- replaced RANDOM_RANGE macro with direct calls to RandomRange

This commit is contained in:
Christoph Oelckers 2021-09-20 08:59:54 +02:00
parent cc912fbf93
commit 2af688dd62
28 changed files with 281 additions and 289 deletions

View file

@ -157,7 +157,7 @@ DoActorDie(short SpriteNum, short weapon)
} }
else else
{ {
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
{ {
SPRITEp wp = &sprite[weapon]; SPRITEp wp = &sprite[weapon];
InitPlasmaFountain(wp, sp); InitPlasmaFountain(wp, sp);
@ -166,8 +166,8 @@ DoActorDie(short SpriteNum, short weapon)
ChangeState(SpriteNum, u->StateEnd); ChangeState(SpriteNum, u->StateEnd);
u->RotNum = 0; u->RotNum = 0;
u->ActorActionFunc = nullptr; u->ActorActionFunc = nullptr;
sp->xvel = 200 + RANDOM_RANGE(200); sp->xvel = 200 + RandomRange(200);
u->jump_speed = -200 - RANDOM_RANGE(250); u->jump_speed = -200 - RandomRange(250);
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
sprite[SpriteNum].ang = sprite[weapon].ang; sprite[SpriteNum].ang = sprite[weapon].ang;
} }
@ -175,7 +175,7 @@ DoActorDie(short SpriteNum, short weapon)
else else
{ {
// test for gibable dead bodies // test for gibable dead bodies
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP); SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeState(SpriteNum, u->StateEnd); ChangeState(SpriteNum, u->StateEnd);
sp->xvel = 0; sp->xvel = 0;
@ -203,7 +203,7 @@ DoActorDie(short SpriteNum, short weapon)
break; break;
case UZI_SMOKE: case UZI_SMOKE:
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP); SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeState(SpriteNum, u->StateEnd); ChangeState(SpriteNum, u->StateEnd);
u->RotNum = 0; u->RotNum = 0;
@ -211,13 +211,13 @@ DoActorDie(short SpriteNum, short weapon)
if (u->ID == RIPPER_RUN_R0 || u->ID == RIPPER2_RUN_R0) if (u->ID == RIPPER_RUN_R0 || u->ID == RIPPER2_RUN_R0)
{ {
sp->xvel <<= 1; sp->xvel <<= 1;
u->jump_speed = -100 - RANDOM_RANGE(250); u->jump_speed = -100 - RandomRange(250);
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
} }
else else
{ {
sp->xvel = 0; sp->xvel = 0;
u->jump_speed = -10 - RANDOM_RANGE(25); u->jump_speed = -10 - RandomRange(25);
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
} }
u->ActorActionFunc = nullptr; u->ActorActionFunc = nullptr;
@ -226,7 +226,7 @@ DoActorDie(short SpriteNum, short weapon)
break; break;
case UZI_SMOKE+1: // Shotgun case UZI_SMOKE+1: // Shotgun
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP); SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeState(SpriteNum, u->StateEnd); ChangeState(SpriteNum, u->StateEnd);
u->RotNum = 0; u->RotNum = 0;
@ -234,13 +234,13 @@ DoActorDie(short SpriteNum, short weapon)
// Rippers still gotta jump or they fall off walls weird // Rippers still gotta jump or they fall off walls weird
if (u->ID == RIPPER_RUN_R0 || u->ID == RIPPER2_RUN_R0) if (u->ID == RIPPER_RUN_R0 || u->ID == RIPPER2_RUN_R0)
{ {
sp->xvel = 75 + RANDOM_RANGE(100); sp->xvel = 75 + RandomRange(100);
u->jump_speed = -100 - RANDOM_RANGE(150); u->jump_speed = -100 - RandomRange(150);
} }
else else
{ {
sp->xvel = 100 + RANDOM_RANGE(200); sp->xvel = 100 + RandomRange(200);
u->jump_speed = -100 - RANDOM_RANGE(250); u->jump_speed = -100 - RandomRange(250);
} }
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
u->ActorActionFunc = nullptr; u->ActorActionFunc = nullptr;
@ -258,19 +258,19 @@ DoActorDie(short SpriteNum, short weapon)
break; break;
default: default:
if (RANDOM_RANGE(1000) > 700) if (RandomRange(1000) > 700)
{ {
SPRITEp wp = &sprite[weapon]; SPRITEp wp = &sprite[weapon];
InitPlasmaFountain(wp, sp); InitPlasmaFountain(wp, sp);
} }
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP); SET(sp->cstat, CSTAT_SPRITE_YFLIP);
ChangeState(SpriteNum, u->StateEnd); ChangeState(SpriteNum, u->StateEnd);
u->RotNum = 0; u->RotNum = 0;
u->ActorActionFunc = nullptr; u->ActorActionFunc = nullptr;
sp->xvel = 300 + RANDOM_RANGE(400); sp->xvel = 300 + RandomRange(400);
u->jump_speed = -300 - RANDOM_RANGE(350); u->jump_speed = -300 - RandomRange(350);
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
sprite[SpriteNum].ang = sprite[weapon].ang; sprite[SpriteNum].ang = sprite[weapon].ang;
break; break;

View file

@ -678,7 +678,7 @@ DoActorActionDecide(short SpriteNum)
// If target was actor, retarget to player it actor died // If target was actor, retarget to player it actor died
// or just randomly give the target actor a break // or just randomly give the target actor a break
//if ((User[u->tgt_sp-sprite] && //if ((User[u->tgt_sp-sprite] &&
// User[u->tgt_sp-sprite]->Health <= 0) || RANDOM_RANGE(1000) > 950) // User[u->tgt_sp-sprite]->Health <= 0) || RandomRange(1000) > 950)
// { // {
// DoActorPickClosePlayer(SpriteNum); // DoActorPickClosePlayer(SpriteNum);
// InitActorReposition(SpriteNum); // InitActorReposition(SpriteNum);

View file

@ -986,7 +986,7 @@ DoBunnyQuickJump(short SpriteNum)
// Kill a rival // Kill a rival
// Only males fight // Only males fight
if (tu->spal == sp->pal && RANDOM_RANGE(1000) > 995) if (tu->spal == sp->pal && RandomRange(1000) > 995)
{ {
if (u->spal == PALETTE_PLAYER8 && tu->spal == PALETTE_PLAYER8) if (u->spal == PALETTE_PLAYER8 && tu->spal == PALETTE_PLAYER8)
{ {
@ -1032,7 +1032,7 @@ DoBunnyQuickJump(short SpriteNum)
{ {
PLAYERp pp = nullptr; PLAYERp pp = nullptr;
if (RANDOM_RANGE(1000) < 995 && tu->spal != PALETTE_PLAYER0) return false; if (RandomRange(1000) < 995 && tu->spal != PALETTE_PLAYER0) return false;
DoActorPickClosePlayer(SpriteNum); DoActorPickClosePlayer(SpriteNum);
@ -1059,7 +1059,7 @@ DoBunnyQuickJump(short SpriteNum)
} }
else else
{ {
if (pp && RANDOM_RANGE(1000) > 200) if (pp && RandomRange(1000) > 200)
{ {
short choose_snd; short choose_snd;
int straightsnds[] = {DIGI_RABBITHUMP1,DIGI_RABBITHUMP2, int straightsnds[] = {DIGI_RABBITHUMP1,DIGI_RABBITHUMP2,
@ -1156,7 +1156,7 @@ int DoBunnyStandKill(short SpriteNum)
NullBunny(SpriteNum); NullBunny(SpriteNum);
// Growl like the bad ass bunny you are! // Growl like the bad ass bunny you are!
if (RANDOM_RANGE(1000) > 800) if (RandomRange(1000) > 800)
PlaySound(DIGI_BUNNYATTACK, sp, v3df_none); PlaySound(DIGI_BUNNYATTACK, sp, v3df_none);
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
@ -1198,13 +1198,13 @@ void BunnyHatch(short Weapon)
// make immediately active // make immediately active
SET(nu->Flags, SPR_ACTIVE); SET(nu->Flags, SPR_ACTIVE);
if (RANDOM_RANGE(1000) > 500) // Boy or Girl? if (RandomRange(1000) > 500) // Boy or Girl?
nu->spal = np->pal = PALETTE_PLAYER0; // Girl nu->spal = np->pal = PALETTE_PLAYER0; // Girl
else else
{ {
nu->spal = np->pal = PALETTE_PLAYER8; // Boy nu->spal = np->pal = PALETTE_PLAYER8; // Boy
// Oops, mommy died giving birth to a boy // Oops, mommy died giving birth to a boy
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
{ {
wu->Health = 0; wu->Health = 0;
Bunny_Count--; // Bunny died Bunny_Count--; // Bunny died
@ -1267,7 +1267,7 @@ int BunnyHatch2(short Weapon)
// make immediately active // make immediately active
SET(nu->Flags, SPR_ACTIVE); SET(nu->Flags, SPR_ACTIVE);
if (RANDOM_RANGE(1000) > 500) // Boy or Girl? if (RandomRange(1000) > 500) // Boy or Girl?
{ {
nu->spal = np->pal = PALETTE_PLAYER0; // Girl nu->spal = np->pal = PALETTE_PLAYER0; // Girl
nu->Flag1 = SEC(5); nu->Flag1 = SEC(5);
@ -1285,12 +1285,12 @@ int BunnyHatch2(short Weapon)
DoActorSetSpeed(New, FAST_SPEED); DoActorSetSpeed(New, FAST_SPEED);
if (TEST_BOOL3(wp)) if (TEST_BOOL3(wp))
{ {
PickJumpMaxSpeed(New, -600-RANDOM_RANGE(600)); PickJumpMaxSpeed(New, -600-RandomRange(600));
np->xrepeat = np->yrepeat = 64; np->xrepeat = np->yrepeat = 64;
np->xvel = 150 + RANDOM_RANGE(1000); np->xvel = 150 + RandomRange(1000);
nu->Health = 1; // Easy to pop. Like shootn' skeet. nu->Health = 1; // Easy to pop. Like shootn' skeet.
np->ang -= RANDOM_RANGE(128); np->ang -= RandomRange(128);
np->ang += RANDOM_RANGE(128); np->ang += RandomRange(128);
} }
else else
PickJumpMaxSpeed(New, -600); PickJumpMaxSpeed(New, -600);
@ -1358,7 +1358,7 @@ DoBunnyMove(short SpriteNum)
DoActorSectorDamage(SpriteNum); DoActorSectorDamage(SpriteNum);
if (RANDOM_RANGE(1000) > 985 && sp->pal != PALETTE_PLAYER1 && u->track < 0) if (RandomRange(1000) > 985 && sp->pal != PALETTE_PLAYER1 && u->track < 0)
{ {
switch (sector[sp->sectnum].floorpicnum) switch (sector[sp->sectnum].floorpicnum)
{ {
@ -1375,7 +1375,7 @@ DoBunnyMove(short SpriteNum)
NewStateGroup(SpriteNum,sg_BunnyStand); NewStateGroup(SpriteNum,sg_BunnyStand);
break; break;
default: default:
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048 << 6) >> 6); sp->ang = NORM_ANGLE(RandomRange(2048 << 6) >> 6);
u->jump_speed = -350; u->jump_speed = -350;
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
u->ActorActionFunc = DoActorMoveJump; u->ActorActionFunc = DoActorMoveJump;
@ -1436,7 +1436,7 @@ DoBunnyEat(short SpriteNum)
case 3562: case 3562:
case 3563: case 3563:
case 3564: case 3564:
if (RANDOM_RANGE(1000) > 970) if (RandomRange(1000) > 970)
NewStateGroup(SpriteNum,sg_BunnyRun); NewStateGroup(SpriteNum,sg_BunnyRun);
break; break;
default: default:
@ -1469,7 +1469,7 @@ DoBunnyScrew(short SpriteNum)
DoActorSectorDamage(SpriteNum); DoActorSectorDamage(SpriteNum);
if (RANDOM_RANGE(1000) > 990) // Bunny sex sounds if (RandomRange(1000) > 990) // Bunny sex sounds
{ {
PlaySound(DIGI_BUNNYATTACK, sp, v3df_follow); PlaySound(DIGI_BUNNYATTACK, sp, v3df_follow);
} }

View file

@ -651,7 +651,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
zdiff = (SPRITEp_MID(tsp)) - u->sz; zdiff = (SPRITEp_MID(tsp)) - u->sz;
// check z diff of the player and the sprite // check z diff of the player and the sprite
zdist = Z(20 + RANDOM_RANGE(100)); // put a random amount zdist = Z(20 + RandomRange(100)); // put a random amount
//zdist = Z(20); //zdist = Z(20);
if (labs(zdiff) > zdist) if (labs(zdiff) > zdist)
{ {
@ -735,7 +735,7 @@ int InitCoolgCircle(short SpriteNum)
if (labs(u->sz - u->hiz) < labs(u->sz - u->loz)) if (labs(u->sz - u->hiz) < labs(u->sz - u->loz))
u->jump_speed = -u->jump_speed; u->jump_speed = -u->jump_speed;
u->WaitTics = (RANDOM_RANGE(3)+1) * 120; u->WaitTics = (RandomRange(3)+1) * 120;
(*u->ActorActionFunc)(SpriteNum); (*u->ActorActionFunc)(SpriteNum);
@ -847,7 +847,7 @@ int DoCoolgMove(short SpriteNum)
PlaySound(DIGI_VOID3, sp, v3df_follow); PlaySound(DIGI_VOID3, sp, v3df_follow);
RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
u->ShellNum = SEC(1) + SEC(RANDOM_RANGE(2)); u->ShellNum = SEC(1) + SEC(RandomRange(2));
break; break;
case 2: case 2:
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
@ -858,7 +858,7 @@ int DoCoolgMove(short SpriteNum)
PlaySound(DIGI_VOID3, sp, v3df_follow); PlaySound(DIGI_VOID3, sp, v3df_follow);
RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE); RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
u->ShellNum = SEC(2) + SEC(RANDOM_RANGE(3)); u->ShellNum = SEC(2) + SEC(RandomRange(3));
break; break;
default: default:
u->FlagOwner = 0; u->FlagOwner = 0;

View file

@ -562,7 +562,7 @@ int SpawnCoolg(short SpriteNum)
{ {
// Don't do a ghost every time // Don't do a ghost every time
if (RANDOM_RANGE(1000) > 700 || Skill < MinEnemySkill - 1) if (RandomRange(1000) > 700 || Skill < MinEnemySkill - 1)
{ {
return(0); return(0);
} }

View file

@ -487,7 +487,7 @@ int DoEelMatchPlayerZ(short SpriteNum)
zdiff = (SPRITEp_BOS(tsp) - Z(8)) - u->sz; zdiff = (SPRITEp_BOS(tsp) - Z(8)) - u->sz;
// check z diff of the player and the sprite // check z diff of the player and the sprite
zdist = Z(20 + RANDOM_RANGE(64)); // put a random amount zdist = Z(20 + RandomRange(64)); // put a random amount
if (labs(zdiff) > zdist) if (labs(zdiff) > zdist)
{ {
if (zdiff > 0) if (zdiff > 0)
@ -588,9 +588,9 @@ DoEelDeath(short SpriteNum)
if (sp->z >= u->loz) if (sp->z >= u->loz)
{ {
RESET(u->Flags, SPR_FALLING|SPR_SLIDING); RESET(u->Flags, SPR_FALLING|SPR_SLIDING);
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_XFLIP); SET(sp->cstat, CSTAT_SPRITE_XFLIP);
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
SET(sp->cstat, CSTAT_SPRITE_YFLIP); SET(sp->cstat, CSTAT_SPRITE_YFLIP);
NewStateGroup(SpriteNum, u->ActorActionSet->Dead); NewStateGroup(SpriteNum, u->ActorActionSet->Dead);
return 0; return 0;

View file

@ -116,11 +116,6 @@ inline int RANDOM(void)
} }
#define RANDOM_P2(pwr_of_2) (MOD_P2(RANDOM(),(pwr_of_2))) #define RANDOM_P2(pwr_of_2) (MOD_P2(RANDOM(),(pwr_of_2)))
#define RANDOM_RANGE(range) (RandomRange(range))
#define PRINT(line,str) DebugPrint(line,str)
// //
// Map directions/degrees // Map directions/degrees

View file

@ -362,7 +362,7 @@ int DoHornetMatchPlayerZ(short SpriteNum)
zdiff = (SPRITEp_MID(tsp)) - u->sz; zdiff = (SPRITEp_MID(tsp)) - u->sz;
// check z diff of the player and the sprite // check z diff of the player and the sprite
zdist = Z(20 + RANDOM_RANGE(200)); // put a random amount zdist = Z(20 + RandomRange(200)); // put a random amount
if (labs(zdiff) > zdist) if (labs(zdiff) > zdist)
{ {
if (zdiff > 0) if (zdiff > 0)
@ -446,7 +446,7 @@ int InitHornetCircle(short SpriteNum)
if (labs(u->sz - u->hiz) < labs(u->sz - u->loz)) if (labs(u->sz - u->hiz) < labs(u->sz - u->loz))
u->jump_speed = -u->jump_speed; u->jump_speed = -u->jump_speed;
u->WaitTics = (RANDOM_RANGE(3)+1) * 60; u->WaitTics = (RandomRange(3)+1) * 60;
(*u->ActorActionFunc)(SpriteNum); (*u->ActorActionFunc)(SpriteNum);

View file

@ -304,7 +304,7 @@ void UseInventoryCloak(PLAYERp pp)
sp->shade = 100; sp->shade = 100;
PlaySound(DIGI_GASPOP, pp, v3df_none); PlaySound(DIGI_GASPOP, pp, v3df_none);
//if(RANDOM_RANGE(1000) > 950) //if(RandomRange(1000) > 950)
if (pp == Player+myconnectindex) if (pp == Player+myconnectindex)
PlayerSound(DIGI_IAMSHADOW, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_IAMSHADOW, v3df_follow|v3df_dontpan,pp);
} }

View file

@ -262,7 +262,7 @@ DoWallBloodDrip(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum].Data(); USERp u = User[SpriteNum].Data();
//sp->z += (300+RANDOM_RANGE(2300)) >> 1; //sp->z += (300+RandomRange(2300)) >> 1;
// sy & sz are the ceiling and floor of the sector you are sliding down // sy & sz are the ceiling and floor of the sector you are sliding down
if (u->sz != u->sy) if (u->sz != u->sy)
@ -275,13 +275,13 @@ DoWallBloodDrip(short SpriteNum)
} }
else else
{ {
sp->zvel = (300+RANDOM_RANGE(2300)) >> 1; sp->zvel = (300+RandomRange(2300)) >> 1;
sp->z += sp->zvel; sp->z += sp->zvel;
} }
} }
else else
{ {
sp->zvel = (300+RANDOM_RANGE(2300)) >> 1; sp->zvel = (300+RandomRange(2300)) >> 1;
sp->z += sp->zvel; sp->z += sp->zvel;
} }
@ -313,8 +313,8 @@ SpawnMidSplash(short SpriteNum)
//SetOwner(Weapon, New); //SetOwner(Weapon, New);
np->shade = -12; np->shade = -12;
np->xrepeat = 70-RANDOM_RANGE(20); np->xrepeat = 70-RandomRange(20);
np->yrepeat = 70-RANDOM_RANGE(20); np->yrepeat = 70-RandomRange(20);
np->opos = sp->opos; np->opos = sp->opos;
SET(np->cstat, CSTAT_SPRITE_YCENTER); SET(np->cstat, CSTAT_SPRITE_YCENTER);
RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -347,8 +347,8 @@ SpawnFloorSplash(short SpriteNum)
//SetOwner(Weapon, New); //SetOwner(Weapon, New);
np->shade = -12; np->shade = -12;
np->xrepeat = 70-RANDOM_RANGE(20); np->xrepeat = 70-RandomRange(20);
np->yrepeat = 70-RANDOM_RANGE(20); np->yrepeat = 70-RandomRange(20);
np->opos = sp->opos; np->opos = sp->opos;
SET(np->cstat, CSTAT_SPRITE_YCENTER); SET(np->cstat, CSTAT_SPRITE_YCENTER);
RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -480,7 +480,7 @@ DoBloodSpray(int16_t Weapon)
} }
sp->xvel = sp->yvel = u->xchange = u->ychange = 0; sp->xvel = sp->yvel = u->xchange = u->ychange = 0;
sp->xrepeat = sp->yrepeat = 70 - RANDOM_RANGE(25); sp->xrepeat = sp->yrepeat = 70 - RandomRange(25);
sp->x = sprite[wb].x; sp->x = sprite[wb].x;
sp->y = sprite[wb].y; sp->y = sprite[wb].y;
@ -567,8 +567,8 @@ DoBloodSpray(int16_t Weapon)
SetOwner(Weapon, New); SetOwner(Weapon, New);
np->shade = -12; np->shade = -12;
np->xrepeat = 40-RANDOM_RANGE(30); np->xrepeat = 40-RandomRange(30);
np->yrepeat = 40-RANDOM_RANGE(30); np->yrepeat = 40-RandomRange(30);
np->opos = sp->opos; np->opos = sp->opos;
SET(np->cstat, CSTAT_SPRITE_YCENTER); SET(np->cstat, CSTAT_SPRITE_YCENTER);
RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -790,8 +790,8 @@ DoPhosphorus(int16_t Weapon)
np->hitag = LUMINOUS; // Always full brightness np->hitag = LUMINOUS; // Always full brightness
SetOwner(Weapon, New); SetOwner(Weapon, New);
np->shade = -40; np->shade = -40;
np->xrepeat = 12 + RANDOM_RANGE(10); np->xrepeat = 12 + RandomRange(10);
np->yrepeat = 12 + RANDOM_RANGE(10); np->yrepeat = 12 + RandomRange(10);
np->opos = sp->opos; np->opos = sp->opos;
SET(np->cstat, CSTAT_SPRITE_YCENTER); SET(np->cstat, CSTAT_SPRITE_YCENTER);
RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(np->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -1479,7 +1479,7 @@ InitSpriteChemBomb(int16_t SpriteNum)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_BLOCK); SET(wp->cstat, CSTAT_SPRITE_BLOCK);
wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wp->zvel = short(-RandomRange(100) * HORIZ_MULT);
wp->clipdist = 80L >> 2; wp->clipdist = 80L >> 2;
@ -1541,7 +1541,7 @@ InitChemBomb(short SpriteNum)
if (SpriteInUnderwaterArea(wp)) if (SpriteInUnderwaterArea(wp))
SET(wu->Flags, SPR_UNDERWATER); SET(wu->Flags, SPR_UNDERWATER);
wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wp->zvel = short(-RandomRange(100) * HORIZ_MULT);
wp->clipdist = 0; wp->clipdist = 0;
if (u->ID == MUSHROOM_CLOUD || u->ID == 3121 || u->ID == SUMO_RUN_R0) // 3121 == GRENADE_EXP if (u->ID == MUSHROOM_CLOUD || u->ID == 3121 || u->ID == SUMO_RUN_R0) // 3121 == GRENADE_EXP
@ -1624,7 +1624,7 @@ PlayerInitFlashBomb(PLAYERp pp)
{ {
int choosesnd = 0; int choosesnd = 0;
choosesnd = RANDOM_RANGE(MAX_PAIN); choosesnd = RandomRange(MAX_PAIN);
PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp); PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp);
} }
@ -1684,7 +1684,7 @@ InitFlashBomb(int16_t SpriteNum)
{ {
int choosesnd = 0; int choosesnd = 0;
choosesnd = RANDOM_RANGE(MAX_PAIN); choosesnd = RandomRange(MAX_PAIN);
PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp); PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp);
} }
@ -1824,7 +1824,7 @@ PlayerInitCaltrops(PLAYERp pp)
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursectnum, w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursectnum,
nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2); nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2);
wp = &sprite[w]; wp = &sprite[w];
wu = User[w].Data(); wu = User[w].Data();
@ -1852,7 +1852,7 @@ PlayerInitCaltrops(PLAYERp pp)
SET(wu->Flags, SPR_UNDERWATER); SET(wu->Flags, SPR_UNDERWATER);
// They go out at different angles // They go out at different angles
// wp->ang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25)); // wp->ang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25));
wp->zvel = -pp->horizon.horiz.asq16() >> 9; wp->zvel = -pp->horizon.horiz.asq16() >> 9;
@ -1920,7 +1920,7 @@ InitCaltrops(int16_t SpriteNum)
wu->floor_dist = Z(3); wu->floor_dist = Z(3);
wu->Counter = 0; wu->Counter = 0;
wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wp->zvel = short(-RandomRange(100) * HORIZ_MULT);
// wp->clipdist = 80L>>2; // wp->clipdist = 80L>>2;
@ -1950,7 +1950,7 @@ InitPhosphorus(int16_t SpriteNum)
ny = sp->y; ny = sp->y;
nz = sp->z; nz = sp->z;
daang = NORM_ANGLE(RANDOM_RANGE(2048)); daang = NORM_ANGLE(RandomRange(2048));
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
@ -1982,7 +1982,7 @@ InitPhosphorus(int16_t SpriteNum)
wu->floor_dist = Z(3); wu->floor_dist = Z(3);
wu->Counter = 0; wu->Counter = 0;
wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wp->zvel = short(-RandomRange(100) * HORIZ_MULT);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -2004,13 +2004,13 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
if (dogib) if (dogib)
cnt = RANDOM_RANGE(3)+1; cnt = RandomRange(3)+1;
else else
cnt = 1; cnt = 1;
//if(dogib) //if(dogib)
// { // {
rnd = RANDOM_RANGE(1000); rnd = RandomRange(1000);
if (rnd > 650) if (rnd > 650)
PlaySound(DIGI_GIBS1, sp, v3df_none); PlaySound(DIGI_GIBS1, sp, v3df_none);
else if (rnd > 350) else if (rnd > 350)
@ -2026,14 +2026,14 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
{ {
if (velocity == -1) if (velocity == -1)
vel = 105+RANDOM_RANGE(320); vel = 105+RandomRange(320);
else if (velocity == -2) else if (velocity == -2)
vel = 105+RANDOM_RANGE(100); vel = 105+RandomRange(100);
if (dogib) if (dogib)
ang = NORM_ANGLE(ang + 512 + RANDOM_RANGE(200)); ang = NORM_ANGLE(ang + 512 + RandomRange(200));
else else
ang = NORM_ANGLE(ang+1024+256 - RANDOM_RANGE(256)); ang = NORM_ANGLE(ang+1024+256 - RandomRange(256));
nx = sp->x; nx = sp->x;
ny = sp->y; ny = sp->y;
@ -2057,8 +2057,8 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
wp->shade = -12; wp->shade = -12;
SetOwner(SpriteNum, w); SetOwner(SpriteNum, w);
wp->yrepeat = 64-RANDOM_RANGE(35); wp->yrepeat = 64-RandomRange(35);
wp->xrepeat = 64-RANDOM_RANGE(35); wp->xrepeat = 64-RandomRange(35);
wp->shade = -15; wp->shade = -15;
wp->clipdist = sp->clipdist; wp->clipdist = sp->clipdist;
wu->WeaponNum = u->WeaponNum; wu->WeaponNum = u->WeaponNum;
@ -2067,7 +2067,7 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
wu->floor_dist = Z(3); wu->floor_dist = Z(3);
wu->Counter = 0; wu->Counter = 0;
wp->zvel = short((-10 - RANDOM_RANGE(50)) * HORIZ_MULT); wp->zvel = short((-10 - RandomRange(50)) * HORIZ_MULT);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -2471,12 +2471,12 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
case -3: case -3:
id = UZI_SHELL; id = UZI_SHELL;
p = s_UziShellShrap; p = s_UziShellShrap;
velocity = 1500 + RANDOM_RANGE(1000); velocity = 1500 + RandomRange(1000);
break; break;
case -4: case -4:
id = SHOT_SHELL; id = SHOT_SHELL;
p = s_ShotgunShellShrap; p = s_ShotgunShellShrap;
velocity = 2000 + RANDOM_RANGE(1000); velocity = 2000 + RandomRange(1000);
break; break;
} }
@ -2552,7 +2552,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
//if (TEST(u->PlayerP->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) //if (TEST(u->PlayerP->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
// SET(wu->Flags, SPR_UNDERWATER); // SET(wu->Flags, SPR_UNDERWATER);
wu->jump_speed = 200; wu->jump_speed = 200;
wu->jump_speed += RANDOM_RANGE(400); wu->jump_speed += RandomRange(400);
wu->jump_speed = -wu->jump_speed; wu->jump_speed = -wu->jump_speed;
DoBeginJump(w); DoBeginJump(w);

View file

@ -311,7 +311,7 @@ void DoLighting(void)
if ((RANDOM_P2(128 << 8) >> 8) > 64) if ((RANDOM_P2(128 << 8) >> 8) > 64)
{ {
sp->shade = -LIGHT_MaxBright(sp) + RANDOM_RANGE(LIGHT_MaxBright(sp) + LIGHT_MaxDark(sp)); sp->shade = -LIGHT_MaxBright(sp) + RandomRange(LIGHT_MaxBright(sp) + LIGHT_MaxDark(sp));
SectorLightShade(sp, sp->shade); SectorLightShade(sp, sp->shade);
DiffuseLighting(sp); DiffuseLighting(sp);
} }
@ -403,7 +403,7 @@ void DoLighting(void)
if ((RANDOM_P2(128 << 8) >> 8) > 64) if ((RANDOM_P2(128 << 8) >> 8) > 64)
{ {
sp->shade = -LIGHT_MaxBright(sp) + RANDOM_RANGE(LIGHT_MaxBright(sp) + LIGHT_MaxDark(sp)); sp->shade = -LIGHT_MaxBright(sp) + RandomRange(LIGHT_MaxBright(sp) + LIGHT_MaxDark(sp));
SectorLightShade(sp, sp->shade); SectorLightShade(sp, sp->shade);
DiffuseLighting(sp); DiffuseLighting(sp);
} }

View file

@ -160,7 +160,7 @@ int DoToiletGirl(short SpriteNum)
if (u->FlagOwner != 1) if (u->FlagOwner != 1)
{ {
if (RANDOM_RANGE(1000) > 980) if (RandomRange(1000) > 980)
{ {
short choose_snd; short choose_snd;
@ -181,13 +181,13 @@ int DoToiletGirl(short SpriteNum)
{ {
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
if (RANDOM_RANGE(1000<<8)>>8 > 500) if (RandomRange(1000<<8)>>8 > 500)
PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad);
else else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_ToiletGirlUzi); ChangeState(SpriteNum,s_ToiletGirlUzi);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -226,13 +226,13 @@ int NullToiletGirl(short SpriteNum)
{ {
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
if (RANDOM_RANGE(1000<<8)>>8 > 500) if (RandomRange(1000<<8)>>8 > 500)
PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad);
else else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_ToiletGirlUzi); ChangeState(SpriteNum,s_ToiletGirlUzi);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -248,7 +248,7 @@ int ToiletGirlUzi(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
u->WaitTics = RANDOM_RANGE(240)+120; u->WaitTics = RandomRange(240)+120;
ChangeState(SpriteNum,s_ToiletGirlStand); ChangeState(SpriteNum,s_ToiletGirlStand);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -397,7 +397,7 @@ int DoWashGirl(short SpriteNum)
DoActorPickClosePlayer(SpriteNum); DoActorPickClosePlayer(SpriteNum);
ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum);
if (RANDOM_RANGE(1000) > 980 && u->ShellNum <= 0) if (RandomRange(1000) > 980 && u->ShellNum <= 0)
{ {
if (!SoundValidAndActive(sp, CHAN_AnimeSing)) if (!SoundValidAndActive(sp, CHAN_AnimeSing))
{ {
@ -408,7 +408,7 @@ int DoWashGirl(short SpriteNum)
} }
ChangeState(SpriteNum,s_WashGirlStandScrub); ChangeState(SpriteNum,s_WashGirlStandScrub);
u->ShellNum = RANDOM_RANGE(2*120)+240; u->ShellNum = RandomRange(2*120)+240;
} }
else else
{ {
@ -429,13 +429,13 @@ int DoWashGirl(short SpriteNum)
{ {
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
if (RANDOM_RANGE(1000<<8)>>8 > 500) if (RandomRange(1000<<8)>>8 > 500)
PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad);
else else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_WashGirlUzi); ChangeState(SpriteNum,s_WashGirlUzi);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -471,13 +471,13 @@ int NullWashGirl(short SpriteNum)
{ {
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
if (RANDOM_RANGE(1000<<8)>>8 > 500) if (RandomRange(1000<<8)>>8 > 500)
PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD1, sp, v3df_dontpan, CHAN_AnimeMad);
else else
PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_ANIMEMAD2, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_WashGirlUzi); ChangeState(SpriteNum,s_WashGirlUzi);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -493,7 +493,7 @@ int WashGirlUzi(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
u->WaitTics = RANDOM_RANGE(240)+120; u->WaitTics = RandomRange(240)+120;
ChangeState(SpriteNum,s_WashGirlStand); ChangeState(SpriteNum,s_WashGirlStand);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -816,8 +816,8 @@ int PachinkoCheckWin(short SpriteNum)
if (TEST_BOOL1(sp)) return 0; if (TEST_BOOL1(sp)) return 0;
// Well? Did I win????! // Well? Did I win????!
/*short rnd = */RANDOM_RANGE(1000); /*short rnd = */RandomRange(1000);
if (RANDOM_RANGE(1000) > 900 || Pachinko_Win_Cheat) if (RandomRange(1000) > 900 || Pachinko_Win_Cheat)
{ {
int i; int i;
SPRITEp tsp; SPRITEp tsp;
@ -874,10 +874,10 @@ int Pachinko1Operate(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
short rnd; short rnd;
rnd = RANDOM_RANGE(1000); rnd = RandomRange(1000);
if (rnd > 900) if (rnd > 900)
{ {
rnd = RANDOM_RANGE(1000); // TEMP SOUNDS: Need pachinko sounds! rnd = RandomRange(1000); // TEMP SOUNDS: Need pachinko sounds!
if (rnd > 700) if (rnd > 700)
PlaySound(DIGI_PROLL1, sp, v3df_none); PlaySound(DIGI_PROLL1, sp, v3df_none);
else if (rnd > 400) else if (rnd > 400)
@ -1276,7 +1276,7 @@ int DoCarGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750) if (choose > 750)
PlaySound(DIGI_LANI049, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI049, sp, v3df_dontpan, CHAN_AnimeMad);
@ -1288,7 +1288,7 @@ int DoCarGirl(short SpriteNum)
PlaySound(DIGI_LANI054, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI054, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_CarGirlUzi); ChangeState(SpriteNum,s_CarGirlUzi);
u->WaitTics = SEC(3)+SEC(RANDOM_RANGE(2<<8)>>8); u->WaitTics = SEC(3)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
} }
@ -1329,7 +1329,7 @@ int NullCarGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750) if (choose > 750)
PlaySound(DIGI_LANI049, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI049, sp, v3df_dontpan, CHAN_AnimeMad);
@ -1341,7 +1341,7 @@ int NullCarGirl(short SpriteNum)
PlaySound(DIGI_LANI054, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI054, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_CarGirlUzi); ChangeState(SpriteNum,s_CarGirlUzi);
u->WaitTics = SEC(3)+SEC(RANDOM_RANGE(2<<8)>>8); u->WaitTics = SEC(3)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -1357,7 +1357,7 @@ int CarGirlUzi(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
u->WaitTics = RANDOM_RANGE(240)+120; u->WaitTics = RandomRange(240)+120;
ChangeState(SpriteNum,s_CarGirlStand); ChangeState(SpriteNum,s_CarGirlStand);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -1495,7 +1495,7 @@ int DoMechanicGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750) if (choose > 750)
PlaySound(DIGI_LANI073, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI073, sp, v3df_dontpan, CHAN_AnimeMad);
@ -1507,7 +1507,7 @@ int DoMechanicGirl(short SpriteNum)
PlaySound(DIGI_LANI079, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI079, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_MechanicGirlDrill); ChangeState(SpriteNum,s_MechanicGirlDrill);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(2<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
} }
@ -1548,7 +1548,7 @@ int NullMechanicGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750) if (choose > 750)
PlaySound(DIGI_LANI073, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI073, sp, v3df_dontpan, CHAN_AnimeMad);
@ -1560,7 +1560,7 @@ int NullMechanicGirl(short SpriteNum)
PlaySound(DIGI_LANI079, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI079, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_MechanicGirlDrill); ChangeState(SpriteNum,s_MechanicGirlDrill);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(2<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(2<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -1576,7 +1576,7 @@ int MechanicGirlDrill(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
u->WaitTics = RANDOM_RANGE(240)+120; u->WaitTics = RandomRange(240)+120;
ChangeState(SpriteNum,s_MechanicGirlStand); ChangeState(SpriteNum,s_MechanicGirlStand);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -1715,7 +1715,7 @@ int DoSailorGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750 && alreadythrew < 3) if (choose > 750 && alreadythrew < 3)
{ {
@ -1731,7 +1731,7 @@ int DoSailorGirl(short SpriteNum)
PlaySound(DIGI_LANI066, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI066, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_SailorGirlThrow); ChangeState(SpriteNum,s_SailorGirlThrow);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
} }
@ -1773,7 +1773,7 @@ int NullSailorGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750 && alreadythrew < 3) if (choose > 750 && alreadythrew < 3)
{ {
@ -1789,7 +1789,7 @@ int NullSailorGirl(short SpriteNum)
PlaySound(DIGI_LANI066, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI066, sp, v3df_dontpan, CHAN_AnimeMad);
} }
ChangeState(SpriteNum,s_SailorGirlThrow); ChangeState(SpriteNum,s_SailorGirlThrow);
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -1805,7 +1805,7 @@ int SailorGirlThrow(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
u->WaitTics = RANDOM_RANGE(240)+120; u->WaitTics = RandomRange(240)+120;
ChangeState(SpriteNum,s_SailorGirlStand); ChangeState(SpriteNum,s_SailorGirlStand);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -1938,7 +1938,7 @@ int DoPruneGirl(short SpriteNum)
else else
PlaySound(DIGI_LANI095, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI095, sp, v3df_dontpan, CHAN_AnimeMad);
} }
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
} }
@ -1996,7 +1996,7 @@ int NullPruneGirl(short SpriteNum)
if (!SoundValidAndActive(sp, CHAN_AnimeMad)) if (!SoundValidAndActive(sp, CHAN_AnimeMad))
{ {
short choose; short choose;
choose = RANDOM_RANGE(1000); choose = RandomRange(1000);
if (choose > 750) if (choose > 750)
PlaySound(DIGI_LANI089, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI089, sp, v3df_dontpan, CHAN_AnimeMad);
@ -2007,7 +2007,7 @@ int NullPruneGirl(short SpriteNum)
else else
PlaySound(DIGI_LANI095, sp, v3df_dontpan, CHAN_AnimeMad); PlaySound(DIGI_LANI095, sp, v3df_dontpan, CHAN_AnimeMad);
} }
u->WaitTics = SEC(1)+SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = SEC(1)+SEC(RandomRange(3<<8)>>8);
u->FlagOwner = 0; u->FlagOwner = 0;
} }
@ -2023,7 +2023,7 @@ int PruneGirlUzi(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
u->WaitTics = RANDOM_RANGE(240)+120; u->WaitTics = RandomRange(240)+120;
ChangeState(SpriteNum,s_PruneGirlStand); ChangeState(SpriteNum,s_PruneGirlStand);
u->FlagOwner = 0; u->FlagOwner = 0;
} }

View file

@ -282,7 +282,7 @@ void ScaleRandomPoint(SECTOR_OBJECTp sop, short k, short ang, int x, int y, int
//sop->scale_point_speed[k] = SCALE_POINT_SPEED; //sop->scale_point_speed[k] = SCALE_POINT_SPEED;
short half = sop->scale_point_base_speed/2; short half = sop->scale_point_base_speed/2;
short quart = sop->scale_point_base_speed/4; short quart = sop->scale_point_base_speed/4;
sop->scale_point_speed[k] = sop->scale_point_base_speed + (RANDOM_RANGE(half) - quart); sop->scale_point_speed[k] = sop->scale_point_base_speed + (RandomRange(half) - quart);
} }
xmul = (sop->scale_point_dist[k] * sop->scale_x_mult)>>8; xmul = (sop->scale_point_dist[k] * sop->scale_x_mult)>>8;

View file

@ -61,9 +61,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define MOD_P2(number,modby) ((number) & ((modby)-1)) #define MOD_P2(number,modby) ((number) & ((modby)-1))
// Truncates to select 2 power numbers
#define TRUNC4(x) ((x) & ~3)
/* /*

View file

@ -1969,7 +1969,7 @@ DoNinjaHariKari(short SpriteNum)
SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1); SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1);
cnt = RANDOM_RANGE(4)+1; cnt = RandomRange(4)+1;
for (i=0; i<=cnt; i++) for (i=0; i<=cnt; i++)
InitBloodSpray(SpriteNum,true,-2); InitBloodSpray(SpriteNum,true,-2);

View file

@ -191,7 +191,7 @@ void DoPlayerChooseYell(PLAYERp pp)
{ {
int choose_snd = 0; int choose_snd = 0;
if (RANDOM_RANGE(1000) < 990) return; if (RandomRange(1000) < 990) return;
choose_snd = STD_RANDOM_RANGE(MAX_YELLSOUNDS); choose_snd = STD_RANDOM_RANGE(MAX_YELLSOUNDS);
@ -273,7 +273,7 @@ void PlayerUpdateHealth(PLAYERp pp, short value)
{ {
int choosesnd = 0; int choosesnd = 0;
choosesnd = RANDOM_RANGE(MAX_PAIN); choosesnd = RandomRange(MAX_PAIN);
if (u->Health > 50) if (u->Health > 50)
{ {
@ -1076,7 +1076,7 @@ pSwordSlideDown(PANEL_SPRITEp psp)
psp->oy = psp->y = SWORD_YOFF; psp->oy = psp->y = SWORD_YOFF;
psp->backupboby(); psp->backupboby();
psp->ang = 1024; psp->ang = 1024;
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->PlayerP->SwordAng = SwordAngTable[RandomRange(SIZ(SwordAngTable))];
psp->vel = 2500; psp->vel = 2500;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
return; return;
@ -1141,7 +1141,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp)
psp->ox = psp->x = SWORD_XOFF + 80; psp->ox = psp->x = SWORD_XOFF + 80;
psp->oy = psp->y = SWORD_YOFF; psp->oy = psp->y = SWORD_YOFF;
psp->backupboby(); psp->backupboby();
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->PlayerP->SwordAng = SwordAngTable[RandomRange(SIZ(SwordAngTable))];
psp->ang = 1024; psp->ang = 1024;
psp->vel = 2500; psp->vel = 2500;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
@ -1218,7 +1218,7 @@ pSwordRest(PANEL_SPRITEp psp)
psp->vel = 2500; psp->vel = 2500;
psp->ang = 1024; psp->ang = 1024;
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->PlayerP->SwordAng = SwordAngTable[RandomRange(SIZ(SwordAngTable))];
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
} }
} }
@ -4675,7 +4675,7 @@ pHeartAttack(PANEL_SPRITEp psp)
// CTW MODIFICATION END // CTW MODIFICATION END
PlaySound(DIGI_HEARTFIRE, pp, v3df_follow|v3df_dontpan); PlaySound(DIGI_HEARTFIRE, pp, v3df_follow|v3df_dontpan);
if (RANDOM_RANGE(1000) > 800) if (RandomRange(1000) > 800)
PlayerSound(DIGI_JG9009, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_JG9009, v3df_follow|v3df_dontpan,pp);
InitHeartAttack(psp->PlayerP); InitHeartAttack(psp->PlayerP);
} }
@ -4760,12 +4760,12 @@ SpawnHeartBlood(PANEL_SPRITEp psp)
blood->ox = blood->x; blood->ox = blood->x;
blood->y = psp->y + hsp->yoff; blood->y = psp->y + hsp->yoff;
blood->oy = blood->y; blood->oy = blood->y;
blood->xspeed = hsp->lo_xspeed + (RANDOM_RANGE((hsp->hi_xspeed - hsp->lo_xspeed)>>4) << 4); blood->xspeed = hsp->lo_xspeed + (RandomRange((hsp->hi_xspeed - hsp->lo_xspeed)>>4) << 4);
SET(blood->flags, PANF_WEAPON_SPRITE); SET(blood->flags, PANF_WEAPON_SPRITE);
blood->scale = 20000 + RANDOM_RANGE(50000 - 20000); blood->scale = 20000 + RandomRange(50000 - 20000);
blood->jump_speed = hsp->lo_jump_speed + (RANDOM_RANGE((hsp->hi_jump_speed + hsp->lo_jump_speed)>>4) << 4); blood->jump_speed = hsp->lo_jump_speed + (RandomRange((hsp->hi_jump_speed + hsp->lo_jump_speed)>>4) << 4);
DoBeginPanelJump(blood); DoBeginPanelJump(blood);
} }
} }
@ -4796,12 +4796,12 @@ SpawnSmallHeartBlood(PANEL_SPRITEp psp)
blood->ox = blood->x; blood->ox = blood->x;
blood->y = psp->y + hsp->yoff; blood->y = psp->y + hsp->yoff;
blood->oy = blood->y; blood->oy = blood->y;
blood->xspeed = hsp->lo_xspeed + (RANDOM_RANGE((hsp->hi_xspeed - hsp->lo_xspeed)>>4) << 4); blood->xspeed = hsp->lo_xspeed + (RandomRange((hsp->hi_xspeed - hsp->lo_xspeed)>>4) << 4);
SET(blood->flags, PANF_WEAPON_SPRITE); SET(blood->flags, PANF_WEAPON_SPRITE);
blood->scale = 10000 + RANDOM_RANGE(30000 - 10000); blood->scale = 10000 + RandomRange(30000 - 10000);
blood->jump_speed = hsp->lo_jump_speed + (RANDOM_RANGE((hsp->hi_jump_speed + hsp->lo_jump_speed)>>4) << 4); blood->jump_speed = hsp->lo_jump_speed + (RandomRange((hsp->hi_jump_speed + hsp->lo_jump_speed)>>4) << 4);
DoBeginPanelJump(blood); DoBeginPanelJump(blood);
} }
} }
@ -5553,7 +5553,7 @@ InitChops(PLAYERp pp)
PlaySound(DIGI_BUZZZ, psp->PlayerP,v3df_none); PlaySound(DIGI_BUZZZ, psp->PlayerP,v3df_none);
if (RANDOM_RANGE(1000) > 750) if (RandomRange(1000) > 750)
PlayerSound(DIGI_MRFLY,v3df_follow|v3df_dontpan,psp->PlayerP); PlayerSound(DIGI_MRFLY,v3df_follow|v3df_dontpan,psp->PlayerP);
} }
@ -5564,7 +5564,7 @@ pChopsClick(PANEL_SPRITEp psp)
int16_t rnd_rng; int16_t rnd_rng;
PlaySound(DIGI_CHOP_CLICK,psp->PlayerP,v3df_none); PlaySound(DIGI_CHOP_CLICK,psp->PlayerP,v3df_none);
rnd_rng = RANDOM_RANGE(1000); rnd_rng = RandomRange(1000);
if (rnd_rng > 950) if (rnd_rng > 950)
PlayerSound(DIGI_SEARCHWALL,v3df_follow|v3df_dontpan,psp->PlayerP); PlayerSound(DIGI_SEARCHWALL,v3df_follow|v3df_dontpan,psp->PlayerP);
else if (rnd_rng > 900) else if (rnd_rng > 900)
@ -5637,7 +5637,7 @@ pChopsWait(PANEL_SPRITEp psp)
psp->ox = psp->x = CHOPS_XOFF + (RANDOM_P2(128) - 64); psp->ox = psp->x = CHOPS_XOFF + (RANDOM_P2(128) - 64);
PlaySound(DIGI_BUZZZ,psp->PlayerP,v3df_none); PlaySound(DIGI_BUZZZ,psp->PlayerP,v3df_none);
pSetState(psp, psp_ChopsAttack[RANDOM_RANGE(SIZ(psp_ChopsAttack))]); pSetState(psp, psp_ChopsAttack[RandomRange(SIZ(psp_ChopsAttack))]);
} }
} }
@ -5659,7 +5659,7 @@ pChopsRetract(PANEL_SPRITEp psp)
if (psp->y >= CHOPS_YOFF + tileHeight(picnum)) if (psp->y >= CHOPS_YOFF + tileHeight(picnum))
{ {
if (RANDOM_RANGE(1000) > 800) if (RandomRange(1000) > 800)
PlayerSound(DIGI_GETTINGSTIFF,v3df_follow|v3df_dontpan,psp->PlayerP); PlayerSound(DIGI_GETTINGSTIFF,v3df_follow|v3df_dontpan,psp->PlayerP);
psp->PlayerP->Chops = nullptr; psp->PlayerP->Chops = nullptr;
pKillSprite(psp); pKillSprite(psp);
@ -5971,7 +5971,7 @@ pFistPresent(PANEL_SPRITEp psp)
psp->oy = psp->y = FIST_YOFF; psp->oy = psp->y = FIST_YOFF;
psp->backupboby(); psp->backupboby();
rnd = RANDOM_RANGE(1000); rnd = RandomRange(1000);
if (rnd > 500) if (rnd > 500)
{ {
psp->PresentState = ps_PresentFist; psp->PresentState = ps_PresentFist;
@ -6041,9 +6041,9 @@ pFistSlideDown(PANEL_SPRITEp psp)
{ {
DoPlayerChooseYell(psp->PlayerP); DoPlayerChooseYell(psp->PlayerP);
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
{ {
//if(RANDOM_RANGE(1000) > 300) //if(RandomRange(1000) > 300)
// { // {
psp->ActionState = ps_FistSwing; psp->ActionState = ps_FistSwing;
psp->PlayerP->WpnKungFuMove = 0; psp->PlayerP->WpnKungFuMove = 0;
@ -6057,7 +6057,7 @@ pFistSlideDown(PANEL_SPRITEp psp)
psp->ox = psp->x = FIST_XOFF; psp->ox = psp->x = FIST_XOFF;
psp->oy = psp->y = FIST_YOFF; psp->oy = psp->y = FIST_YOFF;
psp->backupboby(); psp->backupboby();
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->PlayerP->FistAng = FistAngTable[RandomRange(SIZ(FistAngTable))];
psp->ang = 1024; psp->ang = 1024;
psp->vel = vel; psp->vel = vel;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
@ -6074,7 +6074,7 @@ pFistSlideDown(PANEL_SPRITEp psp)
psp->oy = psp->y = FIST_YOFF; psp->oy = psp->y = FIST_YOFF;
psp->backupboby(); psp->backupboby();
psp->ang = 1024; psp->ang = 1024;
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->PlayerP->FistAng = FistAngTable[RandomRange(SIZ(FistAngTable))];
psp->vel = vel; psp->vel = vel;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
return; return;
@ -6144,7 +6144,7 @@ pFistSlideDownR(PANEL_SPRITEp psp)
{ {
DoPlayerChooseYell(psp->PlayerP); DoPlayerChooseYell(psp->PlayerP);
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
{ {
psp->ActionState = ps_FistSwing+5; psp->ActionState = ps_FistSwing+5;
psp->PlayerP->WpnKungFuMove = 0; psp->PlayerP->WpnKungFuMove = 0;
@ -6154,7 +6154,7 @@ pFistSlideDownR(PANEL_SPRITEp psp)
psp->oy = psp->y = FIST_YOFF; psp->oy = psp->y = FIST_YOFF;
psp->backupboby(); psp->backupboby();
psp->ang = 1024; psp->ang = 1024;
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->PlayerP->FistAng = FistAngTable[RandomRange(SIZ(FistAngTable))];
psp->vel = vel; psp->vel = vel;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
return; return;
@ -6169,7 +6169,7 @@ pFistSlideDownR(PANEL_SPRITEp psp)
psp->ox = psp->x = FIST_XOFF; psp->ox = psp->x = FIST_XOFF;
psp->oy = psp->y = FIST_YOFF; psp->oy = psp->y = FIST_YOFF;
psp->backupboby(); psp->backupboby();
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->PlayerP->FistAng = FistAngTable[RandomRange(SIZ(FistAngTable))];
psp->ang = 1024; psp->ang = 1024;
psp->vel = vel; psp->vel = vel;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
@ -6254,7 +6254,7 @@ pFistRest(PANEL_SPRITEp psp)
psp->vel = 5500; psp->vel = 5500;
psp->ang = 1024; psp->ang = 1024;
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->PlayerP->FistAng = FistAngTable[RandomRange(SIZ(FistAngTable))];
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
} }
} }

View file

@ -3290,7 +3290,7 @@ DoPlayerFall(PLAYERp pp)
{ {
PlayerSound(DIGI_PLAYERPAIN2, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_PLAYERPAIN2, v3df_follow|v3df_dontpan,pp);
// PlayerUpdateHealth(pp, -RANDOM_RANGE(PLAYER_FALL_DAMAGE_AMOUNT) - 2); // PlayerUpdateHealth(pp, -RandomRange(PLAYER_FALL_DAMAGE_AMOUNT) - 2);
if (pp->jump_speed > 1700 && pp->jump_speed < 4000) if (pp->jump_speed > 1700 && pp->jump_speed < 4000)
{ {
@ -4664,7 +4664,7 @@ DoPlayerDive(PLAYERp pp)
pp->DiveDamageTics = PLAYER_DIVE_DAMAGE_TIME; pp->DiveDamageTics = PLAYER_DIVE_DAMAGE_TIME;
//PlayerUpdateHealth(pp, PLAYER_DIVE_DAMAGE_AMOUNT); //PlayerUpdateHealth(pp, PLAYER_DIVE_DAMAGE_AMOUNT);
PlayerSound(DIGI_WANGDROWNING, v3df_dontpan|v3df_follow, pp); PlayerSound(DIGI_WANGDROWNING, v3df_dontpan|v3df_follow, pp);
PlayerUpdateHealth(pp, -3 -(RANDOM_RANGE(7<<8)>>8)); PlayerUpdateHealth(pp, -3 -(RandomRange(7<<8)>>8));
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, -1);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -4801,7 +4801,7 @@ DoPlayerDive(PLAYERp pp)
DoPlayerMove(pp); DoPlayerMove(pp);
// Random bubble sounds // Random bubble sounds
// if((RANDOM_RANGE(1000<<5)>>5) < 100) // if((RandomRange(1000<<5)>>5) < 100)
// PlaySound(DIGI_BUBBLES, pp, v3df_dontpan|v3df_follow); // PlaySound(DIGI_BUBBLES, pp, v3df_dontpan|v3df_follow);
if ((!Prediction && pp->z_speed && ((RANDOM_P2(1024<<5)>>5) < 64)) || if ((!Prediction && pp->z_speed && ((RANDOM_P2(1024<<5)>>5) < 64)) ||
@ -5676,7 +5676,7 @@ DoPlayerDeathFall(PLAYERp pp)
if (loz != pp->loz) if (loz != pp->loz)
SpawnSplash(pp->PlayerSprite); SpawnSplash(pp->PlayerSprite);
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
PlaySound(DIGI_BODYFALL1, pp, v3df_dontpan); PlaySound(DIGI_BODYFALL1, pp, v3df_dontpan);
else else
PlaySound(DIGI_BODYFALL2, pp, v3df_dontpan); PlaySound(DIGI_BODYFALL2, pp, v3df_dontpan);
@ -5839,7 +5839,7 @@ DoPlayerBeginDie(PLAYERp pp)
StopPlayerSound(pp); StopPlayerSound(pp);
// Do the death scream // Do the death scream
choosesnd = RANDOM_RANGE(MAX_PAIN); choosesnd = RandomRange(MAX_PAIN);
PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp); PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp);
@ -6088,7 +6088,7 @@ void DoPlayerDeathHurl(PLAYERp pp)
if (MoveSkip4 == 0) if (MoveSkip4 == 0)
{ {
SpawnShrap(pp->PlayerSprite, -1); SpawnShrap(pp->PlayerSprite, -1);
if (RANDOM_RANGE(1000) > 400) if (RandomRange(1000) > 400)
PlayerSound(DIGI_DHVOMIT, v3df_dontpan|v3df_follow,pp); PlayerSound(DIGI_DHVOMIT, v3df_dontpan|v3df_follow,pp);
} }
return; return;
@ -7286,7 +7286,7 @@ int SearchSpawnPosition(PLAYERp pp)
do do
{ {
// get a spawn position // get a spawn position
pos_num = RANDOM_RANGE(MAX_SW_PLAYERS); pos_num = RandomRange(MAX_SW_PLAYERS);
spawn_sprite = StatIterator::First(STAT_MULTI_START + pos_num); spawn_sprite = StatIterator::First(STAT_MULTI_START + pos_num);
if (spawn_sprite <= -1) if (spawn_sprite <= -1)
return 0; return 0;
@ -7499,7 +7499,7 @@ void CheckFootPrints(PLAYERp pp)
if (pp->NumFootPrints <= 0 || FootMode != WATER_FOOT) if (pp->NumFootPrints <= 0 || FootMode != WATER_FOOT)
{ {
// Hey, you just got your feet wet! // Hey, you just got your feet wet!
pp->NumFootPrints = RANDOM_RANGE(10)+3; pp->NumFootPrints = RandomRange(10)+3;
FootMode = WATER_FOOT; FootMode = WATER_FOOT;
} }
} }

View file

@ -161,7 +161,7 @@ void ProcessQuakeSpot(void)
rand_test = QUAKE_RandomTest(sp); rand_test = QUAKE_RandomTest(sp);
// wrong - all quakes need to happen at the same time on all computerssg // wrong - all quakes need to happen at the same time on all computerssg
//if (!rand_test || (rand_test && STD_RANDOM_RANGE(128) < rand_test)) //if (!rand_test || (rand_test && STD_RANDOM_RANGE(128) < rand_test))
if (!rand_test || (rand_test && RANDOM_RANGE(128) < rand_test)) if (!rand_test || (rand_test && RandomRange(128) < rand_test))
{ {
CopyQuakeSpotToOn(sp); CopyQuakeSpotToOn(sp);
// kill quake spot if needed // kill quake spot if needed

View file

@ -984,7 +984,7 @@ InitRipper2Hang(short SpriteNum)
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(SpriteNum, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -(RANDOM_RANGE(400)+100)); PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100));
SET(u->Flags, SPR_JUMPING); SET(u->Flags, SPR_JUMPING);
RESET(u->Flags, SPR_FALLING); RESET(u->Flags, SPR_FALLING);
@ -1116,7 +1116,7 @@ DoRipper2BeginJumpAttack(short SpriteNum)
DoActorSetSpeed(SpriteNum, FAST_SPEED); DoActorSetSpeed(SpriteNum, FAST_SPEED);
//u->jump_speed = -800; //u->jump_speed = -800;
PickJumpMaxSpeed(SpriteNum, -(RANDOM_RANGE(400)+100)); PickJumpMaxSpeed(SpriteNum, -(RandomRange(400)+100));
SET(u->Flags, SPR_JUMPING); SET(u->Flags, SPR_JUMPING);
RESET(u->Flags, SPR_FALLING); RESET(u->Flags, SPR_FALLING);

View file

@ -1239,11 +1239,11 @@ DoSoundSpotMatch(short match, short sound_num, short sound_type)
{ {
if (snd[0] && snd[1]) if (snd[0] && snd[1])
{ {
snd2play = snd[RANDOM_RANGE(2)]; snd2play = snd[RandomRange(2)];
} }
else if (snd[0] && snd[1] && snd[2]) else if (snd[0] && snd[1] && snd[2])
{ {
snd2play = snd[RANDOM_RANGE(3)]; snd2play = snd[RandomRange(3)];
} }
} }
else if (snd[sound_num]) else if (snd[sound_num])
@ -1699,7 +1699,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
case MECHANICGIRL_R0: case MECHANICGIRL_R0:
case SAILORGIRL_R0: case SAILORGIRL_R0:
case PRUNEGIRL_R0: case PRUNEGIRL_R0:
//if(RANDOM_RANGE(1000) < 500) return(true); //if(RandomRange(1000) < 500) return(true);
//if(u->FlagOwner == 0) //if(u->FlagOwner == 0)
{ {
short choose_snd; short choose_snd;
@ -1785,7 +1785,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
if (u->WaitTics > 0) return true; if (u->WaitTics > 0) return true;
PlaySound(DIGI_PFLIP, sp, v3df_none); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeState(SpriteNum,s_Pachinko1Operate); ChangeState(SpriteNum,s_Pachinko1Operate);
return true; return true;
@ -1796,7 +1796,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
if (u->WaitTics > 0) return true; if (u->WaitTics > 0) return true;
PlaySound(DIGI_PFLIP, sp, v3df_none); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeState(SpriteNum,s_Pachinko2Operate); ChangeState(SpriteNum,s_Pachinko2Operate);
return true; return true;
@ -1807,7 +1807,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
if (u->WaitTics > 0) return true; if (u->WaitTics > 0) return true;
PlaySound(DIGI_PFLIP, sp, v3df_none); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeState(SpriteNum,s_Pachinko3Operate); ChangeState(SpriteNum,s_Pachinko3Operate);
return true; return true;
@ -1818,7 +1818,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
if (u->WaitTics > 0) return true; if (u->WaitTics > 0) return true;
PlaySound(DIGI_PFLIP, sp, v3df_none); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RandomRange(10));
ChangeState(SpriteNum,s_Pachinko4Operate); ChangeState(SpriteNum,s_Pachinko4Operate);
return true; return true;

View file

@ -55,7 +55,7 @@ enum SO_SCALE_TYPE
SO_SCALE_RANDOM_POINT SO_SCALE_RANDOM_POINT
}; };
#define SCALE_POINT_SPEED (4 + RANDOM_RANGE(8)) #define SCALE_POINT_SPEED (4 + RandomRange(8))
typedef struct typedef struct
{ {

View file

@ -313,7 +313,7 @@ DoSkullBeginDeath(int16_t SpriteNum)
if (num_ord > 10) num_ord = 10; if (num_ord > 10) num_ord = 10;
for (i=0; i<num_ord; i++) for (i=0; i<num_ord; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitCaltrops(SpriteNum); InitCaltrops(SpriteNum);
} }
break; break;
@ -338,7 +338,7 @@ DoSkullBeginDeath(int16_t SpriteNum)
SpawnMineExp(SpriteNum); SpawnMineExp(SpriteNum);
for (i=0; i<3; i++) for (i=0; i<3; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitPhosphorus(SpriteNum); InitPhosphorus(SpriteNum);
} }
break; break;
@ -470,7 +470,7 @@ int DoSkullWait(short SpriteNum)
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{ {
PlaySound(DIGI_AHSCREAM, sp, v3df_none); PlaySound(DIGI_AHSCREAM, sp, v3df_none);
u->WaitTics = SEC(3) + RANDOM_RANGE(360); u->WaitTics = SEC(3) + RandomRange(360);
} }
// below the floor type // below the floor type
@ -727,7 +727,7 @@ DoBettyBeginDeath(int16_t SpriteNum)
if (num_ord > 10) num_ord = 10; if (num_ord > 10) num_ord = 10;
for (i=0; i<num_ord; i++) for (i=0; i<num_ord; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitCaltrops(SpriteNum); InitCaltrops(SpriteNum);
} }
break; break;
@ -750,7 +750,7 @@ DoBettyBeginDeath(int16_t SpriteNum)
default: default:
for (i=0; i<5; i++) for (i=0; i<5; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitPhosphorus(SpriteNum); InitPhosphorus(SpriteNum);
SpawnMineExp(SpriteNum); SpawnMineExp(SpriteNum);
} }

View file

@ -2735,7 +2735,7 @@ SpriteSetup(void)
SP_TAG10(sp) = 20; SP_TAG10(sp) = 20;
// interval in seconds // interval in seconds
u->WaitTics = RANDOM_RANGE(SP_TAG10(sp)) * 120; u->WaitTics = RandomRange(SP_TAG10(sp)) * 120;
// time to erupt // time to erupt
if (SP_TAG9(sp) == 0) if (SP_TAG9(sp) == 0)

View file

@ -775,7 +775,7 @@ int InitSumoClap(short SpriteNum)
extern int InitMiniSumoClap(short SpriteNum); extern int InitMiniSumoClap(short SpriteNum);
extern int InitSumoSkull(short SpriteNum); extern int InitSumoSkull(short SpriteNum);
if (sp->pal == 16 && RANDOM_RANGE(1000) <= 800) if (sp->pal == 16 && RandomRange(1000) <= 800)
InitMiniSumoClap(SpriteNum); InitMiniSumoClap(SpriteNum);
else else
InitSumoSkull(SpriteNum); InitSumoSkull(SpriteNum);

View file

@ -99,7 +99,7 @@ int DoWallMove(SPRITEp sp)
dang = ((int)SP_TAG10(sp)) << 3; dang = ((int)SP_TAG10(sp)) << 3;
if (dang) if (dang)
ang = NORM_ANGLE(ang + (RANDOM_RANGE(dang) - dang/2)); ang = NORM_ANGLE(ang + (RandomRange(dang) - dang/2));
nx = MulScale(dist, bcos(ang), 14); nx = MulScale(dist, bcos(ang), 14);
ny = MulScale(dist, bsin(ang), 14); ny = MulScale(dist, bsin(ang), 14);

View file

@ -158,7 +158,7 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum
match_rand[ndx++] = SP_TAG8(sp); match_rand[ndx++] = SP_TAG8(sp);
// reset the match you are looking for // reset the match you are looking for
match = match_rand[RANDOM_RANGE(ndx)]; match = match_rand[RandomRange(ndx)];
} }
break; break;
case WARP_CEILING_PLANE: case WARP_CEILING_PLANE:

View file

@ -3781,8 +3781,8 @@ AutoShrap:
} }
// for FastShrap // for FastShrap
u->zchange = labs(u->jump_speed*4) - RANDOM_RANGE(labs(u->jump_speed)*8)*2; u->zchange = labs(u->jump_speed*4) - RandomRange(labs(u->jump_speed)*8)*2;
u->WaitTics = WaitTics + RANDOM_RANGE(WaitTics/2); u->WaitTics = WaitTics + RandomRange(WaitTics/2);
switch (u->ID) switch (u->ID)
{ {
@ -3850,18 +3850,18 @@ AutoShrap:
if (shrap_rand_zamt) if (shrap_rand_zamt)
{ {
sp->z += Z(RANDOM_RANGE(shrap_rand_zamt) - (shrap_rand_zamt/2)); sp->z += Z(RandomRange(shrap_rand_zamt) - (shrap_rand_zamt/2));
} }
sp->pal = u->spal = uint8_t(shrap_pal); sp->pal = u->spal = uint8_t(shrap_pal);
sp->xvel = p->min_vel*2; sp->xvel = p->min_vel*2;
sp->xvel += RANDOM_RANGE(p->max_vel - p->min_vel); sp->xvel += RandomRange(p->max_vel - p->min_vel);
u->floor_dist = shrap_floor_dist; u->floor_dist = shrap_floor_dist;
u->ceiling_dist = shrap_ceiling_dist; u->ceiling_dist = shrap_ceiling_dist;
u->jump_speed = p->min_jspeed; u->jump_speed = p->min_jspeed;
u->jump_speed += RANDOM_RANGE(p->max_jspeed - p->min_jspeed); u->jump_speed += RandomRange(p->max_jspeed - p->min_jspeed);
u->jump_speed = -u->jump_speed; u->jump_speed = -u->jump_speed;
DoBeginJump(SpriteNum); DoBeginJump(SpriteNum);
@ -4335,7 +4335,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i
np->pal = nu->spal = uint8_t(shrap_pal); np->pal = nu->spal = uint8_t(shrap_pal);
np->xvel = p->min_vel; np->xvel = p->min_vel;
np->xvel += RANDOM_RANGE(p->max_vel - p->min_vel); np->xvel += RandomRange(p->max_vel - p->min_vel);
// special case // special case
// blood coming off of actors should have the acceleration of the actor // blood coming off of actors should have the acceleration of the actor
@ -4344,14 +4344,14 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i
nu->ceiling_dist = nu->floor_dist = Z(2); nu->ceiling_dist = nu->floor_dist = Z(2);
nu->jump_speed = p->min_jspeed; nu->jump_speed = p->min_jspeed;
nu->jump_speed += RANDOM_RANGE(p->max_jspeed - p->min_jspeed); nu->jump_speed += RandomRange(p->max_jspeed - p->min_jspeed);
nu->jump_speed = -nu->jump_speed; nu->jump_speed = -nu->jump_speed;
nu->xchange = MOVEx(np->xvel, np->ang); nu->xchange = MOVEx(np->xvel, np->ang);
nu->ychange = MOVEy(np->xvel, np->ang); nu->ychange = MOVEy(np->xvel, np->ang);
// for FastShrap // for FastShrap
nu->zchange = labs(nu->jump_speed*4) - RANDOM_RANGE(labs(nu->jump_speed)*8); nu->zchange = labs(nu->jump_speed*4) - RandomRange(labs(nu->jump_speed)*8);
nu->WaitTics = 64 + RANDOM_P2(32); nu->WaitTics = 64 + RANDOM_P2(32);
SET(u->Flags, SPR_BOUNCE); SET(u->Flags, SPR_BOUNCE);
@ -5184,7 +5184,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
if (u->WeaponNum == WPN_FIST) if (u->WeaponNum == WPN_FIST)
DoActorDie(SpriteNum, Weapon); DoActorDie(SpriteNum, Weapon);
else if (u->ID == NINJA_RUN_R0 || RANDOM_RANGE(1000) < 500) else if (u->ID == NINJA_RUN_R0 || RandomRange(1000) < 500)
DoActorDie(SpriteNum, Weapon); DoActorDie(SpriteNum, Weapon);
else else
{ {
@ -5248,7 +5248,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
SpawnFireballFlames(SpriteNum, -1); SpawnFireballFlames(SpriteNum, -1);
// Random chance of taunting the AI's here // Random chance of taunting the AI's here
if (RANDOM_RANGE(1000) > 400) if (RandomRange(1000) > 400)
{ {
PLAYERp pp; PLAYERp pp;
@ -5390,7 +5390,7 @@ ActorHealth(short SpriteNum, short amt)
if (rnd < 950) if (rnd < 950)
return true; return true;
SET(u->Flags2, SPR2_DYING); // Only let it check this once! SET(u->Flags2, SPR2_DYING); // Only let it check this once!
u->WaitTics = SEC(1) + SEC(RANDOM_RANGE(2)); u->WaitTics = SEC(1) + SEC(RandomRange(2));
u->Health = 60; u->Health = 60;
PlaySound(DIGI_NINJACHOKE, sp, v3df_follow); PlaySound(DIGI_NINJACHOKE, sp, v3df_follow);
InitPlasmaFountain(nullptr, sp); InitPlasmaFountain(nullptr, sp);
@ -5476,7 +5476,7 @@ ActorPain(short SpriteNum)
break; break;
} }
if (RANDOM_RANGE(1000) < 875 || u->WaitTics > 0) if (RandomRange(1000) < 875 || u->WaitTics > 0)
return false; return false;
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -5668,7 +5668,7 @@ GetDamage(short SpriteNum, short Weapon, short DamageNdx)
//return(damage_amt); //return(damage_amt);
// formula: damage_amt = 75% + random(25%) // formula: damage_amt = 75% + random(25%)
return DIV2(damage_amt) + DIV4(damage_amt) + RANDOM_RANGE(DIV4(damage_amt)); return DIV2(damage_amt) + DIV4(damage_amt) + RandomRange(DIV4(damage_amt));
} }
else else
{ {
@ -5676,7 +5676,7 @@ GetDamage(short SpriteNum, short Weapon, short DamageNdx)
} }
} }
return -(d->damage_lo + RANDOM_RANGE(d->damage_hi - d->damage_lo)); return -(d->damage_lo + RandomRange(d->damage_hi - d->damage_lo));
} }
int int
@ -5969,7 +5969,7 @@ DoDamage(short SpriteNum, short Weapon)
// Random chance of taunting the AI's here // Random chance of taunting the AI's here
if (STD_RANDOM_RANGE(1024) > 512 && pp == Player+myconnectindex) if (STD_RANDOM_RANGE(1024) > 512 && pp == Player+myconnectindex)
{ {
choosesnd=RANDOM_RANGE(MAX_TAUNTAI); choosesnd=RandomRange(MAX_TAUNTAI);
PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp); PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp);
} }
SpawnShrap(SpriteNum, Weapon); SpawnShrap(SpriteNum, Weapon);
@ -6032,10 +6032,10 @@ DoDamage(short SpriteNum, short Weapon)
switch (wu->PlayerP->WpnKungFuMove) switch (wu->PlayerP->WpnKungFuMove)
{ {
case 1: case 1:
damage -= 2 - RANDOM_RANGE(7); damage -= 2 - RandomRange(7);
break; break;
case 2: case 2:
damage -= 5 - RANDOM_RANGE(10); damage -= 5 - RandomRange(10);
break; break;
} }
PlaySound(DIGI_CGTHIGHBONE,wp,v3df_follow|v3df_dontpan); PlaySound(DIGI_CGTHIGHBONE,wp,v3df_follow|v3df_dontpan);
@ -6304,7 +6304,7 @@ DoDamage(short SpriteNum, short Weapon)
case 5011: case 5011:
if (wu->ID == 5011) if (wu->ID == 5011)
damage = -(3 + (RANDOM_RANGE(4<<8)>>8)); damage = -(3 + (RandomRange(4<<8)>>8));
else else
damage = GetDamage(SpriteNum, Weapon, DMG_BLADE); damage = GetDamage(SpriteNum, Weapon, DMG_BLADE);
if (u->sop_parent) if (u->sop_parent)
@ -6516,9 +6516,9 @@ DoDamage(short SpriteNum, short Weapon)
case ZILLA_RUN_R0: case ZILLA_RUN_R0:
break; break;
default: default:
if (RANDOM_RANGE(1000) > 900) if (RandomRange(1000) > 900)
InitBloodSpray(SpriteNum,false,105); InitBloodSpray(SpriteNum,false,105);
if (RANDOM_RANGE(1000) > 900) if (RandomRange(1000) > 900)
SpawnMidSplash(SpriteNum); SpawnMidSplash(SpriteNum);
break; break;
} }
@ -6568,7 +6568,7 @@ DoDamage(short SpriteNum, short Weapon)
case ZILLA_RUN_R0: case ZILLA_RUN_R0:
break; break;
default: default:
if (RANDOM_RANGE(1000) > 950) if (RandomRange(1000) > 950)
SpawnMidSplash(SpriteNum); SpawnMidSplash(SpriteNum);
break; break;
} }
@ -6661,8 +6661,8 @@ DoDamage(short SpriteNum, short Weapon)
break; break;
case BOLT_THINMAN_R1: case BOLT_THINMAN_R1:
//damage = -(2000 + (65 + RANDOM_RANGE(40))); // -2000 makes armor not count //damage = -(2000 + (65 + RandomRange(40))); // -2000 makes armor not count
damage = -(65 + RANDOM_RANGE(40)); damage = -(65 + RandomRange(40));
if (u->sop_parent) if (u->sop_parent)
{ {
@ -7402,12 +7402,12 @@ DoDamage(short SpriteNum, short Weapon)
// If player take alot of damage, make him yell // If player take alot of damage, make him yell
if (u && u->PlayerP) if (u && u->PlayerP)
{ {
if (damage <= -40 && RANDOM_RANGE(1000) > 700) if (damage <= -40 && RandomRange(1000) > 700)
PlayerSound(DIGI_SONOFABITCH, v3df_dontpan|v3df_follow, u->PlayerP); PlayerSound(DIGI_SONOFABITCH, v3df_dontpan|v3df_follow, u->PlayerP);
else if (damage <= -40 && RANDOM_RANGE(1000) > 700) else if (damage <= -40 && RandomRange(1000) > 700)
PlayerSound(DIGI_PAINFORWEAK, v3df_dontpan|v3df_follow, u->PlayerP); PlayerSound(DIGI_PAINFORWEAK, v3df_dontpan|v3df_follow, u->PlayerP);
else if (damage <= -10) else if (damage <= -10)
PlayerSound(PlayerPainVocs[RANDOM_RANGE(MAX_PAIN)], v3df_dontpan|v3df_follow, u->PlayerP); PlayerSound(PlayerPainVocs[RandomRange(MAX_PAIN)], v3df_dontpan|v3df_follow, u->PlayerP);
} }
return 0; return 0;
@ -8107,8 +8107,8 @@ DoStar(int16_t Weapon)
break; // will be killed below - u->ret != 0 break; // will be killed below - u->ret != 0
// 32000 to 96000 // 32000 to 96000
u->xchange = MulScale(u->xchange, 64000 + (RANDOM_RANGE(64000) - 32000), 16); u->xchange = MulScale(u->xchange, 64000 + (RandomRange(64000) - 32000), 16);
u->ychange = MulScale(u->ychange, 64000 + (RANDOM_RANGE(64000) - 32000), 16); u->ychange = MulScale(u->ychange, 64000 + (RandomRange(64000) - 32000), 16);
if (sp->z > DIV2(u->hiz + u->loz)) if (sp->z > DIV2(u->hiz + u->loz))
u->zchange = MulScale(u->zchange, 50000, 16); // floor u->zchange = MulScale(u->zchange, 50000, 16); // floor
@ -8150,8 +8150,8 @@ DoStar(int16_t Weapon)
u->zchange = -u->zchange; u->zchange = -u->zchange;
// 32000 to 96000 // 32000 to 96000
u->xchange = MulScale(u->xchange, 64000 + (RANDOM_RANGE(64000) - 32000), 16); u->xchange = MulScale(u->xchange, 64000 + (RandomRange(64000) - 32000), 16);
u->ychange = MulScale(u->ychange, 64000 + (RANDOM_RANGE(64000) - 32000), 16); u->ychange = MulScale(u->ychange, 64000 + (RandomRange(64000) - 32000), 16);
if (sp->z > DIV2(u->hiz + u->loz)) if (sp->z > DIV2(u->hiz + u->loz))
u->zchange = MulScale(u->zchange, 50000, 16); // floor u->zchange = MulScale(u->zchange, 50000, 16); // floor
else else
@ -8652,7 +8652,7 @@ DoPlasmaFountain(int16_t Weapon)
if (!u->Counter) if (!u->Counter)
{ {
SpawnBlood(short(ap-sprite), Weapon, 0, 0, 0, 0); SpawnBlood(short(ap-sprite), Weapon, 0, 0, 0, 0);
if (RANDOM_RANGE(1000) > 600) if (RandomRange(1000) > 600)
InitBloodSpray(short(ap-sprite), false, 105); InitBloodSpray(short(ap-sprite), false, 105);
} }
} }
@ -8987,7 +8987,7 @@ DoGrenade(int16_t Weapon)
{ {
for (i=0; i<5; i++) for (i=0; i<5; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitPhosphorus(Weapon); InitPhosphorus(Weapon);
} }
} }
@ -9059,7 +9059,7 @@ DoGrenade(int16_t Weapon)
{ {
for (i=0; i<5; i++) for (i=0; i<5; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitPhosphorus(Weapon); InitPhosphorus(Weapon);
} }
} }
@ -9102,7 +9102,7 @@ DoGrenade(int16_t Weapon)
{ {
for (i=0; i<5; i++) for (i=0; i<5; i++)
{ {
sp->ang = NORM_ANGLE(RANDOM_RANGE(2048)); sp->ang = NORM_ANGLE(RandomRange(2048));
InitPhosphorus(Weapon); InitPhosphorus(Weapon);
} }
} }
@ -9642,13 +9642,13 @@ DoMine(int16_t Weapon)
{ {
pp = uo->PlayerP; pp = uo->PlayerP;
if (RANDOM_RANGE(1000) > 800) if (RandomRange(1000) > 800)
PlayerSound(DIGI_STICKYGOTU1, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_STICKYGOTU1, v3df_follow|v3df_dontpan,pp);
else if (RANDOM_RANGE(1000) > 800) else if (RandomRange(1000) > 800)
PlayerSound(DIGI_STICKYGOTU2, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_STICKYGOTU2, v3df_follow|v3df_dontpan,pp);
else if (RANDOM_RANGE(1000) > 800) else if (RandomRange(1000) > 800)
PlayerSound(DIGI_STICKYGOTU3, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_STICKYGOTU3, v3df_follow|v3df_dontpan,pp);
else if (RANDOM_RANGE(1000) > 800) else if (RandomRange(1000) > 800)
PlayerSound(DIGI_STICKYGOTU4, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_STICKYGOTU4, v3df_follow|v3df_dontpan,pp);
} }
} }
@ -9841,7 +9841,7 @@ DoEMP(int16_t Weapon)
MissileHitDiveArea(Weapon); MissileHitDiveArea(Weapon);
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
{ {
sp->xrepeat = 52; sp->xrepeat = 52;
sp->yrepeat = 10; sp->yrepeat = 10;
@ -9892,7 +9892,7 @@ DoEMPBurst(int16_t Weapon)
SET(u->Flags, SPR_ACTIVE); SET(u->Flags, SPR_ACTIVE);
} }
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
{ {
sp->xrepeat = 52; sp->xrepeat = 52;
sp->yrepeat = 10; sp->yrepeat = 10;
@ -10106,9 +10106,9 @@ DoRail(int16_t Weapon)
np = &sprite[New]; np = &sprite[New];
nu = User[New].Data(); nu = User[New].Data();
np->xvel += (RANDOM_RANGE(140)-RANDOM_RANGE(140)); np->xvel += (RandomRange(140)-RandomRange(140));
np->yvel += (RANDOM_RANGE(140)-RANDOM_RANGE(140)); np->yvel += (RandomRange(140)-RandomRange(140));
np->zvel += (RANDOM_RANGE(140)-RANDOM_RANGE(140)); np->zvel += (RandomRange(140)-RandomRange(140));
nu->RotNum = 5; nu->RotNum = 5;
NewStateGroup(New, sg_RailPuff); NewStateGroup(New, sg_RailPuff);
@ -10300,9 +10300,9 @@ SpawnExtraMicroMini(int16_t Weapon)
wu->floor_dist = u->floor_dist; wu->floor_dist = u->floor_dist;
wp->cstat = sp->cstat; wp->cstat = sp->cstat;
wp->ang = NORM_ANGLE(wp->ang + RANDOM_RANGE(64) - 32); wp->ang = NORM_ANGLE(wp->ang + RandomRange(64) - 32);
wp->zvel = sp->zvel; wp->zvel = sp->zvel;
wp->zvel += RANDOM_RANGE(Z(16)) - Z(8); wp->zvel += RandomRange(Z(16)) - Z(8);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -10632,7 +10632,7 @@ int SpawnCoolieExp(short SpriteNum)
ASSERT(u); ASSERT(u);
u->Counter = RANDOM_RANGE(120); // This is the wait til birth time! u->Counter = RandomRange(120); // This is the wait til birth time!
zh = sp->z - SPRITEp_SIZE_Z(sp) + DIV4(SPRITEp_SIZE_Z(sp)); zh = sp->z - SPRITEp_SIZE_Z(sp) + DIV4(SPRITEp_SIZE_Z(sp));
nx = sp->x + MOVEx(64, sp->ang+1024); nx = sp->x + MOVEx(64, sp->ang+1024);
@ -10895,7 +10895,7 @@ SpawnBreakStaticFlames(int16_t SpriteNum)
np = &sprite[New]; np = &sprite[New];
nu = User[New].Data(); nu = User[New].Data();
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
np->picnum = 3143; np->picnum = 3143;
else else
np->picnum = 3157; np->picnum = 3157;
@ -11145,7 +11145,7 @@ SpawnNuclearSecondaryExp(int16_t Weapon, short ang)
RESET(exp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(exp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
//ang = RANDOM_P2(2048); //ang = RANDOM_P2(2048);
int32_t const vel = (2048+128) + RANDOM_RANGE(2048); int32_t const vel = (2048+128) + RandomRange(2048);
eu->xchange = MOVEx(vel, ang); eu->xchange = MOVEx(vel, ang);
eu->ychange = MOVEy(vel, ang); eu->ychange = MOVEy(vel, ang);
eu->Radius = 200; // was NUKE_RADIUS eu->Radius = 200; // was NUKE_RADIUS
@ -11185,7 +11185,7 @@ SpawnNuclearExp(int16_t Weapon)
if (sp->owner) if (sp->owner)
{ {
pp = User[sp->owner]->PlayerP; pp = User[sp->owner]->PlayerP;
rnd_rng = RANDOM_RANGE(1000); rnd_rng = RandomRange(1000);
if (rnd_rng > 990) if (rnd_rng > 990)
PlayerSound(DIGI_LIKEHIROSHIMA, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_LIKEHIROSHIMA, v3df_follow|v3df_dontpan,pp);
@ -11491,7 +11491,7 @@ SpawnGrenadeSecondaryExp(int16_t Weapon, short ang)
RESET(exp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(exp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
//ang = RANDOM_P2(2048); //ang = RANDOM_P2(2048);
vel = (1024+512) + RANDOM_RANGE(1024); vel = (1024+512) + RandomRange(1024);
eu->xchange = MOVEx(vel, ang); eu->xchange = MOVEx(vel, ang);
eu->ychange = MOVEy(vel, ang); eu->ychange = MOVEy(vel, ang);
@ -11537,7 +11537,7 @@ SpawnGrenadeExp(int16_t Weapon)
PlaySound(DIGI_30MMEXPLODE, sp, v3df_none); PlaySound(DIGI_30MMEXPLODE, sp, v3df_none);
if (RANDOM_RANGE(1000) > 990) if (RandomRange(1000) > 990)
{ {
if (sp->owner >= 0 && User[sp->owner].Data() && User[sp->owner]->PlayerP) if (sp->owner >= 0 && User[sp->owner].Data() && User[sp->owner]->PlayerP)
{ {
@ -11552,9 +11552,9 @@ SpawnGrenadeExp(int16_t Weapon)
if (u->ID == ZILLA_RUN_R0) if (u->ID == ZILLA_RUN_R0)
{ {
dx += RANDOM_RANGE(1000)-RANDOM_RANGE(1000); dx += RandomRange(1000)-RandomRange(1000);
dy += RANDOM_RANGE(1000)-RANDOM_RANGE(1000); dy += RandomRange(1000)-RandomRange(1000);
dz = SPRITEp_MID(sp) + RANDOM_RANGE(1000)-RANDOM_RANGE(1000); dz = SPRITEp_MID(sp) + RandomRange(1000)-RandomRange(1000);
} }
explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_GrenadeExp, sp->sectnum, explosion = SpawnSprite(STAT_MISSILE, GRENADE_EXP, s_GrenadeExp, sp->sectnum,
@ -13115,7 +13115,7 @@ InitVulcanBoulder(short SpriteNum)
if (SP_TAG7(sp)) if (SP_TAG7(sp))
{ {
delta = SP_TAG5(sp); delta = SP_TAG5(sp);
nang = sp->ang + (RANDOM_RANGE(delta) - DIV2(delta)); nang = sp->ang + (RandomRange(delta) - DIV2(delta));
nang = NORM_ANGLE(nang); nang = NORM_ANGLE(nang);
} }
else else
@ -13130,13 +13130,13 @@ InitVulcanBoulder(short SpriteNum)
// Spawn a shot // Spawn a shot
w = SpawnSprite(STAT_MISSILE, LAVA_BOULDER, s_VulcanBoulder, sp->sectnum, w = SpawnSprite(STAT_MISSILE, LAVA_BOULDER, s_VulcanBoulder, sp->sectnum,
nx, ny, nz, nang, (vel/2 + vel/4) + RANDOM_RANGE(vel/4)); nx, ny, nz, nang, (vel/2 + vel/4) + RandomRange(vel/4));
wp = &sprite[w]; wp = &sprite[w];
wu = User[w].Data(); wu = User[w].Data();
SetOwner(SpriteNum, w); SetOwner(SpriteNum, w);
wp->xrepeat = wp->yrepeat = 8 + RANDOM_RANGE(72); wp->xrepeat = wp->yrepeat = 8 + RandomRange(72);
wp->shade = -40; wp->shade = -40;
wp->ang = nang; wp->ang = nang;
wu->Counter = 0; wu->Counter = 0;
@ -13166,7 +13166,7 @@ InitVulcanBoulder(short SpriteNum)
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
wu->zchange = -Z(zvel) + -Z(RANDOM_RANGE(zvel_rand)); wu->zchange = -Z(zvel) + -Z(RandomRange(zvel_rand));
return w; return w;
} }
@ -13685,7 +13685,7 @@ InitSwordAttack(PLAYERp pp)
for (i = 0; i < (int)SIZ(dangs); i++) for (i = 0; i < (int)SIZ(dangs); i++)
{ {
if (RANDOM_RANGE(1000) < 500) continue; // Don't spawn bubbles every time if (RandomRange(1000) < 500) continue; // Don't spawn bubbles every time
bubble = SpawnBubble(short(pp->SpriteP - sprite)); bubble = SpawnBubble(short(pp->SpriteP - sprite));
if (bubble >= 0) if (bubble >= 0)
{ {
@ -13742,7 +13742,7 @@ InitSwordAttack(PLAYERp pp)
int daz; int daz;
daang = pp->angle.ang.asbuild(); daang = pp->angle.ang.asbuild();
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RANDOM_RANGE(24000) - 12000); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
bcos(daang), // X vector of 3D ang bcos(daang), // X vector of 3D ang
@ -13933,7 +13933,7 @@ InitFistAttack(PLAYERp pp)
int daz; int daz;
daang = pp->angle.ang.asbuild(); daang = pp->angle.ang.asbuild();
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RANDOM_RANGE(24000) - 12000); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
bcos(daang), // X vector of 3D ang bcos(daang), // X vector of 3D ang
@ -14004,7 +14004,7 @@ InitFistAttack(PLAYERp pp)
case 4947: case 4947:
SpawnSwordSparks(pp, hitinfo.sect, -1, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hitinfo.sect, -1, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang);
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none);
if (RANDOM_RANGE(1000) > 700) if (RandomRange(1000) > 700)
PlayerUpdateHealth(pp,1); // Give some health PlayerUpdateHealth(pp,1); // Give some health
SET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
break; break;
@ -14036,7 +14036,7 @@ InitFistAttack(PLAYERp pp)
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none);
if (PlayerTakeDamage(pp, -1)) if (PlayerTakeDamage(pp, -1))
{ {
PlayerUpdateHealth(pp, -(RANDOM_RANGE(2<<8)>>8)); PlayerUpdateHealth(pp, -(RandomRange(2<<8)>>8));
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, -1);
} }
} }
@ -14949,13 +14949,13 @@ InitShotgun(PLAYERp pp)
{ {
if (pp->WpnShotgunType == 0) if (pp->WpnShotgunType == 0)
{ {
ndaz = daz + (RANDOM_RANGE(Z(120)) - Z(45)); ndaz = daz + (RandomRange(Z(120)) - Z(45));
ndaang = NORM_ANGLE(daang + (RANDOM_RANGE(30) - 15)); ndaang = NORM_ANGLE(daang + (RandomRange(30) - 15));
} }
else else
{ {
ndaz = daz + (RANDOM_RANGE(Z(200)) - Z(65)); ndaz = daz + (RandomRange(Z(200)) - Z(65));
ndaang = NORM_ANGLE(daang + (RANDOM_RANGE(70) - 30)); ndaang = NORM_ANGLE(daang + (RandomRange(70) - 30));
} }
xvect = bcos(ndaang); xvect = bcos(ndaang);
@ -15855,7 +15855,7 @@ InitMicro(PLAYERp pp)
} }
nz = pp->posz + pp->bob_z + Z(14); nz = pp->posz + pp->bob_z + Z(14);
nz += Z(RANDOM_RANGE(20)) - Z(10); nz += Z(RandomRange(20)) - Z(10);
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
@ -15874,7 +15874,7 @@ InitMicro(PLAYERp pp)
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
// randomize zvelocity // randomize zvelocity
wp->zvel += RANDOM_RANGE(Z(8)) - Z(5); wp->zvel += RandomRange(Z(8)) - Z(5);
wu->RotNum = 5; wu->RotNum = 5;
NewStateGroup(w, &sg_Micro[0]); NewStateGroup(w, &sg_Micro[0]);
@ -15887,7 +15887,7 @@ InitMicro(PLAYERp pp)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE); SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
wu->WaitTics = 10 + RANDOM_RANGE(40); wu->WaitTics = 10 + RandomRange(40);
// at certain angles the clipping box was big enough to block the // at certain angles the clipping box was big enough to block the
// initial positioning of the fireball. // initial positioning of the fireball.
@ -15896,7 +15896,7 @@ InitMicro(PLAYERp pp)
wp->ang = NORM_ANGLE(wp->ang + 512); wp->ang = NORM_ANGLE(wp->ang + 512);
#define MICRO_LATERAL 5000 #define MICRO_LATERAL 5000
HelpMissileLateral(w, 1000 + (RANDOM_RANGE(MICRO_LATERAL) - DIV2(MICRO_LATERAL))); HelpMissileLateral(w, 1000 + (RandomRange(MICRO_LATERAL) - DIV2(MICRO_LATERAL)));
wp->ang = NORM_ANGLE(wp->ang - 512); wp->ang = NORM_ANGLE(wp->ang - 512);
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
@ -15933,7 +15933,7 @@ InitMicro(PLAYERp pp)
} }
else else
{ {
wp->ang = NORM_ANGLE(wp->ang + (RANDOM_RANGE(MICRO_ANG) - DIV2(MICRO_ANG)) - 16); wp->ang = NORM_ANGLE(wp->ang + (RandomRange(MICRO_ANG) - DIV2(MICRO_ANG)) - 16);
} }
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
@ -15974,7 +15974,7 @@ InitRipperSlash(short SpriteNum)
if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 600) && FACING_RANGE(hp, sp, 150)) if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 600) && FACING_RANGE(hp, sp, 150))
{ {
// PlaySound(PlayerPainVocs[RANDOM_RANGE(MAX_PAIN)], sp, v3df_none); // PlaySound(PlayerPainVocs[RandomRange(MAX_PAIN)], sp, v3df_none);
DoDamage(i, SpriteNum); DoDamage(i, SpriteNum);
} }
} }
@ -16042,7 +16042,7 @@ InitSerpSlash(short SpriteNum)
if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 800) && FACING_RANGE(hp, sp, 150)) if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 800) && FACING_RANGE(hp, sp, 150))
{ {
// PlaySound(PlayerPainVocs[RANDOM_RANGE(MAX_PAIN)], sp, v3df_none); // PlaySound(PlayerPainVocs[RandomRange(MAX_PAIN)], sp, v3df_none);
DoDamage(i, SpriteNum); DoDamage(i, SpriteNum);
} }
} }
@ -16122,7 +16122,7 @@ DoBladeDamage(short SpriteNum)
if (WallSpriteInsideSprite(sp, hp)) if (WallSpriteInsideSprite(sp, hp))
{ {
DoDamage(i, SpriteNum); DoDamage(i, SpriteNum);
// PlaySound(PlayerPainVocs[RANDOM_RANGE(MAX_PAIN)], sp, v3df_none); // PlaySound(PlayerPainVocs[RandomRange(MAX_PAIN)], sp, v3df_none);
} }
} }
} }
@ -16205,7 +16205,7 @@ InitCoolgBash(short SpriteNum)
if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 600) && FACING_RANGE(hp, sp, 150)) if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 600) && FACING_RANGE(hp, sp, 150))
{ {
// PlaySound(PlayerPainVocs[RANDOM_RANGE(MAX_PAIN)], sp, v3df_none); // PlaySound(PlayerPainVocs[RandomRange(MAX_PAIN)], sp, v3df_none);
DoDamage(i, SpriteNum); DoDamage(i, SpriteNum);
} }
} }
@ -16239,7 +16239,7 @@ InitSkelSlash(short SpriteNum)
if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 600) && FACING_RANGE(hp, sp, 150)) if (dist < CLOSE_RANGE_DIST_FUDGE(sp, hp, 600) && FACING_RANGE(hp, sp, 150))
{ {
// PlaySound(PlayerPainVocs[RANDOM_RANGE(MAX_PAIN)], sp, v3df_none); // PlaySound(PlayerPainVocs[RandomRange(MAX_PAIN)], sp, v3df_none);
DoDamage(i, SpriteNum); DoDamage(i, SpriteNum);
} }
} }
@ -17114,7 +17114,7 @@ GenerateDrips(short SpriteNum)
if (sp->lotag == 0) if (sp->lotag == 0)
u->WaitTics = RANDOM_P2(256<<8)>>8; u->WaitTics = RANDOM_P2(256<<8)>>8;
else else
u->WaitTics = (sp->lotag * 120) + SEC(RANDOM_RANGE(3<<8)>>8); u->WaitTics = (sp->lotag * 120) + SEC(RandomRange(3<<8)>>8);
if (TEST_BOOL2(sp)) if (TEST_BOOL2(sp))
{ {
@ -17459,7 +17459,7 @@ InitTracerUzi(PLAYERp pp)
WeaponAutoAim(pp->SpriteP, w, 32, false); WeaponAutoAim(pp->SpriteP, w, 32, false);
// a bit of randomness // a bit of randomness
wp->ang = NORM_ANGLE(wp->ang + RANDOM_RANGE(30) - 15); wp->ang = NORM_ANGLE(wp->ang + RandomRange(30) - 15);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -17516,7 +17516,7 @@ InitTracerTurret(short SpriteNum, short Operator, fixed_t q16horiz)
WeaponAutoAim(sp, w, 32, false); WeaponAutoAim(sp, w, 32, false);
// a bit of randomness // a bit of randomness
wp->ang = NORM_ANGLE(wp->ang + RANDOM_RANGE(30) - 15); wp->ang = NORM_ANGLE(wp->ang + RandomRange(30) - 15);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -17800,15 +17800,15 @@ InitUzi(PLAYERp pp)
daang = 32; daang = 32;
if (WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, false) != -1) if (WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, false) != -1)
{ {
daang += RANDOM_RANGE(24) - 12; daang += RandomRange(24) - 12;
daang = NORM_ANGLE(daang); daang = NORM_ANGLE(daang);
daz += RANDOM_RANGE(10000) - 5000; daz += RandomRange(10000) - 5000;
} }
else else
{ {
//daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25)); //daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25));
daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(24) - 12)); daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(24) - 12));
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RANDOM_RANGE(24000) - 12000); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000);
} }
@ -17984,7 +17984,7 @@ InitEMP(PLAYERp pp)
InitTracerUzi(pp); InitTracerUzi(pp);
//daz = nz = pp->posz + Z(8) + -MulScale(pp->horizon.horiz.asq16(), 72, 16); //daz = nz = pp->posz + Z(8) + -MulScale(pp->horizon.horiz.asq16(), 72, 16);
//daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25)); //daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25));
daz = nz = pp->posz + pp->bob_z; daz = nz = pp->posz + pp->bob_z;
daang = 64; daang = 64;
@ -18106,7 +18106,7 @@ InitEMP(PLAYERp pp)
// attach weapon to sprite // attach weapon to sprite
SetAttach(hitinfo.sprite, j); SetAttach(hitinfo.sprite, j);
wu->sz = sprite[hitinfo.sprite].z - wp->z; wu->sz = sprite[hitinfo.sprite].z - wp->z;
if (RANDOM_RANGE(1000) > 500) if (RandomRange(1000) > 500)
PlayerSound(DIGI_YOULOOKSTUPID, v3df_follow|v3df_dontpan,pp); PlayerSound(DIGI_YOULOOKSTUPID, v3df_follow|v3df_dontpan,pp);
} }
else else
@ -18171,7 +18171,7 @@ InitTankShell(short SpriteNum, PLAYERp pp)
WeaponAutoAim(sp, w, 64, false); WeaponAutoAim(sp, w, 64, false);
// a bit of randomness // a bit of randomness
wp->ang += RANDOM_RANGE(30) - 15; wp->ang += RandomRange(30) - 15;
wp->ang = NORM_ANGLE(wp->ang); wp->ang = NORM_ANGLE(wp->ang);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
@ -18231,7 +18231,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
} }
nz = sp->z; nz = sp->z;
nz += Z(RANDOM_RANGE(20)) - Z(10); nz += Z(RandomRange(20)) - Z(10);
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
@ -18250,7 +18250,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
// randomize zvelocity // randomize zvelocity
wp->zvel += RANDOM_RANGE(Z(8)) - Z(5); wp->zvel += RandomRange(Z(8)) - Z(5);
wu->RotNum = 5; wu->RotNum = 5;
NewStateGroup(w, &sg_Micro[0]); NewStateGroup(w, &sg_Micro[0]);
@ -18263,7 +18263,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE); SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
wu->WaitTics = 10 + RANDOM_RANGE(40); wu->WaitTics = 10 + RandomRange(40);
#define MICRO_ANG 400 #define MICRO_ANG 400
@ -18283,7 +18283,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
} }
else else
{ {
wp->ang = NORM_ANGLE(wp->ang + (RANDOM_RANGE(MICRO_ANG) - DIV2(MICRO_ANG)) - 16); wp->ang = NORM_ANGLE(wp->ang + (RandomRange(MICRO_ANG) - DIV2(MICRO_ANG)) - 16);
} }
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
@ -18331,7 +18331,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp)
WeaponAutoAim(sp, w, 64, false); WeaponAutoAim(sp, w, 64, false);
// a bit of randomness // a bit of randomness
//wp->ang += RANDOM_RANGE(30) - 15; //wp->ang += RandomRange(30) - 15;
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -18378,7 +18378,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp)
WeaponAutoAim(sp, w, 64, false); WeaponAutoAim(sp, w, 64, false);
// a bit of randomness // a bit of randomness
wp->ang += RANDOM_RANGE(30) - 15; wp->ang += RandomRange(30) - 15;
wp->ang = NORM_ANGLE(wp->ang); wp->ang = NORM_ANGLE(wp->ang);
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
@ -18534,7 +18534,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
daang = 64; daang = 64;
if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1) if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1)
{ {
daz += RANDOM_RANGE(Z(30)) - Z(15); daz += RandomRange(Z(30)) - Z(15);
//daz += 0; //daz += 0;
} }
else else
@ -18544,7 +18544,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
if (q16horiz < horizmin) if (q16horiz < horizmin)
q16horiz = horizmin; q16horiz = horizmin;
daz = -MulScale(q16horiz, 2000, 16) + (RANDOM_RANGE(Z(80)) - Z(40)); daz = -MulScale(q16horiz, 2000, 16) + (RandomRange(Z(80)) - Z(40));
daang = sp->ang; daang = sp->ang;
} }
@ -18945,7 +18945,7 @@ InitTurretMgun(SECTOR_OBJECTp sop)
else else
{ {
// randomize the z for shots // randomize the z for shots
daz += RANDOM_RANGE(Z(120)) - Z(60); daz += RandomRange(Z(120)) - Z(60);
// never auto aim the angle // never auto aim the angle
daang = sp->ang; daang = sp->ang;
daang = NORM_ANGLE(daang + RANDOM_P2(64) - 32); daang = NORM_ANGLE(daang + RANDOM_P2(64) - 32);
@ -18957,7 +18957,7 @@ InitTurretMgun(SECTOR_OBJECTp sop)
daang = 64; daang = 64;
if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1) if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1)
{ {
daz += RANDOM_RANGE(Z(30)) - Z(15); daz += RandomRange(Z(30)) - Z(15);
} }
} }
@ -19093,9 +19093,9 @@ InitEnemyUzi(short SpriteNum)
{ {
// set angle to player and also face player when attacking // set angle to player and also face player when attacking
sp->ang = daang; sp->ang = daang;
daang += RANDOM_RANGE(24) - 12; daang += RandomRange(24) - 12;
daang = NORM_ANGLE(daang); daang = NORM_ANGLE(daang);
daz += RANDOM_RANGE(Z(40)) - Z(20); daz += RandomRange(Z(40)) - Z(20);
} }
else else
{ {
@ -19374,7 +19374,7 @@ InitSpriteGrenade(short SpriteNum)
SET(wp->cstat, CSTAT_SPRITE_BLOCK); SET(wp->cstat, CSTAT_SPRITE_BLOCK);
//wp->zvel = (-RANDOM_RANGE(100) * HORIZ_MULT); //wp->zvel = (-RandomRange(100) * HORIZ_MULT);
wp->zvel = -2000; wp->zvel = -2000;
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
@ -20732,7 +20732,7 @@ int QueueFootPrint(short hit_sprite)
if (FloorBloodQueue[FloorBloodQueueHead] != -1) if (FloorBloodQueue[FloorBloodQueueHead] != -1)
KillSprite(FloorBloodQueue[FloorBloodQueueHead]); KillSprite(FloorBloodQueue[FloorBloodQueueHead]);
rnd_num = RANDOM_RANGE(1024); rnd_num = RandomRange(1024);
if (rnd_num > 683) if (rnd_num > 683)
FloorBloodQueue[FloorBloodQueueHead] = SpriteNum = FloorBloodQueue[FloorBloodQueueHead] = SpriteNum =
@ -20869,7 +20869,7 @@ int QueueWallBlood(short hit_sprite, short ang)
KillSprite(WallBloodQueue[WallBloodQueueHead]); KillSprite(WallBloodQueue[WallBloodQueueHead]);
// Randomly choose a wall blood sprite // Randomly choose a wall blood sprite
rndnum = RANDOM_RANGE(1024); rndnum = RandomRange(1024);
if (rndnum > 768) if (rndnum > 768)
{ {
WallBloodQueue[WallBloodQueueHead] = SpriteNum = WallBloodQueue[WallBloodQueueHead] = SpriteNum =
@ -20986,7 +20986,7 @@ DoFloorBlood(short SpriteNum)
{ {
if (pp->NumFootPrints <= 0 || FootMode != BLOOD_FOOT) if (pp->NumFootPrints <= 0 || FootMode != BLOOD_FOOT)
{ {
pp->NumFootPrints = RANDOM_RANGE(10)+3; pp->NumFootPrints = RandomRange(10)+3;
FootMode = BLOOD_FOOT; FootMode = BLOOD_FOOT;
} }
@ -21326,7 +21326,7 @@ ShrapKillSprite(short SpriteNum)
USERp u = User[SpriteNum].Data(); USERp u = User[SpriteNum].Data();
short rnd_num; short rnd_num;
rnd_num = RANDOM_RANGE(1024); rnd_num = RandomRange(1024);
ASSERT(u); ASSERT(u);
@ -21376,10 +21376,10 @@ ShrapKillSprite(short SpriteNum)
return 0; return 0;
break; break;
case GORE_Lung: case GORE_Lung:
if (RANDOM_RANGE(1000) > 500) break; if (RandomRange(1000) > 500) break;
sp->clipdist = SPRITEp_SIZE_X(sp); sp->clipdist = SPRITEp_SIZE_X(sp);
SpawnFloorSplash(SpriteNum); SpawnFloorSplash(SpriteNum);
if (RANDOM_RANGE(1000) < 500) if (RandomRange(1000) < 500)
PlaySound(DIGI_GIBS1, sp, v3df_none); PlaySound(DIGI_GIBS1, sp, v3df_none);
else else
PlaySound(DIGI_GIBS2, sp, v3df_none); PlaySound(DIGI_GIBS2, sp, v3df_none);
@ -21398,10 +21398,10 @@ ShrapKillSprite(short SpriteNum)
return 0; return 0;
break; break;
case GORE_Liver: case GORE_Liver:
if (RANDOM_RANGE(1000) > 500) break; if (RandomRange(1000) > 500) break;
sp->clipdist = SPRITEp_SIZE_X(sp); sp->clipdist = SPRITEp_SIZE_X(sp);
SpawnFloorSplash(SpriteNum); SpawnFloorSplash(SpriteNum);
if (RANDOM_RANGE(1000) < 500) if (RandomRange(1000) < 500)
PlaySound(DIGI_GIBS1, sp, v3df_none); PlaySound(DIGI_GIBS1, sp, v3df_none);
else else
PlaySound(DIGI_GIBS2, sp, v3df_none); PlaySound(DIGI_GIBS2, sp, v3df_none);
@ -21420,7 +21420,7 @@ ShrapKillSprite(short SpriteNum)
return 0; return 0;
break; break;
case GORE_SkullCap: case GORE_SkullCap:
if (RANDOM_RANGE(1000) > 500) break; if (RandomRange(1000) > 500) break;
sp->clipdist = SPRITEp_SIZE_X(sp); sp->clipdist = SPRITEp_SIZE_X(sp);
SpawnFloorSplash(SpriteNum); SpawnFloorSplash(SpriteNum);
if (rnd_num > 683) if (rnd_num > 683)
@ -21438,7 +21438,7 @@ ShrapKillSprite(short SpriteNum)
return 0; return 0;
break; break;
case GORE_Head: case GORE_Head:
if (RANDOM_RANGE(1000) > 500) break; if (RandomRange(1000) > 500) break;
sp->clipdist = SPRITEp_SIZE_X(sp); sp->clipdist = SPRITEp_SIZE_X(sp);
QueueFloorBlood(SpriteNum); QueueFloorBlood(SpriteNum);
QueueGeneric(SpriteNum,GORE_Head); QueueGeneric(SpriteNum,GORE_Head);

View file

@ -765,7 +765,7 @@ int DoZillaDeathMelt(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum].Data(); USERp u = User[SpriteNum].Data();
if (RANDOM_RANGE(1000) > 800) if (RandomRange(1000) > 800)
SpawnGrenadeExp(SpriteNum); SpawnGrenadeExp(SpriteNum);
u->ID = ZILLA_RUN_R0; u->ID = ZILLA_RUN_R0;