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

GMain.h File Reference

#include <Windows.h>
#include "Game.h"

Go to the source code of this file.

Compounds

struct  CData

Defines

#define ACTOR_INDEX_PLAYER   0
#define ACTOR_INDEX_TURRET   1
#define ACTOR_INDEX_HEALTH   2
#define ACTOR_INDEX_ROCKET_AMMO   3
#define ACTOR_INDEX_ROCKET   4
#define ACTOR_INDEX_SHREDDER   5
#define ACTOR_INDEX_SHREDDER_AMMO   6
#define ACTOR_INDEX_GRENADE_AMMO   7
#define ACTOR_INDEX_GRENADE   8
#define ACTOR_INDEX_ARMOR   9
#define ACTOR_MOTION_PLAYER_WALK   0
#define ACTOR_MOTION_PLAYER_RUN   1
#define ACTOR_MOTION_PLAYER_HIT   2
#define ACTOR_MOTION_PLAYER_DIE   3
#define ACTOR_MOTION_PLAYER_IDLE   4
#define ACTOR_MOTION_T1   5
#define ACTOR_MOTION_T2   6
#define SOUND_INDEX_HURT1   5
#define SOUND_INDEX_HURT2   6
#define SOUND_INDEX_HURT3   7
#define SOUND_INDEX_HURT4   8
#define SOUND_INDEX_DIE   9
#define SOUND_INDEX_PICKUP_HEALTH   10
#define SOUND_INDEX_PICKUP_WEAPON1   11
#define SOUND_INDEX_PICKUP_WEAPON2   12
#define SOUND_INDEX_JUMP   13
#define SOUND_INDEX_BLASTER   14
#define SOUND_INDEX_BLASTER_BANG   15
#define SOUND_INDEX_SHREDDER   16
#define SOUND_INDEX_ITEM_SPAWN   17
#define SOUND_INDEX_PLAYER_SPAWN   18
#define SOUND_INDEX_GRENADE   19
#define TEXTURE_INDEX_WEAPON2   0
#define ITEM_BLASTER   0
#define ITEM_GRENADES   1
#define ITEM_ROCKETS   2
#define ITEM_SHREDDER   3
#define ITEM_ARMOR   16
#define HEALTH_RESPAWN   45.0f
#define ROCKET_RESPAWN   10.0f
#define ROCKET_AMMO_RESPAWN   30.0f
#define ROCKET_AMOUNT   5
#define ROCKET_MAX_AMOUNT   100
#define ROCKET_AMMO_AMOUNT   5
#define GRENADE_RESPAWN   10.0f
#define GRENADE_AMMO_RESPAWN   30.0f
#define GRENADE_AMOUNT   5
#define GRENADE_MAX_AMOUNT   100
#define GRENADE_AMMO_AMOUNT   5
#define SHREDDER_RESPAWN   10.0f
#define SHREDDER_AMMO_RESPAWN   30.0f
#define SHREDDER_AMOUNT   25
#define SHREDDER_MAX_AMOUNT   200
#define SHREDDER_AMMO_AMOUNT   50
#define ARMOR_RESPAWN   25.0f
#define ARMOR_AMOUNT   100
#define MAX_ARMOR   300
#define MAX_ARMOR_PROTECTION   0.7f
#define ROTATION_FRICTION   0.90f
#define PLAYER_GROUND_FRICTION   7.0f
#define PLAYER_LIQUID_FRICTION   2.5f
#define PLAYER_AIR_FRICTION   1.00f
#define PLAYER_GRAVITY   1600.0f
#define PLAYER_JUMP_THRUST   700
#define PLAYER_SIDE_SPEED   4000.0f
#define CONTENTS_WATER   GE_CONTENTS_USER1
#define CONTENTS_LAVA   GE_CONTENTS_USER2

Functions

BOOL XFormFromVector (const geVec3d *Source, const geVec3d *Target, float Roll, geXForm3d *Out)
void SqueezeVector (geVec3d *Vect, float Epsilon)
void ClampVector (geVec3d *Vect, float Epsilon)
void ReflectVelocity (geVec3d *In, geVec3d *Normal, geVec3d *Out, float Scale)
geBoolean AnimatePlayer (GenVSI *VSI, void *PlayerData, uint16 MotionIndex, float Speed, geBoolean Loop)
geBoolean AnimatePlayer2 (GenVSI *VSI, void *PlayerData, int32 MotionSlot, float Speed, geBoolean Loop)
void UpdateClientInventory (GenVSI *VSI, GPlayer *Player, int32 Slot)
geBoolean CheckVelocity (GenVSI *VSI, void *PlayerData, float BounceScale, geBoolean AllowBounce, float Time)
geBoolean DammagePlayer (GenVSI *VSI, void *PlayerData, void *TargetData, int32 Amount, float Power, float Time)
void FireGrenade (GenVSI *VSI, void *PlayerData, float Time)
void FireRocket (GenVSI *VSI, void *PlayerData, float Time)
geBoolean FireWeapon (GenVSI *VSI, void *PlayerData, float Time)
geBoolean Blaster_Control (GenVSI *VSI, void *PlayerData, float Time)
geBoolean Grenade_Control (GenVSI *VSI, void *PlayerData, float Time)
geBoolean Rocket_Control (GenVSI *VSI, void *PlayerData, float Time)
geBoolean Shredder_Control (GenVSI *VSI, void *PlayerData, float Time)
geBoolean Item_ControlHealth (GenVSI *VSI, void *PlayerData, float Time)
geBoolean Item_HealthSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_ArmorSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_RocketSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_RocketAmmoSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_GrenadeSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_GrenadeAmmoSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_ShredderSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Item_ShredderAmmoSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean SetupWorldCB (GenVSI *VSI, const char *WorldName, geVFile *MainFS)
geBoolean ShutdownWorldCB (GenVSI *VSI)
geBoolean ChangeLevel_Spawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
geBoolean Attacker_TurretSpawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
void Attacker_TurretDestroy (GenVSI *VSI, void *PlayerData, void *ClassData)
void Attacker_Fire (GenVSI *VSI, GPlayer *Player, GPlayer *Target, float Time)
geBoolean PlayerPhysics (GenVSI *VSI, void *PlayerData, float GroundFriction, float AirFriction, float LiquidFriction, float Gravity, float BounceScale, geBoolean AllowBounce, float Time)
geBoolean UpdatePlayerContents (GenVSI *VSI, void *PlayerData, float Time)
geBoolean SelfCollisionCB (geWorld_Model *Model, geActor *Actor, void *Context)
geBoolean SelfCollisionCB2 (geWorld_Model *Model, geActor *Actor, void *Context)

Variables

GPlayerCurrentPlayerStart


Define Documentation

#define ACTOR_INDEX_ARMOR   9
 

Definition at line 37 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ArmorSpawn(), Item_ControlArmor(), and SetupWorldCB().

#define ACTOR_INDEX_GRENADE   8
 

Definition at line 36 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ControlGrenade(), Item_GrenadeSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_GRENADE_AMMO   7
 

Definition at line 35 of file Genesis3d/src/Game/GMain.h.

Referenced by FireGrenade(), Item_ControlGrenadeAmmo(), Item_GrenadeAmmoSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_HEALTH   2
 

Definition at line 30 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ControlHealth(), Item_HealthSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_PLAYER   0
 

Definition at line 27 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorStart(), Game_SpawnBot(), Game_SpawnClient(), and SetupWorldCB().

#define ACTOR_INDEX_ROCKET   4
 

Definition at line 32 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ControlRocket(), Item_RocketSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_ROCKET_AMMO   3
 

Definition at line 31 of file Genesis3d/src/Game/GMain.h.

Referenced by FireRocket(), Item_ControlRocketAmmo(), Item_RocketAmmoSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_SHREDDER   5
 

Definition at line 33 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ControlShredder(), Item_ShredderSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_SHREDDER_AMMO   6
 

Definition at line 34 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ControlShredderAmmo(), Item_ShredderAmmoSpawn(), and SetupWorldCB().

#define ACTOR_INDEX_TURRET   1
 

Definition at line 28 of file Genesis3d/src/Game/GMain.h.

Referenced by Attacker_TurretSpawn(), and SetupWorldCB().

#define ACTOR_MOTION_PLAYER_DIE   3
 

Definition at line 43 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_Dying(), KillPlayer(), Player_Dying(), and SetupWorldCB().

#define ACTOR_MOTION_PLAYER_HIT   2
 

Definition at line 42 of file Genesis3d/src/Game/GMain.h.

Referenced by DammagePlayer(), and SetupWorldCB().

#define ACTOR_MOTION_PLAYER_IDLE   4
 

Definition at line 44 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_Animate(), Client_Control(), and SetupWorldCB().

#define ACTOR_MOTION_PLAYER_RUN   1
 

Definition at line 41 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_ActorStart(), Bot_Animate(), Bot_Dying(), Client_Control(), Game_SpawnBot(), Game_SpawnClient(), Player_Dying(), and SetupWorldCB().

#define ACTOR_MOTION_PLAYER_WALK   0
 

Definition at line 40 of file Genesis3d/src/Game/GMain.h.

Referenced by SetupWorldCB().

#define ACTOR_MOTION_T1   5
 

Definition at line 45 of file Genesis3d/src/Game/GMain.h.

Referenced by Attacker_TurretSpawn().

#define ACTOR_MOTION_T2   6
 

Definition at line 46 of file Genesis3d/src/Game/GMain.h.

Referenced by Attacker_TurretSpawn().

#define ARMOR_AMOUNT   100
 

Definition at line 112 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerArmor().

#define ARMOR_RESPAWN   25.0f
 

Definition at line 111 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerArmor().

#define CONTENTS_LAVA   GE_CONTENTS_USER2
 

Definition at line 125 of file Genesis3d/src/Game/GMain.h.

#define CONTENTS_WATER   GE_CONTENTS_USER1
 

Definition at line 124 of file Genesis3d/src/Game/GMain.h.

#define GRENADE_AMMO_AMOUNT   5
 

Definition at line 99 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenadeAmmo().

#define GRENADE_AMMO_RESPAWN   30.0f
 

Definition at line 95 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenadeAmmo().

#define GRENADE_AMOUNT   5
 

Definition at line 97 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenade().

#define GRENADE_MAX_AMOUNT   100
 

Definition at line 98 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenadeAmmo().

#define GRENADE_RESPAWN   10.0f
 

Definition at line 94 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenade().

#define HEALTH_RESPAWN   45.0f
 

Definition at line 83 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerHealth().

#define ITEM_ARMOR   16
 

Definition at line 76 of file Genesis3d/src/Game/GMain.h.

Referenced by DammagePlayer(), and Item_TriggerArmor().

#define ITEM_BLASTER   0
 

Definition at line 69 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_Shoot(), and Bot_TrackAction().

#define ITEM_GRENADES   1
 

Definition at line 70 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_RankWeapons(), FireGrenade(), Game_SpawnBot(), Game_SpawnClient(), Item_TriggerGrenade(), and Item_TriggerGrenadeAmmo().

#define ITEM_ROCKETS   2
 

Definition at line 71 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_RankWeapons(), Bot_Shoot(), Bot_TrackAction(), Bot_ValidateMultiTrackPoints(), Bot_ValidateTrackPoints(), FireRocket(), Game_SpawnBot(), Game_SpawnClient(), Item_TriggerRocket(), and Item_TriggerRocketAmmo().

#define ITEM_SHREDDER   3
 

Definition at line 72 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_RankWeapons(), FireShredder(), Game_SpawnBot(), Game_SpawnClient(), Item_TriggerShredder(), and Item_TriggerShredderAmmo().

#define MAX_ARMOR   300
 

Definition at line 113 of file Genesis3d/src/Game/GMain.h.

Referenced by DammagePlayer(), and Item_TriggerArmor().

#define MAX_ARMOR_PROTECTION   0.7f
 

Definition at line 114 of file Genesis3d/src/Game/GMain.h.

Referenced by DammagePlayer().

#define PLAYER_AIR_FRICTION   1.00f
 

Definition at line 119 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_Dying(), Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WeaponJump(), Client_Control(), Player_Dying(), and PlayerPhysics().

#define PLAYER_GRAVITY   1600.0f
 

Definition at line 120 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_Dying(), Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WeaponJump(), Client_Control(), Player_Dying(), and PlayerPhysics().

#define PLAYER_GROUND_FRICTION   7.0f
 

Definition at line 117 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_Dying(), Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WeaponJump(), Client_Control(), Player_Dying(), and PlayerPhysics().

#define PLAYER_JUMP_THRUST   700
 

Definition at line 121 of file Genesis3d/src/Game/GMain.h.

Referenced by Client_Control().

#define PLAYER_LIQUID_FRICTION   2.5f
 

Definition at line 118 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_Dying(), Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WeaponJump(), Client_Control(), Player_Dying(), and PlayerPhysics().

#define PLAYER_SIDE_SPEED   4000.0f
 

Definition at line 122 of file Genesis3d/src/Game/GMain.h.

Referenced by Client_Control().

#define ROCKET_AMMO_AMOUNT   5
 

Definition at line 91 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerRocketAmmo().

#define ROCKET_AMMO_RESPAWN   30.0f
 

Definition at line 87 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerRocketAmmo().

#define ROCKET_AMOUNT   5
 

Definition at line 89 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerRocket().

#define ROCKET_MAX_AMOUNT   100
 

Definition at line 90 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerRocketAmmo().

#define ROCKET_RESPAWN   10.0f
 

Definition at line 86 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerRocket().

#define ROTATION_FRICTION   0.90f
 

Definition at line 116 of file Genesis3d/src/Game/GMain.h.

#define SHREDDER_AMMO_AMOUNT   50
 

Definition at line 107 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerShredderAmmo().

#define SHREDDER_AMMO_RESPAWN   30.0f
 

Definition at line 103 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerShredderAmmo().

#define SHREDDER_AMOUNT   25
 

Definition at line 105 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerShredder().

#define SHREDDER_MAX_AMOUNT   200
 

Definition at line 106 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerShredderAmmo().

#define SHREDDER_RESPAWN   10.0f
 

Definition at line 102 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerShredder().

#define SOUND_INDEX_BLASTER   14
 

Definition at line 58 of file Genesis3d/src/Game/GMain.h.

Referenced by Attacker_Fire(), FireBlaster(), and SetupWorldCB().

#define SOUND_INDEX_BLASTER_BANG   15
 

Definition at line 59 of file Genesis3d/src/Game/GMain.h.

Referenced by Blaster_Control(), and SetupWorldCB().

#define SOUND_INDEX_DIE   9
 

Definition at line 53 of file Genesis3d/src/Game/GMain.h.

Referenced by KillPlayer(), and SetupWorldCB().

#define SOUND_INDEX_GRENADE   19
 

Definition at line 63 of file Genesis3d/src/Game/GMain.h.

Referenced by FireGrenade(), and SetupWorldCB().

#define SOUND_INDEX_HURT1   5
 

Definition at line 49 of file Genesis3d/src/Game/GMain.h.

Referenced by DammagePlayer(), and SetupWorldCB().

#define SOUND_INDEX_HURT2   6
 

Definition at line 50 of file Genesis3d/src/Game/GMain.h.

Referenced by SetupWorldCB().

#define SOUND_INDEX_HURT3   7
 

Definition at line 51 of file Genesis3d/src/Game/GMain.h.

Referenced by DammagePlayer(), and SetupWorldCB().

#define SOUND_INDEX_HURT4   8
 

Definition at line 52 of file Genesis3d/src/Game/GMain.h.

Referenced by SetupWorldCB().

#define SOUND_INDEX_ITEM_SPAWN   17
 

Definition at line 61 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_ControlArmor(), Item_ControlGrenade(), Item_ControlGrenadeAmmo(), Item_ControlHealth(), Item_ControlRocket(), Item_ControlRocketAmmo(), Item_ControlShredder(), Item_ControlShredderAmmo(), and SetupWorldCB().

#define SOUND_INDEX_JUMP   13
 

Definition at line 57 of file Genesis3d/src/Game/GMain.h.

Referenced by Client_Control(), and SetupWorldCB().

#define SOUND_INDEX_PICKUP_HEALTH   10
 

Definition at line 54 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerArmor(), Item_TriggerHealth(), and SetupWorldCB().

#define SOUND_INDEX_PICKUP_WEAPON1   11
 

Definition at line 55 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenade(), Item_TriggerGrenadeAmmo(), Item_TriggerRocket(), Item_TriggerRocketAmmo(), Item_TriggerShredderAmmo(), and SetupWorldCB().

#define SOUND_INDEX_PICKUP_WEAPON2   12
 

Definition at line 56 of file Genesis3d/src/Game/GMain.h.

Referenced by Item_TriggerGrenade(), Item_TriggerRocket(), Item_TriggerShredder(), and SetupWorldCB().

#define SOUND_INDEX_PLAYER_SPAWN   18
 

Definition at line 62 of file Genesis3d/src/Game/GMain.h.

Referenced by Bot_ActorDying(), Bot_Dying(), Player_Dying(), and SetupWorldCB().

#define SOUND_INDEX_SHREDDER   16
 

Definition at line 60 of file Genesis3d/src/Game/GMain.h.

Referenced by FireShredder(), and SetupWorldCB().

#define TEXTURE_INDEX_WEAPON2   0
 

Definition at line 66 of file Genesis3d/src/Game/GMain.h.

Referenced by Attacker_Fire(), FireBlaster(), and SetupWorldCB().


Function Documentation

geBoolean AnimatePlayer GenVSI VSI,
void *  PlayerData,
uint16  MotionIndex,
float  Speed,
geBoolean  Loop
 

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

References GPlayer::FrameTime, GE_FALSE, GE_TRUE, geBoolean, and GenVSI_GetPlayerTimeExtents().

Referenced by Attacker_ControlTurret(), Bot_ActorDying(), Bot_Animate(), Bot_Dying(), Client_Control(), and Player_Dying().

02205 {
02206         float           StartTime, EndTime, DeltaT;
02207         geBoolean       Looped;
02208         GPlayer         *Player;
02209 
02210         Player = (GPlayer*)PlayerData;
02211 
02212         Looped = GE_FALSE;
02213 
02214         GenVSI_GetPlayerTimeExtents(VSI, Player, MotionIndex, &StartTime, &EndTime);
02215 
02216         if (Speed > 0)
02217         {
02218                 Player->FrameTime += Speed;
02219 
02220                 DeltaT = EndTime - StartTime;
02221 
02222                 if (Player->FrameTime >= EndTime)
02223                 {
02224                         if (Loop)
02225                                 Player->FrameTime -= DeltaT;
02226                         else
02227                                 Player->FrameTime = EndTime;
02228                         Looped = GE_TRUE;
02229                 }
02230         }
02231         else if (Speed < 0)
02232         {
02233                 Player->FrameTime += Speed;
02234 
02235                 DeltaT = EndTime - StartTime;
02236 
02237                 if (Player->FrameTime <= StartTime)
02238                 {
02239                         if (Loop)
02240                                 Player->FrameTime += DeltaT;
02241                         else
02242                                 Player->FrameTime = StartTime;
02243                         Looped = GE_TRUE;
02244                 }
02245         }
02246 
02247         return Looped;
02248 }

geBoolean AnimatePlayer2 GenVSI VSI,
void *  PlayerData,
int32  MotionSlot,
float  Speed,
geBoolean  Loop
 

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

References GE_FALSE, GE_TRUE, geBoolean, GenVSI_GetPlayerTimeExtents(), GPlayer::MotionData, GPlayer_MotionData::MotionIndex, GPlayer_MotionData::MotionTime, and uint16.

Referenced by Attacker_ControlTurret().

02254 {
02255         float           StartTime, EndTime, DeltaT;
02256         geBoolean       Looped;
02257         GPlayer         *Player;
02258         uint16          MotionIndex;
02259         float           MotionTime;
02260 
02261         Player = (GPlayer*)PlayerData;
02262 
02263         assert(MotionSlot < Player->NumMotionData);
02264 
02265         Looped = GE_FALSE;
02266 
02267         MotionIndex = Player->MotionData[MotionSlot].MotionIndex;
02268         MotionTime = Player->MotionData[MotionSlot].MotionTime;
02269 
02270         GenVSI_GetPlayerTimeExtents(VSI, Player, MotionIndex, &StartTime, &EndTime);
02271 
02272         if (Speed > 0)
02273         {
02274                 MotionTime += Speed;
02275 
02276                 DeltaT = EndTime - StartTime;
02277 
02278                 if (MotionTime >= EndTime)
02279                 {
02280                         if (Loop)
02281                                 MotionTime -= DeltaT;
02282                         else
02283                                 MotionTime = EndTime;
02284                         Looped = GE_TRUE;
02285                 }
02286         }
02287         else if (Speed < 0)
02288         {
02289                 MotionTime += Speed;
02290 
02291                 DeltaT = EndTime - StartTime;
02292 
02293                 if (MotionTime <= StartTime)
02294                 {
02295                         if (Loop)
02296                                 MotionTime += DeltaT;
02297                         else
02298                                 MotionTime = StartTime;
02299                         Looped = GE_TRUE;
02300                 }
02301         }
02302 
02303         Player->MotionData[MotionSlot].MotionTime = MotionTime;
02304 
02305         return Looped;
02306 }

void Attacker_Fire GenVSI VSI,
GPlayer Player,
GPlayer Target,
float  Time
 

Definition at line 249 of file Attacker.c.

References Blaster_Control(), GPlayer::Blocked, GPlayer::Control, GPlayer::ControlIndex, FX_PARTICLE_TRAIL, GPlayer::FxFlags, GenVSI_PlaySound(), GenVSI_SpawnPlayer(), NULL, GPlayer::Owner, GPlayer::PingTime, GPlayer::Scale, SOUND_INDEX_BLASTER, TEXTURE_INDEX_WEAPON2, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_LIGHT, VIEW_TYPE_SPRITE, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, GPlayer::XForm, and XFormFromVector().

Referenced by Attacker_ControlTurret().

00250 {
00251         GPlayer                 *Weapon;
00252 
00253         Weapon = GenVSI_SpawnPlayer(VSI, "Attacker_Fire");
00254 
00255         if (!Weapon)
00256         {
00257                 return;
00258         }
00259 
00260         // Setup the callbacks for this weapon
00261         Weapon->Control = Blaster_Control;
00262         Weapon->Blocked = NULL;
00263         Weapon->Trigger = NULL;
00264         Weapon->Owner = Player;
00265         Weapon->Time = 0.0f;
00266         Weapon->PingTime = Player->PingTime;
00267 
00268         Weapon->ControlIndex = 5;
00269 
00270         Weapon->ViewFlags = (VIEW_TYPE_SPRITE | VIEW_TYPE_LIGHT);
00271         Weapon->ViewIndex = TEXTURE_INDEX_WEAPON2;
00272         Weapon->Scale = 1.0f;
00273         Weapon->FxFlags = FX_PARTICLE_TRAIL;            // Make some particles follow Weapon_Blaster
00274 
00275         XFormFromVector(&Player->XForm.Translation, &Target->XForm.Translation, 0.0f, &Weapon->XForm);
00276 
00277         // Play the "take off" sound
00278         GenVSI_PlaySound(VSI, SOUND_INDEX_BLASTER, &Player->XForm.Translation);
00279 
00280         Weapon->VPos = Player->XForm.Translation;
00281 }

void Attacker_TurretDestroy GenVSI VSI,
void *  PlayerData,
void *  ClassData
 

Definition at line 235 of file Attacker.c.

References geRam_Free, and GPlayer::userData.

Referenced by Server_Main().

00236 {
00237         GPlayer                 *Player;
00238 
00239         Player = (GPlayer*)PlayerData;
00240 
00241         if (Player->userData)
00242                 geRam_Free(Player->userData);
00243 
00244 }

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

Definition at line 166 of file Attacker.c.

References ACTOR_INDEX_TURRET, ACTOR_MOTION_T1, ACTOR_MOTION_T2, Attacker_ControlTurret(), GPlayer_XFormData::BoneIndex, GPlayer::Control, GE_FALSE, GE_RAM_ALLOCATE_STRUCT, GE_TRUE, geBoolean, GenVS_Error(), geVec3d_Set(), geXForm3d_SetIdentity(), geXForm3d_SetTranslation(), Turret_Data::LookPos, GPlayer::Maxs, GPlayer::Mins, GPlayer::MotionData, GPlayer_MotionData::MotionIndex, GPlayer::MotionIndex, GPlayer_MotionData::MotionTime, NULL, GPlayer::NumMotionData, GPlayer::NumXFormData, AttackerTurret::Origin, PSTATE_LookLeft, GPlayer::Scale, GPlayer::State, GPlayer::Time, geXForm3d::Translation, GPlayer::userData, VIEW_TYPE_ACTOR, VIEW_TYPE_HACK, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer_XFormData::XForm, GPlayer::XForm, GPlayer::XFormData, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00167 {
00168         AttackerTurret  *Turret;
00169         GPlayer                 *Player;
00170         Turret_Data             *TData;
00171 
00172         Player = (GPlayer*)PlayerData;
00173 
00174         Player->Time = 0.0f;
00175         Player->Control = Attacker_ControlTurret;
00176 
00177         if (ClassData == NULL)
00178                 {
00179                         GenVS_Error("Attacker_TurrentSpawn: entity missing class data ('%s')\n",EntityName);
00180                 }
00181 
00182         Turret = (AttackerTurret*)ClassData;
00183 
00184         geXForm3d_SetIdentity(&Player->XForm);
00185         geXForm3d_SetTranslation(&Player->XForm, Turret->Origin.X, Turret->Origin.Y, Turret->Origin.Z);
00186 
00187         Player->VPos = Player->XForm.Translation;
00188         
00189         geVec3d_Set(&Player->Mins, -50.0f, -50.0f, -50.0f);
00190         geVec3d_Set(&Player->Maxs,  50.0f,  50.0f,  50.0f);
00191 
00192         Player->Scale = 0.4f;
00193         Player->State = PSTATE_LookLeft;
00194 
00195         // Set the view info
00196         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_HACK;
00197         Player->ViewIndex = ACTOR_INDEX_TURRET;
00198         Player->MotionIndex = ACTOR_MOTION_T1;
00199 
00200         // Setup hacked extra bone stuff
00201         Player->NumXFormData = 2;
00202 
00203         Player->XFormData[0].XForm = Player->XForm;
00204         Player->XFormData[0].BoneIndex = 0;
00205 
00206         Player->XFormData[1].XForm = Player->XForm;
00207         Player->XFormData[1].BoneIndex = 1;
00208 
00209         // Setup motions
00210         Player->NumMotionData = 2;
00211 
00212         Player->MotionData[0].MotionTime = 0.0f;
00213         Player->MotionData[0].MotionIndex = ACTOR_MOTION_T1;
00214 
00215         Player->MotionData[1].MotionTime = 0.0f;
00216         Player->MotionData[1].MotionIndex = ACTOR_MOTION_T2;
00217 
00218         TData = GE_RAM_ALLOCATE_STRUCT(Turret_Data);
00219 
00220         if (!TData)
00221                 return GE_FALSE;
00222 
00223         memset(TData, 0, sizeof(Turret_Data));
00224 
00225         TData->LookPos = Player->XForm.Translation;
00226         TData->LookPos.Z += 40.0f;
00227 
00228         Player->userData = TData;
00229 
00230         return GE_TRUE;
00231 }

geBoolean Blaster_Control GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 821 of file Weapons.c.

References GE_Collision::Actor, BLASTER_POWER, BLASTER_POWER_RADIUS, BLASTER_RADIUS, DammagePlayer(), FX_EXPLODE2, GE_COLLIDE_ACTORS, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_TRUE, geBoolean, GenVSI_ActorToPlayer(), GenVSI_DestroyPlayer(), GenVSI_GetWorld(), GenVSI_SpawnFx(), geVec3d_AddScaled(), geVec3d_Scale(), geWorld_Collision(), geWorld_ModelGetUserData(), geXForm3d_Copy(), geXForm3d_GetIn(), geXForm3d_Translate(), GE_Collision::Impact, GE_Collision::Model, GE_Plane::Normal, NULL, GPlayer::Owner, GE_Collision::Plane, CData::Player, RadiusDammage(), SelfCollisionCB(), SOUND_INDEX_BLASTER_BANG, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, GPlayer::Velocity, VIEW_TYPE_PHYSOB, GPlayer::ViewFlags, GPlayer::VPos, CData::VSI, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Attacker_Fire(), Client_Main(), FireBlaster(), and Server_Main().

00822 {
00823         geVec3d                 In, Front, Back;
00824         geXForm3d               DestXForm;
00825         GE_Collision    Collide;
00826         float                   Speed;
00827         GPlayer                 *Player;
00828         geWorld                 *World;
00829         CData                   Data;
00830 
00831         Player = (GPlayer*)PlayerData;
00832 
00833         Player->Time += Time;
00834         
00835         Speed = Player->Time*3600.0f;
00836 
00837         if (Speed > 4000.0f)
00838                 Speed = 4000.0f;
00839 
00840         geXForm3d_Copy(&Player->XForm, &DestXForm);
00841 
00842         geXForm3d_GetIn(&Player->XForm, &In);
00843         geVec3d_Scale(&In, Speed*Time, &In);    
00844         geXForm3d_Translate(&DestXForm, In.X, In.Y, In.Z);
00845 
00846         geXForm3d_GetIn(&Player->XForm, &In);
00847         geVec3d_Scale(&In, 500.f, &Player->Velocity);
00848 
00849         Front = Player->XForm.Translation;
00850         Back = DestXForm.Translation;
00851 
00852         geXForm3d_Copy(&DestXForm, &Player->XForm);
00853 
00854         World = GenVSI_GetWorld(VSI);
00855 
00856         assert(World);
00857 
00858         Data.VSI = VSI;
00859         Data.Player = Player;
00860 
00861         if (geWorld_Collision(World, NULL, NULL, &Front, &Back, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS|GE_COLLIDE_ACTORS, 0xffffffff, SelfCollisionCB, &Data, &Collide))
00862         {
00863                 Player->XForm.Translation = Collide.Impact;
00864                 geVec3d_AddScaled(&Player->XForm.Translation, &Collide.Plane.Normal, 40.0f, &Player->XForm.Translation);
00865 
00866                 if (Collide.Model)
00867                 {
00868                         GPlayer         *Target;
00869 
00870                         Target = (GPlayer*)geWorld_ModelGetUserData(Collide.Model);
00871                         if (Target && Target->Trigger && Target->ViewFlags & VIEW_TYPE_PHYSOB)
00872                         {                               
00873                                 Target->Trigger(VSI, Target, Player, (void*)&Collide);
00874                         }
00875                 }
00876 
00877                 //if (VSI->Mode == MODE_Server)
00878                 {
00879                         if (Collide.Actor)
00880                         {
00881                                 GPlayer         *PlayerHit;
00882                                 PlayerHit = GenVSI_ActorToPlayer(VSI, Collide.Actor);
00883 
00884                                 // Only radius dammage will hurt the player that shot the rocket...
00885                                 if (PlayerHit && PlayerHit != Player->Owner)    
00886                                         DammagePlayer(VSI, Player, PlayerHit, 15, BLASTER_POWER,Time);
00887                         }
00888                         else
00889                                 RadiusDammage(VSI, Player, 10, BLASTER_POWER_RADIUS, BLASTER_RADIUS, Time);
00890                 }
00891 
00892                 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_BLASTER_BANG);
00893                 GenVSI_DestroyPlayer(VSI, PlayerData);
00894         }
00895         
00896         //if (Player->Time >= 25.0f)                            // Kill it after 20 seconds
00897         //      GenVSI_DestroyPlayer(VSI, PlayerData);
00898 
00899         Player->VPos = Player->XForm.Translation;
00900 
00901         return GE_TRUE;
00902 }

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 CheckVelocity GenVSI VSI,
void *  PlayerData,
float  BounceScale,
geBoolean  AllowBounce,
float  Time
 

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

References GE_Collision::Actor, ForceField::affectsPlayers, GE_Contents::Contents, GE_Plane::Dist, FALLOFF_NONE, FALLOFF_ONE_OVER_D, FALLOFF_ONE_OVER_DSQUARED, ForceField::falloffType, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_CONTENTS_SOLID, GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), GenVSI_ConsolePrintf(), GenVSI_GetWorld(), geVec3d_Add(), geVec3d_AddScaled(), geVec3d_Clear(), geVec3d_Copy(), geVec3d_CrossProduct(), geVec3d_DotProduct(), geVec3d_Length(), geVec3d_Normalize(), geVec3d_Scale(), geVec3d_Subtract(), geWorld_Collision(), geWorld_GetContents(), geWorld_GetEntitySet(), geWorld_ModelGetUserData(), GE_Collision::Impact, int32, GPlayer::LastGoodPos, MAX_CLIP_PLANES, GPlayer::Maxs, GPlayer::Mins, GE_Collision::Model, MovePlayerUpStep(), GE_Plane::Normal, NULL, ForceField::Origin, GE_Collision::Plane, PSTATE_Dead, PSTATE_DeadOnGround, PSTATE_InAir, PSTATE_Normal, ForceField::radius, GE_Collision::Ratio, ReflectVelocity(), GPlayer::State, ForceField::strength, geXForm3d::Translation, GPlayer::Trigger, uint32, GPlayer::Velocity, VIEW_TYPE_PHYSOB, VIEW_TYPE_STANDON, GPlayer::ViewFlags, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by PlayerPhysics().

00447 {
00448         int32                   NumHits, NumPlanes;
00449         GE_Collision    Collision;
00450         int32                   HitCount, i, j;
00451         geVec3d                 Mins, Maxs;
00452         geVec3d                 Planes[MAX_CLIP_PLANES];
00453         geVec3d                 Pos, NewPos, OriginalVelocity, PrimalVelocity;
00454         geVec3d                 NewVelocity, Dir;
00455         float                   TimeLeft, Dist;
00456         GE_Contents             Contents;
00457         GPlayer                 *Player;
00458         geWorld                 *World;
00459         uint32                  ColFlags;
00460 
00461 #if 0
00462         geEntity_EntitySet *    Set;
00463         geEntity *                              Entity;
00464         geVec3d boundingBoxCenter,
00465                                         boundingBoxScale,
00466                                         forceFieldCenterToBBCenter;
00467 #endif
00468 
00469         // end VAR section
00471         // BEGIN
00472 
00473         Player = (GPlayer*)PlayerData;
00474 
00475         World = GenVSI_GetWorld(VSI);
00476 
00477         assert(World);
00478 
00479         Mins = Player->Mins;
00480         Maxs = Player->Maxs;
00481 
00482         geVec3d_Copy(&Player->Velocity, &OriginalVelocity);
00483         geVec3d_Copy(&Player->Velocity, &PrimalVelocity);
00484 
00485         TimeLeft = Time;
00486         
00487         NumHits = 4;
00488         NumPlanes = 0;
00489 
00490         if (Player->State == PSTATE_Normal)     
00491                 Player->State = PSTATE_InAir;   
00492 
00493         ColFlags = GE_COLLIDE_MODELS;
00494 
00496         // check for penetration of Player's bounding box into the radius of a ForceField entity
00497         #if 0
00498         geVec3d_Copy(&Player->XForm.Translation, &boundingBoxCenter);
00499 
00500         boundingBoxScale.X = (float)fabs(0.5f * (Maxs.X - Mins.X));
00501         boundingBoxScale.Y = (float)fabs(0.5f * (Maxs.Y - Mins.Y));
00502         boundingBoxScale.Z = (float)fabs(0.5f * (Maxs.Z - Mins.Z));
00503 
00504         #pragma message ("Use: GenVSI_GetNextPlayer here...")
00505         Set = NULL;
00506         Set = geWorld_GetEntitySet(World, "ForceField");
00507         if (Set != NULL)
00508         {
00509                 for     (Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00510                                  Entity != NULL;
00511                                  Entity = geEntity_EntitySetGetNextEntity(Set, Entity))
00512                 {
00513                         ForceField* ff;
00514                         float forceMultiplier;
00515                         float distToFFCenter;
00516                         float forceMagnitude;
00517                         geVec3d forceDir;
00518                         geVec3d forceToApply;
00519                         geVec3d impulse;
00520 
00521                         ff = geEntity_GetUserData(Entity);
00522                         assert(ff != NULL);
00523 
00524                         if (! ff->affectsPlayers) 
00525                                 continue;                               
00526                         
00527                         geVec3d_Subtract(&boundingBoxCenter, &ff->Origin, &forceFieldCenterToBBCenter);
00528                         geVec3d_Copy(&forceFieldCenterToBBCenter, &forceDir);
00529                         #pragma message("does geVec3d_Normalize() return length?")
00530                         geVec3d_Normalize(&forceDir);
00531 
00532                         distToFFCenter = geVec3d_Length(&forceFieldCenterToBBCenter);
00533                         if (distToFFCenter < 1.f)
00534                                 distToFFCenter = 1.f;
00535 
00536                         if ((boundingBoxCenter.X + boundingBoxScale.X) < (ff->Origin.X - ff->radius)) continue;
00537                         if ((boundingBoxCenter.X - boundingBoxScale.X) > (ff->Origin.X + ff->radius)) continue;
00538                         if ((boundingBoxCenter.Y + boundingBoxScale.Y) < (ff->Origin.Y - ff->radius)) continue;
00539                         if ((boundingBoxCenter.Y - boundingBoxScale.Y) > (ff->Origin.Y + ff->radius)) continue;
00540                         if ((boundingBoxCenter.Z + boundingBoxScale.Z) < (ff->Origin.Z - ff->radius)) continue;
00541                         if ((boundingBoxCenter.Z - boundingBoxScale.Z) > (ff->Origin.Z + ff->radius)) continue;
00542 
00544                         // player is inside radius of force field, figure out how much force
00545                         // to apply based on force field's falloff function
00546 
00547                         switch(ff->falloffType)
00548                         {
00549                                 case FALLOFF_NONE:
00550                                         forceMultiplier = 1.f;
00551                                         break;
00552                                 case FALLOFF_ONE_OVER_D:                                        
00553                                         forceMultiplier = 1 / distToFFCenter;
00554                                         break;
00555                                 case FALLOFF_ONE_OVER_DSQUARED:
00556                                         forceMultiplier = 1 / (distToFFCenter * distToFFCenter);
00557                                         break;
00558                                 default:
00559                                         forceMultiplier = 1.f;
00560                         }
00561 
00562                         forceMagnitude = ff->strength * forceMultiplier * 1000.f;
00563 
00564                         geVec3d_Scale(&forceDir, forceMagnitude, &forceToApply);
00565 
00566                         geVec3d_Scale(&forceToApply, Time, &impulse);
00567                         geVec3d_Add(&impulse, &Player->Velocity, &Player->Velocity);
00568                 } // while
00569         } // if
00570         #endif
00571 
00572 
00573         for (HitCount=0 ; HitCount<NumHits ; HitCount++)
00574         {
00575                 float   Fd, Bd;
00576                 //Server_Player *UPlayer;
00577 
00578                 Pos = Player->XForm.Translation;
00579                 geVec3d_AddScaled(&Pos, &Player->Velocity, TimeLeft, &NewPos);
00580 
00581                 // Make sure the pos did not start out in solid
00582                 if (geWorld_GetContents(World, &Pos, &Mins, &Maxs, GE_COLLIDE_MODELS, 0, NULL, NULL, &Contents))
00583                 {
00584                         if (Contents.Contents & GE_CONTENTS_SOLID)
00585                         {
00586                                 if (geWorld_GetContents(World, &NewPos, &Mins, &Maxs, GE_COLLIDE_MODELS, 0, NULL, NULL, &Contents))
00587                                 {
00588                                         if (Contents.Contents & GE_CONTENTS_SOLID)
00589                                         {
00590                                                 geVec3d_Copy(&Player->LastGoodPos, &Player->XForm.Translation);
00591                                                 geVec3d_Clear(&Player->Velocity);
00592                                                 return GE_TRUE;
00593                                         }
00594                                 }
00595                         }
00596                 }
00597                 
00598                 if (!geWorld_Collision(World, &Mins, &Maxs, &Pos, &NewPos, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS, 0, NULL, NULL, &Collision))
00599                         return GE_TRUE;         // Covered the entire distance...
00600 
00601                 if (Collision.Plane.Normal.Y > 0.7f)
00602                 {
00603                         if (Player->State == PSTATE_InAir)
00604                                 Player->State = PSTATE_Normal;                  // Put the player on the ground if in air
00605                         else if (Player->State == PSTATE_Dead)
00606                                 Player->State = PSTATE_DeadOnGround;    // Put the player on the ground if in air
00607 
00608                         if (Collision.Model)
00609                         {
00610                                 GPlayer         *Target;
00611                                 Target = (GPlayer*)geWorld_ModelGetUserData(Collision.Model);
00612                                 if (Target && Target->Trigger && Target->ViewFlags & VIEW_TYPE_STANDON)
00613                                         Target->Trigger(VSI, Target, Player, NULL);
00614                         }
00615                 }
00616 
00617                 if (Collision.Model)
00618                 {
00619                         GPlayer         *Target;
00620                         #pragma message ("Use: GenVSI_ModelToPlayer...")
00621                         Target = (GPlayer*)geWorld_ModelGetUserData(Collision.Model);
00622                         if (Target && Target->Trigger && Target->ViewFlags & VIEW_TYPE_PHYSOB)
00623                                 Target->Trigger(VSI, Target, Player, (void*)&Collision);
00624                 }
00625                 
00626                 if (Collision.Actor)            // Just stop at actors for now...
00627                 {
00628                         geVec3d_Copy(&Player->LastGoodPos, &Player->XForm.Translation);
00629                         geVec3d_Clear(&Player->Velocity);
00630                         return GE_TRUE;
00631                 }
00632 
00633                 // FIXME:  Save this ratio in the impact function...
00634                 Fd = geVec3d_DotProduct(&Pos, &Collision.Plane.Normal) - Collision.Plane.Dist;
00635                 Bd = geVec3d_DotProduct(&NewPos, &Collision.Plane.Normal) - Collision.Plane.Dist;
00636 
00637                 Collision.Ratio = Fd / (Fd - Bd);
00638                 
00639                 if (Collision.Ratio > 0.00f)    // Actually covered some distance
00640                 {       
00641                         // Set the players pos to the impact point
00642                         geVec3d_Copy(&Collision.Impact, &Player->XForm.Translation);
00643                         // Restore Velocity
00644                         geVec3d_Copy(&Player->Velocity, &OriginalVelocity);
00645                         NumPlanes = 0;
00646                 }
00647                 
00648                 if (!Collision.Plane.Normal.Y)
00649                 {
00650                         if (MovePlayerUpStep(VSI, Player, &Collision))
00651                         {
00652                                 continue;
00653                         }
00654                 }
00655 
00656                 //TimeLeft -= TimeLeft * Collision.Ratio;
00657                 
00658                 // Clipped to another plane
00659                 if (NumPlanes >= MAX_CLIP_PLANES)
00660                 {       
00661                         GenVSI_ConsolePrintf(VSI, "MAX_CLIP_PLANES!!!\n");
00662                         geVec3d_Clear(&Player->Velocity);
00663                         return GE_TRUE;
00664                 }
00665 
00666                 // Add the plane hit, to the plane list
00667                 geVec3d_Copy (&Collision.Plane.Normal, &Planes[NumPlanes]);
00668                 NumPlanes++;
00669 
00670                 //
00671                 // Modify original_velocity so it parallels all of the clip planes
00672                 //
00673                 for (i=0 ; i<NumPlanes ; i++)
00674                 {
00675                         ReflectVelocity(&OriginalVelocity, &Planes[i], &NewVelocity, BounceScale);
00676 
00677                         for (j=0 ; j<NumPlanes ; j++)
00678                         {
00679                                 if (j != i)
00680                                 {
00681                                         if (geVec3d_DotProduct(&NewVelocity, &Planes[j]) < 0.0f)
00682                                                 break;  // not ok
00683                                 }
00684                         }
00685                         if (j == NumPlanes)
00686                                 break;
00687                 }
00688                 
00689                 if (i != NumPlanes)
00690                 {       // Go along this plane
00691                         geVec3d_Copy(&NewVelocity, &Player->Velocity);
00692                 }
00693                 else
00694                 {       
00695                         if (NumPlanes != 2)
00696                         {
00697                                 //Console_Printf(Server->Host->Console, "Clip velocity, numplanes == %i\n",NumPlanes);
00698                                 geVec3d_Clear(&Player->Velocity);
00699                                 return GE_TRUE;
00700                         }
00701                         
00702                         //Console_Printf(Server->Host->Console, "Cross product\n",NumPlanes);
00703                         geVec3d_CrossProduct(&Planes[0], &Planes[1], &Dir);
00704                         Dist = geVec3d_DotProduct(&Dir, &Player->Velocity);
00705                         geVec3d_Scale(&Dir, Dist, &Player->Velocity);
00706                 }
00707 
00708                 //
00709                 //      Don't allow new velocity to go against original velocity unless told otherwise
00710                 //
00711                 if (!AllowBounce && geVec3d_DotProduct (&Player->Velocity, &PrimalVelocity) <= 0.0f)
00712                 {
00713                         geVec3d_Clear(&Player->Velocity);
00714                         return GE_TRUE;
00715                 }
00716         }
00717         return GE_TRUE;                                                                 
00718 }

void ClampVector geVec3d Vect,
float  Epsilon
 

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

References geVec3d::X, geVec3d::Y, and geVec3d::Z.

02072 {
02073         if (Vect->X > Epsilon)
02074                 Vect->X = Epsilon;
02075         if (Vect->Y > Epsilon)
02076                 Vect->Y = Epsilon;
02077         if (Vect->Z > Epsilon)
02078                 Vect->Z = Epsilon;
02079 
02080         if (Vect->X < -Epsilon)
02081                 Vect->X = -Epsilon;
02082         if (Vect->Y < -Epsilon)
02083                 Vect->Y = -Epsilon;
02084         if (Vect->Z < -Epsilon)
02085                 Vect->Z = -Epsilon;
02086 }

geBoolean DammagePlayer GenVSI VSI,
void *  PlayerData,
void *  TargetData,
int32  Amount,
float  Power,
float  Time
 

Definition at line 284 of file Weapons.c.

References ACTOR_MOTION_PLAYER_HIT, CLIENT_NULL_HANDLE, GPlayer::ClientHandle, GPlayer::DammageFlags, GPlayer::FrameTime, GE_FALSE, GE_TRUE, geBoolean, GenVSI_IsClientBot(), GenVSI_PlaySound(), GenVSI_SetClientHealth(), geVec3d_AddScaled(), geVec3d_Normalize(), geVec3d_Subtract(), GodMode, GPlayer::Health, int32, GPlayer::Inventory, ITEM_ARMOR, KillPlayer(), MAX_ARMOR, MAX_ARMOR_PROTECTION, GenVSI::Mode, MODE_Server, GPlayer::MotionIndex, GPlayer::Owner, PSTATE_Dead, PSTATE_DeadOnGround, SOUND_INDEX_HURT1, SOUND_INDEX_HURT3, GPlayer::State, geXForm3d::Translation, uint16, UpdateClientInventory(), GPlayer::Velocity, GPlayer::XForm, and geVec3d::Y.

Referenced by Blaster_Control(), Bot_GetContents(), Bot_SuicideTest(), Client_Control(), FireShredder(), Grenade_Control(), RadiusDammage(), and Rocket_Control().

00285 {
00286         geVec3d         Vect, Pos;
00287         int32           DammageSound;
00288         GPlayer         *Player, *Target;
00289         float           Amountf, ArmorRatio;
00290         extern geBoolean GodMode;
00291 
00292         Player = (GPlayer*)PlayerData;
00293         Target = (GPlayer*)TargetData;
00294 
00295         if (VSI->Mode != MODE_Server)
00296                 return GE_TRUE;
00297 
00298         //if (Target->Dead)
00299         //      return GE_TRUE;
00300         if (Target->State == PSTATE_Dead)                               // Ignore dead players...
00301                 return GE_TRUE;
00302         if (Target->State == PSTATE_DeadOnGround)               // Ignore dead players...
00303                 return GE_TRUE;
00304 
00305         if (Target->DammageFlags == 0)
00306                 return GE_TRUE;
00307         //if (Target->ClientHandle == CLIENT_NULL_HANDLE)                       // For now, only hurt client players for deathmatch...
00308         //      return GE_TRUE;
00309 
00310         Amountf = (float)Amount;
00311 
00312         // Dammage -= ((Armor/MAX_ARMOR)*0.5)*Dammaga
00313         ArmorRatio = (float)Target->Inventory[ITEM_ARMOR] / (float)MAX_ARMOR;
00314         Amountf -= (ArmorRatio * MAX_ARMOR_PROTECTION) * Amountf;
00315 
00316         if (Amountf < 0.0f)
00317                 Amountf = 0.0f;
00318 
00319         Target->Inventory[ITEM_ARMOR] -= Amount;
00320 
00321         if (Target->Inventory[ITEM_ARMOR] < 0)
00322                 Target->Inventory[ITEM_ARMOR] = 0;
00323 
00324         // Actors don't have a client handle
00325         if (Target->ClientHandle != CLIENT_NULL_HANDLE)         
00326                 UpdateClientInventory(VSI, Target, ITEM_ARMOR);
00327 
00328         // debug godmode
00329         if (!GodMode || GenVSI_IsClientBot(VSI, Target->ClientHandle))
00330                 Target->Health -= (int32)Amountf;
00331         else
00332                 return GE_FALSE;
00333 
00334         if (Player)
00335         {
00336                 if (Player->Owner == Target)    // Don't hurt ourselves as much
00337                         Amountf *= 0.5f;
00338 
00339                 // Knock the target opposite of the player hitting the target
00340                 Pos = Target->XForm.Translation;
00341                 Pos.Y += 100.0f;
00342                 geVec3d_Subtract(&Pos, &Player->XForm.Translation, &Vect);
00343                 geVec3d_Normalize(&Vect);
00344         
00345                 geVec3d_AddScaled(&Target->Velocity, &Vect, Power, &Target->Velocity);
00346         }
00347 
00348         if (Target->Health <= 0)
00349         {
00350                 if (!KillPlayer(VSI, Player, Target, Time))
00351                         return GE_FALSE;
00352         }
00353 
00354         // Actors don't have a client handle
00355         if (Target->ClientHandle != CLIENT_NULL_HANDLE)         
00356                 GenVSI_SetClientHealth(VSI, Target->ClientHandle, Target->Health);
00357 
00358         Target->MotionIndex = ACTOR_MOTION_PLAYER_HIT;
00359         Target->FrameTime = 0.0f;
00360 
00361         if      ((rand() % 100) > 90)
00362                 DammageSound = (rand()%2) + SOUND_INDEX_HURT3;
00363         else
00364                 DammageSound = (rand()%2) + SOUND_INDEX_HURT1;
00365 
00366         GenVSI_PlaySound(VSI, (uint16)DammageSound, &Target->XForm.Translation);
00367 
00368         return GE_TRUE;
00369 }

void FireGrenade GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 543 of file Weapons.c.

References ACTOR_INDEX_GRENADE_AMMO, GPlayer::Blocked, GPlayer::Control, GPlayer::ControlIndex, FX_SMOKE_TRAIL, GPlayer::FxFlags, GenVSI_ConsolePrintf(), GenVSI_GetTime(), GenVSI_PlaySound(), GenVSI_SpawnPlayer(), geVec3d_Add(), geVec3d_Scale(), geVec3d_Set(), geXForm3d_GetIn(), Grenade_Control(), GPlayer::GunOffset, GPlayer::Inventory, GPlayer::InventoryHas, ITEM_GRENADES, GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, GPlayer::NextWeaponTime, NULL, GPlayer::Owner, GPlayer::PingTime, GPlayer::Scale, SOUND_INDEX_GRENADE, SwitchToNextBestWeapon(), GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, GPlayer::Velocity, VIEW_TYPE_ACTOR, VIEW_TYPE_COLLIDEMODEL, VIEW_TYPE_LIGHT, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, GPlayer::XForm, and geVec3d::Y.

Referenced by Bot_FireWeapon(), and FireWeapon().

00544 {
00545         GPlayer                 *Weapon;
00546         geVec3d                 In;
00547         GPlayer                 *Player;
00548 
00549         Player = (GPlayer*)PlayerData;
00550         
00551         if (!Player->Inventory[ITEM_GRENADES] || !Player->InventoryHas[ITEM_GRENADES])
00552         {
00553                 SwitchToNextBestWeapon(VSI, Player);
00554                 return;
00555         }
00556         
00557         Weapon = (GPlayer*)GenVSI_SpawnPlayer(VSI, "Weapon_Grenade");
00558 
00559         if (!Weapon)
00560         {
00561                 GenVSI_ConsolePrintf(VSI, "FireGrenade:  Failed to spawn player.\n");
00562                 return;
00563         }
00564 
00565         Player->Inventory[ITEM_GRENADES]--;
00566         
00567         if (Player->Inventory[ITEM_GRENADES] < 0)
00568         {
00569                 SwitchToNextBestWeapon(VSI, Player);
00570                 Player->Inventory[ITEM_GRENADES] = 0;
00571         }
00572         
00573         //UpdateClientInventory(VSI, Player, ITEM_GRENADES);
00574 
00575         // Setup the callbacks for this weapon
00576         Weapon->Control = Grenade_Control;
00577         Weapon->Blocked = NULL;
00578         Weapon->Trigger = NULL;
00579         Weapon->Time = 0.0f;
00580         Weapon->Owner = Player;
00581         Weapon->PingTime = Player->PingTime;
00582 
00583         Weapon->ControlIndex = 7;
00584 
00585         Weapon->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_LIGHT | VIEW_TYPE_COLLIDEMODEL;
00586         Weapon->ViewIndex = ACTOR_INDEX_GRENADE_AMMO;
00587         Weapon->FxFlags = FX_SMOKE_TRAIL;
00588         Weapon->Scale = 1.0f;
00589         Weapon->MotionIndex = MOTION_INDEX_NONE;
00590         
00591         geVec3d_Set(&Weapon->Mins, -10.0f, -10.0f, -10.0f);
00592         geVec3d_Set(&Weapon->Maxs,  10.0f,  10.0f,  10.0f);
00593 
00594         Weapon->XForm = Player->XForm;
00595 
00596         geVec3d_Add(&Weapon->XForm.Translation, &Player->GunOffset, &Weapon->XForm.Translation);
00597 
00598         Weapon->XForm.Translation.Y -= 30.0f;
00599 
00600         geXForm3d_GetIn(&Weapon->XForm, &In);
00601 
00602         In.Y += 0.2f;
00603         geVec3d_Scale(&In, 1100.0f, &Weapon->Velocity);
00604 
00605         GenVSI_PlaySound(VSI, SOUND_INDEX_GRENADE, &Player->XForm.Translation);
00606 
00607         Player->NextWeaponTime = GenVSI_GetTime(VSI) + 0.5f;
00608         //Player->NextThinkTime = Server->Host->Time+0.5f;              // 0.5 sec between firing...
00609 
00610         Player->VPos = Player->XForm.Translation;
00611 }

void FireRocket GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 712 of file Weapons.c.

References ACTOR_INDEX_ROCKET_AMMO, GPlayer::Blocked, GPlayer::Control, GPlayer::ControlIndex, FX_SMOKE_TRAIL, GPlayer::FxFlags, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GenVSI_ConsolePrintf(), GenVSI_GetTime(), GenVSI_GetWorld(), GenVSI_PlaySound(), GenVSI_SpawnPlayer(), geQuaternion_SetFromAxisAngle(), geQuaternion_ToMatrix(), geVec3d_Add(), geVec3d_AddScaled(), geVec3d_Set(), geWorld_Collision(), geXForm3d_GetIn(), geXForm3d_GetLeft(), geXForm3d_GetUp(), geXForm3d_Multiply(), GPlayer::GunOffset, GE_Collision::Impact, GPlayer::Inventory, GPlayer::InventoryHas, ITEM_ROCKETS, GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, GPlayer::NextWeaponTime, NULL, GPlayer::Owner, GPlayer::PingTime, CData::Player, Rocket_Control(), GPlayer::Scale, SelfCollisionCB(), SwitchToNextBestWeapon(), GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_LIGHT, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, CData::VSI, geVec3d::X, GPlayer::XForm, XFormFromVector(), geVec3d::Y, and geVec3d::Z.

Referenced by Bot_FireWeapon(), and FireWeapon().

00713 {
00714         GPlayer                 *Weapon;
00715         geVec3d                 Up, In, Rt, Front, Back, Impact;
00716         geQuaternion    Quat;
00717         geXForm3d               RotXForm;
00718         GE_Collision    Collision;
00719         geWorld                 *World;
00720         GPlayer                 *Player;
00721         CData                   Data;
00722 
00723         Player = (GPlayer*)PlayerData;
00724         
00725         if (Player->Inventory[ITEM_ROCKETS] <= 0 || !Player->InventoryHas[ITEM_ROCKETS])
00726         {
00727                 SwitchToNextBestWeapon(VSI, Player);
00728                 return;
00729         }
00730         
00731         Weapon = GenVSI_SpawnPlayer(VSI, "Weapon_Rocket");
00732 
00733         if (!Weapon)
00734         {
00735                 GenVSI_ConsolePrintf(VSI, "FireRocket:  Failed to add player.\n");
00736                 return;
00737         }
00738 
00739         Player->Inventory[ITEM_ROCKETS]--;
00740         
00741         if (Player->Inventory[ITEM_ROCKETS] < 0)
00742         {
00743                 SwitchToNextBestWeapon(VSI, Player);
00744                 Player->Inventory[ITEM_ROCKETS] = 0;
00745         }
00746         
00747         //UpdateClientInventory(VSI, Player, ITEM_ROCKETS);
00748 
00749         // Setup the callbacks for this weapon
00750         Weapon->Control = Rocket_Control;
00751         Weapon->Blocked = NULL;
00752         Weapon->Trigger = NULL;
00753         Weapon->Owner = Player;
00754         Weapon->Time = 0.0f;
00755         Weapon->PingTime = Player->PingTime;
00756 
00757         geVec3d_Set(&Weapon->Mins, -10.0f, -10.0f, -10.0f);
00758         geVec3d_Set(&Weapon->Maxs,  10.0f,  10.0f,  10.0f);
00759 
00760         Weapon->ControlIndex = 6;
00761 
00762         Weapon->ViewFlags = (VIEW_TYPE_ACTOR | VIEW_TYPE_LIGHT);
00763         Weapon->ViewIndex = ACTOR_INDEX_ROCKET_AMMO;
00764         Weapon->FxFlags = FX_SMOKE_TRAIL;               // Make some smoke follow rocket
00765         Weapon->Scale = 1.0f;
00766         Weapon->MotionIndex = MOTION_INDEX_NONE;
00767 
00768         Weapon->XForm = Player->XForm;
00769         
00770         geVec3d_Add(&Weapon->XForm.Translation, &Player->GunOffset, &Weapon->XForm.Translation);
00771 
00772         geXForm3d_GetIn(&Weapon->XForm, &In);
00773         geXForm3d_GetUp(&Weapon->XForm, &Up);
00774         geXForm3d_GetLeft(&Weapon->XForm, &Rt);
00775 
00776         Front = Weapon->XForm.Translation;
00777 
00778         geVec3d_AddScaled(&Front, &In, 20000.0f, &Back);
00779 
00780         World = GenVSI_GetWorld(VSI);
00781 
00782         assert(World);
00783 
00784         Data.VSI = VSI;
00785         Data.Player = Player;
00786 
00787         // Find out what direction the rocket needs to go to hit the target in the center of the screen
00788         if (geWorld_Collision(World, NULL, NULL, &Front, &Back, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS, 0xffffffff, SelfCollisionCB, &Data, &Collision))
00789 
00790                 Impact = Collision.Impact;
00791         else
00792                 Impact = Back;
00793 
00794         // Position the rocket under the lower left arm
00795         geVec3d_AddScaled(&Front, &In, 70.0f, &Front);
00796         geVec3d_AddScaled(&Front, &Up, -30.0f, &Front);
00797         geVec3d_AddScaled(&Front, &Rt, -28.0f, &Front);
00798 
00799         XFormFromVector(&Front, &Impact, 0.0f, &Weapon->XForm);
00800         
00801         // HACK!!! Rocket is backwards, so rotate about up vector 180
00802         // Rotate the thing 180
00803         Up.X = 0.0f;
00804         Up.Y = 1.0f;
00805         Up.Z = 0.0f;
00806         geQuaternion_SetFromAxisAngle(&Quat, &Up, 3.14159f);
00807         geQuaternion_ToMatrix(&Quat, &RotXForm);
00808         geXForm3d_Multiply(&Weapon->XForm, &RotXForm, &Weapon->XForm);
00809 
00810         // Play the "take off" sound
00811         GenVSI_PlaySound(VSI, 0, &Player->XForm.Translation);
00812 
00813         Player->NextWeaponTime = GenVSI_GetTime(VSI) + 0.8f;
00814 
00815         Player->VPos = Player->XForm.Translation;
00816 }

geBoolean FireWeapon GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 1119 of file Weapons.c.

References GPlayer::CurrentWeapon, FireBlaster(), FireGrenade(), FireRocket(), FireShredder(), GE_TRUE, geBoolean, GenVSI_GetTime(), GPlayer::NextWeaponTime, and ValidateWeapon().

Referenced by Client_Control().

01120 {
01121         GPlayer                 *Player;
01122 
01123         assert(PlayerData);
01124 
01125         Player = (GPlayer*)PlayerData;
01126 
01127         if (GenVSI_GetTime(VSI) < Player->NextWeaponTime)
01128                 return GE_TRUE;
01129         
01130         ValidateWeapon(VSI, PlayerData);
01131 
01132         switch (Player->CurrentWeapon)
01133         {
01134                 case 0:
01135                         FireBlaster(VSI, Player, Time);
01136                         break;
01137                 case 1:
01138                         FireGrenade(VSI, Player, Time);
01139                         break;
01140                 case 2:
01141                         FireRocket(VSI, Player, Time);
01142                         break;
01143                 case 3:
01144                         FireShredder(VSI, Player, Time);
01145                         break;
01146         }
01147 
01148         return GE_TRUE;
01149 }

geBoolean Grenade_Control GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 428 of file Weapons.c.

References GE_Collision::Actor, GE_Contents::Actor, DammagePlayer(), FX_EXPLODE1, GE_COLLIDE_ACTORS, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_TRUE, geBoolean, GenVSI_ActorToPlayer(), GenVSI_DestroyPlayer(), GenVSI_GetWorld(), GenVSI_PlaySound(), GenVSI_SpawnFx(), geVec3d_AddScaled(), geVec3d_Length(), geVec3d_Subtract(), geWorld_Collision(), geWorld_GetContents(), GRENADE_POWER, GRENADE_POWER_RADIUS, GRENADE_RADIUS, GE_Collision::Impact, GPlayer::Maxs, GPlayer::Mins, CData::Player, PlayerPhysics(), RadiusDammage(), SelfCollisionCB(), SelfCollisionCB2(), GPlayer::Time, geXForm3d::Translation, GPlayer::Velocity, GPlayer::VPos, CData::VSI, GPlayer::XForm, and geVec3d::Y.

Referenced by Client_Main(), FireGrenade(), and Server_Main().

00429 {
00430         geVec3d                 NewPos;
00431         geVec3d                 Mins;
00432         geVec3d                 Maxs;
00433         GE_Contents             Contents;
00434         GPlayer                 *Player;
00435         geWorld                 *World;
00436         GE_Collision    Col;
00437         CData                   Data;
00438         void                    *ThisSelfCollisionCB;
00439 
00440 
00441         World = GenVSI_GetWorld(VSI);
00442         
00443         Player = (GPlayer*)PlayerData;
00444 
00445         Mins = Player->Mins;
00446         Maxs = Player->Maxs;
00447 
00448         if (Player->Time > 1.0f)                // Give the user 1 sec till it starts to collide with himself...
00449                 ThisSelfCollisionCB = SelfCollisionCB2;
00450         else
00451                 ThisSelfCollisionCB = SelfCollisionCB;
00452 
00453         Player->Time += Time;
00454         
00455         Data.VSI = VSI;
00456         Data.Player = Player;
00457 
00458         geVec3d_AddScaled(&Player->XForm.Translation, &Player->Velocity, Time, &NewPos);
00459 
00460         // Make bounce sound
00461         if (geWorld_Collision(World, &Mins, &Maxs, &Player->XForm.Translation, &NewPos, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS, 0, ThisSelfCollisionCB, &Data, &Col))
00462         {
00463                 geVec3d         Vect;
00464 
00465                 geVec3d_Subtract(&Col.Impact, &NewPos, &Vect);
00466 
00467                 if (geVec3d_Length(&Vect) > 5.0f)
00468                         GenVSI_PlaySound(VSI, 3, &Player->XForm.Translation);
00469         }
00470 
00471         if (geWorld_Collision(World, &Mins, &Maxs, &Player->XForm.Translation, &NewPos, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_ACTORS, 0xffffffff, ThisSelfCollisionCB, &Data, &Col))
00472         {
00473                 if (Col.Actor)
00474                 {
00475                         GPlayer         *PlayerHit;
00476 
00477                         PlayerHit = (GPlayer*)GenVSI_ActorToPlayer(VSI, Col.Actor);
00478 
00479                         if (PlayerHit)
00480                         {
00481                                 // Do radius dammage
00482                                 DammagePlayer(VSI, Player, PlayerHit, 25, GRENADE_POWER, Time);
00483                                 RadiusDammage(VSI, Player, 20, GRENADE_POWER_RADIUS, GRENADE_RADIUS, Time);
00484 
00485                                 Player->XForm.Translation.Y += 40.0f;
00486                                 GenVSI_SpawnFx(VSI, FX_EXPLODE1, &Player->XForm.Translation, 1);
00487 
00488                         }
00489 
00490                         // Remove the player...
00491                         GenVSI_DestroyPlayer(VSI, PlayerData);
00492                         return GE_TRUE;
00493                 }
00494         }
00495         
00496         if (geWorld_GetContents(World, &Player->XForm.Translation, &Player->Mins, &Player->Maxs, GE_COLLIDE_ACTORS, 0xffffffff, ThisSelfCollisionCB, &Data, &Contents))
00497         {
00498                 if (Contents.Actor)
00499                 {
00500                         GPlayer         *PlayerHit;
00501 
00502                         PlayerHit = (GPlayer*)GenVSI_ActorToPlayer(VSI, Contents.Actor);
00503 
00504                         if (PlayerHit)
00505                         {
00506                                 // Do radius dammage
00507                                 DammagePlayer(VSI, Player, PlayerHit, 25, GRENADE_POWER, Time);
00508                                 RadiusDammage(VSI, Player, 20, GRENADE_POWER_RADIUS, GRENADE_RADIUS, Time);
00509                                 
00510                                 Player->XForm.Translation.Y += 40.0f;
00511                                 GenVSI_SpawnFx(VSI,  FX_EXPLODE1, &Player->XForm.Translation, 1);
00512                         
00513                                 // Remove the player...
00514                                 GenVSI_DestroyPlayer(VSI, PlayerData);
00515                                 return GE_TRUE;
00516                         }
00517                 }
00518         }
00519         
00520         // Run the physics on the Grenade
00521         PlayerPhysics(VSI, Player, 0.75f, 0.65f, 2.1f, 1000.0f, 1.8f, GE_TRUE, Time);
00522 
00523         Player->VPos = Player->XForm.Translation;
00524         
00525         if (Player->Time >= 3.5f)               // Grenade last for 3 secs
00526         {
00527                 // Do radius dammage
00528                 RadiusDammage(VSI, Player, 35, GRENADE_POWER_RADIUS, GRENADE_RADIUS, Time);
00529 
00530                 Player->XForm.Translation.Y += 40.0f;
00531                 GenVSI_SpawnFx(VSI, FX_EXPLODE1, &Player->XForm.Translation, 1);
00532                 // Remove the player...
00533                 GenVSI_DestroyPlayer(VSI, Player);
00534 
00535         }
00536 
00537         return GE_TRUE;
00538 }

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

Definition at line 623 of file Items.c.

References ACTOR_INDEX_ARMOR, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlArmor(), Item_TriggerArmor(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemArmor::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00624 {
00625         ItemArmor       *Armor;
00626         GPlayer         *Player;
00627 
00628         Player = (GPlayer*)PlayerData;
00629         
00630         Player->Control = Item_ControlArmor;
00631         //Player->ControlIndex = 9;
00632         Player->Trigger = Item_TriggerArmor;
00633 
00634         Player->Time = 0.0f;
00635         
00636         Player->Mins.X =-20.0f;
00637         Player->Mins.Y =-20.0f;
00638         Player->Mins.Z =-20.0f;
00639         Player->Maxs.X = 20.0f;
00640         Player->Maxs.Y = 20.0f;
00641         Player->Maxs.Z = 20.0f;
00642 
00643         // Set the view info
00644         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00645         Player->ViewIndex = ACTOR_INDEX_ARMOR;
00646         Player->FrameTime = 0.0f;
00647         Player->Scale     = 1.0f;
00648         Player->MotionIndex = MOTION_INDEX_NONE;
00649 
00650         // Clean up the matrix
00651         geXForm3d_SetIdentity(&Player->XForm);
00652 
00653         if (ClassData == NULL)
00654                 {
00655                         GenVS_Error("ArmorSpawn: entity missing class data ('%s')\n",EntityName);
00656                 }
00657 
00658         Armor = (ItemArmor*)ClassData;
00659 
00660         // Set the initial pos
00661         Player->XForm.Translation = Armor->Origin;      
00662 
00663         Player->VPos = Player->XForm.Translation;
00664 
00665         return GE_TRUE;
00666 }

geBoolean Item_ControlHealth GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 414 of file Items.c.

References ACTOR_INDEX_HEALTH, FX_EXPLODE2, GE_TRUE, geBoolean, GenVSI_GetTime(), GenVSI_SpawnFx(), geXForm3d_RotateY(), GPlayer::NextThinkTime, GPlayer::Roll, SOUND_INDEX_ITEM_SPAWN, geXForm3d::Translation, GPlayer::ViewIndex, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Client_Main(), Item_HealthSpawn(), and Server_Main().

00415 {
00416         geVec3d Pos;
00417         GPlayer *Player;
00418 
00419         Player = (GPlayer*)PlayerData;
00420 
00421         if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00422                 return GE_TRUE;         // Not time to come back yet
00423 
00424         if (Player->ViewIndex == 0xffff)        // Comming back into view 
00425         {
00426                 Player->Roll = 0.0f;
00427                 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00428                 Player->ViewIndex = ACTOR_INDEX_HEALTH;
00429         }
00430         Pos = Player->XForm.Translation;
00431 
00432         Player->XForm.Translation.X = 0.0f;
00433         Player->XForm.Translation.Y = 0.0f;
00434         Player->XForm.Translation.Z = 0.0f;
00435 
00436         geXForm3d_RotateY(&Player->XForm, Time*2.0f);
00437 
00438         Player->XForm.Translation = Pos;
00439 
00440         return GE_TRUE;
00441 }

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

Definition at line 802 of file Items.c.

References ACTOR_INDEX_GRENADE_AMMO, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlGrenadeAmmo(), Item_TriggerGrenadeAmmo(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemGrenadeAmmo::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00803 {
00804         ItemGrenadeAmmo *GrenadeAmmo;
00805         GPlayer         *Player;
00806 
00807         Player = (GPlayer*)PlayerData;
00808 
00809         Player->Control = Item_ControlGrenadeAmmo;
00810         Player->Trigger = Item_TriggerGrenadeAmmo;
00811 
00812         Player->Time = 0.0f;
00813         
00814         Player->Mins.X =-20.0f;
00815         Player->Mins.Y =-20.0f;
00816         Player->Mins.Z =-20.0f;
00817         Player->Maxs.X = 20.0f;
00818         Player->Maxs.Y = 20.0f;
00819         Player->Maxs.Z = 20.0f;
00820 
00821         // Set the view info
00822         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00823         Player->ViewIndex = ACTOR_INDEX_GRENADE_AMMO;
00824         Player->FrameTime = 0.0f;
00825         Player->Scale     = 1.0f;
00826         Player->MotionIndex = MOTION_INDEX_NONE;
00827 
00828         geXForm3d_SetIdentity(&Player->XForm);
00829 
00830         if (ClassData == NULL)
00831                 {
00832                         GenVS_Error("GrenadeAmmo: entity missing class data ('%s')\n",EntityName);
00833                 }
00834 
00835         GrenadeAmmo = (ItemGrenadeAmmo*)ClassData;
00836 
00837         Player->XForm.Translation = GrenadeAmmo->Origin;        
00838 
00839         Player->VPos = Player->XForm.Translation;
00840 
00841         return GE_TRUE;
00842 }

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

Definition at line 757 of file Items.c.

References ACTOR_INDEX_GRENADE, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlGrenade(), Item_TriggerGrenade(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemGrenade::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00758 {
00759         ItemGrenade     *Grenade;
00760         GPlayer         *Player;
00761 
00762         Player = (GPlayer*)PlayerData;
00763 
00764         Player->Control = Item_ControlGrenade;
00765         Player->Trigger = Item_TriggerGrenade;
00766 
00767         Player->Time = 0.0f;
00768         
00769         Player->Mins.X =-20.0f;
00770         Player->Mins.Y =-20.0f;
00771         Player->Mins.Z =-20.0f;
00772         Player->Maxs.X = 20.0f;
00773         Player->Maxs.Y = 20.0f;
00774         Player->Maxs.Z = 20.0f;
00775 
00776         // Set the view info
00777         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00778         Player->ViewIndex = ACTOR_INDEX_GRENADE;
00779         Player->FrameTime = 0.0f;
00780         Player->Scale     = 1.0f;
00781         Player->MotionIndex = MOTION_INDEX_NONE;
00782 
00783         geXForm3d_SetIdentity(&Player->XForm);
00784 
00785         if (ClassData == NULL)
00786                 {
00787                         GenVS_Error("GrenadeSpawn: entity missing class data ('%s')\n",EntityName);
00788                 }
00789 
00790         Grenade = (ItemGrenade*)ClassData;
00791 
00792         Player->XForm.Translation = Grenade->Origin;    
00793 
00794         Player->VPos = Player->XForm.Translation;
00795 
00796         return GE_TRUE;
00797 }

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

Definition at line 575 of file Items.c.

References ACTOR_INDEX_HEALTH, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlHealth(), Item_TriggerHealth(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemHealth::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00576 {
00577         ItemHealth      *Health;
00578         GPlayer         *Player;
00579 
00580         Player = (GPlayer*)PlayerData;
00581         
00582         Player->Control = Item_ControlHealth;
00583         //Player->ControlIndex = 9;
00584         Player->Trigger = Item_TriggerHealth;
00585 
00586         Player->Time = 0.0f;
00587         
00588         Player->Mins.X =-20.0f;
00589         Player->Mins.Y =-20.0f;
00590         Player->Mins.Z =-20.0f;
00591         Player->Maxs.X = 20.0f;
00592         Player->Maxs.Y = 20.0f;
00593         Player->Maxs.Z = 20.0f;
00594 
00595         // Set the view info
00596         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00597         Player->ViewIndex = ACTOR_INDEX_HEALTH;
00598         Player->FrameTime = 0.0f;
00599         Player->Scale     = 1.0f;
00600         Player->MotionIndex = MOTION_INDEX_NONE;
00601 
00602         // Clean up the matrix
00603         geXForm3d_SetIdentity(&Player->XForm);
00604 
00605         if (ClassData == NULL)
00606                 {
00607                         GenVS_Error( "HealthSpawn: entity missing class data ('%s')\n",EntityName);
00608                 }
00609 
00610         Health = (ItemHealth*)ClassData;
00611 
00612         // Set the initial pos
00613         Player->XForm.Translation = Health->Origin;     
00614 
00615         Player->VPos = Player->XForm.Translation;
00616 
00617         return GE_TRUE;
00618 }

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

Definition at line 716 of file Items.c.

References ACTOR_INDEX_ROCKET_AMMO, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geVec3d_Set(), geXForm3d_SetIdentity(), Item_ControlRocketAmmo(), Item_TriggerRocketAmmo(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemRocketAmmo::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, and GPlayer::XForm.

Referenced by Server_Main().

00717 {
00718         ItemRocketAmmo  *RocketAmmo;
00719         GPlayer         *Player;
00720 
00721         Player = (GPlayer*)PlayerData;
00722 
00723         Player->Control = Item_ControlRocketAmmo;
00724         Player->Trigger = Item_TriggerRocketAmmo;
00725 
00726         Player->Time = 0.0f;
00727         
00728         geVec3d_Set(&Player->Mins, -20.0f, -20.0f, -20.0f);
00729         geVec3d_Set(&Player->Maxs,  20.0f,  20.0f,  20.0f);
00730 
00731         // Set the view info
00732         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00733         Player->ViewIndex = ACTOR_INDEX_ROCKET_AMMO;
00734         Player->FrameTime = 0.0f;
00735         Player->Scale     = 1.0f;
00736         Player->MotionIndex = MOTION_INDEX_NONE;
00737 
00738         geXForm3d_SetIdentity(&Player->XForm);
00739 
00740         if (ClassData == NULL)
00741                 {
00742                         GenVS_Error("RocketAmmoSpawn: entity missing class data ('%s')\n",EntityName);
00743                 }
00744 
00745         RocketAmmo = (ItemRocketAmmo*)ClassData;
00746 
00747         Player->XForm.Translation = RocketAmmo->Origin; 
00748 
00749         Player->VPos = Player->XForm.Translation;
00750 
00751         return GE_TRUE;
00752 }

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

Definition at line 671 of file Items.c.

References ACTOR_INDEX_ROCKET, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlRocket(), Item_TriggerRocket(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemRocket::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00672 {
00673         GPlayer         *Player;
00674         ItemRocket      *Rocket;
00675 
00676         Player = (GPlayer*)PlayerData;
00677 
00678         Player->Control = Item_ControlRocket;
00679         Player->Trigger = Item_TriggerRocket;
00680 
00681         Player->Time = 0.0f;
00682         
00683         Player->Mins.X =-20.0f;
00684         Player->Mins.Y =-20.0f;
00685         Player->Mins.Z =-20.0f;
00686         Player->Maxs.X = 20.0f;
00687         Player->Maxs.Y = 20.0f;
00688         Player->Maxs.Z = 20.0f;
00689 
00690         // Set the view info
00691         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00692         Player->ViewIndex =ACTOR_INDEX_ROCKET;
00693         Player->FrameTime = 0.0f;
00694         Player->Scale     = 1.0f;
00695         Player->MotionIndex = MOTION_INDEX_NONE;
00696 
00697         geXForm3d_SetIdentity(&Player->XForm);
00698 
00699         if (ClassData == NULL)
00700                 {
00701                         GenVS_Error("RocketSpawn: entity missing class data ('%s')\n",EntityName);
00702                 }
00703 
00704         Rocket = (ItemRocket*)ClassData;
00705 
00706         Player->XForm.Translation = Rocket->Origin;     
00707 
00708         Player->VPos = Player->XForm.Translation;
00709 
00710         return GE_TRUE;
00711 }

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

Definition at line 892 of file Items.c.

References ACTOR_INDEX_SHREDDER_AMMO, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlShredderAmmo(), Item_TriggerShredderAmmo(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemShredderAmmo::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00893 {
00894         ItemShredderAmmo        *ShredderAmmo;
00895         GPlayer         *Player;
00896 
00897         Player = (GPlayer*)PlayerData;
00898 
00899         Player->Control = Item_ControlShredderAmmo;
00900         Player->Trigger = Item_TriggerShredderAmmo;
00901 
00902         Player->Time = 0.0f;
00903         
00904         Player->Mins.X =-20.0f;
00905         Player->Mins.Y =-20.0f;
00906         Player->Mins.Z =-20.0f;
00907         Player->Maxs.X = 20.0f;
00908         Player->Maxs.Y = 20.0f;
00909         Player->Maxs.Z = 20.0f;
00910 
00911         // Set the view info
00912         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00913         Player->ViewIndex = ACTOR_INDEX_SHREDDER_AMMO;
00914         Player->FrameTime = 0.0f;
00915         Player->Scale     = 1.0f;
00916         Player->MotionIndex = MOTION_INDEX_NONE;
00917 
00918         geXForm3d_SetIdentity(&Player->XForm);
00919 
00920         if (ClassData == NULL)
00921                 {
00922                         GenVS_Error("ShredderAmmoSpawn: entity missing class data ('%s')\n",EntityName);
00923                 }
00924 
00925         ShredderAmmo = (ItemShredderAmmo*)ClassData;
00926 
00927         Player->XForm.Translation = ShredderAmmo->Origin;       
00928 
00929         Player->VPos = Player->XForm.Translation;
00930 
00931         return GE_TRUE;
00932 }

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

Definition at line 847 of file Items.c.

References ACTOR_INDEX_SHREDDER, GPlayer::Control, GPlayer::FrameTime, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), Item_ControlShredder(), Item_TriggerShredder(), GPlayer::Maxs, GPlayer::Mins, MOTION_INDEX_NONE, GPlayer::MotionIndex, NULL, ItemShredder::Origin, GPlayer::Scale, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, VIEW_TYPE_ACTOR, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, GPlayer::ViewIndex, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Server_Main().

00848 {
00849         ItemShredder    *Shredder;
00850         GPlayer         *Player;
00851 
00852         Player = (GPlayer*)PlayerData;
00853 
00854         Player->Control = Item_ControlShredder;
00855         Player->Trigger = Item_TriggerShredder;
00856 
00857         Player->Time = 0.0f;
00858         
00859         Player->Mins.X =-20.0f;
00860         Player->Mins.Y =-20.0f;
00861         Player->Mins.Z =-20.0f;
00862         Player->Maxs.X = 20.0f;
00863         Player->Maxs.Y = 20.0f;
00864         Player->Maxs.Z = 20.0f;
00865 
00866         // Set the view info
00867         Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_TOUCH;
00868         Player->ViewIndex = ACTOR_INDEX_SHREDDER;
00869         Player->FrameTime = 0.0f;
00870         Player->Scale     = 1.0f;
00871         Player->MotionIndex = MOTION_INDEX_NONE;
00872 
00873         geXForm3d_SetIdentity(&Player->XForm);
00874 
00875         if (ClassData == NULL)
00876                 {
00877                         GenVS_Error("Shreadder: entity missing class data ('%s')\n",EntityName);
00878                 }
00879 
00880         Shredder = (ItemShredder*)ClassData;
00881 
00882         Player->XForm.Translation = Shredder->Origin;   
00883 
00884         Player->VPos = Player->XForm.Translation;
00885 
00886         return GE_TRUE;
00887 }

geBoolean PlayerPhysics GenVSI VSI,
void *  PlayerData,
float  GroundFriction,
float  AirFriction,
float  LiquidFriction,
float  Gravity,
float  BounceScale,
geBoolean  AllowBounce,
float  Time
 

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

References CheckPlayer(), CheckVelocity(), GE_TRUE, geBoolean, geVec3d_AddScaled(), geVec3d_Length(), geVec3d_Scale(), GPlayer::LastGoodPos, PLAYER_AIR_FRICTION, PLAYER_GRAVITY, PLAYER_GROUND_FRICTION, PLAYER_LIQUID_FRICTION, PlayerLiquid(), PSTATE_Dead, PSTATE_DeadOnGround, PSTATE_InAir, PSTATE_InLava, PSTATE_InWater, PSTATE_Normal, SqueezeVector(), GPlayer::State, geXForm3d::Translation, UpdatePlayerContents(), GPlayer::Velocity, GPlayer::XForm, and geVec3d::Y.

Referenced by Bot_ActorDying(), Bot_Dying(), Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WeaponJump(), Client_Control(), Grenade_Control(), and Player_Dying().

00733 {
00734         float   Speed;
00735         GPlayer *Player;
00736 
00737         Player = (GPlayer*)PlayerData;
00738 
00739 #ifndef FLY_MODE
00740         Player->LastGoodPos = Player->XForm.Translation;
00741 
00742         // Add gravity
00743         switch (Player->State)
00744         {
00745                 case PSTATE_InLava:
00746                 case PSTATE_InWater:
00747                         Player->Velocity.Y -= PLAYER_GRAVITY*Time*0.05f;
00748                         break;
00749 
00750                 default:
00751                         Player->Velocity.Y -= PLAYER_GRAVITY*Time;
00752                         break;
00753         }
00754 
00755         CheckVelocity(VSI, Player, BounceScale, AllowBounce, Time);
00756 
00757         SqueezeVector(&Player->Velocity, 0.2f);
00758         geVec3d_AddScaled(&Player->XForm.Translation, &Player->Velocity, Time, &Player->XForm.Translation);
00759 
00760         CheckPlayer(VSI, Player);
00761 #else           // Fly through walls
00762         Player->State = PSTATE_InAir;
00763         SqueezeVector(&Player->Velocity, 0.2f);
00764         geVec3d_AddScaled(&Player->XForm.Translation, &Player->Velocity, Time, &Player->XForm.Translation);
00765 #endif
00766         
00767         Speed = geVec3d_Length(&Player->Velocity);
00768 
00769         // Apply friction
00770         if (Speed > 0.001)
00771         {
00772                 float   NewSpeed;
00773 
00774                 if (Player->State == PSTATE_Normal || Player->State == PSTATE_DeadOnGround)
00775                         NewSpeed = Speed - Time*Speed*PLAYER_GROUND_FRICTION;
00776                 else if (Player->State == PSTATE_InAir || Player->State == PSTATE_Dead)
00777                         NewSpeed = Speed - Time*Speed*PLAYER_AIR_FRICTION;
00778                 else if (PlayerLiquid(Player))
00779                         NewSpeed = Speed - Time*Speed*PLAYER_LIQUID_FRICTION;
00780 
00781                 if (NewSpeed < 0.0f)
00782                         NewSpeed = 0.0f;
00783 
00784                 NewSpeed /= Speed;
00785 
00786                 // Apply movement friction
00787                 geVec3d_Scale(&Player->Velocity, NewSpeed, &Player->Velocity);
00788         }
00789         
00790         UpdatePlayerContents(VSI, Player, Time);
00791 
00792         return GE_TRUE;
00793 }

void ReflectVelocity geVec3d In,
geVec3d Normal,
geVec3d Out,
float  Scale
 

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

References geVec3d_DotProduct(), SqueezeVector(), geVec3d::X, geVec3d::Y, and geVec3d::Z.

Referenced by Bot_CheckVelocity(), Bot_ScanCheckVelocity(), and CheckVelocity().

02092 {
02093         float   Reflect;
02094         
02095         Reflect = geVec3d_DotProduct(In, Normal) * Scale;
02096 
02097         Out->X = In->X - Normal->X*Reflect;
02098         Out->Y = In->Y - Normal->Y*Reflect;
02099         Out->Z = In->Z - Normal->Z*Reflect;
02100 
02101         SqueezeVector(Out, 0.1f);
02102 }

geBoolean Rocket_Control GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 616 of file Weapons.c.

References GE_Collision::Actor, DammagePlayer(), FX_EXPLODE1, GE_COLLIDE_ACTORS, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_TRUE, geBoolean, GenVSI_ActorToPlayer(), GenVSI_DestroyPlayer(), GenVSI_GetWorld(), GenVSI_SpawnFx(), geVec3d_AddScaled(), geVec3d_Scale(), geWorld_Collision(), geWorld_ModelGetUserData(), geXForm3d_Copy(), geXForm3d_GetIn(), geXForm3d_Translate(), GE_Collision::Impact, GE_Collision::Model, GE_Plane::Normal, NULL, GPlayer::Owner, GE_Collision::Plane, CData::Player, RadiusDammage(), ROCKET_POWER, ROCKET_POWER_RADIUS, ROCKET_RADIUS, SelfCollisionCB(), GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, GPlayer::Velocity, VIEW_TYPE_PHYSOB, GPlayer::ViewFlags, GPlayer::VPos, CData::VSI, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.

Referenced by Client_Main(), FireRocket(), and Server_Main().

00617 {
00618         geVec3d                 In, Front, Back;
00619         geXForm3d               DestXForm;
00620         GE_Collision    Collide;
00621         float                   Speed;
00622         GPlayer                 *Player;
00623         geWorld                 *World;
00624         CData                   Data;
00625 
00626         Player = (GPlayer*)PlayerData;
00627 
00628         Player->Time += Time;
00629         
00630         Speed = Player->Time*3600.0f;
00631 
00632         if (Speed > 4000.0f)
00633                 Speed = 4000.0f;
00634 
00635         geXForm3d_Copy(&Player->XForm, &DestXForm);
00636 
00637         geXForm3d_GetIn(&Player->XForm, &In);
00638         geVec3d_Scale(&In, -Speed*Time, &In);           // - speed since xform was rotated 180!!!
00639         geXForm3d_Translate(&DestXForm, In.X, In.Y, In.Z);
00640 
00641         Front = Player->XForm.Translation;
00642         Back = DestXForm.Translation;
00643 
00644         geXForm3d_Copy(&DestXForm, &Player->XForm);
00645 
00646         World = GenVSI_GetWorld(VSI);
00647 
00648         assert(World);
00649 
00650         Data.VSI = VSI;
00651         Data.Player = Player;//->Owner;
00652 
00653         if (geWorld_Collision(  World, NULL, NULL, &Front, &Back, 
00654                                                         GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS|GE_COLLIDE_ACTORS, 
00655                                                         0xffffffff, SelfCollisionCB, &Data, &Collide))
00656         {
00657                 Player->XForm.Translation = Collide.Impact;
00658                 geVec3d_AddScaled(&Player->XForm.Translation, &Collide.Plane.Normal, 40.0f, &Player->XForm.Translation);
00659 
00660                 GenVSI_SpawnFx(VSI, FX_EXPLODE1, &Player->XForm.Translation, 1);
00661 
00662                 if (Collide.Model)
00663                 {
00664                         GPlayer         *Target;
00665 
00666                         Target = (GPlayer*)geWorld_ModelGetUserData(Collide.Model);
00667                         if (Target && Target->Trigger && (Target->ViewFlags & VIEW_TYPE_PHYSOB))
00668                         {
00669                                 geXForm3d_GetIn(&Player->XForm, &In);
00670                                 Player->Velocity = In;
00671                                 geVec3d_Scale(&In, -1000.f, &Player->Velocity);
00672                                 Target->Trigger(VSI, Target, Player, (void*)&Collide);
00673                         }
00674                 }
00675 
00676                 if (Collide.Actor)
00677                 {
00678                         GPlayer         *PlayerHit;
00679 
00680                         PlayerHit = (GPlayer*)GenVSI_ActorToPlayer(VSI, Collide.Actor);
00681 
00682                         // Only radius dammage will hurt the player that shot the rocket...
00683                         if (PlayerHit && PlayerHit != Player->Owner)    
00684                                 DammagePlayer(VSI, Player, PlayerHit, 35, ROCKET_POWER, Time);
00685                         
00686                         // Do radius dammage
00687                         RadiusDammage(VSI, Player, 30, ROCKET_POWER_RADIUS, ROCKET_RADIUS, Time);
00688 
00689                         GenVSI_DestroyPlayer(VSI, PlayerData);
00690                         return GE_TRUE;
00691                 }
00692 
00693                 // Do radius dammage
00694                 RadiusDammage(VSI, Player, 40, ROCKET_POWER_RADIUS, ROCKET_RADIUS, Time);
00695                 GenVSI_DestroyPlayer(VSI, PlayerData);
00696 
00697                 return GE_TRUE;
00698         }
00699         
00700         Player->VPos = Player->XForm.Translation;
00701 
00702         if (Player->Time >= 20.0f)                              // Kill it after 20 seconds
00703                 GenVSI_DestroyPlayer(VSI, PlayerData);
00704 
00705         return GE_TRUE;
00706 }

geBoolean SelfCollisionCB geWorld_Model Model,
geActor Actor,
void *  Context
 

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

References GE_FALSE, GE_TRUE, geBoolean, GenVSI_ActorToPlayer(), GPlayer::Owner, CData::Player, and CData::VSI.

Referenced by Blaster_Control(), Bot_GetContents(), Client_Control(), FireRocket(), FireShredder(), Grenade_Control(), and Rocket_Control().

00148 {
00149         if (Actor)
00150         {
00151                 CData   *Data;
00152 
00153                 Data = (CData*)Context;
00154 
00155                 assert(Data);
00156                 assert(Data->Player);
00157 
00158                 if (GenVSI_ActorToPlayer(Data->VSI, Actor) == Data->Player)
00159                         return GE_FALSE;
00160 
00161                 // NOTE  - Owner CAN be NULL...
00162                 if (GenVSI_ActorToPlayer(Data->VSI, Actor) == Data->Player->Owner)
00163                         return GE_FALSE;
00164         }
00165 
00166         return GE_TRUE;
00167 }

geBoolean SelfCollisionCB2 geWorld_Model Model,
geActor Actor,
void *  Context
 

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

References GE_FALSE, GE_TRUE, geBoolean, GenVSI_ActorToPlayer(), CData::Player, and CData::VSI.

Referenced by Grenade_Control().

00171 {
00172         if (Actor)
00173         {
00174                 CData   *Data;
00175 
00176                 Data = (CData*)Context;
00177 
00178                 assert(Data);
00179                 assert(Data->Player);
00180 
00181                 if (GenVSI_ActorToPlayer(Data->VSI, Actor) == Data->Player)
00182                         return GE_FALSE;
00183         }
00184 
00185         return GE_TRUE;
00186 }

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 Shredder_Control GenVSI VSI,
void *  PlayerData,
float  Time
 

Definition at line 985 of file Weapons.c.

References GE_TRUE, geBoolean, GenVSI_DestroyPlayer(), geVec3d_Add(), GPlayer::GunOffset, NULL, GPlayer::Owner, GPlayer::Time, geXForm3d::Translation, GPlayer::VPos, GPlayer::Weapon, and GPlayer::XForm.

Referenced by Client_Main(), FireShredder(), and Server_Main().

00986 {
00987         GPlayer                 *Player;
00988 
00989         Player = (GPlayer*)PlayerData;
00990 
00991         Player->Time += Time;
00992 
00993         if (Player->Time > 0.25f)
00994         {
00995                 Player->Owner->Weapon = NULL;
00996                 GenVSI_DestroyPlayer(VSI, PlayerData);
00997                 return GE_TRUE;
00998         }
00999 
01000         Player->XForm = Player->Owner->XForm;
01001 
01002         geVec3d_Add(&Player->XForm.Translation, &Player->Owner->GunOffset, &Player->XForm.Translation);
01003 
01004         Player->VPos = Player->XForm.Translation;
01005 
01006         return GE_TRUE;
01007 }

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 }

void SqueezeVector geVec3d Vect,
float  Epsilon
 

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

References geVec3d::X, geVec3d::Y, and geVec3d::Z.

Referenced by Ang2Vec(), Bot_Physics(), Bot_ScanPhysics(), PlayerPhysics(), and ReflectVelocity().

02059 {
02060         if (Vect->X > -Epsilon && Vect->X < Epsilon)
02061                 Vect->X = 0.0f;
02062         if (Vect->Y > -Epsilon && Vect->Y < Epsilon)
02063                 Vect->Y = 0.0f;
02064         if (Vect->Z > -Epsilon && Vect->Z < Epsilon)
02065                 Vect->Z = 0.0f;
02066 }

void UpdateClientInventory GenVSI VSI,
GPlayer Player,
int32  Slot
 

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

References GPlayer::ClientHandle, GPlayer::CurrentWeapon, geBoolean, GenVSI_SetClientInventory(), GPlayer::Inventory, GPlayer::InventoryHas, and uint16.

Referenced by DammagePlayer(), Item_TriggerArmor(), Item_TriggerGrenade(), Item_TriggerGrenadeAmmo(), Item_TriggerRocket(), Item_TriggerRocketAmmo(), Item_TriggerShredder(), Item_TriggerShredderAmmo(), and KillPlayer().

02313 {
02314         uint16          Amount;
02315         geBoolean       Has;
02316 
02317         assert(Player->Inventory[Player->CurrentWeapon] >= 0 && Player->Inventory[Player->CurrentWeapon] <= 65535);
02318 
02319         Amount = (uint16)Player->Inventory[Slot];
02320         Has = Player->InventoryHas[Slot];
02321 
02322         GenVSI_SetClientInventory(VSI, Player->ClientHandle, Slot, Amount, Has);
02323 }

geBoolean UpdatePlayerContents GenVSI VSI,
void *  PlayerData,
float  Time
 

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

References GE_Contents::Contents, CONTENTS_LAVA, CONTENTS_WATER, GE_COLLIDE_MODELS, GE_TRUE, geBoolean, GenVSI_GetWorld(), geWorld_GetContents(), GPlayer::Maxs, GPlayer::Mins, NULL, PlayerLiquid(), PSTATE_InLava, PSTATE_InWater, PSTATE_Normal, GPlayer::State, geXForm3d::Translation, and GPlayer::XForm.

Referenced by PlayerPhysics().

00799 {
00800         GPlayer         *Player;
00801         geWorld         *World;
00802         GE_Contents     Contents;
00803 
00804         World = GenVSI_GetWorld(VSI);
00805 
00806         assert(World);
00807 
00808         Player = (GPlayer*)PlayerData;
00809 
00810         if (geWorld_GetContents(World, &Player->XForm.Translation, &Player->Mins, &Player->Maxs, GE_COLLIDE_MODELS, 0, NULL, NULL, &Contents))
00811         {
00812                 // Check to see if player is in lava...
00813                 if (Contents.Contents & CONTENTS_WATER)
00814                 {
00815                         Player->State = PSTATE_InWater;
00816                 }
00817                 else if (Contents.Contents & CONTENTS_LAVA)
00818                 {
00819                         Player->State = PSTATE_InLava;
00820                 }
00821                 else if (PlayerLiquid(Player))
00822                                 Player->State = PSTATE_Normal;
00823         }
00824         else if (PlayerLiquid(Player))
00825                         Player->State = PSTATE_Normal;
00826 
00827         return GE_TRUE;
00828 }

BOOL XFormFromVector const geVec3d Source,
const geVec3d Target,
float  Roll,
geXForm3d Out
 

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

References geXForm3d::AX, geXForm3d::AY, geXForm3d::AZ, geXForm3d::BX, geXForm3d::BY, geXForm3d::BZ, geXForm3d::CX, geXForm3d::CY, geXForm3d::CZ, geVec3d_Compare(), geVec3d_CrossProduct(), geVec3d_Normalize(), geVec3d_Subtract(), geXForm3d_SetIdentity(), Source, geXForm3d::Translation, TRUE, geVec3d::X, geVec3d::Y, and geVec3d::Z.

Referenced by Attacker_Fire(), FireBlaster(), and FireRocket().

02119 {
02120         geVec3d         p1, p2, Vect;
02121         geVec3d         Origin = {0.0f, 0.0f, 0.0f};
02122 
02123         geVec3d_Subtract(Source, Target, &Vect);
02124 
02125         if (geVec3d_Compare(&Vect, &Origin, 0.05f))
02126         {
02127                 Vect.Y = -1.0f;
02128         }
02129 
02130         // First clear the xform
02131         geXForm3d_SetIdentity(Out);
02132 
02133         geVec3d_Normalize(&Vect);
02134 
02135         // Now set the IN vector
02136         Out->AZ = Vect.X;
02137         Out->BZ = Vect.Y;
02138         Out->CZ = Vect.Z;
02139 
02140         // Get a straight up vector
02141         p2.X = 0.0f;
02142         p2.Y = 1.0f;
02143         p2.Z = 0.0f;
02144 
02145         // Use it with the in vector to get the RIGHT vector
02146         geVec3d_CrossProduct(&p2, &Vect, &p1);
02147         geVec3d_Normalize(&p1);
02148 
02149         // Put the RIGHT vector in the matrix
02150         Out->AX = p1.X;
02151         Out->BX = p1.Y;
02152         Out->CX = p1.Z;
02153 
02154         // Now use the RIGHT vector with the IN vector to get the real UP vector
02155         geVec3d_CrossProduct(&Vect, &p1, &p2);
02156         geVec3d_Normalize(&p2);
02157 
02158         // Put the UP vector in the matrix
02159         Out->AY = p2.X;
02160         Out->BY = p2.Y;
02161         Out->CY = p2.Z;
02162         
02163         // Put the translation in...
02164         Out->Translation = *Source;
02165 
02166         return TRUE;
02167 }


Variable Documentation

GPlayer* CurrentPlayerStart
 

Definition at line 138 of file Genesis3d/src/Game/GMain.h.

Referenced by GetDMSpawn(), Server_Main(), and SetupWorldCB().


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