forked from smbx/smbx-legacy-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modBlocks.bas
1540 lines (1492 loc) · 63.9 KB
/
modBlocks.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 = "modBlocks"
Option Explicit
Public Sub BlockHit(A As Integer, Optional HitDown As Boolean = False, Optional whatPlayer As Integer = 0) 'The block was hit by a player
Dim tempPlayer As Integer
Dim makeShroom As Boolean 'if true make amushroom
Dim newBlock As Integer 'what the block should turn into if anything
Dim C As Integer
Dim B As Integer
Dim blankBlock As Block
Dim tempBool As Boolean
Dim oldSpecial As Integer 'previous .Special
Dim tempLocation As Location
With Block(A)
If BattleMode = True And .RespawnDelay = 0 Then
.RespawnDelay = 1
End If
If (.Type >= 622 And .Type <= 625) Or .Type = 631 Then
If whatPlayer = 0 Then
Exit Sub
Else
.Special = 0
For B = 1 To numPlayers
SavedChar(Player(whatPlayer).Character) = Player(whatPlayer)
If Player(B).Character = 1 Then BlockFrame(622) = 4
If Player(B).Character = 2 Then BlockFrame(623) = 4
If Player(B).Character = 3 Then BlockFrame(624) = 4
If Player(B).Character = 4 Then BlockFrame(625) = 4
If Player(B).Character = 5 Then BlockFrame(631) = 4
Next B
If BlockFrame(.Type) < 4 Then
PlaySound 34
'UnDuck whatPlayer
If .Type = 622 Then Player(whatPlayer).Character = 1
If .Type = 623 Then Player(whatPlayer).Character = 2
If .Type = 624 Then Player(whatPlayer).Character = 3
If .Type = 625 Then Player(whatPlayer).Character = 4
If .Type = 631 Then Player(whatPlayer).Character = 5
With Player(whatPlayer)
Player(whatPlayer).State = SavedChar(Player(whatPlayer).Character).State
Player(whatPlayer).HeldBonus = SavedChar(Player(whatPlayer).Character).HeldBonus
Player(whatPlayer).Mount = SavedChar(Player(whatPlayer).Character).Mount
Player(whatPlayer).MountType = SavedChar(Player(whatPlayer).Character).MountType
Player(whatPlayer).Hearts = SavedChar(Player(whatPlayer).Character).Hearts
If .State = 0 Then .State = 1
.FlySparks = False
.Immune = 50
.Effect = 8
.Effect2 = 14
If .Mount <= 1 Then
.Location.Height = Physics.PlayerHeight(.Character, .State)
If .Mount = 1 And .State = 1 Then .Location.Height = Physics.PlayerHeight(1, 2)
.StandUp = True
End If
tempLocation = .Location
tempLocation.Y = .Location.Y + .Location.Height / 2 - 16
tempLocation.X = .Location.X + .Location.Width / 2 - 16
NewEffect 10, tempLocation
End With
Else
Exit Sub
End If
End If
End If
oldSpecial = .Special
If .ShakeY <> 0 Or .ShakeY2 <> 0 Or .ShakeY3 <> 0 Then 'if the block has just been hit, ignore
If .RapidHit > 0 And Player(whatPlayer).Character = 4 And whatPlayer > 0 Then
.RapidHit = Int(Rnd * 3) + 1
End If
Exit Sub
End If
.Invis = False
If HitDown = True And .Special > 0 Then
tempBool = False
For B = 1 To numBlock
If B <> A Then
If CheckCollision(Block(A).Location, newLoc(Block(B).Location.X + 4, Block(B).Location.Y - 16, Block(B).Location.Width - 8, Block(B).Location.Height)) Then
HitDown = False
Exit For
End If
End If
Next B
End If
If nPlay.Online = True And nPlay.Mode = 1 Then 'online code
If HitDown = False Then
Netplay.sendData "3a" & B & LB
Else
Netplay.sendData "3b" & B & LB
End If
End If
If .Special = 1225 Or .Special = 1226 Or .Special = 1227 Then
HitDown = False
End If
'Shake the block
If .Type = 4 Or .Type = 615 Or .Type = 55 Or .Type = 60 Or .Type = 90 Or .Type = 159 Or .Type = 169 Or .Type = 170 Or .Type = 173 Or .Type = 176 Or .Type = 179 Or .Type = 188 Or .Type = 226 Or .Type = 281 Or .Type = 282 Or .Type = 283 Or (.Type >= 622 And .Type <= 625) Then
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
End If
If .Type = 169 Then
PlaySound 32
BeltDirection = -BeltDirection 'for the blet direction changing block
End If
If .Type = 170 Then 'smw switch blocks
PlaySound 32
For B = 1 To numBlock
If Block(B).Type = 171 Then
Block(B).Type = 172
ElseIf Block(B).Type = 172 Then
Block(B).Type = 171
End If
Next B
For B = 1 To numNPCs
If NPC(B).Type = 60 Then
NPC(B).Direction = -NPC(B).Direction
End If
Next B
End If
If .Type = 173 Then 'smw switch blocks
PlaySound 32
For B = 1 To numBlock
If Block(B).Type = 174 Then
Block(B).Type = 175
ElseIf Block(B).Type = 175 Then
Block(B).Type = 174
End If
Next B
For B = 1 To numNPCs
If NPC(B).Type = 62 Then
NPC(B).Direction = -NPC(B).Direction
End If
Next B
End If
If .Type = 176 Then 'smw switch blocks
PlaySound 32
For B = 1 To numBlock
If Block(B).Type = 177 Then
Block(B).Type = 178
ElseIf Block(B).Type = 178 Then
Block(B).Type = 177
End If
Next B
For B = 1 To numNPCs
If NPC(B).Type = 64 Then
NPC(B).Direction = -NPC(B).Direction
End If
Next B
End If
If .Type = 179 Then 'smw switch blocks
PlaySound 32
For B = 1 To numBlock
If Block(B).Type = 180 Then
Block(B).Type = 181
ElseIf Block(B).Type = 181 Then
Block(B).Type = 180
End If
Next B
For B = 1 To numNPCs
If NPC(B).Type = 66 Then
NPC(B).Direction = -NPC(B).Direction
End If
Next B
End If
'Find out what the block should turn into
If .Type = 88 Or .Type = 90 Or .Type = 89 Or .Type = 171 Or .Type = 174 Or .Type = 177 Or .Type = 180 Then 'SMW
newBlock = 89
ElseIf .Type = 188 Or .Type = 192 Or .Type = 193 Or .Type = 60 Or .Type = 369 Then 'SMB1
newBlock = 192
ElseIf .Type = 224 Or .Type = 225 Or .Type = 226 Then 'Large SMB3 blocks
newBlock = 225
ElseIf .Type = 159 Then 'SMB3 Battle Block
newBlock = 159
Else 'Everything else defaults to SMB3
newBlock = 2
End If
If .Special > 0 And .Special < 100 Then 'Block has coins
If whatPlayer > 0 And Player(whatPlayer).Character = 4 Then .RapidHit = Int(Rnd * 3) + 1
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
If whatPlayer > 0 And (Player(whatPlayer).Character = 2 Or Player(whatPlayer).Character = 5) Then
tempBool = False
For B = 1 To numBlock
If B <> A And Block(B).Hidden = False And Not BlockOnlyHitspot1(Block(B).Type) And Not BlockIsSizable(Block(B).Type) Then
If CheckCollision(Block(B).Location, newLoc(.Location.X + 1, .Location.Y - 31, 30, 30)) Then
tempBool = True
Exit For
End If
End If
Next B
If tempBool = False Then
For B = 1 To .Special
numNPCs = numNPCs + 1
With NPC(numNPCs)
.Active = True
.TimeLeft = 100
If newBlock = 89 Then
.Type = 33
ElseIf newBlock = 192 Then
.Type = 88
Else
.Type = 10
End If
If Player(whatPlayer).Character = 5 Then
.Type = 251
If Rnd * 20 <= 3 Then .Type = 252
If Rnd * 60 <= 3 Then .Type = 253
PlaySound 81
Else
PlaySound 14
End If
.Location.Width = NPCWidth(.Type)
.Location.Height = NPCHeight(.Type)
.Location.X = Block(A).Location.X + Block(A).Location.Width / 2 - .Location.Width / 2
.Location.Y = Block(A).Location.Y - .Location.Height - 0.01
.Location.SpeedX = Rnd * 3 - 1.5
.Location.SpeedY = -Rnd * 4 - 3
If HitDown = True Then
.Location.SpeedY = -.Location.SpeedY * 0.5
.Location.Y = Block(A).Location.Y + Block(A).Location.Height
End If
.Special = 1
.Immune = 20
CheckSectionNPC numNPCs
End With
If B > 20 Or (Player(whatPlayer).Character = 5 And B > 5) Then Exit For
Next B
.Special = 0
Else
Coins = Coins + 1
If Coins >= 100 Then
If Lives < 99 Then
Lives = Lives + 1
PlaySound 15
Coins = Coins - 100
Else
Coins = 99
End If
End If
PlaySound 14
NewEffect 11, .Location
.Special = .Special - 1
End If
ElseIf .RapidHit > 0 Then '(whatPlayer > 0 And Player(whatPlayer).Character = 3)
tempBool = False
For B = 1 To numBlock
If B <> A And Block(B).Hidden = False And Not BlockOnlyHitspot1(Block(B).Type) And Not BlockIsSizable(Block(B).Type) Then
If CheckCollision(Block(B).Location, newLoc(.Location.X + 1, .Location.Y - 31, 30, 30)) Then
tempBool = True
Exit For
End If
End If
Next B
If tempBool = False Then
numNPCs = numNPCs + 1
With NPC(numNPCs)
.Active = True
.TimeLeft = 100
If newBlock = 89 Then
.Type = 33
ElseIf newBlock = 192 Then
.Type = 88
Else
.Type = 10
End If
.Type = 138
.Location.Width = NPCWidth(.Type)
.Location.Height = NPCHeight(.Type)
.Location.X = Block(A).Location.X + Block(A).Location.Width / 2 - .Location.Width / 2
.Location.Y = Block(A).Location.Y - .Location.Height - 0.01
.Location.SpeedX = Rnd * 3 - 1.5
.Location.SpeedY = -Rnd * 4 - 3
.Special = 1
.Immune = 20
PlaySound 14
CheckSectionNPC numNPCs
End With
.Special = .Special - 1
Else
Coins = Coins + 1
If Coins >= 100 Then
If Lives < 99 Then
Lives = Lives + 1
PlaySound 15
Coins = Coins - 100
Else
Coins = 99
End If
End If
PlaySound 14
NewEffect 11, .Location
.Special = .Special - 1
End If
Else
Coins = Coins + 1
If Coins >= 100 Then
If Lives < 99 Then
Lives = Lives + 1
PlaySound 15
Coins = Coins - 100
Else
Coins = 99
End If
End If
PlaySound 14
NewEffect 11, .Location
.Special = .Special - 1
End If
If .Special = 0 And Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
ElseIf .Special >= 1000 Then 'New spawn code
C = .Special - 1000 'this finds the NPC type and puts in the variable C
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then '55 is the bouncy note block
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
If NPCIsABonus(C) And C <> 169 And C <> 170 Then 'check to see if it should spawn a dead player
tempPlayer = CheckDead
If numPlayers > 2 And nPlay.Online = False Then tempPlayer = 0
End If
'don't spawn players from blocks anymore
tempPlayer = 0
If tempPlayer = 0 Then 'Spawn the npc
numNPCs = numNPCs + 1 'create a new NPC
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 1000
If NPCIsYoshi(C) Then
NPC(numNPCs).Type = 96
NPC(numNPCs).Special = C
ElseIf numPlayers > 2 Then
NPC(numNPCs).Type = C
ElseIf C = 14 Or C = 34 Or C = 264 Or C = 277 Then
For B = 1 To numPlayers
If Player(B).State = 1 And Player(B).Character <> 5 Then makeShroom = True
Next B
If makeShroom = False Then
NPC(numNPCs).Type = C
Else
NPC(numNPCs).Type = 9
End If
ElseIf C = 183 Then
For B = 1 To numPlayers
If Player(B).State = 1 And Player(B).Character <> 5 Then makeShroom = True
Next B
If makeShroom = False Then
NPC(numNPCs).Type = C
Else
NPC(numNPCs).Type = 185
End If
ElseIf C = 182 Then
For B = 1 To numPlayers
If Player(B).State = 1 And Player(B).Character <> 5 Then makeShroom = True
Next B
If makeShroom = False Then
NPC(numNPCs).Type = C
Else
NPC(numNPCs).Type = 184
End If
Else
NPC(numNPCs).Type = C
End If
If makeShroom = True And whatPlayer > 0 And (Player(whatPlayer).State > 1 Or Player(whatPlayer).Character = 5) Then NPC(numNPCs).Type = C 'set the NPC type if the conditions are met
If makeShroom = True And BattleMode = True Then NPC(numNPCs).Type = C 'always spawn the item in battlemode
If NPC(numNPCs).Type = 287 Then NPC(numNPCs).Type = RandomBonus
CharStuff numNPCs
NPC(numNPCs).Location.Width = NPCWidth(C)
If .Location.Width = 32 Then
.Location.Width = .Location.Width - 0.1
.Location.X = .Location.X + 0.05
End If
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If NPCIsYoshi(C) Then 'if the npc is yoshi then set the color of the egg
If C = 98 Then
NPC(numNPCs).Frame = 1
ElseIf C = 99 Then
NPC(numNPCs).Frame = 2
ElseIf C = 100 Then
NPC(numNPCs).Frame = 3
ElseIf C = 148 Then
NPC(numNPCs).Frame = 4
ElseIf C = 149 Then
NPC(numNPCs).Frame = 5
ElseIf C = 150 Then
NPC(numNPCs).Frame = 6
End If
End If
If HitDown = False Then
NPC(numNPCs).Location.Y = .Location.Y '- 0.1
NPC(numNPCs).Location.Height = 0
If NPCIsYoshi(C) Then
NPC(numNPCs).Effect = 0
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Location.Y = .Location.Y - 32
ElseIf NPC(numNPCs).Type = 34 Then
NPC(numNPCs).Effect = 0
NPC(numNPCs).Location.Y = .Location.Y - 32
NPC(numNPCs).Location.SpeedY = -6
NPC(numNPCs).Location.Height = NPCHeight(C)
PlaySound 7
Else
NPC(numNPCs).Effect = 1
PlaySound 7
End If
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = NPCHeight(C)
NPC(numNPCs).Effect = 3
PlaySound 7
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
With NPC(numNPCs)
If NPCIsYoshi(.Type) Or NPCIsBoot(.Type) Or .Type = 9 Or .Type = 14 Or .Type = 22 Or .Type = 90 Or .Type = 153 Or .Type = 169 Or .Type = 170 Or .Type = 182 Or .Type = 183 Or .Type = 184 Or .Type = 185 Or .Type = 186 Or .Type = 187 Or .Type = 188 Or .Type = 195 Then .TimeLeft = Physics.NPCTimeOffScreen * 20
End With
Else 'Spawn the player
PlaySound 7
Player(tempPlayer).State = 1
Player(tempPlayer).Location.Width = Physics.PlayerWidth(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Location.Height = Physics.PlayerHeight(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Frame = 1
Player(tempPlayer).Dead = False
Player(tempPlayer).Location.X = .Location.X + .Location.Width * 0.5 - Player(tempPlayer).Location.Width * 0.5
If HitDown = False Then
Player(tempPlayer).Location.Y = .Location.Y - 0.1 - Player(tempPlayer).Location.Height
Else
Player(tempPlayer).Location.Y = .Location.Y + 0.1 + .Location.Height
End If
Player(tempPlayer).Location.SpeedX = 0
Player(tempPlayer).Location.SpeedY = 0
Player(tempPlayer).Immune = 150
End If
ElseIf .Special = 100 Then 'Block contains a mushroom
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
tempPlayer = CheckDead
If numPlayers > 2 And nPlay.Online = False Then tempPlayer = 0
PlaySound 7
If tempPlayer = 0 Then
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 1000
NPC(numNPCs).Type = 9
NPC(numNPCs).Location.Width = NPCWidth(9)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If HitDown = False Then
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Effect = 1
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
Else
Player(tempPlayer).Location.Width = Physics.PlayerWidth(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Location.Height = Physics.PlayerHeight(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Frame = 1
Player(tempPlayer).Dead = False
Player(tempPlayer).Location.X = .Location.X + .Location.Width * 0.5 - Player(tempPlayer).Location.Width * 0.5
If HitDown = False Then
Player(tempPlayer).Location.Y = .Location.Y - 0.1 - Player(tempPlayer).Location.Height
Else
Player(tempPlayer).Location.Y = .Location.Y + 0.1 + .Location.Height
End If
Player(tempPlayer).Location.SpeedX = 0
Player(tempPlayer).Location.SpeedY = 0
Player(tempPlayer).Immune = 150
End If
ElseIf .Special = 102 Then 'Block contains a fire flower
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
tempPlayer = CheckDead
If numPlayers > 2 And nPlay.Online = False Then tempPlayer = 0
PlaySound 7
If tempPlayer = 0 Then
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 1000
For B = 1 To numPlayers
If Player(B).State = 1 Then makeShroom = True
Next B
If makeShroom = False Then
NPC(numNPCs).Type = 14
Else
NPC(numNPCs).Type = 9
End If
NPC(numNPCs).Location.Width = NPCWidth(NPC(numNPCs).Type)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If HitDown = False Then
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Effect = 1
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
Else 'Rez player
Player(tempPlayer).Frame = 1
Player(tempPlayer).Dead = False
Player(tempPlayer).Location.Width = Physics.PlayerWidth(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Location.Height = Physics.PlayerHeight(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Location.X = .Location.X + .Location.Width * 0.5 - Player(tempPlayer).Location.Width * 0.5
If HitDown = False Then
Player(tempPlayer).Location.Y = .Location.Y - 0.1 - Player(tempPlayer).Location.Height
Else
Player(tempPlayer).Location.Y = .Location.Y + 0.1 + .Location.Height
End If
Player(tempPlayer).Location.SpeedX = 0
Player(tempPlayer).Location.SpeedY = 0
Player(tempPlayer).Immune = 150
End If
ElseIf .Special = 103 Then 'Block contains a Leaf
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(.Type)
.Location.Width = BlockWidth(.Type)
End If
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
tempPlayer = CheckDead
If numPlayers > 2 And nPlay.Online = False Then tempPlayer = 0
PlaySound 7
If tempPlayer = 0 Then
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 1000
For B = 1 To numPlayers
If Player(B).State = 1 Then makeShroom = True
Next B
If makeShroom = False Then
NPC(numNPCs).Type = 34
Else
NPC(numNPCs).Type = 9
End If
NPC(numNPCs).Location.Width = NPCWidth(NPC(numNPCs).Type)
NPC(numNPCs).Location.Height = NPCHeight(NPC(numNPCs).Type)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.SpeedX = 0
If HitDown = False Then
If NPC(numNPCs).Type = 34 Then
NPC(numNPCs).Location.Y = .Location.Y - 32
NPC(numNPCs).Location.SpeedY = -6
NPC(numNPCs).Location.Height = NPCHeight(34)
Else
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Effect = 1
End If
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
Else 'Rez player
Player(tempPlayer).Location.Width = Physics.PlayerWidth(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Location.Height = Physics.PlayerHeight(Player(tempPlayer).Character, Player(tempPlayer).State)
Player(tempPlayer).Frame = 1
Player(tempPlayer).Dead = False
Player(tempPlayer).Location.X = .Location.X + .Location.Width * 0.5 - Player(tempPlayer).Location.Width * 0.5
If HitDown = False Then
Player(tempPlayer).Location.Y = .Location.Y - 0.1 - Player(tempPlayer).Location.Height
Else
Player(tempPlayer).Location.Y = .Location.Y + 0.1 + .Location.Height
End If
Player(tempPlayer).Location.SpeedX = 0
Player(tempPlayer).Location.SpeedY = 0
Player(tempPlayer).Immune = 150
End If
ElseIf .Special = 104 Then 'Block contains a Shoe
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
PlaySound 7
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 100
NPC(numNPCs).Type = 35
NPC(numNPCs).Direction = -1
NPC(numNPCs).Location.Width = NPCWidth(35)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If HitDown = False Then
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Effect = 1
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
ElseIf .Special = 105 Then 'Block contains a Green Yoshi
SoundPause(2) = 2
PlaySound 7
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 100
NPC(numNPCs).Type = 96
NPC(numNPCs).Special = 95
NPC(numNPCs).Direction = 1
NPC(numNPCs).Location.Width = NPCWidth(96)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If HitDown = False Then
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Location.Y = .Location.Y - 32
NPC(numNPCs).Effect = 0
Else
PlaySound 7
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
ElseIf .Special = 101 Then 'Block contains a Goomba
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
PlaySound 7
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 100
NPC(numNPCs).Type = 1
NPC(numNPCs).Location.Width = NPCWidth(9)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If HitDown = False Then
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Effect = 1
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
ElseIf .Special = 201 Then 'Block contains a 1-up
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
.Special = 0
If Not .Type = 55 Then
.Type = newBlock
.Location.Height = BlockHeight(newBlock)
.Location.Width = BlockWidth(newBlock)
End If
If HitDown = False Then
BlockShakeUp A
Else
BlockShakeDown A
End If
PlaySound 7
numNPCs = numNPCs + 1
NPC(numNPCs).Active = True
NPC(numNPCs).TimeLeft = 100
NPC(numNPCs).Type = 90
NPC(numNPCs).Location.Width = NPCWidth(90)
NPC(numNPCs).Location.X = (.Location.X + .Location.Width / 2 - NPC(numNPCs).Location.Width / 2)
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.SpeedX = 0
NPC(numNPCs).Location.SpeedY = 0
If HitDown = False Then
NPC(numNPCs).Location.Y = .Location.Y - 0.1
NPC(numNPCs).Location.Height = 0
NPC(numNPCs).Effect = 1
Else
NPC(numNPCs).Location.Y = .Location.Y + 4
NPC(numNPCs).Location.Height = 32
NPC(numNPCs).Effect = 3
End If
NPC(numNPCs).Effect2 = 0
CheckSectionNPC numNPCs
End If
If PSwitchTime > 0 And newBlock = 89 And .Special = 0 And oldSpecial > 0 Then
numNPCs = numNPCs + 1
With NPC(numNPCs)
.Active = True
.TimeLeft = 1
.Type = 33
.Block = 89
.Location = Block(A).Location
.Location.Width = NPCWidth(.Type)
.Location.Height = NPCHeight(.Type)
.Location.X = .Location.X + (Block(A).Location.Width - .Location.Width) / 2
.Location.Y = .Location.Y - 0.01
.DefaultLocation = .Location
.DefaultType = .Type
CheckSectionNPC numNPCs
End With
Block(A) = blankBlock
End If
If .Type = 90 Then BlockHitHard A
End With
End Sub
Public Sub BlockShakeUp(A As Integer) 'Shake the block up
If Block(A).Hidden = False Then
With Block(A)
.ShakeY = -12 'Go up
.ShakeY2 = 12 'Come back down
.ShakeY3 = 0
End With
If A <> iBlock(iBlocks) Then
iBlocks = iBlocks + 1
iBlock(iBlocks) = A
End If
End If
End Sub
Public Sub BlockShakeUpPow(A As Integer) 'Shake the block up
If Block(A).Hidden = False Then
With Block(A)
.ShakeY = -6 'Go up
.ShakeY2 = 6 'Come back down
.ShakeY3 = 0
End With
If A <> iBlock(iBlocks) Then
iBlocks = iBlocks + 1
iBlock(iBlocks) = A
End If
End If
End Sub
Public Sub BlockShakeDown(A As Integer) 'Shake the block down
If Block(A).Hidden = False Then
With Block(A)
.ShakeY = 12 'Go down
.ShakeY2 = -12 'Come back up
.ShakeY3 = 0
End With
If A <> iBlock(iBlocks) Then
iBlocks = iBlocks + 1
iBlock(iBlocks) = A
End If
End If
End Sub
Public Sub BlockHitHard(A As Integer)
If Block(A).Hidden = False Then
If nPlay.Online = True And nPlay.Mode = 1 Then
Netplay.sendData "3c" & A & LB
End If
If Block(A).Type = 90 Then
'Block(A).Hidden = True
'NewEffect 82, Block(A).Location, , A
'PlaySound 3
Else
Block(A).Kill = True
iBlocks = iBlocks + 1
iBlock(iBlocks) = A
End If
End If
End Sub
Public Sub KillBlock(A As Integer, Optional Splode As Boolean = True) 'Destroy a block
Dim blankBlock As Block
Dim tempBool As Boolean
Dim C As Integer
If Block(A).Hidden = True Then Exit Sub
If BattleMode = True And Block(A).RespawnDelay = 0 Then
Block(A).RespawnDelay = 1
End If
If Splode = True Then
If Block(A).Type = 526 Then
PlaySound 64
ElseIf Block(A).Type = 186 Then
PlaySound 43
Else
PlaySound 4 'Block smashed
End If
'Create the break effect
If Block(A).Type = 60 Then
NewEffect 21, Block(A).Location
ElseIf Block(A).Type = 188 Then
NewEffect 51, Block(A).Location
ElseIf Block(A).Type = 457 Then
NewEffect 100, Block(A).Location
ElseIf Block(A).Type = 526 Then
NewEffect 107, Block(A).Location
ElseIf Block(A).Type = 293 Then
NewEffect 135, Block(A).Location
Else
NewEffect 1, Block(A).Location
End If
End If
If LevelEditor = True Then
If numBlock > 0 Then
Block(A) = Block(numBlock)
Block(numBlock) = blankBlock
numBlock = numBlock - 1
End If
Else
Score = Score + 50
If Block(A).TriggerDeath <> "" Then
ProcEvent Block(A).TriggerDeath
End If
If Block(A).TriggerLast <> "" Then
tempBool = False
For C = 1 To numNPCs
If NPC(C).Layer = Block(A).Layer And NPC(C).Generator = False Then tempBool = True
Next C
For C = 1 To numBlock
If C <> A Then
If Block(A).Layer = Block(C).Layer Then tempBool = True
End If
Next C
If tempBool = False Then ProcEvent Block(A).TriggerLast
End If
Block(A).Hidden = True
Block(A).Layer = "Destroyed Blocks"
Block(A).Kill = False
End If
End Sub
Public Sub BlockFrames() 'update the frames for animated blocks
Dim A As Integer
Dim pChar(0 To 5) As Boolean
Dim tempBool As Boolean
If FreezeNPCs = True Then Exit Sub
'Update block frame counter
BlockFrame2(4) = BlockFrame2(4) + 1
If BlockFrame2(4) = 8 Then BlockFrame2(4) = 0
BlockFrame2(5) = BlockFrame2(5) + 1
If BlockFrame2(5) = 8 Then BlockFrame2(5) = 0
BlockFrame2(30) = BlockFrame2(30) + 1
If BlockFrame2(30) = 8 Then BlockFrame2(30) = 0
BlockFrame2(55) = BlockFrame2(55) + 1
If BlockFrame2(55) = 8 Then BlockFrame2(55) = 0
BlockFrame2(88) = BlockFrame2(88) + 1
If BlockFrame2(88) = 8 Then BlockFrame2(88) = 0
BlockFrame2(109) = BlockFrame2(109) + 1
If BlockFrame2(109) = 4 Then BlockFrame2(109) = 0
BlockFrame2(371) = BlockFrame2(371) + 1
If BlockFrame2(371) = 8 Then BlockFrame2(371) = 0
BlockFrame2(379) = BlockFrame2(379) + 1
If BlockFrame2(379) >= 12 Then BlockFrame2(379) = 0
'Check if the block type is ready for the next frame
If BlockFrame2(4) = 0 Then
BlockFrame(4) = BlockFrame(4) + 1
If BlockFrame(4) = 4 Then BlockFrame(4) = 0
End If
If BlockFrame2(5) = 0 Then
BlockFrame(5) = BlockFrame(5) + 1
If BlockFrame(5) = 4 Then BlockFrame(5) = 0
End If
BlockFrame(598) = BlockFrame(5)
BlockFrame(511) = BlockFrame(5)
BlockFrame(169) = BlockFrame(5)
BlockFrame(173) = BlockFrame(5)
BlockFrame(176) = BlockFrame(5)
BlockFrame(179) = BlockFrame(5)
BlockFrame(193) = BlockFrame(5)
BlockFrame(389) = BlockFrame(5)
BlockFrame(391) = BlockFrame(5)
BlockFrame(392) = BlockFrame(5)
BlockFrame(404) = BlockFrame(5)
BlockFrame(459) = BlockFrame(5)
BlockFrame(460) = BlockFrame(5)
BlockFrame(461) = BlockFrame(5)
BlockFrame(462) = BlockFrame(5)
BlockFrame(463) = BlockFrame(5)
BlockFrame(464) = BlockFrame(5)
BlockFrame(465) = BlockFrame(5)
BlockFrame(466) = BlockFrame(5)
BlockFrame(468) = BlockFrame(5)
BlockFrame(469) = BlockFrame(5)
BlockFrame(470) = BlockFrame(5)
BlockFrame(471) = BlockFrame(5)
BlockFrame(472) = BlockFrame(5)