Factor out modification of DukePlayer_t->actors_killed into P_AddKills().

git-svn-id: https://svn.eduke32.com/eduke32@6319 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-07-05 05:37:58 +00:00
parent 9fdfd10723
commit 57a7802f6c
4 changed files with 13 additions and 7 deletions

View file

@ -3947,7 +3947,7 @@ ACTOR_STATIC void G_MoveActors(void)
int const newSprite = A_Spawn(spriteNum, EXPLOSION2); int const newSprite = A_Spawn(spriteNum, EXPLOSION2);
A_PlaySound(LASERTRIP_EXPLODE, newSprite); A_PlaySound(LASERTRIP_EXPLODE, newSprite);
A_Spawn(spriteNum, PIGCOP); A_Spawn(spriteNum, PIGCOP);
g_player[myconnectindex].ps->actors_killed++; P_AddKills(g_player[myconnectindex].ps, 1);
DELETE_SPRITE_AND_CONTINUE(spriteNum); DELETE_SPRITE_AND_CONTINUE(spriteNum);
} }
@ -4173,7 +4173,7 @@ ACTOR_STATIC void G_MoveActors(void)
if (damageTile == FREEZEBLAST) if (damageTile == FREEZEBLAST)
goto next_sprite; goto next_sprite;
pPlayer->actors_killed++; P_AddKills(pPlayer, 1);
for (bssize_t j = 16; j >= 0; --j) for (bssize_t j = 16; j >= 0; --j)
{ {
@ -4234,7 +4234,7 @@ ACTOR_STATIC void G_MoveActors(void)
sprite[j].pal = 0; sprite[j].pal = 0;
} }
pPlayer->actors_killed++; P_AddKills(pPlayer, 1);
pData[0] = -3; pData[0] = -3;
if (pPlayer->somethingonplayer == spriteNum) if (pPlayer->somethingonplayer == spriteNum)
@ -4315,7 +4315,7 @@ ACTOR_STATIC void G_MoveActors(void)
goto next_sprite; goto next_sprite;
} }
pPlayer->actors_killed++; P_AddKills(pPlayer, 1);
if ((krand()&255) < 32) if ((krand()&255) < 32)
{ {

View file

@ -1728,7 +1728,7 @@ skip_check:
case CON_ADDKILLS: case CON_ADDKILLS:
insptr++; insptr++;
pPlayer->actors_killed += *insptr++; P_AddKills(pPlayer, *insptr++);
vm.pActor->actorstayput = -1; vm.pActor->actorstayput = -1;
continue; continue;
@ -5898,7 +5898,7 @@ void A_Execute(int spriteNum, int playerNum, int playerDist)
if (EDUKE32_PREDICT_FALSE((unsigned)vm.pSprite->sectnum >= MAXSECTORS)) if (EDUKE32_PREDICT_FALSE((unsigned)vm.pSprite->sectnum >= MAXSECTORS))
{ {
if (A_CheckEnemySprite(vm.pSprite)) if (A_CheckEnemySprite(vm.pSprite))
vm.pPlayer->actors_killed++; P_AddKills(vm.pPlayer, 1);
A_DeleteSprite(vm.spriteNum); A_DeleteSprite(vm.spriteNum);
return; return;

View file

@ -40,6 +40,11 @@ extern int32_t g_levelTextTime, ticrandomseed;
int32_t g_numObituaries = 0; int32_t g_numObituaries = 0;
int32_t g_numSelfObituaries = 0; int32_t g_numSelfObituaries = 0;
void P_AddKills(DukePlayer_t * const pPlayer, uint16_t kills)
{
pPlayer->actors_killed += kills;
}
void P_UpdateScreenPal(DukePlayer_t * const pPlayer) void P_UpdateScreenPal(DukePlayer_t * const pPlayer)
{ {
int inWater = 0; int inWater = 0;
@ -5408,7 +5413,7 @@ HORIZONLY:;
} }
default: default:
if (A_CheckEnemySprite(&sprite[pPlayer->actorsqu])) if (A_CheckEnemySprite(&sprite[pPlayer->actorsqu]))
pPlayer->actors_killed++; P_AddKills(pPlayer, 1);
A_DeleteSprite(pPlayer->actorsqu); A_DeleteSprite(pPlayer->actorsqu);
break; break;
} }

View file

@ -336,6 +336,7 @@ static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_
} }
} }
void P_AddKills(DukePlayer_t * const pPlayer, uint16_t kills);
int32_t A_GetHitscanRange(int spriteNum); int32_t A_GetHitscanRange(int spriteNum);
void P_GetInput(int playerNum); void P_GetInput(int playerNum);
void P_AddAmmo(DukePlayer_t * const pPlayer, int const weaponNum, int const addAmount); void P_AddAmmo(DukePlayer_t * const pPlayer, int const weaponNum, int const addAmount);