00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <Windows.h>
00016 #include <Assert.h>
00017
00018 #include "Genesis.h"
00019 #include "Errorlog.h"
00020 #include "Ram.h"
00021
00022 #include "Fx.h"
00023
00024 #include "..\\Procedurals\gebmutil.h"
00025
00026 static geBoolean ControlParticleAnim(Fx_System *Fx, Fx_TempPlayer *Player, float Time);
00027
00028 #define POLY_FLAGS (GE_RENDER_DEPTH_SORT_BF)
00029
00030
00031 extern geFloat EffectScale;
00032
00033 static char SmokeBitmapNames[NUM_SMOKE_TEXTURES][32] = {
00034 "Bmp\\Fx\\Smoke_01.Bmp",
00035 "Bmp\\Fx\\Smoke_02.Bmp",
00036 "Bmp\\Fx\\Smoke_03.Bmp",
00037 "Bmp\\Fx\\Smoke_04.Bmp",
00038 "Bmp\\Fx\\Smoke_05.Bmp",
00039 "Bmp\\Fx\\Smoke_06.Bmp",
00040 "Bmp\\Fx\\Smoke_07.Bmp",
00041 "Bmp\\Fx\\Smoke_08.Bmp",
00042 "Bmp\\Fx\\Smoke_09.Bmp",
00043 "Bmp\\Fx\\Smoke_10.Bmp"
00044 };
00045
00046 static char SmokeBitmapANames[NUM_SMOKE_TEXTURES][32] = {
00047 "Bmp\\Fx\\A_Smk01.Bmp",
00048 "Bmp\\Fx\\A_Smk02.Bmp",
00049 "Bmp\\Fx\\A_Smk03.Bmp",
00050 "Bmp\\Fx\\A_Smk04.Bmp",
00051 "Bmp\\Fx\\A_Smk05.Bmp",
00052 "Bmp\\Fx\\A_Smk06.Bmp",
00053 "Bmp\\Fx\\A_Smk07.Bmp",
00054 "Bmp\\Fx\\A_Smk08.Bmp",
00055 "Bmp\\Fx\\A_Smk09.Bmp",
00056 "Bmp\\Fx\\A_Smk10.Bmp",
00057 };
00058
00059 static char ExplodeBitmapNames[NUM_EXPLODE_TEXTURES][32] = {
00060 "Bmp\\Explode\\1EXP01.Bmp",
00061 "Bmp\\Explode\\1EXP02.Bmp",
00062 "Bmp\\Explode\\1EXP03.Bmp",
00063 "Bmp\\Explode\\1EXP04.Bmp",
00064 "Bmp\\Explode\\1EXP05.Bmp",
00065 "Bmp\\Explode\\1EXP06.Bmp"
00066 };
00067
00068 static char ExplodeBitmapANames[NUM_EXPLODE_TEXTURES][32] = {
00069 "Bmp\\Explode\\A_1EXP01.Bmp",
00070 "Bmp\\Explode\\A_1EXP02.Bmp",
00071 "Bmp\\Explode\\A_1EXP03.Bmp",
00072 "Bmp\\Explode\\A_1EXP04.Bmp",
00073 "Bmp\\Explode\\A_1EXP05.Bmp",
00074 "Bmp\\Explode\\A_1EXP06.Bmp"
00075 };
00076
00077 static char ParticleBitmapNames[NUM_PARTICLE_TEXTURES][32] = {
00078 "Bmp\\Fx\\Parti1.Bmp",
00079 "Bmp\\Fx\\Parti2.Bmp",
00080 "Bmp\\Fx\\Parti3.Bmp",
00081 "Bmp\\Fx\\Parti4.Bmp",
00082 "Bmp\\Fx\\Parti5.Bmp",
00083 "Bmp\\Fx\\Parti6.Bmp",
00084 "Bmp\\Fx\\Parti7.Bmp",
00085 "Bmp\\Fx\\Parti8.Bmp",
00086 };
00087
00088 static char ParticleBitmapANames[NUM_PARTICLE_TEXTURES][32] = {
00089 "Bmp\\Fx\\Parti1.Bmp",
00090 "Bmp\\Fx\\Parti2.Bmp",
00091 "Bmp\\Fx\\Parti3.Bmp",
00092 "Bmp\\Fx\\Parti4.Bmp",
00093 "Bmp\\Fx\\Parti5.Bmp",
00094 "Bmp\\Fx\\Parti6.Bmp",
00095 "Bmp\\Fx\\Parti7.Bmp",
00096 "Bmp\\Fx\\Parti8.Bmp",
00097 };
00098
00099
00100
00101
00102 static geBoolean StartupSmokeTrail(Fx_System *Fx, Fx_Player *Player);
00103 static geBoolean ShutdownSmokeTrail(Fx_System *Fx, Fx_Player *Player);
00104 static geBoolean LoadFxTextures(Fx_System *Fx);
00105 static geBoolean FreeFxTextures(Fx_System *Fx);
00106
00107 static geBoolean ControlExplode1Anim(Fx_System *Fx, Fx_TempPlayer *Player, float Time);
00108 static geBoolean ControlExplode2Anim(Fx_System *Fx, Fx_TempPlayer *Player, float Time);
00109
00110 static geBoolean ControlParticleTrail(Fx_System *Fx, Fx_Player *Player, float Time);
00111 static geBoolean ControlSmokeTrail(Fx_System *Fx, Fx_Player *Player, float Time);
00112 static geBoolean ControlShredderFx(Fx_System *Fx, Fx_Player *Player, float Time);
00113
00114
00115
00116
00117 Fx_System *Fx_SystemCreate(geWorld *World, Console_Console *Console)
00118 {
00119 Fx_System *Fx;
00120
00121 assert(World);
00122
00123
00124 Fx = GE_RAM_ALLOCATE_STRUCT(Fx_System);
00125
00126 if (!Fx)
00127 return NULL;
00128
00129 memset(Fx, 0, sizeof(Fx_System));
00130
00131 Fx->World = World;
00132 Fx->Console = Console;
00133
00134 if (!LoadFxTextures(Fx))
00135 {
00136 Fx_SystemDestroy(Fx);
00137 return NULL;
00138 }
00139
00140 return Fx;
00141 }
00142
00143
00144
00145
00146 void Fx_SystemDestroy(Fx_System *Fx)
00147 {
00148 geBoolean Ret;
00149
00150 assert(Fx);
00151
00152 Ret = FreeFxTextures(Fx);
00153
00154 assert(Ret == GE_TRUE);
00155
00156 geRam_Free(Fx);
00157 }
00158
00159
00160
00161
00162 geBoolean Fx_SystemFrame(Fx_System *Fx, float Time)
00163 {
00164 Fx_TempPlayer *Player;
00165 int32 i;
00166
00167
00168 Player = Fx->TempPlayers;
00169
00170 for (i=0; i< FX_MAX_TEMP_PLAYERS; i++, Player++)
00171 {
00172 if (!Player->Active)
00173 continue;
00174
00175 if (!Player->Control)
00176 continue;
00177
00178
00179 if (!Player->Control(Fx, Player, Time))
00180 return GE_FALSE;
00181 }
00182
00183 return GE_TRUE;
00184 }
00185
00186
00187
00188
00189 geBoolean Fx_SpawnFx(Fx_System *Fx, geVec3d *Pos, uint8 Type)
00190 {
00191 Fx_TempPlayer *TempPlayer;
00192
00193 TempPlayer = Fx_SystemAddTempPlayer(Fx);
00194
00195 if (!TempPlayer)
00196 return GE_TRUE;
00197
00198 TempPlayer->Pos = *Pos;
00199 TempPlayer->Time = 0.0f;
00200
00201 switch(Type)
00202 {
00203 case FX_EXPLODE1:
00204 TempPlayer->Control = ControlExplode1Anim;
00205 break;
00206
00207 case FX_EXPLODE2:
00208 TempPlayer->Control = ControlExplode2Anim;
00209 break;
00210
00211 default:
00212 return GE_FALSE;
00213 }
00214
00215 return GE_TRUE;
00216 }
00217
00218
00219
00220
00221 Fx_TempPlayer *Fx_SystemAddTempPlayer(Fx_System *Fx)
00222 {
00223 Fx_TempPlayer *Player, *End;
00224 int32 i;
00225
00226
00227 Player = Fx->CurrentTempPlayer;
00228
00229 if (!Player)
00230 Player = Fx->TempPlayers;
00231
00232 End = &Fx->TempPlayers[FX_MAX_TEMP_PLAYERS-1];
00233
00234 for (i=0; i< FX_MAX_TEMP_PLAYERS; i++)
00235 {
00236 if (!Player->Active)
00237 {
00238 Fx->CurrentTempPlayer = Player;
00239
00240 memset(Player, 0, sizeof(Fx_TempPlayer));
00241 Player->Active = GE_TRUE;
00242 return Player;
00243 }
00244
00245 Player++;
00246
00247 if (Player >= End)
00248 Player = Fx->TempPlayers;
00249 }
00250
00251 return NULL;
00252 }
00253
00254
00255
00256
00257 void Fx_SystemRemoveTempPlayer(Fx_System *Fx, Fx_TempPlayer *Player)
00258 {
00259 Player->Active = GE_FALSE;
00260
00261 Fx->CurrentTempPlayer = Player;
00262 }
00263
00264
00265
00266
00267 geBoolean Fx_PlayerSetFxFlags(Fx_System *Fx, Fx_Player *Player, uint16 FxFlags)
00268 {
00269 if (FxFlags == Player->FxFlags)
00270 return GE_TRUE;
00271
00272
00273
00274 if ((Player->FxFlags & FX_SMOKE_TRAIL) && !(FxFlags & FX_SMOKE_TRAIL))
00275 ShutdownSmokeTrail(Fx, Player);
00276 else if (!(Player->FxFlags & FX_SMOKE_TRAIL) && (FxFlags & FX_SMOKE_TRAIL))
00277 StartupSmokeTrail(Fx, Player);
00278
00279 Player->FxFlags = FxFlags;
00280
00281 return GE_TRUE;
00282 }
00283
00284
00285
00286
00287 geBoolean Fx_PlayerFrame(Fx_System *Fx, Fx_Player *Player, const geXForm3d *XForm, float Time)
00288 {
00289 Player->XForm = *XForm;
00290
00291 if (Player->FxFlags & FX_SMOKE_TRAIL)
00292 ControlSmokeTrail(Fx, Player, Time);
00293
00294 if (Player->FxFlags & FX_PARTICLE_TRAIL)
00295 ControlParticleTrail(Fx, Player, Time);
00296
00297 if (Player->FxFlags & FX_SHREDDER)
00298 ControlShredderFx(Fx, Player, Time);
00299
00300 return GE_TRUE;
00301 }
00302
00303
00304
00305
00306 static geBoolean StartupSmokeTrail(Fx_System *Fx, Fx_Player *Player)
00307 {
00308
00309
00310 return GE_TRUE;
00311 }
00312
00313
00314
00315
00316 static geBoolean ShutdownSmokeTrail(Fx_System *Fx, Fx_Player *Player)
00317 {
00318
00319
00320 return GE_TRUE;
00321 }
00322
00323
00324
00325
00326 static geBoolean ControlExplode1Anim(Fx_System *Fx, Fx_TempPlayer *Player, float Time)
00327 {
00328 GE_LVertex Vert;
00329 int32 Frame;
00330
00331 Player->Time += Time;
00332
00333 Vert.X = Player->Pos.X;
00334 Vert.Y = Player->Pos.Y;
00335 Vert.Z = Player->Pos.Z;
00336 Vert.r = Vert.g = Vert.b = Vert.a = 255.0f;
00337 Vert.u = Vert.v = 0.0f;
00338
00339 Frame = (int32)(Player->Time*20.0f);
00340
00341 if (Frame >= NUM_EXPLODE_TEXTURES)
00342 {
00343
00344 Frame = NUM_EXPLODE_TEXTURES-1;
00345 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->ExplodeBitmaps[Frame], GE_TEXTURED_POINT, GE_RENDER_DEPTH_SORT_BF, 10.0f * EffectScale);
00346 Fx_SystemRemoveTempPlayer(Fx, Player);
00347 }
00348 else
00349 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->ExplodeBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 10.0f * EffectScale);
00350
00351 return GE_TRUE;
00352 }
00353
00354
00355
00356
00357 static geBoolean ControlExplode2Anim(Fx_System *Fx, Fx_TempPlayer *Player, float Time)
00358 {
00359 GE_LVertex Vert;
00360 int32 Frame;
00361
00362 Player->Time += Time;
00363
00364 Vert.X = Player->Pos.X;
00365 Vert.Y = Player->Pos.Y;
00366 Vert.Z = Player->Pos.Z;
00367 Vert.r = Vert.g = 255.0f;
00368 Vert.b = 100.0f;
00369 Vert.a = 255.0f;
00370 Vert.u = Vert.v = 0.0f;
00371
00372 Frame = (int32)(Player->Time*20.0f);
00373
00374 if (Frame >= NUM_PARTICLE_TEXTURES)
00375 {
00376
00377 Frame = NUM_PARTICLE_TEXTURES-1;
00378 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->ParticleBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 8.0f * EffectScale);
00379 Fx_SystemRemoveTempPlayer(Fx, Player);
00380 }
00381 else
00382 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->ParticleBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 8.0f * EffectScale);
00383
00384 return GE_TRUE;
00385 }
00386
00387
00388
00389
00390 extern geVFile *MainFS;
00391 static geBoolean LoadFxTextures(Fx_System *Fx)
00392 {
00393 int32 i;
00394
00395 assert(Fx);
00396 assert(Fx->World);
00397
00398 for (i=0; i< NUM_SMOKE_TEXTURES; i++)
00399 {
00400 Fx->SmokeBitmaps[i] = geBitmapUtil_CreateFromFileAndAlphaNames(MainFS, SmokeBitmapNames[i], SmokeBitmapANames[i]);
00401
00402 if (!Fx->SmokeBitmaps[i])
00403 {
00404 char Str[1024];
00405 sprintf(Str, "%s, %s", SmokeBitmapNames[i], SmokeBitmapANames[i]);
00406 geErrorLog_AddString(-1, "Fx_LoadFxTextures: geBitmapUtil_CreateFromFileAndAlphaNames failed:", Str);
00407 goto ExitWithError;
00408 }
00409
00410 if (!geWorld_AddBitmap(Fx->World, Fx->SmokeBitmaps[i]))
00411 {
00412 geErrorLog_AddString(-1, "Fx_LoadFxTextures: geWorld_AddBItmap failed.", NULL);
00413 goto ExitWithError;
00414 }
00415 }
00416
00417 for (i=0; i< NUM_PARTICLE_TEXTURES; i++)
00418 {
00419 Fx->ParticleBitmaps[i] = geBitmapUtil_CreateFromFileAndAlphaNames(MainFS, ParticleBitmapNames[i], ParticleBitmapANames[i]);
00420
00421 if (!Fx->ParticleBitmaps[i])
00422 {
00423 char Str[1024];
00424 sprintf(Str, "%s, %s", ParticleBitmapNames[i], ParticleBitmapANames[i]);
00425 geErrorLog_AddString(-1, "Fx_LoadFxTextures: geBitmapUtil_CreateFromFileAndAlphaNames failed:", Str);
00426 goto ExitWithError;
00427 }
00428
00429 if (!geWorld_AddBitmap(Fx->World, Fx->ParticleBitmaps[i]))
00430 {
00431 geErrorLog_AddString(-1, "Fx_LoadFxTextures: geWorld_AddBItmap failed.", NULL);
00432 goto ExitWithError;
00433 }
00434 }
00435
00436 for (i=0; i< NUM_EXPLODE_TEXTURES; i++)
00437 {
00438 Fx->ExplodeBitmaps[i] = geBitmapUtil_CreateFromFileAndAlphaNames(MainFS, ExplodeBitmapNames[i], ExplodeBitmapANames[i]);
00439
00440 if (!Fx->ExplodeBitmaps[i])
00441 {
00442 char Str[1024];
00443 sprintf(Str, "%s, %s", ExplodeBitmapNames[i], ExplodeBitmapANames[i]);
00444 geErrorLog_AddString(-1, "Fx_LoadFxTextures: geBitmapUtil_CreateFromFileAndAlphaNames failed:", Str);
00445 goto ExitWithError;
00446 }
00447
00448 if (!geWorld_AddBitmap(Fx->World, Fx->ExplodeBitmaps[i]))
00449 {
00450 geErrorLog_AddString(-1, "Fx_LoadFxTextures: geWorld_AddBItmap failed.", NULL);
00451 goto ExitWithError;
00452 }
00453 }
00454
00455 return GE_TRUE;
00456
00457 ExitWithError:
00458 {
00459 FreeFxTextures(Fx);
00460
00461 return GE_FALSE;
00462 }
00463 }
00464
00465
00466
00467
00468 static geBoolean FreeFxTextures(Fx_System *Fx)
00469 {
00470 int32 i;
00471
00472 assert(Fx);
00473 assert(Fx->World);
00474
00475 for (i=0; i< NUM_SMOKE_TEXTURES; i++)
00476 {
00477 if (Fx->SmokeBitmaps[i])
00478 {
00479 geWorld_RemoveBitmap(Fx->World, Fx->SmokeBitmaps[i]);
00480 geBitmap_Destroy(&Fx->SmokeBitmaps[i]);
00481 Fx->SmokeBitmaps[i] = NULL;
00482 }
00483 }
00484
00485 for (i=0; i< NUM_PARTICLE_TEXTURES; i++)
00486 {
00487 if (Fx->ParticleBitmaps[i])
00488 {
00489 geWorld_RemoveBitmap(Fx->World, Fx->ParticleBitmaps[i]);
00490 geBitmap_Destroy(&Fx->ParticleBitmaps[i]);
00491 Fx->ParticleBitmaps[i] = NULL;
00492 }
00493 }
00494
00495 for (i=0; i< NUM_EXPLODE_TEXTURES; i++)
00496 {
00497 if (Fx->ExplodeBitmaps[i])
00498 {
00499 geWorld_RemoveBitmap(Fx->World, Fx->ExplodeBitmaps[i]);
00500 geBitmap_Destroy(&Fx->ExplodeBitmaps[i]);
00501 Fx->ExplodeBitmaps[i] = NULL;
00502 }
00503 }
00504
00505 return GE_TRUE;
00506 }
00507
00508
00509
00510
00511
00512
00513
00514
00515 static geBoolean ControlParticleAnim(Fx_System *Fx, Fx_TempPlayer *Player, float Time)
00516 {
00517 GE_LVertex Vert;
00518 int32 Frame;
00519
00520 Player->Time += Time;
00521
00522 Vert.X = Player->Pos.X;
00523 Vert.Y = Player->Pos.Y;
00524 Vert.Z = Player->Pos.Z;
00525 Vert.r = Vert.g = Vert.b = Vert.a = 255.0f;
00526 Vert.u = Vert.v = 0.0f;
00527
00528 Frame = (int32)(Player->Time*20.0f);
00529
00530 if (Frame >= NUM_PARTICLE_TEXTURES)
00531 {
00532
00533 Frame = NUM_PARTICLE_TEXTURES-1;
00534 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->ParticleBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 2.3f * EffectScale);
00535 Fx_SystemRemoveTempPlayer(Fx, Player);
00536 }
00537 else
00538 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->ParticleBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 2.3f * EffectScale);
00539
00540 return GE_TRUE;
00541 }
00542
00543
00544
00545
00546 static geBoolean ControlParticleTrail(Fx_System *Fx, Fx_Player *Player, float Time)
00547 {
00548 Fx_TempPlayer *TempPlayer;
00549
00550 Player->Time += Time;
00551
00552 if (Player->Time >= 0.04f)
00553 {
00554 TempPlayer = Fx_SystemAddTempPlayer(Fx);
00555
00556 if (!TempPlayer)
00557 return GE_TRUE;
00558
00559 TempPlayer->Control = ControlParticleAnim;
00560 TempPlayer->Pos = Player->XForm.Translation;
00561 TempPlayer->Time = 0.0f;
00562
00563 Player->Time = 0.0f;
00564 }
00565
00566 return GE_TRUE;
00567 }
00568
00569
00570
00571
00572 static geBoolean ControlSmokeAnim(Fx_System *Fx, Fx_TempPlayer *Player, float Time)
00573 {
00574 GE_LVertex Vert;
00575 int32 Frame;
00576
00577 Player->Time += Time + ((float)(rand()%1000) * (1.0f/1000.0f)* 0.1f);
00578
00579 Vert.X = Player->Pos.X;
00580 Vert.Y = Player->Pos.Y;
00581 Vert.Z = Player->Pos.Z;
00582 Vert.r = Vert.g = Vert.b = Vert.a = 255.0f;
00583 Vert.u = Vert.v = 0.0f;
00584
00585 Frame = (int32)(Player->Time*15.0f);
00586
00587 if (Frame >= NUM_SMOKE_TEXTURES)
00588 {
00589
00590 Frame = NUM_SMOKE_TEXTURES-1;
00591 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->SmokeBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 2.6f * EffectScale);
00592 Fx_SystemRemoveTempPlayer(Fx, Player);
00593 }
00594 else
00595 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->SmokeBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 2.6f * EffectScale);
00596
00597 return GE_TRUE;
00598 }
00599
00600
00601
00602
00603 static geBoolean ControlSmokeTrail(Fx_System *Fx, Fx_Player *Player, float Time)
00604 {
00605 Fx_TempPlayer *TempPlayer;
00606
00607 Player->Time += Time;
00608
00609 if (Player->Time >= 0.04f)
00610 {
00611 TempPlayer = Fx_SystemAddTempPlayer(Fx);
00612
00613 if (!TempPlayer)
00614 return GE_TRUE;
00615
00616 TempPlayer->Control = ControlSmokeAnim;
00617 TempPlayer->Pos = Player->XForm.Translation;
00618 TempPlayer->Time = 0.0f;
00619
00620 Player->Time = 0.0f;
00621 }
00622
00623 return GE_TRUE;
00624 }
00625
00626
00627
00628
00629 static geBoolean ControlShredderAnim(Fx_System *Fx, Fx_TempPlayer *Player, float Time)
00630 {
00631 GE_LVertex Vert;
00632 int32 Frame;
00633
00634 Player->Time += Time;
00635
00636 Vert.X = Player->Pos.X;
00637 Vert.Y = Player->Pos.Y;
00638 Vert.Z = Player->Pos.Z;
00639 Vert.r = Vert.g = Vert.b = Vert.a = 255.0f;
00640 Vert.u = Vert.v = 0.0f;
00641
00642 Frame = (int32)(Player->Time*20.0f);
00643
00644 if (Frame >= NUM_SMOKE_TEXTURES)
00645 {
00646
00647 Frame = NUM_SMOKE_TEXTURES-1;
00648 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->SmokeBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 0.6f * EffectScale);
00649 Fx_SystemRemoveTempPlayer(Fx, Player);
00650 }
00651 else
00652 geWorld_AddPolyOnce(Fx->World, &Vert, 1, Fx->SmokeBitmaps[Frame], GE_TEXTURED_POINT, POLY_FLAGS, 0.6f * EffectScale);
00653
00654 return GE_TRUE;
00655 }
00656
00657
00658
00659
00660 static geBoolean ControlShredderFx(Fx_System *Fx, Fx_Player *Player, float Time)
00661 {
00662 assert(Fx);
00663 assert(Player);
00664
00665 Player->Time += Time;
00666
00667 if (Player->Time >= 0.03f)
00668 {
00669 Fx_TempPlayer *TempPlayer;
00670 GE_Collision Collision;
00671 geVec3d Front, Back, In;
00672 geVec3d Mins = {-1.0f, -1.0f, -1.0f};
00673 geVec3d Maxs = { 1.0f, 1.0f, 1.0f};
00674
00675 TempPlayer = Fx_SystemAddTempPlayer(Fx);
00676
00677 if (!TempPlayer)
00678 return GE_TRUE;
00679
00680 TempPlayer->Control = ControlShredderAnim;
00681 TempPlayer->Time = 0.0f;
00682
00683 Front = Player->XForm.Translation;
00684
00685 geXForm3d_GetIn(&Player->XForm, &In);
00686 geVec3d_AddScaled(&Front, &In, 10000.0f, &Back);
00687
00688 if (geWorld_Collision(Fx->World, NULL, NULL, &Front, &Back, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_ACTORS | GE_COLLIDE_MODELS, 0xffffffff, NULL, NULL, &Collision))
00689 {
00690
00691 geVec3d_AddScaled(&Collision.Impact, &In, -50.0f, &Collision.Impact);
00692
00693
00694 Collision.Impact.X += (float)(rand()%15);
00695 Collision.Impact.Y += (float)(rand()%15);
00696 Collision.Impact.Z += (float)(rand()%15);
00697
00698 TempPlayer->Pos = Collision.Impact;
00699 }
00700 else
00701 TempPlayer->Pos = Player->XForm.Translation;
00702
00703 Player->Time = 0.0f;
00704 }
00705 return GE_TRUE;
00706 }
00707