turn driftsparkGrowTimer into a player field
less hacky and avoids 3 loops lol
This commit is contained in:
1 parent
02b411f7ee
commit
ac8e25865e
5 files changed
+8
-44
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -551,6 +551,8 @@ typedef struct player_s
|
||||
|
||||
UINT8 splitscreenindex;
|
||||
|
||||
tic_t driftsparkGrowTimer;
|
||||
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
} player_t;
|
||||
|
||||
|
||||
+4
-37
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user