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

Level.c File Reference

#include <Windows.h>
#include <Assert.h>
#include <stdio.h>
#include "GMain.h"
#include "PathPt.h"

Go to the source code of this file.

Functions

void GenVS_Error (const char *Msg,...)
geBoolean SetupWorldCB (GenVSI *VSI, const char *WorldName, geVFile *MainFS)
geBoolean ShutdownWorldCB (GenVSI *VSI)
geBoolean ChangeLevel_Trigger (GenVSI *VSI, void *PlayerData, void *TargetData, void *Context)
geBoolean ChangeLevel_Spawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)


Function Documentation

geBoolean ChangeLevel_Spawn GenVSI VSI,
void *  PlayerData,
void *  ClassData,
char *  EntityName
 

Definition at line 126 of file Level.c.

References GPlayer::Blocked, ChangeLevel_Trigger(), GPlayer::Control, GE_TRUE, geBoolean, GenVS_Error(), GenVSI_RegisterPlayerModel(), geXForm3d_SetIdentity(), geXForm3d_SetTranslation(), ChangeLevel::LevelName, ChangeLevel::Model, NULL, ChangeLevel::Origin, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_LOCAL, VIEW_TYPE_NONE, VIEW_TYPE_STANDON, GPlayer::ViewFlags, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00127 {
00128         ChangeLevel             *Cl;
00129         GPlayer                 *Player;
00130 
00131         Player = (GPlayer*)PlayerData;
00132 
00133         Player->Control = NULL;
00134         Player->Trigger = ChangeLevel_Trigger;
00135         Player->Blocked = NULL;
00136         Player->Time = 0.0f;
00137         Player->ViewFlags = VIEW_TYPE_NONE | VIEW_TYPE_LOCAL | VIEW_TYPE_STANDON;
00138 
00139         if (ClassData == NULL)
00140                 {
00141                         GenVS_Error("ChangeLevel_Spawn: entity missing class data ('%s')\n",EntityName);
00142                 }
00143         Cl = (ChangeLevel*)ClassData;
00144 
00145         if (Cl->LevelName == NULL)
00146                 {
00147                         GenVS_Error("ChangeLevel_Spawn: entity missing LevelName ('%s')\n",EntityName);
00148                 }
00149         if (Cl->Model == NULL)
00150                 {
00151                         GenVS_Error("ChangeLevel_Spawn: entity missing model ('%s')\n",EntityName);
00152                 }
00153 
00154 
00155         geXForm3d_SetIdentity(&Player->XForm);
00156         geXForm3d_SetTranslation(&Player->XForm, Cl->Origin.X, Cl->Origin.Y, Cl->Origin.Z);
00157 
00158         Player->VPos = Player->XForm.Translation;
00159 
00160 
00161         GenVSI_RegisterPlayerModel(VSI, Player, Cl->Model);
00162 
00163 
00164         return GE_TRUE;
00165 }

geBoolean ChangeLevel_Trigger GenVSI VSI,
void *  PlayerData,
void *  TargetData,
void *  Context
[static]
 

Definition at line 104 of file Level.c.

References GPlayer::ClassData, GE_TRUE, geBoolean, GenVSI_SetWorld(), ChangeLevel::LevelName, SetupWorldCB(), and ShutdownWorldCB().

Referenced by ChangeLevel_Spawn().

00105 {
00106         ChangeLevel             *Cl;
00107         GPlayer                 *Player;
00108         char                    Name[256];
00109 
00110         Player = (GPlayer*)PlayerData;
00111         Cl = (ChangeLevel*)Player->ClassData;
00112 
00113         assert(strlen(Cl->LevelName)+8 < 256);
00114         
00115         sprintf(Name, "Levels\\%s", Cl->LevelName);
00116 
00117         // Set the world using the name supplied in the entity that is attached to this player...
00118         GenVSI_SetWorld(VSI, SetupWorldCB, ShutdownWorldCB, Name);
00119 
00120         return GE_TRUE;         
00121 }

void GenVS_Error const char *  Msg,
... 
 

geBoolean SetupWorldCB GenVSI VSI,
const char *  WorldName,
geVFile MainFS
 

Definition at line 28 of file Level.c.

References ACTOR_INDEX_ARMOR, ACTOR_INDEX_GRENADE, ACTOR_INDEX_GRENADE_AMMO, ACTOR_INDEX_HEALTH, ACTOR_INDEX_PLAYER, ACTOR_INDEX_ROCKET, ACTOR_INDEX_ROCKET_AMMO, ACTOR_INDEX_SHREDDER, ACTOR_INDEX_SHREDDER_AMMO, ACTOR_INDEX_TURRET, ACTOR_MOTION_PLAYER_DIE, ACTOR_MOTION_PLAYER_HIT, ACTOR_MOTION_PLAYER_IDLE, ACTOR_MOTION_PLAYER_RUN, ACTOR_MOTION_PLAYER_WALK, CurrentPlayerStart, GE_FALSE, GE_TRUE, geBoolean, GenVSI_ActorIndex(), GenVSI_BoneIndex(), GenVSI_GetWorld(), GenVSI_MotionIndex(), GenVSI_SoundIndex(), GenVSI_TextureIndex(), MainFS, NULL, PathPt_Startup(), SOUND_INDEX_BLASTER, SOUND_INDEX_BLASTER_BANG, SOUND_INDEX_DIE, SOUND_INDEX_GRENADE, SOUND_INDEX_HURT1, SOUND_INDEX_HURT2, SOUND_INDEX_HURT3, SOUND_INDEX_HURT4, SOUND_INDEX_ITEM_SPAWN, SOUND_INDEX_JUMP, SOUND_INDEX_PICKUP_HEALTH, SOUND_INDEX_PICKUP_WEAPON1, SOUND_INDEX_PICKUP_WEAPON2, SOUND_INDEX_PLAYER_SPAWN, SOUND_INDEX_SHREDDER, and TEXTURE_INDEX_WEAPON2.

Referenced by ChangeLevel_Trigger(), Client_Control(), and Server_Main().

00029 {
00030         // Setup the pathpoints for bots...
00031         if (!PathPt_Startup(GenVSI_GetWorld(VSI), MainFS))
00032                 return GE_FALSE;
00033 
00034         // Don't forget to reset this between worlds...
00035         CurrentPlayerStart = NULL;
00036 
00037         // Actor indexes
00038         GenVSI_ActorIndex(VSI, ACTOR_INDEX_PLAYER, "PlayerClient", "Actors\\Dema.Act");
00039         GenVSI_ActorIndex(VSI, ACTOR_INDEX_TURRET, "PlayerClient", "Actors\\Turret.Act");
00040 
00041         GenVSI_ActorIndex(VSI, ACTOR_INDEX_HEALTH, "foo", "Actors\\MedKit.Act");
00042         GenVSI_ActorIndex(VSI, ACTOR_INDEX_ROCKET_AMMO, "foo", "Actors\\rocket.Act");
00043         GenVSI_ActorIndex(VSI, ACTOR_INDEX_ROCKET, "foo", "Actors\\rlaunch.Act");
00044         GenVSI_ActorIndex(VSI, ACTOR_INDEX_SHREDDER, "foo", "Actors\\Shredder.Act");
00045         GenVSI_ActorIndex(VSI, ACTOR_INDEX_SHREDDER_AMMO, "foo", "Actors\\SAmmo.Act");
00046         GenVSI_ActorIndex(VSI, ACTOR_INDEX_GRENADE_AMMO, "foo", "Actors\\Grenade.Act");
00047         GenVSI_ActorIndex(VSI, ACTOR_INDEX_GRENADE, "foo", "Actors\\GLaunch.Act");
00048         GenVSI_ActorIndex(VSI, ACTOR_INDEX_ARMOR, "foo", "Actors\\Armor.Act");
00049 
00050         // Motion indexes
00051         GenVSI_MotionIndex(VSI, ACTOR_MOTION_PLAYER_WALK, "Walk");
00052         GenVSI_MotionIndex(VSI, ACTOR_MOTION_PLAYER_RUN, "Run");
00053         GenVSI_MotionIndex(VSI, ACTOR_MOTION_PLAYER_HIT, "Hit");
00054         GenVSI_MotionIndex(VSI, ACTOR_MOTION_PLAYER_DIE, "Die");
00055         GenVSI_MotionIndex(VSI, ACTOR_MOTION_PLAYER_IDLE, "Idle");
00056 
00057         //GenVSI_MotionIndex(VSI, ACTOR_MOTION_T1, "BigArmLeft");
00058         //GenVSI_MotionIndex(VSI, ACTOR_MOTION_T2, "BigArmEndLeft");
00059 
00060         GenVSI_TextureIndex(VSI, TEXTURE_INDEX_WEAPON2, "Bmp\\Weapon\\Spot_Red.Bmp", "Bmp\\Weapon\\A_Spot.Bmp");
00061 
00062         GenVSI_SoundIndex(VSI, 0, "Wav\\MLaunch.wav");
00063         GenVSI_SoundIndex(VSI, 1, "Wav\\MImpact.wav");
00064         GenVSI_SoundIndex(VSI, 2, "Wav\\DoorOpen.wav");
00065         GenVSI_SoundIndex(VSI, 3, "Wav\\Bounce.wav");
00066         GenVSI_SoundIndex(VSI, 4, "Wav\\KeyPress.wav");
00067         GenVSI_SoundIndex(VSI, SOUND_INDEX_HURT1, "Wav\\Hurt1.Wav");
00068         GenVSI_SoundIndex(VSI, SOUND_INDEX_HURT2, "Wav\\Hurt2.Wav");
00069         GenVSI_SoundIndex(VSI, SOUND_INDEX_HURT3, "Wav\\Hurt3.Wav");
00070         GenVSI_SoundIndex(VSI, SOUND_INDEX_HURT4, "Wav\\Hurt4.Wav");
00071         GenVSI_SoundIndex(VSI, SOUND_INDEX_DIE, "Wav\\Die.Wav");
00072         GenVSI_SoundIndex(VSI, SOUND_INDEX_PICKUP_HEALTH, "Wav\\PickupHealth.Wav");
00073         GenVSI_SoundIndex(VSI, SOUND_INDEX_PICKUP_WEAPON1, "Wav\\LockLoad.Wav");
00074         GenVSI_SoundIndex(VSI, SOUND_INDEX_PICKUP_WEAPON2, "Wav\\WeaponPickup.Wav");
00075         GenVSI_SoundIndex(VSI, SOUND_INDEX_JUMP, "Wav\\Jump.Wav");
00076         GenVSI_SoundIndex(VSI, SOUND_INDEX_BLASTER, "Wav\\Blaster.Wav");
00077         GenVSI_SoundIndex(VSI, SOUND_INDEX_BLASTER_BANG, "Wav\\BlasterBang.Wav");
00078         GenVSI_SoundIndex(VSI, SOUND_INDEX_SHREDDER, "Wav\\Shredder.Wav");
00079         GenVSI_SoundIndex(VSI, SOUND_INDEX_ITEM_SPAWN, "Wav\\itemspwn.Wav");
00080         GenVSI_SoundIndex(VSI, SOUND_INDEX_PLAYER_SPAWN, "Wav\\plyrspwn.Wav");
00081         GenVSI_SoundIndex(VSI, SOUND_INDEX_GRENADE, "Wav\\grenade.Wav");
00082 
00083         // Register bone indexes
00084         GenVSI_BoneIndex(VSI, 0, "ROOT");
00085         GenVSI_BoneIndex(VSI, 1, "AXLE");
00086 
00087         return GE_TRUE;
00088 }

geBoolean ShutdownWorldCB GenVSI VSI  ) 
 

Definition at line 93 of file Level.c.

References GE_TRUE, geBoolean, and PathPt_Shutdown().

Referenced by ChangeLevel_Trigger(), Client_Control(), GenVSI_SetWorld(), Server_Main(), and Server_SetWorldRequest().

00094 {
00095         // Shutdown all the path points for this world...
00096         PathPt_Shutdown();
00097 
00098         return GE_TRUE;
00099 }


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