- function renaming for clarity and easier lookup.

This commit is contained in:
Christoph Oelckers 2021-08-27 16:25:58 +02:00
parent 895ecc81bc
commit 2e37cc627c
10 changed files with 70 additions and 76 deletions

View file

@ -775,13 +775,13 @@ void movefta_d(void)
else s->shade = sector[s->sectnum].floorshade;
act->timetosleep = 0;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
default:
act->timetosleep = 0;
check_fta_sounds_d(act);
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
break;
}
else act->timetosleep = 0;
@ -1586,7 +1586,7 @@ static bool movefireball(DDukeActor* actor)
FireProj proj = { spr->x, spr->y, spr->z, spr->xvel, spr->yvel, spr->zvel };
fire.Insert(ball->GetIndex(), proj);
changespritestat(ball, STAT_PROJECTILE);
changeactorstat(ball, STAT_PROJECTILE);
}
actor->temp_data[0]++;
}
@ -2345,7 +2345,7 @@ static void greenslime(DDukeActor *actor)
if (actor->timetosleep > SLEEPTIME)
{
actor->timetosleep = 0;
changespritestat(actor, 2);
changeactorstat(actor, 2);
return;
}
}
@ -4042,7 +4042,7 @@ void checktimetosleep_d(DDukeActor *actor)
if (actor->timetosleep > 1)
actor->timetosleep--;
else if (actor->timetosleep == 1)
changespritestat(actor, STAT_ZOMBIEACTOR);
changeactorstat(actor, STAT_ZOMBIEACTOR);
break;
}
}

View file

@ -597,7 +597,7 @@ void movefta_r(void)
else s->shade = sector[s->sectnum].floorshade;
act->timetosleep = 0;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
default:
#if 0
@ -606,7 +606,7 @@ void movefta_r(void)
#endif
act->timetosleep = 0;
check_fta_sounds_r(act);
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
break;
}
else act->timetosleep = 0;
@ -624,7 +624,7 @@ void movefta_r(void)
{
act->timetosleep = 0;
check_fta_sounds_r(act);
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
}
}
}
@ -4248,7 +4248,7 @@ void checktimetosleep_r(DDukeActor *actor)
if (actor->timetosleep > 1)
actor->timetosleep--;
else if (actor->timetosleep == 1)
changespritestat(actor, STAT_ZOMBIEACTOR);
changeactorstat(actor, STAT_ZOMBIEACTOR);
break;
}
}

View file

@ -95,17 +95,11 @@ inline int player_struct::GetPlayerNum()
}
// Refactoring helpers/intermediates
inline void changespritestat(DDukeActor* a, int newstat)
inline void changeactorstat(DDukeActor* a, int newstat)
{
::changespritestat(a->GetIndex(), newstat);
}
// The int version also needs to be wrapped due to namespacing issues.
inline void changespritestat(int i, int newstat)
{
::changespritestat(i, newstat);
}
inline void changespritesect(DDukeActor* a, int newsect)
{
::changespritesect(a->GetIndex(), newsect);

View file

@ -3690,7 +3690,7 @@ void LoadActor(DDukeActor *actor, int p, int x)
if (actor->timetosleep > 1)
actor->timetosleep--;
else if (actor->timetosleep == 1)
changespritestat(actor, STAT_ZOMBIEACTOR);
changeactorstat(actor, STAT_ZOMBIEACTOR);
}
else if (actor->s->statnum == 6)
@ -3798,7 +3798,7 @@ void execute(DDukeActor *actor,int p,int x)
if (actor->timetosleep > 1)
actor->timetosleep--;
else if (actor->timetosleep == 1)
changespritestat(actor, STAT_ZOMBIEACTOR);
changeactorstat(actor, STAT_ZOMBIEACTOR);
}
else if (actor->s->statnum == STAT_STANDABLE)

View file

@ -3840,7 +3840,7 @@ HORIZONLY:
S_PlayActorSound(404, clip.actor);
else
check_fta_sounds_r(clip.actor);
changespritestat(clip.actor, 1);
changeactorstat(clip.actor, 1);
}
}
else if (!isRRRA() && clip.actor->s->picnum == RRTILE3410)

View file

@ -1418,7 +1418,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
if (s->statnum == 2)
{
changespritestat(targ, 1);
changeactorstat(targ, 1);
targ->timetosleep = SLEEPTIME;
}
if ((s->xrepeat < 24 || s->picnum == SHARK) && pspr->picnum == SHRINKSPARK) return;

View file

@ -320,7 +320,7 @@ void operaterespawns_r(int low)
}
case RRTILE7424:
if (isRRRA() && !ud.monsters_off)
changespritestat(act, 119);
changeactorstat(act, 119);
break;
}
@ -1718,7 +1718,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case RRTILE8166:
case RRTILE8167:
case RRTILE8168:
changespritestat(targ, STAT_MISC);
changeactorstat(targ, STAT_MISC);
s->picnum = RRTILE5063;
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
break;
@ -1729,7 +1729,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case RRTILE8593:
case RRTILE8594:
case RRTILE8595:
changespritestat(targ, STAT_MISC);
changeactorstat(targ, STAT_MISC);
s->picnum = RRTILE8588;
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
break;
@ -2380,7 +2380,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
if (s->statnum == 2)
{
changespritestat(targ, 1);
changeactorstat(targ, 1);
targ->timetosleep = SLEEPTIME;
}
}

View file

@ -243,7 +243,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
{
// make it go away...
sp->xrepeat = sp->yrepeat = 0;
changespritestat(act, STAT_MISC);
changeactorstat(act, STAT_MISC);
return;
}
@ -256,7 +256,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
if (ud.monsters_off == 1)
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(act, STAT_MISC);
changeactorstat(act, STAT_MISC);
return;
}
@ -273,15 +273,15 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
{
if (actj->s->picnum == RESPAWN)
act->tempang = sp->pal = actj->s->pal;
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
}
else changespritestat(act, STAT_ZOMBIEACTOR);
else changeactorstat(act, STAT_ZOMBIEACTOR);
}
else
{
sp->clipdist = 40;
act->SetOwner(act);
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
}
act->timetosleep = 0;
@ -329,7 +329,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam)
sp->ang = spj->ang;
sp->xvel = 128;
changespritestat(acti, STAT_MISC);
changeactorstat(acti, STAT_MISC);
ssp(acti, CLIPMASK0);
setsprite(acti, sp->x, sp->y, sp->z);
}
@ -357,18 +357,18 @@ int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
updatesector(sp->x - 108, sp->y + 108, &s1);
if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz)
{
sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true;
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return true;
}
}
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true; }
else { sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return true; }
}
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true; }
else { sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return true; }
}
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true; }
else { sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return true; }
if (sector[sp->sectnum].lotag == 1)
{
changespritestat(acti, STAT_MISC);
changeactorstat(acti, STAT_MISC);
return true;
}
return false;
@ -401,7 +401,7 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
updatesector(sp->x - 84, sp->y + 84, &s1);
if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz)
{
sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return;
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return;
}
}
else { sp->xrepeat = sp->yrepeat = 0; return; }
@ -419,7 +419,7 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
sp->xrepeat = sp->yrepeat = 32;
insertspriteq(acti);
changespritestat(acti, STAT_MISC);
changeactorstat(acti, STAT_MISC);
}
//---------------------------------------------------------------------------
@ -472,7 +472,7 @@ void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell)
sp->xrepeat = sp->yrepeat = isRR() && isshell? 2 : 4;
changespritestat(acti, STAT_MISC);
changeactorstat(acti, STAT_MISC);
}
}
@ -526,7 +526,7 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
tempwallptr += 3;
acti->SetOwner(nullptr);
sp->extra = 8;
changespritestat(acti, STAT_STANDABLE);
changeactorstat(acti, STAT_STANDABLE);
}
//---------------------------------------------------------------------------
@ -561,7 +561,7 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
}
sp->xrepeat = 24;
sp->yrepeat = 24;
changespritestat(actor, STAT_STANDABLE);
changeactorstat(actor, STAT_STANDABLE);
}
@ -581,7 +581,7 @@ int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
if (sp->lotag > ud.player_skill)
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(actor, STAT_MISC);
changeactorstat(actor, STAT_MISC);
return true;
}
if (!isRR() || actorflag(actor, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill.
@ -590,7 +590,7 @@ int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
if (ud.monsters_off == 1)
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(actor, STAT_MISC);
changeactorstat(actor, STAT_MISC);
return false;
}
sp->extra = 130;
@ -603,13 +603,13 @@ int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
if (ud.multimode < 2 && sp->pal != 0)
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(actor, STAT_MISC);
changeactorstat(actor, STAT_MISC);
return false;
}
sp->pal = 0;
sp->shade = -17;
changespritestat(actor, 2);
changeactorstat(actor, 2);
return false;
}
@ -654,7 +654,7 @@ void spawneffector(DDukeActor* actor)
t[4] = sector[sect].floorz == sp->z;
sp->cstat = 0;
changespritestat(actor, STAT_TRANSPORT);
changeactorstat(actor, STAT_TRANSPORT);
return;
case SE_1_PIVOT:
actor->SetOwner(nullptr);
@ -1110,9 +1110,9 @@ void spawneffector(DDukeActor* actor)
if ((!isRR() && actor->s->lotag >= 40 && actor->s->lotag <= 45) ||
(isRRRA() && actor->s->lotag >= 150 && actor->s->lotag <= 155))
changespritestat(actor, STAT_RAROR);
changeactorstat(actor, STAT_RAROR);
else
changespritestat(actor, STAT_EFFECTOR);
changeactorstat(actor, STAT_EFFECTOR);
}

View file

@ -96,7 +96,7 @@ int spawn_d(int j, int pn)
if ((sp->lotag > ud.player_skill) || ud.monsters_off)
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(act, STAT_MISC);
changeactorstat(act, STAT_MISC);
break;
}
else
@ -1026,10 +1026,10 @@ int spawn_d(int j, int pn)
sp->shade = -17;
if(j >= 0) changespritestat(act, STAT_ACTOR);
if(j >= 0) changeactorstat(act, STAT_ACTOR);
else
{
changespritestat(act, STAT_ZOMBIEACTOR);
changeactorstat(act, STAT_ZOMBIEACTOR);
makeitfall(act);
}
break;
@ -1044,12 +1044,12 @@ int spawn_d(int j, int pn)
case BOX:
sp->cstat = 257; // Make it hitable
sp->extra = 1;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case FLOORFLAME:
sp->shade = -127;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case BOUNCEMINE:
@ -1058,7 +1058,7 @@ int spawn_d(int j, int pn)
sp->xrepeat = sp->yrepeat = 24;
sp->shade = -127;
sp->extra = gs.impact_damage<<2;
changespritestat(act, STAT_ZOMBIEACTOR);
changeactorstat(act, STAT_ZOMBIEACTOR);
break;
case CAMERA1:
@ -1116,7 +1116,7 @@ int spawn_d(int j, int pn)
else sp->cstat = 1+256;
sp->extra = gs.impact_damage<<2;
act->SetOwner(act);
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case CRACK1:
@ -1144,7 +1144,7 @@ int spawn_d(int j, int pn)
sp->pal = 0;
act->SetOwner(act);
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
sp->xvel = 8;
ssp(act, CLIPMASK0);
break;
@ -1182,7 +1182,7 @@ int spawn_d(int j, int pn)
if( ud.monsters_off == 1 && sp->picnum == EGG )
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(act, STAT_MISC);
changeactorstat(act, STAT_MISC);
}
else
{
@ -1192,12 +1192,12 @@ int spawn_d(int j, int pn)
ps[connecthead].max_actors_killed++;
}
sp->cstat = 257|(krand()&4);
changespritestat(act, STAT_ZOMBIEACTOR);
changeactorstat(act, STAT_ZOMBIEACTOR);
}
break;
case TOILETWATER:
sp->shade = -16;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
}
return i;

View file

@ -156,7 +156,7 @@ int spawn_r(int j, int pn)
sp->clipdist = 0;
act->SetOwner(act);
sp->extra = 0;
changespritestat(act,115);
changeactorstat(act,115);
break;
case RRTILE8593:
if (!isRRRA()) goto default_case;
@ -164,7 +164,7 @@ int spawn_r(int j, int pn)
sp->clipdist = 0;
act->SetOwner(act);
sp->extra = 0;
changespritestat(act,122);
changeactorstat(act,122);
break;
case RRTILE285:
case RRTILE286:
@ -1052,10 +1052,10 @@ int spawn_r(int j, int pn)
{
act->timetosleep = 0;
check_fta_sounds_r(act);
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
sp->shade = spj->shade;
}
else changespritestat(act, STAT_ZOMBIEACTOR);
else changeactorstat(act, STAT_ZOMBIEACTOR);
}
@ -1063,7 +1063,7 @@ int spawn_r(int j, int pn)
case LOCATORS:
// sp->xrepeat=sp->yrepeat=0;
sp->cstat |= 32768;
changespritestat(act, STAT_LOCATOR);
changeactorstat(act, STAT_LOCATOR);
break;
case ACTIVATORLOCKED:
@ -1072,13 +1072,13 @@ int spawn_r(int j, int pn)
sp->cstat |= 32768;
if (sp->picnum == ACTIVATORLOCKED)
sector[sect].lotag ^= 16384;
changespritestat(act, STAT_ACTIVATOR);
changeactorstat(act, STAT_ACTIVATOR);
break;
case DOORSHOCK:
sp->cstat |= 1+256;
sp->shade = -12;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case OOZ:
@ -1088,7 +1088,7 @@ int spawn_r(int j, int pn)
if( spj->picnum == NUKEBARREL )
sp->pal = 8;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
getglobalz(act);
@ -1172,7 +1172,7 @@ int spawn_r(int j, int pn)
if( ( ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill) )
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(act, STAT_MISC);
changeactorstat(act, STAT_MISC);
break;
}
@ -1198,10 +1198,10 @@ int spawn_r(int j, int pn)
sp->shade = -17;
if(j >= 0) changespritestat(act, STAT_ACTOR);
if(j >= 0) changeactorstat(act, STAT_ACTOR);
else
{
changespritestat(act, STAT_ZOMBIEACTOR);
changeactorstat(act, STAT_ZOMBIEACTOR);
makeitfall(act);
}
switch (sp->picnum)
@ -1358,7 +1358,7 @@ int spawn_r(int j, int pn)
ssp(act, CLIPMASK0);
}
case CEILINGSTEAM:
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case SECTOREFFECTOR:
spawneffector(act);
@ -1376,7 +1376,7 @@ int spawn_r(int j, int pn)
else sp->cstat = 1+256;
sp->extra = gs.impact_damage<<2;
act->SetOwner(act);
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case CRACK1:
@ -1394,7 +1394,7 @@ int spawn_r(int j, int pn)
sp->pal = 0;
act->SetOwner(act);
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
sp->xvel = 8;
ssp(act, CLIPMASK0);
break;
@ -1413,7 +1413,7 @@ int spawn_r(int j, int pn)
act->saved_ammo = 100;
sp->cstat = 257;
sp->lotag = 1;
changespritestat(act, STAT_ACTOR);
changeactorstat(act, STAT_ACTOR);
break;
case EMPTYBOAT:
if (!isRRRA()) goto default_case;
@ -1464,19 +1464,19 @@ int spawn_r(int j, int pn)
if( ud.monsters_off == 1 && sp->picnum == EGG )
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(act, STAT_MISC);
changeactorstat(act, STAT_MISC);
}
else
{
if(sp->picnum == EGG)
sp->clipdist = 24;
sp->cstat = 257|(krand()&4);
changespritestat(act, STAT_ZOMBIEACTOR);
changeactorstat(act, STAT_ZOMBIEACTOR);
}
break;
case TOILETWATER:
sp->shade = -16;
changespritestat(act, STAT_STANDABLE);
changeactorstat(act, STAT_STANDABLE);
break;
case RRTILE63:
sp->cstat |= 32768;