diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1496b9eb8..fdf913778 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2428,8 +2428,6 @@ 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(). @@ -2463,9 +2461,6 @@ 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; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 63839cf12..4ec6f43ba 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -295,8 +295,6 @@ typedef union { #pragma pack() #endif -extern tic_t driftsparkGrowTimer[16]; - // add game commands, needs cleanup void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); diff --git a/src/d_player.h b/src/d_player.h index d6702e2c0..0991144fb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -551,6 +551,8 @@ typedef struct player_s UINT8 splitscreenindex; + tic_t driftsparkGrowTimer; + fixed_t fovadd; // adjust FOV for hw rendering } player_t; diff --git a/src/k_kart.c b/src/k_kart.c index 7e3179772..6ef1ec594 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3242,7 +3242,6 @@ 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)); @@ -3252,16 +3251,7 @@ static void K_SpawnDriftSparks(player_t *player) spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift]; // 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; - } - } + driftExtraScale = FixedDiv(player->driftsparkGrowTimer, DRIFTSPARKGROWTICS); 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))); @@ -6041,7 +6031,6 @@ static void K_KartDrift(player_t *player, boolean onground) player->kartstuff[k_driftend] = 0; } - // Incease/decrease the drift value to continue drifting in that direction if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0) { @@ -6081,20 +6070,11 @@ static void K_KartDrift(player_t *player, boolean onground) || (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; - } - } + player->driftsparkGrowTimer = DRIFTSPARKGROWTICS; } @@ -6107,21 +6087,8 @@ static void K_KartDrift(player_t *player, boolean onground) 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; - } - } - } + if (player->driftsparkGrowTimer) + player->driftsparkGrowTimer--; // Stop drifting if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed) diff --git a/src/p_setup.c b/src/p_setup.c index f4c34c17e..4503dad62 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2122,6 +2122,8 @@ static void P_LevelInitStuff(boolean reloadinggamestate) players[i].laptime[j] = 0; } + players[i].driftsparkGrowTimer = 0; + players[i].gotcontinue = false; players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0;