Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

_bot.h File Reference

Go to the source code of this file.

Compounds

struct  Stack

Defines

#define M_PI   (3.14159f)
#define PI_2   (M_PI*2.0f)
#define M_PI2   (PI_2)

Typedefs

typedef Stack Stack

Functions

int32 krand (void)
int32 RandomRange (int32 range)
void VectorRotateY (geVec3d *vec, float delta_ang, geVec3d *result)
void StackInit (Stack *s)
void StackReset (Stack *s)
void StackPush (Stack *s, int32 data)
int32 StackPop (Stack *s)
int32 StackTop (Stack *s)
geBoolean StackIsEmpty (Stack *s)
void StackSetup (Stack *s)

Variables

int32 randomseed


Define Documentation

#define M_PI   (3.14159f)
 

Definition at line 14 of file _bot.h.

#define M_PI2   (PI_2)
 

Definition at line 16 of file _bot.h.

#define PI_2   (M_PI*2.0f)
 

Definition at line 15 of file _bot.h.


Typedef Documentation

typedef struct Stack Stack
 


Function Documentation

int32 krand void   ) 
 

Definition at line 65 of file _bot.c.

References int32, and randomseed.

Referenced by RandomRange().

00066     {
00067     randomseed = ((randomseed * 21 + 1) & 65535);
00068     return (randomseed);
00069     }

int32 RandomRange int32  range  ) 
 

Definition at line 77 of file _bot.c.

References int32, krand(), and U.

Referenced by Bot_FindNewMoveVec(), Bot_FindRandomItem(), Bot_FindRandomTrack(), Bot_ModeChange(), Bot_ModeThinkAttack(), Bot_ModeThinkLedge(), Bot_ModeThinkUnstick(), Bot_Shoot(), and ChooseAction().

00078     {
00079     int32 rand_num;
00080     int32 value;
00081     
00082     if (range <= 0)
00083         return(0);
00084     
00085     rand_num = krand();
00086     
00087     if (rand_num == 65535U)
00088         rand_num--;
00089     
00090     // shift values to give more precision
00091     value = (rand_num << 14) / ((65535UL << 14) / range);
00092     
00093     if (value >= range)
00094         value = range - 1;
00095         
00096     return(value);
00097     }

void StackInit Stack s  ) 
 

Definition at line 19 of file _bot.c.

References GE_RAM_ALLOCATE_ARRAY, int32, MAX_TRACKS, and s.

Referenced by Bot_Create().

00020         {
00021         s->TOS = -1;
00022         s->Data = GE_RAM_ALLOCATE_ARRAY(int32, MAX_TRACKS);
00023     assert(s->Data);
00024     s->Size = MAX_TRACKS;
00025         }

geBoolean StackIsEmpty Stack s  ) 
 

Definition at line 60 of file _bot.c.

References geBoolean, and s.

Referenced by Bot_FinishTrack(), Bot_InitFindMultiTrack(), Bot_InitFindMultiTrackAway(), and Bot_MoveToPoint().

00061         {
00062         return (s->TOS <= -1);
00063         }

int32 StackPop Stack s  ) 
 

Definition at line 39 of file _bot.c.

References int32, and s.

Referenced by Bot_FinishTrack().

00040         {
00041     int32 value;
00042 
00043         if (s->TOS <= -1)
00044                 return (s->TOS = -1);
00045 
00046         value = s->Data[s->TOS];
00047         s->TOS--;
00048 
00049         return (value);
00050         }

void StackPush Stack s,
int32  data
 

Definition at line 32 of file _bot.c.

References s.

Referenced by Bot_FindTrack(), Bot_FindTrackToGoal(), and Track_FindMultiTrack().

00033         {
00034         s->TOS++;
00035     assert(s->TOS < s->Size);
00036         s->Data[s->TOS] = data;
00037         }

void StackReset Stack s  ) 
 

Definition at line 27 of file _bot.c.

References s.

Referenced by Bot_ActorDying(), Bot_ClearTrack(), Bot_Dying(), and Track_FindMultiTrack().

00028         {
00029         s->TOS = -1;
00030         }

void StackSetup Stack s  ) 
 

int32 StackTop Stack s  ) 
 

Definition at line 52 of file _bot.c.

References int32, and s.

Referenced by Bot_FindTrack(), Bot_FindTrackToGoal(), Bot_FinishTrack(), Bot_InitFindMultiTrack(), and Bot_InitFindMultiTrackAway().

00053         {
00054         if (s->TOS <= -1)
00055                 return (-1);
00056 
00057         return (s->Data[s->TOS]);
00058         }

void VectorRotateY geVec3d vec,
float  delta_ang,
geVec3d result
 

Definition at line 122 of file _bot.c.

References geXForm3d_Rotate(), geXForm3d_RotateY(), and geXForm3d_SetIdentity().

Referenced by Bot_FindNewMoveVec().

00123     {
00124     geXForm3d XForm;
00125 
00126     geXForm3d_SetIdentity(&XForm);
00127     geXForm3d_RotateY(&XForm, delta_ang);
00128     geXForm3d_Rotate(&XForm, vec, result);
00129     }


Variable Documentation

int32 randomseed
 

Definition at line 8 of file _bot.h.

Referenced by krand(), and ksrand().


Generated on Tue Sep 30 12:36:56 2003 for GTestAndEngine by doxygen 1.3.2