- DoFall + DoBeginFall.

This commit is contained in:
Christoph Oelckers 2021-10-29 23:41:33 +02:00
parent dc6ea40911
commit c7f6b7a8c2
10 changed files with 30 additions and 56 deletions

View file

@ -895,7 +895,7 @@ int DoJump(DSWActor* actor)
if ((u->jump_speed += jump_adj) > 0)
{
// Start falling
DoBeginFall(SpriteNum);
DoBeginFall(actor);
return 0;
}
@ -912,56 +912,31 @@ int DoJump(DSWActor* actor)
u->jump_speed = -u->jump_speed;
// Change sprites state to falling
DoBeginFall(SpriteNum);
DoBeginFall(actor);
}
return 0;
}
int
DoBeginFall(short SpriteNum)
int DoBeginFall(DSWActor* actor)
{
USERp u = User[SpriteNum].Data();
USERp u = actor->u();
SET(u->Flags, SPR_FALLING);
RESET(u->Flags, SPR_JUMPING);
u->jump_grav = ACTOR_GRAVITY;
DoFall(SpriteNum);
DoFall(actor);
return 0;
}
#if 0
int
DoFall(short SpriteNum)
int DoFall(DSWActor* actor)
{
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
// adjust jump speed by gravity
u->jump_speed += u->jump_grav * ACTORMOVETICS;
// adjust player height by jump speed
sp->z += u->jump_speed * ACTORMOVETICS;
// Stick like glue when you hit the ground
if (sp->z > u->loz)
{
sp->z = u->loz;
RESET(u->Flags, SPR_FALLING);
}
return 0;
}
#else
int
DoFall(short SpriteNum)
{
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp u = actor->u();
SPRITEp sp = &actor->s();
// adjust jump speed by gravity
u->jump_speed += u->jump_grav * ACTORMOVETICS;
@ -978,7 +953,6 @@ DoFall(short SpriteNum)
return 0;
}
#endif
#include "saveable.h"

View file

@ -801,13 +801,13 @@ DoCoolgDeath(DSWActor* actor)
if (TEST(u->Flags, SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
}
else
{
DoFindGroundPoint(SpriteNum);
u->floor_dist = 0;
DoBeginFall(SpriteNum);
DoBeginFall(actor);
}
if (TEST(u->Flags, SPR_SLIDING))

View file

@ -537,13 +537,13 @@ DoEelDeath(DSWActor* actor)
int nx, ny;
if (TEST(u->Flags, SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
}
else
{
DoFindGroundPoint(SpriteNum);
u->floor_dist = 0;
DoBeginFall(SpriteNum);
DoBeginFall(actor);
}
if (TEST(u->Flags, SPR_SLIDING))

View file

@ -519,14 +519,14 @@ DoHornetDeath(DSWActor* actor)
if (TEST(u->Flags, SPR_FALLING))
{
u->loz = u->zclip;
DoFall(SpriteNum);
DoFall(actor);
}
else
{
RESET(sp->cstat, CSTAT_SPRITE_YCENTER);
u->jump_speed = 0;
u->floor_dist = 0;
DoBeginFall(SpriteNum);
DoBeginFall(actor);
DoFindGroundPoint(SpriteNum);
u->zclip = u->loz;
}

View file

@ -82,8 +82,8 @@ void DoSlidorInterp(short, INTERP_FUNC);
int DoBeginJump(DSWActor* actor);
int DoJump(DSWActor* actor);
int DoBeginFall(short SpriteNum);
int DoFall(short SpriteNum);
int DoBeginFall(DSWActor* actor);
int DoFall(DSWActor* actor);
void KeepActorOnFloor(DSWActor* actor);
int DoActorSlide(DSWActor* actor);
int DoActorSectorDamage(DSWActor* actor);

View file

@ -6406,7 +6406,7 @@ void DoPlayerDeathFlip(PLAYERp pp)
DoPlayerDeathFall(pp);
DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_UP_VALUE, 4);
if (MoveSkip2 == 0)
DoFall(pp->PlayerSprite);
DoFall(pp->Actor());
}
}
else

View file

@ -1065,7 +1065,7 @@ DoRipperHangJF(DSWActor* actor)
if (TEST(u->Flags, SPR_JUMPING))
DoJump(actor);
else
DoFall(SpriteNum);
DoFall(actor);
}
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -1133,7 +1133,7 @@ DoRipperMoveJump(DSWActor* actor)
if (TEST(u->Flags, SPR_JUMPING))
DoJump(actor);
else
DoFall(SpriteNum);
DoFall(actor);
}
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -1305,7 +1305,7 @@ DoRipperMove(DSWActor* actor)
if (TEST(u->Flags, SPR_JUMPING))
DoJump(actor);
else
DoFall(SpriteNum);
DoFall(actor);
}
// if on a player/enemy sprite jump quickly

View file

@ -1070,7 +1070,7 @@ DoRipper2HangJF(DSWActor* actor)
if (TEST(u->Flags, SPR_JUMPING))
DoJump(actor);
else
DoFall(SpriteNum);
DoFall(actor);
}
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -1145,7 +1145,7 @@ DoRipper2MoveJump(DSWActor* actor)
if (TEST(u->Flags, SPR_JUMPING))
DoJump(actor);
else
DoFall(SpriteNum);
DoFall(actor);
}
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -1323,7 +1323,7 @@ DoRipper2Move(DSWActor* actor)
if (TEST(u->Flags, SPR_JUMPING))
DoJump(actor);
else
DoFall(SpriteNum);
DoFall(actor);
}
// if on a player/enemy sprite jump quickly

View file

@ -385,7 +385,7 @@ int DoSkullJump(DSWActor* actor)
}
else if (TEST(u->Flags,SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
// jump/fall type
if (sp->xvel)
@ -804,7 +804,7 @@ int DoBettyJump(DSWActor* actor)
}
else if (TEST(u->Flags,SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
// jump/fall type
if (sp->xvel)

View file

@ -3901,8 +3901,8 @@ DoVomit(DSWActor* actor)
}
else if (TEST(u->Flags, SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(SpriteNum);
DoFall(actor);
DoFall(actor);
DoShrapMove(SpriteNum);
}
else
@ -4035,7 +4035,7 @@ DoShrapDamage(DSWActor* actor)
}
else if (TEST(u->Flags, SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
DoShrapMove(SpriteNum);
}
else
@ -4756,7 +4756,7 @@ DoFireballFlames(DSWActor* actor)
}
else if (TEST(u->Flags, SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
jumping = true;
//u->ret = move_missile(SpriteNum, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS);
}
@ -4831,7 +4831,7 @@ DoBreakFlames(DSWActor* actor)
}
else if (TEST(u->Flags, SPR_FALLING))
{
DoFall(SpriteNum);
DoFall(actor);
jumping = true;
}
else