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

Genvsi.c

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  GenVSI.c                                                                            */
00003 /*                                                                                      */
00004 /*  Author: John Pollard                                                                */
00005 /*  Description:                                                                        */
00006 /*                                                                                      */
00007 /*  Copyright (c) 1997, 1999, Eclipse Entertainment; All rights reserved.               */
00008 /*                                                                                      */
00009 /*  See the accompanying file LICENSE.TXT for terms on the use of this library.         */
00010 /*  This library is distributed in the hope that it will be useful but WITHOUT          */
00011 /*  ANY WARRANTY OF ANY KIND and without any implied warranty of MERCHANTABILITY        */
00012 /*  or FITNESS FOR ANY PURPOSE.  Refer to LICENSE.TXT for more details.                 */
00013 /*                                                                                      */
00014 /****************************************************************************************/
00015 #include <Windows.h>
00016 #include <Assert.h>
00017 #include <stdio.h>
00018 
00019 #include "GenVSI.h"
00020 
00021 #include "Genesis.h"
00022 
00023 
00024 //=====================================================================================
00025 // Loading/Prep functions (Authoritive Server side ONLY)
00026 //=====================================================================================
00027 
00028 //=====================================================================================
00029 //      GenVSI_SetClassSpawn
00030 //=====================================================================================
00031 void GenVSI_SetClassSpawn(GenVSI *VSI, const char *ClassName, GenVSI_SpawnFunc *Func, GenVSI_DestroyFunc *DFunc)
00032 {
00033         if (!VSI->SetClassSpawn)
00034                 return;
00035 
00036         VSI->SetClassSpawn(VSI->UData, ClassName, Func, DFunc);
00037 }
00038 
00039 //=====================================================================================
00040 //      GenVSI_SetWorld
00041 //=====================================================================================
00042 void GenVSI_SetWorld(GenVSI *VSI, GenVSI_NewWorldCB *NewWorldCB, GenVSI_ShutdownWorldCB *ShutdownWorldCB, const char *WorldName)
00043 {
00044         if (!VSI->SetWorld)
00045                 return;
00046 
00047         VSI->SetWorld(VSI->UData, NewWorldCB, ShutdownWorldCB, WorldName);
00048 }
00049 
00050 //=====================================================================================
00051 //      GenVSI_ActorIndex
00052 //=====================================================================================
00053 void GenVSI_ActorIndex(GenVSI *VSI, uint16 Index, const char *GFXPath, const char *FileName)
00054 {
00055         if (!VSI->ActorIndex)
00056                 return;
00057 
00058         VSI->ActorIndex(VSI->UData, Index, GFXPath, FileName);
00059 }
00060 
00061 //=====================================================================================
00062 //      GenVSI_MotionIndex
00063 //=====================================================================================
00064 void GenVSI_MotionIndex(GenVSI *VSI, uint16 Index, const char *MotionName)
00065 {
00066         if (!VSI->MotionIndex)
00067                 return;
00068 
00069         VSI->MotionIndex(VSI->UData, Index, MotionName);
00070 }
00071 
00072 //=====================================================================================
00073 //      GenVSI_BoneIndex
00074 //=====================================================================================
00075 void GenVSI_BoneIndex(GenVSI *VSI, uint16 Index, const char *BoneName)
00076 {
00077         if (!VSI->BoneIndex)
00078                 return;
00079 
00080         VSI->BoneIndex(VSI->UData, Index, BoneName);
00081 }
00082 
00083 //=====================================================================================
00084 //      GenVSI_TextureIndex
00085 //=====================================================================================
00086 void GenVSI_TextureIndex(GenVSI *VSI, uint16 Index, const char *TextureName, const char *ATextureName)
00087 {
00088         if (!VSI->TextureIndex)
00089                 return;
00090 
00091         VSI->TextureIndex(VSI->UData, Index, TextureName, ATextureName);
00092 }
00093 
00094 //=====================================================================================
00095 //      GenVSI_SoundIndex
00096 //=====================================================================================
00097 void GenVSI_SoundIndex(GenVSI *VSI, uint16 Index, const char *FileName)
00098 {
00099         if (!VSI->SoundIndex)
00100                 return;
00101 
00102         VSI->SoundIndex(VSI->UData, Index, FileName);
00103 }
00104 
00105 //=====================================================================================
00106 // Candy functions (Client and server should be able to call these)
00107 //=====================================================================================
00108 
00109 //=====================================================================================
00110 //      GenVSI_PlaySound
00111 //=====================================================================================
00112 void GenVSI_PlaySound(GenVSI *VSI, uint16 Index, const geVec3d *Pos)
00113 {
00114         if (!VSI->PlaySound)
00115                 return;
00116 
00117         VSI->PlaySound(VSI->UData, Index, Pos);
00118 }
00119 
00120 //=====================================================================================
00121 //      GenVSI_SpawnFx
00122 //=====================================================================================
00123 void GenVSI_SpawnFx(GenVSI *VSI, uint8 FxNum, const geVec3d *Pos, uint8 SoundIndex)
00124 {
00125         if (!VSI->SpawnFx)
00126                 return;
00127 
00128         VSI->SpawnFx(VSI->UData, FxNum, Pos, SoundIndex);
00129 }
00130 
00131 //=====================================================================================
00132 // Collision
00133 //=====================================================================================
00134 //void GenVSI_RayCollision(GenVSI *VSI, geVec3d *Front, geVec3d *Back,...)      // FIXME:  Implement...
00135 
00136 //=====================================================================================
00137 // Stray (don't know what to do with yet) functions
00138 // These are currently built in, and will be soon be converted to the new net-variable
00139 // interface system.  I.e:  NetUseVariable("ClientScore"), etc...
00140 //=====================================================================================
00141 
00142 //=====================================================================================
00143 //      GenVSI_GetPlayerClientData
00144 //=====================================================================================
00145 void *GenVSI_GetPlayerClientData(GenVSI *VSI, GenVSI_CHandle ClientHandle)
00146 {
00147         if (!VSI->GetPlayerClientData)
00148                 return NULL;
00149 
00150         return VSI->GetPlayerClientData(VSI->UData, ClientHandle);
00151 }
00152 
00153 //=====================================================================================
00154 //      GenVSI_SetClientScore
00155 //=====================================================================================
00156 void GenVSI_SetClientScore(GenVSI *VSI, GenVSI_CHandle ClientHandle, int32 Score)
00157 {
00158         if (!VSI->SetClientScore)
00159                 return;
00160 
00161         VSI->SetClientScore(VSI->UData, ClientHandle, Score);
00162 }
00163 
00164 //=====================================================================================
00165 //      GenVSI_SetClientHealth
00166 //=====================================================================================
00167 void GenVSI_SetClientHealth(GenVSI *VSI, GenVSI_CHandle ClientHandle, int32 Health)
00168 {
00169         if (!VSI->SetClientHealth)
00170                 return;
00171 
00172         VSI->SetClientHealth(VSI->UData, ClientHandle, Health);
00173 }
00174 
00175 //=====================================================================================
00176 //      GenVSI_SetClientWeapon
00177 //=====================================================================================
00178 void GenVSI_SetClientWeapon(GenVSI *VSI, GenVSI_CHandle ClientHandle, int32 Weapon)
00179 {
00180         if (!VSI->SetClientWeapon)
00181                 return;
00182 
00183         VSI->SetClientWeapon(VSI->UData, ClientHandle, Weapon);
00184 }
00185 
00186 //=====================================================================================
00187 //      GenVSI_SetClientInventory
00188 //=====================================================================================
00189 void GenVSI_SetClientInventory(GenVSI *VSI, GenVSI_CHandle ClientHandle, int32 Slot, uint16 Amount, geBoolean HasItem)
00190 {
00191         if (!VSI->SetClientInventory)
00192                 return;
00193 
00194         VSI->SetClientInventory(VSI->UData, ClientHandle, Slot, Amount, HasItem);
00195 }
00196 
00197 //=====================================================================================
00198 //      GenVSI_IsClientBot
00199 //=====================================================================================
00200 #pragma message ("Bot - Genvsi.c")
00201 geBoolean GenVSI_IsClientBot(GenVSI *VSI, GenVSI_CHandle ClientHandle)
00202 {
00203         if (!VSI->IsClientBot)
00204                 return GE_FALSE;
00205 
00206         return VSI->IsClientBot(VSI->UData, ClientHandle);
00207 }
00208 
00209 //=====================================================================================
00210 //      GenVSI_ClientDisconnect
00211 //=====================================================================================
00212 geBoolean GenVSI_ClientDisconnect(GenVSI *VSI, GenVSI_CHandle ClientHandle)
00213 {
00214         if (!VSI->ClientDisconnect)
00215                 return GE_FALSE;
00216 
00217         return VSI->ClientDisconnect(VSI->UData, ClientHandle);
00218 }
00219 
00220 //=====================================================================================
00221 //      GenVSI_GetClientMove
00222 //=====================================================================================
00223 GenVSI_CMove *GenVSI_GetClientMove(GenVSI *VSI, GenVSI_CHandle ClientHandle)
00224 {
00225         if (!VSI->GetClientMove)
00226                 return NULL;
00227 
00228         return VSI->GetClientMove(VSI->UData, ClientHandle);
00229 }
00230 
00231 // Support functions
00232 //=====================================================================================
00233 //      GenVSI_ModelToViewIndex
00234 //=====================================================================================
00235 uint16 GenVSI_ModelToViewIndex(GenVSI *VSI, geWorld_Model *Model)
00236 {
00237         if (!VSI->ModelToViewIndex)
00238         {
00239                 assert(!"Should'nt be here!!!");
00240                 return 0xffff;
00241         }
00242 
00243         return VSI->ModelToViewIndex(VSI->UData, Model);
00244 }
00245 
00246 //=====================================================================================
00247 //      GenVSI_RegisterPlayerModel
00248 //=====================================================================================
00249 void GenVSI_RegisterPlayerModel(GenVSI *VSI, void *PlayerData, geWorld_Model *Model)
00250 {
00251         if (!VSI->RegisterPlayerModel)
00252                 return;
00253 
00254         VSI->RegisterPlayerModel(VSI->UData, PlayerData, Model);
00255 }
00256 
00257 //=====================================================================================
00258 //      GenVSI_GetNextPlayer
00259 //=====================================================================================
00260 void *GenVSI_GetNextPlayer(GenVSI *VSI, void *Start, const char *ClassName)
00261 {
00262         if (!VSI->GetNextPlayer)
00263                 return NULL;
00264 
00265         return VSI->GetNextPlayer(VSI->UData, Start, ClassName);
00266 }
00267 
00268 //=====================================================================================
00269 //      GenVSI_GetNextPlayerInRadius
00270 //=====================================================================================
00271 void *GenVSI_GetNextPlayerInRadius(GenVSI *VSI, void *PlayerData, void *Start, const char *ClassName, float Radius)
00272 {
00273         if (!VSI->GetNextPlayerInRadius)
00274                 return NULL;
00275 
00276         return VSI->GetNextPlayerInRadius(VSI->UData, PlayerData, Start, ClassName, Radius);
00277 }
00278 
00279 //=====================================================================================
00280 //      GenVSI_SetViewPlayer
00281 //=====================================================================================
00282 void GenVSI_SetViewPlayer(GenVSI *VSI, GenVSI_CHandle ClientHandle, void *PlayerData)
00283 {
00284         if (!VSI->SetViewPlayer)
00285                 return;
00286 
00287         VSI->SetViewPlayer(VSI->UData, ClientHandle, PlayerData);
00288 }
00289 
00290 //=====================================================================================
00291 //      GenVSI_MovePlayerModel
00292 //=====================================================================================
00293 geBoolean GenVSI_MovePlayerModel(GenVSI *VSI, void *PlayerData, const geXForm3d *DestXForm)
00294 {
00295         if (!VSI->MovePlayerModel)
00296                 return GE_FALSE;
00297 
00298         return VSI->MovePlayerModel(VSI->UData, PlayerData, DestXForm);
00299 }
00300 
00301 //=====================================================================================
00302 //      GenVSI_GetPlayerTimeExtents
00303 //=====================================================================================
00304 void GenVSI_GetPlayerTimeExtents(GenVSI *VSI, void *PlayerData, uint16 MotionIndex, float *Start, float *End)
00305 {
00306         if (!VSI->GetPlayerTimeExtents)
00307                 return;
00308 
00309         VSI->GetPlayerTimeExtents(VSI->UData, PlayerData, MotionIndex, Start, End);
00310 }
00311 
00312 //=====================================================================================
00313 //      GenVSI_ActorToPlayer
00314 //=====================================================================================
00315 void *GenVSI_ActorToPlayer(GenVSI *VSI, geActor *Actor)
00316 {
00317         if (!VSI->ActorToPlayer)
00318                 return NULL;
00319 
00320         return VSI->ActorToPlayer(VSI->UData, Actor);
00321 }
00322 
00323 //=====================================================================================
00324 //      GenVSI_GetWorld
00325 //=====================================================================================
00326 geWorld *GenVSI_GetWorld(GenVSI *VSI)
00327 {
00328         if (!VSI->GetWorld)
00329                 return NULL;
00330 
00331         return VSI->GetWorld(VSI->UData);
00332 }
00333 
00334 //=====================================================================================
00335 //      GenVSI_ConsolePrintf
00336 //=====================================================================================
00337 void GenVSI_ConsolePrintf(GenVSI *VSI, const char *Str, ...)
00338 {
00339         va_list         ArgPtr;
00340 
00341         if (!VSI->ConsolePrintf)
00342                 return;
00343 
00344         assert(VSI);
00345         assert(Str);
00346 
00347         va_start (ArgPtr, Str);
00348     VSI->ConsolePrintf(VSI->UData, Str, ArgPtr);
00349         va_end (ArgPtr);
00350 }
00351 
00352 //=====================================================================================
00353 //      GenVSI_ConsoleHeaderPrintf
00354 //=====================================================================================
00355 void GenVSI_ConsoleHeaderPrintf(GenVSI *VSI, int32 ClientHandle, geBoolean AllClients, const char *Str, ...)
00356 {
00357         va_list         ArgPtr;
00358     char                TempStr[256];
00359 
00360         if (!VSI->ConsoleHeaderPrintf)
00361                 return;
00362 
00363         assert(VSI);
00364         assert(Str);
00365 
00366         va_start (ArgPtr, Str);
00367     vsprintf (TempStr, Str, ArgPtr);
00368         va_end (ArgPtr);
00369 
00370     VSI->ConsoleHeaderPrintf(VSI->UData, ClientHandle, AllClients, TempStr);
00371 }
00372 
00373 //=====================================================================================
00374 //      GenVSI_GetTime
00375 //=====================================================================================
00376 float GenVSI_GetTime(GenVSI *VSI)
00377 {
00378         if (!VSI->GetTime)
00379                 return 0.0f;
00380 
00381         return VSI->GetTime(VSI->UData);
00382 }
00383 
00384 //=====================================================================================
00385 //      GenVSI_SpawnPlayer
00386 //=====================================================================================
00387 void *GenVSI_SpawnPlayer(GenVSI *VSI, const char *ClassName)
00388 {
00389         if (!VSI->SpawnPlayer)
00390                 return NULL;
00391 
00392         return VSI->SpawnPlayer(VSI->UData, ClassName);
00393 }
00394 
00395 //=====================================================================================
00396 //      GenVSI_DestroyPlayer
00397 //=====================================================================================
00398 void GenVSI_DestroyPlayer(GenVSI *VSI, void *PlayerData)
00399 {
00400         if (!VSI->DestroyPlayer)
00401         {
00402                 assert(!"Bad! No destroy!!!");
00403                 return;
00404         }
00405         
00406         VSI->DestroyPlayer(VSI->UData, PlayerData);
00407 }
00408 
00409 
00410 //=====================================================================================
00411 //      GenVSI_ProcIndex
00412 //=====================================================================================
00413 void GenVSI_ProcIndex(GenVSI *VSI, uint16 Index, void *Proc)
00414 {
00415         if (!VSI->ProcIndex)
00416                 return;
00417 
00418         VSI->ProcIndex(VSI->UData, Index, Proc);
00419 }

Generated on Tue Sep 30 12:35:51 2003 for GTestAndEngine by doxygen 1.3.2