Add extra categories and apply based on non-blocking review

- PR_RANDOMANIM // FF_ANIMATE|FF_RANDOMANIM
- PR_BUBBLE // Decorative air bubbles
- PR_RULESCRAMBLE // Netgame rule scrambing events
- PR_ITEM_DEBRIS // Item debris
- PR_ITEM_BUBBLE // Item bubbles
- PR_ITEM_BOOST // Boost
- PR_SMOLDERING // Smoldering particles
- PR_SPARKLE // Endsign and/or Emerald
- PR_MOVINGTARGET // Randomised moving targets
This commit is contained in:
toaster 2022-09-24 22:01:00 +01:00
parent 5c36e72115
commit 6ab24e6055
8 changed files with 161 additions and 145 deletions

View file

@ -515,26 +515,26 @@ void K_SetPowerLevelScrambles(SINT8 powertype)
{
case 5:
speed = KARTSPEED_HARD;
encore = P_RandomChance(PR_UNDEFINED, FRACUNIT>>1);
encore = P_RandomChance(PR_RULESCRAMBLE, FRACUNIT>>1);
break;
case 4:
speed = P_RandomChance(PR_UNDEFINED, (7<<FRACBITS)/10) ? KARTSPEED_HARD : KARTSPEED_NORMAL;
encore = P_RandomChance(PR_UNDEFINED, FRACUNIT>>1);
speed = P_RandomChance(PR_RULESCRAMBLE, (7<<FRACBITS)/10) ? KARTSPEED_HARD : KARTSPEED_NORMAL;
encore = P_RandomChance(PR_RULESCRAMBLE, FRACUNIT>>1);
break;
case 3:
speed = P_RandomChance(PR_UNDEFINED, (3<<FRACBITS)/10) ? KARTSPEED_HARD : KARTSPEED_NORMAL;
encore = P_RandomChance(PR_UNDEFINED, FRACUNIT>>2);
speed = P_RandomChance(PR_RULESCRAMBLE, (3<<FRACBITS)/10) ? KARTSPEED_HARD : KARTSPEED_NORMAL;
encore = P_RandomChance(PR_RULESCRAMBLE, FRACUNIT>>2);
break;
case 2:
speed = KARTSPEED_NORMAL;
encore = P_RandomChance(PR_UNDEFINED, FRACUNIT>>3);
encore = P_RandomChance(PR_RULESCRAMBLE, FRACUNIT>>3);
break;
case 1: default:
speed = KARTSPEED_NORMAL;
encore = false;
break;
case 0:
speed = P_RandomChance(PR_UNDEFINED, (3<<FRACBITS)/10) ? KARTSPEED_EASY : KARTSPEED_NORMAL;
speed = P_RandomChance(PR_RULESCRAMBLE, (3<<FRACBITS)/10) ? KARTSPEED_EASY : KARTSPEED_NORMAL;
encore = false;
break;
}

View file

@ -36,15 +36,31 @@ typedef enum
// However each instance of RNG being used for
// gameplay should be split up as much as possible.
PR_ITEM_ROULETTE, // Item results
PR_ITEM_RINGS, // Flung ring direction
PR_ITEM_SHRINK, // Shrink gun offsets
PR_PLAYERSTARTS, // Player starts
PR_TERRAIN, // TERRAIN particles
PR_EXECUTOR, // Linedef executor
PR_DECORATION, // Generic decoration
PR_TERRAIN, // TERRAIN particles
PR_BUBBLE, // Decorative air bubbles
PR_RANDOMANIM, // FF_ANIMATE|FF_RANDOMANIM
PR_PLAYERSTARTS, // Player starts
PR_VOICES, // Player voice sounds
PR_RULESCRAMBLE, // Netgame rule scrambing events
PR_ITEM_ROULETTE, // Item results
PR_ITEM_RINGS, // Flung ring/bumper/player (on death)
PR_ITEM_SHRINK, // Shrink gun offsets
PR_ITEM_BUBBLE, // Item bubbles
PR_ITEM_DEBRIS, // Item debris
PR_ITEM_BOOST, // Boost
PR_EXPLOSION, // Explosion VFX
PR_SMOLDERING, // Smoldering particles
PR_SPARKLE, // Endsign and/or Emerald
PR_MOVINGTARGET, // Randomised moving targets
PRNUMCLASS
} pr_class_t;

View file

@ -3273,7 +3273,7 @@ void A_BossScream(mobj_t *actor)
return;
if (locvar1 & 1)
fa = (FixedAngle(P_RandomKey(PR_UNDEFINED, 360)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
fa = (FixedAngle(P_RandomKey(PR_EXPLOSION, 360)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
else
{
actor->movecount += 4*16;
@ -3290,11 +3290,11 @@ void A_BossScream(mobj_t *actor)
explodetype = (mobjtype_t)locvar2;
if (locvar1 & 2)
z = actor->z + (P_RandomKey(PR_UNDEFINED, (actor->height - mobjinfo[explodetype].height)>>FRACBITS)<<FRACBITS);
z = actor->z + (P_RandomKey(PR_EXPLOSION, (actor->height - mobjinfo[explodetype].height)>>FRACBITS)<<FRACBITS);
else if (actor->eflags & MFE_VERTICALFLIP)
z = actor->z + actor->height - mobjinfo[explodetype].height - FixedMul((P_RandomByte(PR_UNDEFINED)<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale);
z = actor->z + actor->height - mobjinfo[explodetype].height - FixedMul((P_RandomByte(PR_EXPLOSION)<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale);
else
z = actor->z + FixedMul((P_RandomByte(PR_UNDEFINED)<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale);
z = actor->z + FixedMul((P_RandomByte(PR_EXPLOSION)<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale);
mo = P_SpawnMobj(x, y, z, explodetype);
if (actor->eflags & MFE_VERTICALFLIP)
@ -3811,7 +3811,7 @@ void A_BubbleSpawn(mobj_t *actor)
return; // don't make bubble!
}
prandom = P_RandomByte(PR_UNDEFINED);
prandom = P_RandomByte(PR_BUBBLE);
if (leveltime % (3*TICRATE) < 8)
bubble = P_SpawnMobj(actor->x, actor->y, actor->z + (actor->height / 2), MT_EXTRALARGEBUBBLE);
@ -3859,7 +3859,7 @@ void A_FanBubbleSpawn(mobj_t *actor)
return; // don't make bubble!
}
prandom = P_RandomByte(PR_UNDEFINED);
prandom = P_RandomByte(PR_BUBBLE);
if ((prandom & 0x7) == 0x7)
bubble = P_SpawnMobj(actor->x, actor->y, hz, MT_SMALLBUBBLE);
@ -3899,7 +3899,7 @@ void A_BubbleRise(mobj_t *actor)
// Move around slightly to make it look like it's bending around the water
if (!locvar1)
{
UINT8 prandom = P_RandomByte(PR_UNDEFINED);
UINT8 prandom = P_RandomByte(PR_BUBBLE);
if (!(prandom & 0x7)) // *****000
{
P_InstaThrust(actor, prandom & 0x70 ? actor->angle + ANGLE_90 : actor->angle,
@ -4246,7 +4246,7 @@ void A_SetSolidSteam(mobj_t *actor)
if (!(actor->flags2 & MF2_AMBUSH))
{
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/8))
if (P_RandomChance(PR_DECORATION, FRACUNIT/8))
{
if (actor->info->deathsound)
S_StartSound(actor, actor->info->deathsound); // Hiss!
@ -5249,7 +5249,7 @@ void A_RockSpawn(mobj_t *actor)
type = MT_ROCKCRUMBLE1 + (sides[line->sidenum[0]].rowoffset >> FRACBITS);
if (line->flags & ML_NOCLIMB)
randomoomph = P_RandomByte(PR_UNDEFINED) * (FRACUNIT/32);
randomoomph = P_RandomByte(PR_DECORATION) * (FRACUNIT/32);
else
randomoomph = 0;
@ -5797,7 +5797,7 @@ void A_MixUp(mobj_t *actor)
{
if (counter > 255) // fail-safe to avoid endless loop
break;
prandom = P_RandomByte(PR_UNDEFINED);
prandom = P_RandomByte(PR_PLAYERSTARTS);
prandom %= numplayers; // I love modular arithmetic, don't you?
if (prandom) // Make sure it's not a useless mix
break;
@ -7122,7 +7122,7 @@ void A_SmokeTrailer(mobj_t *actor)
P_SetObjectMomZ(th, FRACUNIT, false);
th->destscale = actor->scale;
P_SetScale(th, actor->scale);
th->tics -= P_RandomByte(PR_UNDEFINED) & 3;
th->tics -= P_RandomByte(PR_SMOLDERING) & 3;
if (th->tics < 1)
th->tics = 1;
}
@ -7239,7 +7239,7 @@ void A_ChangeAngleRelative(mobj_t *actor)
if (angle > amax)
angle = amax;*/
actor->angle += FixedAngle(P_RandomRange(PR_UNDEFINED, amin, amax));
actor->angle += FixedAngle(P_RandomRange(PR_RANDOMANIM, amin, amax));
}
// Function: A_ChangeAngleAbsolute
@ -7272,7 +7272,7 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
if (angle > amax)
angle = amax;*/
actor->angle = FixedAngle(P_RandomRange(PR_UNDEFINED, amin, amax));
actor->angle = FixedAngle(P_RandomRange(PR_RANDOMANIM, amin, amax));
}
// Function: A_RollAngle
@ -7321,7 +7321,7 @@ void A_ChangeRollAngleRelative(mobj_t *actor)
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
#endif
actor->rollangle += FixedAngle(P_RandomRange(PR_UNDEFINED, amin, amax));
actor->rollangle += FixedAngle(P_RandomRange(PR_RANDOMANIM, amin, amax));
}
// Function: A_ChangeRollAngleAbsolute
@ -7346,7 +7346,7 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
#endif
actor->rollangle = FixedAngle(P_RandomRange(PR_UNDEFINED, amin, amax));
actor->rollangle = FixedAngle(P_RandomRange(PR_RANDOMANIM, amin, amax));
}
// Function: A_PlaySound
@ -7536,7 +7536,7 @@ void A_SetRandomTics(mobj_t *actor)
if (LUA_CallAction(A_SETRANDOMTICS, actor))
return;
actor->tics = P_RandomRange(PR_UNDEFINED, locvar1, locvar2);
actor->tics = P_RandomRange(PR_RANDOMANIM, locvar1, locvar2);
}
// Function: A_ChangeColorRelative
@ -7981,7 +7981,7 @@ void A_RandomState(mobj_t *actor)
if (LUA_CallAction(A_RANDOMSTATE, actor))
return;
P_SetMobjState(actor, P_RandomChance(PR_UNDEFINED, FRACUNIT/2) ? locvar1 : locvar2);
P_SetMobjState(actor, P_RandomChance(PR_RANDOMANIM, FRACUNIT/2) ? locvar1 : locvar2);
}
// Function: A_RandomStateRange
@ -7999,7 +7999,7 @@ void A_RandomStateRange(mobj_t *actor)
if (LUA_CallAction(A_RANDOMSTATERANGE, actor))
return;
P_SetMobjState(actor, P_RandomRange(PR_UNDEFINED, locvar1, locvar2));
P_SetMobjState(actor, P_RandomRange(PR_RANDOMANIM, locvar1, locvar2));
}
// Function: A_StateRangeByAngle
@ -8753,7 +8753,7 @@ void A_CheckRandom(mobj_t *actor)
chance *= (locvar1 >> 16);
chance /= (locvar1 & 0xFFFF);
if (P_RandomChance(PR_UNDEFINED, chance))
if (P_RandomChance(PR_RANDOMANIM, chance))
P_SetMobjState(actor, locvar2);
}
@ -10937,9 +10937,9 @@ void A_FlameParticle(mobj_t *actor)
rad = actor->radius>>FRACBITS;
hei = actor->height>>FRACBITS;
particle = P_SpawnMobjFromMobj(actor,
P_RandomRange(PR_UNDEFINED, rad, -rad)<<FRACBITS,
P_RandomRange(PR_UNDEFINED, rad, -rad)<<FRACBITS,
P_RandomRange(PR_UNDEFINED, hei/2, hei)<<FRACBITS,
P_RandomRange(PR_DECORATION, rad, -rad)<<FRACBITS,
P_RandomRange(PR_DECORATION, rad, -rad)<<FRACBITS,
P_RandomRange(PR_DECORATION, hei/2, hei)<<FRACBITS,
type);
P_SetObjectMomZ(particle, 2<<FRACBITS, false);
}
@ -11073,20 +11073,20 @@ void A_LightBeamReset(mobj_t *actor)
if (LUA_CallAction(A_LIGHTBEAMRESET, actor))
return;
actor->destscale = FRACUNIT + P_SignedRandom(PR_UNDEFINED)*FRACUNIT/256;
actor->destscale = FRACUNIT + P_SignedRandom(PR_DECORATION)*FRACUNIT/256;
P_SetScale(actor, actor->destscale);
if (!actor->spawnpoint)
return; // this can't work properly welp
actor->momx = -(P_SignedRandom(PR_UNDEFINED)*FINESINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/128;
actor->momy = (P_SignedRandom(PR_UNDEFINED)*FINECOSINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/128;
actor->momz = (P_SignedRandom(PR_UNDEFINED)*FRACUNIT)/128;
actor->momx = -(P_SignedRandom(PR_DECORATION)*FINESINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/128;
actor->momy = (P_SignedRandom(PR_DECORATION)*FINECOSINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/128;
actor->momz = (P_SignedRandom(PR_DECORATION)*FRACUNIT)/128;
P_SetOrigin(actor,
actor->spawnpoint->x*FRACUNIT - (P_SignedRandom(PR_UNDEFINED)*FINESINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/2,
actor->spawnpoint->y*FRACUNIT + (P_SignedRandom(PR_UNDEFINED)*FINECOSINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/2,
actor->spawnpoint->z*FRACUNIT + (P_SignedRandom(PR_UNDEFINED)*FRACUNIT)/2);
actor->spawnpoint->x*FRACUNIT - (P_SignedRandom(PR_DECORATION)*FINESINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/2,
actor->spawnpoint->y*FRACUNIT + (P_SignedRandom(PR_DECORATION)*FINECOSINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/2,
actor->spawnpoint->z*FRACUNIT + (P_SignedRandom(PR_DECORATION)*FRACUNIT)/2);
}
// Function: A_MineExplode
@ -11125,9 +11125,9 @@ void A_MineExplode(mobj_t *actor)
P_SpawnMobj(actor->x, actor->y, actor->z, type);
for (i = 0; i < 16; i++)
{
mobj_t *b = P_SpawnMobj(actor->x+P_RandomRange(PR_UNDEFINED, -dist, dist)*FRACUNIT,
actor->y+P_RandomRange(PR_UNDEFINED, -dist, dist)*FRACUNIT,
actor->z+P_RandomRange(PR_UNDEFINED, ((actor->eflags & MFE_UNDERWATER) ? -dist : 0), dist)*FRACUNIT,
mobj_t *b = P_SpawnMobj(actor->x+P_RandomRange(PR_EXPLOSION, -dist, dist)*FRACUNIT,
actor->y+P_RandomRange(PR_EXPLOSION, -dist, dist)*FRACUNIT,
actor->z+P_RandomRange(PR_EXPLOSION, ((actor->eflags & MFE_UNDERWATER) ? -dist : 0), dist)*FRACUNIT,
type);
fixed_t dx = b->x - actor->x, dy = b->y - actor->y, dz = b->z - actor->z;
fixed_t dm = P_AproxDistance(dz, P_AproxDistance(dy, dx));
@ -13349,17 +13349,17 @@ void A_JawzExplode(mobj_t *actor)
{
INT32 speed, speed2;
truc = P_SpawnMobj(actor->x + P_RandomRange(PR_UNDEFINED, -8, 8)*FRACUNIT, actor->y + P_RandomRange(PR_UNDEFINED, -8, 8)*FRACUNIT,
actor->z + P_RandomRange(PR_UNDEFINED, 0, 8)*FRACUNIT, MT_BOOMPARTICLE);
truc = P_SpawnMobj(actor->x + P_RandomRange(PR_EXPLOSION, -8, 8)*FRACUNIT, actor->y + P_RandomRange(PR_EXPLOSION, -8, 8)*FRACUNIT,
actor->z + P_RandomRange(PR_EXPLOSION, 0, 8)*FRACUNIT, MT_BOOMPARTICLE);
truc->scale = actor->scale*2;
speed = FixedMul(7*FRACUNIT, actor->scale)>>FRACBITS;
truc->momx = P_RandomRange(PR_UNDEFINED, -speed, speed)*FRACUNIT;
truc->momy = P_RandomRange(PR_UNDEFINED, -speed, speed)*FRACUNIT;
truc->momx = P_RandomRange(PR_EXPLOSION, -speed, speed)*FRACUNIT;
truc->momy = P_RandomRange(PR_EXPLOSION, -speed, speed)*FRACUNIT;
speed = FixedMul(5*FRACUNIT, actor->scale)>>FRACBITS;
speed2 = FixedMul(15*FRACUNIT, actor->scale)>>FRACBITS;
truc->momz = P_RandomRange(PR_UNDEFINED, speed, speed2)*FRACUNIT;
truc->momz = P_RandomRange(PR_EXPLOSION, speed, speed2)*FRACUNIT;
truc->tics = TICRATE*2;
truc->color = SKINCOLOR_KETCHUP;
@ -13439,8 +13439,8 @@ void A_LandMineExplode(mobj_t *actor)
//K_MatchGenericExtraFlags(expl, actor);
P_SetScale(expl, actor->scale*4);
expl->momx = P_RandomRange(PR_UNDEFINED, -3, 3)*actor->scale/2;
expl->momy = P_RandomRange(PR_UNDEFINED, -3, 3)*actor->scale/2;
expl->momx = P_RandomRange(PR_EXPLOSION, -3, 3)*actor->scale/2;
expl->momy = P_RandomRange(PR_EXPLOSION, -3, 3)*actor->scale/2;
// 100/45 = 2.22 fu/t
expl->momz = ((i+1)*actor->scale*5/2)*P_MobjFlip(expl);
@ -13524,11 +13524,11 @@ void A_FZBoomSmoke(mobj_t *actor)
for (i = 0; i < 8+(4*var1); i++)
{
mobj_t *smoke = P_SpawnMobj(actor->x + (P_RandomRange(PR_UNDEFINED, -rad, rad)*actor->scale), actor->y + (P_RandomRange(PR_UNDEFINED, -rad, rad)*actor->scale),
actor->z + (P_RandomRange(PR_UNDEFINED, 0, 72)*actor->scale), MT_THOK);
mobj_t *smoke = P_SpawnMobj(actor->x + (P_RandomRange(PR_SMOLDERING, -rad, rad)*actor->scale), actor->y + (P_RandomRange(PR_SMOLDERING, -rad, rad)*actor->scale),
actor->z + (P_RandomRange(PR_SMOLDERING, 0, 72)*actor->scale), MT_THOK);
P_SetMobjState(smoke, S_FZEROSMOKE1);
smoke->tics += P_RandomRange(PR_UNDEFINED, -3, 4);
smoke->tics += P_RandomRange(PR_SMOLDERING, -3, 4);
smoke->scale = actor->scale*3;
}
return;
@ -13548,7 +13548,7 @@ void A_RandomShadowFrame(mobj_t *actor)
{
fake = P_SpawnMobj(actor->x, actor->y, actor->z, MT_THOK);
fake->sprite = SPR_ENM1;
fake->frame = P_RandomRange(PR_UNDEFINED, 0, 6);
fake->frame = P_RandomRange(PR_DECORATION, 0, 6);
P_SetScale(fake, FRACUNIT*3/2);
fake->scale = FRACUNIT*3/2;
fake->destscale = FRACUNIT*3/2;
@ -13651,7 +13651,7 @@ void A_MayonakaArrow(mobj_t *actor)
iswarning = actor->spawnpoint->options & MTF_OBJECTSPECIAL; // is our object a warning sign?
// "animtimer" is replaced by "extravalue1" here.
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1+1) : (P_RandomRange(PR_UNDEFINED, 0, (iswarning) ? (TICRATE/2) : TICRATE*3)));
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1+1) : (P_RandomRange(PR_DECORATION, 0, (iswarning) ? (TICRATE/2) : TICRATE*3)));
flip = ((actor->spawnpoint->options & 1) ? (3) : (0)); // flip adds 3 frames, which is the flipped version of the sign.
// special warning behavior:
if (iswarning)
@ -13691,7 +13691,7 @@ void A_MementosTPParticles(mobj_t *actor)
for (; i<4; i++)
{
particle = P_SpawnMobj(actor->x + (P_RandomRange(PR_UNDEFINED, -256, 256)<<FRACBITS), actor->y + (P_RandomRange(PR_UNDEFINED, -256, 256)<<FRACBITS), actor->z + (P_RandomRange(PR_UNDEFINED, 48, 256)<<FRACBITS), MT_MEMENTOSPARTICLE);
particle = P_SpawnMobj(actor->x + (P_RandomRange(PR_DECORATION, -256, 256)<<FRACBITS), actor->y + (P_RandomRange(PR_DECORATION, -256, 256)<<FRACBITS), actor->z + (P_RandomRange(PR_DECORATION, 48, 256)<<FRACBITS), MT_MEMENTOSPARTICLE);
particle->frame = 0;
particle->color = ((i%2) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->destscale = 1;
@ -13754,7 +13754,7 @@ void A_ReaperThinker(mobj_t *actor)
// Spawn particles as we grow out of the floor, ゴ ゴ ゴ ゴ
for (; i<16; i++)
{
particle = P_SpawnMobj(actor->x + (P_RandomRange(PR_UNDEFINED, -60, 60)<<FRACBITS), actor->y + (P_RandomRange(PR_UNDEFINED, -60, 60)<<FRACBITS), actor->z, MT_THOK);
particle = P_SpawnMobj(actor->x + (P_RandomRange(PR_DECORATION, -60, 60)<<FRACBITS), actor->y + (P_RandomRange(PR_DECORATION, -60, 60)<<FRACBITS), actor->z, MT_THOK);
particle->momz = 20<<FRACBITS;
particle->color = ((i%2 !=0) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->frame = 0;
@ -14030,9 +14030,9 @@ A_SpawnItemDebrisCloud (mobj_t *actor)
mobj_t *puff = P_SpawnMobjFromMobj(
target,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, 0, 4 * spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_DEBRIS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_DEBRIS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_DEBRIS, 0, 4 * spacing) * FRACUNIT,
MT_SPINDASHDUST
);

View file

@ -2202,7 +2202,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
for (c = topz; c > bottomz; c -= spacing)
{
spawned = P_SpawnMobj(a, b, c, type);
spawned->angle += P_RandomKey(PR_UNDEFINED, 36)*ANG10; // irrelevant for default objects but might make sense for some custom ones
spawned->angle += P_RandomKey(PR_TERRAIN, 36)*ANG10; // irrelevant for default objects but might make sense for some custom ones
if (flags & ML_EFFECT1)
{

View file

@ -416,8 +416,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
firework->momx = toucher->momx;
firework->momy = toucher->momy;
firework->momz = toucher->momz;
P_Thrust(firework, FixedAngle((72*i)<<FRACBITS), P_RandomRange(PR_UNDEFINED, 1,8)*special->scale);
P_SetObjectMomZ(firework, P_RandomRange(PR_UNDEFINED, 1,8)*special->scale, false);
P_Thrust(firework, FixedAngle((72*i)<<FRACBITS), P_RandomRange(PR_ITEM_DEBRIS, 1,8)*special->scale);
P_SetObjectMomZ(firework, P_RandomRange(PR_ITEM_DEBRIS, 1,8)*special->scale, false);
firework->color = toucher->color;
}
@ -536,7 +536,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
special->momz = 0;
special->flags |= MF_NOGRAVITY;
P_SetMobjState (special, special->info->deathstate);
S_StartSound (special, special->info->deathsound+(P_RandomKey(PR_UNDEFINED, special->info->mass)));
S_StartSound (special, special->info->deathsound+(P_RandomKey(PR_DECORATION, special->info->mass)));
}
return;
@ -1270,7 +1270,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
{
flingAngle = target->angle + ANGLE_180;
if (P_RandomByte(PR_UNDEFINED) & 1)
if (P_RandomByte(PR_ITEM_RINGS) & 1)
{
flingAngle -= ANGLE_45;
}
@ -1313,7 +1313,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
UINT8 i;
mobj_t *attacker = inflictor ? inflictor : source;
mobj_t *part = target->hnext;
angle_t angle = FixedAngle(360*P_RandomFixed(PR_UNDEFINED));
angle_t angle = FixedAngle(360*P_RandomFixed(PR_ITEM_DEBRIS));
INT16 spacing = (target->radius >> 1) / target->scale;
// set respawn fuse
@ -1338,9 +1338,9 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
{
mobj_t *puff = P_SpawnMobjFromMobj(
target,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, 0, 4*spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_DEBRIS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_DEBRIS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_DEBRIS, 0, 4*spacing) * FRACUNIT,
MT_SPINDASHDUST
);
@ -1620,7 +1620,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
if (target->info->xdeathstate != S_NULL)
{
sprflip = P_RandomChance(PR_UNDEFINED, FRACUNIT/2);
sprflip = P_RandomChance(PR_DECORATION, FRACUNIT/2);
#define makechunk(angtweak, xmov, ymov) \
chunk = P_SpawnMobjFromMobj(target, 0, 0, 0, MT_WALLSPIKE);\
@ -1633,7 +1633,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
chunk->y += ymov - forwardyoffs;\
P_SetThingPosition(chunk);\
P_InstaThrust(chunk, angtweak, 4*scale);\
chunk->momz = P_RandomRange(PR_UNDEFINED, 5, 7)*scale;\
chunk->momz = P_RandomRange(PR_DECORATION, 5, 7)*scale;\
if (flip)\
chunk->momz *= -1;\
if (sprflip)\
@ -1646,7 +1646,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
#undef makechunk
}
sprflip = P_RandomChance(PR_UNDEFINED, FRACUNIT/2);
sprflip = P_RandomChance(PR_DECORATION, FRACUNIT/2);
chunk = P_SpawnMobjFromMobj(target, 0, 0, 0, MT_WALLSPIKE);
@ -1659,7 +1659,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
chunk->y += forwardyoffs - yoffs;
P_SetThingPosition(chunk);
P_InstaThrust(chunk, ang + ANGLE_180, 2*scale);
chunk->momz = P_RandomRange(PR_UNDEFINED, 5, 7)*scale;
chunk->momz = P_RandomRange(PR_DECORATION, 5, 7)*scale;
if (flip)
chunk->momz *= -1;
if (sprflip)
@ -1673,7 +1673,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
target->y += forwardyoffs + yoffs;
P_SetThingPosition(target);
P_InstaThrust(target, ang, 2*scale);
target->momz = P_RandomRange(PR_UNDEFINED, 5, 7)*scale;
target->momz = P_RandomRange(PR_DECORATION, 5, 7)*scale;
if (flip)
target->momz *= -1;
if (!sprflip)

View file

@ -92,7 +92,7 @@ static inline INT32 randomframe (mobj_t *mobj, INT32 n)
{
// Only mobj thinkers should use synced RNG
if (mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker)
return P_RandomKey(PR_UNDEFINED, n);
return P_RandomKey(PR_RANDOMANIM, n);
else
return M_RandomKey(n);
}
@ -316,7 +316,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
}
else if (mobj->sprite2 != spr2)
{
if ((st->frame & FF_SPR2MIDSTART) && numframes && P_RandomChance(PR_UNDEFINED, FRACUNIT/2))
if ((st->frame & FF_SPR2MIDSTART) && numframes && P_RandomChance(PR_RANDOMANIM, FRACUNIT/2))
frame = numframes/2;
else
frame = 0;
@ -442,7 +442,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
}
else if (mobj->sprite2 != spr2)
{
if ((st->frame & FF_SPR2MIDSTART) && numframes && P_RandomChance(PR_UNDEFINED, FRACUNIT/2))
if ((st->frame & FF_SPR2MIDSTART) && numframes && P_RandomChance(PR_RANDOMANIM, FRACUNIT/2))
frame = numframes/2;
else
frame = 0;
@ -2503,12 +2503,12 @@ boolean P_ZMovement(mobj_t *mo)
// If deafed, give the tumbleweed another random kick if it runs out of steam.
mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale);
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/2))
if (P_RandomChance(PR_DECORATION, FRACUNIT/2))
mom.x += FixedMul(6*FRACUNIT, mo->scale);
else
mom.x -= FixedMul(6*FRACUNIT, mo->scale);
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/2))
if (P_RandomChance(PR_DECORATION, FRACUNIT/2))
mom.y += FixedMul(6*FRACUNIT, mo->scale);
else
mom.y -= FixedMul(6*FRACUNIT, mo->scale);
@ -2531,7 +2531,7 @@ boolean P_ZMovement(mobj_t *mo)
else if (mo->type == MT_FALLINGROCK)
{
if (P_MobjFlip(mo)*mom.z > FixedMul(2*FRACUNIT, mo->scale))
S_StartSound(mo, mo->info->activesound + P_RandomKey(PR_UNDEFINED, mo->info->reactiontime));
S_StartSound(mo, mo->info->activesound + P_RandomKey(PR_DECORATION, mo->info->reactiontime));
mom.z /= 2; // Rocks not so bouncy
@ -2983,7 +2983,7 @@ boolean P_SceneryZMovement(mobj_t *mo)
for (i = 0; i < 4; ++i) // split into four
{
prandom = P_RandomByte(PR_UNDEFINED);
prandom = P_RandomByte(PR_BUBBLE);
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_SMALLBUBBLE);
explodemo->momx += ((prandom & 0x0F) << (FRACBITS-2)) * (i & 2 ? -1 : 1);
explodemo->momy += ((prandom & 0xF0) << (FRACBITS-6)) * (i & 1 ? -1 : 1);
@ -2992,7 +2992,7 @@ boolean P_SceneryZMovement(mobj_t *mo)
}
if (mo->threshold != 42) // Don't make pop sound if threshold is 42.
S_StartSound(explodemo, sfx_bubbl1 + P_RandomKey(PR_UNDEFINED, 5));
S_StartSound(explodemo, sfx_bubbl1 + P_RandomKey(PR_BUBBLE, 5));
//note that we assign the bubble sound to one of the new bubbles.
// in other words, IT ACTUALLY GETS USED YAAAAAAAY
@ -3378,10 +3378,10 @@ void P_MobjCheckWater(mobj_t *mobj)
// P_RandomByte()s are called individually to allow consistency
// across various compilers, since the order of function calls
// in C is not part of the ANSI specification.
prandom[0] = P_RandomByte(PR_UNDEFINED);
prandom[1] = P_RandomByte(PR_UNDEFINED);
prandom[2] = P_RandomByte(PR_UNDEFINED);
prandom[3] = P_RandomByte(PR_UNDEFINED);
prandom[0] = P_RandomByte(PR_BUBBLE);
prandom[1] = P_RandomByte(PR_BUBBLE);
prandom[2] = P_RandomByte(PR_BUBBLE);
prandom[3] = P_RandomByte(PR_BUBBLE);
bubbletype = MT_SMALLBUBBLE;
if (!(prandom[0] & 0x3)) // medium bubble chance up to 64 from 32
@ -5408,7 +5408,7 @@ static boolean P_ParticleGenSceneryThink(mobj_t *mobj)
spawn->scalespeed = spawn->scale/mobj->health;
spawn->tics = (tic_t)mobj->health;
spawn->flags2 |= (mobj->flags2 & MF2_OBJECTFLIP);
spawn->angle += P_RandomKey(PR_UNDEFINED, 36)*ANG10; // irrelevant for default objects but might make sense for some custom ones
spawn->angle += P_RandomKey(PR_DECORATION, 36)*ANG10; // irrelevant for default objects but might make sense for some custom ones
mobj->angle += mobj->movedir;
}
@ -5519,7 +5519,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
{
mobj->health = 0;
P_SetMobjState(mobj, mobj->info->deathstate);
S_StartSound(mobj, mobj->info->deathsound + P_RandomKey(PR_UNDEFINED, mobj->info->mass));
S_StartSound(mobj, mobj->info->deathsound + P_RandomKey(PR_DECORATION, mobj->info->mass));
return;
}
break;
@ -5672,22 +5672,22 @@ static void P_MobjSceneryThink(mobj_t *mobj)
case MT_SMOLDERING:
if (leveltime % 2 == 0)
{
fixed_t x = P_RandomRange(PR_UNDEFINED, -35, 35)*mobj->scale;
fixed_t y = P_RandomRange(PR_UNDEFINED, -35, 35)*mobj->scale;
fixed_t z = P_RandomRange(PR_UNDEFINED, 0, 70)*mobj->scale;
fixed_t x = P_RandomRange(PR_SMOLDERING, -35, 35)*mobj->scale;
fixed_t y = P_RandomRange(PR_SMOLDERING, -35, 35)*mobj->scale;
fixed_t z = P_RandomRange(PR_SMOLDERING, 0, 70)*mobj->scale;
mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE);
P_SetMobjState(smoke, S_OPAQUESMOKE1);
K_MatchGenericExtraFlags(smoke, mobj);
smoke->scale = mobj->scale * 2;
smoke->destscale = mobj->scale * 6;
smoke->momz = P_RandomRange(PR_UNDEFINED, 4, 9)*FRACUNIT*P_MobjFlip(smoke);
smoke->momz = P_RandomRange(PR_SMOLDERING, 4, 9)*FRACUNIT*P_MobjFlip(smoke);
}
break;
case MT_BOOMPARTICLE:
{
fixed_t x = P_RandomRange(PR_UNDEFINED, -16, 16)*mobj->scale;
fixed_t y = P_RandomRange(PR_UNDEFINED, -16, 16)*mobj->scale;
fixed_t z = P_RandomRange(PR_UNDEFINED, 0, 32)*mobj->scale*P_MobjFlip(mobj);
fixed_t x = P_RandomRange(PR_EXPLOSION, -16, 16)*mobj->scale;
fixed_t y = P_RandomRange(PR_EXPLOSION, -16, 16)*mobj->scale;
fixed_t z = P_RandomRange(PR_EXPLOSION, 0, 32)*mobj->scale*P_MobjFlip(mobj);
if (leveltime % 2 == 0)
{
mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_BOSSEXPLODE);
@ -5772,9 +5772,9 @@ static void P_MobjSceneryThink(mobj_t *mobj)
{
mobj_t *debris = P_SpawnMobjFromMobj(
mobj,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_RINGS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_RINGS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_RINGS, -spacing, spacing) * FRACUNIT,
MT_BATTLEBUMPER_DEBRIS
);
@ -5803,9 +5803,9 @@ static void P_MobjSceneryThink(mobj_t *mobj)
{
mobj_t *puff = P_SpawnMobjFromMobj(
mobj,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_RINGS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_RINGS, -spacing, spacing) * FRACUNIT,
P_RandomRange(PR_ITEM_RINGS, -spacing, spacing) * FRACUNIT,
MT_SPINDASHDUST
);
@ -6396,9 +6396,9 @@ static boolean P_MobjDeadThink(mobj_t *mobj)
for (i = 0; i < 2; i++)
{
fixed_t xoffset = P_RandomRange(PR_UNDEFINED, -amt, amt) * mobj->scale;
fixed_t yoffset = P_RandomRange(PR_UNDEFINED, -amt, amt) * mobj->scale;
fixed_t zoffset = P_RandomRange(PR_UNDEFINED, -(amt >> 1), (amt >> 1)) * mobj->scale;
fixed_t xoffset = P_RandomRange(PR_ITEM_DEBRIS, -amt, amt) * mobj->scale;
fixed_t yoffset = P_RandomRange(PR_ITEM_DEBRIS, -amt, amt) * mobj->scale;
fixed_t zoffset = P_RandomRange(PR_ITEM_DEBRIS, -(amt >> 1), (amt >> 1)) * mobj->scale;
dust = P_SpawnMobj(mobj->x + xoffset, mobj->y + yoffset,
mobj->z + (mobj->height >> 1) + zoffset, MT_EXPLODE);
@ -7066,9 +7066,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
{
mobj_t *sparkle = P_SpawnMobjFromMobj(
mobj,
P_RandomRange(PR_UNDEFINED, -48, 48) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, -48, 48) * FRACUNIT,
P_RandomRange(PR_UNDEFINED, 0, 64) * FRACUNIT,
P_RandomRange(PR_SPARKLE, -48, 48) * FRACUNIT,
P_RandomRange(PR_SPARKLE, -48, 48) * FRACUNIT,
P_RandomRange(PR_SPARKLE, 0, 64) * FRACUNIT,
MT_EMERALDSPARK
);
@ -7304,7 +7304,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
smoke->momy = mobj->target->momy/2;
smoke->momz = mobj->target->momz/2;
P_Thrust(smoke, mobj->angle+FixedAngle(P_RandomRange(PR_UNDEFINED, 135, 225)<<FRACBITS), P_RandomRange(PR_UNDEFINED, 0, 8) * mobj->target->scale);
P_Thrust(smoke, mobj->angle+FixedAngle(P_RandomRange(PR_ITEM_BOOST, 135, 225)<<FRACBITS), P_RandomRange(PR_ITEM_BOOST, 0, 8) * mobj->target->scale);
}
break;
case MT_INVULNFLASH:
@ -7761,9 +7761,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
for (i = 0; i < nl; i++)
{
mobj_t *fast = P_SpawnMobj(mobj->x + (P_RandomRange(PR_UNDEFINED, -36,36) * mobj->scale),
mobj->y + (P_RandomRange(PR_UNDEFINED, -36,36) * mobj->scale),
mobj->z + (mobj->height/2) + (P_RandomRange(PR_UNDEFINED, -20,20) * mobj->scale),
mobj_t *fast = P_SpawnMobj(mobj->x + (P_RandomRange(PR_ITEM_BOOST, -36,36) * mobj->scale),
mobj->y + (P_RandomRange(PR_ITEM_BOOST, -36,36) * mobj->scale),
mobj->z + (mobj->height/2) + (P_RandomRange(PR_ITEM_BOOST, -20,20) * mobj->scale),
MT_FASTLINE);
P_InitAngle(fast, mobj->angle);
@ -8030,7 +8030,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
else
{
// Pick another player in the server!
player_t *p = &players[plist[P_RandomKey(PR_UNDEFINED, plistlen)]];
player_t *p = &players[plist[P_RandomKey(PR_SPARKLE, plistlen)]];
newskin = ((skin_t*)p->mo->skin) - skins;
newcolor = p->skincolor;
}
@ -8102,7 +8102,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->movecount = 3;
{
angle_t facing = P_RandomRange(PR_UNDEFINED, 0, 90);
angle_t facing = P_RandomRange(PR_MOVINGTARGET, 0, 90);
if (facing >= 45)
facing = InvAngle((facing - 45)*ANG1);
else
@ -8135,23 +8135,23 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
else // fire + smoke pillar
{
UINT8 i;
mobj_t *fire = P_SpawnMobj(mobj->x + (P_RandomRange(PR_UNDEFINED, -32, 32)*mobj->scale), mobj->y + (P_RandomRange(PR_UNDEFINED, -32, 32)*mobj->scale), mobj->z, MT_THOK);
mobj_t *fire = P_SpawnMobj(mobj->x + (P_RandomRange(PR_SMOLDERING, -32, 32)*mobj->scale), mobj->y + (P_RandomRange(PR_SMOLDERING, -32, 32)*mobj->scale), mobj->z, MT_THOK);
fire->sprite = SPR_FPRT;
fire->frame = FF_FULLBRIGHT|FF_TRANS30;
fire->scale = mobj->scale*4;
fire->momz = P_RandomRange(PR_UNDEFINED, 2, 3)*mobj->scale;
fire->momz = P_RandomRange(PR_SMOLDERING, 2, 3)*mobj->scale;
fire->scalespeed = mobj->scale/12;
fire->destscale = 1;
fire->tics = TICRATE;
for (i = 0; i < 2; i++)
{
mobj_t *smoke = P_SpawnMobj(mobj->x + (P_RandomRange(PR_UNDEFINED, -16, 16)*mobj->scale), mobj->y + (P_RandomRange(PR_UNDEFINED, -16, 16)*mobj->scale), mobj->z, MT_SMOKE);
mobj_t *smoke = P_SpawnMobj(mobj->x + (P_RandomRange(PR_SMOLDERING, -16, 16)*mobj->scale), mobj->y + (P_RandomRange(PR_SMOLDERING, -16, 16)*mobj->scale), mobj->z, MT_SMOKE);
P_SetMobjState(smoke, S_FZSLOWSMOKE1);
smoke->scale = mobj->scale;
smoke->momz = P_RandomRange(PR_UNDEFINED, 3, 10)*mobj->scale;
smoke->momz = P_RandomRange(PR_SMOLDERING, 3, 10)*mobj->scale;
smoke->destscale = mobj->scale*4;
smoke->scalespeed = mobj->scale/24;
}
@ -8647,7 +8647,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
P_MoveOrigin(mobj,
mobj->tracer->x + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<<FRACBITS),
mobj->tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<<FRACBITS),
mobj->tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(PR_UNDEFINED, -abs(mobj->cvmem), abs(mobj->cvmem))<<FRACBITS));
mobj->tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(PR_ITEM_BUBBLE, -abs(mobj->cvmem), abs(mobj->cvmem))<<FRACBITS));
if (mobj->movecount > 4*TICRATE)
{
@ -9264,9 +9264,9 @@ static boolean P_FuseThink(mobj_t *mobj)
for (i = 0; i < 5; i++)
{
mobj_t *debris = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_SMK_ICEBLOCK_DEBRIS);
P_InitAngle(debris, FixedAngle(P_RandomRange(PR_UNDEFINED, 0,360)<<FRACBITS));
P_InstaThrust(debris, debris->angle, P_RandomRange(PR_UNDEFINED, 3,18)*(FRACUNIT/4));
debris->momz = P_RandomRange(PR_UNDEFINED, 4,8)<<FRACBITS;
P_InitAngle(debris, FixedAngle(P_RandomRange(PR_DECORATION, 0,360)<<FRACBITS));
P_InstaThrust(debris, debris->angle, P_RandomRange(PR_DECORATION, 3,18)*(FRACUNIT/4));
debris->momz = P_RandomRange(PR_DECORATION, 4,8)<<FRACBITS;
if (!i) // kinda hacky :V
S_StartSound(debris, sfx_s3k82);
}
@ -10153,7 +10153,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
SKINCOLOR_JET
};
mobj->color = BALLOONCOLORS[P_RandomKey(PR_UNDEFINED, sizeof(BALLOONCOLORS))];
mobj->color = BALLOONCOLORS[P_RandomKey(PR_DECORATION, sizeof(BALLOONCOLORS))];
}
break;
case MT_POGOSPRING:
@ -10163,8 +10163,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->color = SKINCOLOR_RED;
break;
case MT_EGGROBO1:
mobj->movecount = P_RandomKey(PR_UNDEFINED, 13);
mobj->color = FIRSTRAINBOWCOLOR + P_RandomKey(PR_UNDEFINED, FIRSTSUPERCOLOR - FIRSTRAINBOWCOLOR);
mobj->movecount = P_RandomKey(PR_DECORATION, 13);
mobj->color = FIRSTRAINBOWCOLOR + P_RandomKey(PR_DECORATION, FIRSTSUPERCOLOR - FIRSTRAINBOWCOLOR);
break;
case MT_HIVEELEMENTAL:
mobj->extravalue1 = 5;
@ -10260,15 +10260,15 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
{
// set default item & count
#if 0 // set to 1 to test capsules with random items, e.g. with objectplace
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/3))
if (P_RandomChance(PR_ITEM_ROULETTE, FRACUNIT/3))
mobj->threshold = KITEM_SUPERRING;
else if (P_RandomChance(PR_UNDEFINED, FRACUNIT/3))
else if (P_RandomChance(PR_ITEM_ROULETTE, FRACUNIT/3))
mobj->threshold = KITEM_SPB;
else if (P_RandomChance(PR_UNDEFINED, FRACUNIT/3))
else if (P_RandomChance(PR_ITEM_ROULETTE, FRACUNIT/3))
mobj->threshold = KITEM_ORBINAUT;
else
mobj->threshold = P_RandomRange(PR_UNDEFINED, 1, NUMKARTITEMS - 1);
mobj->movecount = P_RandomChance(PR_UNDEFINED, FRACUNIT/3) ? 1 : P_RandomKey(PR_UNDEFINED, 32) + 1;
mobj->threshold = P_RandomRange(PR_ITEM_ROULETTE, 1, NUMKARTITEMS - 1);
mobj->movecount = P_RandomChance(PR_ITEM_ROULETTE, FRACUNIT/3) ? 1 : P_RandomKey(PR_ITEM_ROULETTE, 32) + 1;
#else
mobj->threshold = KITEM_SUPERRING; // default item is super ring
mobj->movecount = 1;
@ -10412,8 +10412,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
UINT16 i;
for (i = 0; i < mobj->info->mass; i++)
{
fixed_t newx = mobj->x + (P_RandomRange(PR_UNDEFINED, -mobj->info->mass, mobj->info->mass)<<FRACBITS);
fixed_t newy = mobj->y + (P_RandomRange(PR_UNDEFINED, -mobj->info->mass, mobj->info->mass)<<FRACBITS);
fixed_t newx = mobj->x + (P_RandomRange(PR_DECORATION, -mobj->info->mass, mobj->info->mass)<<FRACBITS);
fixed_t newy = mobj->y + (P_RandomRange(PR_DECORATION, -mobj->info->mass, mobj->info->mass)<<FRACBITS);
if (P_FloorzAtPos(newx, newy, mobj->z, 8<<FRACBITS) == mobj->z)
P_SpawnMobj(newx, newy, mobj->z, MT_EERIEFOG);
@ -10956,7 +10956,7 @@ void P_PrecipitationEffects(void)
// with global rain and switched players to anything else ...
// If the global weather has lightning strikes,
// EVERYONE gets them at the SAME time!
thunderchance = (P_RandomKey(PR_UNDEFINED, 8192));
thunderchance = (P_RandomKey(PR_DECORATION, 8192));
}
else if (sounds_thunder || effects_lightning)
{
@ -12548,8 +12548,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
if (mthing->options & MTF_AMBUSH)
{
fixed_t offset = FixedMul(16*FRACUNIT, mobj->scale);
mobj->momx += P_RandomChance(PR_UNDEFINED, FRACUNIT/2) ? offset : -offset;
mobj->momy += P_RandomChance(PR_UNDEFINED, FRACUNIT/2) ? offset : -offset;
mobj->momx += P_RandomChance(PR_DECORATION, FRACUNIT/2) ? offset : -offset;
mobj->momy += P_RandomChance(PR_DECORATION, FRACUNIT/2) ? offset : -offset;
mobj->momz += offset;
}
break;

View file

@ -3298,9 +3298,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT32 result;
if (rvalue1 <= rvalue2)
result = P_RandomRange(PR_UNDEFINED, rvalue1, rvalue2);
result = P_RandomRange(PR_EXECUTOR, rvalue1, rvalue2);
else
result = P_RandomRange(PR_UNDEFINED, rvalue2, rvalue1);
result = P_RandomRange(PR_EXECUTOR, rvalue2, rvalue1);
P_LinedefExecute((INT16)result, mo, NULL);
break;

View file

@ -1746,12 +1746,12 @@ static void P_DoBubbleBreath(player_t *player)
if (player->charflags & SF_MACHINE)
{
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/5))
if (P_RandomChance(PR_BUBBLE, FRACUNIT/5))
{
fixed_t r = player->mo->radius>>FRACBITS;
x += (P_RandomRange(PR_UNDEFINED, r, -r)<<FRACBITS);
y += (P_RandomRange(PR_UNDEFINED, r, -r)<<FRACBITS);
z += (P_RandomKey(PR_UNDEFINED, player->mo->height>>FRACBITS)<<FRACBITS);
x += (P_RandomRange(PR_BUBBLE, r, -r)<<FRACBITS);
y += (P_RandomRange(PR_BUBBLE, r, -r)<<FRACBITS);
z += (P_RandomKey(PR_BUBBLE, player->mo->height>>FRACBITS)<<FRACBITS);
bubble = P_SpawnMobj(x, y, z, MT_WATERZAP);
S_StartSound(bubble, sfx_beelec);
}
@ -1763,9 +1763,9 @@ static void P_DoBubbleBreath(player_t *player)
else
z += FixedDiv(player->mo->height,5*(FRACUNIT/4));
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/16))
if (P_RandomChance(PR_BUBBLE, FRACUNIT/16))
bubble = P_SpawnMobj(x, y, z, MT_SMALLBUBBLE);
else if (P_RandomChance(PR_UNDEFINED, 3*FRACUNIT/256))
else if (P_RandomChance(PR_BUBBLE, 3*FRACUNIT/256))
bubble = P_SpawnMobj(x, y, z, MT_MEDIUMBUBBLE);
}
@ -2381,7 +2381,7 @@ void P_MovePlayer(player_t *player)
// Little water sound while touching water - just a nicety.
if ((player->mo->eflags & MFE_TOUCHWATER) && !(player->mo->eflags & MFE_UNDERWATER) && !player->spectator)
{
if (P_RandomChance(PR_UNDEFINED, FRACUNIT/2) && leveltime % TICRATE == 0)
if (P_RandomChance(PR_BUBBLE, FRACUNIT/2) && leveltime % TICRATE == 0)
S_StartSound(player->mo, sfx_floush);
}
@ -3717,7 +3717,7 @@ boolean P_SpectatorJoinGame(player_t *player)
else if (redscore > bluescore)
changeto = 2;
else
changeto = (P_RandomFixed(PR_UNDEFINED) & 1) + 1;
changeto = (P_RandomFixed(PR_RULESCRAMBLE) & 1) + 1;
if (!LUA_HookTeamSwitch(player, changeto, true, false, false))
return false;