Merge branch 'driftspark-pulse-on-charge' into backup-driftspark-pulse-on-charge

This commit is contained in:
Ashnal authored and Lonsfor committed 2022-10-03 15:50:06 -03:00
1 parent a12aaf40ce
commit 61683c96a3
7 files changed
+73 -12

No files matched your search

+5
View File
@@ -2323,6 +2323,8 @@ static void Command_StopMovie_f(void)
INT32 mapchangepending = 0;
tic_t driftsparkGrowTimer[MAXPLAYERS];
/** Runs a map change.
* The supplied data are assumed to be good. If provided by a user, they will
* have already been checked in Command_Map_f().
@@ -2356,6 +2358,9 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d encoremode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
mapnum, newgametype, pencoremode, resetplayers, delay, skipprecutscene);
// just gonna hack in a timer reset here...
memset(driftsparkGrowTimer, 0, sizeof(driftsparkGrowTimer));
if (netgame || multiplayer)
FLS = false;
+2
View File
@@ -231,6 +231,8 @@ typedef union {
#pragma pack()
#endif
extern tic_t driftsparkGrowTimer[16];
// add game commands, needs cleanup
void D_RegisterServerCommands(void);
void D_RegisterClientCommands(void);
+2
View File
@@ -526,6 +526,8 @@ consvar_t cv_driftaxis4 = {"joyaxis4_drift", "None", CV_SAVE, joyaxis_cons_t, NU
consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#if MAXPLAYERS > 16
#error "please update player_name table using the new value for MAXPLAYERS"
+2
View File
@@ -124,6 +124,8 @@ extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_xdeadzone4,cv_ydeadzone4;
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
extern consvar_t cv_driftsparkpulse;
typedef enum
{
AXISNONE = 0,
+58 -12
View File
@@ -2798,6 +2798,8 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
return NULL;
}
#define DRIFTSPARKGROWTICS 8
static void K_SpawnDriftSparks(player_t *player)
{
fixed_t newx;
@@ -2823,14 +2825,28 @@ static void K_SpawnDriftSparks(player_t *player)
for (i = 0; i < 2; i++)
{
UINT8 pindex;
fixed_t driftExtraScale = 0;
newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(32*FRACUNIT, player->mo->scale));
newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(32*FRACUNIT, player->mo->scale));
spark = P_SpawnMobj(newx, newy, player->mo->z, MT_DRIFTSPARK);
P_SetTarget(&spark->target, player->mo);
spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift];
spark->destscale = player->mo->scale;
P_SetScale(spark, player->mo->scale);
// scale increase while driftspark level gained timer is running
// hack to find the correct player number
for (pindex = 0; pindex < MAXPLAYERS; pindex++)
{
if (player == &players[pindex])
{
driftExtraScale = FixedDiv(driftsparkGrowTimer[pindex], DRIFTSPARKGROWTICS);
break;
}
}
spark->destscale = FixedMul(player->mo->scale, FRACUNIT + FixedMul(driftExtraScale, cv_driftsparkpulse.value));
P_SetScale(spark, FixedMul(player->mo->scale, FRACUNIT + FixedMul(driftExtraScale, cv_driftsparkpulse.value)));
spark->momx = player->mo->momx/2;
spark->momy = player->mo->momy/2;
@@ -5196,24 +5212,54 @@ static void K_KartDrift(player_t *player, boolean onground)
if (player->speed > minspeed*2)
player->kartstuff[k_getsparks] = 1;
// Sound whenever you get a different tier of sparks
if ((player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone)
|| (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo)
|| (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree))
{
UINT8 pindex;
//S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH...
S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh...
// hack to find the correct player number
for (pindex = 0; pindex < MAXPLAYERS; pindex++)
{
if (player == &players[pindex])
{
driftsparkGrowTimer[pindex] = DRIFTSPARKGROWTICS;
break;
}
}
}
// moved this below sounds to help with scaling
// This spawns the drift sparks
if (player->kartstuff[k_driftcharge] + driftadditive >= dsone)
K_SpawnDriftSparks(player);
// Sound whenever you get a different tier of sparks
if (P_IsLocalPlayer(player) // UGHGHGH...
&& ((player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone)
|| (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo)
|| (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree)))
{
//S_StartSound(player->mo, sfx_s3ka2);
S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh...
}
player->kartstuff[k_driftcharge] += driftadditive;
player->kartstuff[k_driftend] = 0;
}
{
//im putting this in a block because i want the variables here, not at the top of the block
UINT8 pindex;
// hack to find the correct player number
for (pindex = 0; pindex < MAXPLAYERS; pindex++)
{
if (player == &players[pindex])
{
if (driftsparkGrowTimer[pindex])
driftsparkGrowTimer[pindex]--;
break;
}
}
}
// Stop drifting
if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed)
{
+2
View File
@@ -1271,6 +1271,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 90},
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 100},
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 110},
{IT_STRING | IT_CVAR, NULL, "Drift spark pulse size",&cv_driftsparkpulse, 125},
#ifdef HWRENDER
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 130},
@@ -1292,6 +1293,7 @@ enum
op_video_fps,
op_video_vsync,
op_video_fpscap,
op_video_driftsparkpulse,
#ifdef HWRENDER
op_video_ogl,
#endif
+2
View File
@@ -1520,6 +1520,8 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_cam4_rotate);
CV_RegisterVar(&cv_cam4_rotspeed);
CV_RegisterVar(&cv_driftsparkpulse);
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);