forked from ByteNybbler/MNIKEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadventures.bb
23555 lines (17665 loc) · 589 KB
/
adventures.bb
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
Function CreateNewPlayer()
name$=PlayerName$
; Create the Directory structure
CreateDir GlobalDirName$+"\Player Profiles\"+name$
; GiveDirectoryUserFullAccess(GlobalDirName$+"\Player Profiles\"+name$)
CreateDir GlobalDirName$+"\Player Profiles\"+name$+"\Current"
; GiveDirectoryUserFullAccess(GlobalDirName$+"\Player Profiles\"+name$+"\Current")
CreateDir GlobalDirName$+"\Player Profiles\"+name$+"\Current\Hub"
; GiveDirectoryUserFullAccess(GlobalDirName$+"\Player Profiles\"+name$+"\Current\Hub")
CreateDir GlobalDirName$+"\Player Profiles\"+name$+"\Current\Adventure"
; GiveDirectoryUserFullAccess(GlobalDirName$+"\Player Profiles\"+name$+"\Current\Adventure")
CreateDir GlobalDirName$+"\Player Profiles\"+name$+"\SaveFiles"
; GiveDirectoryUserFullAccess(GlobalDirName$+"\Player Profiles\"+name$+"\SaveFiles")
; copy the hub data
; dir=ReadDir ("Data\Adventures\Hub")
; Repeat
; dirfile$=NextFile$(dir)
; If FileType("Data\Adventures\Hub\"+dirfile$)=1
; CopyFile "Data\Adventures\Hub\"+dirfile$,GlobalDirName$+"\Player Profiles\"+playername$+"\Current\Hub\"+dirfile$
; EndIf
; Until dirfile$=""
; CloseDir dir
; and make the actual player data file
file=WriteFile(GlobalDirName$+"\Player Profiles\"+name$+"\Current\playerfile.wpf")
Incustomhub=0
incustomhubname$=""
incustomhubiconname$=""
WriteInt file,0 ; incustomhub
WriteString file,""
WriteString file,"" ;incustomhubiconname$=iconname$
WriteString file,""
WriteInt file,1 ; gatekeyversion
WriteString file,PlayerName$
WriteString file,PlayerCharacterName$
WriteInt file, PlayerTextureBody
WriteInt file,PlayerAcc1
WriteInt file,PlayerTexAcc1
WriteInt file,PlayerAcc2
WriteInt file,PlayerTexAcc2
WriteFloat file,PlayerSizeX#
WriteFloat file,PlayerSizeY#
WriteFloat file,PlayerSizeZ#
WriteInt file,PlayerVoice
WriteInt file,PlayerPitch
; save inventory
WriteInt file,3
WriteInt file,0
For i=0 To 99
WriteInt file,9091
WriteInt file,-1
WriteInt file,3
WriteString file,""
WriteString file,"Empty"
Next
WriteInt file,56 ; 0-crypted
WriteInt file,0
WriteInt file,0
WriteInt file,56 ; 0-crypted
WriteInt file,0
WriteInt file,0;ShardsAreActive
WriteInt file,future
WriteInt file,future
WriteInt file,future
WriteInt file,3
WriteInt file,0
For i=0 To 99
WriteInt file,9091
WriteInt file,-1
WriteInt file,3
WriteString file,""
WriteString file,"Empty"
Next
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,0
WriteInt file,future
; Adventure/hub status
WriteInt file,0;AdventureCurrentLevel
WriteInt file,0;AdventureCurrentStatus
WriteInt file,0;AdventureCurrentNumber
WriteString file,"";AdventureCurrentName
WriteInt file,0;AdventureExitWonLevel
WriteInt file,0;AdventureExitWonX
WriteInt file,0;AdventureExitWonY
WriteInt file,0;AdventureExitLostLevel
WriteInt file,0;AdventureExitLostX
WriteInt file,0;AdventureExitLostY
WriteInt file,0;AdventureGoal
For i=0 To 2
For j=0 To 5
WriteInt file,0;AdventureWonCommand(i,j)
Next
Next
For i=0 To 499
WriteInt file,0;AdventureCompleted(i)
WriteInt file,0;AdventureCompletedTime(i)
WriteInt file,0;AdventureCompletedGems(i)
WriteInt file,0;AdventureCompletedGemsTotal(i)
WriteInt file,0;AdventureCompletedCoins(i)
WriteInt file,0;AdventureCompletedCoinsTotal(i)
WriteInt file,0;AdventureCompletedScore(i)
Next
WriteInt file,0;NofWeeStinkersInAdventure
WriteInt file,0;NofWeeStinkersFollowing
WriteInt file,0;NofWeeStinkersFollowingLast
WriteInt file,0;NofScrittersInAdventure
WriteInt file,0;NofGemsInAdventure
WriteInt file,0;NofBricksInAdventure
WriteInt file,0;NofFireFlowersInAdventure
WriteInt file,0;NofCrabsInAdventure
WriteInt file,0;NofBabyBoomersInAdventure
WriteInt file,0;NofZBotsInAdventure
WriteInt file,future
WriteInt file,future
WriteInt file,future
WriteInt file,future
WriteInt file,future
WriteInt file,future
WriteInt file,future
; Other Global Data
WriteInt file,0;PlayerObject
WriteInt file,0;StinkerObject
WriteInt file,0;CameraFocusObject
WriteInt file,0;LevelTimer
WriteInt file,0;PlayerControlMode
WriteInt file,0;LastPlayerControl
WriteInt file,0;PlayerTalkToGoalObject
WriteInt file,0;GameMode
WriteInt file,0;OldGameMode
WriteInt file,0;MoveCursorNewTarge
WriteInt file,0;MouseHeld
WriteInt file,0;DelayCommand
WriteInt file,0;DelayData1
WriteInt file,0;DelayData2
WriteInt file,0;DelayData3
WriteInt file,0;DelayData4
WriteInt file,0;SpellActive
WriteInt file,0;CurrentSpell
WriteInt file,0;CurrentCharm
WriteInt file,0;CurrentSpellPower
WriteInt file,0;currentlightpower
WriteInt file,False ; usedinventoryonce
WriteInt file,0 ; GlobalGrowFlowerCounter
WriteInt file,0 ; GlobalFloingBubbleCounter
WriteInt file,0 ; PlayerLavaTimer
WriteInt file,0;IndigoActive
WriteInt file,future
WriteInt file,future
WriteInt file,future
WriteInt file,future
WA3BlueFlower=-(Abs(MilliSecs()) Mod 15)-1
WriteInt file, WA3BlueFlower
;Print "Create"
;Print WA3BlueFlower
;Delay 5000
Wa3BlueFlowerStatus=0
WriteInt file,Wa3BlueFlowerStatus
WriteString file,Stri$
WriteString file,Stri$
WriteString file,Stri$
WriteString file,Stri$
WriteString file,Stri$
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
WriteFloat file,floa
For i=0 To 999
WriteInt file,0 ;MasterAskAboutActive
Next
For i=0 To 7
WriteInt file,0;mappiecefound(i)=False
Next
For i=1 To Abs(MilliSecs()) Mod 100
a=Rand(0,100)
Next
For i=0 To 3
MysteryNumber(i)=Rand(1,12)
WriteInt file,MysteryNumber(i)
Next
WriteInt file,0 ;mysterynumberpos
WriteInt file,CurrentReplayAdventure
WriteInt file,PreReplayAdventureLevel;=ReadInt(file)
WriteInt file,PreReplayAdventureX;=ReadInt(file)
WriteInt file,PreRePlayAdventureY;=ReadInt(file)
WriteInt file,LevelMusicCustomVolume
WriteInt file,LevelMusicCustomPitch
;wa3
;Print wa3blueflower
;Delay 1000
CloseFile file
loadplayer(GlobalDirName$+"\Player Profiles\"+name$+"\Current\playerfile.wpf")
End Function
Function StartHubLevel(Level,x,y,Usexy)
; Load Hub Level (negative!) and create player at x/y
; This is used when a HubLevel is first started from e.g. within Menu, or after completed adventure.
; ... Not for going from HubLevel to HubLevel
;usexy not used (jsut make false)
GameMode=0
AdventureCurrentLevel=Level
AdventureGoal=0
AdventureCurrentStatus=0
AdventureCurrentNumber=0
currentreplayadventure=0
PlayerLavaTimer=0
; Start Level 1 and Create Player
StartLevel(GlobalDirName$+"\Player Profiles\"+playername$+"\Current\Hub\"+Str$(-AdventureCurrentLevel)+".wlv",False)
CreatePlayer(x,y);AdventureStartX,AdventureStartY)
MouseGameMode=-2
ResetParticles("data/graphics/particles.bmp")
ScaleEntity LevelCursor,1,1,1
RotateEntity LevelCursor,0,0,0
EntityAlpha LevelCursor,.5
ShowEntity MouseCursor
MouseCursorVisible=True
End Function
Function StartLevel(name$,complete)
CameraAddZoom=0
CameraAddX=0
CameraAddY=0
CameraAddZ=0
RotateEntity Camera,55,0,0
; Disable any Spells unless loading from currentsaved game
If Lower$(Right$(name$,13))<>"savelevel.wlv"
; delete charm
currentcharm=0
deleteicon(1)
SpellActive=False
CurrentSpell=-1
IndigoActive=0
; check inventory for gloves
For j=0 To 99
If InventoryItem(j)=1001
InventoryTexture(j)=23
CurrentSpellPower=0
IndigoActive=0
DeleteIcon(0)
EndIf
Next
Else
If CurrentSpell>=0 And CurrentSpellPower>0
SpellActive=Not SpellActive
ToggleSpell()
EndIf
EndIf
ShardHitCounter=0
ShardLastHit=-1
LevelTimer=0
EntityAlpha LevelCursor,.5
EntityAlpha MouseCursor,.8
For i=0 To 99
For j=0 To 99
LevelTileLogic(i,j)=0
ObjectTileLogic(i,j)=0
Next
Next
; FreeTexture WaterTexture
; FreeTexture LevelTexture
; if Complete=True, also create Player, Spellballs
; Load The Level
LoadLevel(name$,complete,True)
SetLight(LightRedGoal,LightGreenGoal,LightBlueGoal,4,AmbientRedGoal,AmbientGreenGoal,AmbientBlueGoal,4)
; check inventory for light
For j=0 To 99
If (InventoryItem(j)=2001 Or InventoryItem(j)=2011)
If toodark()=True
DeleteIcon(1)
If InventoryItem(j)=2001
CreateIcon(1,0,66,2002,"- "+CurrentLightPower+" -","Remove")
CurrentCharm=1
Else
CreateIcon(1,0,67,2012,"Light","Remove")
CurrentCharm=2
EndIf
EndIf
EndIf
Next
If (currentcharm=0 Or currentlightpower=0) And toodark()=True
If Rand(0,100)<10
MessageLineText1$="It is pitch black."
MessageLineText2$="You are likely to be eaten by a grue."
MessageLineTimer=300
Else
MessageLineText1$="It is very dark!"
MessageLineText2$="You need a lamp."
MessageLineTimer=300
EndIf
EndIf
CreateLevel()
; Create the MousePickPlane - needs to be redone each level (different sizes)
If MousePickPlane>0
FreeEntity MousePickPlane
MousePickPlane=0
EndIf
MousePickPlane=CreateMesh()
Surface=CreateSurface(MousePickPlane)
AddVertex (surface,-10,.05,10)
AddVertex (surface,LevelWidth+10,.05,10)
AddVertex (surface,-10,.05,-LevelHeight-10)
AddVertex (surface,LevelWidth+10,.05,-LevelHeight-10)
AddTriangle (surface,0,1,2)
AddTriangle (surface,1,3,2)
EntityPickMode MousePickPlane,2
EntityAlpha MousePickPlane,0
Playercontrolmode=7
LightRedGoal2=-1
deleteicon(7)
If complete=False LevelMusicCustomVolume=100
If levelmusic<>CurrentMusic And GlobalMusicVolume2>0
If ChannelPlaying (MusicChannel)=1
StopChannel (MusicChannel)
EndIf
If levelmusic>0
If levelmusic=21
MusicChannel=PlayMusic ("data\models\ladder\valetfile.ogg")
Else
MusicChannel=PlayMusic ("data\music\"+levelmusic+".ogg")
EndIf
EndIf
CurrentMusic=levelmusic
EndIf
ChannelVolume musicchannel,GlobalMusicVolume*Float(LevelMusicCustomVolume)/100.0
If complete=False LevelMusicCustomPitch=44
If LevelMusic=12 Then LevelMusicCustomPitch=22
ChannelPitch MusicChannel,LevelMusicCustomPitch*1000
; Menu
CreateIcon(9,0,4,4,"Menu","Open")
; Rucksack
If NofInventoryItems>0 Or UsedInventoryOnce=True Then CreateIcon(8,0,0,1,"Items","Open")
End Function
Function Loadlevel(name$,complete,create)
LevelFormat104=False
IsThereAFlipBridge=False
; complete=true: also create playercharacter, spellballs, etc (i.e. loaded from a savefile)
; create=true: actually create the entities (not done if loaded to change e.g. AdventureWonCommand)
file=ReadFile (name$)
Repeat
LevelWidth=ReadInt(file)
Until levelwidth<>-999
;If LevelWidth=-999 Then LevelWidth=ReadInt(file) ; crypted
LevelHeight=ReadInt(file)
LevelDetail=4
If LevelWidth>=1000
LevelFormat104=True
LevelWidth=LevelWidth-1000
EndIf
If Levelwidth>121 Then levelwidth=levelwidth-121
For j=0 To LevelHeight-1
For i=0 To LevelWidth-1
LevelTileTexture(i,j)=ReadInt(file)
LevelTileRotation(i,j)=ReadInt(file)
LevelTileSideTexture(i,j) =ReadInt(file)
LevelTileSideRotation(i,j)=ReadInt(file)
LevelTileRandom#(i,j)=ReadFloat(file)
LevelTileHeight#(i,j)=ReadFloat(file)
LevelTileExtrusion#(i,j)=ReadFloat(file)
LevelTileRounding(i,j)=ReadInt(file)
LevelTileEdgeRandom(i,j)=ReadInt(file)
LevelTileLogic(i,j)=ReadInt(file)
ObjectTileLogic(i,j)=0
Next
Next
For j=0 To LevelHeight-1
For i=0 To LevelWidth-1
WaterTileTexture(i,j)=ReadInt(file)
WaterTileRotation(i,j)=ReadInt(file)
WaterTileHeight(i,j)=ReadFloat(file)
WaterTileTurbulence(i,j)=ReadFloat(file)
Next
Next
WaterFlow=ReadInt(file)
WaterTransparent=ReadInt(file)
WaterGlow=ReadInt(file)
; LEVELTEXTURE
leveltexturename$=ReadString$(file)
usecustomleveltexture=False
If customleveltexture>0
FreeTexture customleveltexture
customleveltexture=0
EndIf
If custombgtexture1>0
FreeTexture custombgtexture1
custombgtexture1=0
EndIf
If custombgtexture2>0
FreeTexture custombgtexture2
custombgtexture2=0
EndIf
If Len(leveltexturename$)<14
ex$="custom"
Else
ex$=Mid$(leveltexturename$,10,Len(leveltexturename$)-9-4)
EndIf
If whichleveltexture(ex$)=-1
; custom texture
customleveltexture=LoadTexture(globaldirname$+"/custom/leveltextures/leveltex "+leveltexturename$+".bmp")
custombgtexture1=LoadTexture(globaldirname$+"/custom/leveltextures/backgroundtex "+leveltexturename$+"1.bmp")
custombgtexture2=LoadTexture(globaldirname$+"/custom/leveltextures/backgroundtex "+leveltexturename$+"2.bmp")
If customleveltexture=0 Or custombgtexture1=0 Or custombgtexture2=0
leveltexturename$="leveltex hills.bmp"
Else
usecustomleveltexture=True
EndIf
EndIf
; WATERTEXTURE
watertexturename$=ReadString$(file)
usecustomwatertexture=False
If customwatertexture>0
FreeTexture customwatertexture
customwatertexture=0
EndIf
If Len(waterTextureName$)<14
ex$="custom"
Else
ex$=Mid$(watertexturename$,10,Len(watertexturename$)-9-4)
EndIf
If whichwatertexture(ex$)=-1
; custom texture
customwatertexture=LoadTexture(globaldirname$+"/custom/leveltextures/watertex "+watertexturename$+".jpg")
If customwatertexture=0
watertexturename$="1"
Else
usecustomwatertexture=True
EndIf
EndIf
NofObjects=0
k=ReadInt(file)
For i=0 To k-1
LoadObject(file,complete,create)
Next
LevelEdgeStyle=ReadInt(file)
LightRedGoal=ReadInt(file)
LightGreenGoal=ReadInt(file)
LightBlueGoal=ReadInt(file)
AmbientRedGoal=ReadInt(file)
AmbientGreenGoal=ReadInt(file)
AmbientBlueGoal=ReadInt(file)
LevelMusic=ReadInt(file)
LevelWeather=ReadInt(file)
notusedadventuretitle4saving$=ReadString$(file)
;WispLight=CreateLight(3)
;PositionEntity wisplight,15,-10,.5
; end of first-time data
LevelTimer=0
LevelTimer=ReadInt(file) ; if it's there
FitForWidescreen=0
If LevelTimer=-2 ;if this is -2, we have extra values
Goto readextravalues
;Else
EndIf
; v1.04 - Save/Load the ObjectTileLogic for levels (except for player)
If Eof(file)=True
Else
;If Eof(file)=False
LevelFormat104=True
For j=0 To LevelHeight-1
For i=0 To LevelWidth-1
ObjectTileLogic(i,j)=ReadInt(file)
; delete any players
If (ObjectTileLogic(i,j) And 2^1) >0 And complete=False
ObjectTileLogic(i,j)=ObjectTileLogic(i,j)-2^1
EndIf
Next
Next
;EndIf
EndIf
If LevelFormat104=False ;if are not loading from a save file, use the value from master.dat
FitForWidescreen=FitForWidescreenGlobal
EndIf
If Eof(file)=False
If ReadInt(file)=-2
.readextravalues
temp=ReadInt(file)
If temp>-1 And temp<2
FitForWidescreen=temp
Else
FitForWidescreen=FitForWidescreenGlobal
EndIf
EndIf
EndIf
CloseFile file
End Function
Function EndLevel()
; clear everything
LevelMusicCustomPitch=44
i=0
While LevelEntity(i)>0
FreeEntity LevelEntity(i)
FreeEntity WaterEntity(i)
LevelEntity(i)=0
WaterEntity(i)=0
i=i+1
Wend
If BackGroundEntity1>0
FreeEntity BackGroundEntity1
BackGroundEntity1=0
EndIf
; If BackGroundTexture1>0
; FreeTexture BackGroundTexture1
; BackGroundTexture1=0
; EndIf
If BackGroundEntity2>0
FreeEntity BackGroundEntity2
BackGroundEntity2=0
EndIf
; If BackGroundTexture2>0
; FreeTexture BackGroundTexture2
; BackGroundTexture2=0
; EndIf
For i=0 To NofObjects-1
FreeEntity ObjectEntity(i)
ObjectEntity(i)=0
FreeTexture ObjectTexture(i)
ObjectTexture(i)=0
Next
NofObjects=0
If MousePickPlane>0
FreeEntity MousePickPlane
MousePickPlane=0;
EndIf
NofParticles=0
NofParticles2=0
For p.particle = Each particle
Delete p
Next
For p2.particle2 = Each particle2
Delete p2
Next
End Function
Function SaveLevel(name$)
file=WriteFile (name$)
WriteInt file,LevelWidth+1000
WriteInt file,LevelHeight
For j=0 To LevelHeight-1
For i=0 To LevelWidth-1
WriteInt file,LevelTileTexture(i,j) ; corresponding to squares in LevelTexture
WriteInt file,LevelTileRotation(i,j) ; 0-3 , and 4-7 for "flipped"
WriteInt file,LevelTileSideTexture(i,j) ; texture for extrusion walls
WriteInt file,LevelTileSideRotation(i,j) ; 0-3 , and 4-7 for "flipped"
WriteFloat file,LevelTileRandom#(i,j) ; random height pertubation of tile
WriteFloat file,LevelTileHeight#(i,j) ; height of "center" - e.g. to make ditches and hills
WriteFloat file,LevelTileExtrusion#(i,j); extrusion with walls around it
WriteInt file,LevelTileRounding(i,j); 0-no, 1-yes: are floors rounded if on a drop-off corner
WriteInt file,LevelTileEdgeRandom(i,j); 0-no, 1-yes: are edges rippled
WriteInt file,LevelTileLogic(i,j)
Next
Next
For j=0 To LevelHeight-1
For i=0 To LevelWidth-1
WriteInt file,WaterTileTexture(i,j)
WriteInt file,WaterTileRotation(i,j)
WriteFloat file,WaterTileHeight(i,j)
WriteFloat file,WaterTileTurbulence(i,j)
Next
Next
; Globals
WriteInt file,WaterFlow
WriteInt file,WaterTransparent
WriteInt file,WaterGlow
WriteString file,LevelTextureName$
WriteString file,WaterTextureName$
; Objects
WriteInt file,NofObjects
For i=0 To NofObjects-1
Dest=i
;WriteInt file,True;ObjectExists(Dest)
;WriteInt file ObjectEntity(Dest)=0
;ObjectTexture(Dest)=0
WriteString file,ObjectModelName$(Dest)
WriteString file,ObjectTextureName$(Dest)
WriteFloat file,ObjectXScale(Dest)
WriteFloat file,ObjectYScale(Dest)
WriteFloat file,ObjectZScale(Dest)
WriteFloat file,ObjectXAdjust(Dest)
WriteFloat file,ObjectYAdjust(Dest)
WriteFloat file,ObjectZAdjust(Dest)
WriteFloat file,ObjectPitchAdjust(Dest)
WriteFloat file,ObjectYawAdjust(Dest)
WriteFloat file,ObjectRollAdjust(Dest)
WriteFloat file,ObjectX(Dest)
WriteFloat file,ObjectY(Dest)
WriteFloat file,ObjectZ(Dest)
WriteFloat file,ObjectOldX(Dest)
WriteFloat file,ObjectOldY(Dest)
WriteFloat file,ObjectOldZ(Dest)
WriteFloat file,ObjectDX(Dest)
WriteFloat file,ObjectDY(Dest)
WriteFloat file,ObjectDZ(Dest)
WriteFloat file,ObjectPitch(Dest)
WriteFloat file,ObjectYaw(Dest)
WriteFloat file,ObjectRoll(Dest)
WriteFloat file,ObjectPitch2(Dest)
WriteFloat file,ObjectYaw2(Dest)
WriteFloat file,ObjectRoll2(Dest)
WriteFloat file,ObjectXGoal(Dest)
WriteFloat file,ObjectYGoal(Dest)
WriteFloat file,ObjectZGoal(Dest)
WriteInt file,ObjectMovementType(Dest)
WriteInt file,ObjectMovementTypeData(Dest)
WriteFloat file,ObjectSpeed(Dest)
WriteFloat file,ObjectRadius(Dest)
WriteInt file,ObjectRadiusType(Dest)
WriteInt file,ObjectData10(Dest)
WriteFloat file,ObjectPushDX(Dest)
WriteFloat file,ObjectPushDY(Dest)
WriteInt file,ObjectAttackPower(Dest)
WriteInt file,ObjectDefensePower(Dest)
WriteInt file,ObjectDestructionType(Dest)
WriteInt file,ObjectID(Dest)
WriteInt file,ObjectType(Dest)
WriteInt file,ObjectSubType(Dest)
WriteInt file,ObjectActive(Dest)
WriteInt file,ObjectLastActive(Dest)
WriteInt file,ObjectActivationType(Dest)
WriteInt file,ObjectActivationSpeed(Dest)
WriteInt file,ObjectStatus(Dest)
WriteInt file,ObjectTimer(Dest)
WriteInt file,ObjectTimerMax1(Dest)
WriteInt file,ObjectTimerMax2(Dest)
WriteInt file,ObjectTeleportable(Dest)
WriteInt file,ObjectButtonPush(Dest)
WriteInt file,ObjectWaterReact(Dest)
WriteInt file,ObjectTelekinesisable(Dest)
WriteInt file,ObjectFreezable(Dest)
WriteInt file,ObjectReactive(Dest)
WriteInt file,ObjectChild(Dest)
WriteInt file,ObjectParent(Dest)
For k=0 To 9
WriteInt file,ObjectData(Dest,k)
Next
For k=0 To 3
WriteString file,ObjectTextData(Dest,k)
Next
WriteInt file,ObjectTalkable(Dest)
WriteInt file,ObjectCurrentAnim(Dest)
WriteInt file,ObjectStandardAnim(Dest)
WriteInt file,ObjectTileX(Dest)
WriteInt file,ObjectTileY(Dest)
WriteInt file,ObjectTileX2(Dest)
WriteInt file,ObjectTileY2(Dest)
WriteInt file,ObjectMovementTimer(Dest)
WriteInt file,ObjectMovementSpeed(Dest)
WriteInt file,ObjectMoveXGoal(Dest)
WriteInt file,ObjectMoveYGoal(Dest)
WriteInt file,ObjectTileTypeCollision(Dest)
WriteInt file,ObjectObjectTypeCollision(Dest)
WriteInt file,ObjectCaged(Dest)
WriteInt file,ObjectDead(Dest)
WriteInt file,ObjectDeadTimer(Dest)
WriteInt file,ObjectExclamation(Dest)
WriteInt file,ObjectShadow(Dest)
WriteInt file,ObjectLinked(Dest)
WriteInt file,ObjectLinkBack(Dest)
WriteInt file,ObjectFlying(Dest)
WriteInt file,ObjectFrozen(Dest)
WriteInt file,ObjectIndigo(Dest)
WriteInt file,ObjectFutureInt24(Dest)
WriteInt file,ObjectFutureInt25(Dest)
WriteFloat file,ObjectScaleAdjust(Dest)
WriteFloat file,ObjectScaleXAdjust(Dest)
WriteFloat file,ObjectScaleYAdjust(Dest)
WriteFloat file,ObjectScaleZAdjust(Dest)
WriteFloat file,ObjectFutureFloat5(Dest)
WriteFloat file,ObjectFutureFloat6(Dest)
WriteFloat file,ObjectFutureFloat7(Dest)
WriteFloat file,ObjectFutureFloat8(Dest)
WriteFloat file,ObjectFutureFloat9(Dest)
WriteFloat file,ObjectFutureFloat10(Dest)
WriteString file,ObjectFutureString1$(Dest)
WriteString file,ObjectFutureString2$(Dest)
For k=0 To 30
WriteString file,"BLA"
Next
Next
WriteInt file,LevelEdgeStyle
; The Rest is "extra" data, i.e. stuff that is changed from the original level file
; TileLogic
; For j=0 To LevelHeight-1
; For i=0 To LevelWidth-1
; WriteInt file,LevelTileLogic(i,j)
; Next
; Next
; Lights
WriteInt file,LightRedGoal2
WriteInt file,LightGreenGoal2
WriteInt file,LightBlueGoal2
WriteInt file,AmbientRedGoal2
WriteInt file,AmbientGreenGoal2
WriteInt file,AmbientBlueGoal2
WriteInt file,LevelMusic
WriteInt file,LevelWeather
WriteString file,adventuretitle4saving$
If LevelTimer<1000000000
WriteInt file,LevelTimer
Else
WriteInt file,0
EndIf
;v1.04 data
For j=0 To LevelHeight-1
For i=0 To LevelWidth-1
WriteInt file,ObjectTileLogic(i,j)
Next
Next
WriteInt file,-2
WriteInt file,FitForWidescreen
CloseFile file