00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <Windows.h>
00016 #include <Assert.h>
00017 #include <Math.h>
00018
00019 #include "GMain.h"
00020 extern void GenVS_Error(const char *Msg, ...);
00021
00022
00023
00024 static geBoolean Item_TriggerHealth(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00025 {
00026 GPlayer *Player, *Target;
00027
00028 Player = (GPlayer*)PlayerData;
00029 Target = (GPlayer*)TargetData;
00030
00031 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00032 return GE_TRUE;
00033
00034 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00035 return GE_TRUE;
00036
00037 if (Target->Health >= 100)
00038 return GE_TRUE;
00039
00040 Player->ViewIndex = 0xffff;
00041 Player->NextThinkTime = GenVSI_GetTime(VSI) + HEALTH_RESPAWN;
00042
00043
00044 Target->Health += 25;
00045
00046 if (Target->Health > 100)
00047 Target->Health = 100;
00048
00049 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_HEALTH, &Player->XForm.Translation);
00050
00051
00052 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00053 {
00054 GenVSI_SetClientHealth(VSI, Target->ClientHandle, Target->Health);
00055 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get 25 health");
00056 }
00057
00058 return GE_TRUE;
00059 }
00060
00061
00062
00063
00064 static geBoolean Item_TriggerArmor(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00065 {
00066 GPlayer *Player, *Target;
00067
00068 Player = (GPlayer*)PlayerData;
00069 Target = (GPlayer*)TargetData;
00070
00071 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00072 return GE_TRUE;
00073
00074 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00075 return GE_TRUE;
00076
00077 if (Target->Inventory[ITEM_ARMOR] >= MAX_ARMOR)
00078 return GE_TRUE;
00079
00080 Player->ViewIndex = 0xffff;
00081 Player->NextThinkTime = GenVSI_GetTime(VSI) + ARMOR_RESPAWN;
00082
00083 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_HEALTH, &Player->XForm.Translation);
00084
00085
00086 Target->InventoryHas[ITEM_ARMOR] = GE_TRUE;
00087
00088 Target->Inventory[ITEM_ARMOR] += ARMOR_AMOUNT;
00089
00090 if (Target->Inventory[ITEM_ARMOR] > MAX_ARMOR)
00091 Target->Inventory[ITEM_ARMOR] = MAX_ARMOR;
00092
00093
00094 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00095 {
00096 UpdateClientInventory(VSI, Target, ITEM_ARMOR);
00097
00098 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get %i armor", ARMOR_AMOUNT);
00099 }
00100
00101 return GE_TRUE;
00102 }
00103
00104
00105
00106
00107 static geBoolean Item_TriggerRocket(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00108 {
00109 GPlayer *Player, *Target;
00110
00111 Player = (GPlayer*)PlayerData;
00112 Target = (GPlayer*)TargetData;
00113
00114 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00115 return GE_TRUE;
00116
00117 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00118 return GE_TRUE;
00119
00120 if (Target->InventoryHas[ITEM_ROCKETS])
00121 return GE_TRUE;
00122
00123
00124 Player->ViewIndex = 0xffff;
00125 Player->NextThinkTime = GenVSI_GetTime(VSI) + ROCKET_RESPAWN;
00126
00127 if (!Target->InventoryHas[ITEM_ROCKETS] || Target->Inventory[ITEM_ROCKETS] < 5)
00128 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON2, &Player->XForm.Translation);
00129 else
00130 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON1, &Player->XForm.Translation);
00131
00132 Target->InventoryHas[ITEM_ROCKETS] = GE_TRUE;
00133 Target->CurrentWeapon = ITEM_ROCKETS;
00134
00135 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00136 GenVSI_SetClientWeapon(VSI, Target->ClientHandle, ITEM_ROCKETS);
00137
00138 Target->Inventory[ITEM_ROCKETS] += ROCKET_AMOUNT;
00139
00140
00141 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00142 {
00143 UpdateClientInventory(VSI, Target, ITEM_ROCKETS);
00144 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get the Rocket Launcher");
00145 }
00146
00147 return GE_TRUE;
00148 }
00149
00150
00151
00152
00153 static geBoolean Item_TriggerRocketAmmo(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00154 {
00155 GPlayer *Player, *Target;
00156
00157 Player = (GPlayer*)PlayerData;
00158 Target = (GPlayer*)TargetData;
00159
00160 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00161 return GE_TRUE;
00162
00163 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00164 return GE_TRUE;
00165
00166 if (Target->Inventory[ITEM_ROCKETS] >= ROCKET_MAX_AMOUNT)
00167 return GE_TRUE;
00168
00169
00170 Player->ViewIndex = 0xffff;
00171 Player->NextThinkTime = GenVSI_GetTime(VSI) + ROCKET_AMMO_RESPAWN;
00172
00173
00174 Target->Inventory[ITEM_ROCKETS] += ROCKET_AMMO_AMOUNT;
00175
00176 if (Target->Inventory[ITEM_ROCKETS] > ROCKET_MAX_AMOUNT)
00177 Target->Inventory[ITEM_ROCKETS] = ROCKET_MAX_AMOUNT;
00178
00179 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON1, &Player->XForm.Translation);
00180
00181
00182 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00183 {
00184 UpdateClientInventory(VSI, Target, ITEM_ROCKETS);
00185 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get some Rocket Ammo");
00186 }
00187
00188 return GE_TRUE;
00189 }
00190
00191
00192
00193
00194 static geBoolean Item_TriggerGrenade(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00195 {
00196 GPlayer *Player, *Target;
00197
00198 Player = (GPlayer*)PlayerData;
00199 Target = (GPlayer*)TargetData;
00200
00201 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00202 return GE_TRUE;
00203
00204 if (Target->InventoryHas[ITEM_GRENADES])
00205 return GE_TRUE;
00206
00207 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00208 return GE_TRUE;
00209
00210
00211 Player->ViewIndex = 0xffff;
00212 Player->NextThinkTime = GenVSI_GetTime(VSI) + GRENADE_RESPAWN;
00213
00214 if (!Target->InventoryHas[ITEM_GRENADES] || Target->Inventory[ITEM_GRENADES] < 5)
00215 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON2, &Player->XForm.Translation);
00216 else
00217 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON1, &Player->XForm.Translation);
00218
00219 Target->InventoryHas[ITEM_GRENADES] = GE_TRUE;
00220 Target->CurrentWeapon = ITEM_GRENADES;
00221
00222 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00223 GenVSI_SetClientWeapon(VSI, Target->ClientHandle, ITEM_GRENADES);
00224
00225 Target->Inventory[ITEM_GRENADES] += GRENADE_AMOUNT;
00226
00227
00228 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00229 {
00230 UpdateClientInventory(VSI, Target, ITEM_GRENADES);
00231 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get the Grenade Launcher");
00232 }
00233
00234 return GE_TRUE;
00235 }
00236
00237
00238
00239
00240 static geBoolean Item_ControlShredder(GenVSI *VSI, void *PlayerData, float Time)
00241 {
00242 geVec3d Pos;
00243 GPlayer *Player;
00244
00245 Player = (GPlayer*)PlayerData;
00246
00247 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00248 return GE_TRUE;
00249
00250 if (Player->ViewIndex == 0xffff)
00251 {
00252 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00253 Player->ViewIndex = ACTOR_INDEX_SHREDDER;
00254 }
00255
00256 Pos = Player->XForm.Translation;
00257
00258 geXForm3d_RotateY(&Player->XForm, Time*2.0f);
00259
00260 Player->XForm.Translation = Pos;
00261
00262 return GE_TRUE;
00263 }
00264
00265
00266
00267
00268 static geBoolean Item_ControlShredderAmmo(GenVSI *VSI, void *PlayerData, float Time)
00269 {
00270 GPlayer *Player;
00271
00272 Player = (GPlayer*)PlayerData;
00273
00274 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00275 return GE_TRUE;
00276
00277 if (Player->ViewIndex == 0xffff)
00278 {
00279 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00280 Player->ViewIndex = ACTOR_INDEX_SHREDDER_AMMO;
00281 }
00282
00283 return GE_TRUE;
00284 }
00285
00286
00287
00288
00289 static geBoolean Item_TriggerShredder(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00290 {
00291 GPlayer *Player, *Target;
00292
00293 Player = (GPlayer*)PlayerData;
00294 Target = (GPlayer*)TargetData;
00295
00296 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00297 return GE_TRUE;
00298
00299 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00300 return GE_TRUE;
00301
00302 if (Target->InventoryHas[ITEM_SHREDDER])
00303 return GE_TRUE;
00304
00305
00306 Player->ViewIndex = 0xffff;
00307 Player->NextThinkTime = GenVSI_GetTime(VSI) + SHREDDER_RESPAWN;
00308
00309 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON2, &Player->XForm.Translation);
00310
00311 Target->InventoryHas[ITEM_SHREDDER] = GE_TRUE;
00312 Target->CurrentWeapon = ITEM_SHREDDER;
00313
00314 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00315 GenVSI_SetClientWeapon(VSI, Target->ClientHandle, ITEM_SHREDDER);
00316
00317 Target->Inventory[ITEM_SHREDDER] += SHREDDER_AMOUNT;
00318
00319
00320 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00321 {
00322 UpdateClientInventory(VSI, Target, ITEM_SHREDDER);
00323 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get the Shredder");
00324 }
00325
00326 return GE_TRUE;
00327 }
00328
00329
00330
00331
00332 static geBoolean Item_TriggerShredderAmmo(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00333 {
00334 GPlayer *Player, *Target;
00335
00336 Player = (GPlayer*)PlayerData;
00337 Target = (GPlayer*)TargetData;
00338
00339 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00340 return GE_TRUE;
00341
00342 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00343 return GE_TRUE;
00344
00345 if (Target->Inventory[ITEM_SHREDDER] >= SHREDDER_MAX_AMOUNT)
00346 return GE_TRUE;
00347
00348
00349 Player->ViewIndex = 0xffff;
00350 Player->NextThinkTime = GenVSI_GetTime(VSI) + SHREDDER_AMMO_RESPAWN;
00351
00352
00353 Target->Inventory[ITEM_SHREDDER] += SHREDDER_AMMO_AMOUNT;
00354
00355 if (Target->Inventory[ITEM_SHREDDER] > SHREDDER_MAX_AMOUNT)
00356 Target->Inventory[ITEM_SHREDDER] = SHREDDER_MAX_AMOUNT;
00357
00358 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON1, &Player->XForm.Translation);
00359
00360
00361 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00362 {
00363 UpdateClientInventory(VSI, Target, ITEM_SHREDDER);
00364 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get some Shredder Ammo");
00365 }
00366
00367 return GE_TRUE;
00368 }
00369
00370
00371
00372
00373 static geBoolean Item_TriggerGrenadeAmmo(GenVSI *VSI, void *PlayerData, void *TargetData, void* data)
00374 {
00375 GPlayer *Player, *Target;
00376
00377 Player = (GPlayer*)PlayerData;
00378 Target = (GPlayer*)TargetData;
00379
00380 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00381 return GE_TRUE;
00382
00383 if (Target->ClientHandle == CLIENT_NULL_HANDLE)
00384 return GE_TRUE;
00385
00386 if (Target->Inventory[ITEM_GRENADES] >= GRENADE_MAX_AMOUNT)
00387 return GE_TRUE;
00388
00389
00390 Player->ViewIndex = 0xffff;
00391 Player->NextThinkTime = GenVSI_GetTime(VSI) + GRENADE_AMMO_RESPAWN;
00392
00393
00394 Target->Inventory[ITEM_GRENADES] += GRENADE_AMMO_AMOUNT;
00395
00396 if (Target->Inventory[ITEM_GRENADES] > GRENADE_MAX_AMOUNT)
00397 Target->Inventory[ITEM_GRENADES] = GRENADE_MAX_AMOUNT;
00398
00399 GenVSI_PlaySound(VSI, SOUND_INDEX_PICKUP_WEAPON1, &Player->XForm.Translation);
00400
00401
00402 if (Target->ClientHandle != CLIENT_NULL_HANDLE)
00403 {
00404 UpdateClientInventory(VSI, Target, ITEM_GRENADES);
00405 GenVSI_ConsoleHeaderPrintf(VSI, Target->ClientHandle, GE_FALSE, "You get some Grenade Ammo");
00406 }
00407
00408 return GE_TRUE;
00409 }
00410
00411
00412
00413
00414 geBoolean Item_ControlHealth(GenVSI *VSI, void *PlayerData, float Time)
00415 {
00416 geVec3d Pos;
00417 GPlayer *Player;
00418
00419 Player = (GPlayer*)PlayerData;
00420
00421 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00422 return GE_TRUE;
00423
00424 if (Player->ViewIndex == 0xffff)
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 }
00442
00443
00444
00445
00446 geBoolean Item_ControlArmor(GenVSI *VSI, void *PlayerData, float Time)
00447 {
00448 geVec3d Pos;
00449 GPlayer *Player;
00450
00451 Player = (GPlayer*)PlayerData;
00452
00453 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00454 return GE_TRUE;
00455
00456 if (Player->ViewIndex == 0xffff)
00457 {
00458 Player->Roll = 0.0f;
00459 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00460 Player->ViewIndex = ACTOR_INDEX_ARMOR;
00461 }
00462 Pos = Player->XForm.Translation;
00463
00464 Player->XForm.Translation.X = 0.0f;
00465 Player->XForm.Translation.Y = 0.0f;
00466 Player->XForm.Translation.Z = 0.0f;
00467
00468 geXForm3d_RotateY(&Player->XForm, Time*2.0f);
00469
00470 Player->XForm.Translation = Pos;
00471
00472 return GE_TRUE;
00473 }
00474
00475
00476
00477
00478 static geBoolean Item_ControlRocket(GenVSI *VSI, void *PlayerData, float Time)
00479 {
00480 geVec3d Pos;
00481 GPlayer *Player;
00482
00483 Player = (GPlayer*)PlayerData;
00484
00485 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00486 return GE_TRUE;
00487
00488 if (Player->ViewIndex == 0xffff)
00489 {
00490 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00491 Player->ViewIndex = ACTOR_INDEX_ROCKET;
00492 }
00493
00494 Player->Roll += Time*2.0f;
00495
00496 if (Player->Roll > 3.14159f*2.0f)
00497 Player->Roll = 0.0f;
00498
00499 Pos = Player->XForm.Translation;
00500
00501 geXForm3d_SetYRotation(&Player->XForm, Player->Roll);
00502
00503 Player->XForm.Translation = Pos;
00504
00505 return GE_TRUE;
00506 }
00507
00508
00509
00510
00511
00512 static geBoolean Item_ControlRocketAmmo(GenVSI *VSI, void *PlayerData, float Time)
00513 {
00514 GPlayer *Player;
00515
00516 Player = (GPlayer*)PlayerData;
00517
00518 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00519 return GE_TRUE;
00520
00521 if (Player->ViewIndex == 0xffff)
00522 {
00523 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00524 Player->ViewIndex = ACTOR_INDEX_ROCKET_AMMO;
00525 }
00526
00527 return GE_TRUE;
00528 }
00529
00530
00531
00532
00533 static geBoolean Item_ControlGrenade(GenVSI *VSI, void *PlayerData, float Time)
00534 {
00535 GPlayer *Player;
00536
00537 Player = (GPlayer*)PlayerData;
00538
00539 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00540 return GE_TRUE;
00541
00542 if (Player->ViewIndex == 0xffff)
00543 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00544
00545
00546 Player->ViewIndex = ACTOR_INDEX_GRENADE;
00547
00548 return GE_TRUE;
00549 }
00550
00551
00552
00553
00554 static geBoolean Item_ControlGrenadeAmmo(GenVSI *VSI, void *PlayerData, float Time)
00555 {
00556 GPlayer *Player;
00557
00558 Player = (GPlayer*)PlayerData;
00559
00560 if (GenVSI_GetTime(VSI) < Player->NextThinkTime)
00561 return GE_TRUE;
00562
00563 if (Player->ViewIndex == 0xffff)
00564 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_ITEM_SPAWN);
00565
00566
00567 Player->ViewIndex = ACTOR_INDEX_GRENADE_AMMO;
00568
00569 return GE_TRUE;
00570 }
00571
00572
00573
00574
00575 geBoolean Item_HealthSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
00576 {
00577 ItemHealth *Health;
00578 GPlayer *Player;
00579
00580 Player = (GPlayer*)PlayerData;
00581
00582 Player->Control = Item_ControlHealth;
00583
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
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
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
00613 Player->XForm.Translation = Health->Origin;
00614
00615 Player->VPos = Player->XForm.Translation;
00616
00617 return GE_TRUE;
00618 }
00619
00620
00621
00622
00623 geBoolean Item_ArmorSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
00624 {
00625 ItemArmor *Armor;
00626 GPlayer *Player;
00627
00628 Player = (GPlayer*)PlayerData;
00629
00630 Player->Control = Item_ControlArmor;
00631
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
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
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
00661 Player->XForm.Translation = Armor->Origin;
00662
00663 Player->VPos = Player->XForm.Translation;
00664
00665 return GE_TRUE;
00666 }
00667
00668
00669
00670
00671 geBoolean Item_RocketSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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
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 }
00712
00713
00714
00715
00716 geBoolean Item_RocketAmmoSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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
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 }
00753
00754
00755
00756
00757 geBoolean Item_GrenadeSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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
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 }
00798
00799
00800
00801
00802 geBoolean Item_GrenadeAmmoSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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
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 }
00843
00844
00845
00846
00847 geBoolean Item_ShredderSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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
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 }
00888
00889
00890
00891
00892 geBoolean Item_ShredderAmmoSpawn(GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName)
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
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 }
00933