Renamed 'Random' to 'TFB_Random' to avoid conflict with Carbon framework

on MacOS X.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@462 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2002-12-22 02:37:40 +00:00
parent 2c927a0d6c
commit 5cb57268f2
68 changed files with 196 additions and 196 deletions
+2 -2
View File
@@ -177,9 +177,9 @@ Battle (void)
SeedRandom (GetTimeCounter ());
#else /* DEMO_MODE */
if (BattleSeed == 0)
BattleSeed = Random ();
BattleSeed = TFB_Random ();
SeedRandom (BattleSeed);
BattleSeed = Random (); /* get next battle seed */
BattleSeed = TFB_Random (); /* get next battle seed */
#endif /* DEMO_MODE */
BattleSong (FALSE);
+1 -1
View File
@@ -35,7 +35,7 @@
(BYTE)HIWORD ((S)->RaceDescPtr)
#define StarShipPlayer(S) \
(COUNT)LOWORD ((S)->RaceDescPtr)
#define PickCaptainName() (((COUNT)Random () \
#define PickCaptainName() (((COUNT)TFB_Random () \
& (NUM_CAPTAINS_NAMES - 1)) \
+ NAME_OFFSET)
+12 -12
View File
@@ -672,11 +672,11 @@ SetUpSequence (PSEQUENCE pSeq)
if (pSeq->AnimType == COLOR_ANIM)
pSeq->AnimObj.CurCMap =
SetRelColorMapIndex (pSeq->AnimObj.CurCMap,
(COUNT)Random () % pSeq->FramesLeft);
(COUNT)TFB_Random () % pSeq->FramesLeft);
else
pSeq->AnimObj.CurFrame =
SetRelFrameIndex (pSeq->AnimObj.CurFrame,
(COUNT)Random () % pSeq->FramesLeft);
(COUNT)TFB_Random () % pSeq->FramesLeft);
}
else if (ADPtr->AnimFlags & YOYO_ANIM)
{
@@ -691,7 +691,7 @@ SetUpSequence (PSEQUENCE pSeq)
pSeq->Alarm =
ADPtr->BaseRestartRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomRestartRate + 1))
+ 1;
}
@@ -803,7 +803,7 @@ int ambient_anim_task(void* data)
ActiveMask |= 1L << i;
pSeq->Alarm =
ADPtr->BaseFrameRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1))
+ 1;
}
@@ -812,7 +812,7 @@ int ambient_anim_task(void* data)
ActiveMask &= ~(1L << i);
pSeq->Alarm =
ADPtr->BaseRestartRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomRestartRate + 1))
+ 1;
if (ActiveMask & ADPtr->BlockMask)
@@ -866,13 +866,13 @@ pBatch->Object.Stamp.origin.x = -SAFE_X;
pSeq->AnimObj.CurCMap =
SetAbsColorMapIndex (pSeq->AnimObj.CurCMap,
ADPtr->StartIndex
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% ADPtr->NumFrames));
else
pSeq->AnimObj.CurFrame =
SetAbsFrameIndex (pSeq->AnimObj.CurFrame,
ADPtr->StartIndex
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% ADPtr->NumFrames));
}
else if (pSeq->AnimType == COLOR_ANIM)
@@ -937,7 +937,7 @@ pBatch->Object.Stamp.origin.x = -SAFE_X;
{
FrameRate =
ADPtr->BaseFrameRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1));
if (TalkAlarm < 0
|| GetFrameIndex (TalkFrame) ==
@@ -945,11 +945,11 @@ pBatch->Object.Stamp.origin.x = -SAFE_X;
{
TalkFrame = SetAbsFrameIndex (CommFrame,
ADPtr->StartIndex + 1
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->NumFrames - 1)));
FrameRate +=
ADPtr->BaseRestartRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomRestartRate + 1));
}
else
@@ -984,7 +984,7 @@ pBatch->Object.Stamp.origin.x = -SAFE_X;
{
FrameRate =
ADPtr->BaseFrameRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1));
if (TalkAlarm < 0)
TalkFrame = SetAbsFrameIndex (CommFrame,
@@ -1001,7 +1001,7 @@ pBatch->Object.Stamp.origin.x = -SAFE_X;
{
FrameRate =
ADPtr->BaseFrameRate
+ ((COUNT)Random ()
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1));
if (TalkAlarm < 0)
TalkFrame = SetAbsFrameIndex (CommFrame,
+1 -1
View File
@@ -238,7 +238,7 @@ StripShip (COUNT fuel_required)
{
DWORD rand_val;
rand_val = Random ();
rand_val = TFB_Random ();
switch (which_module = LOBYTE (LOWORD (rand_val)) % (CREW_POD + 1))
{
case PLANET_LANDER:
+1 -1
View File
@@ -356,7 +356,7 @@ NormalMycon (RESPONSE_REF R)
DISABLE_PHRASE (RESPONSE_TO_REF (R));
}
if ((BYTE)Random () < 256 * 30 / 100)
if ((BYTE)TFB_Random () < 256 * 30 / 100)
RespFunc = (RESPONSE_FUNC)CombatIsInevitable;
else
RespFunc = (RESPONSE_FUNC)NormalMycon;
+3 -3
View File
@@ -163,7 +163,7 @@ RESPONSE_REF R;
{
RESPONSE_REF pStr0, pStr1;
switch ((BYTE)Random () & 7)
switch ((BYTE)TFB_Random () & 7)
{
case 0:
pStr0 = NORMAL_GOODBYE_A0;
@@ -1572,7 +1572,7 @@ CheckBulletins (BOOLEAN Repeat)
pIntro = BEFORE_WE_GO_ON_1;
else
{
switch ((BYTE)Random () % 7)
switch ((BYTE)TFB_Random () % 7)
{
case 0:
pIntro = BEFORE_WE_GO_ON_1;
@@ -1656,7 +1656,7 @@ NormalStarbase (RESPONSE_REF R)
{
RESPONSE_REF pStr0, pStr1;
switch ((BYTE)Random () & 7)
switch ((BYTE)TFB_Random () & 7)
{
case 0:
pStr0 = NORMAL_HELLO_A0;
+1 -1
View File
@@ -189,7 +189,7 @@ ExitConversation (RESPONSE_REF R)
}
else if (PLAYER_SAID (R, bye_space))
{
if ((BYTE)Random () & 1)
if ((BYTE)TFB_Random () & 1)
NPCPhrase (GOODBYE_AND_DIE_SPACE);
else
{
+2 -2
View File
@@ -494,7 +494,7 @@ TurnShip (ELEMENTPTR ShipPtr, COUNT angle)
if (ship_delta_facing == ANGLE_TO_FACING (HALF_CIRCLE))
ship_delta_facing =
NORMALIZE_FACING (ship_delta_facing +
(Random () & 1 ?
(TFB_Random () & 1 ?
ANGLE_TO_FACING (OCTANT >> 1) :
-ANGLE_TO_FACING (OCTANT >> 1)));
@@ -766,7 +766,7 @@ Entice (ELEMENTPTR ShipPtr, EVALUATE_DESCPTR EvalDescPtr)
- EvalDescPtr->facing
);
if ((desired_turn_angle & (HALF_CIRCLE - 1)) == 0)
desired_thrust_angle = Random () & 1 ? RIGHT : LEFT;
desired_thrust_angle = TFB_Random () & 1 ? RIGHT : LEFT;
else
desired_thrust_angle = desired_turn_angle < HALF_CIRCLE ? RIGHT : LEFT;
}
+1 -1
View File
@@ -106,7 +106,7 @@ BuildBattle (COUNT which_player)
load_gravity_well (NUMBER_OF_PLANET_TYPES);
break;
case IN_HYPERSPACE:
load_gravity_well ((BYTE)((COUNT)Random ()
load_gravity_well ((BYTE)((COUNT)TFB_Random ()
% NUMBER_OF_PLANET_TYPES));
break;
default:
+4 -4
View File
@@ -241,8 +241,8 @@ InitGalaxy (void)
if (i == BIG_STAR_COUNT || i == BIG_STAR_COUNT + MED_STAR_COUNT)
++factor;
ppt->x = (COORD)((UWORD)Random () % SPACE_WIDTH) << factor;
ppt->y = (COORD)((UWORD)Random () % SPACE_HEIGHT) << factor;
ppt->x = (COORD)((UWORD)TFB_Random () % SPACE_WIDTH) << factor;
ppt->y = (COORD)((UWORD)TFB_Random () % SPACE_HEIGHT) << factor;
if (i < BIG_STAR_COUNT + MED_STAR_COUNT)
{
@@ -307,7 +307,7 @@ MoveGalaxy (VIEW_STATE view_state, register SIZE dx, register SIZE dy)
{
pprim->Object.Stamp.frame =
SetAbsFrameIndex (stars_in_space,
((COUNT)Random () & 31) + (32 + 26));
((COUNT)TFB_Random () & 31) + (32 + 26));
++pprim;
} while (--i);
@@ -316,7 +316,7 @@ MoveGalaxy (VIEW_STATE view_state, register SIZE dx, register SIZE dy)
{
pprim->Object.Stamp.frame =
SetAbsFrameIndex (stars_in_space,
((COUNT)Random () & 31) + 26);
((COUNT)TFB_Random () & 31) + 26);
++pprim;
} while (--i);
}
+7 -7
View File
@@ -162,7 +162,7 @@ BuildGroups (void)
* 60L / encounter_radius);
}
rand_val = Random ();
rand_val = TFB_Random ();
if ((int)(LOWORD (rand_val) % 100) < (int)i
&& (BestPercent == 0
|| (HIWORD (rand_val) % (i + BestPercent)) < i))
@@ -192,7 +192,7 @@ FoundHome:
};
which_group = 0;
num_groups = ((COUNT)Random () % (BestPercent >> 1)) + 1;
num_groups = ((COUNT)TFB_Random () % (BestPercent >> 1)) + 1;
if (num_groups > (MAX_BATTLE_GROUPS >> 1))
num_groups = (MAX_BATTLE_GROUPS >> 1);
else if (num_groups < 5
@@ -204,7 +204,7 @@ FoundHome:
for (Index = HINIBBLE (EncounterMakeup[BestIndex]); Index; --Index)
{
if (Index <= LONIBBLE (EncounterMakeup[BestIndex])
|| (COUNT)Random () % 100 < 50)
|| (COUNT)TFB_Random () % 100 < 50)
CloneShipFragment (
BestIndex, &GLOBAL (npc_built_ship_q), 0
);
@@ -417,7 +417,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
OwnStarShip (FragPtr, BAD_GUY, 0);
SET_GROUP_ID (FragPtr, which_group);
rand_val = Random ();
rand_val = TFB_Random ();
task = (BYTE)(LOBYTE (LOWORD (rand_val)) % ON_STATION);
if (task == FLEE)
task = ON_STATION;
@@ -432,14 +432,14 @@ GetGroupInfo (DWORD offset, BYTE which_group)
HIBYTE (LOWORD (rand_val)) % group_loc
) + 1);
SET_GROUP_DEST (FragPtr, group_loc);
rand_val = Random ();
rand_val = TFB_Random ();
FragPtr->ShipInfo.loc.x =
(LOWORD (rand_val) % 10000) - 5000;
FragPtr->ShipInfo.loc.y =
(HIWORD (rand_val) % 10000) - 5000;
if (task == EXPLORE)
FragPtr->ShipInfo.group_counter =
((COUNT)Random ()
((COUNT)TFB_Random ()
% MAX_REVOLUTIONS)
<< FACING_SHIFT;
else
@@ -491,7 +491,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
if (offset)
InitGroupInfo (FALSE);
/* Random battle group */
/* TFB_Random battle group */
else if (ValidateEvent (ABSOLUTE_EVENT, /* still fresh */
&month_index, &day_index, &year_index))
{
+5 -5
View File
@@ -227,7 +227,7 @@ percent = 0;
&& (COUNT)dy < encounter_radius
&& (DWORD)dx * dx + (DWORD)dy * dy <
(DWORD)encounter_radius * encounter_radius
&& ((COUNT)Random () % 100) < percent)
&& ((COUNT)TFB_Random () % 100) < percent)
{
#ifndef DEBUG
char buf[20];
@@ -794,7 +794,7 @@ AddAmbientElement (void)
SetPrimType (&DisplayArray[HyperSpaceElementPtr->PrimIndex], STAMP_PRIM);
HyperSpaceElementPtr->preprocess_func = animation_preprocess;
rand_val = Random ();
rand_val = TFB_Random ();
dy = LOWORD (rand_val);
dx = (SIZE)(LOBYTE (dy) % SPACE_WIDTH) - (SPACE_WIDTH >> 1);
dy = (SIZE)(HIBYTE (dy) % SPACE_HEIGHT) - (SPACE_HEIGHT >> 1);
@@ -941,7 +941,7 @@ AddEncounterElement (ENCOUNTERPTR EncounterPtr,
NumShips = LONIBBLE (EncounterMakeup[Type]);
for (i = HINIBBLE (EncounterMakeup[Type]) - NumShips; i; --i)
{
if ((COUNT)Random () % 100 < 50)
if ((COUNT)TFB_Random () % 100 < 50)
++NumShips;
}
@@ -975,7 +975,7 @@ AddEncounterElement (ENCOUNTERPTR EncounterPtr,
{
DWORD rand_val;
rand_val = Random ();
rand_val = TFB_Random ();
SD.star_pt.x = puniverse->x
+ (LOWORD (rand_val) % (XOFFS << 1)) - XOFFS;
@@ -1527,7 +1527,7 @@ SeedUniverse (void)
SetContext (StatusContext);
if (!(LOWORD (Random ()) & 7))
if (!(LOWORD (TFB_Random ()) & 7))
AddAmbientElement ();
if (universe.x != GLOBAL (ShipStamp.origin.x)
+6 -6
View File
@@ -48,10 +48,10 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
else if ((target_loc = GET_GROUP_DEST (StarShipPtr)) == 0)
{
target_loc = GET_ORBIT_LOC (StarShipPtr);
SET_ORBIT_LOC (StarShipPtr, NORMALIZE_FACING (Random ()));
SET_ORBIT_LOC (StarShipPtr, NORMALIZE_FACING (TFB_Random ()));
#ifdef OLD
target_loc = (BYTE)((
(COUNT)Random ()
(COUNT)TFB_Random ()
% pSolarSysState->SunDesc[0].NumPlanets
) + 1);
#endif /* OLD */
@@ -61,7 +61,7 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
StarShipPtr->ShipInfo.group_counter = 0;
else
StarShipPtr->ShipInfo.group_counter =
((COUNT)Random ()
((COUNT)TFB_Random ()
% MAX_REVOLUTIONS)
<< FACING_SHIFT;
}
@@ -139,7 +139,7 @@ ip_group_preprocess (PELEMENT ElementPtr)
StarShipPtr->ShipInfo.group_counter = 0;
else
StarShipPtr->ShipInfo.group_counter =
((COUNT)Random ()
((COUNT)TFB_Random ()
% MAX_REVOLUTIONS)
<< FACING_SHIFT;
}
@@ -263,7 +263,7 @@ ip_group_preprocess (PELEMENT ElementPtr)
if (StarShipPtr->ShipInfo.group_counter)
--StarShipPtr->ShipInfo.group_counter;
else if (task == EXPLORE
&& (next_loc = (BYTE)(((COUNT)Random ()
&& (next_loc = (BYTE)(((COUNT)TFB_Random ()
% pSolarSysState->SunDesc[0].NumPlanets)
+ 1)) != target_loc)
{
@@ -420,7 +420,7 @@ CheckGetAway:
ANGLE_TO_FACING (angle + HALF_CIRCLE)
));
StarShipPtr->ShipInfo.group_counter =
((COUNT)Random () % MAX_REVOLUTIONS)
((COUNT)TFB_Random () % MAX_REVOLUTIONS)
<< FACING_SHIFT;
}
+2 -2
View File
@@ -51,7 +51,7 @@ seed_fast_random(DWORD seed)
retval = SeedRandom(seed);
for( index = 0; index < TABLE_SIZE; index++ )
random_table[index] = Random();
random_table[index] = TFB_Random();
fast_index = 0; /* must be set to the start of the table for
repeatability... */
@@ -95,7 +95,7 @@ fast_random()
void
reseed_fast_random()
{
fast_index = (COUNT)(Random() % TABLE_SIZE);
fast_index = (COUNT)(TFB_Random() % TABLE_SIZE);
}
+3 -3
View File
@@ -21,7 +21,7 @@
* DESC: a library of random number generators for general purpose use.
*
* References:
* "Random Number Generators: Good ones are hard to find" S.K.Park & K.W.Miller
* "TFB_Random Number Generators: Good ones are hard to find" S.K.Park & K.W.Miller
* Communications of the ACM, Vol31 Number 10, October 1988, Pp 1192-1201
*
* HISTORY: Created 1/23/1989
@@ -48,7 +48,7 @@ static DWORD seed = 12345L; /* random number seed */
/* ----------------------------CODE--------------------------------------- */
/*****************************************************************************
* FUNC: DWORD Random()
* FUNC: DWORD TFB_Random()
*
* DESC: random number generator
*
@@ -59,7 +59,7 @@ static DWORD seed = 12345L; /* random number seed */
*****************************************************************************/
DWORD
Random (void)
TFB_Random (void)
{
if ((seed = A * (seed % Q) - R * (seed / Q)) > M)
return (seed -= M);
+3 -3
View File
@@ -41,9 +41,9 @@
#define SFASTRAND(n) ( (int)_FAST_ % (n) )
#define AND_FASTRAND(n) ( (int)_FAST_ & (n) )
#define RAND(n) ( (int) ( (unsigned int)Random() % (n) ) )
#define SRAND(n) ( (int)Random() % (n) )
#define AND_RAND(n) ( (int)Random() & (n) )
#define RAND(n) ( (int) ( (unsigned int)TFB_Random() % (n) ) )
#define SRAND(n) ( (int)TFB_Random() % (n) )
#define AND_RAND(n) ( (int)TFB_Random() & (n) )
#define INDEXED_RANDOM(x) (random_table[x])
+1 -1
View File
@@ -22,7 +22,7 @@
#include "compiler.h"
extern DWORD SeedRandom (DWORD seed);
extern DWORD Random (void);
extern DWORD TFB_Random (void);
extern COUNT square_root (DWORD value);
#endif /* _MATHLIB_H */
+1 -1
View File
@@ -1611,7 +1611,7 @@ DoMelee (INPUT_STATE InputState, PMELEE_STATE pMS)
;
SeedRandomNumbers ();
load_gravity_well ((BYTE)((COUNT)Random () % NUMBER_OF_PLANET_TYPES));
load_gravity_well ((BYTE)((COUNT)TFB_Random () % NUMBER_OF_PLANET_TYPES));
Battle ();
free_gravity_well ();
+12 -12
View File
@@ -45,9 +45,9 @@ spawn_planet (void)
do
{
PlanetElementPtr->current.location.x =
WRAP_X (DISPLAY_ALIGN_X (Random ()));
WRAP_X (DISPLAY_ALIGN_X (TFB_Random ()));
PlanetElementPtr->current.location.y =
WRAP_Y (DISPLAY_ALIGN_Y (Random ()));
WRAP_Y (DISPLAY_ALIGN_Y (TFB_Random ()));
} while (CalculateGravity (PlanetElementPtr)
|| TimeSpaceMatterConflict (PlanetElementPtr));
loc = PlanetElementPtr->current.location;
@@ -152,19 +152,19 @@ spawn_asteroid (PELEMENT ElementPtr)
AsteroidElementPtr->state_flags = APPEARING;
AsteroidElementPtr->life_span = NORMAL_LIFE;
SetPrimType (&DisplayArray[AsteroidElementPtr->PrimIndex], STAMP_PRIM);
if ((val = (COUNT)Random ()) & (1 << 0))
if ((val = (COUNT)TFB_Random ()) & (1 << 0))
{
if (!(val & (1 << 1)))
AsteroidElementPtr->current.location.x = 0;
else
AsteroidElementPtr->current.location.x = LOG_SPACE_WIDTH;
AsteroidElementPtr->current.location.y =
WRAP_Y (DISPLAY_ALIGN_Y (Random ()));
WRAP_Y (DISPLAY_ALIGN_Y (TFB_Random ()));
}
else
{
AsteroidElementPtr->current.location.x =
WRAP_X (DISPLAY_ALIGN_X (Random ()));
WRAP_X (DISPLAY_ALIGN_X (TFB_Random ()));
if (!(val & (1 << 1)))
AsteroidElementPtr->current.location.y = 0;
else
@@ -172,16 +172,16 @@ spawn_asteroid (PELEMENT ElementPtr)
}
SetVelocityVector (&AsteroidElementPtr->velocity,
DISPLAY_TO_WORLD (((SIZE)Random () & 7) + 4),
(COUNT)Random ());
DISPLAY_TO_WORLD (((SIZE)TFB_Random () & 7) + 4),
(COUNT)TFB_Random ());
AsteroidElementPtr->current.image.farray = asteroid;
AsteroidElementPtr->current.image.frame =
SetAbsFrameIndex (asteroid[0],
NORMALIZE_FACING (Random ()));
NORMALIZE_FACING (TFB_Random ()));
AsteroidElementPtr->turn_wait =
AsteroidElementPtr->thrust_wait =
(BYTE)Random () & (BYTE)((1 << 2) - 1);
AsteroidElementPtr->thrust_wait |= (BYTE)Random () & (BYTE)(1 << 7);
(BYTE)TFB_Random () & (BYTE)((1 << 2) - 1);
AsteroidElementPtr->thrust_wait |= (BYTE)TFB_Random () & (BYTE)(1 << 7);
AsteroidElementPtr->preprocess_func = asteroid_preprocess;
AsteroidElementPtr->death_func = spawn_rubble;
AsteroidElementPtr->collision_func = collision;
@@ -354,8 +354,8 @@ AbandonShip (ELEMENTPTR ShipPtr, ELEMENTPTR TargetPtr,
ShipIntersect.IntersectStamp.origin =
ShipPtr->IntersectControl.EndPoint;
w = (SIZE)((COUNT)Random () % r.extent.width);
h = (SIZE)((COUNT)Random () % r.extent.height);
w = (SIZE)((COUNT)TFB_Random () % r.extent.width);
h = (SIZE)((COUNT)TFB_Random () % r.extent.height);
CrewIntersect.EndPoint = ShipIntersect.EndPoint;
CrewIntersect.IntersectStamp.frame = DecFrameIndex (stars_in_space);
if (dx == 0 && dy == 0)
+1 -1
View File
@@ -300,7 +300,7 @@ ChangeSelection:
hBattleShip = 0;
else
{
ship_index = (COUNT)Random () % ships_left;
ship_index = (COUNT)TFB_Random () % ships_left;
for (hBattleShip = GetHeadLink (&race_q[which_player]);
hBattleShip != 0; hBattleShip = hNextShip)
{
+3 -3
View File
@@ -193,7 +193,7 @@ CalcRotation (PLANET_INFOPTR PlanetInfoPtr)
{
if (PLANSIZE (PlanetInfoPtr->PlanDataPtr->Type) == GAS_GIANT)
return ((COUNT)CalcFromBase (80, 80));
else if (((BYTE)Random () % 10) == 0)
else if (((BYTE)TFB_Random () % 10) == 0)
return ((COUNT)CalcFromBase ((UWORD)50 * 240, (UWORD)200 * 240));
else
return ((COUNT)CalcFromBase (150, 150));
@@ -211,7 +211,7 @@ CalcTilt (void)
i = NUM_TOSSES;
do /* Using added Randomom values to give bell curve */
{
tilt += (UWORD)Random () % ((TILT_RANGE / NUM_TOSSES) + 1);
tilt += (UWORD)TFB_Random () % ((TILT_RANGE / NUM_TOSSES) + 1);
} while (--i);
return (tilt);
@@ -292,7 +292,7 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
}
SysInfoPtr->PlanetInfo.PlanetDensity +=
(SysInfoPtr->PlanetInfo.PlanetDensity / 20)
- ((COUNT)Random ()
- ((COUNT)TFB_Random ()
% (SysInfoPtr->PlanetInfo.PlanetDensity / 10));
switch (PLANSIZE (SysInfoPtr->PlanetInfo.PlanDataPtr->Type))
+3 -3
View File
@@ -41,7 +41,7 @@ GenerateBurvixes (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -67,7 +67,7 @@ GenerateBurvixes (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -104,7 +104,7 @@ GenerateBurvixes (BYTE control)
pSolarSysState->MoonDesc[0].data_index = SELENIC_WORLD;
pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS
+ (MAX_MOONS - 1) * MOON_DELTA;
rand_val = Random ();
rand_val = TFB_Random ();
angle = NORMALIZE_ANGLE (LOWORD (rand_val));
pSolarSysState->MoonDesc[0].location.x =
COSINE (angle, pSolarSysState->MoonDesc[0].radius);
+1 -1
View File
@@ -33,7 +33,7 @@ GenerateChmmr (BYTE control)
pSolarSysState->MoonDesc[0].data_index = (BYTE)~0;
pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS;
rand_val = Random ();
rand_val = TFB_Random ();
angle = NORMALIZE_ANGLE (LOWORD (rand_val));
pSolarSysState->MoonDesc[0].location.x =
COSINE (angle, pSolarSysState->MoonDesc[0].radius);
+1 -1
View File
@@ -37,7 +37,7 @@ GenerateDruuge (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -36,7 +36,7 @@ GenerateIlwrath (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -36,7 +36,7 @@ GenerateMycon (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+3 -3
View File
@@ -39,7 +39,7 @@ GenerateAndrosynth (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -201,7 +201,7 @@ GenerateOrz (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -238,7 +238,7 @@ GenerateOrz (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+2 -2
View File
@@ -89,7 +89,7 @@ ZapToUrquanEncounter (void)
DeltaSISGauges (0, -dx, 0);
if (GLOBAL_SIS (FuelOnBoard) < 5 * FUEL_TANK_SCALE)
{
dx = ((5 + ((COUNT)Random () % 5)) * FUEL_TANK_SCALE)
dx = ((5 + ((COUNT)TFB_Random () % 5)) * FUEL_TANK_SCALE)
- (SIZE)GLOBAL_SIS (FuelOnBoard);
DeltaSISGauges (0, dx, 0);
}
@@ -119,7 +119,7 @@ GenerateTalkingPet (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -37,7 +37,7 @@ GeneratePkunk (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -217,7 +217,7 @@ GenerateSamatra (BYTE control)
pSolarSysState->MoonDesc[0].data_index = (BYTE)(~0 - 1);
pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS
+ (2 * MOON_DELTA);
rand_val = Random ();
rand_val = TFB_Random ();
angle = NORMALIZE_ANGLE (LOWORD (rand_val));
pSolarSysState->MoonDesc[0].location.x =
COSINE (angle, pSolarSysState->MoonDesc[0].radius);
+3 -3
View File
@@ -140,7 +140,7 @@ generate_tractors (void)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -465,7 +465,7 @@ GenerateSOL (BYTE control)
pSolarSysState->MoonDesc[1].data_index = SELENIC_WORLD;
pSolarSysState->MoonDesc[1].radius = MIN_MOON_RADIUS
+ (MAX_MOONS - 1) * MOON_DELTA;
rand_val = Random ();
rand_val = TFB_Random ();
angle = NORMALIZE_ANGLE (LOWORD (rand_val));
pSolarSysState->MoonDesc[1].location.x =
COSINE (angle, pSolarSysState->MoonDesc[1].radius);
@@ -499,7 +499,7 @@ GenerateSOL (BYTE control)
COUNT angle;
UWORD word_val;
pCurDesc->rand_seed = rand_val = Random ();
pCurDesc->rand_seed = rand_val = TFB_Random ();
word_val = LOWORD (rand_val);
angle = NORMALIZE_ANGLE ((COUNT)HIBYTE (word_val));
+3 -3
View File
@@ -37,7 +37,7 @@ GenerateSpathi (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -74,7 +74,7 @@ GenerateSpathi (BYTE control)
pSolarSysState->MoonDesc[0].data_index = PELLUCID_WORLD;
pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS + MOON_DELTA;
angle = NORMALIZE_ANGLE (LOWORD (Random ()));
angle = NORMALIZE_ANGLE (LOWORD (TFB_Random ()));
pSolarSysState->MoonDesc[0].location.x =
COSINE (angle, pSolarSysState->MoonDesc[0].radius);
pSolarSysState->MoonDesc[0].location.y =
@@ -113,7 +113,7 @@ GenerateSpathi (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -37,7 +37,7 @@ GenerateSupox (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+2 -2
View File
@@ -39,7 +39,7 @@ GenerateThradd (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -63,7 +63,7 @@ GenerateThradd (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+2 -2
View File
@@ -40,9 +40,9 @@ DeltaTopography (COUNT num_iterations, PSBYTE DepthArray, PRECT pRect,
DWORD rand_val;
register PSBYTE lpDst;
depth_delta = ((((SIZE)Random () & 1) << 1) - 1) * depth_delta;
depth_delta = ((((SIZE)TFB_Random () & 1) << 1) - 1) * depth_delta;
rand_val = Random ();
rand_val = TFB_Random ();
w1 = LOWORD (rand_val);
w2 = HIWORD (rand_val);
+2 -2
View File
@@ -67,7 +67,7 @@ GenerateUtwig (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -94,7 +94,7 @@ GenerateUtwig (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -34,7 +34,7 @@ GenerateShipVault (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+3 -3
View File
@@ -66,7 +66,7 @@ GenerateVUX (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -257,7 +257,7 @@ GenerateVUX (BYTE control)
i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
@@ -289,7 +289,7 @@ GenerateVUX (BYTE control)
i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -33,7 +33,7 @@ GenerateUrquanWreck (BYTE control)
pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]
);
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -36,7 +36,7 @@ GenerateYehat (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+1 -1
View File
@@ -122,7 +122,7 @@ GenerateZoqFotPik (BYTE control)
which_node = i = 0;
do
{
rand_val = Random ();
rand_val = TFB_Random ();
pSolarSysState->SysInfo.PlanetInfo.CurPt.x =
(LOBYTE (LOWORD (rand_val)) % (MAP_WIDTH - (8 << 1))) + 8;
pSolarSysState->SysInfo.PlanetInfo.CurPt.y =
+18 -18
View File
@@ -247,7 +247,7 @@ object_animation (PELEMENT ElementPtr)
if (ElementPtr->mass_points == LAVASPOT_DISASTER
&& frame_index == 5
&& (BYTE)Random () < 256 * 90 / 100)
&& (BYTE)TFB_Random () < 256 * 90 / 100)
{
HELEMENT hLavaElement;
@@ -270,7 +270,7 @@ object_animation (PELEMENT ElementPtr)
else
LavaElementPtr->next.location.x %= MAP_WIDTH << MAG_SHIFT;
LavaElementPtr->hit_points = NORMALIZE_FACING (
ElementPtr->hit_points + ((COUNT)Random () % 3) - 1
ElementPtr->hit_points + ((COUNT)TFB_Random () % 3) - 1
);
UnlockElement (hLavaElement);
}
@@ -312,7 +312,7 @@ object_animation (PELEMENT ElementPtr)
DetectPercent = (((BYTE)(CreatureData[index].Attributes
& AWARENESS_MASK) >> AWARENESS_SHIFT) + 1)
* (30 / 6);
if (((BYTE)Random () % 100) < DetectPercent)
if (((BYTE)TFB_Random () % 100) < DetectPercent)
{
ElementPtr->thrust_wait = 0;
ElementPtr->mass_points |= CREATURE_AWARE;
@@ -336,7 +336,7 @@ object_animation (PELEMENT ElementPtr)
{
COUNT rand_val;
rand_val = (COUNT)Random ();
rand_val = (COUNT)TFB_Random ();
angle = NORMALIZE_ANGLE (LOBYTE (rand_val));
ElementPtr->thrust_wait =
(HIBYTE (rand_val) >> 2) + 10;
@@ -354,7 +354,7 @@ object_animation (PELEMENT ElementPtr)
|| old_angle == (FULL_CIRCLE - QUADRANT))
angle = old_angle;
else
angle = (((COUNT)Random () & 1)
angle = (((COUNT)TFB_Random () & 1)
* HALF_CIRCLE) - QUADRANT;
ElementPtr->thrust_wait = 5;
}
@@ -412,7 +412,7 @@ DeltaLanderCrew (SIZE crew_delta, COUNT which_disaster)
ShieldFlags = GET_GAME_STATE (LANDER_SHIELDS);
ShieldFlags &= 1 << which_disaster;
crew_delta = HIBYTE (pMenuState->delta_item);
if (ShieldFlags && (BYTE)Random () < 256 * 95 / 100)
if (ShieldFlags && (BYTE)TFB_Random () < 256 * 95 / 100)
pMenuState->delta_item = SHIELD_BIT;
else
{
@@ -570,7 +570,7 @@ CheckObjectCollision (COUNT index)
{
case EARTHQUAKE_DISASTER:
case LAVASPOT_DISASTER:
if ((BYTE)Random () < (256 >> 2))
if ((BYTE)TFB_Random () < (256 >> 2))
DeltaLanderCrew (-1, scan);
break;
}
@@ -621,7 +621,7 @@ CheckObjectCollision (COUNT index)
0, 6, 13, 26
};
if (((COUNT)Random () & 127) < danger_vals[
if (((COUNT)TFB_Random () & 127) < danger_vals[
(CreatureData[
ElementPtr->mass_points
& ~CREATURE_AWARE
@@ -845,7 +845,7 @@ lightning_process (PELEMENT ElementPtr)
if (ElementPtr->mass_points == LIGHTNING_DISASTER)
{
if (HIBYTE (pMenuState->delta_item)
&& (BYTE)Random () < (256 / 10)
&& (BYTE)TFB_Random () < (256 / 10)
&& !(
(PPLANETSIDE_DESC)pMenuState->ModuleFrame
)->InTransit)
@@ -857,7 +857,7 @@ lightning_process (PELEMENT ElementPtr)
pPrim->Object.Stamp.frame =
SetAbsFrameIndex (pPrim->Object.Stamp.frame,
(COUNT)Random () % num_frames);
(COUNT)TFB_Random () % num_frames);
}
ElementPtr->turn_wait += HINIBBLE (ElementPtr->turn_wait);
@@ -882,12 +882,12 @@ AddLightning (void)
LightningElementPtr->state_flags = FINITE_LIFE | BAD_GUY;
LightningElementPtr->preprocess_func = lightning_process;
if ((BYTE)Random () >= (256 >> 2))
if ((BYTE)TFB_Random () >= (256 >> 2))
LightningElementPtr->mass_points = 0;
else
LightningElementPtr->mass_points = LIGHTNING_DISASTER;
rand_val = Random ();
rand_val = TFB_Random ();
LightningElementPtr->life_span = 10 + (HIWORD (rand_val) % 10) + 1;
LightningElementPtr->next.location.x = (
pSolarSysState->MenuState.first_item.x
@@ -935,7 +935,7 @@ AddGroundDisaster (COUNT which_disaster)
GroundDisasterElementPtr->state_flags = FINITE_LIFE | BAD_GUY;
GroundDisasterElementPtr->preprocess_func = object_animation;
rand_val = Random ();
rand_val = TFB_Random ();
GroundDisasterElementPtr->next.location.x = (
pSolarSysState->MenuState.first_item.x
+ ((MAP_WIDTH << MAG_SHIFT) - (SURFACE_WIDTH * 3 / 8))
@@ -958,7 +958,7 @@ AddGroundDisaster (COUNT which_disaster)
{
SetPrimType (pPrim, STAMP_PRIM);
GroundDisasterElementPtr->hit_points =
NORMALIZE_FACING (Random ());
NORMALIZE_FACING (TFB_Random ());
pPrim->Object.Stamp.frame = LanderFrame[3];
GroundDisasterElementPtr->turn_wait = MAKE_BYTE (0, 0);
}
@@ -987,7 +987,7 @@ BuildObjectList (void)
lander_flags &= ~KILL_CREW;
pPSD = (PPLANETSIDE_DESC)pMenuState->ModuleFrame;
rand_val = Random ();
rand_val = TFB_Random ();
if (LOBYTE (HIWORD (rand_val)) < pPSD->FireChance)
{
AddGroundDisaster (LAVASPOT_DISASTER);
@@ -1470,14 +1470,14 @@ InitPlanetSide (void)
pt = pSolarSysState->MenuState.first_item;
// Jitter the X landing point.
pt.x -= RANDOM_MISS - (SIZE)(LOWORD (Random ()) % (RANDOM_MISS << 1));
pt.x -= RANDOM_MISS - (SIZE)(LOWORD (TFB_Random ()) % (RANDOM_MISS << 1));
if (pt.x < 0)
pt.x += (MAP_WIDTH << MAG_SHIFT);
else if (pt.x >= (MAP_WIDTH << MAG_SHIFT))
pt.x -= (MAP_WIDTH << MAG_SHIFT);
// Jitter the Y landing point.
pt.y -= RANDOM_MISS - (SIZE)(LOWORD (Random ()) % (RANDOM_MISS << 1));
pt.y -= RANDOM_MISS - (SIZE)(LOWORD (TFB_Random ()) % (RANDOM_MISS << 1));
if (pt.y < 0)
pt.y = 0;
else if (pt.y >= (MAP_HEIGHT << MAG_SHIFT))
@@ -1931,7 +1931,7 @@ PlanetSide (PMENU_STATE pMS)
PSD.ColorCycle[(NUM_TEXT_FRAMES >> 1) - 1] = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x3, 0x00), 0x7F);
pMS->ModuleFrame = (FRAME)&PSD;
index = NORMALIZE_FACING ((COUNT)Random ());
index = NORMALIZE_FACING ((COUNT)TFB_Random ());
LanderFrame[0] = SetAbsFrameIndex (
LanderFrame[0], index
);
+4 -4
View File
@@ -492,7 +492,7 @@ char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'};
if (NumPlanets == (BYTE)~0)
{
#define MAX_GENERATED_PLANETS 10
while ((NumPlanets = (BYTE)(LOWORD (Random())
while ((NumPlanets = (BYTE)(LOWORD (TFB_Random())
% MAX_GENERATED_PLANETS)) == 0)
;
pSolarSysState->SunDesc[0].NumPlanets = NumPlanets;
@@ -520,7 +520,7 @@ char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'};
do
{
rand_val = Random ();
rand_val = TFB_Random ();
if (TypesDefined)
rand_val = 0;
else
@@ -558,7 +558,7 @@ char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'};
else
min_radius = Suns[StarSize].MinGasGDist;
RelocatePlanet:
rand_val = Random ();
rand_val = TFB_Random ();
if (GeneratingMoons)
{
pPD->radius = MIN_MOON_RADIUS
@@ -586,7 +586,7 @@ RelocatePlanet:
}
}
rand_val = Random ();
rand_val = TFB_Random ();
angle = NORMALIZE_ANGLE (LOWORD (rand_val));
pPD->location.x =
COSINE (angle, pPD->radius);
+1 -1
View File
@@ -79,7 +79,7 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
r.extent.height = SIS_SCREEN_HEIGHT - MAP_HEIGHT;
rp = &r;
if (scale_amt == PLANET_INIT_ZOOM_SIZE)
zoom_from |= Random () & 0x03;
zoom_from |= TFB_Random () & 0x03;
// we're zooming in, take care of scaling the frames
for (i=0; i < num_frames; i++)
{
+1 -1
View File
@@ -263,7 +263,7 @@ enum
};
#define CalcGravity(d,r) (UWORD)((DWORD)(d) * (r) / 100)
#define CalcFromBase(b,v) ((UWORD)(b) + ((UWORD)Random () % (v)))
#define CalcFromBase(b,v) ((UWORD)(b) + ((UWORD)TFB_Random () % (v)))
#define PLANET_INFOPTR PPLANET_INFO
+8 -8
View File
@@ -709,7 +709,7 @@ DitherMap (PSBYTE DepthArray)
{
DWORD rand_val;
rand_val = Random ();
rand_val = TFB_Random ();
*lpDst++ += (SBYTE) ((1 << (RANGE_SHIFT - 4))
- (LOBYTE (LOWORD (rand_val)) & ((1 << (RANGE_SHIFT - 3)) - 1)));
*lpDst++ += (SBYTE) ((1 << (RANGE_SHIFT - 4))
@@ -936,7 +936,7 @@ MakeStorms (COUNT storm_count, PSBYTE DepthArray)
intersect = FALSE;
rand_val = Random ();
rand_val = TFB_Random ();
loword = LOWORD (rand_val);
hiword = HIWORD (rand_val);
switch (HIBYTE (hiword) & 31)
@@ -964,7 +964,7 @@ MakeStorms (COUNT storm_count, PSBYTE DepthArray)
if (pstorm_r->extent.height <= 4)
pstorm_r->extent.height += 4;
rand_val = Random ();
rand_val = TFB_Random ();
loword = LOWORD (rand_val);
hiword = HIWORD (rand_val);
@@ -1053,7 +1053,7 @@ MakeGasGiant (COUNT num_bands, PSBYTE DepthArray, PRECT pRect, SIZE
band_error = num_bands >> 1;
lpDst = DepthArray;
band_delta = ((LOWORD (Random ())
band_delta = ((LOWORD (TFB_Random ())
& (NUM_BAND_COLORS - 1)) << RANGE_SHIFT)
+ (1 << (RANGE_SHIFT - 1));
last_y = next_y = 0;
@@ -1061,7 +1061,7 @@ MakeGasGiant (COUNT num_bands, PSBYTE DepthArray, PRECT pRect, SIZE
{
COORD cur_y;
rand_val = Random ();
rand_val = TFB_Random ();
loword = LOWORD (rand_val);
hiword = HIWORD (rand_val);
@@ -1102,7 +1102,7 @@ MakeGasGiant (COUNT num_bands, PSBYTE DepthArray, PRECT pRect, SIZE
& (((1 << RANGE_SHIFT) * NUM_BAND_COLORS) - 1);
}
MakeStorms ((COUNT)(4 + ((COUNT)Random () & 3) + 1), DepthArray);
MakeStorms ((COUNT)(4 + ((COUNT)TFB_Random () & 3) + 1), DepthArray);
DitherMap (DepthArray);
}
@@ -1224,7 +1224,7 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
RECT crater_r;
UWORD loword;
loword = LOWORD (Random ());
loword = LOWORD (TFB_Random ());
switch (HIBYTE (loword) & 31)
{
case 0:
@@ -1247,7 +1247,7 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
break;
}
loword = LOWORD (Random ());
loword = LOWORD (TFB_Random ());
crater_r.extent.height = crater_r.extent.width;
crater_r.corner.x = HIBYTE (loword)
% (MAP_WIDTH - crater_r.extent.width);
+2 -2
View File
@@ -1120,7 +1120,7 @@ GeneratePlanetSide (void)
if (CreatureData[which_node].Attributes & SPEED_MASK)
{
i = (COUNT)Random ();
i = (COUNT)TFB_Random ();
NodeElementPtr->current.location.x =
(LOBYTE (i) % (MAP_WIDTH - (8 << 1))) + 8;
NodeElementPtr->current.location.y =
@@ -1159,7 +1159,7 @@ GeneratePlanetSide (void)
DisplayArray[NodeElementPtr->PrimIndex].Object.Stamp.frame =
SetAbsFrameIndex (
pSolarSysState->PlanetSideFrame[i + 3],
(COUNT)Random ()
(COUNT)TFB_Random ()
);
}
}
+4 -4
View File
@@ -191,7 +191,7 @@ LoadSolarSys (void)
pCurDesc = &pSolarSysState->SunDesc[0];
pCurDesc->pPrevDesc = 0;
pCurDesc->rand_seed = Random ();
pCurDesc->rand_seed = TFB_Random ();
pCurDesc->data_index = STAR_TYPE (CurStarDescPtr->Type);
pCurDesc->location.x = pCurDesc->location.y = 0;
@@ -1595,7 +1595,7 @@ GenerateRandomIP (BYTE control)
BYTE byte_val;
BYTE num_moons;
rand_val = Random ();
rand_val = TFB_Random ();
byte_val = LOBYTE (rand_val);
num_moons = 0;
@@ -1780,7 +1780,7 @@ DrawStarBackGround (BOOLEAN ForPlanet)
#define NUM_DIM_DRAWN 5
for (j = 0; j < NUM_DIM_DRAWN; ++j)
{
rand_val = Random ();
rand_val = TFB_Random ();
s.origin.x = LOWORD (rand_val) % SIS_SCREEN_WIDTH;
s.origin.y = HIWORD (rand_val) % SIS_SCREEN_HEIGHT;
@@ -1794,7 +1794,7 @@ DrawStarBackGround (BOOLEAN ForPlanet)
#define NUM_BRT_DRAWN 30
for (j = 0; j < NUM_BRT_DRAWN; ++j)
{
rand_val = Random ();
rand_val = TFB_Random ();
s.origin.x = LOWORD (rand_val) % SIS_SCREEN_WIDTH;
s.origin.y = HIWORD (rand_val) % SIS_SCREEN_HEIGHT;
+7 -7
View File
@@ -36,7 +36,7 @@ CalcMineralDeposits (SYSTEM_INFOPTR SysInfoPtr, COUNT which_deposit)
{
BYTE num_possible;
num_possible = (BYTE)((BYTE)Random ()
num_possible = (BYTE)((BYTE)TFB_Random ()
% (DEPOSIT_QUANTITY (eptr->Density) + 1));
while (num_possible--)
{
@@ -47,7 +47,7 @@ CalcMineralDeposits (SYSTEM_INFOPTR SysInfoPtr, COUNT which_deposit)
COUNT deposit_quality_fine,
deposit_quality_gross;
deposit_quality_fine = ((COUNT)Random () % 100)
deposit_quality_fine = ((COUNT)TFB_Random () % 100)
+ (
DEPOSIT_QUALITY (eptr->Density)
+ SysInfoPtr->StarSize
@@ -59,7 +59,7 @@ CalcMineralDeposits (SYSTEM_INFOPTR SysInfoPtr, COUNT which_deposit)
else
deposit_quality_gross = 2;
rand_val = Random ();
rand_val = TFB_Random ();
loword = LOWORD (rand_val);
hiword = HIWORD (rand_val);
SysInfoPtr->PlanetInfo.CurPt.x =
@@ -199,25 +199,25 @@ CalcLifeForms (SYSTEM_INFOPTR SysInfoPtr, COUNT which_life)
SysInfoPtr->PlanetInfo.LifeChance = life_var;
life_var = (COUNT)Random () & 1023;
life_var = (COUNT)TFB_Random () & 1023;
if (life_var < SysInfoPtr->PlanetInfo.LifeChance
|| (SysInfoPtr->PlanetInfo.LifeChance < MIN_LIFE_CHANCE
&& life_var < MIN_LIFE_CHANCE))
{
BYTE num_types;
num_types = (BYTE)(((BYTE)Random () % MAX_LIFE_VARIATION) + 1);
num_types = (BYTE)(((BYTE)TFB_Random () % MAX_LIFE_VARIATION) + 1);
do
{
BYTE index, num_creatures;
UWORD rand_val;
rand_val = (UWORD)Random ();
rand_val = (UWORD)TFB_Random ();
index = LOBYTE (rand_val) % NUM_CREATURE_TYPES;
num_creatures = (BYTE)((HIBYTE (rand_val) % 10) + 1);
do
{
rand_val = (UWORD)Random ();
rand_val = (UWORD)TFB_Random ();
SysInfoPtr->PlanetInfo.CurPt.x =
(LOBYTE (rand_val) % (MAP_WIDTH - (8 << 1))) + 8;
SysInfoPtr->PlanetInfo.CurPt.y =
+3 -3
View File
@@ -426,7 +426,7 @@ spawn_ship (STARSHIPPTR
}
else
{
StarShipPtr->ShipFacing = NORMALIZE_FACING (Random ());
StarShipPtr->ShipFacing = NORMALIZE_FACING (TFB_Random ());
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
{
COUNT facing;
@@ -445,9 +445,9 @@ spawn_ship (STARSHIPPTR
do
{
ShipElementPtr->current.location.x =
WRAP_X (DISPLAY_ALIGN_X (Random ()));
WRAP_X (DISPLAY_ALIGN_X (TFB_Random ()));
ShipElementPtr->current.location.y =
WRAP_Y (DISPLAY_ALIGN_Y (Random ()));
WRAP_Y (DISPLAY_ALIGN_Y (TFB_Random ()));
} while (CalculateGravity (ShipElementPtr)
|| TimeSpaceMatterConflict (ShipElementPtr));
}
+4 -4
View File
@@ -143,7 +143,7 @@ bubble_preprocess (PELEMENT ElementPtr)
IncFrameIndex (ElementPtr->current.image.frame);
ElementPtr->state_flags |= CHANGING;
thrust_wait = (BYTE)((COUNT)Random () & 3);
thrust_wait = (BYTE)((COUNT)TFB_Random () & 3);
}
if (turn_wait > 0)
@@ -157,11 +157,11 @@ bubble_preprocess (PELEMENT ElementPtr)
GetVelocityTravelAngle (&ElementPtr->velocity)
));
if ((delta_facing = TrackShip (ElementPtr, &facing)) == -1)
facing = (COUNT)Random ();
facing = (COUNT)TFB_Random ();
else if (delta_facing <= ANGLE_TO_FACING (HALF_CIRCLE))
facing += (COUNT)Random () & (ANGLE_TO_FACING (HALF_CIRCLE) - 1);
facing += (COUNT)TFB_Random () & (ANGLE_TO_FACING (HALF_CIRCLE) - 1);
else
facing -= (COUNT)Random () & (ANGLE_TO_FACING (HALF_CIRCLE) - 1);
facing -= (COUNT)TFB_Random () & (ANGLE_TO_FACING (HALF_CIRCLE) - 1);
SetVelocityVector (&ElementPtr->velocity,
MISSILE_SPEED, facing);
+3 -3
View File
@@ -170,7 +170,7 @@ arilou_intelligence (PELEMENT ShipPtr, PEVALUATE_DESC ObjectsOfConcern,
|| (IsTrackingWeapon && (lpEvalDesc->which_turn == 1
|| (lpEvalDesc->ObjectPtr->state_flags & CREW_OBJECT))) /* FIGHTERS!!! */
|| PlotIntercept (lpEvalDesc->ObjectPtr, ShipPtr, 3, 0))
&& !(Random () & 3))
&& !(TFB_Random () & 3))
{
StarShipPtr->ship_input_state &= ~(LEFT | RIGHT | THRUST | WEAPON);
StarShipPtr->ship_input_state |= SPECIAL;
@@ -262,9 +262,9 @@ arilou_preprocess (PELEMENT ElementPtr)
else
{
ElementPtr->next.location.x =
WRAP_X (DISPLAY_ALIGN_X (Random ()));
WRAP_X (DISPLAY_ALIGN_X (TFB_Random ()));
ElementPtr->next.location.y =
WRAP_Y (DISPLAY_ALIGN_Y (Random ()));
WRAP_Y (DISPLAY_ALIGN_Y (TFB_Random ()));
}
}
+1 -1
View File
@@ -243,7 +243,7 @@ doggy_preprocess (PELEMENT ElementPtr)
GetVelocityTravelAngle (&ElementPtr->velocity)
));
if ((delta_facing = TrackShip (ElementPtr, &facing)) < 0)
facing = NORMALIZE_FACING (Random ());
facing = NORMALIZE_FACING (TFB_Random ());
else
{
ELEMENTPTR ShipPtr;
+3 -3
View File
@@ -138,7 +138,7 @@ laser_death (ELEMENTPTR ElementPtr)
- ShipPtr->current.location.x;
dy = ElementPtr->current.location.y
- ShipPtr->current.location.y;
if (((BYTE)Random () & 0x07)
if (((BYTE)TFB_Random () & 0x07)
&& (dist = (long)dx * dx + (long)dy * dy) >=
(long)DISPLAY_TO_WORLD (CHMMR_OFFSET + 10)
* DISPLAY_TO_WORLD (CHMMR_OFFSET + 10)
@@ -155,7 +155,7 @@ laser_death (ELEMENTPTR ElementPtr)
IonSpotsPtr->life_span = 9;
angle = ARCTAN (dx, dy);
magnitude = ((COUNT)Random ()
magnitude = ((COUNT)TFB_Random ()
% ((square_root (dist) + 1)
- DISPLAY_TO_WORLD (CHMMR_OFFSET + 10)))
+ DISPLAY_TO_WORLD (CHMMR_OFFSET + 10);
@@ -684,7 +684,7 @@ spawn_satellites (PELEMENT ElementPtr)
StarShipPtr->RaceDescPtr->ship_data.special;
SattPtr->current.image.frame = SetAbsFrameIndex (
StarShipPtr->RaceDescPtr->ship_data.special[0],
(COUNT)Random () & 0x07
(COUNT)TFB_Random () & 0x07
);
SattPtr->preprocess_func = satellite_preprocess;
+3 -3
View File
@@ -225,7 +225,7 @@ spawn_comet (PELEMENT ElementPtr)
if (ElementPtr->state_flags & PLAYER_SHIP)
{
CometPtr->turn_wait = 0;
facing = (COUNT)Random ();
facing = (COUNT)TFB_Random ();
SetVelocityVector (&CometPtr->velocity,
COMET_SPEED, facing);
}
@@ -464,7 +464,7 @@ sentinel_preprocess (PELEMENT ElementPtr)
else
{
ElementPtr->state_flags &= ~NONSOLID;
facing = (COUNT)Random ();
facing = (COUNT)TFB_Random ();
SetVelocityVector (&ElementPtr->velocity,
MISSILE_SPEED, facing);
}
@@ -794,7 +794,7 @@ samatra_preprocess (PELEMENT ElementPtr)
GeneratorPtr->current.image.frame =
SetAbsFrameIndex (
StarShipPtr->RaceDescPtr->ship_data.special[0],
(BYTE)Random () % 10
(BYTE)TFB_Random () % 10
);
GeneratorPtr->preprocess_func = generator_preprocess;
+1 -1
View File
@@ -456,7 +456,7 @@ confusion_collision (PELEMENT ElementPtr0, PPOINT pPt0, PELEMENT ElementPtr1, PP
ConfusionPtr->life_span = 400;
ConfusionPtr->turn_wait =
(BYTE)(1 << ((BYTE)Random () & 1)); /* LEFT or RIGHT */
(BYTE)(1 << ((BYTE)TFB_Random () & 1)); /* LEFT or RIGHT */
UnlockElement (hConfusionElement);
}
+6 -6
View File
@@ -271,7 +271,7 @@ COUNT ConcernCounter;
{
StarShipPtr->ship_input_state |= SPECIAL;
if (delta_facing == ANGLE_TO_FACING (HALF_CIRCLE))
delta_facing += (((BYTE)Random () & 1) << 1) - 1;
delta_facing += (((BYTE)TFB_Random () & 1) << 1) - 1;
if (delta_facing < ANGLE_TO_FACING (HALF_CIRCLE))
StarShipPtr->ship_input_state |= RIGHT;
@@ -413,7 +413,7 @@ LeftShip:
ElementPtr->thrust_wait = MARINE_WAIT;
randval = (BYTE)Random ();
randval = (BYTE)TFB_Random ();
if (randval < (0x0100 / 16))
{
ElementPtr->life_span = 0;
@@ -461,7 +461,7 @@ LeftShip:
);
ElementPtr->thrust_wait = 0;
ElementPtr->turn_wait =
MAKE_BYTE (0, NORMALIZE_FACING ((BYTE)Random ()));
MAKE_BYTE (0, NORMALIZE_FACING ((BYTE)TFB_Random ()));
ElementPtr->preprocess_func = marine_preprocess;
}
}
@@ -569,7 +569,7 @@ PELEMENT ElementPtr;
else
{
if (delta_facing == ANGLE_TO_FACING (OCTANT))
facing += (((SIZE)Random () & 1) << 1) - 1;
facing += (((SIZE)TFB_Random () & 1) << 1) - 1;
else if (delta_facing < ANGLE_TO_FACING (OCTANT))
++facing;
else
@@ -615,7 +615,7 @@ PELEMENT ElementPtr;
if (delta_facing > 0)
{
if (delta_facing == ANGLE_TO_FACING (HALF_CIRCLE))
facing += (((BYTE)Random () & 1) << 1) - 1;
facing += (((BYTE)TFB_Random () & 1) << 1) - 1;
else if (delta_facing < ANGLE_TO_FACING (HALF_CIRCLE))
++facing;
else
@@ -750,7 +750,7 @@ marine_collision (PELEMENT ElementPtr0, PPOINT pPt0, PELEMENT ElementPtr1, PPOIN
else if ((ElementPtr0->state_flags & IGNORE_SIMILAR)
&& ElementPtr1->crew_level
#ifdef NEVER
&& (BYTE)Random () <= (0x0100 / 3)
&& (BYTE)TFB_Random () <= (0x0100 / 3)
#endif /* NEVER */
)
{
+6 -6
View File
@@ -192,7 +192,7 @@ COUNT ConcernCounter;
if (StarShipPtr->RaceDescPtr->ship_info.energy_level <
StarShipPtr->RaceDescPtr->ship_info.max_energy
&& (StarShipPtr->special_counter == 0
|| (BYTE)Random () < 20))
|| (BYTE)TFB_Random () < 20))
StarShipPtr->ship_input_state |= SPECIAL;
else
StarShipPtr->ship_input_state &= ~SPECIAL;
@@ -249,7 +249,7 @@ new_pkunk (PELEMENT ElementPtr)
ElementPtr->turn_wait = ElementPtr->thrust_wait = 0;
ElementPtr->life_span = NORMAL_LIFE;
StarShipPtr->ShipFacing = NORMALIZE_FACING (Random ());
StarShipPtr->ShipFacing = NORMALIZE_FACING (TFB_Random ());
ElementPtr->current.image.farray = StarShipPtr->RaceDescPtr->ship_data.ship;
ElementPtr->current.image.frame =
SetAbsFrameIndex (StarShipPtr->RaceDescPtr->ship_data.ship[0],
@@ -261,9 +261,9 @@ new_pkunk (PELEMENT ElementPtr)
do
{
ElementPtr->current.location.x =
WRAP_X (DISPLAY_ALIGN_X (Random ()));
WRAP_X (DISPLAY_ALIGN_X (TFB_Random ()));
ElementPtr->current.location.y =
WRAP_Y (DISPLAY_ALIGN_Y (Random ()));
WRAP_Y (DISPLAY_ALIGN_Y (TFB_Random ()));
} while (CalculateGravity (ElementPtr)
|| TimeSpaceMatterConflict (ElementPtr));
@@ -440,7 +440,7 @@ PELEMENT ElementPtr;
{
ELEMENTPTR PhoenixPtr;
if (((BYTE)Random () & 1)
if (((BYTE)TFB_Random () & 1)
&& (hPhoenix = AllocElement ()))
{
@@ -530,7 +530,7 @@ PELEMENT ElementPtr;
do
{
CurSound =
2 + ((COUNT)Random ()
2 + ((COUNT)TFB_Random ()
% (GetSoundCount (StarShipPtr->RaceDescPtr->ship_data.ship_sounds) - 2));
} while (CurSound == LastSound);
ProcessSound (SetAbsSoundIndex (
+1 -1
View File
@@ -332,7 +332,7 @@ COUNT ConcernCounter;
&& ShipPtr->crew_level == 1)
|| (PlotIntercept (lpWeaponEvalDesc->ObjectPtr, ShipPtr, 2, 0)
&& lpWeaponEvalDesc->ObjectPtr->mass_points >= ShipPtr->crew_level
&& (Random () & 1))))))
&& (TFB_Random () & 1))))))
StarShipPtr->ship_input_state |= SPECIAL;
}
}
+1 -1
View File
@@ -164,7 +164,7 @@ initialize_lightning (PELEMENT ElementPtr, HELEMENT LaserArray[])
LaserPtr->postprocess_func = lightning_postprocess;
LaserPtr->collision_func = lightning_collision;
rand_val = Random ();
rand_val = TFB_Random ();
if (!(ElementPtr->state_flags & PLAYER_SHIP))
{
+1 -1
View File
@@ -162,7 +162,7 @@ COUNT ConcernCounter;
StarShipPtr->ship_input_state &= ~THRUST;
StarShipPtr->ship_input_state |= SPECIAL;
if (!(StarShipPtr->cur_status_flags & (LEFT | RIGHT)))
StarShipPtr->ship_input_state |= 1 << ((BYTE)Random () & 1);
StarShipPtr->ship_input_state |= 1 << ((BYTE)TFB_Random () & 1);
else
StarShipPtr->ship_input_state |=
StarShipPtr->cur_status_flags & (LEFT | RIGHT);
+1 -1
View File
@@ -227,7 +227,7 @@ COUNT ConcernCounter;
/* don't want him backing straight into ship */
if (this_turn <= 8 && LinedUp)
{
if (Random () & 1)
if (TFB_Random () & 1)
StarShipPtr->ship_input_state |= LEFT;
else
StarShipPtr->ship_input_state |= RIGHT;
+1 -1
View File
@@ -225,7 +225,7 @@ COUNT ConcernCounter;
& PLAYER_SHIP) /* means IMMEDIATE WEAPON */
|| PlotIntercept (lpEvalDesc->ObjectPtr,
ShipPtr, 2, 0))
&& (Random () & 3))
&& (TFB_Random () & 3))
{
StarShipPtr->ship_input_state |= SPECIAL;
StarShipPtr->ship_input_state &= ~WEAPON;
+3 -3
View File
@@ -165,7 +165,7 @@ limpet_collision (PELEMENT ElementPtr0, PPOINT pPt0, PELEMENT
/* LIMPET_AFFIXES */
StarShipPtr->RaceDescPtr->ship_data.ship_sounds, 2));
s.frame = SetAbsFrameIndex (
StarShipPtr->RaceDescPtr->ship_data.weapon[0], (COUNT)Random ()
StarShipPtr->RaceDescPtr->ship_data.weapon[0], (COUNT)TFB_Random ()
);
ModifySilhouette (ElementPtr1, &s, MODIFY_IMAGE);
}
@@ -322,11 +322,11 @@ vux_preprocess (PELEMENT ElementPtr)
ElementPtr->current.location.x =
(OtherShipPtr->current.location.x -
(MAXX_ENTRY_DIST >> 1)) +
((COUNT)Random () % MAXX_ENTRY_DIST);
((COUNT)TFB_Random () % MAXX_ENTRY_DIST);
ElementPtr->current.location.y =
(OtherShipPtr->current.location.y -
(MAXY_ENTRY_DIST >> 1)) +
((COUNT)Random () % MAXY_ENTRY_DIST);
((COUNT)TFB_Random () % MAXY_ENTRY_DIST);
dx = OtherShipPtr->current.location.x -
ElementPtr->current.location.x;
dy = OtherShipPtr->current.location.y -
+1 -1
View File
@@ -191,7 +191,7 @@ COUNT ConcernCounter;
& PLAYER_SHIP) /* means IMMEDIATE WEAPON */
|| PlotIntercept (lpEvalDesc->ObjectPtr,
ShipPtr, 2, 0))
&& (Random () & 3))
&& (TFB_Random () & 3))
StarShipPtr->ship_input_state |= SPECIAL;
if (lpEvalDesc->ObjectPtr
+1 -1
View File
@@ -119,7 +119,7 @@ spit_preprocess (PELEMENT ElementPtr)
IncFrameIndex (ElementPtr->next.image.frame);
angle = GetVelocityTravelAngle (&ElementPtr->velocity);
if ((index = GetFrameIndex (ElementPtr->next.image.frame)) == 1)
angle = angle + (((COUNT)Random () % 3) - 1);
angle = angle + (((COUNT)TFB_Random () % 3) - 1);
speed = WORLD_TO_VELOCITY (DISPLAY_TO_WORLD (
GetFrameCount (ElementPtr->next.image.frame) - index) << 1);
+2 -2
View File
@@ -206,7 +206,7 @@ explosion_preprocess (PELEMENT ShipPtr)
SetPrimType (&DisplayArray[ElementPtr->PrimIndex], STAMP_PRIM);
ElementPtr->current.image.farray = explosion;
ElementPtr->current.image.frame = explosion[0];
rand_val = Random ();
rand_val = TFB_Random ();
angle = LOBYTE (HIWORD (rand_val));
dist = DISPLAY_TO_WORLD (LOBYTE (LOWORD (rand_val)) % 8);
if (HIBYTE (LOWORD (rand_val)) < 256 * 1 / 3)
@@ -218,7 +218,7 @@ explosion_preprocess (PELEMENT ShipPtr)
ShipPtr->current.location.y
+ SINE (angle, dist);
ElementPtr->preprocess_func = animation_preprocess;
rand_val = Random ();
rand_val = TFB_Random ();
angle = LOBYTE (LOWORD (rand_val));
dist = WORLD_TO_VELOCITY (
DISPLAY_TO_WORLD (HIBYTE (LOWORD (rand_val)) % 5)
+3 -3
View File
@@ -265,10 +265,10 @@ ModifySilhouette (ELEMENTPTR
ShipIntersect.EndPoint = ShipIntersect.IntersectStamp.origin;
do
{
ObjectIntersect.IntersectStamp.origin.x = ((COUNT)Random ()
ObjectIntersect.IntersectStamp.origin.x = ((COUNT)TFB_Random ()
% (r.extent.width - or.extent.width))
+ ((or.extent.width - r.extent.width) >> 1);
ObjectIntersect.IntersectStamp.origin.y = ((COUNT)Random ()
ObjectIntersect.IntersectStamp.origin.y = ((COUNT)TFB_Random ()
% (r.extent.height - or.extent.height))
+ ((or.extent.height - r.extent.height) >> 1);
ObjectIntersect.EndPoint =
@@ -384,7 +384,7 @@ CheckTracking:
facing = *pfacing;
if (best_delta_facing == ANGLE_TO_FACING (HALF_CIRCLE))
facing += (((BYTE)Random () & 1) << 1) - 1;
facing += (((BYTE)TFB_Random () & 1) << 1) - 1;
else if (best_delta_facing < ANGLE_TO_FACING (HALF_CIRCLE))
++facing;
else