forked from smbx/smbx-legacy-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodEditor.bas
2077 lines (2033 loc) · 104 KB
/
modEditor.bas
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
Attribute VB_Name = "modEditor"
Option Explicit
Private ScrollDelay As Integer 'slows down the camera movement when scrolling through a level
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
X As Long
Y As Long
End Type
Public CursorPos As POINTAPI
Public HasCursor As Boolean
Public NoReallyKillIt As Boolean
Public curSection As Integer
Public Sub UpdateEditor()
'this sub handles the level editor
'it is still called when the player is testing a level in the editor in windowed mode
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim qLevel As Integer
Dim CanPlace As Boolean 'Determines if something is in the way
Dim tempBool As Boolean
Dim grabBool As Boolean
Dim tempLocation As Location
If Debugger = True Then
frmLevelDebugger.UpdateDisplay
End If
GameMenu = False
If EditorControls.Mouse1 = False Then MouseRelease = True
If LevelEditor = True Then numPlayers = 0
If MagicHand = True Then
MouseMove EditorCursor.X, EditorCursor.Y, True
frmNPCs.chkMessage.Enabled = False
Else
frmNPCs.chkMessage.Enabled = True
FreezeNPCs = False
LevelMacro = 0
LevelMacroCounter = 0
End If
If MagicHand = False And ScreenType <> 0 Then
ScreenType = 0
SetupScreens
End If
If MagicHand = False Then
If GetKeyState(vbKeyPageUp) And KEY_PRESSED Then
If ScrollRelease = True Then
ScrollRelease = False
frmLevelSettings.optSection(curSection).Value = False
curSection = curSection - 1
If curSection < 0 Then curSection = 0
If EditorCursor.Mode = 2 Then frmLevelSettings.optSection(curSection).Value = True
End If
ElseIf GetKeyState(vbKeyPageDown) And KEY_PRESSED Then
If ScrollRelease = True Then
ScrollRelease = False
frmLevelSettings.optSection(curSection).Value = False
curSection = curSection + 1
If curSection > 20 Then curSection = 20
If EditorCursor.Mode = 2 Then frmLevelSettings.optSection(curSection).Value = True
End If
Else
ScrollRelease = True
End If
If (vScreenY(1) + 8) Mod 32 <> 0 Then
vScreenY(1) = Int(vScreenY(1) / 32) * 32 - 8
End If
If vScreenX(1) Mod 32 <> 0 Then
vScreenX(1) = Int(vScreenX(1) / 32) * 32
End If
Else
curSection = Player(1).Section
frmLevelSettings.optSection(Player(1).Section).Value = True
End If
If WorldEditor = True Then
frmLevelEditor.mnuWorldEditor.Enabled = False
frmLevelEditor.mnuLevelEditor.Enabled = True
frmLevelEditor.menuView.Visible = False
frmLevelEditor.MenuTest.Visible = False
frmLevelEditor.picLevel.Visible = False
frmLevelEditor.picWorld.Visible = True
Else
frmLevelEditor.mnuWorldEditor.Enabled = True
frmLevelEditor.mnuLevelEditor.Enabled = False
frmLevelEditor.menuView.Visible = True
frmLevelEditor.MenuTest.Visible = True
frmLevelEditor.picWorld.Visible = False
frmLevelEditor.picLevel.Visible = True
End If
GetCursorPos CursorPos
With CursorPos
If .X * 15 > frmLevelEditor.Left + frmLevelWindow.Left + 200 And .X * 15 < frmLevelEditor.Left + frmLevelWindow.Left + frmLevelWindow.Width + 100 And .Y * 15 > frmLevelEditor.Top + frmLevelWindow.Top + 1150 And .Y * 15 < frmLevelEditor.Top + frmLevelWindow.Top + frmLevelWindow.Height + 700 Then
Else
HideCursor
End If
End With
If frmLevelEditor.Enabled = True Then
GetEditorControls
If GetKeyState(vbKeyShift) And KEY_PRESSED Then
ScrollDelay = 0
End If
If MagicHand = True Then ScrollDelay = 10
If ScrollDelay <= 0 Then
With EditorControls
If .Up = True Then
vScreenY(1) = vScreenY(1) + 32
EditorCursor.Location.Y = EditorCursor.Location.Y - 32
ScrollDelay = 2
MouseRelease = True
End If
If .Down = True Then
vScreenY(1) = vScreenY(1) - 32
EditorCursor.Location.Y = EditorCursor.Location.Y + 32
ScrollDelay = 2
MouseRelease = True
End If
If .Left = True Then
vScreenX(1) = vScreenX(1) + 32
EditorCursor.Location.X = EditorCursor.Location.X - 32
ScrollDelay = 2
MouseRelease = True
End If
If .Right = True Then
vScreenX(1) = vScreenX(1) - 32
EditorCursor.Location.X = EditorCursor.Location.X + 32
ScrollDelay = 2
MouseRelease = True
End If
End With
Else
ScrollDelay = ScrollDelay - 1
End If
SetCursor
'this is where objects are placed/grabbed/deleted
With EditorCursor
If EditorControls.Mouse1 = True Then
CanPlace = True
If .Mode = 13 Or .Mode = 14 Then
If MouseRelease = True Then
For A = 1 To 2
If CursorCollision(.Location, PlayerStart(A)) = True Then
PlaySound 23
.Location = PlayerStart(A)
PlayerStart(A).X = 0
PlayerStart(A).Y = 0
frmLevelEditor.optCursor(2).Value = True
frmLevelSettings.optLevel(3 + A).Value = True
.Mode = 2
MouseMove .X, .Y
MouseRelease = False
Netplay.sendData "v" & A & "|" & PlayerStart(A).X & "|" & PlayerStart(A).Y & "|" & PlayerStart(A).Width & "|" & PlayerStart(A).Height & LB
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numNPCs
tempLocation = NPC(A).Location
If NPC(A).Type = 91 Then tempLocation.Y = tempLocation.Y - 16
If CursorCollision(.Location, tempLocation) = True And NPC(A).Hidden = False Then
PlaySound 23
B = 0
frmLevelEditor.optCursor(4).Value = True
If NPC(A).Type = 91 Or NPC(A).Type = 284 Or NPC(A).Type = 283 Or (NPC(A).Type = 96 And NPC(A).Special <> 0 And NPC(A).Special <> 96) Then
If NPC(A).Special > 0 Then
Do While frmNPCs.NPC(NPC(A).Special).Visible = False
frmNPCs.optGame(B).Value = True
B = B + 1
If B > frmNPCs.optGame.Count - 1 Then Exit Do
Loop
End If
Else
Do While frmNPCs.NPC(NPC(A).Type).Visible = False
frmNPCs.optGame(B).Value = True
B = B + 1
If B > frmNPCs.optGame.Count - 1 Then Exit Do
Loop
End If
frmNPCs.NPC(NPC(A).Type).Value = True
frmNPCs.NPCText = NPC(A).Text
If NPC(A).Inert = True Then
frmNPCs.Friendly.Caption = "Yes"
Else
frmNPCs.Friendly.Caption = "No"
End If
If NPC(A).Stuck = True Then
frmNPCs.DontMove.Caption = "Yes"
Else
frmNPCs.DontMove.Caption = "No"
End If
If NPC(A).Legacy = True Then
frmNPCAdvanced.Legacy.Caption = "Yes"
frmNPCAdvanced.Show
Else
frmNPCAdvanced.Legacy.Caption = "No"
End If
If NPC(A).Type = 288 Or NPC(A).Type = 289 Or (NPC(A).Type = 91 And NPC(A).Special = 288) Then
frmNPCAdvanced.Show
frmNPCAdvanced.WarpSection.ListIndex = NPC(A).Special2
frmNPCAdvanced.WarpSection.Text = frmNPCAdvanced.WarpSection.List(frmNPCAdvanced.WarpSection.ListIndex)
End If
frmAdvanced.AttLayer = NPC(A).AttLayer
If frmAdvanced.AttLayer <> "" Then frmAdvanced.Show
frmAdvanced.TriggerActivate = NPC(A).TriggerActivate
frmAdvanced.TriggerDeath = NPC(A).TriggerDeath
frmAdvanced.TriggerTalk = NPC(A).TriggerTalk
frmAdvanced.TriggerLast = NPC(A).TriggerLast
If frmAdvanced.TriggerActivate <> "" Or frmAdvanced.TriggerDeath <> "" Or frmAdvanced.TriggerTalk <> "" Or frmAdvanced.TriggerLast <> "" Then
frmAdvanced.Show
End If
If NPC(A).Generator = True Then
frmGenerator.Show
frmGenerator.Spawn.Caption = "Yes"
frmGenerator.scrDelay.Value = NPC(A).GeneratorTimeMax
frmGenerator.optEffect(NPC(A).GeneratorEffect).Value = True
frmGenerator.optSpawnDirection(NPC(A).GeneratorDirection).Value = True
frmGenerator.CheckSpawn
Else
frmGenerator.Spawn.Caption = "No"
End If
If NPC(A).Type = 91 Then
frmNPCs.Buried.Caption = "Yes"
If NPC(A).Special > 0 Then frmNPCs.NPC(NPC(A).Special).Value = True
Else
frmNPCs.Buried.Caption = "No"
End If
If NPC(A).Type = 283 Then
frmNPCs.Bubble.Caption = "Yes"
If NPC(A).Special > 0 Then frmNPCs.NPC(NPC(A).Special).Value = True
Else
frmNPCs.Bubble.Caption = "No"
End If
If NPC(A).Type = 284 Then
frmNPCs.Lakitu.Caption = "Yes"
If NPC(A).Special > 0 Then frmNPCs.NPC(NPC(A).Special).Value = True
Else
frmNPCs.Lakitu.Caption = "No"
End If
If NPC(A).Type = 96 Then
If NPC(A).Special <> 0 And NPC(A).Special <> 96 Then
frmNPCs.Egg.Caption = "Yes"
If NPC(A).Special > 0 Then frmNPCs.NPC(NPC(A).Special).Value = True
End If
Else
frmNPCs.Egg.Caption = "No"
End If
If NPCIsAParaTroopa(NPC(A).Type) = True Then
frmNPCAdvanced.cmbPara.ListIndex = NPC(A).Special
frmNPCAdvanced.Show
End If
If NPCIsCheep(NPC(A).Type) = True Then
frmNPCAdvanced.cmbCheep.ListIndex = NPC(A).Special
frmNPCAdvanced.Show
End If
If NPC(A).Type = 260 Then
frmNPCAdvanced.scrFire.Value = NPC(A).Special
frmNPCAdvanced.Show
End If
For B = 0 To frmLayers.lstLayer.ListCount - 1
If LCase(NPC(A).Layer) = LCase(frmLayers.lstLayer.List(B)) Then
frmLayers.lstLayer.ListIndex = B
Exit For
End If
Next B
frmNPCs.optNPCDirection(NPC(A).Direction + 1).Value = True
EditorCursor.Mode = 4
EditorCursor.Location.X = NPC(A).Location.X
EditorCursor.Location.Y = NPC(A).Location.Y
SetCursor
Netplay.sendData Netplay.EraseNPC(A, 1) & "p23" & LB
KillNPC A, 9
MouseRelease = False
tempBool = True
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numBlock
If BlockIsSizable(Block(A).Type) = False Then
If CursorCollision(.Location, Block(A).Location) = True And Block(A).Hidden = False Then
PlaySound 23
frmLevelEditor.optCursor(1).Value = True
B = 0
Do While frmBlocks.Block(Block(A).Type).Visible = False
If B > frmBlocks.optGame.Count - 1 Then Exit Do
frmBlocks.optGame(B).Value = True
If B = 0 Then
For C = 0 To frmBlocks.SMB3.Count - 1
frmBlocks.optSMB3(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 1 Then
For C = 0 To frmBlocks.SMB2.Count - 1
frmBlocks.optSMB2(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 2 Then
For C = 0 To frmBlocks.SMB1.Count - 1
frmBlocks.optSMB1(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 3 Then
For C = 0 To frmBlocks.SMW.Count - 1
frmBlocks.optSMW(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 4 Then
For C = 0 To frmBlocks.Misc.Count - 1
frmBlocks.optMisc(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
B = B + 1
Loop
frmBlocks.Block(Block(A).Type).Value = True
frmAdvancedBlock.TriggerHit.Text = Block(A).TriggerHit
frmAdvancedBlock.TriggerDeath.Text = Block(A).TriggerDeath
frmAdvancedBlock.TriggerLast = Block(A).TriggerLast
If Block(A).Special >= 1 And Block(A).Special <= 99 Then
frmBlocks.optBlockS.Value = -Block(A).Special
ElseIf Block(A).Special > 1000 Then
frmBlocks.optBlockS.Value = Block(A).Special - 1000
End If
If Block(A).Invis = True Then
frmBlocks.cmdInvis.Caption = "Yes"
Else
frmBlocks.cmdInvis.Caption = "No"
End If
If Block(A).Slippy = True Then
frmBlocks.cmdSlip.Caption = "Yes"
Else
frmBlocks.cmdSlip.Caption = "No"
End If
For B = 0 To frmLayers.lstLayer.ListCount - 1
If LCase(Block(A).Layer) = LCase(frmLayers.lstLayer.List(B)) Then
frmLayers.lstLayer.ListIndex = B
Exit For
End If
Next B
EditorCursor.Mode = 1
EditorCursor.Location.X = Block(A).Location.X
EditorCursor.Location.Y = Block(A).Location.Y
SetCursor
Netplay.sendData Netplay.EraseBlock(A, 1)
KillBlock A, False
MouseRelease = False
FindSBlocks
Exit For
End If
End If
Next A
End If
If MouseRelease = True And MagicHand = False Then
For A = 1 To numWarps
If CursorCollision(.Location, Warp(A).Entrance) And Warp(A).Hidden = False Then
PlaySound 23
Warp(A).PlacedEnt = False
If Warp(A).NoYoshi = True Then
frmWarp.cmdYoshi.Caption = "Yes"
Else
frmWarp.cmdYoshi.Caption = "No"
End If
If Warp(A).WarpNPC = True Then
frmWarp.cmdNPC.Caption = "Yes"
Else
frmWarp.cmdNPC.Caption = "No"
End If
If Warp(A).Locked = True Then
frmWarp.cmdLocked.Caption = "Yes"
Else
frmWarp.cmdLocked.Caption = "No"
End If
frmLevelEditor.optCursor(5).Value = True
If Warp(A).MapWarp = True Then
frmWarp.chkMapWarp.Value = 1
Else
frmWarp.chkMapWarp.Value = 0
End If
frmWarp.optE(1).Value = True
frmWarp.optDirection(Warp(A).Direction).Value = True
frmWarp.optDirection2(Warp(A).Direction2).Value = True
frmWarp.optEffect(Warp(A).Effect).Value = True
frmWarp.txtLevel = Warp(A).level
frmWarp.scrWarp.Value = Warp(A).LevelWarp
frmWarp.chkEntrance.Value = Val(Warp(A).LevelEnt)
frmWarp.txtStars = Warp(A).Stars
If frmWarp.txtStars = 0 Then frmWarp.txtStars = ""
frmWarp.txtX = Warp(A).MapX
frmWarp.txtY = Warp(A).MapY
If frmWarp.txtX = -1 Then frmWarp.txtX = ""
If frmWarp.txtY = -1 Then frmWarp.txtY = ""
MouseRelease = False
If Warp(A).LevelEnt = True Then
frmWarp.chkEntrance = 1
Warp(A).PlacedExit = False
End If
If nPlay.Online = True Then Netplay.sendData Netplay.AddWarp(A)
Exit For
ElseIf CursorCollision(.Location, Warp(A).Exit) Then
PlaySound 23
Warp(A).PlacedExit = False
If Warp(A).NoYoshi = True Then
frmWarp.cmdYoshi.Caption = "Yes"
Else
frmWarp.cmdYoshi.Caption = "No"
End If
If Warp(A).WarpNPC = True Then
frmWarp.cmdNPC.Caption = "Yes"
Else
frmWarp.cmdNPC.Caption = "No"
End If
If Warp(A).Locked = True Then
frmWarp.cmdLocked.Caption = "Yes"
Else
frmWarp.cmdLocked.Caption = "No"
End If
frmLevelEditor.optCursor(5).Value = True
If Warp(A).MapWarp = True Then
frmWarp.chkMapWarp.Value = 1
Else
frmWarp.chkMapWarp.Value = 0
End If
frmWarp.optE(2).Value = True
frmWarp.optDirection(Warp(A).Direction).Value = True
frmWarp.optDirection2(Warp(A).Direction2).Value = True
frmWarp.optEffect(Warp(A).Effect).Value = True
frmWarp.txtLevel = Warp(A).level
frmWarp.scrWarp.Value = Warp(A).LevelWarp
frmWarp.chkEntrance.Value = Warp(A).LevelEnt
frmWarp.txtStars = Warp(A).Stars
If frmWarp.txtStars = 0 Then frmWarp.txtStars = ""
frmWarp.txtX = Warp(A).MapX
frmWarp.txtY = Warp(A).MapY
If frmWarp.txtX = -1 Then frmWarp.txtX = ""
If frmWarp.txtY = -1 Then frmWarp.txtY = ""
MouseRelease = False
If Warp(A).LevelEnt = True Then
frmWarp.chkEntrance = 1
Warp(A).PlacedEnt = False
End If
If nPlay.Online = True Then Netplay.sendData Netplay.AddWarp(A)
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = numBackground To 1 Step -1
If CursorCollision(.Location, Background(A).Location) = True And Background(A).Hidden = False Then
PlaySound 23
frmLevelEditor.optCursor(3).Value = True
B = 0
Do While frmBackgrounds.Background(Background(A).Type).Visible = False
frmBackgrounds.optGame(B).Value = True
B = B + 1
Loop
For B = 0 To frmLayers.lstLayer.ListCount - 1
If LCase(Background(A).Layer) = LCase(frmLayers.lstLayer.List(B)) Then
frmLayers.lstLayer.ListIndex = B
Exit For
End If
Next B
frmBackgrounds.Background(Background(A).Type).Value = True
EditorCursor.Location.X = Background(A).Location.X
EditorCursor.Location.Y = Background(A).Location.Y
SetCursor
Netplay.sendData Netplay.EraseBackground(A, 1) & "p23" & LB
Background(A) = Background(numBackground)
numBackground = numBackground - 1
If MagicHand = True Then UpdateBackgrounds
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numBlock
If BlockIsSizable(Block(A).Type) = True Then
If CursorCollision(.Location, Block(A).Location) = True And Block(A).Hidden = False Then
PlaySound 23
frmLevelEditor.optCursor(1).Value = True
B = 0
Do While frmBlocks.Block(Block(A).Type).Visible = False
If B > frmBlocks.optGame.Count - 1 Then Exit Do
frmBlocks.optGame(B).Value = True
If B = 0 Then
For C = 0 To frmBlocks.SMB3.Count - 1
frmBlocks.optSMB3(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 1 Then
For C = 0 To frmBlocks.SMB2.Count - 1
frmBlocks.optSMB2(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 2 Then
For C = 0 To frmBlocks.SMB1.Count - 1
frmBlocks.optSMB1(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 3 Then
For C = 0 To frmBlocks.SMW.Count - 1
frmBlocks.optSMW(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
If B = 4 Then
For C = 0 To frmBlocks.Misc.Count - 1
frmBlocks.optMisc(C).Value = True
If frmBlocks.Block(Block(A).Type).Visible = True Then Exit For
Next C
End If
B = B + 1
Loop
frmBlocks.Block(Block(A).Type).Value = True
If Block(A).Special >= 1 And Block(A).Special <= 99 Then
frmBlocks.optBlockS.Value = -Block(A).Special
ElseIf Block(A).Special > 1000 Then
frmBlocks.optBlockS.Value = Block(A).Special - 1000
End If
If Block(A).Invis = True Then
frmBlocks.cmdInvis.Caption = "Yes"
Else
frmBlocks.cmdInvis.Caption = "No"
End If
If Block(A).Slippy = True Then
frmBlocks.cmdSlip.Caption = "Yes"
Else
frmBlocks.cmdSlip.Caption = "No"
End If
For B = 0 To frmLayers.lstLayer.ListCount - 1
If LCase(Block(A).Layer) = LCase(frmLayers.lstLayer.List(B)) Then
frmLayers.lstLayer.ListIndex = B
Exit For
End If
Next B
frmAdvancedBlock.TriggerHit = Block(A).TriggerHit
frmAdvancedBlock.TriggerDeath = Block(A).TriggerDeath
frmAdvancedBlock.TriggerLast = Block(A).TriggerLast
frmBlocks.BlockW.Value = Block(A).Location.Width / 32
frmBlocks.BlockH.Value = Block(A).Location.Height / 32
EditorCursor.Mode = 1
EditorCursor.Location.X = Block(A).Location.X
EditorCursor.Location.Y = Block(A).Location.Y
SetCursor
Netplay.sendData Netplay.EraseBlock(A, 1)
KillBlock A, False
MouseRelease = False
FindSBlocks
Exit For
End If
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWater
If CursorCollision(.Location, Water(A).Location) = True Then
PlaySound 23
frmLevelEditor.optCursor(15).Value = True
frmWater.WaterW = Water(A).Location.Width / 32
frmWater.WaterH = Water(A).Location.Height / 32
If .Water.Quicksand = True Then
frmWater.Quicksand.Caption = "Yes"
Else
frmWater.Quicksand.Caption = "No"
End If
If nPlay.Online = True Then Netplay.sendData "y" & A & LB & "p23" & LB
Water(A) = Water(numWater)
numWater = numWater - 1
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWorldMusic
If CursorCollision(.Location, WorldMusic(A).Location) = True Then
PlaySound 23
frmLevelEditor.optCursor(11).Value = True
.Mode = 11
.Location = WorldMusic(A).Location
SetCursor
frmMusic.optMusic(WorldMusic(A).Type).Value = True
WorldMusic(A) = WorldMusic(numWorldMusic)
numWorldMusic = numWorldMusic - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWorldPaths
If CursorCollision(.Location, WorldPath(A).Location) = True Then
PlaySound 23
frmLevelEditor.optCursor(10).Value = True
frmPaths.WorldPath(WorldPath(A).Type).Value = True
.Mode = 10
.Location = WorldPath(A).Location
SetCursor
WorldPath(A) = WorldPath(numWorldPaths)
numWorldPaths = numWorldPaths - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = numScenes To 1 Step -1
If CursorCollision(.Location, Scene(A).Location) = True Then
PlaySound 23
frmLevelEditor.optCursor(8).Value = True
frmScene.Scene(Scene(A).Type).Value = True
.Mode = 8
.Location = Scene(A).Location
SetCursor
MouseMove .X, .Y
For B = A To numScenes - 1
Scene(B) = Scene(B + 1)
Next B
numScenes = numScenes - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWorldLevels
If CursorCollision(.Location, WorldLevel(A).Location) = True Then
PlaySound 23
frmLevelEditor.optCursor(9).Value = True
frmLevels.WorldLevel(WorldLevel(A).Type).Value = True
With WorldLevel(A)
frmLevels.txtLevelName = .LevelName
frmLevels.txtFilename = .FileName
frmLevels.scrWarp.Value = .StartWarp
If .WarpX = -1 Then
frmLevels.txtX = ""
Else
frmLevels.txtX = .WarpX
End If
If .WarpY = -1 Then
frmLevels.txtY = ""
Else
frmLevels.txtY = .WarpY
End If
If .Path = True Then
frmLevels.chkPath.Value = 1
Else
frmLevels.chkPath.Value = 0
End If
If .Path2 = True Then
frmLevels.chkPath2.Value = 1
Else
frmLevels.chkPath2.Value = 0
End If
If .Start = True Then
frmLevels.chkStart.Value = 1
Else
frmLevels.chkStart.Value = 0
End If
If .Visible = True Then
frmLevels.chkVisible.Value = 1
Else
frmLevels.chkVisible.Value = 0
End If
For B = 1 To 4
frmLevels.cmbExit(B).ListIndex = .LevelExit(B) + 1
Next B
End With
.Mode = 9
.Location = WorldLevel(A).Location
SetCursor
WorldLevel(A) = WorldLevel(numWorldLevels)
numWorldLevels = numWorldLevels - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numTiles
If CursorCollision(.Location, Tile(A).Location) = True Then
PlaySound 23
frmLevelEditor.optCursor(7).Value = True
frmTiles.Tile(Tile(A).Type).Value = True
If frmTiles.Tile(Tile(A).Type).Visible = False Then
For B = 0 To frmTiles.Game.Count - 1
frmTiles.optGame(B).Value = True
If frmTiles.Tile(Tile(A).Type).Visible = True Then Exit For
Next B
End If
.Mode = 7
.Location = Tile(A).Location
SetCursor
Tile(A) = Tile(numTiles)
numTiles = numTiles - 1
MouseRelease = False
Exit For
End If
Next A
End If
ElseIf .Mode = 15 Then ' Water
If MouseRelease = True Then
MouseRelease = False
CanPlace = True
For A = 1 To numWater
If Water(A).Location.X = .Location.X And Water(A).Location.Y = .Location.Y And Water(A).Location.Height = .Location.Height And Water(A).Location.Width = .Location.Width Then
CanPlace = False
Exit For
End If
Next A
If CanPlace = True Then
numWater = numWater + 1
Water(numWater) = .Water
If nPlay.Online = True Then Netplay.sendData Netplay.AddWater(numWater)
End If
End If
ElseIf .Mode = 0 Or .Mode = 6 Then 'Eraser
If MouseRelease = True Then
For A = 1 To numNPCs
tempLocation = NPC(A).Location
If NPC(A).Type = 91 Then tempLocation.Y = tempLocation.Y - 16
If CursorCollision(.Location, tempLocation) = True And NPC(A).Hidden = False Then
If Int(Rnd * 2) = 0 Then
NPC(A).Location.SpeedX = Physics.NPCShellSpeed / 2
Else
NPC(A).Location.SpeedX = -(Physics.NPCShellSpeed / 2)
End If
Netplay.sendData Netplay.EraseNPC(A, 0)
If NPCIsABonus(NPC(A).Type) Or NPCIsACoin(NPC(A).Type) Then
KillNPC A, 4 'Kill the bonus/coin
Else
KillNPC A, 2 'Kill the NPC
End If
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numBlock
If BlockIsSizable(Block(A).Type) = False Then
If CursorCollision(.Location, Block(A).Location) = True And Block(A).Hidden = False Then
Netplay.sendData Netplay.EraseBlock(A)
KillBlock A 'Erase the block
FindSBlocks
MouseRelease = False
Exit For
End If
End If
Next A
End If
If MouseRelease = True And MagicHand = False Then
For A = 1 To numWarps
tempLocation = Warp(A).Entrance
tempLocation.Height = 32
tempLocation.Width = 32
If CursorCollision(.Location, tempLocation) Then
KillWarp A
If nPlay.Online = True Then Netplay.sendData "B" & A & LB
MouseRelease = False
Exit For
End If
tempLocation = Warp(A).Exit
tempLocation.Height = 32
tempLocation.Width = 32
If CursorCollision(.Location, tempLocation) Then
KillWarp A
If nPlay.Online = True Then Netplay.sendData "B" & A & LB
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = numBackground To 1 Step -1
If CursorCollision(.Location, Background(A).Location) = True And Background(A).Hidden = False Then
Netplay.sendData Netplay.EraseBackground(A, 0)
With Background(A)
.Location.X = .Location.X + .Location.Width / 2 - EffectWidth(10) / 2
.Location.Y = .Location.Y + .Location.Height / 2 - EffectHeight(10) / 2
NewEffect 10, .Location
PlaySound 36
End With
Background(A) = Background(numBackground)
numBackground = numBackground - 1
MouseRelease = False
If MagicHand = True Then UpdateBackgrounds
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = numBlock To 1 Step -1
If BlockIsSizable(Block(A).Type) = True Then
If CursorCollision(.Location, Block(A).Location) = True And Block(A).Hidden = False Then
Netplay.sendData Netplay.EraseBlock(A)
KillBlock A 'Erase the block
FindSBlocks
MouseRelease = False
Exit For
End If
End If
Next A
End If
If MouseRelease = True And LevelEditor = True Then
For A = 1 To numWater
tempLocation = Water(A).Location
If CursorCollision(.Location, tempLocation) = True And Water(A).Hidden = False Then
PlaySound 36
If nPlay.Online = True Then Netplay.sendData "y" & A & LB & "p36" & LB
Water(A) = Water(numWater)
numWater = numWater - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWorldMusic
If CursorCollision(.Location, WorldMusic(A).Location) = True Then
tempLocation = WorldMusic(A).Location
tempLocation.X = tempLocation.X + tempLocation.Width / 2 - EffectWidth(10) / 2
tempLocation.Y = tempLocation.Y + tempLocation.Height / 2 - EffectHeight(10) / 2
NewEffect 10, tempLocation
PlaySound 9
WorldMusic(A) = WorldMusic(numWorldMusic)
numWorldMusic = numWorldMusic - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWorldPaths
If CursorCollision(.Location, WorldPath(A).Location) = True Then
tempLocation = WorldPath(A).Location
tempLocation.X = tempLocation.X + tempLocation.Width / 2 - EffectWidth(10) / 2
tempLocation.Y = tempLocation.Y + tempLocation.Height / 2 - EffectHeight(10) / 2
NewEffect 10, tempLocation
PlaySound 9
WorldPath(A) = WorldPath(numWorldPaths)
numWorldPaths = numWorldPaths - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = numScenes To 1 Step -1
If CursorCollision(.Location, Scene(A).Location) = True Then
tempLocation = Scene(A).Location
tempLocation.X = tempLocation.X + tempLocation.Width / 2 - EffectWidth(10) / 2
tempLocation.Y = tempLocation.Y + tempLocation.Height / 2 - EffectHeight(10) / 2
NewEffect 10, tempLocation
PlaySound 9
For B = A To numScenes - 1
Scene(B) = Scene(B + 1)
Next B
numScenes = numScenes - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numWorldLevels
If CursorCollision(.Location, WorldLevel(A).Location) = True Then
tempLocation = WorldLevel(A).Location
tempLocation.X = tempLocation.X + tempLocation.Width / 2 - EffectWidth(10) / 2
tempLocation.Y = tempLocation.Y + tempLocation.Height / 2 - EffectHeight(10) / 2
NewEffect 10, tempLocation
PlaySound 9
WorldLevel(A) = WorldLevel(numWorldLevels)
numWorldLevels = numWorldLevels - 1
MouseRelease = False
Exit For
End If
Next A
End If
If MouseRelease = True Then
For A = 1 To numTiles
If CursorCollision(.Location, Tile(A).Location) = True Then
tempLocation = Tile(A).Location
tempLocation.X = tempLocation.X + tempLocation.Width / 2 - EffectWidth(10) / 2
tempLocation.Y = tempLocation.Y + tempLocation.Height / 2 - EffectHeight(10) / 2
NewEffect 10, tempLocation
PlaySound 9
Tile(A) = Tile(numTiles)
numTiles = numTiles - 1
MouseRelease = False
Exit For
End If
Next A
End If
ElseIf .Mode = 1 Then 'Blocks
For A = 1 To numBlock
If Not BlockIsSizable(Block(A).Type) And Not BlockIsSizable(.Block.Type) Then
If CursorCollision(.Location, Block(A).Location) = True And Block(A).Hidden = False Then
CanPlace = False
End If
Else
If Block(A).Type = .Block.Type Then
If .Location.X = Block(A).Location.X And .Location.Y = Block(A).Location.Y Then CanPlace = False
End If
End If
Next A
If Not BlockIsSizable(.Block.Type) And Not .Block.Type = 370 Then
For A = 1 To numNPCs
If NPC(A).Type <> 91 And NPC(A).Type <> 259 And NPC(A).Type <> 260 Then
If CursorCollision(.Location, NPC(A).Location) = True And NPC(A).Hidden = False And NPC(A).Active = True Then
CanPlace = False
End If
End If
Next A
For A = 1 To 2
If CursorCollision(.Location, PlayerStart(A)) = True And MagicHand = False Then CanPlace = False
Next A
End If
If CanPlace = True Then 'Nothing is in the way
If frmBlocks.chkFill.Value = 1 Then
BlockFill EditorCursor.Block.Location
If MagicHand = True Then
For A = -FLBlocks To FLBlocks
FirstBlock(A) = 1
LastBlock(A) = numBlock
Next A
BlocksSorted = False
End If
FindSBlocks
Else
If numBlock < maxBlocks Then 'Not out of blocks
numBlock = numBlock + 1
Block(numBlock) = EditorCursor.Block
Block(numBlock).DefaultType = Block(numBlock).Type
Block(numBlock).DefaultSpecial = Block(numBlock).Special
If MagicHand = True Then
For A = -FLBlocks To FLBlocks
FirstBlock(A) = 1
LastBlock(A) = numBlock
Next A
BlocksSorted = False
End If
End If
FindSBlocks
If nPlay.Online = True Then
Netplay.sendData Netplay.AddBlock(numBlock)
End If
End If
End If
ElseIf .Mode = 2 And MagicHand = False Then 'Level
If frmLevelSettings.optLevel(0).Value = True Then 'Top
level(curSection).Y = Int(.Location.Y / 32) * 32
If level(curSection).Height - level(curSection).Y < 600 Then level(curSection).Y = level(curSection).Height - 600
ElseIf frmLevelSettings.optLevel(1).Value = True Then 'Left
level(curSection).X = Int(.Location.X / 32) * 32
If level(curSection).Width - level(curSection).X < 800 Then level(curSection).X = level(curSection).Width - 800
ElseIf frmLevelSettings.optLevel(2).Value = True Then 'Right
level(curSection).Width = Int(.Location.X / 32) * 32
If level(curSection).Width - level(curSection).X < 800 Then level(curSection).Width = level(curSection).X + 800
ElseIf frmLevelSettings.optLevel(3).Value = True Then 'Bottom
level(curSection).Height = Int(.Location.Y / 32) * 32
If level(curSection).Height - level(curSection).Y < 600 Then level(curSection).Height = level(curSection).Y + 600
ElseIf frmLevelSettings.optLevel(4).Value = True Or frmLevelSettings.optLevel(5).Value = True Then
If frmLevelSettings.optLevel(4).Value = True Then
B = 1
Else
B = 2
End If
For A = 1 To 2
If CursorCollision(.Location, PlayerStart(A)) = True And A <> B Then CanPlace = False
Next A
For A = 1 To numBlock
If CursorCollision(.Location, Block(A).Location) = True And Block(A).Hidden = False And Block(A).Invis = False And BlockIsSizable(Block(A).Type) = False And BlockNoClipping(Block(A).Type) = False And BlockOnlyHitspot1(Block(A).Type) = False And BlockSlope(Block(A).Type) = 0 And BlockSlope2(Block(A).Type) = 0 Then CanPlace = False
Next A
If CanPlace = True Then
If frmLevelSettings.optLevel(4).Value = True Then
PlayerStart(1) = .Location
Netplay.sendData "v" & 1 & "|" & PlayerStart(1).X & "|" & PlayerStart(1).Y & "|" & PlayerStart(1).Width & "|" & PlayerStart(1).Height & LB
Else
PlayerStart(2) = .Location
Netplay.sendData "v" & 2 & "|" & PlayerStart(2).X & "|" & PlayerStart(2).Y & "|" & PlayerStart(2).Width & "|" & PlayerStart(2).Height & LB
End If
End If