diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index fd33b236c..e3df0294d 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -48,7 +48,7 @@ This file is a combination of code from the following sources: BEGIN_DUKE_NS -int adjustfall(spritetype* s, int c); +int adjustfall(DDukeActor* s, int c); //--------------------------------------------------------------------------- @@ -5030,10 +5030,10 @@ void getglobalz(DDukeActor* actor) // //--------------------------------------------------------------------------- -void makeitfall(int i) +void makeitfall(DDukeActor* actor) { - spritetype *s = &sprite[i]; - int hz,lz,c; + auto s = &actor->s; + int c; if( fi.floorspace(s->sectnum) ) c = 0; @@ -5046,18 +5046,21 @@ void makeitfall(int i) if (isRRRA()) { - c = adjustfall(s, c); // this accesses sprite indices and cannot be in shared code. Should be done better. + c = adjustfall(actor, c); // this accesses sprite indices and cannot be in shared code. Should be done better. } - if( ( s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE ) ) - getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[i].ceilingz,&hz,&hittype[i].floorz,&lz,127L,CLIPMASK0); + if ((s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE)) + { + Collision c; + getzrange_ex(s->x, s->y, s->z - (FOURSLEIGHT), s->sectnum, &actor->ceilingz, c, &actor->floorz, c, 127, CLIPMASK0); + } else { - hittype[i].ceilingz = sector[s->sectnum].ceilingz; - hittype[i].floorz = sector[s->sectnum].floorz; + actor->ceilingz = sector[s->sectnum].ceilingz; + actor->floorz = sector[s->sectnum].floorz; } - if( s->z < hittype[i].floorz-(FOURSLEIGHT) ) + if( s->z < actor->floorz-(FOURSLEIGHT) ) { if( sector[s->sectnum].lotag == 2 && s->zvel > 3122 ) s->zvel = 3144; @@ -5066,9 +5069,9 @@ void makeitfall(int i) else s->zvel = 6144; s->z += s->zvel; } - if( s->z >= hittype[i].floorz-(FOURSLEIGHT) ) + if( s->z >= actor->floorz-(FOURSLEIGHT) ) { - s->z = hittype[i].floorz - FOURSLEIGHT; + s->z = actor->floorz - FOURSLEIGHT; s->zvel = 0; } } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index beb84bb15..49261e81f 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3734,11 +3734,11 @@ void moveeffectors_r(void) //STATNUM 3 // //--------------------------------------------------------------------------- -int adjustfall(spritetype *s, int c) +int adjustfall(DDukeActor *actor, int c) { - if ((s->picnum == BIKERB || s->picnum == CHEERB) && c == gc) + if ((actor->s.picnum == BIKERB || actor->s.picnum == CHEERB) && c == gc) c = gc>>2; - else if (s->picnum == BIKERBV2 && c == gc) + else if (actor->s.picnum == BIKERBV2 && c == gc) c = gc>>3; return c; } diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index 93427361d..16f92b446 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -259,9 +259,9 @@ inline void execute(DDukeActor* act, int a, int b) execute(act->GetIndex(), a, b); } -inline void makeitfall(DDukeActor* act) +inline void makeitfall(int act) { - makeitfall(act->GetIndex()); + makeitfall(&hittype[act]); } inline void getglobalz(int act) diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 1c5f4f542..23e9a28b5 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -170,7 +170,7 @@ void doorders(const CompletionFunc& func); void LoadActor(int i, int p, int x); void execute(int s, int p, int d); -void makeitfall(int s); +void makeitfall(DDukeActor* s); int furthestangle(int snum, int angDiv); void getglobalz(DDukeActor* s); void OnEvent(int id, int pnum = -1, int snum = -1, int dist = -1);