This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
gameobjectsrender.cpp
1826 lines (1687 loc) · 68.9 KB
/
gameobjectsrender.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
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include "gameobjectsrender.h"
#include "math.h"
#include "D3DarkMod.h"
#include "textures.h"
#define utils_h
#include "utils.h"
#include "main.h"
#include "gameobjects.h"
extern FILE *MAPFILE;
void AddEmails(int game, tile LevelInfo[64][64], ObjectItem objList[1600])
{//Generates hidden email objects for when triggers have a send email action
for (int i = 0; i < 1600; i++)
{
if (objList[i].InUseFlag == 1)
{
if (isTriggerSHOCK(objList[i]))
{
if (objList[i].TriggerAction == ACTION_EMAIL)
{
float x; float y; float z;
CalcObjectXYZ(game, &x, &y, &z, LevelInfo, &objList[i], 0, objList[i].tileX, objList[i].tileY);
RenderEntityBOOK(game, x, y, z, 1, objList[i], objList, LevelInfo);
}
}
}
}
}
void CalcObjectXYZ(int game, float *offX, float *offY, float *offZ, tile LevelInfo[64][64], ObjectItem objList[1600], long nextObj, int x, int y)
{
int ResolutionXY = 7; // A tile has a 7x7 grid for object positioning.
int ResolutionZ = 128; //UW has 127 posible z positions for an object in tile.
if (game == SHOCK){ ResolutionXY = 256; ResolutionZ = 256; } //Shock has more "z" in it.
*offX = 0; *offY = 0; *offZ = 0;
float BrushX = BrushSizeX;
float BrushY = BrushSizeY;
float BrushZ = BrushSizeZ;
*offX = (x*BrushX) + ((objList[nextObj].x) * (BrushX / ResolutionXY));
*offY = (y*BrushY) + ((objList[nextObj].y) * (BrushY / ResolutionXY));
//offZ = objList[nextObj].zpos ; //TODO:Adjust this.
float zpos = objList[nextObj].zpos;
float ceil = CEILING_HEIGHT;
*offZ = ((zpos / ResolutionZ) * (ceil)) * BrushZ;
//TODO:This may mess with stuff on walls. It's here to prevent models cliping through sloped floors
//if ((LevelInfo[x][y].tileType >= 6) && (LevelInfo[x][y].tileType <= 9) && (LevelInfo[x][y].isWater == 0) && (LevelInfo[x][y].shockSlopeFlag !=SLOPE_CEILING_ONLY))
// {
// *offZ = *offZ + (LevelInfo[x][y].shockSteep * (BrushSizeZ /2));
// }
}
void CalcObjectXYZ(int game, float *offX, float *offY, float *offZ, tile LevelInfo[64][64], ObjectItem objList[1600], long nextObj, int x, int y, short WallAdjust)
{
float ResolutionXY = 7.0; // A tile has a 7x7 grid for object positioning.
float ResolutionZ = 128.0; //UW has 127 posible z positions for an object in tile.
if (game == SHOCK){ ResolutionXY = 256.0; ResolutionZ = 256.0; } //Shock has more "z" in it.
*offX = 0; *offY = 0; *offZ = 0;
float BrushX = BrushSizeX;
float BrushY = BrushSizeY;
float BrushZ = BrushSizeZ;
float objX = (float)objList[nextObj].x;
float objY = (float)objList[nextObj].y;
*offX = (x*BrushX) + ((objList[nextObj].x) * (BrushX / ResolutionXY));
*offY = (y*BrushY) + ((objList[nextObj].y) * (BrushY / ResolutionXY));
float zpos = objList[nextObj].zpos;
float ceil = CEILING_HEIGHT;
*offZ = ((zpos / ResolutionZ) * (ceil)) * BrushZ;
if (game !=SHOCK)
{//Adjust zpos by a fraction for objects on sloped tiles.
switch (LevelInfo[x][y].tileType)
{
case TILE_SLOPE_N:
*offZ += objY * (48.0 / BrushZ);
break;
case TILE_SLOPE_E:
*offX += objX * (48.0 / BrushZ);
break;
case TILE_SLOPE_S:
*offZ += (8.0f-objY) * (48.0 / BrushZ);
break;
case TILE_SLOPE_W:
*offZ += (8.0f - objX) * (48.0 / BrushZ);
break;
}
}
if (WallAdjust == 1)
{//Adjust the object x,y to avoid clipping into walls.
switch (game)
{
case SHOCK:
if (objList[nextObj].x == 0)
{
*offX = *offX + 2.0f;
}
if (objList[nextObj].x == 128)
{
*offX = *offX - 2.0f;
}
if (objList[nextObj].y == 0)
{
*offY = *offY + 2.0f;
}
if (objList[nextObj].y == 128)
{
*offY = *offY - 2.0f;
}
break;
default:
if (objList[nextObj].x == 0)
{
*offX = *offX + 2.0f;
}
if (objList[nextObj].x == 7)
{
*offX = *offX - 2.0f;
}
if (objList[nextObj].y == 0)
{
*offY = *offY + 2.0f;
}
if (objList[nextObj].y == 7)
{
*offY = *offY - 2.0f;
}
break;
}
}
}
void createScriptCall(ObjectItem &currobj, float x, float y, float z)
{//Entity for running a script when triggered.
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
fprintf(MAPFILE, "\"classname\" \"atdm:target_callscriptfunction\"\n");
fprintf(MAPFILE, "\"name\" \"runscript_%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"call\" \"start_%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "}\n");
EntityCount++;
}
void createScriptCall(ObjectItem &currobj, float x, float y, float z, char *callname)
{//Entity for running a script when triggered.
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
fprintf(MAPFILE, "\"classname\" \"atdm:target_callscriptfunction\"\n");
fprintf(MAPFILE, "\"name\" \"runscript_%s_%s\"\n", UniqueObjectName(currobj), callname);
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"call\" \"start_%s_%s\"\n", UniqueObjectName(currobj), callname);
fprintf(MAPFILE, "}\n");
EntityCount++;
}
void EntityRotation(int heading)
{//This is a fudge until I figure out the rotation math
//this also violates the idea of having differing x/y scales
switch (heading)
{
// 0 origin to the west
//90 origin to the north
//180 origin to the east
//270 origin to the south
case 0:
{fprintf(MAPFILE, "\n\"rotation\" \"1 0 0 0 1 0 0 0 1\"\n"); break; }
case 45:
{fprintf(MAPFILE, "\n\"rotation\" \"0.707107 0.707107 0 -0.707107 0.707107 0 0 0 1\"\n"); break; }
case 90:
{fprintf(MAPFILE, "\n\"rotation\" \"0 -1 0 1 0 0 0 0 1\"\n"); break; }
case 135:
{fprintf(MAPFILE, "\n\"rotation\" \"-0.707107 0.707107 0 -0.707107 -0.707107 0 0 0 1\"\n"); break; }
case 180:
{fprintf(MAPFILE, "\n\"rotation\" \"-1 0 0 0 -1 0 0 0 1\"\n"); break; }
case 225:
{fprintf(MAPFILE, "\n\"rotation\" \"-0.707107 -0.707107 0 0.707107 -0.707107 0 0 0 1\"\n"); break; }
case 270:
{fprintf(MAPFILE, "\n\"rotation\" \"0 1 0 -1 0 0 0 0 1\"\n"); break; }
case 315:
{fprintf(MAPFILE, "\n\"rotation\" \"0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1\"\n"); break; }
default:
{fprintf(MAPFILE, "\n\"rotation\" \"1 0 0 0 1 0 0 0 1\"\n"); break; }
}
}
void EntityRotationSHOCK(int heading)
{//This is a fudge until I figure out the rotation math
//this also violates the idea of having differing x/y scales
switch (heading)
{
//#define SHOCK_NORTH 192
//#define SHOCK_SOUTH 0
//#define SHOCK_EAST 64
//#define SHOCK_WEST 128
case SHOCK_SOUTH:
{fprintf(MAPFILE, "\n\"rotation\" \"1 0 0 0 1 0 0 0 1\"\n"); break; }
case SHOCK_NORTH:
{fprintf(MAPFILE, "\n\"rotation\" \"-1 0 0 0 -1 0 0 0 1\"\n"); break; }
case SHOCK_EAST:
{fprintf(MAPFILE, "\n\"rotation\" \"0 -1 0 1 0 0 0 0 1\"\n"); break; }
case SHOCK_WEST:
{fprintf(MAPFILE, "\n\"rotation\" \"0 1 0 -1 0 0 0 0 1\"\n"); break; }
default:
{fprintf(MAPFILE, "\n\"rotation\" \"0 1 0 -1 0 0 0 0 1\"\n"); break; }
}
}
void RenderEntity(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//Picks what type of object to generate.
//long patchX;long patchY;long patchZ;
//int patchOffsetX;int patchOffsetY;
printf("Rendering:%s\n", UniqueObjectName(currobj));
switch (objectMasters[currobj.item_id].isEntity)
{
case -1: //ignore
{return; break; }
case 0: //Model
{
RenderEntityModel(game, x, y, z, currobj, objList, LevelInfo);
break;
}
case 1: //entity
{
switch (objectMasters[currobj.item_id].type)
{
case NPC:
RenderEntityNPC(game, x, y, z, currobj, objList, LevelInfo);
break;
case HIDDENDOOR:
case DOOR:
case PORTCULLIS:
RenderEntityDoor(game, x, y, z, currobj, objList, LevelInfo);
break;
case KEY:
RenderEntityKey(game, x, y, z, currobj, objList, LevelInfo);
break;
case CONTAINER:
RenderEntityContainer(game, x, y, z, currobj, objList, LevelInfo);
break;
case ACTIVATOR:
RenderEntityActivator(game, x, y, z, currobj, objList, LevelInfo);
break;
case BUTTON:
RenderEntityButton(game, x, y, z, currobj, objList, LevelInfo);
break;
case LOCK:
case A_DOOR_TRAP:
RenderEntityA_DOOR_TRAP(game, x, y, z, currobj, objList, LevelInfo);
break;
case A_DO_TRAP:
RenderEntityA_DO_TRAP(game, x, y, z, currobj, objList, LevelInfo);
break;
case A_CHANGE_TERRAIN_TRAP:
RenderEntityA_CHANGE_TERRAIN_TRAP(game, x, y, z, currobj, objList, LevelInfo);
break;
case TMAP_SOLID:
case TMAP_CLIP:
RenderEntityTMAP(game, x, y, z, currobj, objList, LevelInfo);
break;
case BOOK:
case SCROLL:
RenderEntityBOOK(game, x, y, z, 0, currobj, objList, LevelInfo);
break;
case SIGN:
RenderEntitySIGN(game, x, y, z, currobj, objList, LevelInfo);
break;
case A_MOVE_TRIGGER:
RenderEntityA_MOVE_TRIGGER(game, x, y, z, currobj, objList, LevelInfo);
break;
case A_TELEPORT_TRAP: //a destination for a teleport.
RenderEntityA_TELEPORT_TRAP(game, x, y, z, currobj, objList, LevelInfo);
break;
case SHOCK_DECAL:
RenderEntityDecal(game, x, y, z, currobj, objList, LevelInfo);
break;
case COMPUTER_SCREEN:
RenderEntityComputerScreen(game, x, y, z, currobj, objList, LevelInfo);
break;
case SHOCK_TRIGGER_DEATHWATCH:
case SHOCK_TRIGGER_NULL:
case SHOCK_TRIGGER_LEVEL:
RenderEntityNULL_TRIGGER(game, x, y, z, currobj, objList, LevelInfo);
break;
case SHOCK_TRIGGER_REPULSOR:
RenderEntityREPULSOR(game, x, y, z, currobj, objList, LevelInfo);
break;
case CORPSE:
RenderEntityCorpse(game, x, y, z, currobj, objList, LevelInfo);
break;
case SHOCK_WORDS:
RenderEntityWords(game, x, y, z, currobj, objList, LevelInfo);
break;
case SHOCK_GRATING:
RenderEntityGrating(game, x, y, z, currobj, objList, LevelInfo);
break;
case SHOCK_DOOR:
case SHOCK_DOOR_TRANSPARENT:
RenderEntitySHOCKDoor(game, x, y, z, currobj, objList, LevelInfo);
break;
case UW_PAINTING:
RenderEntityPaintingUW(game, x, y, z, currobj, objList, LevelInfo);
break;
case BRIDGE:
RenderEntityBridgeUW(game, x, y, z, currobj, objList, LevelInfo);
break;
case PARTICLE:
RenderEntityParticle(game, x, y, z, currobj, objList, LevelInfo, 0);
break;
default:
//just the basic name. with no properties.
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
//fprintf(MAPFILE, "\"name\" \"%s_%04d\"\n", objectMasters[currobj.item_id].desc, EntityCount);
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
//position
EntityRotation(currobj.heading);
AttachToJoint(currobj); //for models/darkmod/containers/bag1_small.lwonpc items
if (objectMasters[currobj.item_id].isMoveable == 1)
{
if (objectMasters[currobj.item_id].isInventory == 1)
{
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "atdm:moveable_custom_item");
}
else
{
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "atdm:grabable_custom_item");
}
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z + 12);
fprintf(MAPFILE, "\"bouncyness\" \"0.1\"\n");
fprintf(MAPFILE, "\"friction\" \"0.1\"\n");
fprintf(MAPFILE, "\"frobable\" \"1\"\n");
fprintf(MAPFILE, "\"mass\" \"0.6\"\n");
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].base);
fprintf(MAPFILE, "\"notpushable\" \"0\"\n");
fprintf(MAPFILE, "\"snd_bounce\" \"tdm_impact_small_hard_object\"\n");
fprintf(MAPFILE, "\"spr_object_hardness\" \"hard\"\n");
fprintf(MAPFILE, "\"spr_object_size\" \"medium\"\n");
//fprintf(MAPFILE, "\"frob_action_script\" \"testfrob\"\n");
}
else
{
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
}
if (objectMasters[currobj.item_id].isInventory == 1)
{
fprintf(MAPFILE, "\"inv_icon\" \"%s\"\n", objectMasters[currobj.item_id].InvIcon);
fprintf(MAPFILE, "\"inv_name\" \"%s\"\n", objectMasters[currobj.item_id].desc);
fprintf(MAPFILE, "\"inv_map_start\" \"0\"\n");
fprintf(MAPFILE, "\"inv_droppable\" \"0\"\n");
fprintf(MAPFILE, "\"frob_action_script\" \"%s_frob\"\n", UniqueObjectName(currobj));
}
fprintf(MAPFILE, "}");
EntityCount++;
break;
}
}
}
if (objectMasters[currobj.item_id].hasParticle == 1)
{
RenderEntityParticle(game, x, y, z, currobj, objList, LevelInfo, 1);
}
if (objectMasters[currobj.item_id].hasSound == 1)
{
RenderEntitySound(game, x, y, z, currobj, objList, LevelInfo, 1);
}
if ((currobj.objectConversion != 0) && (game == SHOCK))
{
//Swap out the object type but generate based on the original properties.
int originalObj = objList[currobj.index].item_id;
int newObj = currobj.objectConversion;
int newObjId = getObjectIDByClass(currobj.ObjectClass, currobj.ObjectSubClass, currobj.objectConversion);
objList[currobj.index].item_id = newObjId;
objList[currobj.index].objectConversion = 0;
objList[currobj.index].invis = 1; //hide the object
RenderEntity(game, x, y, z, currobj, objList, LevelInfo);
objList[currobj.index].invis = 0;
objList[currobj.index].item_id = originalObj;
objList[currobj.index].objectConversion = newObj;
}
}
void RenderEntityA_DO_TRAP(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//This is a trigger in UW that can do a bunch of different things. Eg cameras/rising platforms.
switch (currobj.quality)
{
case 2: //A camera
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
fprintf(MAPFILE, "\"classname\" \"func_cameraview\"\n");
fprintf(MAPFILE, "\"name\" \"%s_%03d_%03d\"\n", objectMasters[currobj.item_id].desc, currobj.tileX, currobj.tileY);
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"trigger\" \"1\"\n");
//Aim the camera.
EntityRotation(currobj.heading);//TODO:Points in wrong direction
fprintf(MAPFILE, "\n}");
EntityCount++;
break;
case 3: //rising platform
RenderEntityElevator(game, LevelInfo, currobj);
//RenderEntityBullfrog(game, LevelInfo, currobj);
break;
//case 24://Bullfrog
//
default:
RenderEntityParticle(game, x, y, z, currobj, objList, LevelInfo, 0);
// fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
// fprintf(MAPFILE, "\"classname\" \"func_static\"\n");
// fprintf(MAPFILE, "\"name\" \"%s\"\n",UniqueObjectName(currobj));
// //models/darkmod/decorative/hourglass.ase
// fprintf(MAPFILE, "\n\"model\" \"models/darkmod/decorative/hourglass.ase\"");
// fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
// fprintf(MAPFILE, "\n}");
// EntityCount++;
}
return;
}
void RenderEntityA_DOOR_TRAP(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{//Is this in use?
//A door trap object for opening doors.
//Params
//objectOwnerName (passed down from a parent object)
//objectOwner
//tileX
//tileY
//Need to add path for generic usage.
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"door_%03d_%03d\"\n", currobj.objectOwner, currobj.objectOwnerName);
fprintf(MAPFILE, "\"target\" \"door_%03d_%03d\"\n", currobj.tileX, currobj.tileY); //Doors are refered to by their tile location.
fprintf(MAPFILE, "\"toggle\" \"1\"\n"); //todo: other types of behaviour.
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "}");
EntityCount++;
return;
}
void RenderEntityA_CHANGE_TERRAIN_TRAP(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//
//A trigger that converts one type of terrain into another.
//We generate both types of terrain at the start but hide the second type until the trigger is activated.
//render func static for the initial tiles.
PrimitiveCount = 0;
int tileCount = 0;
//for (int i = 0; i <= currobj.x; i++)
//{
// for (int j = 0; j <= currobj.y; j++)
// {
// fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
// fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
// //TODO:There is some weirdness when I try and hide water. For now I'll just ignore it.
// //if (LevelInfo[currobj.tileX+i][currobj.tileY+j].isWater == 0)
// // {
// //fprintf (MAPFILE, "\"name\" \"%s_initial_%03d_%03d_%03d_%03d\"\n",objectMasters[currobj.item_id].desc,currobj.tileX,currobj.tileY,currobj.index,tileCount);
// fprintf(MAPFILE, "\"name\" \"initial_%s_%03d\"\n", UniqueObjectName(currobj), tileCount);
// // }
// //else
// // {//water
// // fprintf (MAPFILE, "\"name\" \"%s_initial_%03d_%03d_%03d_%03d\"\n",objectMasters[currobj.item_id].desc,currobj.tileX,currobj.tileY,currobj.index,tileCount);
// // fprintf (MAPFILE, "\n\"underwater_gui\" \"guis\underwater\underwater_green_thinmurk.gui\"\n");
// // }
// fprintf(MAPFILE, "\"model\" \"initial_%s_%03d\"\n", UniqueObjectName(currobj), tileCount);
// fprintf(MAPFILE, "\"origin\" \"%d %d %d\"\n", (currobj.tileX + i)*BrushSizeX, (currobj.tileY + j)*BrushSizeY, 0);
// RenderDarkModTile(game, 0, 0, LevelInfo[currobj.tileX + i][currobj.tileY + j], LevelInfo[currobj.tileX + i][currobj.tileY + j].isWater, 0, 0, 1);
// fprintf(MAPFILE, "\n}\n");
// tileCount++;
// }
//}
for (int i = 0; i <= currobj.x; i++)
{
for (int j = 0; j <= currobj.y; j++)
{
//Then render a func static for how it ends up.
PrimitiveCount = 0;
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"%s_%02d_%02d\"\n", UniqueObjectName(currobj), currobj.tileX + i, currobj.tileY + j);
fprintf(MAPFILE, "\"model\" \"%s_%02d_%02d\"\n", UniqueObjectName(currobj), currobj.tileX + i, currobj.tileY + j);
fprintf(MAPFILE, "\"origin\" \"%d %d %d\"\n", currobj.tileX*BrushSizeX + (i*BrushSizeX), currobj.tileY*BrushSizeY + (j*BrushSizeY), 0);
tile t; //temporary tile for rendering.
t.tileType = currobj.quality & 0x01;
t.Render = 1;
t.floorHeight = ((currobj.zpos >> 3) >> 2) * 8; //heights in uw are shifted
t.floorHeight = (currobj.zpos >> 2); //heights in uw are shifted
t.ceilingHeight = 0;
if (game != UW2)
{
t.floorTexture = (currobj.quality >> 1) + 210;
}
else
{
t.floorTexture = LevelInfo[currobj.tileX][currobj.tileY].floorTexture;//?
}
t.shockCeilingTexture = LevelInfo[currobj.tileX + i][currobj.tileY + j].shockCeilingTexture;
t.wallTexture = LevelInfo[currobj.tileX + i][currobj.tileY + j].wallTexture;
t.West = LevelInfo[currobj.tileX + i][currobj.tileY + j].West;
t.East = LevelInfo[currobj.tileX + i][currobj.tileY + j].East;
t.North = LevelInfo[currobj.tileX + i][currobj.tileY + j].North;
t.South = LevelInfo[currobj.tileX + i][currobj.tileY + j].South;
t.isWater = 0;
t.DimY = 1;
t.DimX = 1;
t.hasElevator = 0;
t.BullFrog = 0;
RenderDarkModTile(game, 0, 0, t, 0, 0, 0, 1);
fprintf(MAPFILE, "\n}\n");
}
}
}
void RenderEntityA_MOVE_TRIGGER(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//A trigger that fires when you step in it.
//Params
//item_id
//index
//tileX
//tileY
//need to add objectmaster path for generic usage
//need to add objectmaster desc for generic usage
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"model\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"target\" \"runscript_%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"wait\" \"5\"\n");
switch (game)
{
case UWDEMO:
case UW1: //At the corner of the tile
fprintf(MAPFILE, "\"origin\" \"%d %d %d\"\n", currobj.tileX*BrushSizeX, currobj.tileY*BrushSizeY, LevelInfo[currobj.tileX][currobj.tileY].floorHeight*BrushSizeZ);
break;
case UW2: //Positioned around the triggers origin.
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
break;
case SHOCK: //At the corner of the tile.
fprintf(MAPFILE, "\"origin\" \"%d %d %d\"\n", currobj.tileX*BrushSizeX, currobj.tileY*BrushSizeY, 0);
break;
}
tile t; //temp tile for rendering trigger
t.floorTexture = TRIGGER_MULTI;
t.wallTexture = TRIGGER_MULTI;
t.East = TRIGGER_MULTI;
t.West = TRIGGER_MULTI;
t.North = TRIGGER_MULTI;
t.South = TRIGGER_MULTI;
t.DimX = 1; t.DimY = 1;
t.tileType = 1;
t.Render = 1;
t.floorHeight = 0;
t.ceilingHeight = CEILING_HEIGHT;
t.isWater = 0;
t.hasElevator = 0;
t.BullFrog = 0;
switch (game)
{
case UWDEMO:
case UW1:
RenderGenericTile(0, 0, t, 1, 0);
break;
case UW2:
RenderGenericTileAroundOrigin(currobj.tileX, currobj.tileY, t, LevelInfo[currobj.tileX][currobj.tileY].floorHeight + 1, LevelInfo[currobj.tileX][currobj.tileY].floorHeight, BrushSizeZ);
break;
case SHOCK:
//enter any part of tile
RenderGenericTile(0, 0, t, CEILING_HEIGHT, 0);
break;
}
fprintf(MAPFILE, "\n}");
createScriptCall(currobj, x, y, z);
}
void RenderEntityA_TELEPORT_TRAP(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//This is the destination spot of a teleport.
//zpos = this level
//item_id for type
//quality = x coord of destination
//owner = y coord of destination
//need to add objectmaster path for generic usage.
//only show if it points to this level.
if (currobj.zpos == 0)
{
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"origin\" \"%d %d %d\"\n", currobj.quality * BrushSizeX + (BrushSizeX / 2), currobj.owner * BrushSizeY + (BrushSizeY / 2), LevelInfo[currobj.quality][currobj.owner].floorHeight * BrushSizeZ);
fprintf(MAPFILE, "\n}");
}
return;
}
void RenderEntityBOOK(int game, float x, float y, float z, short message, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//A book in UW and an audio log/text in Shock. Xdata is generated in advance based on game files.
//Params
//tileX
//tileY
//Index
//currobj.link -200 = pointer to the readable string block in UW
//heading
int ReadableIndex;
switch (game)
{
case SHOCK:
ReadableIndex = currobj.shockProperties[SOFT_PROPERTY_LOG]; //currobj.Property1; //The chunk that the text comes from.
break;
default:
ReadableIndex = currobj.link - 0x200;
break;
}
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
if (message == 1)//atdm:readable_mobile_scroll01
{//This is a hidden email OR MESSAGE
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "atdm:readable_mobile_scroll01");
fprintf(MAPFILE, "\"name\" \"%s_email\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"hide\" \"1\"\n");
}
else
{
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
}
fprintf(MAPFILE, "\"inv_name\" \"Readable_%d\"\n", ReadableIndex); //Need a better name than this!
fprintf(MAPFILE, "\"inv_icon\" \"%s\"\n", objectMasters[currobj.item_id].InvIcon);
switch (game)
{
case UWDEMO:
case UW1:
{fprintf(MAPFILE, "\"xdata_contents\" \"readables/uw1/scroll_%03d\"\n", ReadableIndex); break; }
case UW2:
{fprintf(MAPFILE, "\"xdata_contents\" \"readables/uw2/scroll_%03d\"\n", ReadableIndex); break; }
case SHOCK:
{
fprintf(MAPFILE, "\"xdata_contents\" \"readables/shock/log_%03d\"\n", ReadableIndex);
if (message == 0)
{//plays the audio of this log
fprintf(MAPFILE, "\"trigger_on_open\" \"runscript_%s\"\n", UniqueObjectName(currobj));
}
else
{
fprintf(MAPFILE, "\"trigger_on_open\" \"runscript_%s_email\"\n", UniqueObjectName(currobj));
}
break;
}
}
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
EntityRotation(currobj.heading);
AttachToJoint(currobj); //for npc items
fprintf(MAPFILE, "}");
EntityCount++;
if (game == SHOCK)
{
if (message == 0)
{
createScriptCall(currobj, x, y, z);
}
else
{
//char str[80];
//sprintf_s(str, "runscript_%s_email", UniqueObjectName(currobj));
createScriptCall(currobj, x, y, z, "email");
}
}
return;
}
void RenderEntityButton(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//
//Params
//item_id
//tileX
//tileY
//index
//heading
//Need to pass desc/path for generic handling
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "atdm:mover_button");
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
//fprintf (MAPFILE, "\"model\" \"models/darkmod/mechanical/switches/switch_flip.ase\"\n"); //TODO:Need to pass this in from config
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
//position
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"rotate\" \"0 0 1\"\n");
fprintf(MAPFILE, "\"interruptable\" \"0\"\n");
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
fprintf(MAPFILE, "\"target\" \"runscript_%s\"\n", UniqueObjectName(currobj));
if (game == SHOCK)
{//gui related settings. Sets the gui that controls the 2d animation of this switch.
fprintf(MAPFILE, "\"gui\" \"guis/shock/switch_%d_%d_%d.gui\"\n", currobj.ObjectClass, currobj.ObjectSubClass, currobj.ObjectSubClassIndex);
fprintf(MAPFILE, "\"gui_parm1\" \"0\"\n", currobj.ObjectClass, currobj.ObjectSubClass, currobj.ObjectSubClassIndex);
EntityRotationSHOCK(currobj.Angle2);
}
else
{
EntityRotation(currobj.heading);
}
fprintf(MAPFILE, "}\n"); EntityCount++;
createScriptCall(currobj, x, y, z); //To run whatever actions this switch performs.
return;
}
void RenderEntityComputerScreen(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
if (currobj.shockProperties[SCREEN_START] < 246)
{
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_damagable");
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"gui\" \"guis/shock/screen_%d_%d_%d.gui\"\n", currobj.shockProperties[SCREEN_START], currobj.shockProperties[SCREEN_NO_OF_FRAMES], currobj.shockProperties[SCREEN_LOOP_FLAG]);
fprintf(MAPFILE, "\"target\" \"runscript_%s_destroy\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"gui_parm1\" \"0\"\n", UniqueObjectName(currobj));
}
else
{//unimplemented special screens.
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_static");
fprintf(MAPFILE, "\"gui\" \"guis/shock/screen.gui\"\n");
}
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
//currobj.shockProperties[SCREEN_NO_OF_FRAMES]
//currobj.shockProperties[SCREEN_LOOP_FLAG]
//currobj.shockProperties[SCREEN_START]
//fprintf(MAPFILE, "\"gui\" \"guis/shock/screen.gui\"\n");
EntityRotationSHOCK(currobj.Angle2);
fprintf(MAPFILE, "\n}");
if (currobj.shockProperties[SCREEN_START] < 246)
{//destructable
createScriptCall(currobj, x, y, z, "destroy");
}
}
void RenderEntityContainer(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//Creates something that holds objects. Current behaviour is to spawn objects at various spawn points surrounding the object.
//Params.
//Item_id
//link //To check for a lock and it's list of contents.
if (game != SHOCK)
{
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_static");
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
//I need to spawn it's contents at the same location (recursively)
//render it first.
//TODO: I also need to fix containers which are not really entities
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
if (objectMasters[objList[currobj.link].item_id].type == LOCK) //container has a lock.
{//bit 1 of the flags is the lock?
fprintf(MAPFILE, "\"locked\" \"%d\"\n", (objList[currobj.link].flags & 0x01));
fprintf(MAPFILE, "\"used_by\" \"a_key_%03d_0\"\n", objList[currobj.link].link & 0x3F);
fprintf(MAPFILE, "\"used_by1\" \"a_key_%03d_1\"\n", objList[currobj.link].link & 0x3F);
fprintf(MAPFILE, "\"used_by2\" \"a_key_%03d_2\"\n", objList[currobj.link].link & 0x3F);
fprintf(MAPFILE, "\"used_by3\" \"a_key_%03d_3\"\n", objList[currobj.link].link & 0x3F);
fprintf(MAPFILE, "\"used_by4\" \"a_key_%03d_4\"\n", objList[currobj.link].link & 0x3F);
fprintf(MAPFILE, "\"used_by5\" \"a_key_%03d_5\"\n", objList[currobj.link].link & 0x3F);
}
//position
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
AttachToJoint(currobj);
fprintf(MAPFILE, "}");
EntityCount++;
//now recursively get it's contents.
if (currobj.link != 0) //Container has objects
{
ObjectItem tmpobj = objList[currobj.link];
while (tmpobj.next != 0)
{
if (objectMasters[objList[currobj.link].item_id].type != LOCK)
{
RenderEntity(game, x, y, z, tmpobj, objList, LevelInfo);
}
tmpobj = objList[tmpobj.next];
}
RenderEntity(game, x, y, z, tmpobj, objList, LevelInfo);
}
return;
}
else
{
//Shock container. contents are different from uw1
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_static");
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
if (hasContents(currobj))
{
fprintf(MAPFILE, "\"grabable\" \"%d\"\n", 0);
fprintf(MAPFILE, "\"frobable\" \"%d\"\n", 1);
fprintf(MAPFILE, "\"frob_action_script\" \"start_%s\"\n", UniqueObjectName(currobj));
}
fprintf(MAPFILE, "}");
if (hasContents(currobj))
{
//createScriptCall(currobj, x, y, z);
//create 4 spawn points around the container to spawn the contents at.
int offX = 10; int offY = 10;
for (int i = 0; i < 4; i++)
{
switch (i)
{
case 0: offX = 10; offY = 10; break;
case 1: offX = -10; offY = 10; break;
case 2: offX = 10; offY = -10; break;
case 3: offX = -10; offY = -10; break;
}
if (currobj.shockProperties[CONTAINER_CONTENTS_1 + i] != 0)
{
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "target_null");
fprintf(MAPFILE, "\"name\" \"%s_spawnpoint_%d\"\n", UniqueObjectName(currobj), i);
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x + offX, y + offY, z);
fprintf(MAPFILE, "}");
}
}
}
}
}
void RenderEntityCorpse(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{
//Some corpses will have inventories. For these we have spawn points that behave just like containers.
//Params.
//Item_id
//link //To check for a lock and it's list of contents.
if (game == SHOCK)
{
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);//"atdm:mover_button"
fprintf(MAPFILE, "\"classname\" \"%s\"\n", objectMasters[currobj.item_id].path);
//fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
if (hasContents(currobj))
{
fprintf(MAPFILE, "\"grabable\" \"%d\"\n", 0);
fprintf(MAPFILE, "\"frobable\" \"%d\"\n", 1);
fprintf(MAPFILE, "\"frob_action_script\" \"start_%s\"\n", UniqueObjectName(currobj));
}
fprintf(MAPFILE, "}");
if (hasContents(currobj))
{
//createScriptCall(currobj, x, y, z);
//create 4 spawn points around the container to spawn the contents at.
int offX = 10; int offY = 10;
for (int i = 0; i < 4; i++)
{
switch (i)
{
case 0: offX = 10; offY = 10; break;
case 1: offX = -10; offY = 10; break;
case 2: offX = 10; offY = -10; break;
case 3: offX = -10; offY = -10; break;
}
if (currobj.shockProperties[CONTAINER_CONTENTS_1 + i] > 0)
{
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "target_null");
fprintf(MAPFILE, "\"name\" \"%s_spawnpoint_%d\"\n", UniqueObjectName(currobj), i);
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x + offX, y + offY, z);
fprintf(MAPFILE, "}");
}
}
}
}
}
void RenderEntityDecal(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{//decals like wall icons etc.
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_static");
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
switch (currobj.ObjectSubClassIndex)
{
case 0: //sign
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"skin\" \"shock_sign_%04d\"\n", 390 + currobj.unk1);
break;
case 1: //icon
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"skin\" \"shock_icon_%04d\"\n", currobj.unk1);
break;
case 2: //graffiti
if (currobj.unk1 != 7)
{
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
}
else
{
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[131].path); //special case for shodan hearts diego
}
fprintf(MAPFILE, "\"skin\" \"shock_graffiti_%04d\"\n", currobj.unk1);
break;
case 4: //painting
if (currobj.unk1 != 2)
{
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
}
else
{
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[126].path);//special case for the scream.
}
fprintf(MAPFILE, "\"skin\" \"shock_painting_%04d\"\n", 403 + currobj.unk1);
break;
case 5: //poster
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"skin\" \"shock_poster_%04d\"\n", currobj.unk1);
break;
}
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
EntityRotationSHOCK(currobj.Angle2);
fprintf(MAPFILE, "\n}");
}
void RenderEntityPaintingUW(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{//UW2 wall paintings.
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_static");
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
fprintf(MAPFILE, "\"skin\" \"uw2_painting_%02d\"\n", currobj.flags & 0x7);
EntityRotation(currobj.heading);
fprintf(MAPFILE, "\n}");
}
void RenderEntityBridgeUW(int game, float x, float y, float z, ObjectItem &currobj, ObjectItem objList[1600], tile LevelInfo[64][64])
{//UW2 bridges
fprintf(MAPFILE, "\n// entity %d\n{\n", EntityCount++);
fprintf(MAPFILE, "\"classname\" \"%s\"\n", "func_static");
fprintf(MAPFILE, "\"name\" \"%s\"\n", UniqueObjectName(currobj));
fprintf(MAPFILE, "\"origin\" \"%f %f %f\"\n", x, y, z);
fprintf(MAPFILE, "\"hide\" \"%d\"\n", currobj.invis);
fprintf(MAPFILE, "\"model\" \"%s\"\n", objectMasters[currobj.item_id].path);
if (currobj.flags < 2)
{