- cleanup.

This commit is contained in:
Christoph Oelckers 2021-10-30 23:18:58 +02:00
parent d60d3cd307
commit 06b4e8cf08
2 changed files with 9 additions and 12 deletions

View file

@ -626,7 +626,6 @@ int DoActorBeginSlide(DSWActor* actor, short ang, short vel, short dec)
int DoActorSlide(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
int nx, ny;
nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14);
@ -653,7 +652,6 @@ int DoActorSlide(DSWActor* actor)
int DoActorBeginJump(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SET(u->Flags, SPR_JUMPING);
RESET(u->Flags, SPR_FALLING);
@ -683,7 +681,6 @@ int DoActorBeginJump(DSWActor* actor)
int DoActorJump(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &actor->s();
int jump_adj;
@ -707,10 +704,10 @@ int DoActorJump(DSWActor* actor)
sp->z += u->jump_speed * ACTORMOVETICS;
// if player gets to close the ceiling while jumping
if (sp->z < u->hiz + Z(PIC_SIZY(SpriteNum)))
if (sp->z < u->hiz + Z(PIC_SIZY(sp)))
{
// put player at the ceiling
sp->z = u->hiz + Z(PIC_SIZY(SpriteNum));
sp->z = u->hiz + Z(PIC_SIZY(sp));
// reverse your speed to falling
u->jump_speed = -u->jump_speed;
@ -779,7 +776,6 @@ int DoActorFall(DSWActor* actor)
int DoActorStopFall(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &actor->s();
sp->z = u->loz;
@ -795,9 +791,6 @@ int DoActorStopFall(DSWActor* actor)
sp->ang = NORM_ANGLE(sp->ang + 1024 + (RANDOM_P2(512<<8)>>8));
u->jump_speed = -350;
//DSPRINTF(ds,"StopFall: sp_num %d, sp->picnum %d, lo_num %d, lo_sp->picnum %d",SpriteNum, sp->picnum, u->lo_sp - sprite, u->lo_sp->picnum);
MONO_PRINT(ds);
DoActorBeginJump(actor);
return 0;
}
@ -876,7 +869,6 @@ int DoJump(DSWActor* actor)
{
USERp u = actor->u();
SPRITEp sp = &actor->s();
int SpriteNum = actor->GetSpriteIndex();
int jump_adj;
@ -896,10 +888,10 @@ int DoJump(DSWActor* actor)
sp->z += u->jump_speed * ACTORMOVETICS;
// if player gets to close the ceiling while jumping
if (sp->z < u->hiz + Z(PIC_SIZY(SpriteNum)))
if (sp->z < u->hiz + Z(PIC_SIZY(sp)))
{
// put player at the ceiling
sp->z = u->hiz + Z(PIC_SIZY(SpriteNum));
sp->z = u->hiz + Z(PIC_SIZY(sp));
// reverse your speed to falling
u->jump_speed = -u->jump_speed;

View file

@ -229,6 +229,11 @@ inline int PIC_SIZY(int sn)
return tileHeight(sprite[sn].picnum);
}
inline int PIC_SIZY(spritetype* sp)
{
return tileHeight(sp->picnum);
}
// Distance macro - tx, ty, tmin are holding vars that must be declared in the routine
// that uses this macro
inline void DISTANCE(int x1, int y1, int x2, int y2, int& dist, int& tx, int& ty, int& tmin)