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

Game.h File Reference

#include <Windows.h>
#include "Genesis.h"
#include "Ram.h"
#include "GenVSI.h"
#include "GPlayer.h"
#include "GenVS.h"

Go to the source code of this file.

Defines

#define FX_SMOKE_TRAIL   (1<<0)
#define FX_PARTICLE_TRAIL   (1<<1)
#define FX_SHREDDER   (1<<2)
#define FX_EXPLODE1   0
#define FX_EXPLODE2   1

Functions

geBoolean Server_Main (GenVSI *VSI, const char *LevelName)
geBoolean Client_Main (GenVSI *VSI)
geBoolean Game_SpawnClient (GenVSI *VSI, geWorld *World, void *PlayerData, void *ClassData)
geBoolean Game_SpawnBot (GenVSI *VSI, geWorld *World, void *PlayerData, void *ClassData)
void Game_DestroyClient (GenVSI *VSI, void *PlayerData, void *ClassData)


Define Documentation

#define FX_EXPLODE1   0
 

Definition at line 39 of file Game.h.

#define FX_EXPLODE2   1
 

Definition at line 40 of file Game.h.

#define FX_PARTICLE_TRAIL   (1<<1)
 

Definition at line 35 of file Game.h.

#define FX_SHREDDER   (1<<2)
 

Definition at line 36 of file Game.h.

#define FX_SMOKE_TRAIL   (1<<0)
 

Definition at line 34 of file Game.h.


Function Documentation

geBoolean Client_Main GenVSI VSI  ) 
 

Definition at line 130 of file Genesis3d/src/Game/GMain.c.

References Blaster_Control(), Client_Control(), Door_Control(), Door_Trigger(), GE_TRUE, geBoolean, GenVSI_ProcIndex(), Grenade_Control(), Item_ControlHealth(), Plat_Control(), Plat_Trigger(), Rocket_Control(), and Shredder_Control().

Referenced by Client_Create().

00131 {
00132         GenVSI_ProcIndex(VSI, 0, Client_Control);
00133         GenVSI_ProcIndex(VSI, 1, Door_Control);
00134         GenVSI_ProcIndex(VSI, 2, Door_Trigger);
00135         GenVSI_ProcIndex(VSI, 3, Plat_Control);
00136         GenVSI_ProcIndex(VSI, 4, Plat_Trigger);
00137         GenVSI_ProcIndex(VSI, 5, Blaster_Control);
00138         GenVSI_ProcIndex(VSI, 6, Rocket_Control);
00139         GenVSI_ProcIndex(VSI, 7, Grenade_Control);
00140         GenVSI_ProcIndex(VSI, 8, Shredder_Control);
00141         GenVSI_ProcIndex(VSI, 9, Item_ControlHealth);
00142 
00143         return GE_TRUE;
00144 }

void Game_DestroyClient GenVSI VSI,
void *  PlayerData,
void *  ClassData
 

Definition at line 321 of file Genesis3d/src/Game/GMain.c.

Referenced by Server_ValidateClient().

00322 {
00323         //GenVS_Error( "Client destroyed...");          // For debugging...
00324 }

geBoolean Game_SpawnBot GenVSI VSI,
geWorld World,
void *  PlayerData,
void *  ClassData
 

Definition at line 4684 of file bot.c.

References ACTOR_INDEX_PLAYER, ACTOR_MOTION_PLAYER_RUN, Bot_Create(), Bot_Destroy(), GPlayer::ClientHandle, GPlayer::ControlIndex, GPlayer::CurrentWeapon, DAMMAGE_TYPE_NORMAL, DAMMAGE_TYPE_RADIUS, GPlayer::DammageFlags, GPlayer::DFunc, GE_FALSE, GE_TRUE, geBoolean, GenVSI_ClientDisconnect(), GenVSI_SetClientHealth(), GenVSI_SetClientInventory(), GenVSI_SetClientScore(), GetBotMatchSpawn(), GPlayer::GunOffset, GPlayer::Health, int32, GPlayer::Inventory, GPlayer::InventoryHas, ITEM_GRENADES, ITEM_ROCKETS, ITEM_SHREDDER, MAX_PLAYER_ITEMS, GPlayer::Maxs, GPlayer::Mins, GPlayer::MotionIndex, GPlayer::NextWeaponTime, GPlayer::Scale, GPlayer::Score, GPlayer::Time, VIEW_TYPE_ACTOR, VIEW_TYPE_COLLIDEMODEL, VIEW_TYPE_YAW_ONLY, GPlayer::ViewFlags, GPlayer::ViewIndex, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_ValidateClient().

04685 {
04686         int32                   i;
04687         GPlayer                 *DMStart;
04688         GPlayer                 *Player;
04689         geVec3d                 Normal = {0.0f, 1.0f, 0.0f};
04690 
04691         Player = (GPlayer*)PlayerData;
04692 
04693         // Get a DM start
04694         DMStart = GetBotMatchSpawn(VSI);
04695         if (!DMStart)
04696                 {
04697                 //GenVSI_ConsoleHeaderPrintf(VSI, DBot->TgtPlayer->ClientHandle, GE_TRUE, "No Bot spawn positions exist.");
04698                 GenVSI_ClientDisconnect(VSI, Player->ClientHandle);
04699                 return GE_TRUE;
04700                 }
04701         
04702         Player->XForm = DMStart->XForm;
04703 
04704         Player->Time = 0.0f;
04705 
04706         Player->Scale = 2.7f;   
04707         
04708         Player->Mins.X = -30.0f;
04709         Player->Mins.Y = -10.0f;
04710         Player->Mins.Z = -30.0f;
04711         Player->Maxs.X =  30.0f;
04712         Player->Maxs.Y = 160.0f;
04713         Player->Maxs.Z =  30.0f;
04714 
04715         Player->GunOffset.X = 0.0f;
04716         Player->GunOffset.Y = 130.0f;
04717         Player->GunOffset.Z = 0.0f;
04718 
04719         // Set the view info
04720         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_YAW_ONLY | VIEW_TYPE_COLLIDEMODEL;
04721         Player->ViewIndex = ACTOR_INDEX_PLAYER;
04722         Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
04723         Player->DammageFlags = DAMMAGE_TYPE_NORMAL | DAMMAGE_TYPE_RADIUS;       
04724 
04725 
04726         // Hook player up to client physics controller
04727         Player->ControlIndex = 0;
04728         Player->DFunc = (void*)Bot_Destroy;
04729 
04730         Bot_Create(VSI, Player);
04731 
04732         // Set the view player on this machine to the clients player
04733         // !Important! - don't set the player view to the bot
04734         //GenVSI_SetViewPlayer(VSI, ClientHandle, Player);
04735 
04736         // Players keep track of scoring, health, etc for now.
04737         // Server_SetClientScore/Health must be called to update a particular client
04738         // that is associated with a player...
04739 
04740         Player->Health = 100;
04741         Player->Score = 0;
04742 
04743 
04744         // FIXME:  Soon, Scores, Health, etc won't be so arbitrary.  Maybe somthing like
04745         // Quake2's Layouts will be used instead, making it easier to make games that don't
04746         // use this sort of scoring system...
04747         GenVSI_SetClientScore(VSI, Player->ClientHandle, Player->Score);
04748         GenVSI_SetClientHealth(VSI, Player->ClientHandle, Player->Health);
04749 
04750         for (i=0; i< MAX_PLAYER_ITEMS; i++)
04751         {
04752                 Player->Inventory[i] = 0;
04753                 Player->InventoryHas[i] = GE_FALSE;
04754         }
04755 
04756         Player->CurrentWeapon = 0;
04757         
04758         GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_GRENADES, 0, GE_FALSE);
04759         GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_ROCKETS, 0, GE_FALSE);
04760         GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_SHREDDER, 0, GE_FALSE);
04761 
04762         Player->NextWeaponTime = 0.0f;
04763 
04764         return GE_TRUE;
04765 }

geBoolean Game_SpawnClient GenVSI VSI,
geWorld World,
void *  PlayerData,
void *  ClassData
 

Definition at line 230 of file Genesis3d/src/Game/GMain.c.

References ACTOR_INDEX_PLAYER, ACTOR_MOTION_PLAYER_RUN, Client_Control(), GPlayer::ClientHandle, GPlayer::Control, GPlayer::ControlIndex, GPlayer::CurrentWeapon, DAMMAGE_TYPE_NORMAL, DAMMAGE_TYPE_RADIUS, GPlayer::DammageFlags, GE_FALSE, GE_TRUE, geBoolean, GenVSI_SetClientHealth(), GenVSI_SetClientInventory(), GenVSI_SetClientScore(), GenVSI_SetViewPlayer(), GetDMSpawn(), geXForm3d_SetIdentity(), GPlayer::GunOffset, GPlayer::Health, int32, GPlayer::Inventory, GPlayer::InventoryHas, ITEM_GRENADES, ITEM_ROCKETS, ITEM_SHREDDER, GPlayer::JustSpawned, MAX_PLAYER_ITEMS, GPlayer::Maxs, GPlayer::Mins, GPlayer::MotionIndex, GPlayer::NextWeaponTime, GPlayer::Scale, GPlayer::Score, GPlayer::Time, VIEW_TYPE_ACTOR, VIEW_TYPE_COLLIDEMODEL, VIEW_TYPE_YAW_ONLY, GPlayer::ViewFlags, GPlayer::ViewIndex, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_ValidateClient().

00231 {
00232         int32                   i;
00233         GPlayer                 *Player;
00234 
00235         //Player = (GPlayer*)GenVSI_GetPlayerData(VSI, PlayerHandle);
00236         Player = (GPlayer*)PlayerData;
00237 
00238         geXForm3d_SetIdentity(&Player->XForm);
00239 
00240         // Get a DM start
00241 #ifndef FLY_MODE
00242         {
00243                 GPlayer                 *DMStart;
00244 
00245                 DMStart = GetDMSpawn(VSI);
00246                 Player->XForm = DMStart->XForm;
00247         }
00248 
00249         //GenVSI_SetPlayerBox(VSI, PlayerHandle, &Mins, &Maxs);
00250         Player->Mins.X = -30.0f;
00251         Player->Mins.Y = -10.0f;
00252         Player->Mins.Z = -30.0f;
00253         Player->Maxs.X =  30.0f;
00254         Player->Maxs.Y = 160.0f;
00255         Player->Maxs.Z =  30.0f;
00256 #else
00257         Player->Mins.X =-5.0f;
00258         Player->Mins.Y =-5.0f;
00259         Player->Mins.Z =-5.0f;
00260         Player->Maxs.X = 5.0f;
00261         Player->Maxs.Y = 5.0f;
00262         Player->Maxs.Z = 5.0f;
00263 #endif
00264 
00265         Player->Time = 0.0f;
00266         Player->JustSpawned = GE_TRUE;
00267 
00268         //GenVSI_SetClientGunOffset(VSI, ClientHandle, 0.0f, 130.0f, 0.0f);
00269         Player->GunOffset.X = 0.0f;
00270         Player->GunOffset.Y = 130.0f;
00271         Player->GunOffset.Z = 0.0f;
00272 
00273         Player->Scale = 2.7f;
00274 
00275         // Set the view info
00276         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_YAW_ONLY | VIEW_TYPE_COLLIDEMODEL;
00277         Player->ViewIndex = ACTOR_INDEX_PLAYER;
00278         Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
00279         Player->DammageFlags = DAMMAGE_TYPE_NORMAL | DAMMAGE_TYPE_RADIUS;
00280         
00281         // Hook player up to client physics controller
00282         Player->ControlIndex = 0;
00283         Player->Control = Client_Control;
00284 
00285         // Set the view player on this machine to the clients player
00286         GenVSI_SetViewPlayer(VSI, Player->ClientHandle, Player);
00287 
00288         // Players keep track of scoring, health, etc for now.
00289         // Server_SetClientScore/Health must be called to update a particular client
00290         // that is associated with a player...
00291 
00292         Player->Health = 100;
00293         Player->Score = 0;
00294 
00295         // FIXME:  Soon, Scores, Health, etc won't be so arbitrary.  Maybe somthing like
00296         // Quake2's Layouts will be used instead, making it easier to make games that don't
00297         // use this sort of scoring system...
00298         GenVSI_SetClientScore(VSI, Player->ClientHandle, Player->Score);
00299         GenVSI_SetClientHealth(VSI, Player->ClientHandle, Player->Health);
00300 
00301         for (i=0; i< MAX_PLAYER_ITEMS; i++)
00302         {
00303                 Player->Inventory[i] = 0;
00304                 Player->InventoryHas[i] = GE_FALSE;
00305         }
00306 
00307         Player->CurrentWeapon = 0;
00308         
00309         GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_GRENADES, 0, GE_FALSE);
00310         GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_ROCKETS, 0, GE_FALSE);
00311         GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_SHREDDER, 0, GE_FALSE);
00312 
00313         Player->NextWeaponTime = 0.0f;
00314 
00315         return GE_TRUE;
00316 }

geBoolean Server_Main GenVSI VSI,
const char *  LevelName
 

Definition at line 73 of file Genesis3d/src/Game/GMain.c.

References Attacker_TurretDestroy(), Attacker_TurretSpawn(), Blaster_Control(), Bot_Main(), ChangeLevel_Spawn(), Client_Control(), CurrentPlayerStart, Door_Control(), Door_Spawn(), Door_Trigger(), ForceField_Spawn(), GE_TRUE, geBoolean, GenVSI_ProcIndex(), GenVSI_SetClassSpawn(), GenVSI_SetWorld(), Grenade_Control(), Item_ArmorSpawn(), Item_ControlHealth(), Item_GrenadeAmmoSpawn(), Item_GrenadeSpawn(), Item_HealthSpawn(), Item_RocketAmmoSpawn(), Item_RocketSpawn(), Item_ShredderAmmoSpawn(), Item_ShredderSpawn(), NULL, PhysicalSystem_Destroy(), PhysicalSystem_Spawn(), PhysicsJoint_Destroy(), PhysicsJoint_Spawn(), PhysicsObject_Destroy(), PhysicsObject_Spawn(), Plat_Control(), Plat_Spawn(), Plat_Trigger(), Player_Spawn(), Rocket_Control(), SetupWorldCB(), Shredder_Control(), and ShutdownWorldCB().

Referenced by Server_Create().

00074 {
00075         Bot_Main(VSI, LevelName);
00076     
00077         CurrentPlayerStart = NULL;
00078 
00079         // SetClassSpawn functions get called once, and are used for each SetWorld...
00080         // Set the calss spawns
00081         GenVSI_SetClassSpawn(VSI, "DeathMatchStart", Player_Spawn, NULL);
00082         
00083         // Doors/Plats/PhysicalObjects/PhysicsJoints/PhysicalSystems/etc.
00084         GenVSI_SetClassSpawn(VSI, "Door", Door_Spawn, NULL);
00085         GenVSI_SetClassSpawn(VSI, "MovingPlat", Plat_Spawn, NULL);
00086         
00087         GenVSI_SetClassSpawn(VSI, "PhysicsObject", PhysicsObject_Spawn, PhysicsObject_Destroy);
00088         GenVSI_SetClassSpawn(VSI, "PhysicsJoint", PhysicsJoint_Spawn, PhysicsJoint_Destroy);
00089         GenVSI_SetClassSpawn(VSI, "PhysicalSystem", PhysicalSystem_Spawn, PhysicalSystem_Destroy);
00090         GenVSI_SetClassSpawn(VSI, "ForceField", ForceField_Spawn, NULL);
00091         
00092 
00093         // Change level trigger
00094         GenVSI_SetClassSpawn(VSI, "ChangeLevel", ChangeLevel_Spawn, NULL);
00095 
00096         // Items
00097         GenVSI_SetClassSpawn(VSI, "ItemHealth", Item_HealthSpawn, NULL);
00098         GenVSI_SetClassSpawn(VSI, "ItemArmor", Item_ArmorSpawn, NULL);
00099         GenVSI_SetClassSpawn(VSI, "ItemRocket", Item_RocketSpawn, NULL);
00100         GenVSI_SetClassSpawn(VSI, "ItemRocketAmmo", Item_RocketAmmoSpawn, NULL);
00101         GenVSI_SetClassSpawn(VSI, "ItemGrenade", Item_GrenadeSpawn, NULL);
00102         GenVSI_SetClassSpawn(VSI, "ItemGrenadeAmmo", Item_GrenadeAmmoSpawn, NULL);
00103         GenVSI_SetClassSpawn(VSI, "ItemShredder", Item_ShredderSpawn, NULL);
00104         GenVSI_SetClassSpawn(VSI, "ItemShredderAmmo", Item_ShredderAmmoSpawn, NULL);
00105 
00106         GenVSI_SetClassSpawn(VSI, "AttackerTurret", Attacker_TurretSpawn, Attacker_TurretDestroy);
00107 
00108         // Set the level with these spawns...
00109         // FIXME:  Rename to: Server_ExecuteClassSpawns(Server, LevelName);???????
00110         GenVSI_SetWorld(VSI, SetupWorldCB, ShutdownWorldCB, LevelName);         // Use the level name supplied by the host
00111 
00112         // Proc indexes
00113         GenVSI_ProcIndex(VSI, 0, Client_Control);
00114         GenVSI_ProcIndex(VSI, 1, Door_Control);
00115         GenVSI_ProcIndex(VSI, 2, Door_Trigger);
00116         GenVSI_ProcIndex(VSI, 3, Plat_Control);
00117         GenVSI_ProcIndex(VSI, 4, Plat_Trigger);
00118         GenVSI_ProcIndex(VSI, 5, Blaster_Control);
00119         GenVSI_ProcIndex(VSI, 6, Rocket_Control);
00120         GenVSI_ProcIndex(VSI, 7, Grenade_Control);
00121         GenVSI_ProcIndex(VSI, 8, Shredder_Control);
00122         GenVSI_ProcIndex(VSI, 9, Item_ControlHealth);
00123 
00124         return GE_TRUE;
00125 }


Generated on Tue Sep 30 12:37:33 2003 for GTestAndEngine by doxygen 1.3.2