- DoItemFly

This commit is contained in:
Christoph Oelckers 2021-11-03 21:44:22 +01:00
parent c14fb9e93f
commit 95d3095f8d
3 changed files with 13 additions and 17 deletions

View file

@ -5490,7 +5490,7 @@ DoGet(DSWActor* actor)
if (sp->xvel) if (sp->xvel)
{ {
if (!DoItemFly(SpriteNum)) if (!DoItemFly(actor))
{ {
sp->xvel = 0; sp->xvel = 0;
change_actor_stat(actor, STAT_ITEM); change_actor_stat(actor, STAT_ITEM);

View file

@ -21007,12 +21007,10 @@ bool CheckBreakToughness(BREAK_INFOp break_info, short ID)
return true; // It wasn't tough, go ahead and break it return true; // It wasn't tough, go ahead and break it
} }
int int DoItemFly(DSWActor* actor)
DoItemFly(int16_t SpriteNum)
{ {
auto actor = &swActors[SpriteNum]; SPRITEp sp = &actor->s();
SPRITEp sp = &sprite[SpriteNum]; USERp u = actor->u();
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_UNDERWATER)) if (TEST(u->Flags, SPR_UNDERWATER))
{ {
@ -21027,23 +21025,21 @@ DoItemFly(int16_t SpriteNum)
u->zchange += u->Counter; u->zchange += u->Counter;
} }
SetCollision(u, move_missile(SpriteNum, u->xchange, u->ychange, u->zchange, SetCollision(u, move_missile(actor->GetSpriteIndex(), u->xchange, u->ychange, u->zchange,
u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS*2)); u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS*2));
MissileHitDiveArea(actor); MissileHitDiveArea(actor);
if (u->ret)
{ {
switch (TEST(u->ret, HIT_MASK)) switch (u->coll.type)
{ {
case HIT_SPRITE: case kHitSprite:
{ {
short wall_ang; short wall_ang;
short hit_sprite = -2; auto hit_sprite = u->coll.actor;
SPRITEp hsp; SPRITEp hsp;
hit_sprite = NORM_SPRITE(u->ret); hsp = &hit_sprite->s();
hsp = &sprite[hit_sprite];
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
@ -21060,12 +21056,12 @@ DoItemFly(int16_t SpriteNum)
break; break;
} }
case HIT_WALL: case kHitWall:
{ {
short hit_wall,nw,wall_ang; short hit_wall,nw,wall_ang;
WALLp wph; WALLp wph;
hit_wall = NORM_WALL(u->ret); hit_wall = u->coll.index;
wph = &wall[hit_wall]; wph = &wall[hit_wall];
nw = wall[hit_wall].point2; nw = wall[hit_wall].point2;
@ -21076,7 +21072,7 @@ DoItemFly(int16_t SpriteNum)
break; break;
} }
case HIT_SECTOR: case kHitSector:
{ {
// hit floor // hit floor
if (sp->z > DIV2(u->hiz + u->loz)) if (sp->z > DIV2(u->hiz + u->loz))

View file

@ -240,7 +240,7 @@ int SpawnBoltExp(int16_t Weapon);
int SpawnTracerExp(int16_t Weapon); int SpawnTracerExp(int16_t Weapon);
int SpawnGoroFireballExp(int16_t Weapon); int SpawnGoroFireballExp(int16_t Weapon);
bool MissileHitMatch(short Weapon,short WeaponNum,short hit_sprite); bool MissileHitMatch(short Weapon,short WeaponNum,short hit_sprite);
int DoItemFly(int16_t SpriteNum); int DoItemFly(DSWActor*);
int SpawnVehicleSmoke(DSWActor* actor); int SpawnVehicleSmoke(DSWActor* actor);
short PrevWall(short wall_num); short PrevWall(short wall_num);
int DoDamage(short SpriteNum,short Weapon); int DoDamage(short SpriteNum,short Weapon);