- SpawnShrap callers

Function itself still needs work.
This commit is contained in:
Christoph Oelckers 2021-10-30 21:44:51 +02:00
parent 1db4be60f0
commit 400f822df3
8 changed files with 39 additions and 40 deletions

View file

@ -371,7 +371,7 @@ int DoActorSectorDamage(DSWActor* actor)
//if (u->lo_sectp && u->hi_sectp && labs(u->loz - u->hiz) < SPRITEp_SIZE_Z(sp))
{
u->Health = 0;
if (SpawnShrap(SpriteNum, WPN_NM_SECTOR_SQUISH))
if (SpawnShrap(actor, nullptr, WPN_NM_SECTOR_SQUISH))
{
UpdateSinglePlayKills(actor);
SetSuicide(SpriteNum);

View file

@ -596,6 +596,7 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short
// need correct location for spawning shrap
BreakSprite = COVERinsertsprite(0, STAT_DEFAULT);
ASSERT(BreakSprite >= 0);
auto breakActor = &swActors[BreakSprite];
bsp = &sprite[BreakSprite];
bsp->cstat = 0;
bsp->extra = 0;
@ -606,7 +607,7 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short
// pass Break Info Globally
GlobBreakInfo = break_info;
SpawnShrap(BreakSprite, -1);
SpawnShrap(breakActor, nullptr);
GlobBreakInfo = nullptr;
KillSprite(BreakSprite);
@ -942,6 +943,7 @@ int UserBreakSprite(short BreakSprite)
int AutoBreakSprite(short BreakSprite, short type)
{
auto breakActor = &swActors[BreakSprite];
SPRITEp bp = &sprite[BreakSprite];
BREAK_INFOp break_info;
extern void DoWallBreakMatch(short match);
@ -973,7 +975,7 @@ int AutoBreakSprite(short BreakSprite, short type)
bp->picnum = break_info->breaknum;
// pass Break Info Globally
GlobBreakInfo = break_info;
SpawnShrap(BreakSprite, -1);
SpawnShrap(breakActor, nullptr);
GlobBreakInfo = nullptr;
if (bp->picnum == 3683)
RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -987,7 +989,7 @@ int AutoBreakSprite(short BreakSprite, short type)
// pass Break Info Globally
GlobBreakInfo = break_info;
SpawnShrap(BreakSprite, -1);
SpawnShrap(breakActor, nullptr);
GlobBreakInfo = nullptr;
// kill it or change the pic
@ -1034,6 +1036,7 @@ bool NullActor(USERp u)
int HitBreakSprite(short BreakSprite, short type)
{
auto breakActor = &swActors[BreakSprite];
SPRITEp bp = &sprite[BreakSprite];
USERp bu = User[BreakSprite].Data();
@ -1056,7 +1059,7 @@ int HitBreakSprite(short BreakSprite, short type)
if (bp->lotag)
DoLightingMatch(bp->lotag, -1);
SpawnShrap(BreakSprite, -1);
SpawnShrap(breakActor, nullptr);
RESET(bp->extra, SPRX_BREAKABLE);
return false;
}

View file

@ -1003,7 +1003,7 @@ DoBunnyQuickJump(DSWActor* actor)
// Blood fountains
InitBloodSpray(hit_sprite,true,-1);
if (SpawnShrap(hit_sprite, SpriteNum))
if (SpawnShrap(hitActor, actor))
{
SetSuicide(hit_sprite);
}
@ -1223,7 +1223,7 @@ void BunnyHatch(short Weapon)
// Blood fountains
InitBloodSpray(Weapon,true,-1);
if (SpawnShrap(Weapon, New))
if (SpawnShrap(actor, actorNew))
{
SetSuicide(Weapon);
}

View file

@ -1916,7 +1916,7 @@ bool SoundValidAndActive(SPRITEp spr, int channel);
ANIMATOR DoActorBeginJump,DoActorJump,DoActorBeginFall,DoActorFall,DoActorDeathMove;
int SpawnShrap(short,short);
int SpawnShrap(DSWActor*, DSWActor*, int = -1);
void PlayerUpdateHealth(PLAYERp pp, short value);
void PlayerUpdateAmmo(PLAYERp pp, short WeaponNum, short value);

View file

@ -2646,7 +2646,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
UpdateSinglePlayKills(actor);
if (SpawnShrap(i, -99))
if (SpawnShrap(actor, nullptr, -99))
SetSuicide(i);
else
KillSprite(i);
@ -2706,6 +2706,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
SectIterator it(int(*sectp - sector));
while ((i = it.NextIndex()) >= 0)
{
auto actor = &swActors[i];
sp = &sprite[i];
u = User[i].Data();
@ -2717,7 +2718,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
{
if (sp->statnum == STAT_ENEMY)
{
if (SpawnShrap(i, -99))
if (SpawnShrap(actor, nullptr, -99))
SetSuicide(i);
else
KillSprite(i);
@ -5985,7 +5986,7 @@ DoPlayerBeginDie(PLAYERp pp)
SET(pp->Flags, PF_DEAD_HEAD | PF_JUMPING);
pp->jump_speed = -300;
u->slide_vel = 0;
SpawnShrap(pp->PlayerSprite,-1);
SpawnShrap(pp->Actor(), nullptr);
SET(pp->SpriteP->cstat, CSTAT_SPRITE_YCENTER);
NewStateGroup(pp->PlayerSprite, sg_PlayerHeadFly);
u->ID = NINJA_Head_R0;
@ -6000,7 +6001,7 @@ DoPlayerBeginDie(PLAYERp pp)
SET(pp->Flags, PF_DEAD_HEAD | PF_JUMPING);
pp->jump_speed = -650;
SpawnShrap(pp->PlayerSprite,-1);
SpawnShrap(pp->Actor(), nullptr);
SET(pp->SpriteP->cstat, CSTAT_SPRITE_YCENTER);
NewStateGroup(pp->PlayerSprite, sg_PlayerHeadFly);
u->ID = NINJA_Head_R0;
@ -6018,7 +6019,7 @@ DoPlayerBeginDie(PLAYERp pp)
SET(pp->Flags, PF_DEAD_HEAD | PF_JUMPING);
pp->jump_speed = 200;
u->slide_vel = 800;
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
SET(pp->SpriteP->cstat, CSTAT_SPRITE_YCENTER);
NewStateGroup(pp->PlayerSprite, sg_PlayerHeadFly);
u->ID = NINJA_Head_R0;
@ -6101,7 +6102,7 @@ void DoPlayerDeathHurl(PLAYERp pp)
NewStateGroup(pp->PlayerSprite, sg_PlayerHeadHurl);
if (MoveSkip4 == 0)
{
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
if (RandomRange(1000) > 400)
PlayerSound(DIGI_DHVOMIT, v3df_dontpan|v3df_follow,pp);
}
@ -6281,7 +6282,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp)
pp->jump_speed = -500;
NewStateGroup(pp->PlayerSprite, sg_PlayerHeadFly);
SET(pp->Flags, PF_JUMPING);
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
return hp;
}
}
@ -6298,7 +6299,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp)
pp->jump_speed = -100;
NewStateGroup(pp->PlayerSprite, sg_PlayerHeadFly);
SET(pp->Flags, PF_JUMPING);
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
return nullptr;
}
@ -6339,7 +6340,7 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
dang = getincangle(wall_ang, u->slide_ang);
u->slide_ang = NORM_ANGLE(wall_ang + 1024 - dang);
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
break;
}
case HIT_WALL:
@ -6356,7 +6357,7 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
dang = getincangle(wall_ang, u->slide_ang);
u->slide_ang = NORM_ANGLE(wall_ang + 1024 - dang);
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
break;
}
}
@ -6482,7 +6483,7 @@ void DoPlayerDeathBounce(PLAYERp pp)
u->slide_vel >>= 2;
u->slide_ang = NORM_ANGLE((RANDOM_P2(64<<8)>>8) - 32);
SET(pp->Flags, PF_JUMPING);
SpawnShrap(pp->PlayerSprite, -1);
SpawnShrap(pp->Actor(), nullptr);
}

View file

@ -1130,7 +1130,7 @@ int DoSpawnSpot(DSWActor* actor)
if ((u->WaitTics -= synctics) < 0)
{
change_actor_stat(actor, STAT_SPAWN_SPOT);
SpawnShrap(SpriteNum, -1);
SpawnShrap(actor, nullptr);
if (u->LastDamage == 1)
{

View file

@ -450,11 +450,7 @@ int DoSkullBob(DSWActor* actor)
int DoSkullSpawnShrap(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
int SpawnShrap(short, short);
SpawnShrap(SpriteNum, -1);
SpawnShrap(actor, nullptr);
//PlaySpriteSound(SpriteNum,attr_extra1,v3df_none);
return 0;
@ -868,9 +864,7 @@ int DoBettyBob(DSWActor* actor)
int DoBettySpawnShrap(DSWActor* actor)
{
USER* u = actor->u();
int SpawnShrap(short, short);
SpawnShrap(u->SpriteNum, -1);
SpawnShrap(actor, nullptr);
//PlaySpriteSound(SpriteNum,attr_extra1,v3df_none);
return 0;
}

View file

@ -2747,9 +2747,8 @@ bool MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite)
int SpawnShrapX(DSWActor* actor)
{
USER* u = actor->u();
//For shrap that has no Weapon to send over
SpawnShrap(u->SpriteNum, -1);
SpawnShrap(actor, nullptr);
return 0;
}
@ -2864,9 +2863,10 @@ STATEp UserStateSetup(short base_tile, short num_tiles)
#endif
int
SpawnShrap(short ParentNum, short Secondary)
SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means)
{
auto parentActor = &swActors[ParentNum];
int Secondary = secondaryActor ? secondaryActor->GetSpriteIndex() : means;
int ParentNum = parentActor->GetSpriteIndex();
SPRITEp parent = &parentActor->s();
SPRITEp sp;
USERp u, pu = parentActor->u();
@ -3873,6 +3873,7 @@ AutoShrap:
return retval;
}
int
DoShrapMove(int16_t SpriteNum)
{
@ -5072,7 +5073,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
pp->Bloody = true;
PlaySound(DIGI_TOILETGIRLSCREAM, sp, v3df_none);
}
if (SpawnShrap(SpriteNum, Weapon))
if (SpawnShrap(actor, weapActor))
SetSuicide(SpriteNum);
break;
}
@ -5081,7 +5082,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
case ZOMBIE_RUN_R0:
InitBloodSpray(SpriteNum,true,105);
InitBloodSpray(SpriteNum,true,105);
if (SpawnShrap(SpriteNum, Weapon))
if (SpawnShrap(actor, weapActor))
SetSuicide(SpriteNum);
break;
@ -5150,7 +5151,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
// Blood fountains
InitBloodSpray(SpriteNum,true,-1);
if (SpawnShrap(SpriteNum, Weapon))
if (SpawnShrap(actor, weapActor))
{
SetSuicide(SpriteNum);
}
@ -5234,7 +5235,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
return true;
}
if (SpawnShrap(SpriteNum, Weapon))
if (SpawnShrap(actor, weapActor))
{
SetSuicide(SpriteNum);
}
@ -5926,7 +5927,7 @@ DoDamage(short SpriteNum, short Weapon)
choosesnd=RandomRange(MAX_TAUNTAI);
PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp);
}
SpawnShrap(SpriteNum, Weapon);
SpawnShrap(actor, weapActor);
SetSuicide(SpriteNum);
return 0;
}
@ -10530,12 +10531,12 @@ DoElectro(DSWActor* actor)
USERp hu = User[NORM_SPRITE(u->ret)].Data();
if (!TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY) || hu->ID == SKULL_R0 || hu->ID == BETTY_R0)
SpawnShrap(Weapon, -1);
SpawnShrap(actor, nullptr);
break;
}
default:
SpawnShrap(Weapon, -1);
SpawnShrap(actor, nullptr);
break;
}
@ -10569,7 +10570,7 @@ DoLavaBoulder(DSWActor* actor)
{
if (WeaponMoveHit(Weapon))
{
SpawnShrap(Weapon, -1);
SpawnShrap(actor, nullptr);
KillSprite(Weapon);
return true;
}