00001
00002 #include "revolt.h"
00003 #include "main.h"
00004 #include "camera.h"
00005 #include "input.h"
00006 #include "level.h"
00007 #include "model.h"
00008 #include "editobj.h"
00009 #include "text.h"
00010 #include "draw.h"
00011 #include "ctrlread.h"
00012 #include "object.h"
00013
00014
00015
00016 EDIT_OBJECT *CurrentFileObject;
00017
00018 static long UsedFileObjectCount;
00019 static EDIT_OBJECT *FileObjectList;
00020 static EDIT_OBJECT *UsedFileObjectHead;
00021 static EDIT_OBJECT *FreeFileObjectHead;
00022
00023 static long FileObjectModelNum;
00024 static MODEL *FileObjectModels;
00025 static char FileObjectAxis = 0, FileObjectAxisType = 0;
00026 static long CurrentFileObjectFlag = -1;
00027
00028
00029
00030 static char *FileObjectAxisNames[] = {
00031 "X Y",
00032 "X Z",
00033 "Z Y",
00034 "X",
00035 "Y",
00036 "Z",
00037 };
00038
00039 static char *FileObjectAxisTypeNames[] = {
00040 "Camera",
00041 "World",
00042 };
00043
00045
00047
00048 long InitFileObjects(void)
00049 {
00050 long i;
00051
00052
00053
00054 FileObjectList = (EDIT_OBJECT*)malloc(sizeof(EDIT_OBJECT) * MAX_EDIT_OBJECTS);
00055 if (!FileObjectList)
00056 {
00057 Box("ERROR", "Can't alloc memory for file objects", MB_OK);
00058 QuitGame = TRUE;
00059 return FALSE;
00060 }
00061
00062
00063
00064 UsedFileObjectHead = NULL;
00065
00066
00067
00068 FreeFileObjectHead = FileObjectList;
00069
00070 for (i = 0 ; i < MAX_EDIT_OBJECTS ; i++)
00071 {
00072 FileObjectList[i].Prev = &FileObjectList[i - 1];
00073 FileObjectList[i].Next = &FileObjectList[i + 1];
00074 }
00075
00076
00077
00078 FileObjectList[0].Prev = NULL;
00079 FileObjectList[MAX_EDIT_OBJECTS - 1].Next = NULL;
00080
00081
00082
00083 UsedFileObjectCount = 0;
00084
00085
00086
00087 return TRUE;
00088 }
00089
00091
00093
00094 void KillFileObjects(void)
00095 {
00096 if (FileObjectList)
00097 {
00098 free(FileObjectList);
00099 FileObjectList = NULL;
00100 }
00101 }
00102
00104
00106
00107 EDIT_OBJECT *AllocFileObject(void)
00108 {
00109 EDIT_OBJECT *obj;
00110
00111
00112
00113 if (!FreeFileObjectHead)
00114 {
00115 return NULL;
00116 }
00117
00118
00119
00120 obj = FreeFileObjectHead;
00121 FreeFileObjectHead = obj->Next;
00122
00123 if (FreeFileObjectHead)
00124 {
00125 FreeFileObjectHead->Prev = NULL;
00126 }
00127
00128
00129
00130 obj->Prev = NULL;
00131 obj->Next = UsedFileObjectHead;
00132 UsedFileObjectHead = obj;
00133
00134 if (obj->Next)
00135 {
00136 obj->Next->Prev = obj;
00137 }
00138
00139
00140
00141 UsedFileObjectCount++;
00142
00143
00144
00145 return obj;
00146 }
00147
00149
00151
00152 void FreeFileObject(EDIT_OBJECT *obj)
00153 {
00154
00155
00156
00157 if (!obj)
00158 {
00159 return;
00160 }
00161
00162
00163
00164 if (obj->Prev)
00165 {
00166 obj->Prev->Next = obj->Next;
00167 }
00168 else
00169 {
00170 UsedFileObjectHead = obj->Next;
00171 }
00172
00173 if (obj->Next)
00174 {
00175 obj->Next->Prev = obj->Prev;
00176 }
00177
00178
00179
00180 obj->Prev = NULL;
00181 obj->Next = FreeFileObjectHead;
00182 FreeFileObjectHead = obj;
00183
00184 if (obj->Next)
00185 {
00186 obj->Next->Prev = obj;
00187 }
00188
00189
00190
00191 UsedFileObjectCount--;
00192 }
00193
00195
00197
00198 void LoadFileObjects(char *file)
00199 {
00200 long i, j;
00201 FILE *fp;
00202 EDIT_OBJECT *obj;
00203 FILE_OBJECT fileobj;
00204
00205
00206
00207 fp = fopen(file, "rb");
00208
00209
00210
00211 if (!fp)
00212 {
00213 fp = fopen(file, "wb");
00214 if (!fp) return;
00215 i = 0;
00216 fwrite(&i, sizeof(i), 1, fp);
00217 fclose(fp);
00218 fp = fopen(file, "rb");
00219 if (!fp) return;
00220 }
00221
00222
00223
00224 fread(&i, sizeof(i), 1, fp);
00225
00226 for ( ; i ; i--)
00227 {
00228
00229
00230
00231 obj = AllocFileObject();
00232 if (!obj) break;
00233
00234
00235
00236 fread(&fileobj, sizeof(fileobj), 1, fp);
00237
00238 VecMulScalar(&fileobj.Pos, EditScale);
00239
00240
00241
00242 obj->ID = fileobj.ID;
00243
00244
00245
00246 for (j = 0 ; j < FILE_OBJECT_FLAG_NUM ; j++)
00247 obj->Flag[j] = fileobj.Flag[j];
00248
00249
00250
00251 obj->Pos = fileobj.Pos;
00252
00253
00254
00255 obj->Mat.mv[U] = fileobj.Up;
00256 obj->Mat.mv[L] = fileobj.Look;
00257 CrossProduct(&obj->Mat.mv[U], &obj->Mat.mv[L], &obj->Mat.mv[R]);
00258 }
00259
00260
00261
00262 fclose(fp);
00263 }
00264
00266
00268
00269 void SaveFileObjects(char *file)
00270 {
00271 long i;
00272 FILE *fp;
00273 FILE_OBJECT fileobj;
00274 EDIT_OBJECT *obj;
00275 char bak[256];
00276
00277
00278
00279 memcpy(bak, file, strlen(file) - 3);
00280 wsprintf(bak + strlen(file) - 3, "fo-");
00281 remove(bak);
00282 rename(file, bak);
00283
00284
00285
00286 fp = fopen(file, "wb");
00287 if (!fp) return;
00288
00289
00290
00291 fwrite(&UsedFileObjectCount, sizeof(UsedFileObjectCount), 1, fp);
00292
00293
00294
00295 for (obj = UsedFileObjectHead ; obj ; obj = obj->Next)
00296 {
00297
00298
00299
00300 fileobj.ID = obj->ID;
00301
00302
00303
00304 for (i = 0 ; i < FILE_OBJECT_FLAG_NUM ; i++)
00305 fileobj.Flag[i] = obj->Flag[i];
00306
00307
00308
00309 fileobj.Pos = obj->Pos;
00310
00311
00312
00313 fileobj.Up = obj->Mat.mv[U];
00314 fileobj.Look = obj->Mat.mv[L];
00315
00316
00317
00318 fwrite(&fileobj, sizeof(fileobj), 1, fp);
00319 }
00320
00321
00322
00323 Box("Saved Object File:", file, MB_OK);
00324 fclose(fp);
00325 }
00326
00328
00330
00331 void EditFileObjects(void)
00332 {
00333 long i, j, flag;
00334 EDIT_OBJECT *obj, *nobj;
00335 VEC vec, vec2, r, u, l, r2, u2, l2;
00336 MAT mat, mat2;
00337 float xrad, yrad, z, sx, sy;
00338
00339
00340
00341 if (CAM_MainCamera->Type != CAM_EDIT)
00342 {
00343 CurrentFileObject = NULL;
00344 return;
00345 }
00346
00347
00348
00349 if (MouseRight)
00350 {
00351 RotMatrixZYX(&mat, (float)-Mouse.lY / 3072, -(float)Mouse.lX / 3072, 0);
00352 MulMatrix(&CAM_MainCamera->WMatrix, &mat, &mat2);
00353 CopyMatrix(&mat2, &CAM_MainCamera->WMatrix);
00354
00355 CAM_MainCamera->WMatrix.m[RY] = 0;
00356 NormalizeVector(&CAM_MainCamera->WMatrix.mv[X]);
00357 CrossProduct(&CAM_MainCamera->WMatrix.mv[Z], &CAM_MainCamera->WMatrix.mv[X], &CAM_MainCamera->WMatrix.mv[Y]);
00358 NormalizeVector(&CAM_MainCamera->WMatrix.mv[Y]);
00359 CrossProduct(&CAM_MainCamera->WMatrix.mv[X], &CAM_MainCamera->WMatrix.mv[Y], &CAM_MainCamera->WMatrix.mv[Z]);
00360 }
00361
00362
00363
00364 if (Keys[DIK_LCONTROL] && Keys[DIK_F4] && !LastKeys[DIK_F4])
00365 {
00366 SaveFileObjects(GetLevelFilename("fob", FILENAME_MAKE_BODY | FILENAME_GAME_SETTINGS));
00367 }
00368
00369
00370
00371 if (!CurrentFileObject && Keys[DIK_RETURN] && !LastKeys[DIK_RETURN])
00372 {
00373 nobj = NULL;
00374 z = RenderSettings.FarClip;
00375
00376 for (obj = UsedFileObjectHead ; obj ; obj = obj->Next)
00377 {
00378 RotTransVector(&ViewMatrix, &ViewTrans, &obj->Pos, &vec);
00379
00380 if (vec.v[Z] < RenderSettings.NearClip || vec.v[Z] >= RenderSettings.FarClip) continue;
00381
00382 sx = vec.v[X] * RenderSettings.GeomPers / vec.v[Z] + REAL_SCREEN_XHALF;
00383 sy = vec.v[Y] * RenderSettings.GeomPers / vec.v[Z] + REAL_SCREEN_YHALF;
00384
00385 xrad = (64 * RenderSettings.GeomPers) / vec.v[Z];
00386 yrad = (64 * RenderSettings.GeomPers) / vec.v[Z];
00387
00388 if (MouseXpos > sx - xrad && MouseXpos < sx + xrad && MouseYpos > sy - yrad && MouseYpos < sy + yrad)
00389 {
00390 if (vec.v[Z] < z)
00391 {
00392 nobj = obj;
00393 z = vec.v[Z];
00394 }
00395 }
00396 }
00397 if (nobj)
00398 {
00399 CurrentFileObject = nobj;
00400 return;
00401 }
00402 }
00403
00404
00405
00406 if (Keys[DIK_INSERT] && !LastKeys[DIK_INSERT])
00407 {
00408 if ((obj = AllocFileObject()))
00409 {
00410 vec.v[X] = 0;
00411 vec.v[Y] = 0;
00412 vec.v[Z] = 256;
00413 RotVector(&CAM_MainCamera->WMatrix, &vec, &vec2);
00414 obj->Pos.v[X] = CAM_MainCamera->WPos.v[X] + vec2.v[X];
00415 obj->Pos.v[Y] = CAM_MainCamera->WPos.v[Y] + vec2.v[Y];
00416 obj->Pos.v[Z] = CAM_MainCamera->WPos.v[Z] + vec2.v[Z];
00417
00418 RotMatrixZYX(&obj->Mat, 0, 0, 0);
00419
00420 obj->ID = 0;
00421
00422 for (i = 0 ; i < FILE_OBJECT_FLAG_NUM ; i++)
00423 obj->Flag[i] = 0;
00424
00425 CurrentFileObject = obj;
00426 }
00427 }
00428
00429
00430
00431 if (!CurrentFileObject) return;
00432
00433
00434
00435 if (Keys[DIK_RETURN] && !LastKeys[DIK_RETURN])
00436 {
00437 CurrentFileObject = NULL;
00438 return;
00439 }
00440
00441
00442
00443 if (Keys[DIK_DELETE] && !LastKeys[DIK_DELETE])
00444 {
00445 FreeFileObject(CurrentFileObject);
00446 CurrentFileObject = NULL;
00447 return;
00448 }
00449
00450
00451
00452 if (MouseLeft && !MouseLastLeft && Keys[DIK_LSHIFT])
00453 {
00454 if ((obj = AllocFileObject()))
00455 {
00456 memcpy(obj, CurrentFileObject, sizeof(EDIT_OBJECT) - 8);
00457 CurrentFileObject = obj;
00458 return;
00459 }
00460 }
00461
00462
00463
00464 if (Keys[DIK_TAB] && !LastKeys[DIK_TAB])
00465 {
00466 if (Keys[DIK_LSHIFT]) FileObjectAxis--;
00467 else FileObjectAxis++;
00468 if (FileObjectAxis == -1) FileObjectAxis = 5;
00469 if (FileObjectAxis == 6) FileObjectAxis = 0;
00470 }
00471
00472
00473
00474 if (Keys[DIK_LALT] && !LastKeys[DIK_LALT])
00475 FileObjectAxisType ^= 1;
00476
00477
00478
00479 j = 0;
00480 for (i = 0 ; i < FILE_OBJECT_FLAG_NUM ; i++)
00481 {
00482 if (FileObjectInfo[CurrentFileObject->ID].FlagInfo[i].Name)
00483 {
00484 j++;
00485
00486 if (CurrentFileObject->Flag[i] < FileObjectInfo[CurrentFileObject->ID].FlagInfo[i].Min)
00487 CurrentFileObject->Flag[i] = (char)FileObjectInfo[CurrentFileObject->ID].FlagInfo[i].Min;
00488 if (CurrentFileObject->Flag[i] > FileObjectInfo[CurrentFileObject->ID].FlagInfo[i].Max)
00489 CurrentFileObject->Flag[i] = (char)FileObjectInfo[CurrentFileObject->ID].FlagInfo[i].Max;
00490 }
00491 }
00492
00493
00494
00495 if (Keys[DIK_LSHIFT]) LastKeys[DIK_LEFT] = LastKeys[DIK_RIGHT] = 0;
00496
00497 if (Keys[DIK_UP] && !LastKeys[DIK_UP])
00498 CurrentFileObjectFlag--;
00499 if (Keys[DIK_DOWN] && !LastKeys[DIK_DOWN])
00500 CurrentFileObjectFlag++;
00501
00502 if (CurrentFileObjectFlag < -1) CurrentFileObjectFlag = j - 1;
00503 if (CurrentFileObjectFlag >= j) CurrentFileObjectFlag = -1;
00504
00505
00506
00507 if (CurrentFileObjectFlag == -1)
00508 {
00509 flag = CurrentFileObject->ID;
00510 if (Keys[DIK_LEFT] && !LastKeys[DIK_LEFT])
00511 {
00512 flag--;
00513 while (FileObjectInfo[flag].ModelID == -2) flag--;
00514 if (flag < 0) flag = 0;
00515 }
00516
00517 if (Keys[DIK_RIGHT] && !LastKeys[DIK_RIGHT])
00518 {
00519 flag++;
00520 while (FileObjectInfo[flag].ModelID == -2) flag++;
00521 if (FileObjectInfo[flag].ModelID == -1)
00522 {
00523 flag--;
00524 while (FileObjectInfo[flag].ModelID == -2) flag--;
00525 }
00526 }
00527 CurrentFileObject->ID = flag;
00528 }
00529
00530
00531
00532 else
00533 {
00534 for (i = j = 0 ; i < CurrentFileObjectFlag ; i++)
00535 {
00536 if (FileObjectInfo[CurrentFileObject->ID].FlagInfo[i].Name) j++;
00537 }
00538
00539 flag = CurrentFileObject->Flag[j];
00540
00541 if (Keys[DIK_LEFT] && !LastKeys[DIK_LEFT]) flag--;
00542 if (Keys[DIK_RIGHT] && !LastKeys[DIK_RIGHT]) flag++;
00543
00544 if (flag < FileObjectInfo[CurrentFileObject->ID].FlagInfo[j].Min)
00545 flag = FileObjectInfo[CurrentFileObject->ID].FlagInfo[j].Max;
00546 if (flag > FileObjectInfo[CurrentFileObject->ID].FlagInfo[j].Max)
00547 flag = FileObjectInfo[CurrentFileObject->ID].FlagInfo[j].Min;
00548
00549 CurrentFileObject->Flag[j] = flag;
00550 }
00551
00552
00553
00554 if (MouseLeft)
00555 {
00556 RotTransVector(&ViewMatrix, &ViewTrans, &CurrentFileObject->Pos, &vec);
00557
00558 switch (FileObjectAxis)
00559 {
00560 case FILE_OBJECT_AXIS_XY:
00561 vec.v[X] = MouseXrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditXrel;
00562 vec.v[Y] = MouseYrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditYrel;
00563 vec.v[Z] = CameraEditZrel;
00564 break;
00565 case FILE_OBJECT_AXIS_XZ:
00566 vec.v[X] = MouseXrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditXrel;
00567 vec.v[Y] = CameraEditYrel;
00568 vec.v[Z] = -MouseYrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditZrel;
00569 break;
00570 case FILE_OBJECT_AXIS_ZY:
00571 vec.v[X] = CameraEditXrel;
00572 vec.v[Y] = MouseYrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditYrel;
00573 vec.v[Z] = MouseXrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditZrel;
00574 break;
00575 case FILE_OBJECT_AXIS_X:
00576 vec.v[X] = MouseXrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditXrel;
00577 vec.v[Y] = CameraEditYrel;
00578 vec.v[Z] = CameraEditZrel;
00579 break;
00580 case FILE_OBJECT_AXIS_Y:
00581 vec.v[X] = CameraEditXrel;
00582 vec.v[Y] = MouseYrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditYrel;
00583 vec.v[Z] = CameraEditZrel;
00584 break;
00585 case FILE_OBJECT_AXIS_Z:
00586 vec.v[X] = CameraEditXrel;
00587 vec.v[Y] = CameraEditYrel;
00588 vec.v[Z] = -MouseYrel * vec.v[Z] / RenderSettings.GeomPers + CameraEditZrel;
00589 break;
00590 }
00591
00592 if (FileObjectAxisType == 1)
00593 {
00594 SetVector(&vec2, vec.v[X], vec.v[Y], vec.v[Z]);
00595 }
00596 else
00597 {
00598 RotVector(&CAM_MainCamera->WMatrix, &vec, &vec2);
00599 }
00600
00601 CurrentFileObject->Pos.v[X] += vec2.v[X];
00602 CurrentFileObject->Pos.v[Y] += vec2.v[Y];
00603 CurrentFileObject->Pos.v[Z] += vec2.v[Z];
00604 }
00605
00606
00607
00608 vec.v[X] = vec.v[Y] = vec.v[Z] = 0;
00609
00610 if (Keys[DIK_NUMPAD7]) vec.v[X] -= 0.001f;
00611 if (Keys[DIK_NUMPAD4]) vec.v[X] += 0.001f;
00612 if (Keys[DIK_NUMPAD8]) vec.v[Y] -= 0.001f;
00613 if (Keys[DIK_NUMPAD5]) vec.v[Y] += 0.001f;
00614 if (Keys[DIK_NUMPAD9]) vec.v[Z] -= 0.001f;
00615 if (Keys[DIK_NUMPAD6]) vec.v[Z] += 0.001f;
00616
00617 if (Keys[DIK_NUMPAD1] && !LastKeys[DIK_NUMPAD1]) vec.v[X] += 0.25f;
00618 if (Keys[DIK_NUMPAD2] && !LastKeys[DIK_NUMPAD2]) vec.v[Y] += 0.25f;
00619 if (Keys[DIK_NUMPAD3] && !LastKeys[DIK_NUMPAD3]) vec.v[Z] += 0.25f;
00620
00621 if (Keys[DIK_NUMPAD0]) CopyMatrix(&IdentityMatrix, &CurrentFileObject->Mat);
00622
00623 RotMatrixZYX(&mat, vec.v[X], vec.v[Y], vec.v[Z]);
00624
00625 if (FileObjectAxisType)
00626 {
00627 MulMatrix(&mat, &CurrentFileObject->Mat, &mat2);
00628 CopyMatrix(&mat2, &CurrentFileObject->Mat);
00629 NormalizeMatrix(&CurrentFileObject->Mat);
00630 }
00631 else if (vec.v[X] || vec.v[Y] || vec.v[Z])
00632 {
00633 RotVector(&ViewMatrix, &CurrentFileObject->Mat.mv[X], &r);
00634 RotVector(&ViewMatrix, &CurrentFileObject->Mat.mv[Y], &u);
00635 RotVector(&ViewMatrix, &CurrentFileObject->Mat.mv[Z], &l);
00636
00637 RotVector(&mat, &r, &r2);
00638 RotVector(&mat, &u, &u2);
00639 RotVector(&mat, &l, &l2);
00640
00641 RotVector(&CAM_MainCamera->WMatrix, &r2, &CurrentFileObject->Mat.mv[X]);
00642 RotVector(&CAM_MainCamera->WMatrix, &u2, &CurrentFileObject->Mat.mv[Y]);
00643 RotVector(&CAM_MainCamera->WMatrix, &l2, &CurrentFileObject->Mat.mv[Z]);
00644
00645 NormalizeMatrix(&CurrentFileObject->Mat);
00646 }
00647 }
00648
00650
00652
00653 void DrawFileObjects(void)
00654 {
00655 EDIT_OBJECT *obj;
00656 MODEL *model;
00657
00658
00659
00660 for (obj = UsedFileObjectHead ; obj ; obj = obj->Next)
00661 {
00662
00663
00664
00665 if (obj->ID == OBJECT_TYPE_PLANET && obj->Flag[0] != PLANET_SUN)
00666 model = &FileObjectModels[FileObjectInfo[obj->ID].ModelID + obj->Flag[0]];
00667 else if (obj->ID == OBJECT_TYPE_STROBE)
00668 model = &FileObjectModels[FileObjectInfo[obj->ID].ModelID + obj->Flag[0]];
00669 else
00670 model = &FileObjectModels[FileObjectInfo[obj->ID].ModelID];
00671
00672 DrawModel(model, &obj->Mat, &obj->Pos, MODEL_PLAIN);
00673
00674 if (obj->ID == OBJECT_TYPE_COPTER) {
00675 DrawBoundingBox(
00676 obj->Pos.v[X] - ((float)obj->Flag[0] * 10),
00677 obj->Pos.v[X] + ((float)obj->Flag[0] * 10),
00678 obj->Pos.v[Y] - ((float)obj->Flag[1] * 10) - ((float)obj->Flag[3] * 50),
00679 obj->Pos.v[Y] + ((float)obj->Flag[1] * 10) - ((float)obj->Flag[3] * 50),
00680 obj->Pos.v[Z] - ((float)obj->Flag[2] * 10),
00681 obj->Pos.v[Z] + ((float)obj->Flag[2] * 10),
00682 0xff0000, 0x00ff00, 0x0000ff, 0x00ffff, 0xff00ff, 0xffff00);
00683 }
00684
00685
00686
00687
00688 if (obj == CurrentFileObject)
00689 {
00690 if (FileObjectAxisType)
00691 DrawAxis(&IdentityMatrix, &obj->Pos);
00692 else
00693 DrawAxis(&CAM_MainCamera->WMatrix, &obj->Pos);
00694 }
00695 }
00696 }
00697
00699
00701
00702 void DisplayFileObjectInfo(EDIT_OBJECT *obj)
00703 {
00704 short y;
00705 long i;
00706 char buf[128];
00707 FILE_OBJECT_INFO *info = &FileObjectInfo[obj->ID];
00708
00709
00710
00711 DumpText(400, 0, 8, 16, 0xffff00, info->ObjName);
00712
00713
00714
00715 y = 24;
00716 for (i = 0 ; i < FILE_OBJECT_FLAG_NUM ; i++)
00717 {
00718
00719
00720
00721 if (!info->FlagInfo[i].Name)
00722 continue;
00723
00724
00725
00726 if (!info->FlagInfo[i].Type)
00727 wsprintf(buf, "%s: %d", info->FlagInfo[i].Name, obj->Flag[i]);
00728 else
00729 wsprintf(buf, "%s: %s", info->FlagInfo[i].Name, info->FlagInfo[i].Type[obj->Flag[i]]);
00730
00731 DumpText(400, y, 8, 16, 0x0000ff, buf);
00732
00733
00734
00735 y += 24;
00736 }
00737
00738
00739
00740 wsprintf(buf, "Axis %s - %s", FileObjectAxisNames[FileObjectAxis], FileObjectAxisTypeNames[FileObjectAxisType]);
00741 DumpText(400, y, 8, 16, 0xff00ff, buf);
00742
00743
00744
00745 DumpText(376, CurrentFileObjectFlag * 24 + 24, 8, 16, 0xff0000, "->");
00746 }
00747
00749
00751
00752 void LoadFileObjectModels(void)
00753 {
00754 long i;
00755
00756
00757
00758 FileObjectModelNum = 0;
00759 while (FileObjectModelList[FileObjectModelNum])
00760 FileObjectModelNum++;
00761
00762
00763
00764 FileObjectModels = (MODEL*)malloc(sizeof(MODEL) * FileObjectModelNum);
00765
00766
00767
00768 for (i = 0 ; i < FileObjectModelNum ; i++)
00769 {
00770 LoadModel(FileObjectModelList[i], &FileObjectModels[i], 0, 1, LOADMODEL_OFFSET_TPAGE, 100);
00771 }
00772 }
00773
00775
00777
00778 void FreeFileObjectModels(void)
00779 {
00780 long i;
00781
00782
00783
00784 for (i = 0 ; i < FileObjectModelNum ; i++)
00785 {
00786 FreeModel(&FileObjectModels[i], 1);
00787 }
00788
00789
00790
00791 free(FileObjectModels);
00792 }
00793