- DoFindGround(Point)

This commit is contained in:
Christoph Oelckers 2021-11-05 00:10:26 +01:00
parent 6a25b4a560
commit cbf8d2324a
3 changed files with 21 additions and 30 deletions

View file

@ -5657,7 +5657,7 @@ void DoPlayerBeginDie(PLAYERp pp)
u->ID = NINJA_DEAD; u->ID = NINJA_DEAD;
pp->jump_speed = -200; pp->jump_speed = -200;
NewStateGroup(pp->Actor(), sg_PlayerDeath); NewStateGroup(pp->Actor(), sg_PlayerDeath);
DoFindGround(pp->PlayerSprite); DoFindGround(pp->Actor());
DoBeginJump(pp->Actor()); DoBeginJump(pp->Actor());
u->jump_speed = -300; u->jump_speed = -300;
break; break;
@ -5677,7 +5677,7 @@ void DoPlayerBeginDie(PLAYERp pp)
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
u->ceiling_dist = Z(10); u->ceiling_dist = Z(10);
u->floor_dist = Z(0); u->floor_dist = Z(0);
DoFindGround(pp->PlayerSprite); DoFindGround(pp->Actor());
DoBeginJump(pp->Actor()); DoBeginJump(pp->Actor());
u->jump_speed = -400; u->jump_speed = -400;
break; break;
@ -5776,7 +5776,7 @@ void DoPlayerDeathZrange(PLAYERp pp)
USERp u = pp->Actor()->u(); USERp u = pp->Actor()->u();
// make sure we don't land on a regular sprite // make sure we don't land on a regular sprite
DoFindGround(pp->PlayerSprite); DoFindGround(pp->Actor());
// update player values with results from DoFindGround // update player values with results from DoFindGround
pp->loz = u->loz; pp->loz = u->loz;

View file

@ -10746,7 +10746,7 @@ void SpawnFireballFlames(int16_t SpriteNum, int16_t enemy)
nu->floor_dist = nu->ceiling_dist = 0; nu->floor_dist = nu->ceiling_dist = 0;
DoFindGround(actorNew->GetSpriteIndex()); DoFindGround(actorNew);
nu->jump_speed = 0; nu->jump_speed = 0;
DoBeginJump(actorNew); DoBeginJump(actorNew);
} }
@ -10785,7 +10785,7 @@ int SpawnBreakFlames(DSWActor* actor)
nu->floor_dist = nu->ceiling_dist = 0; nu->floor_dist = nu->ceiling_dist = 0;
DoFindGround(New); DoFindGround(actorNew);
nu->jump_speed = 0; nu->jump_speed = 0;
DoBeginJump(actorNew); DoBeginJump(actorNew);
@ -10834,10 +10834,6 @@ SpawnBreakStaticFlames(int16_t SpriteNum)
np->z = getflorzofslope(np->sectnum,np->x,np->y); np->z = getflorzofslope(np->sectnum,np->x,np->y);
//DoFindGround(New);
//nu->jump_speed = 0;
//DoBeginJump(actorNew);
PlaySound(DIGI_FIRE1,np,v3df_dontpan|v3df_doppler); PlaySound(DIGI_FIRE1,np,v3df_dontpan|v3df_doppler);
return New; return New;
@ -11844,12 +11840,11 @@ DoFireball(DSWActor* actor)
} }
int int DoFindGround(DSWActor* actor)
DoFindGround(int16_t SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum], hsp; SPRITEp sp = &actor->s(), hsp;
USERp u = User[SpriteNum].Data(); USERp u = actor->u();
int ceilhit, florhit; Collision ceilhit, florhit;
short save_cstat; short save_cstat;
short bak_cstat; short bak_cstat;
@ -11861,13 +11856,11 @@ DoFindGround(int16_t SpriteNum)
FAFgetzrange(sp->pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER); FAFgetzrange(sp->pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
sp->cstat = save_cstat; sp->cstat = save_cstat;
ASSERT(TEST(florhit, HIT_SPRITE | HIT_SECTOR)); switch (florhit.type)
switch (TEST(florhit, HIT_MASK))
{ {
case HIT_SPRITE: case kHitSprite:
{ {
auto florActor = &swActors[NORM_SPRITE(florhit)]; auto florActor = florhit.actor;
hsp = &florActor->s(); hsp = &florActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR))
@ -11883,7 +11876,7 @@ DoFindGround(int16_t SpriteNum)
// recursive // recursive
bak_cstat = hsp->cstat; bak_cstat = hsp->cstat;
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
DoFindGround(SpriteNum); DoFindGround(actor);
hsp->cstat = bak_cstat; hsp->cstat = bak_cstat;
} }
@ -11891,7 +11884,7 @@ DoFindGround(int16_t SpriteNum)
} }
case HIT_SECTOR: case HIT_SECTOR:
{ {
u->lo_sectp = &sector[NORM_SECTOR(florhit)]; u->lo_sectp = &sector[florhit.index];
u->lowActor = nullptr; u->lowActor = nullptr;
return true; return true;
} }
@ -11908,7 +11901,7 @@ int DoFindGroundPoint(DSWActor* actor)
{ {
SPRITEp sp = &actor->s(), hsp; SPRITEp sp = &actor->s(), hsp;
USERp u = actor->u(); USERp u = actor->u();
int ceilhit, florhit; Collision ceilhit, florhit;
short save_cstat; short save_cstat;
short bak_cstat; short bak_cstat;
@ -11920,13 +11913,11 @@ int DoFindGroundPoint(DSWActor* actor)
FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit); FAFgetzrangepoint(sp->x, sp->y, sp->z, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit);
sp->cstat = save_cstat; sp->cstat = save_cstat;
ASSERT(TEST(florhit, HIT_SPRITE | HIT_SECTOR)); switch (florhit.type)
switch (TEST(florhit, HIT_MASK))
{ {
case HIT_SPRITE: case kHitSprite:
{ {
auto florActor = &swActors[NORM_SPRITE(florhit)]; auto florActor = florhit.actor;
hsp = &florActor->s(); hsp = &florActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR))
@ -11948,9 +11939,9 @@ int DoFindGroundPoint(DSWActor* actor)
return false; return false;
} }
case HIT_SECTOR: case kHitSector:
{ {
u->lo_sectp = &sector[NORM_SECTOR(florhit)]; u->lo_sectp = &sector[florhit.index];
u->lowActor = nullptr; u->lowActor = nullptr;
return true; return true;
} }

View file

@ -227,7 +227,7 @@ void InitSpearTrap(DSWActor*);
int InitTurretMgun(SECTOR_OBJECTp sop); int InitTurretMgun(SECTOR_OBJECTp sop);
void InitVulcanBoulder(DSWActor* actor); void InitVulcanBoulder(DSWActor* actor);
int DoBladeDamage(DSWActor*); int DoBladeDamage(DSWActor*);
int DoFindGround(int16_t SpriteNum); int DoFindGround(DSWActor*);
int DoFindGroundPoint(DSWActor* actor); int DoFindGroundPoint(DSWActor* actor);
void SpriteQueueDelete(DSWActor* actor); void SpriteQueueDelete(DSWActor* actor);
int HelpMissileLateral(DSWActor*, int dist); int HelpMissileLateral(DSWActor*, int dist);