- consolidated gutsdir functions by making the spawn offset for Duke's commander an actor property.

This commit is contained in:
Christoph Oelckers 2020-10-22 00:05:08 +02:00
parent 80aab4b5f7
commit 3e62550489
7 changed files with 40 additions and 74 deletions

View File

@ -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);
}

View File

@ -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);
}
}
//---------------------------------------------------------------------------
//
//

View File

@ -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;

View File

@ -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,

View File

@ -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);

View File

@ -40,6 +40,8 @@ BEGIN_DUKE_NS
void initactorflags_d()
{
actorinfo[COMMANDER].gutsoffset = -(24 << 8);
setflag(SFLAG_INTERNAL_BADGUY, {
SHARK,
RECON,

View File

@ -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.