00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <Windows.h>
00016 #include <Assert.h>
00017 #include <stdio.h>
00018
00019 #include "GMain.h"
00020
00021 #include "PathPt.h"
00022 extern void GenVS_Error(const char *Msg, ...);
00023
00024
00025
00026
00027
00028 geBoolean SetupWorldCB(GenVSI *VSI, const char *WorldName, geVFile *MainFS)
00029 {
00030
00031 if (!PathPt_Startup(GenVSI_GetWorld(VSI), MainFS))
00032 return GE_FALSE;
00033
00034
00035 CurrentPlayerStart = NULL;
00036
00037
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
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
00058
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
00084 GenVSI_BoneIndex(VSI, 0, "ROOT");
00085 GenVSI_BoneIndex(VSI, 1, "AXLE");
00086
00087 return GE_TRUE;
00088 }
00089
00090
00091
00092
00093 geBoolean ShutdownWorldCB(GenVSI *VSI)
00094 {
00095
00096 PathPt_Shutdown();
00097
00098 return GE_TRUE;
00099 }
00100
00101
00102
00103
00104 static geBoolean ChangeLevel_Trigger(GenVSI *VSI, void *PlayerData, void *TargetData, void *Context)
00105 {
00106 ChangeLevel *Cl;
00107 GPlayer *Player;
00108 char Name[256];
00109
00110 Player = (GPlayer*)PlayerData;
00111 Cl = (ChangeLevel*)Player->ClassData;
00112
00113 assert(strlen(Cl->LevelName)+8 < 256);
00114
00115 sprintf(Name, "Levels\\%s", Cl->LevelName);
00116
00117
00118 GenVSI_SetWorld(VSI, SetupWorldCB, ShutdownWorldCB, Name);
00119
00120 return GE_TRUE;
00121 }
00122
00123
00124
00125
00126 geBoolean ChangeLevel_Spawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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 }