00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "revolt.h"
00019 #include "main.h"
00020 #include "dx.h"
00021 #include "geom.h"
00022 #include "model.h"
00023 #include "texture.h"
00024 #include "particle.h"
00025 #include "aerial.h"
00026 #include "play.h"
00027 #include "NewColl.h"
00028 #include "Body.h"
00029 #include "car.h"
00030 #include "input.h"
00031 #include "text.h"
00032 #include "shadow.h"
00033 #include "camera.h"
00034 #include "light.h"
00035 #include "world.h"
00036 #include "draw.h"
00037 #include "DrawObj.h"
00038 #include "visibox.h"
00039 #include "level.h"
00040 #include "ctrlread.h"
00041 #include "obj_init.h"
00042 #include "object.h"
00043 #include "control.h"
00044 #include "move.h"
00045 #include "gameloop.h"
00046 #include "level.h"
00047 #include "editai.h"
00048 #include "editobj.h"
00049 #include "editzone.h"
00050 #include "instance.h"
00051 #include "Player.h"
00052 #include "timing.h"
00053 #include "Ghost.h"
00054 #include "Registry.h"
00055 #include "edittrig.h"
00056 #include "trigger.h"
00057 #include "editcam.h"
00058 #include "edfield.h"
00059 #include "sfx.h"
00060 #include "panel.h"
00061 #include "ai.h"
00062 #include "edportal.h"
00063 #include "weapon.h"
00064 #ifdef _PC
00065 #include "spark.h"
00066 #endif
00067
00068
00069
00070 bool DrawGridCollSkin = FALSE;
00071 int NPhysicsLoops = 0;
00072
00073 static bool DrawRearView = FALSE;
00074 static CAMERA *RearCamera;
00075 static bool DrawGhostView = FALSE;
00076 static CAMERA *GhostCamera;
00077 static long PawsSelect;
00078
00079 #if SHOW_PHYSICS_INFO
00080 static bool PhysicsInfoTog = FALSE;
00081 #endif
00082
00083 #if USE_DEBUG_ROUTINES
00084 extern REAL DBG_dt;
00085 #endif
00086
00087
00088
00089 #if RECORD_AVI
00090 static void RecordAvi(void);
00091 long AviFrame = 0, AviRecord = FALSE;
00092 #endif
00093
00094
00095
00096 #if GHOST_TAKEOVER
00097 static void GhostTakeover(void);
00098 long GhostTakeoverFlag = FALSE, GhostTakeoverTime = 0;
00099 REAL CamTime = ZERO;
00100 REAL ChangeCamTime = Real(5);
00101 #endif
00102
00103 #if CHECK_ZZZ
00104 extern void CheckZZZ(void);
00105 #endif
00106
00107
00108
00109 char *PawsMenuText[] = {
00110 "RESUME",
00111 " QUIT",
00112 };
00113
00114
00115
00116 void GLP_GameLoop(void)
00117 {
00118 int iStep;
00119 long j;
00120 char buf[256];
00121
00122
00123
00124 #if GHOST_TAKEOVER
00125 GhostTakeover();
00126 #endif
00127
00128
00129
00130 CheckCheatStrings();
00131
00132
00133
00134 Reset3dPolyList();
00135
00136
00137
00138 FrameCount++;
00139 UpdateTimeFactor();
00140 UpdateRaceTimers();
00141
00142
00143
00144 StoreGhostData(&PLR_LocalPlayer->car);
00145
00146
00147
00148 ReadMouse();
00149 ReadKeyboard();
00150 ReadJoystick();
00151
00152
00153
00154 MaintainAllSfx();
00155
00156
00157
00158 CON_DoPlayerControl();
00159
00160
00161
00162 CRD_CheckLocalKeys();
00163
00164
00165
00166 if (!GameSettings.Paws)
00167 {
00168 ResetMeshFxList();
00169 }
00170
00171
00172
00173 ResetOilSlickList();
00174
00175
00176
00177 if (!GameSettings.Paws)
00178 {
00179 AI_ProcessAllAIs();
00180 }
00181
00182
00183
00184 if (!GameSettings.Paws)
00185 {
00186 NPhysicsLoops = 1 + (int) (TimeStep * MAX_TIMESTEP);
00187 TimeStep /= Real(NPhysicsLoops);
00188 for (iStep = 0; iStep < NPhysicsLoops; iStep++) {
00189
00190
00191
00192 COL_DoObjectCollisions();
00193
00194
00195 MOV_MoveObjects();
00196 }
00197 TimeStep *= Real(NPhysicsLoops);
00198 }
00199
00200
00201
00202 if (!GameSettings.Paws)
00203 {
00204 if (GameSettings.GameType == GAMETYPE_SERVER || GameSettings.GameType == GAMETYPE_CLIENT)
00205 {
00206 SendLocalCarData();
00207 GetRemoteMessages();
00208 }
00209 }
00210
00211
00212
00213 BuildAllCarWorldMatrices();
00214
00215
00216
00217 ProcessLights();
00218
00219
00220
00221 if (!GameSettings.Paws)
00222 {
00223 ProcessSparks();
00224 }
00225
00226
00227
00228 ProcessTextureAnimations();
00229
00230
00231
00232 CheckTriggers();
00233
00234
00235
00236 if (Keys[DIK_R] && !LastKeys[DIK_R])
00237 {
00238 DrawRearView = !DrawRearView;
00239 if (DrawRearView) {
00240 RearCamera = AddCamera(32, 32, 128, 128, CAMERA_FLAG_SECONDARY);
00241 SetCameraFollow(RearCamera, PLR_LocalPlayer->ownobj, CAM_FOLLOW_FRONT);
00242 } else {
00243 RemoveCamera(RearCamera);
00244 }
00245 }
00246
00247
00248
00249 if (Keys[DIK_G] && !LastKeys[DIK_G])
00250 {
00251 DrawGhostView = !DrawGhostView;
00252 if (DrawGhostView) {
00253 GhostCamera = AddCamera(480, 32, 128, 128, CAMERA_FLAG_SECONDARY);
00254 SetCameraFollow(GhostCamera, GHO_GhostPlayer->ownobj, CAM_FOLLOW_CLOSE);
00255 } else {
00256 RemoveCamera(GhostCamera);
00257 }
00258 }
00259
00260
00261
00262 CheckSurfaces();
00263 FlipBuffers();
00264
00265
00266
00267 #if RECORD_AVI
00268 RecordAvi();
00269 #endif
00270
00271
00272
00273 D3Ddevice->BeginScene();
00274
00275
00276
00277 for (CameraCount = 0 ; CameraCount < MAX_CAMERAS ; CameraCount++) if (Camera[CameraCount].Flag != CAMERA_FLAG_FREE)
00278 {
00279
00280
00281
00282 UpdateCamera(&Camera[CameraCount]);
00283
00284
00285
00286 SetViewport(Camera[CameraCount].X, Camera[CameraCount].Y, Camera[CameraCount].Xsize, Camera[CameraCount].Ysize, BaseGeomPers + Camera[CameraCount].Lens);
00287 InitRenderStates();
00288 ClearBuffers();
00289
00290 SetCameraView(&Camera[CameraCount].WMatrix, &Camera[CameraCount].WPos, Camera[CameraCount].Shake);
00291 SetCameraVisiMask(&Camera[CameraCount].WPos);
00292
00293
00294
00295 ResetSemiList();
00296
00297 if (DrawGridCollSkin)
00298 {
00299 DrawGridCollPolys(PosToCollGrid(&PLR_LocalPlayer->car.Body->Centre.Pos));
00300 }
00301 else
00302 {
00303 DrawWorld();
00304 DrawInstances();
00305 }
00306
00307 DrawObjects();
00308 DrawAllCars();
00309 Draw3dPolyList();
00310
00311
00312
00313
00314
00315
00316
00317
00318 if (EditMode != EDIT_NONE)
00319 {
00320 FlushPolyBuckets();
00321
00322 if (EditMode == EDIT_LIGHTS) DrawFileLights();
00323 if (EditMode == EDIT_VISIBOXES) DrawVisiBoxes();
00324 if (EditMode == EDIT_OBJECTS) DrawFileObjects();
00325 if (EditMode == EDIT_AINODES) DrawAiNodes();
00326 if (EditMode == EDIT_ZONES) DrawFileZones();
00327 if (EditMode == EDIT_TRIGGERS) DrawTriggers();
00328 if (EditMode == EDIT_CAM || EditMode == EDIT_TRIGGERS) DrawEditCamNodes();
00329 if (EditMode == EDIT_FIELDS) DrawFields();
00330 if (EditMode == EDIT_PORTALS) DrawPortals();
00331 }
00332
00333
00334
00335 if (AI_Testing)
00336 {
00337 if (PLR_LocalPlayer->CarAI.CurNode)
00338 {
00339 DrawModel(&EditAiNodeModel[0], &IdentityMatrix, &PLR_LocalPlayer->CarAI.CurNode->Node[0].Pos, MODEL_PLAIN);
00340 DrawModel(&EditAiNodeModel[1], &IdentityMatrix, &PLR_LocalPlayer->CarAI.CurNode->Node[1].Pos, MODEL_PLAIN);
00341 }
00342 }
00343
00344
00345
00346 FlushPolyBuckets();
00347 FlushEnvBuckets();
00348
00349
00350
00351 DrawSemiList();
00352 DrawSparks();
00353 DrawTrails();
00354 DrawSkidMarks();
00355 DrawAllCarShadows();
00356 DrawAllGhostCars();
00357
00358
00359
00360 if (Camera[CameraCount].Flag == CAMERA_FLAG_PRIMARY)
00361 {
00362
00363
00364
00365 if (EditMode != EDIT_NONE)
00366 {
00367 if (EditMode == EDIT_LIGHTS) EditFileLights();
00368 if (EditMode == EDIT_VISIBOXES) EditVisiBoxes();
00369 if (EditMode == EDIT_OBJECTS) EditFileObjects();
00370 if (EditMode == EDIT_INSTANCES) EditInstances();
00371 if (EditMode == EDIT_AINODES) EditAiNodes();
00372 if (EditMode == EDIT_ZONES) EditFileZones();
00373 if (EditMode == EDIT_TRIGGERS) EditTriggers();
00374 if (EditMode == EDIT_CAM) EditCamNodes();
00375 if (EditMode == EDIT_FIELDS) EditFields();
00376 if (EditMode == EDIT_PORTALS) EditPortals();
00377 }
00378
00379
00380
00381 DrawControlPanel();
00382
00383
00384
00385 BeginTextState();
00386
00387
00388
00389 if (GameSettings.GameType == GAMETYPE_SERVER || GameSettings.GameType == GAMETYPE_CLIENT)
00390 DisplayPlayers();
00391
00392
00393
00394 if (CAM_MainCamera->Type == CAM_EDIT)
00395 {
00396 if (EditMode == EDIT_LIGHTS && CurrentEditLight) DisplayLightInfo(CurrentEditLight);
00397 if (EditMode == EDIT_VISIBOXES && CurrentVisiBox) DisplayVisiBoxInfo(CurrentVisiBox);
00398 if (EditMode == EDIT_OBJECTS && CurrentFileObject) DisplayFileObjectInfo(CurrentFileObject);
00399 if (EditMode == EDIT_INSTANCES && CurrentInstance) DisplayInstanceInfo(CurrentInstance);
00400 if (EditMode == EDIT_AINODES && CurrentEditAiNode) DisplayAiNodeInfo(CurrentEditAiNode);
00401 if (EditMode == EDIT_ZONES && CurrentFileZone) DisplayZoneInfo(CurrentFileZone);
00402 if (EditMode == EDIT_TRIGGERS && CurrentTrigger) DisplayTriggerInfo(CurrentTrigger);
00403 if (EditMode == EDIT_CAM && CurrentEditCamNode) DisplayCamNodeInfo(CurrentEditCamNode);
00404 if (EditMode == EDIT_FIELDS && CurrentField) DisplayFieldInfo(CurrentField);
00405 if (EditMode == EDIT_PORTALS && CurrentPortal) DisplayPortalInfo(CurrentPortal);
00406
00407 DrawMousePointer(0xffffff);
00408 }
00409
00410 if (EditMode == EDIT_VISIBOXES) DisplayCamVisiMask();
00411 if (EditMode == EDIT_ZONES) DisplayCurrentTrackZone();
00412
00413
00414
00415
00416
00417
00418
00419 #if SCREEN_DEBUG
00420 FrameTime = TimerCurrent;
00421 if (FrameTime - FrameTimeLast > TimerFreq / 2)
00422 {
00423 FrameRate = (FrameCount - FrameCountLast) * TimerFreq / (FrameTime - FrameTimeLast);
00424 FrameTimeLast = FrameTime;
00425 FrameCountLast = FrameCount;
00426 }
00427
00428 wsprintf(buf, "%d", FrameRate);
00429 DumpText(0, 0, 8, 16, 0xffff00, buf);
00430
00431 static long screendebugshow = 0;
00432 if (Keys[DIK_F9] && !LastKeys[DIK_F9] && Everything) screendebugshow = !screendebugshow;
00433
00434 if (screendebugshow)
00435 {
00436 wsprintf(buf, "State %d, %d Lights %d Car %d, %d, %d", RenderStateChange, TextureStateChange, TotalLightCount, (long)PLR_LocalPlayer->car.Body->Centre.Pos.v[X], (long)PLR_LocalPlayer->car.Body->Centre.Pos.v[Y], (long)PLR_LocalPlayer->car.Body->Centre.Pos.v[Z]);
00437 DumpText(176, 0, 8, 16, 0xffffff, buf);
00438
00439 wsprintf(buf, "Cube %d, %d World %d, %d Model %d, %d", WorldBigCubeCount, WorldCubeCount, WorldPolyCount, WorldDrawnCount, ModelPolyCount, ModelDrawnCount);
00440 DumpText(0, 464, 8, 16, 0xffffff, buf);
00441 }
00442
00443 #endif
00444
00445
00446
00447 #if SCREEN_TIMES
00448 static long recordshow = 0;
00449 if (Keys[DIK_F10] && !LastKeys[DIK_F10] && Everything) recordshow = (recordshow + 1) % 3;
00450
00451 if (recordshow == 1)
00452 {
00453 for (j = 0 ; j < MAX_RECORD_TIMES ; j++)
00454 {
00455 wsprintf(buf, "%02d:%02d:%03d %6.6s - %6.6s", MINUTES(TrackRecords.RecordLap[j].Time), SECONDS(TrackRecords.RecordLap[j].Time), THOUSANDTHS(TrackRecords.RecordLap[j].Time), TrackRecords.RecordLap[j].Player, TrackRecords.RecordLap[j].Car);
00456 DumpText(16, 128 + j * 16, 8, 16, 0x00ffff, buf);
00457 }
00458 }
00459 if (recordshow == 2)
00460 {
00461 for (j = 0 ; j < MAX_RECORD_TIMES ; j++)
00462 {
00463 wsprintf(buf, "%02d:%02d:%03d %6.6s - %6.6s", MINUTES(TrackRecords.RecordRace[j].Time), SECONDS(TrackRecords.RecordRace[j].Time), THOUSANDTHS(TrackRecords.RecordRace[j].Time), TrackRecords.RecordRace[j].Player, TrackRecords.RecordRace[j].Car);
00464 DumpText(16, 128 + j * 16, 8, 16, 0x00ffff, buf);
00465 }
00466 }
00467 #endif
00468
00469
00470
00471 if (Keys[DIK_F12] && !LastKeys[DIK_F12] && !DetailMenuTogg && (Keys[DIK_LSHIFT] || Everything))
00472 {
00473 DetailMenuTogg = TRUE;
00474 }
00475 if (Keys[DIK_ESCAPE] && !LastKeys[DIK_ESCAPE] && DetailMenuTogg)
00476 {
00477 DetailMenuTogg = FALSE;
00478 LastKeys[DIK_ESCAPE] = TRUE;
00479 }
00480 if (DetailMenuTogg) DetailMenu();
00481
00482
00483
00484
00485 if (GameSettings.Paws)
00486 {
00487 if (PawsMenu())
00488 {
00489 LEV_EndLevel();
00490 Event = GoFront;
00491 }
00492 }
00493
00494 if (Keys[DIK_ESCAPE] && !LastKeys[DIK_ESCAPE] && !DetailMenuTogg && !GameSettings.Paws)
00495 {
00496 GameSettings.Paws = TRUE;
00497 PawsSelect = 0;
00498 SetMouseExclusive(FALSE);
00499 PauseAllSfx();
00500 }
00501
00502
00503
00504 #if SHOW_PHYSICS_INFO
00505 if (Keys[DIK_F11] && !LastKeys[DIK_F11] && Everything) PhysicsInfoTog = !PhysicsInfoTog;
00506 if (PhysicsInfoTog) ShowPhysicsInfo();
00507 #endif
00508
00509
00510
00511 #if CHECK_ZZZ
00512 CheckZZZ();
00513 #endif
00514
00515 }
00516 }
00517
00518
00519
00520 D3Ddevice->EndScene();
00521 }
00522
00524
00526
00527 long PawsMenu(void)
00528 {
00529 long i, col;
00530
00531
00532
00533 if (Keys[DIK_UP] && !LastKeys[DIK_UP] && PawsSelect) PawsSelect--;
00534 if (Keys[DIK_DOWN] && !LastKeys[DIK_DOWN] && PawsSelect < PAWS_MENU_NUM - 1) PawsSelect++;
00535
00536
00537
00538 for (i = 0 ; i < PAWS_MENU_NUM ; i++)
00539 {
00540 if (i == PawsSelect)
00541 col = 0xffffff;
00542 else
00543 col = 0x808080;
00544
00545
00546
00547 SET_TPAGE(TPAGE_BIGFONT);
00548 DumpBigText(248, i * 32 + 208, 24, 32, col, PawsMenuText[i]);
00549 SET_TPAGE(TPAGE_FONT);
00550 }
00551
00552
00553
00554 if (Keys[DIK_RETURN] && !LastKeys[DIK_RETURN])
00555 {
00556 SetMouseExclusive(TRUE);
00557
00558 if (PawsSelect == PAWS_MENU_RESUME)
00559 {
00560 GameSettings.Paws = FALSE;
00561 ResumeAllSfx();
00562 }
00563
00564 if (PawsSelect == PAWS_MENU_QUIT)
00565 {
00566 return TRUE;
00567 }
00568 }
00569
00570
00571
00572 return FALSE;
00573 }
00574
00576
00578 #if RECORD_AVI
00579
00580 static void RecordAvi(void)
00581 {
00582 char buf[128];
00583
00584
00585
00586 if (!AviRecord && Keys[DIK_1])
00587 {
00588 AviRecord = TRUE;
00589 }
00590
00591
00592
00593 if (AviRecord && Keys[DIK_2])
00594 {
00595 AviRecord = FALSE;
00596 }
00597
00598
00599
00600 if (AviRecord)
00601 {
00602 wsprintf(buf, "..\\avi\\scr%05d.bmp", AviFrame);
00603 SaveFrontBuffer(buf);
00604 AviFrame++;
00605 }
00606 }
00607 #endif
00608
00610
00612 #if GHOST_TAKEOVER
00613
00614 extern GHOST_DATA *BestGhostData;
00615
00616 long GhostWeapon[] = {
00617 OBJECT_TYPE_SHOCKWAVE,
00618 OBJECT_TYPE_FIREWORK,
00619 OBJECT_TYPE_WATERBOMB,
00620 OBJECT_TYPE_ELECTROPULSE,
00621 OBJECT_TYPE_CHROMEBALL,
00622 };
00623
00624 static void GhostTakeover(void)
00625 {
00626 long i, keys;
00627 static bool ForceGhostCam = FALSE;
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650 if ((CAM_MainCamera->Type == CAM_EDIT) || (CAM_MainCamera->Type == CAM_FREEDOM))
00651 return;
00652
00653
00654
00655 keys = (PLR_LocalPlayer->controls.dx | PLR_LocalPlayer->controls.dy);
00656
00657 if (!keys) for (i = 0 ; i < 256 ; i++)
00658 {
00659 if ((keys = Keys[i])) break;
00660 }
00661
00662 if (Keys[DIK_F6] && !LastKeys[DIK_F6]) {
00663 ForceGhostCam = !ForceGhostCam;
00664 if (ForceGhostCam) {
00665 SetCameraRail(CAM_MainCamera, GHO_GhostPlayer->ownobj, 1);
00666 } else {
00667 GhostTakeoverFlag = FALSE;
00668 GhostTakeoverTime = 0;
00669 SetCameraFollow(CAM_MainCamera, PLR_LocalPlayer->ownobj, 0);
00670 }
00671 }
00672
00673 if (Keys[DIK_F7] && !LastKeys[DIK_F7]) {
00674 if (CAM_MainCamera->Object == GHO_GhostPlayer->ownobj) {
00675 CAM_MainCamera->Object = PLR_LocalPlayer->ownobj;
00676 } else {
00677 CAM_MainCamera->Object = GHO_GhostPlayer->ownobj;
00678 }
00679 InitCamPos(CAM_MainCamera);
00680 }
00681
00682
00683
00684 if (!GhostTakeoverFlag && !ForceGhostCam)
00685 {
00686 GhostTakeoverTime += (long)(TimeStep * 1000.0f);
00687 if (keys) GhostTakeoverTime = 0;
00688 if (GhostTakeoverTime > GHOST_TAKEOVER_TIME)
00689 {
00690 GhostTakeoverFlag = TRUE;
00691 SetCameraRail(CAM_MainCamera, GHO_GhostPlayer->ownobj, 1);
00692 }
00693 }
00694
00695
00696
00697 else
00698 {
00699 if (GHO_BestFrame > GHO_BestGhostInfo->NFrames - 3)
00700 {
00701 GHO_BestFrame = 0;
00702 GHO_GhostPlayer->car.CurrentLapStartTime = TimerCurrent -
00703 (GHO_GhostPlayer->car.CurrentLapTime - BestGhostData[GHO_BestGhostInfo->NFrames - 1].Time);
00704
00705 }
00706
00707
00708
00709 if (CamTime > ChangeCamTime) {
00710 REAL choice;
00711
00712 CamTime = ZERO;
00713 ChangeCamTime = Real(2) + frand(6);
00714
00715 choice = frand(100);
00716 if (choice < 50) {
00717
00718 SetCameraRail(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_RAIL_STATIC_NEAREST);
00719 } else if (choice < 58) {
00720
00721 SetCameraFollow(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_FOLLOW_BEHIND);
00722 } else if (choice < 66) {
00723
00724 SetCameraFollow(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_FOLLOW_CLOSE);
00725 } else if (choice < 74) {
00726
00727 SetCameraFollow(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_FOLLOW_LEFT);
00728 } else if (choice < 82) {
00729
00730 SetCameraFollow(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_FOLLOW_RIGHT);
00731 } else if (choice < 90) {
00732
00733 SetCameraFollow(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_FOLLOW_FRONT);
00734 } else {
00735
00736 SetCameraAttached(CAM_MainCamera, GHO_GhostPlayer->ownobj, CAM_ATTACHED_INCAR);
00737 }
00738 } else {
00739 CamTime += TimeStep;
00740 }
00741
00742 if (keys && !ForceGhostCam)
00743 {
00744 GhostTakeoverFlag = FALSE;
00745 GhostTakeoverTime = 0;
00746 SetCameraFollow(CAM_MainCamera, PLR_LocalPlayer->ownobj, 0);
00747 }
00748 }
00749 }
00750 #endif
00751
00753
00755
00756 #if CHECK_ZZZ
00757
00758 static void CheckZZZ(void)
00759 {
00760 FILE *fp;
00761 char name[256], action[256], mess[256], user[256];
00762 static char lastmp3[256], lastmess[256];
00763 static float time = 0.0f;
00764 short ch, i;
00765 DWORD size;
00766
00767
00768
00769 DumpText(0, 128, 16, 32, 0xffff00, lastmess);
00770
00771
00772
00773 time -= TimeStep;
00774 if (time > 0.0f)
00775 return;
00776
00777 time = 10.0f;
00778
00779 lastmess[0] = 0;
00780
00781 size = 256;
00782 GetUserName(user, &size);
00783
00784
00785
00786 if ((fp = fopen("n:\\!\\!!!!!!!!", "r")) == NULL)
00787 return;
00788
00789
00790
00791 while (TRUE)
00792 {
00793
00794
00795
00796 if (fscanf(fp, "%s%s", name, action) == EOF)
00797 break;
00798
00799
00800
00801 if (!strcmp(name, "ALL") || !strcmp(name, user))
00802 {
00803
00804
00805
00806 if (!strcmp(action, "QUIT"))
00807 {
00808 QuitGame = TRUE;
00809 return;
00810 }
00811
00812
00813
00814 do {
00815 ch = fgetc(fp);
00816 } while (ch != '\'' && ch != EOF);
00817
00818 i = 0;
00819 while (TRUE)
00820 {
00821 ch = fgetc(fp);
00822 if (ch != '\'' && ch != EOF && i < 255)
00823 {
00824 mess[i] = (char)ch;
00825 i++;
00826 }
00827 else
00828 {
00829 mess[i] = 0;
00830 break;
00831 }
00832 }
00833
00834
00835
00836 if (!strcmp(action, "MP3"))
00837 {
00838 if (strcmp(lastmp3, mess))
00839 {
00840 strcpy(lastmp3, mess);
00841 StopMP3();
00842 PlayMP3(mess);
00843 }
00844 }
00845
00846
00847
00848 else if (!strcmp(action, "TEXT"))
00849 {
00850 strcpy(lastmess, mess);
00851 }
00852 }
00853
00854
00855
00856 do {
00857 ch = fgetc(fp);
00858 } while (ch != '\n' && ch != EOF);
00859 }
00860
00861
00862
00863 fclose(fp);
00864
00865 }
00866 #endif