- execute.

This commit is contained in:
Christoph Oelckers 2020-10-23 20:28:29 +02:00
parent 8f815f9391
commit ac58dd8017
3 changed files with 28 additions and 36 deletions

View file

@ -259,11 +259,6 @@ inline void ms(short i)
ms(&hittype[i]); ms(&hittype[i]);
} }
inline void execute(DDukeActor* act, int a, int b)
{
execute(act->GetIndex(), a, b);
}
inline void makeitfall(int act) inline void makeitfall(int act)
{ {
makeitfall(&hittype[act]); makeitfall(&hittype[act]);

View file

@ -171,7 +171,7 @@ void showtwoscreens(const CompletionFunc& func);
void doorders(const CompletionFunc& func); void doorders(const CompletionFunc& func);
void LoadActor(DDukeActor* i, int p, int x); void LoadActor(DDukeActor* i, int p, int x);
void execute(int s, int p, int d); void execute(DDukeActor* s, int p, int d);
void makeitfall(DDukeActor* s); void makeitfall(DDukeActor* s);
int furthestangle(DDukeActor* snum, int angDiv); int furthestangle(DDukeActor* snum, int angDiv);
void getglobalz(DDukeActor* s); void getglobalz(DDukeActor* s);

View file

@ -3735,31 +3735,28 @@ void LoadActor(DDukeActor *actor, int p, int x)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void execute(int i,int p,int x) void execute(DDukeActor *actor,int p,int x)
{ {
if (actorinfo[sprite[i].picnum].scriptaddress == 0) return; if (actorinfo[actor->s.picnum].scriptaddress == 0) return;
int done; int done;
spritetype* g_sp;
ParseState s; ParseState s;
s.g_i = i; // Sprite ID
s.g_p = p; // Player ID s.g_p = p; // Player ID
s.g_x = x; // ?? s.g_x = x; // ??
g_sp = s.g_sp = &sprite[i]; // Pointer to sprite structure s.g_ac = actor;
s.g_t = &hittype[i].temp_data[0]; // Sprite's 'extra' data s.g_t = &actor->temp_data[0]; // Sprite's 'extra' data
s.g_ac = &hittype[i];
if (actorinfo[g_sp->picnum].scriptaddress == 0) return; if (actorinfo[actor->s.picnum].scriptaddress == 0) return;
s.insptr = &ScriptCode[4 + (actorinfo[g_sp->picnum].scriptaddress)]; s.insptr = &ScriptCode[4 + (actorinfo[actor->s.picnum].scriptaddress)];
s.killit_flag = 0; s.killit_flag = 0;
if(g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) if(actor->s.sectnum < 0 || actor->s.sectnum >= MAXSECTORS)
{ {
if(badguy(g_sp)) if(badguy(actor))
ps[p].actors_killed++; ps[p].actors_killed++;
deletesprite(i); deletesprite(actor);
return; return;
} }
@ -3771,11 +3768,11 @@ void execute(int i,int p,int x)
int increment = ptr[3]; int increment = ptr[3];
int delay = ptr[4]; int delay = ptr[4];
g_sp->lotag += TICSPERFRAME; actor->s.lotag += TICSPERFRAME;
if (g_sp->lotag > delay) if (actor->s.lotag > delay)
{ {
s.g_t[2]++; s.g_t[2]++;
g_sp->lotag = 0; actor->s.lotag = 0;
s.g_t[3] += increment; s.g_t[3] += increment;
} }
if (abs(s.g_t[3]) >= abs(numframes * increment)) if (abs(s.g_t[3]) >= abs(numframes * increment))
@ -3788,35 +3785,35 @@ void execute(int i,int p,int x)
if(s.killit_flag == 1) if(s.killit_flag == 1)
{ {
// if player was set to squish, first stop that... // if player was set to squish, first stop that..
if(ps[p].actorsqu == &hittype[i]) if(ps[p].actorsqu == actor)
ps[p].actorsqu = nullptr; ps[p].actorsqu = nullptr;
killthesprite = true; killthesprite = true;
} }
else else
{ {
fi.move(s.g_ac, p, x); fi.move(actor, p, x);
if (g_sp->statnum == STAT_ACTOR) if (actor->s.statnum == STAT_ACTOR)
{ {
if (badguy(g_sp)) if (badguy(actor))
{ {
if (g_sp->xrepeat > 60) goto quit; if (actor->s.xrepeat > 60) goto quit;
if (ud.respawn_monsters == 1 && g_sp->extra <= 0) goto quit; if (ud.respawn_monsters == 1 && actor->s.extra <= 0) goto quit;
} }
else if (ud.respawn_items == 1 && (g_sp->cstat & 32768)) goto quit; else if (ud.respawn_items == 1 && (actor->s.cstat & 32768)) goto quit;
if (hittype[i].timetosleep > 1) if (actor->timetosleep > 1)
hittype[i].timetosleep--; actor->timetosleep--;
else if (hittype[i].timetosleep == 1) else if (actor->timetosleep == 1)
changespritestat(i, STAT_ZOMBIEACTOR); changespritestat(actor, STAT_ZOMBIEACTOR);
} }
else if (g_sp->statnum == STAT_STANDABLE) else if (actor->s.statnum == STAT_STANDABLE)
fi.checktimetosleep(s.g_ac); fi.checktimetosleep(actor);
} }
quit: quit:
if (killthesprite) deletesprite(i); if (killthesprite) deletesprite(actor);
killthesprite = false; killthesprite = false;
} }