diff --git a/source/sw/src/bunny.cpp b/source/sw/src/bunny.cpp index f629a182a..2510097d0 100644 --- a/source/sw/src/bunny.cpp +++ b/source/sw/src/bunny.cpp @@ -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); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index f7f3044ee..6e5b0046d 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -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) diff --git a/source/sw/src/ripper.cpp b/source/sw/src/ripper.cpp index 2848fe0d2..7d0b1bf8b 100644 --- a/source/sw/src/ripper.cpp +++ b/source/sw/src/ripper.cpp @@ -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); diff --git a/source/sw/src/ripper2.cpp b/source/sw/src/ripper2.cpp index 93b11ddbf..7b0edab85 100644 --- a/source/sw/src/ripper2.cpp +++ b/source/sw/src/ripper2.cpp @@ -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);