-
Notifications
You must be signed in to change notification settings - Fork 255
/
Copy pathMainFrm.cpp
3693 lines (3130 loc) · 105 KB
/
MainFrm.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
--- HISTORICAL COMMENTS FOLLOW ---
* $Logfile: /DescentIII/Main/editor/MainFrm.cpp $
* $Revision: 1.1.1.1 $
* $Date: 2003-08-26 03:57:38 $
* $Author: kevinb $
*
* The editor main frame window
*
* $Log: not supported by cvs2svn $
*
* 164 10/29/99 4:34p Matt
* Added code (not being called) to count the number of specular faces in
* a level.
*
* 163 10/27/99 10:37a Matt
* Added some code (not being called in this version) to list all the
* objects in a level that use lightmaps.
*
* 162 10/25/99 12:54p Jeff
* test1 _really_ destroys all lightmaps
*
* 161 10/13/99 10:41a Chris
* Added 'special forcefields' that have custom bounce factors
*
* 160 9/15/99 1:56p Matt
* Added the option to allow rooms or groups placed on the terrain to
* either align with the terrain or with gravity.
*
* 159 8/18/99 11:29a Matt
* Added shortcuts for next vertex and add vert to face.
*
* 158 8/17/99 4:09p Matt
* Added some accelerator keys, and a function to copy face light
* multiples.
*
* 157 8/12/99 9:36a Matt
* Changed MoveEntireMine() code to move in both X and Y.
*
* 156 7/28/99 5:48p Matt
* Added test code to scale an entire mine.
*
* 155 5/22/99 4:40a Matt
* Fixed yet another small bug in the show-all-locked-pages code.
*
* 154 5/21/99 1:29p Matt
* Fixed tiny bug.
*
* 153 5/21/99 12:36p Matt
* Added test code to check for destroyable textures without a destroyed
* bitmap.
*
* 152 5/10/99 12:04a Matt
* Added function for Luke to shift the entire mine.
*
* 151 5/08/99 1:01p Matt
* Added a function for Luke to scale all the room light multipliers in a
* level.
*
* 150 5/08/99 1:39a Matt
* Added a function to delete all objects of a certain type, and support
* for placing and attaching groups to the terrain.
*
* 149 5/05/99 2:02a Matt
* Added a function to check for precision-error FVI cracks in the level.
*
* 148 5/03/99 2:56a Matt
* Added a function for Luke to delete all the faces in a room that have
* texture 1 on them.
*
* 147 5/02/99 9:23p Matt
* Notify the level keypad when the level has changed, and then re-init
* the combo boxes.
*
* 146 5/02/99 6:41a Jeff
* created 'test/temp' function to force unload all osiris modules
*
* 145 5/02/99 2:01a Jeff
* fixed crash in getchangemask
*
* 144 5/01/99 9:43p Matt
* Apparently, there's no longer a page called "DUMMY PAGE" in the list of
* locked pages, so remove the assert that checked for it.
*
* 143 4/29/99 11:51p Matt
* Improved viewer move functions.
*
* 142 4/29/99 3:19p Jeff
* test function 3 to grab non-physics set objects
*
* 141 4/23/99 4:55p Matt
* Fixed bug in previous version.
*
* 140 4/23/99 2:51p Matt
* Added function to relink objects from the terrain to the mine to fix
* one of Dan's levels.
*
* 139 4/21/99 10:36p Matt
* Fixed typo
*
* 138 4/21/99 10:20p Matt
* Fixed cut room message
*
* 137 4/17/99 6:15p Samir
* replaced gr.h with grdefs.h and fixed resulting compile bugs.
*
* 136 4/16/99 3:54p Nate
* Added Viewer Properties Dialog
*
* 135 4/12/99 12:50p Matt
* Added function to dump goal text to a file.
*
* 134 4/05/99 11:17a Matt
* Added code to list all the objects in the levels.
*
* 133 4/05/99 10:54a Matt
* Added auto-waypoint system
*
* 131 4/03/99 7:54p Matt
* Finished implementing spiffy keypad update system.
*
* 130 4/02/99 5:08p Matt
* Added intro movie.
*
* 129 3/30/99 6:24p Matt
* Added new error system, where instead of putting up an error message, a
* function returns a failure code & returns an error message that the
* caller can display if it wants.
*
* 128 3/30/99 4:09p Matt
* Fixed very small bug
*
* 127 3/30/99 11:25a Matt
* Re-enabled object reset code
*
* 126 3/25/99 4:11p Samir
* added aureal test code.
*
* 125 3/18/99 8:41p Jeff
* created orphan hunter dialog
*
* 124 3/15/99 4:04p Matt
* Added code to show a list of named rooms.
*
* 123 3/10/99 7:17p Samir
* added function that updates keypads.
*
* 122 3/01/99 6:26p Matt
* Added function to fix bad objects in Dan's level
*
* 121 2/23/99 11:51p Jeff
* new script dll sync dialog
*
* 120 2/22/99 11:39p Matt
* Deleted debris editor menu item, since it' no longer needed.
*
* 119 2/21/99 4:20p Matt
* Added SoundSource objects (and reformatted parts of the object header
* files).
*
* 118 2/05/99 1:29p Matt
* Added a function to show the viewer's forward vector. (Also checked
* select-object-by-number to use common code to print out the selected
* object info.)
*
* 117 2/03/99 1:10p Matt
* Changed the paletted room current faces to be stored in a separate
* array, instead of in the room structure.
*
* 116 2/03/99 1:20a Matt
* Added a system to show all pages locked.
*
* 115 2/01/99 11:36p Matt
* Added menu functions to select an object by number and move the viewer
* to the current object.
*
* 114 1/24/99 6:35p Matt
* Made view set functions behave differently in Room View
*
* 113 1/21/99 11:15p Jeff
* pulled out some structs and defines from header files and moved them
* into separate header files so that multiplayer dlls don't require major
* game headers, just those new headers. Side effect is a shorter build
* time. Also cleaned up some header file #includes that weren't needed.
* This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
* manage.h and multi.h
*
* 112 1/19/99 6:53p Matt
* Fixed a problem when the viewer was instantaneously moved from inside
* to ourside or vise-versa.
*
* 111 1/15/99 7:52p Chris
* Updated ObjSetPos() to include a f_update_attach_children flag
*
* 110 1/12/99 12:35p Nate
* Clicking on the DALLAS menu item now restores it if it was minimized
*
* 109 1/11/99 3:34p Jeff
* added checks for when going editor->game to see if scripts are out of
* date, if so give the option of breaking out. Add some options to mass
* script compiler, along with a toolbar shortcut.
*
* 108 1/08/99 2:56p Samir
* Ripped out OSIRIS1.
*
* 107 12/23/98 4:01p Nate
* Added code create Dallas as a modeless dialog
*
* 106 12/11/98 6:48p Nate
* Added support for starting D.A.L.L.A.S. from the main menu
*
* 105 12/11/98 5:50p Jeff
* implemented and added changes regarding Level&Scripting manage system
* and compiler interface
*
* 104 12/01/98 11:17p Matt
* Added menu option to disable drawing objects in the wireframe view
*
* 103 11/01/98 1:58a Jeff
* converted the vsprintf calls to use the Pvsprintf, which is a safe
* vsprintf, no buffer overflows allowed
*
* 102 10/21/98 12:50p Sean
* Allow for cameras to be placed on external rooms
*
* 101 10/14/98 4:37p Matt
* Made InitD3System() exit with error if there's a problem instead of
* returning a status value. Also moved some editor-specific code from
* init.cpp to mainfrm.cpp, and cleaned up some other initialization and
* error-handling code.
*
* 100 10/12/98 1:46p Samir
* new Program_version parameters.
*
* 99 10/08/98 4:23p Kevin
* Changed code to comply with memory library usage. Always use mem_malloc
* , mem_free and mem_strdup
*
* 98 10/06/98 12:38p Nate
*
* 97 10/04/98 1:25p Matt
*
* 96 10/02/98 1:43p Samir
* took out FULL_DEVELOPMENT
*
* 95 9/09/98 12:48p Samir
* added script localizer.
*
* 94 9/03/98 5:29p Matt
* Added code to fix cracks in levels.
*
* 93 9/03/98 2:20p Jeff
* flush keyboard after briefeditor exits
*
* 92 9/02/98 2:55p Jeff
* initial creation of briefing editor
*
* 91 8/31/98 4:37p Matt
* Added improved room & mine error checking.
*
* 90 8/27/98 6:42p Chris
* Added the goal keypad and the start of the matcen keypad
*
* 89 8/20/98 12:35p Matt
* Added nice editing for ambient sound patterns
*
* 88 8/13/98 1:06p Nate
* Disabled pausing of Editor when running TableTextEditor
*
* 87 8/10/98 12:14p Nate
* Added Table File Edit dialog.
*
* 86 7/08/98 6:26p Samir
* took out obsolete code.
*
* 85 7/01/98 4:58p Samir
* changed InitD3Systems.
*
* 84 6/29/98 6:45p Samir
* call WM_ACTIVATEAPP Descent Handler from mainframe.
*
* 83 6/25/98 7:16p Matt
* Added code to check for errors in portal linkage
*
* 82 5/01/98 3:57p Matt
* Added function to place a camera in the center of the current face.
*
* 81 4/21/98 2:40p Matt
* Added option to show level stats
*
* 80 4/16/98 6:39p Kevin
* made CKeypadDialog::Activate static.
*
* 79 4/14/98 7:50p Matt
* Added system to keep info for each level
*
* 78 3/27/98 6:05p Samir
* Added key handler for main frame.
*
* 77 3/23/98 8:03p Samir
* A bunch of changes to allow for ALT-TAB to work.
*
* 76 3/23/98 2:17p Jeff
* Included telcom.h
*
* 75 3/06/98 5:36p Matt
* Took out cfile try/catch for editor, since it's probably better to get
* the error in the cfile code when debugging, so you can look at the
* stack & parms and stuff. I've left try/catch in for the game, but
* ideally we'd take that out too when running under the debugger, if we
* could figure out how to do that.
*
* 74 2/17/98 6:13p Jeff
* Changed it so TelCom is forced to go into Briefings when called
*
* 73 2/15/98 7:44p Matt
* Added groovy try/catch/throw error checking for cfile functions
*
* 72 2/09/98 10:54a Matt
* Don't allow user to switch to mine view if there are no internal rooms
*
* 71 2/05/98 3:11p Matt
* Don't move the viewer to an external room.
*
* 70 2/05/98 2:57p Matt
* Changed code to use ObjSetPos()
*
* 69 2/04/98 6:23p Matt
* Changed object room number to indicate a terrain cell via a flag. Got
* rid of the object flag which used to indicate terrain.
*
* 68 1/30/98 6:07p Matt
* Added code and menu items to deal with camera objects
*
* 67 1/29/98 2:15p Samir
* Implemented ObjectListModeless and Toolbar button.
*
* 66 1/21/98 1:08p Matt
* Made SetViewMode() not take new_viewer parm, since it's not needed
* after my revamp of the editor view system.
*
* 65 1/21/98 12:33p Matt
* Revamped viewer system
*
* 64 12/02/97 4:43p Samir
* Repaired MainFrm.cpp
*
* 63 12/01/97 6:06p Samir
* Implemented new FileDialog tracker system.
*
* 62 11/17/97 3:53p Matt
* When deleting objects, set the pointers to them to NULL.
* Added test function to play the briefing.
*
* 61 10/22/97 4:30p Chris
* We can now slew between the mine and the terrain
*
* 60 10/16/97 7:35p Samir
* For fullscreen game from editor, hide all user interface elements of
* the editor window and use the client area for our display. It's REALLY
* hacked, but seems to be the cleanest method of playing the game in
* fullscreen. Old method of blanking window doesn't work.
*
* 59 10/15/97 5:20p Jason
* did a HUGE overhaul of the bitmap system
*
* 58 10/03/97 3:39p Matt
* Added separate sets of wireframe view variables for mine & room views
*
* 57 9/23/97 10:38a Jason
* Took out OnTerrain
*
* 56 9/23/97 10:27a Jason
* took premature return from OnFileImportRoom
*
* 55 9/22/97 5:59p Samir
* Changed ObjCScript system, so everything is broken, but it shouldn't
* crash the game.
*
* 53 9/17/97 12:58p Samir
* Got rid of Curve Keypad.
*
* 52 9/17/97 12:48p Samir
* Got rid of more obscure segment references.
*
* 51 9/17/97 11:30a Jason
* ripped out segment engine
*
* 50 9/16/97 4:27p Matt
* Got rid of static_light & changed fields in the room struct
*
* 49 9/11/97 5:38p Jason
* initial door coding for room engine
*
* 48 9/09/97 12:23p Samir
* Added a menu item to go to level properties dialog.
*
* 47 9/02/97 6:41p Matt
* Added code for group paste
*
* 46 8/29/97 5:45p Matt
* Made selection & cut/copy/past funcs work with rooms
*
* 45 8/29/97 2:49p Samir
* Nuked SegmentKeypad.
*
* 44 8/27/97 10:55a Samir
* Fixed bug when keypad is initally closed, and you toggle it, and the
* control bar looked fine, just no tab control.
*
* 43 8/21/97 7:48p Matt
* Added code to move player object (like old move player to curseg)
*
* 42 8/20/97 5:28p Samir
* Took out Desktop_surf init and put it into init.cpp
*
* 41 8/15/97 6:32p Samir
* Added ScriptWizard!
*
* 40 8/13/97 5:39p Samir
* Use CompileScript to compile a script now, and we compile default
* script at startup of editor.
*
* 39 8/12/97 5:47p Matt
* Added menu items to edit debris, clutter, & buildings
* Increased number of items in objpage dropdown box
*
* 38 8/12/97 3:22p Samir
* osi_Compile and D3XReallocProgram added parameters.
*
* 37 8/11/97 1:53p Matt
* Ripped out robot & powerup pages, and added generic page
*
* 36 8/08/97 3:30p Matt
* Fixed stupid bug
*
* 35 8/08/97 3:22p Jeff
* Added automatic OGF conversion when extracting HSM
*
* 34 8/08/97 3:09p Matt
* Added testing calls to new generic page dialog
*
* 33 8/08/97 2:51p Jeff
* added code to check if default script is locked
*
* 32 8/06/97 10:36a Samir
* Fixed osi_Compile calls.
*
* 31 8/04/97 4:12p Samir
* Call to osi_Compile uses new prototype.
*
* 30 8/04/97 12:42p Matt
* Made move viewer function work with room engine
*
* 29 8/01/97 2:36p Jeff
*
* 28 7/29/97 3:48p Jeff
*
* 27 7/29/97 2:19p Jason
* added filepage editor to mainframe
*
* 26 7/29/97 2:11p Jeff
* Added compile on exit for Osiris
*
* 25 7/29/97 12:17p Matt
* Made room:face display on status bar show different info for room,
* mine, and terrain views.
*
* 24 7/28/97 5:33p Matt
* Added function to change the view mode
*
* 23 7/28/97 10:51a Jeff
* Changed cha *DefaultExternalEditor to what it should be called, char
* Default_external_editor[256]
*
* 22 7/26/97 8:48p Jeff
* fixed up calls to script editor. Added DefaultExternalEditor global
* variable
*
* 21 7/25/97 6:16p Samir
* Fixed the tile-cascade switching/default madness.
*
* 20 7/24/97 3:00p Matt
* Save/load game & editor settings from/to the registry, and added code
* to display current keypad.
*
* 19 7/22/97 7:08p Matt
* Cleaned up D3EditState, moving some vars in and some out, and renaming
* and changing a few others
*
* 18 7/21/97 5:55p Jeff
*
* 17 7/21/97 4:05p Jeff
* fixed default path for external editor
*
* 16 7/21/97 3:21p Jeff
*
* 15 7/19/97 8:09p Jeff
*
* 14 7/18/97 5:36p Jason
* save changed paletted rooms on exit
*
* 13 7/18/97 5:17p Jeff
*
* 93 6/30/97 1:30p Jason
* added netherspace stuff
*
* 92 6/27/97 7:21p Matt
* Added function to move player 0 to current segment
*
* 91 6/27/97 3:10p Jason
*
* 90 6/27/97 12:19p Samir
* Added room keypad dialog
*
* 89 6/25/97 5:29p Jason
* added/modified code to display a room
*
* 88 6/18/97 11:56a Jason
* added some more terrain functions for Mark
*
*
* 87 6/13/97 2:18p Matt
* Added functions to change wireframe view target
*
* 86 6/11/97 1:07p Samir
* The removal of gameos and replaced with oeApplication, oeDatabase
*
* 85 6/10/97 5:08p Jason
* added reorderpages menu item
*
* 84 6/06/97 4:33p Jason
* added cool stuff for megacells
*
* 83 6/05/97 3:37p Samir
* Added megacell keypad.
*
* 82 6/05/97 2:52p Jason
* added megacell functions
*
* 81 6/03/97 4:55p Mark
*
* 81 6/03/97 4:39p Jeff
* Added code for Context sensitive help
*
* 80 6/02/97 2:31p Samir
* Music test code!
*
* 79 5/19/97 5:10p Jason
* changes for our new abstracted renderer code
*
* 78 5/13/97 7:27p Matt
* Added code to set & clear fuelcen flag in segments
*
* 77 5/13/97 12:04p Matt
* Added code to add a floating segment
*
* 76 5/05/97 3:37p Matt
*
* 75 4/30/97 5:52p Jason
* added ability to switch between 8bit/16bit modes
*
* 74 4/17/97 4:03p Samir
* Apply Tmap 1 and Tmap2 implemented, but no Tmap2 rendering is occurring
* yet.
*
* 73 4/17/97 11:08a Samir
* BuildBridge Implemented
*
* 72 4/16/97 6:11p Matt
* Added code to divide a segment into two
*
* 71 4/15/97 11:29a Samir
* Iimplemented menu item object placement and deletion.
*
* 70 4/11/97 4:59p Samir
* Grab texture menu item works.
*
* 69 4/08/97 10:42a Jason
* implemented path following interface
*
* 68 4/04/97 3:15p Samir
* Added paths keypad, removed player keypad since it's joined with object
* keypad.
*
* 67 4/03/97 1:20p Jason
* changes to get the sound page system playing
*
* 66 4/02/97 10:56a Matt
* Changed "Other" menu to "Object", and removed obsolete set-player-start
* option
*
* 65 4/01/97 11:00p Matt
* Changed editor to keep a viewer object (type camera) separate from the
* player object. This camera, and not the player, is now moved by
* slewing, the C key, etc. When going into the game, the viewer position
* & orientation are copied to the player. When going back to the editor,
* the player position is copied to the viewer, and the player object is
* reset to its start location.
*
* 64 3/31/97 5:58p Matt
* Revamped mine update flags
*
* 63 3/28/97 12:20p Jason
* added terrain dialog stuff, plus bitmap memory indicator
*
* 62 3/26/97 6:46p Samir
* Fixed order of tabs in dialog box.
*
* 61 3/26/97 5:48p Samir
* Keep splash screen up a bit longer.
*
* 60 3/26/97 4:37p Samir
* Splash screen up and running.
*
* 59 3/24/97 6:48p Samir
* Allow clean delete of door segments. AddDefaultSegment
*
* 58 3/21/97 12:30p Samir
* Added more keypad functionality and NET pane.
*
* 57 3/20/97 5:01p Matt
* Removed obsolete select-from-box code
*
* 56 3/20/97 11:55a Jason
* changes for terrain editing/drawing
*
* 55 3/17/97 2:26p Matt
* Added function to set player view from curseg/curside
*
* 54 3/17/97 1:32p Matt
* Took out redundant and unneeded handlers for View menu items.
*
* 53 3/17/97 12:25a Matt
* Added call to FormJoint(), and changed a bunch of code to use the
* SEGNUM() macro.
*
* 52 3/14/97 6:53p Samir
* Took out unused functions and added delete segment function.
*
* 51 3/14/97 12:50p Samir
* Added marked segment pane
*
* 50 3/13/97 7:02p Samir
* Added current segment:side pane.
*
* 49 3/13/97 12:09p Matt
* Switch to data\levels directory, so the Open file dialog will default
* to that directory.
*
* 48 3/12/97 3:25p Matt
* Added funcs for cut, copy, paste, & delete, and to save and load
* groups.
*
* 47 3/10/97 11:13a Samir
* Changes made to reflect deletion of OSDebug class from system
*
* 46 3/05/97 7:21p Samir
* Added special initialization code for editor and use osD3Winxxxx
* classes for os objects.
*
* 45 3/05/97 11:49a Samir
* Added doorway and terrain keypad tabs.
*
* 44 3/04/97 11:37a Samir
* Fixed goofup in tab ordering for trigger keypad.
*
* 43 3/03/97 5:23p Samir
* Create osDatabase and osDebug obejcts.
*
* 42 3/02/97 4:21p Matt
* Added code to select connected segments
*
* 41 2/28/97 6:40p Matt
* Call code to call box selection code
*
* 40 2/28/97 4:00p Matt
* Added code to handle the list of selected segments
*
* 39 2/28/97 2:37p Mark
*
* 38 2/28/97 11:09a Samir
* Fixed Play in 640x480 menu item.
*
* 37 2/28/97 11:03a Samir
* Changes to reflect newer gameos interface.
*
* 36 2/27/97 5:29p Mark
*
* 35 2/26/97 3:35p Mark
*
* 34 2/20/97 6:05p Samir
* Allow for clean activation and deactivation of surfaces in editor when
* going into fullscreen mode.
*
* 33 2/20/97 5:10p Samir
* Added Tmap1 and Tmap2 apply accels. Tmap1 works by doing a CTRL-1.
*
* 32 2/20/97 9:57a Matt
* Added Add Segment
*
* 31 2/19/97 5:39p Matt
* Made EditorStatus() take printf-type args, as the D1/D2 function did.
*
* 30 2/19/97 2:15p Samir
* Added keypad info.
*
* 29 2/18/97 7:04p Samir
* Added print status bar message functions
*
* 28 2/12/97 4:07p Samir
* Prompts for hogfile name when staring hog editor.
*
* 27 2/12/97 2:33p Samir
* Added hog dialog.
*
* 26 2/10/97 1:59p Jason
* Better import anim/bitmap functionality
*
* 25 2/06/97 2:46p Jason
* added import bitmap function
*
* 24 2/05/97 12:16p Samir
* Added menu item for preferences.
*
* 23 2/04/97 5:27p Samir
* Instead of GAME_MODE go to EDITOR_GAME_MODE when playing the level.
*
* 22 2/04/97 5:18p Samir
* Added Leaving editor... option in File Menu
*
* 21 1/30/97 6:43p Samir
* stupid forgetting an argument
*
* 20 1/30/97 6:24p Samir
* Reflect changes in ddgr system and game->editor->game stuff
*
* 19 1/23/97 4:35p Samir
* Added floating keypad toggle and support
*
* 18 1/21/97 12:45p Samir
* Toggle to get rid of keypad
*
* $NoKeywords: $
*/
#include <cstdarg>
#include <cstdio>
#include <filesystem>
#include "stdafx.h"
#include "editor.h"
// USER INTERFACE HEADERS
#include "MainFrm.h"
#include "editorDoc.h"
#include "editorView.h"
#include "TextureDialog.h"
#include "ObjectDialog.h"
#include "LightingDialog.h"
#include "MegacellKeypad.h"
#include "TriggerDialog.h"
#include "DoorwayDialog.h"
#include "TerrainDialog.h"
#include "WorldTexturesDialog.h"
#include "WorldWeaponsDialog.h"
#include "WorldObjectsDoorDialog.h"
#include "WorldObjectsLightDialog.h"
#include "WorldObjectsPlayerDialog.h"
#include "RoomKeypadDialog.h"
#include "MegacellDialog.h"
#include "WorldSoundsDialog.h"
#include "PathPadDialog.h"
#include "GrFontDialog.h"
#include "FloatingKeypadDialog.h"
#include "PreferencesDialog.h"
#include "HogDialog.h"
#include "D3Splash.h"
#include "filepagedialog.h"
#include "LevelDialog.h"
#include "ObjectListDialog.h"
#include "TelCom.h"
#include "Slew.h"
#include "AmbientSoundPattern.h"
#include "levelkeypad.h"
#include "matcenkeypad.h"
#include "scriptlevelinterface.h"
#include "ScriptMassCompile.h"
#include "EditLineDialog.h"
// D3 EDITOR HEADERS
#include "pserror.h"
#include "application.h"
#include "AppDatabase.h"
#include "program.h"
#include "gr.h"
#include "init.h"
#include "mono.h"
#include "ddio.h"
#include "descent.h"
#include "bitmap.h"
#include "gametexture.h"
#include "manage.h"
#include "vclip.h"
#include "erooms.h"
#include "HTexture.h"
#include "HView.h"
#include "selectedroom.h"
#include "drawworld.h"
#include "Group.h"
#include "moveworld.h"
#include "worldobjectsgenericdialog.h"
#include "objinfo.h"
#include "HFile.h"
#include "hroom.h"
#include "read3ds.h"
#include "terrain.h"
#include "HObject.h"
#include "hotspotmap.h"
#include "TableFileEdit.h"
#include "BriefEdit.h"
#include "TableFileFilter.h"
#include "DallasMainDlg.h"
#include "ViewerPropDlg.h"
#include "mem.h"
#include "findintersection.h"
#include "renderer.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_DESTROY()
ON_COMMAND(ID_TOOLS_WORLD_TEXTURES, OnToolsWorldTextures)
ON_WM_SIZE()
ON_COMMAND(ID_TOOLS_WORLD_WEAPONS, OnToolsWorldWeapons)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_DOOR, OnToolsWorldObjectsDoor)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_LIGHTS, OnToolsWorldObjectsLights)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_PLAYER, OnToolsWorldObjectsPlayer)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_POWERUPS, OnToolsWorldObjectsPowerups)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_ROBOTS, OnToolsWorldObjectsRobots)
ON_COMMAND(ID_SUBEDITORS_FONT, OnSubeditorsFont)
ON_COMMAND(ID_FILE_PLAY640X480, OnFilePlayin640x480)
ON_UPDATE_COMMAND_UI(ID_VIEW_KEYPAD_TOGGLE, OnUpdateViewKeypadToggle)
ON_COMMAND(ID_VIEW_KEYPAD_TOGGLE, OnViewKeypadToggle)
ON_COMMAND(ID_FILE_LEAVE_EDITOR, OnFileLeaveEditor)
ON_COMMAND(ID_FILE_PREFERENCES, OnFilePreferences)
ON_COMMAND(IDM_IMPORT_BITMAP, OnImportBitmap)
ON_COMMAND(ID_SUBEDITORS_HOGMAKER, OnSubeditorsHogmaker)
ON_COMMAND(ID_NUMPAD0, OnNumpad0)
ON_COMMAND(ID_NUMPAD1, OnNumpad1)
ON_COMMAND(ID_NUMPAD2, OnNumpad2)
ON_COMMAND(ID_NUMPAD3, OnNumpad3)
ON_COMMAND(ID_NUMPAD4, OnNumpad4)
ON_COMMAND(ID_NUMPAD5, OnNumpad5)
ON_COMMAND(ID_NUMPAD6, OnNumpad6)
ON_COMMAND(ID_NUMPAD7, OnNumpad7)
ON_COMMAND(ID_NUMPAD8, OnNumpad8)
ON_COMMAND(ID_NUMPAD9, OnNumpad9)
ON_COMMAND(ID_NUMPADDEL, OnNumpaddel)
ON_COMMAND(ID_NUMPADMINUS, OnNumpadminus)
ON_COMMAND(ID_NUMPADADD, OnNumpadadd)
ON_COMMAND(ID_VIEW_CENTERONMINE, OnViewCenterOnMine)
ON_COMMAND(ID_VIEW_MOVECAMERATOSELECTEDROOM, OnViewMoveCameraToSelectedRoom)
ON_COMMAND(ID_VIEW_CENTERONCUBE, OnViewCenterOnCube)
ON_COMMAND(ID_VIEW_CENTERONOBJECT, OnViewCenterOnObject)
ON_COMMAND(ID_GROUP_CREATEGROUP, OnGroupCreateGroup)
ON_COMMAND(ID_GROUP_LOADGROUP, OnGroupLoadGroup)
ON_COMMAND(ID_GROUP_MIRRORGROUP, OnGroupMirrorGroup)
ON_COMMAND(ID_GROUP_SAVEGROUP, OnGroupSaveGroup)
ON_COMMAND(ID_EDIT_ADDSELECT, OnEditAddSelect)
ON_COMMAND(ID_EDIT_CLEARSELECTED, OnEditClearSelected)
ON_COMMAND(ID_EDIT_REMOVESELECT, OnEditRemoveSelect)
ON_COMMAND(ID_EDIT_SELECTATTACHED, OnEditSelectAttached)
ON_COMMAND(ID_EDIT_SAVESCRAP, OnEditSaveScrap)
ON_COMMAND(ID_EDIT_LOADSCRAP, OnEditLoadScrap)
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
ON_COMMAND(ID_EDIT_CUT, OnEditCut)
ON_COMMAND(ID_EDIT_DELETE, OnEditDelete)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_CURSEG, OnSegSidePane)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_NET, OnNetPane)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_BMMEM, OnBMMemPane)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_ENGINE, OnEnginePane)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_VIEWER, OnViewerPane)
ON_COMMAND(ID_NUMPADDIV, OnNumpadDiv)
ON_COMMAND(ID_NUMPADENTER, OnNumpadEnter)
ON_COMMAND(ID_NUMPADLOCK, OnNumpadLock)
ON_COMMAND(ID_NUMPADMUL, OnNumpadMul)
ON_COMMAND(ID_OBJECT_DELETEOBJECT, OnObjectDeleteObject)
ON_COMMAND(ID_OBJECT_PLACEOBJECT, OnObjectPlaceObject)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_SOUND, OnToolsWorldObjectsSound)
ON_COMMAND(ID_TEST_TEST1, OnTestTest1)
ON_COMMAND(ID_TEST_TEST2, OnTestTest2)
ON_COMMAND(ID_TEST_TEST3, OnTestTest3)
ON_WM_HELPINFO()
ON_COMMAND(ID_EDITORS_MEGACELLS, OnEditorsMegacells)
ON_COMMAND(IDD_REORDER_PAGES, OnReorderPages)
ON_COMMAND(ID_FILE_IMPORT_ROOM, OnFileImportRoom)
ON_COMMAND(ID_OBJECT_MOVEPLAYER, OnObjectMovePlayer)
ON_COMMAND(ID_ROOM_VIEW, OnRoomView)
ON_COMMAND(ID_TERRAIN_VIEW, OnTerrainView)
ON_COMMAND(ID_MINE_VIEW, OnMineView)
ON_UPDATE_COMMAND_UI(ID_MINE_VIEW, OnUpdateMineView)
ON_UPDATE_COMMAND_UI(ID_ROOM_VIEW, OnUpdateRoomView)
ON_UPDATE_COMMAND_UI(ID_TERRAIN_VIEW, OnUpdateTerrainView)
ON_COMMAND(ID_VIEW_NEWVIEWER, OnViewNewviewer)
ON_COMMAND(ID_VIEWER_NEXT, OnViewNextviewer)
ON_COMMAND(ID_VIEW_DELETEVIEWER, OnViewDeleteviewer)
ON_COMMAND(ID_D3HELP, OnD3help)
ON_COMMAND(ID_HOTSPOT_TGA, OnHotspotTga)
ON_COMMAND(ID_EDITORS_FILES, OnEditorsFiles)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_CLUTTER, OnToolsWorldObjectsClutter)
ON_COMMAND(ID_TOOLS_WORLD_OBJECTS_BUILDINGS, OnToolsWorldObjectsBuildings)
ON_COMMAND(ID_EDIT_PLACE, OnEditPlace)
ON_COMMAND(ID_EDIT_ATTACH, OnEditAttach)
ON_UPDATE_COMMAND_UI(ID_EDIT_ATTACH, OnUpdateEditAttach)
ON_UPDATE_COMMAND_UI(ID_EDIT_SAVESCRAP, OnUpdateEditSaveScrap)
ON_COMMAND(ID_FILE_LEVELPROPS, OnFileLevelProps)
ON_COMMAND(ID_OBJBUTTON, OnObjbutton)
ON_UPDATE_COMMAND_UI(ID_OBJBUTTON, OnUpdateObjbutton)
ON_WM_NCDESTROY()
ON_COMMAND(ID_OBJECT_SETCAMERAFROMVIEWER, OnObjectSetCameraFromViewer)
ON_COMMAND(ID_OBJECT_PLACECAMERAATVIEWER, OnObjectPlaceCameraAtViewer)
ON_COMMAND(ID_OBJECT_SETVIEWERFROMCAMERA, OnObjectSetViewerFromCamera)
ON_WM_KEYDOWN()
ON_COMMAND(ID_FILE_LEVEL_INFO, OnFileLevelInfo)
ON_COMMAND(ID_FILE_STATS, OnFileStats)
ON_COMMAND(ID_FILE_VERIFY_LEVEL, OnFileVerifyLevel)
ON_COMMAND(ID_OBJECT_PLACECAMERAATCURRENTFACE, OnObjectPlaceCameraAtCurrentFace)
ON_COMMAND(ID_SUBEDITORS_TABLEFILEEDIT, OnSubEditorsTableFileEdit)
ON_COMMAND(ID_EDITORS_AMBIENTSOUNDS, OnEditorsAmbientSounds)
ON_COMMAND(ID_BRIEFING_EDITOR, OnBriefingEditor)
ON_COMMAND(ID_SCRIPT_LEVEL_INTERFACE, OnScriptLevelInterface)
ON_COMMAND(ID_FILE_FIXCRACKS, OnFileFixCracks)
ON_COMMAND(ID_VIEW_RESETVIEWRADIUS, OnViewResetViewRadius)
ON_COMMAND(ID_SUBEDITORS_TABLEFILEFILTER, OnSubeditorsTablefilefilter)
ON_COMMAND(ID_VIEW_SHOWOBJECTSINWIREFRAMEVIEW, OnViewShowObjectsInWireframeView)
ON_UPDATE_COMMAND_UI(ID_VIEW_SHOWOBJECTSINWIREFRAMEVIEW, OnUpdateViewShowObjectsInWireframeView)
ON_COMMAND(ID_EDITORS_DALLAS, OnEditorsDallas)
ON_UPDATE_COMMAND_UI(ID_OSIRISCOMPILE, OnUpdateOsiriscompile)
ON_COMMAND(ID_OSIRISCOMPILE, OnOsiriscompile)
ON_COMMAND(ID_VIEW_MOVECAMERATOCURRENTOBJECT, OnViewMoveCameraToCurrentObject)
ON_COMMAND(ID_OBJECT_SELECTBYNUMBER, OnObjectSelectByNumber)
ON_COMMAND(IDD_SHOW_ALL_CHECKED_OUT, OnShowAllCheckedOut)
ON_COMMAND(ID_VIEW_SHOWVIEWERFORWARDVECTOR, OnViewShowViewerForwardVector)
ON_COMMAND(ID_OBJECT_PLACESOUNDSOURCEATVIEWER, OnObjectPlaceSoundSourceAtViewer)
ON_COMMAND(IDD_ORPHANHUNTER, OnOrphanhunter)
ON_COMMAND(ID_OBJECT_PLACEWAYPOINTATVIEWER, OnObjectPlaceWaypointAtViewer)
ON_COMMAND(ID_FILE_SAVEGOALTEXT, OnFileSaveGoalText)
ON_COMMAND(ID_VIEW_VIEWPROP, OnViewViewprop)
ON_UPDATE_COMMAND_UI(ID_VIEW_VIEWPROP, OnUpdateViewViewprop)
ON_COMMAND(ID_VIEW_MOVECAMERATOSELECTEDFACE, OnViewMoveCameraToSelectedFace)
ON_COMMAND(ID_EDIT_PLACE_TERRAIN, OnEditPlaceTerrain)
ON_COMMAND(ID_CONTEXT_HELP, OnContextHelp)
ON_COMMAND(ID_VIEW_NEXTVIEWER, OnViewNextviewer)
ON_COMMAND(ID_ACCEL_COPY_LIGHT_MULTIPLE, OnAccelCopyLightMultiple)
ON_COMMAND(ID_ACCEL_SLIDEDOWN, OnAccelSlidedown)
ON_COMMAND(ID_ACCEL_SLIDELEFT, OnAccelSlideleft)
ON_COMMAND(ID_ACCEL_SLIDERIGHT, OnAccelSlideright)
ON_COMMAND(ID_ACCEL_SLIDEUP, OnAccelSlideup)
ON_COMMAND(ID_ACCEL_NEXTVERTEX, OnAccelNextVertex)
//}}AFX_MSG_MAP
ON_COMMAND(ID_HELP_FINDER, CFrameWnd::OnHelpFinder)
ON_COMMAND(ID_HELP, CFrameWnd::OnHelp)
ON_COMMAND(ID_CONTEXT_HELP, OnContextHelp)
ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpFinder)
END_MESSAGE_MAP()
static UINT indicators[] = {
ID_SEPARATOR, // status line indicator
ID_INDICATOR_BMMEM, // How much memory our bitmaps used
ID_INDICATOR_NET, // network indicator