SW: Revert the changes from JFSW commit 7d0deafe81b0ffa30d77cfe242e454f8b4487a1f

related to the definitions of RANDOM_NEG in bunny.cpp, ripper.cpp
and ripper2.cpp. Do so in a way that isn't re-introducing compiler
warnings. This partially fixes compatibility with demos made for SW 1.2.
Additionally, replace the 3 separate definitions of RANDOM_NEG
with a common one within game.h.

From-SVN: r8798
This commit is contained in:
NY00123 2020-04-04 19:42:00 +00:00 committed by Christoph Oelckers
parent 00daf6295e
commit c32a8cab29
4 changed files with 15 additions and 13 deletions

View file

@ -860,16 +860,13 @@ DoBunnyBeginJumpAttack(short SpriteNum)
int CanSeePlayer(short SpriteNum);
short tang;
#define RANDOM_NEG(x) (RANDOM_P2((x)<<1) - (x))
tang = getangle(psp->x - sp->x, psp->y - sp->y);
if (move_sprite(SpriteNum, sintable[NORM_ANGLE(tang+512)] >> 7, sintable[tang] >> 7,
0L, u->ceiling_dist, u->floor_dist, CLIPMASK_ACTOR, ACTORMOVETICS))
sp->ang = NORM_ANGLE(sp->ang + 1024) + (RANDOM_NEG(256 << 6) >> 6);
sp->ang = NORM_ANGLE(sp->ang + 1024) + (RANDOM_NEG(256, 6) >> 6);
else
sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256 << 6) >> 6));
sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6));
DoActorSetSpeed(SpriteNum, FAST_SPEED);

View file

@ -452,6 +452,15 @@ int StdRandomRange(int range);
#define STD_RANDOM_RANGE(range) (StdRandomRange(range))
#define STD_RANDOM() (rand())
#if 0
// TODO: PedanticMode
#define RANDOM_NEG(x,y) (PedanticMode \
? ((RANDOM_P2(((x)<<(y))<<1) - (x))<<(y)) \
: (RANDOM_P2(((x)<<(y))<<1) - ((x) <<(y))))
#else
#define RANDOM_NEG(x,y) ((RANDOM_P2(((x)<<(y))<<1) - (x))<<(y))
#endif
#define MOVEx(vel,ang) (((int)(vel) * (int)sintable[NORM_ANGLE((ang) + 512)]) >> 14)
#define MOVEy(vel,ang) (((int)(vel) * (int)sintable[NORM_ANGLE((ang))]) >> 14)

View file

@ -1094,15 +1094,13 @@ DoRipperBeginJumpAttack(short SpriteNum)
int CanSeePlayer(short SpriteNum);
short tang;
#define RANDOM_NEG(x) (RANDOM_P2((x)<<1) - (x))
tang = getangle(psp->x - sp->x, psp->y - sp->y);
if (move_sprite(SpriteNum, sintable[NORM_ANGLE(tang+512)] >> 7, sintable[tang] >> 7,
0L, u->ceiling_dist, u->floor_dist, CLIPMASK_ACTOR, ACTORMOVETICS))
sp->ang = NORM_ANGLE((sp->ang + 1024) + (RANDOM_NEG(256 << 6) >> 6));
sp->ang = NORM_ANGLE((sp->ang + 1024) + (RANDOM_NEG(256, 6) >> 6));
else
sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256 << 6) >> 6));
sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6));
DoActorSetSpeed(SpriteNum, FAST_SPEED);

View file

@ -1101,8 +1101,6 @@ DoRipper2BeginJumpAttack(short SpriteNum)
int CanSeePlayer(short SpriteNum);
short tang;
#define RANDOM_NEG(x) (RANDOM_P2((x)<<1) - (x))
tang = getangle(psp->x - sp->x, psp->y - sp->y);
// Always jump at player if mad.
@ -1110,10 +1108,10 @@ DoRipper2BeginJumpAttack(short SpriteNum)
//{
if (move_sprite(SpriteNum, sintable[NORM_ANGLE(tang+512)] >> 7, sintable[tang] >> 7,
0L, u->ceiling_dist, u->floor_dist, CLIPMASK_ACTOR, ACTORMOVETICS))
sp->ang = NORM_ANGLE((sp->ang + 1024) + (RANDOM_NEG(256 << 6) >> 6));
sp->ang = NORM_ANGLE((sp->ang + 1024) + (RANDOM_NEG(256, 6) >> 6));
else
sp->ang = NORM_ANGLE(tang);
// sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256 << 6) >> 6));
// sp->ang = NORM_ANGLE(tang + (RANDOM_NEG(256, 6) >> 6));
//} else
// sp->ang = NORM_ANGLE(tang);