- switched the checkhitsprite interface to actors.

This commit is contained in:
Christoph Oelckers 2020-10-24 07:15:10 +02:00
parent 30f4057451
commit 4258c27248
9 changed files with 19 additions and 29 deletions

View file

@ -1523,7 +1523,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
} }
else if (j == kHitSprite) else if (j == kHitSprite)
{ {
fi.checkhitsprite(actor->GetIndex(), coll.actor->GetIndex()); fi.checkhitsprite(actor, coll.actor);
} }
s->xvel--; s->xvel--;

View file

@ -424,7 +424,7 @@ SKIPWALLCHECK:
{ {
if (badguy(act2) && !cansee(spri2->x, spri2->y, spri2->z + q, spri2->sectnum, spri->x, spri->y, spri->z + q, spri->sectnum)) if (badguy(act2) && !cansee(spri2->x, spri2->y, spri2->z + q, spri2->sectnum, spri->x, spri->y, spri->z + q, spri->sectnum))
continue; continue;
fi.checkhitsprite(act2->GetIndex(), actor->GetIndex()); fi.checkhitsprite(act2, actor);
} }
} }
else if (spri2->extra >= 0 && act2 != actor && (spri2->picnum == TRIPBOMB || badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD)) else if (spri2->extra >= 0 && act2 != actor && (spri2->picnum == TRIPBOMB || badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD))
@ -500,7 +500,7 @@ SKIPWALLCHECK:
spri2->picnum == FEM8 || spri2->picnum == FEM9 || spri2->picnum == FEM8 || spri2->picnum == FEM9 ||
spri2->picnum == FEM10 || spri2->picnum == STATUE || spri2->picnum == FEM10 || spri2->picnum == STATUE ||
spri2->picnum == STATUEFLASH || spri2->picnum == SPACEMARINE || spri2->picnum == QUEBALL || spri2->picnum == STRIPEBALL) spri2->picnum == STATUEFLASH || spri2->picnum == SPACEMARINE || spri2->picnum == QUEBALL || spri2->picnum == STRIPEBALL)
fi.checkhitsprite(act2->GetIndex(), actor->GetIndex()); fi.checkhitsprite(act2, actor);
} }
else if (spri->extra == 0) act2->extra = 0; else if (spri->extra == 0) act2->extra = 0;
@ -1629,7 +1629,7 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball)
} }
if (!isWorldTour() || s->picnum != FIREBALL || fireball) if (!isWorldTour() || s->picnum != FIREBALL || fireball)
fi.checkhitsprite(targ->GetIndex(), proj->GetIndex()); fi.checkhitsprite(targ, proj);
if (targ->s.picnum == APLAYER) if (targ->s.picnum == APLAYER)
{ {
@ -2802,7 +2802,7 @@ static void flamethrowerflame(DDukeActor *actor)
s->xvel = s->yvel = s->zvel = 0; s->xvel = s->yvel = s->zvel = 0;
if (coll.type == kHitSprite) if (coll.type == kHitSprite)
{ {
fi.checkhitsprite(coll.actor->GetIndex(), actor->GetIndex()); fi.checkhitsprite(coll.actor, actor);
if (coll.actor->s.picnum == APLAYER) if (coll.actor->s.picnum == APLAYER)
S_PlayActorSound(actor->GetIndex(), PISTOL_BODYHIT); S_PlayActorSound(actor->GetIndex(), PISTOL_BODYHIT);
} }

View file

@ -291,7 +291,7 @@ SKIPWALLCHECK:
{ {
continue; continue;
} }
fi.checkhitsprite(act2->GetIndex(), actor->GetIndex()); fi.checkhitsprite(act2, actor);
} }
} }
else if (spri2->extra >= 0 && act2 != actor && (badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == RRTILE3440 || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD)) else if (spri2->extra >= 0 && act2 != actor && (badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == RRTILE3440 || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD))
@ -352,7 +352,7 @@ SKIPWALLCHECK:
if (spri2->picnum == STATUEFLASH || spri2->picnum == QUEBALL || if (spri2->picnum == STATUEFLASH || spri2->picnum == QUEBALL ||
spri2->picnum == STRIPEBALL || spri2->picnum == RRTILE3440) spri2->picnum == STRIPEBALL || spri2->picnum == RRTILE3440)
fi.checkhitsprite(act2->GetIndex(), actor->GetIndex()); fi.checkhitsprite(act2, actor);
if (spri2->picnum != RADIUSEXPLOSION && if (spri2->picnum != RADIUSEXPLOSION &&
Owner && Owner->s.statnum < MAXSTATUS) Owner && Owner->s.statnum < MAXSTATUS)
@ -1182,7 +1182,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &ol
return true; return true;
} }
fi.checkhitsprite(targ->GetIndex(), proj->GetIndex()); fi.checkhitsprite(targ, proj);
if (targ->s.picnum == APLAYER) if (targ->s.picnum == APLAYER)
{ {
@ -2807,7 +2807,7 @@ static int henstand(DDukeActor *actor)
else if (coll.type == kHitSprite) else if (coll.type == kHitSprite)
{ {
auto hitact = coll.actor; auto hitact = coll.actor;
fi.checkhitsprite(actor->GetIndex(), hitact->GetIndex()); fi.checkhitsprite(actor, hitact);
if (hitact->s.picnum == HEN) if (hitact->s.picnum == HEN)
{ {
auto ns = spawn(hitact, HENSTAND); auto ns = spawn(hitact, HENSTAND);

View file

@ -53,8 +53,8 @@ void checkplayerhurt_d(struct player_struct* p, int j);
void checkplayerhurt_r(struct player_struct* p, int j); void checkplayerhurt_r(struct player_struct* p, int j);
bool checkhitceiling_d(int sn); bool checkhitceiling_d(int sn);
bool checkhitceiling_r(int sn); bool checkhitceiling_r(int sn);
void checkhitsprite_d(int i, int sn); void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);
void checkhitsprite_r(int i, int sn); void checkhitsprite_r(DDukeActor* i, DDukeActor* sn);
void checksectors_d(int snum); void checksectors_d(int snum);
void checksectors_r(int snum); void checksectors_r(int snum);

View file

@ -81,7 +81,7 @@ struct Dispatcher
void (*checkhitwall)(int spr, int dawallnum, int x, int y, int z, int atwith); void (*checkhitwall)(int spr, int dawallnum, int x, int y, int z, int atwith);
void (*checkplayerhurt)(struct player_struct* p, int j); void (*checkplayerhurt)(struct player_struct* p, int j);
bool (*checkhitceiling)(int sn); bool (*checkhitceiling)(int sn);
void (*checkhitsprite)(int i, int sn); void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
void (*checksectors)(int low); void (*checksectors)(int low);
bool (*ceilingspace)(int sectnum); bool (*ceilingspace)(int sectnum);

View file

@ -276,7 +276,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2) if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
{ {
fi.checkhitsprite(hitsprt->GetIndex(), knee->GetIndex()); fi.checkhitsprite(hitsprt, knee);
if (p >= 0) fi.checkhitswitch(p, hitsprt->GetIndex(), 1); if (p >= 0) fi.checkhitswitch(p, hitsprt->GetIndex(), 1);
} }
@ -440,7 +440,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (hitact) if (hitact)
{ {
fi.checkhitsprite(hitact->GetIndex(), spark->GetIndex()); fi.checkhitsprite(hitact, spark);
if (hitact->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) if (hitact->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
{ {
auto jib = spawn(spark, JIBS6); auto jib = spawn(spark, JIBS6);
@ -536,7 +536,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (hitact) if (hitact)
{ {
fi.checkhitsprite(hitact->GetIndex(), spark->GetIndex()); fi.checkhitsprite(hitact, spark);
if (hitact->s.picnum != TILE_APLAYER) if (hitact->s.picnum != TILE_APLAYER)
spawn(spark, SMALLSMOKE); spawn(spark, SMALLSMOKE);
else spark->s.xrepeat = spark->s.yrepeat = 0; else spark->s.xrepeat = spark->s.yrepeat = 0;
@ -980,7 +980,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
if (zvel < 0 && (sector[hitsect].ceilingstat & 1) == 0) if (zvel < 0 && (sector[hitsect].ceilingstat & 1) == 0)
fi.checkhitceiling(hitsect); fi.checkhitceiling(hitsect);
} }
else if (hitsprt != nullptr) fi.checkhitsprite(hitsprt->GetIndex(), spark->GetIndex()); else if (hitsprt != nullptr) fi.checkhitsprite(hitsprt, spark);
else if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2) else if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2)
{ {
fi.checkhitwall(spark->GetIndex(), hitwall, hitx, hity, hitz, GROWSPARK); fi.checkhitwall(spark->GetIndex(), hitwall, hitx, hity, hitz, GROWSPARK);

View file

@ -174,7 +174,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2) if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
{ {
fi.checkhitsprite(hitsprt->GetIndex(), wpn->GetIndex()); fi.checkhitsprite(hitsprt, wpn);
if (p >= 0) fi.checkhitswitch(p, hitsprt->GetIndex(), 1); if (p >= 0) fi.checkhitswitch(p, hitsprt->GetIndex(), 1);
} }
else if (hitwall >= 0) else if (hitwall >= 0)
@ -341,7 +341,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
{ {
if (hitsprt->s.picnum == 1930) if (hitsprt->s.picnum == 1930)
return; return;
fi.checkhitsprite(hitsprt->GetIndex(), spark->GetIndex()); fi.checkhitsprite(hitsprt, spark);
if (hitsprt->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) if (hitsprt->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
{ {
auto l = spawn(spark, JIBS6); auto l = spawn(spark, JIBS6);
@ -441,7 +441,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (hitsprt) if (hitsprt)
{ {
fi.checkhitsprite(hitsprt->GetIndex(), spark->GetIndex()); fi.checkhitsprite(hitsprt, spark);
if (hitsprt->s.picnum != TILE_APLAYER) if (hitsprt->s.picnum != TILE_APLAYER)
spawn(spark, SMALLSMOKE); spawn(spark, SMALLSMOKE);
else spark->s.xrepeat = spark->s.yrepeat = 0; else spark->s.xrepeat = spark->s.yrepeat = 0;

View file

@ -1486,11 +1486,6 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
} }
} }
void checkhitsprite_d(int targ, int proj)
{
checkhitsprite_d(&hittype[targ], &hittype[proj]);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //

View file

@ -2417,11 +2417,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
} }
} }
void checkhitsprite_r(int targ, int proj)
{
checkhitsprite_r(&hittype[targ], &hittype[proj]);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //