- QueueWallBlood callers.

This commit is contained in:
Christoph Oelckers 2021-11-02 18:51:14 +01:00
parent 2fdc2ec00f
commit 04657ab559
3 changed files with 22 additions and 21 deletions

View file

@ -417,7 +417,7 @@ int DoBloodSpray(DSWActor* actor)
{ {
wall_ang = NORM_ANGLE(hsp->ang); wall_ang = NORM_ANGLE(hsp->ang);
SpawnMidSplash(actor); SpawnMidSplash(actor);
QueueWallBlood(actor->GetSpriteIndex(), hsp->ang); QueueWallBlood(actor, hsp->ang);
WallBounce(actor->GetSpriteIndex(), wall_ang); WallBounce(actor->GetSpriteIndex(), wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
} }
@ -425,7 +425,7 @@ int DoBloodSpray(DSWActor* actor)
{ {
u->xchange = u->ychange = 0; u->xchange = u->ychange = 0;
SpawnMidSplash(actor); SpawnMidSplash(actor);
QueueWallBlood(actor->GetSpriteIndex(), hsp->ang); QueueWallBlood(actor, hsp->ang);
KillActor(actor); KillActor(actor);
return true; return true;
} }
@ -455,16 +455,17 @@ int DoBloodSpray(DSWActor* actor)
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512); wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
SpawnMidSplash(actor); SpawnMidSplash(actor);
wb = QueueWallBlood(actor->GetSpriteIndex(), NORM_ANGLE(wall_ang+1024)); auto bldActor = QueueWallBlood(actor, NORM_ANGLE(wall_ang+1024));
if (wb < 0) if (bldActor== nullptr)
{ {
KillActor(actor); KillActor(actor);
return 0; return 0;
} }
else else
{ {
if (FAF_Sector(sprite[wb].sectnum) || FAF_ConnectArea(sprite[wb].sectnum)) auto bsp = &bldActor->s();
if (FAF_Sector(bsp->sectnum) || FAF_ConnectArea(bsp->sectnum))
{ {
KillActor(actor); KillActor(actor);
return 0; return 0;
@ -472,14 +473,14 @@ int DoBloodSpray(DSWActor* actor)
sp->xvel = sp->yvel = u->xchange = u->ychange = 0; sp->xvel = sp->yvel = u->xchange = u->ychange = 0;
sp->xrepeat = sp->yrepeat = 70 - RandomRange(25); sp->xrepeat = sp->yrepeat = 70 - RandomRange(25);
sp->x = sprite[wb].x; sp->x = bsp->x;
sp->y = sprite[wb].y; sp->y = bsp->y;
// !FRANK! bit of a hack // !FRANK! bit of a hack
// yvel is the hit_wall // yvel is the hit_wall
if (sprite[wb].yvel >= 0) if (bsp->yvel >= 0)
{ {
short wallnum = sprite[wb].yvel; short wallnum = bsp->yvel;
// sy & sz are the ceiling and floor of the sector you are sliding down // sy & sz are the ceiling and floor of the sector you are sliding down
if (wall[wallnum].nextsector >= 0) if (wall[wallnum].nextsector >= 0)

View file

@ -17292,7 +17292,7 @@ BulletHitSprite(SPRITEp sp, short hit_sprite, int hit_x, int hit_y, int hit_z, s
if (!hu->PlayerP) if (!hu->PlayerP)
SpawnBlood(hitActor, nullptr, NORM_ANGLE(sp->ang+1024),hit_x, hit_y, hit_z); SpawnBlood(hitActor, nullptr, NORM_ANGLE(sp->ang+1024),hit_x, hit_y, hit_z);
if (hu->ID != TRASHCAN && hu->ID != ZILLA_RUN_R0) if (hu->ID != TRASHCAN && hu->ID != ZILLA_RUN_R0)
QueueWallBlood(hit_sprite, sp->ang); //QueueWallBlood needs bullet angle. QueueWallBlood(hitActor, sp->ang); //QueueWallBlood needs bullet angle.
} }
} }
@ -20422,9 +20422,9 @@ STATE s_WallBlood4[] =
}; };
int QueueWallBlood(short hit_sprite, short ang) DSWActor* QueueWallBlood(DSWActor* actor, short ang)
{ {
SPRITEp hsp = &sprite[hit_sprite]; SPRITEp hsp = &actor->s();
short w,nw,wall_ang,dang; short w,nw,wall_ang,dang;
short SpriteNum; short SpriteNum;
int nx,ny; int nx,ny;
@ -20433,11 +20433,11 @@ int QueueWallBlood(short hit_sprite, short ang)
short rndnum; short rndnum;
int daz; int daz;
hitdata_t hitinfo; hitdata_t hitinfo;
USERp u = User[hit_sprite].Data(); USERp u = actor->u();
if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(hsp) || SpriteInDiveArea(hsp)) if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(hsp) || SpriteInDiveArea(hsp))
return -1; // No blood underwater! return nullptr; // No blood underwater!
daz = Z(RANDOM_P2(128))<<3; daz = Z(RANDOM_P2(128))<<3;
daz -= DIV2(Z(128)<<3); daz -= DIV2(Z(128)<<3);
@ -20450,23 +20450,23 @@ int QueueWallBlood(short hit_sprite, short ang)
&hitinfo, CLIPMASK_MISSILE); &hitinfo, CLIPMASK_MISSILE);
if (hitinfo.sect < 0) if (hitinfo.sect < 0)
return -1; return nullptr;
#define WALLBLOOD_DIST_MAX 2500 #define WALLBLOOD_DIST_MAX 2500
if (Distance(hitinfo.pos.x, hitinfo.pos.y, hsp->x, hsp->y) > WALLBLOOD_DIST_MAX) if (Distance(hitinfo.pos.x, hitinfo.pos.y, hsp->x, hsp->y) > WALLBLOOD_DIST_MAX)
return -1; return nullptr;
// hit a sprite? // hit a sprite?
if (hitinfo.sprite >= 0) if (hitinfo.sprite >= 0)
return -1; // Don't try to put blood on a sprite return nullptr; // Don't try to put blood on a sprite
if (hitinfo.wall >= 0) // Don't check if blood didn't hit a wall, otherwise the ASSERT fails! if (hitinfo.wall >= 0) // Don't check if blood didn't hit a wall, otherwise the ASSERT fails!
{ {
if (TestDontStick(-1, hitinfo.wall)) if (TestDontStick(-1, hitinfo.wall))
return -1; return nullptr;
} }
else else
return -1; return nullptr;
if (WallBloodQueue[WallBloodQueueHead] != -1) if (WallBloodQueue[WallBloodQueueHead] != -1)
@ -20534,7 +20534,7 @@ int QueueWallBlood(short hit_sprite, short ang)
if (sp->sectnum != sectnum) if (sp->sectnum != sectnum)
changespritesect(SpriteNum, sectnum); changespritesect(SpriteNum, sectnum);
return SpriteNum; return &swActors[SpriteNum];
} }
#define FEET_IN_BLOOD_DIST 300 #define FEET_IN_BLOOD_DIST 300

View file

@ -78,7 +78,7 @@ SECTOR_OBJECTp DetectSectorObject(SECTORp);
SECTOR_OBJECTp DetectSectorObjectByWall(WALLp); SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);
void ScaleSpriteVector(DSWActor* actor, int scale); void ScaleSpriteVector(DSWActor* actor, int scale);
int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z); int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z);
int QueueWallBlood(short hit_sprite, short ang); DSWActor* QueueWallBlood(DSWActor* hit, short ang);
bool SlopeBounce(short SpriteNum, bool *hit_wall); bool SlopeBounce(short SpriteNum, bool *hit_wall);
bool HitscanSpriteAdjust(short SpriteNum, short hit_wall); bool HitscanSpriteAdjust(short SpriteNum, short hit_wall);
int SpawnSwordSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang); int SpawnSwordSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang);