diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 8dfd52ae3..124a5ec2b 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2596,6 +2596,38 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void gutsdir(DDukeActor* actor, short gtype, short n, short p) +{ + int sx, sy; + + if (badguy(actor) && actor->s.xrepeat < 16) + sx = sy = 8; + else sx = sy = 32; + + int gutz = actor->s.z - (8 << 8); + int floorz = getflorzofslope(actor->s.sectnum, actor->s.x, actor->s.y); + + if (gutz > (floorz - (8 << 8))) + gutz = floorz - (8 << 8); + + gutz += actorinfo[actor->s.picnum].gutsoffset; + + for (int j = 0; j < n; j++) + { + int a = krand() & 2047; + int r1 = krand(); + int r2 = krand(); + // TRANSITIONAL: owned by a player??? + EGS(actor->s.sectnum, actor->s.x, actor->s.y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].GetActor(), 5); + } +} + //--------------------------------------------------------------------------- // // taken out of moveeffectors @@ -2981,7 +3013,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) updatesector(a2->s.x, a2->s.y, &k); if (a2->s.extra >= 0 && k == s->sectnum) { - fi.gutsdir(&a2->s, JIBS6, 72, myconnectindex); + gutsdir(a2, JIBS6, 72, myconnectindex); S_PlayActorSound(SQUISHED, actor); deletesprite(a2); } @@ -3171,7 +3203,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) updatesector(a2->s.x, a2->s.y, &k); if (a2->s.extra >= 0 && k == s->sectnum) { - fi.gutsdir(&a2->s, JIBS6, 24, myconnectindex); + gutsdir(a2, JIBS6, 24, myconnectindex); S_PlayActorSound(SQUISHED, a2); deletesprite(a2); } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index bfe21e2dd..6f835ae4b 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -666,8 +666,7 @@ void guts_d(spritetype* s, short gtype, short n, short p) if (gutz > (floorz - (8 << 8))) gutz = floorz - (8 << 8); - if (s->picnum == COMMANDER) - gutz -= (24 << 8); + gutz += actorinfo[s->picnum].gutsoffset; if (badguy(s) && s->pal == 6) pal = 6; @@ -698,39 +697,6 @@ void guts_d(spritetype* s, short gtype, short n, short p) } } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void gutsdir_d(spritetype* s, short gtype, short n, short p) -{ - int sx, sy; - - if (badguy(s) && s->xrepeat < 16) - sx = sy = 8; - else sx = sy = 32; - - int gutz = s->z - (8 << 8); - int floorz = getflorzofslope(s->sectnum, s->x, s->y); - - if (gutz > (floorz - (8 << 8))) - gutz = floorz - (8 << 8); - - if (s->picnum == COMMANDER) - gutz -= (24 << 8); - - for (int j = 0; j < n; j++) - { - int a = krand() & 2047; - int r1 = krand(); - int r2 = krand(); - // TRANSITIONAL: owned by a player??? - EGS(s->sectnum, s->x, s->y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].i, 5); - } -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 9f569bb34..ec720f34f 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -486,6 +486,8 @@ void guts_r(spritetype* s, short gtype, short n, short p) if (gutz > (floorz - (8 << 8))) gutz = floorz - (8 << 8); + gutz += actorinfo[s->picnum].gutsoffset; + if (badguy(s) && s->pal == 6) pal = 6; else @@ -519,38 +521,6 @@ void guts_r(spritetype* s, short gtype, short n, short p) // //--------------------------------------------------------------------------- -void gutsdir_r(spritetype* s, short gtype, short n, short p) -{ - int gutz, floorz; - short i, j; - char sx, sy; - - if (badguy(s) && s->xrepeat < 16) - sx = sy = 8; - else sx = sy = 32; - - gutz = s->z - (8 << 8); - floorz = getflorzofslope(s->sectnum, s->x, s->y); - - if (gutz > (floorz - (8 << 8))) - gutz = floorz - (8 << 8); - - for (j = 0; j < n; j++) - { - int a = krand() & 2047; - int r1 = krand(); - int r2 = krand(); - // TRANSITIONAL: owned by a player??? - i = EGS(s->sectnum, s->x, s->y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].i, 5); - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void movefta_r(void) { int x, px, py, sx, sy; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index bb51c49f4..7e5d48aa9 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -72,8 +72,6 @@ void lotsofpaper_d(DDukeActor* s, short n); void lotsoffeathers_r(DDukeActor* s, short n); void guts_d(spritetype* s, short gtype, short n, short p); void guts_r(spritetype* s, short gtype, short n, short p); -void gutsdir_d(spritetype* s, short gtype, short n, short p); -void gutsdir_r(spritetype* s, short gtype, short n, short p); int ifhitsectors_d(int sectnum); int ifhitsectors_r(int sectnum); int ifhitbyweapon_r(DDukeActor* sn); @@ -155,7 +153,6 @@ void SetDispatcher() lotsofmail_d, lotsofpaper_d, guts_d, - gutsdir_d, ifhitsectors_d, ifhitbyweapon_d, fall_d, @@ -207,7 +204,6 @@ void SetDispatcher() lotsoffeathers_r, lotsoffeathers_r, guts_r, - gutsdir_r, ifhitsectors_r, ifhitbyweapon_r, fall_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index dfaa6e20c..5b07ea072 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -93,7 +93,6 @@ struct Dispatcher void (*lotsofmail)(DDukeActor *s, short n); void (*lotsofpaper)(DDukeActor *s, short n); void (*guts)(spritetype* s, short gtype, short n, short p); - void (*gutsdir)(spritetype* s, short gtype, short n, short p); int (*ifhitsectors)(int sectnum); int (*ifhitbyweapon)(DDukeActor* sectnum); void (*fall)(int g_i, int g_p); diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 11f2dec90..4e7e04e74 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -40,6 +40,8 @@ BEGIN_DUKE_NS void initactorflags_d() { + actorinfo[COMMANDER].gutsoffset = -(24 << 8); + setflag(SFLAG_INTERNAL_BADGUY, { SHARK, RECON, diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index d62fcae1f..afaeff7a7 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -104,6 +104,7 @@ struct ActorInfo uint32_t scriptaddress; uint32_t flags; int aimoffset; + int gutsoffset; }; // for now just flags not related to actors, may get more info later.