-
Notifications
You must be signed in to change notification settings - Fork 0
/
NNLocal.bas
3000 lines (2756 loc) · 90.5 KB
/
NNLocal.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
#include "NNLocal.bi"
sub local_gameplay
dim as string InMusic, InPassword
dim as short LevelClear, PassInput, InstruAlpha, InstruBeta, InstruGamma, Phase, AboveLine, HeadingUpwards, RotationFrame, _
ProhibitSpawn, WepCooldown, DebugConsole, FreezeStr, ScoreTick, MinPlayHeight, ShowTopUI, RecalcGems
dim as integer LoadErrors, BarrierStrength, MPAlternate, ScoreFilling, GracePeriod, ModdedHiScore
dim as double LastPlayed, DispTime, MusicPitch
dim as string ScoreRef, DiffName, GameInfo, TimeStr, DebugCode
GamePaused = 0
SpeedMod = 100
InstruAlpha = 4
Player = 1
apply_diff_specs
DesireX = 512
PaddleHealth = 6600
ShowTopUI = 60
ShuffleList(1) = 1
fix_first_level
if QuickPlayFile = "" then
LoadErrors = load_settings
else
CampaignName = PlaytestName
StartingLives = 9
ExtraBarrierPoint = 1
BaseCapsuleValue = 100
InitialExtraLife = 0
SubsequentExtraLives = 0
ExplodingValue = 8
SecretLevels = 2
end if
with NewPlrSlot
.DispScore = 0
.Score = 0
.Lives = 0
.LevelNum = 1
.PerfectClear = 1
if InitialExtraLife = 0 then
.Threshold = SubsequentExtraLives
else
.Threshold = InitialExtraLife
end if
empty_hand(0)
end with
begin_local_game(-1, 1)
if LoadErrors then
exit sub
else
load_scores
end if
if FileExists(CampaignName+".dat") then
open CampaignName+".dat" for input as #2
input #2, HighLevel
close #2
else
HighLevel = 1
end if
for LsrID as ubyte = 1 to 20
for LsrPt as ubyte = 1 to 15
with LaserBeams(LsrID,LsrPt)
.Y = 768
end with
next LsrPt
next LsrID
NewPlrSlot.Lives = StartingLives + (ExtraBarrierPoint * CampaignBarrier)
InPassword = "--------"
SavedControls = ControlStyle
do
PlayerSlot(0).Difficulty = max(PlayerSlot(1).Difficulty,_
max(PlayerSlot(2).Difficulty,_
max(PlayerSlot(3).Difficulty,_
max(PlayerSlot(4).Difficulty,_
max(PlayerSlot(5).Difficulty,_
PlayerSlot(6).Difficulty)))))
if ControlStyle > CTRL_KEYBOARD then
getJoystick(ControlStyle-4,JoyButtonCombo,JoyAxis(0),JoyAxis(1),JoyAxis(2),JoyAxis(3),JoyAxis(4),JoyAxis(5),JoyAxis(6),JoyAxis(7))
if JoyInvertAxes then
for AxisID as byte = 0 to 7
JoyAxis(AxisID) = -JoyAxis(AxisID)
next AxisID
end if
end if
with PlayerSlot(Player)
PowerTick += SpeedMod
screenevent(@e)
FrameTime += 1/FPS
cls
decrement_pauses
if CampaignBarrier AND .Lives > 0 then
BarrierStrength = .Lives - 1
else
BarrierStrength = 0
end if
if GamePaused = 0 then
if PowerTick >= 100 then
RotationFrame += 1
end if
end if
end with
ExploTick += 1
AttackBricks = 0
if RotationFrame >= 20 then
if (GameStyle AND (1 SHL STYLE_ROTATION)) then
dim as short MapX(40), FlashX(40), LastHitX(40)
dim as TileSpecs TilesetX(40)
for YID as ubyte = 1 to 24
if Pallete(PlayerSlot(Player).TileSet(1,YID).BrickID).CalcedInvulnerable = 0 then
for DXID as byte = 20*(CondensedLevel+1) to 2 step -1
if Pallete(PlayerSlot(Player).TileSet(DXID,YID).BrickID).CalcedInvulnerable = 0 then
TilesetX(1) = PlayerSlot(Player).TileSet(DXID,YID)
exit for
end if
next DXID
else
TilesetX(1) = PlayerSlot(Player).TileSet(1,YID)
end if
for XID as ubyte = 2 to 20*(CondensedLevel+1)
if Pallete(PlayerSlot(Player).TileSet(XID,YID).BrickID).CalcedInvulnerable = 0 then
for DXID as byte = XID - 1 to 1 step -1
if Pallete(PlayerSlot(Player).TileSet(DXID,YID).BrickID).CalcedInvulnerable = 0 then
TilesetX(XID) = PlayerSlot(Player).TileSet(DXID,YID)
exit for
end if
if DXID = 1 then
DXID = 21+20*(CondensedLevel)
end if
next DXID
else
TilesetX(XID) = PlayerSlot(Player).TileSet(XID,YID)
end if
next XID
for XID as ubyte = 1 to 20*(CondensedLevel+1)
PlayerSlot(Player).TileSet(XID,YID) = TilesetX(XID)
next XID
next YID
end if
RotationFrame = 0
end if
if (GameStyle AND (1 SHL STYLE_EXTRA_HEIGHT)) then
MinPlayHeight = 0
else
MinPlayHeight = 96
end if
if (GameStyle AND (1 SHL STYLE_BOSS)) then
for YID as ubyte = 1 to 20
for XID as byte = 20*(CondensedLevel+1) to 1 step -1
with PlayerSlot(Player).TileSet(XID,YID)
if .BrickID = 1 then
AttackBricks += 1
elseif .BrickID > 0 AND Pallete(.BrickID).CanRegen > 0 AND _
.BrickID <> Pallete(.BrickID).CanRegen then
dim as short ComputeDamage
.BrickID = Pallete(.BrickID).CanRegen
if .LastBall > 0 then
ComputeDamage = Ball(.LastBall).Speed
ComputeDamage *= max(int(5.45 - ActiveDifficulty),1)
else
ComputeDamage = 10
end if
with PlayerSlot(Player)
if .BossLastHit > 6 then
.BossLastHealth = .BossHealth
end if
.BossLastHit = 0
.BossHealth -= ComputeDamage
end with
end if
end with
next XID
next YID
if TotalBC > 0 AND AttackBricks > 0 AND PaddleSize > 0 AND GamePaused = 0 then
AttackTick += PlayerSlot(Player).BossMaxHealth / 5000 * ActiveDifficulty * SpeedMod / 100
if AttackTick >= 50 + PlayerSlot(Player).BossHealth/PlayerSlot(Player).BossMaxHealth * 50 then
dim as ubyte NewBeam, NewX, NewY
dim as ushort NewAngle = irandom(220,320), NewSpeed = irandom(4,10)
AttackTick = 0
for Try as ubyte = 1 to 5
NewBeam = irandom(1,20)
with LaserBeams(NewBeam,1)
if .Speed = 0 then
do
NewX = irandom(1,20)
NewY = irandom(1,20)
loop until PlayerSlot(Player).TileSet(NewX,NewY).BrickID = 1
end if
end with
if NewX > 0 AND NewY > 0 then
for LsrPt as ubyte = 1 to 15
with LaserBeams(NewBeam,LsrPt)
.Angle = NewAngle
.X = 56 + (NewX - 1) * 48 + cos(degtorad(NewAngle)) * LsrPt
.Y = 108 + (NewY - 1) * 24 - sin(degtorad(NewAngle)) * LsrPt
.Speed = NewSpeed / 1.3
end with
next LsrPt
exit for
end if
next Try
end if
else
AttackTick = 0
end if
end if
while BulletStart >= MaxBullets
BulletStart -= MaxBullets
wend
ScoreTick += 1
for PID as ubyte = 1 to NumPlayers
with PlayerSlot(PID)
if .Score - .DispScore > 50 then
.DispScore += int((.Score-.DispScore)/50)
elseif .DispScore < .Score then
.DispScore += 1
end if
end with
next PID
if TotalBC > 0 AND ProhibitSpawn = 0 then
ProhibitSpawn = 2
PlayerSlot(Player).Lives += 1
end if
with PlayerSlot(Player)
if DQ = 0 AND ControlStyle >= CTRL_DESKTOP then
if .LevelNum > HighLevel AND .Lives > 0 then
HighLevel = .LevelNum
'Clear victory flag; likely new levels discovered
kill(CampaignName+".flag")
end if
end if
put(0,0),Background,pset
line(0,0)-(1023,767),rgba(0,0,0,255-(BGBrightness/100*255)),bf
if (MinPlayHeight > 0) then
ShowTopUI = 60
put(0,0),FramesetMerged,trans
else
put(0,0),Sideframes,trans
if ShowTopUI >= 60 then
put(32,0),Topframe,trans
end if
end if
'Score display
if .Score < 1e6 then
ScoreRef = commaSep(.Score)
elseif .Score < 1e8 then
ScoreRef = commaSep(int(.Score/1e3))+"K"
elseif .Score < 1e11 then
ScoreRef = commaSep(int(.Score/1e6))+"M"
else
ScoreRef = commaSep(int(.Score/1e9))+"B"
end if
ui_element(ScoreRef,45,6,7,rgba(255,255,255,224))
/'
' Target score display - Changes based on number of players:
' - If playing alone: Displays score needed to beat the next score on the High Scores
' - If playing hosteat: Displays the game leader's score
'/
if ShowTopUI >= 60 then
dim as byte TargetPos = 10
dim as uinteger TargetColoring
if NumPlayers = 1 then
if CampaignName = PlaytestName then
ModdedHiScore = 0
TargetPos = -1
else
do
ModdedHiScore = ceil(HighScore(TargetPos).RawScore * HighScore(TargetPos).Difficulty / .Difficulty)
TargetPos -= 1
loop until TargetPos = 0 OR .Score < ModdedHiScore
end if
else
ModdedHiScore = 0
for PID as byte = 1 to NumPlayers
if PID <> Player AND PlayerSlot(PID).Score > ModdedHiScore then
ModdedHiScore = PlayerSlot(PID).Score
end if
next PID
end if
if ModdedHiScore < 1e6 then
ScoreRef = commaSep(ModdedHiScore)
elseif ModdedHiScore < 1e8 then
ScoreRef = commaSep(int(ModdedHiScore / 1e3))+"K"
elseif ModdedHiScore < 1e11 then
ScoreRef = commaSep(int(ModdedHiScore / 1e6))+"M"
else
ScoreRef = commaSep(int(ModdedHiScore / 1e9))+"B"
end if
TargetColoring = rgba(255,255,255,224)
if TargetPos = -1 then
TargetColoring = rgba(128,128,128,224)
elseif TargetPos = 0 then
if .Score < ModdedHiScore then
TargetColoring = rgba(255,215,0,224)
else
TargetColoring = rgba(0,255,255,224)
if .Score < 1e6 then
ScoreRef = commaSep(.Score)
elseif .Score < 1e8 then
ScoreRef = commaSep(int(.Score / 1e3))+"K"
elseif .Score < 1e11 then
ScoreRef = commaSep(int(.Score / 1e6))+"M"
else
ScoreRef = commaSep(int(.Score / 1e9))+"B"
end if
end if
elseif TargetPos = 1 then
TargetColoring = rgba(192,192,192,224)
elseif TargetPos = 2 then
TargetColoring = rgba(205,127,50,224)
end if
ui_element(ScoreRef,192,6,7,TargetColoring)
end if
'Timer display
if .Lives > 0 AND BrickCount <= 3 AND LevelTimeLimit = 0 then
if GamePaused = 0 AND LevelClear = 0 AND PowerTick >= 100 then
.WarpTimer -= 1
end if
TimeRem = .WarpTimer / 60
DispTime = int(TimeRem+1-(1e-10))
TimeStr = str(int(DispTime/60))+":"+_
str(int(remainder(DispTime,60)/10))+_
str(int(remainder(DispTime,10)))
ui_element(str(TimeStr),560,6,5,rgba(255,255,0,224))
if .WarpTimer = 0 AND LevelClear = 0 then
play_clip(SFX_EXPLODE)
LevelClear = 1
elseif .WarpTimer > 1800 AND TotalBC = 0 then
.WarpTimer = 1800
end if
elseif .Lives > 0 AND LevelTimeLimit > 0 then
dim as uinteger DColor
if TimeRem < 60 then
if (GameStyle AND (1 SHL STYLE_FATAL_TIMER)) then
DColor = rgb(255,32,32)
else
DColor = rgb(255,128,0)
end if
elseif TimeRem < 120 then
DColor = rgb(255,255,0)
else
DColor = rgb(0,255,255)
end if
if GamePaused = 0 AND LevelClear = 0 AND PowerTick >= 100 then
.LevelTimer -= 1
end if
TimeRem = .LevelTimer/60
if TimeRem < 0 AND LevelClear = 0 then
if (GameStyle AND (1 SHL STYLE_BONUS)) then
play_clip(SFX_EXPLODE)
LevelClear = 1
elseif (GameStyle AND (1 SHL STYLE_FATAL_TIMER)) = 0 AND .Lives > 1 then
play_clip(SFX_DEATH)
.PerfectClear = 0
.Lives -= 1
LevelClear = 1
else
.Lives = 1
ProhibitSpawn = 2
destroy_balls
end if
end if
DispTime = int(TimeRem+1-(1e-10))
TimeStr = str(int(DispTime/60))+":"+_
str(int(remainder(DispTime,60)/10))+_
str(int(remainder(DispTime,10)))
ui_element(TimeStr,560,6,5,DColor)
elseif .WarpTimer < 3600 then
TimeRem = .WarpTimer / 60
DispTime = int(TimeRem+1-(1e-10))
TimeStr = str(int(DispTime/60))+":"+_
str(int(remainder(DispTime,60)/10))+_
str(int(remainder(DispTime,10)))
ui_element(TimeStr,560,6,5,rgba(128,128,128,224))
elseif ShowTopUI >= 60 then
ui_element("-:--",560,6,5,rgba(128,128,128,224))
end if
if ShowTopUI >= 60 then
'Player and Lives displays
ui_element(str(Player),343,6,0,rgba(255,255,255,224))
if .Lives > 0 then
if CampaignBarrier then
DispLives = BarrierStrength
elseif (GameStyle AND (1 SHL STYLE_BONUS)) then
DispLives = .Lives
else
DispLives = .Lives - sgn(ProhibitSpawn)
end if
ui_element(str(DispLives),386,6,0,rgba(255,255,255,224))
else
DispLives = 0
ui_element("0",386,6,0,rgba(255,64,64,224))
end if
'Ammo display
if .MissileAmmo > 0 then
dim as uinteger Coloring
if WepCooldown = 0 then
Coloring = rgb(255,255,255)
else
Coloring = rgb(255,255,0)
end if
if .MissileAmmo < 1000 then
ui_element(str(.MissileAmmo)+"M",671,6,4,Coloring)
else
ui_element("+++M",671,6,4,Coloring)
end if
elseif .BulletAmmo > 0 then
if .BulletAmmo < 1000 then
ui_element(str(.BulletAmmo)+"B",671,6,4,rgb(255,255,255))
else
ui_element("+++B",671,6,4,rgb(255,255,255))
end if
else
ui_element("----",671,6,4,rgb(128,128,128))
end if
'Password display
if CampaignFolder = EndlessFolder then
'Intentionally blank
elseif CampaignPassword = "--------" then
ui_element("Fatal!",764,6,7,rgb(255,128,128))
elseif CampaignPassword <> "++++++++" AND .LevelNum <= HighLevel AND ShuffleLevels = 0 then
if .Difficulty >= 6.5 then
ui_element(CampaignPassword,764,6,0,rgb(128,128,128))
else
ui_element(CampaignPassword,764,6,0,rgb(255,255,255))
end if
end if
'Level display
ui_element(str(.LevelNum),935,6,3,rgb(255,255,255))
GameInfo = CampaignName + ": " + CampaignLevelName
if (GameStyle AND (1 SHL STYLE_BOSS)) = 0 AND (GameStyle AND (1 SHL STYLE_BREAKABLE_CEILING)) = 0 then
if BrickCount > CampaignBricks then
line(53,36)-(987,64),rgb(128,0,64),bf
elseif BrickCount > 0 then
line(53,36)-(53+BrickCount/CampaignBricks*934,64),rgb(64,0,64),bf
end if
end if
end if
if (GameStyle AND (1 SHL STYLE_BOSS)) OR (GameStyle AND (1 SHL STYLE_BREAKABLE_CEILING)) then
if .BossHealth <= 0 then
.BossHealth = 0
if .BossLastHit = 1 AND (GameStyle AND (1 SHL STYLE_BOSS)) then
play_clip(SFX_WALL_BROKEN)
for YID as ubyte = 1 to 24
for XID as ubyte = 1 to 20*(CondensedLevel+1)
PlayerSlot(Player).TileSet(XID,YID).BrickID = 0
next XID
next YID
end if
end if
if .BossLastHit < 64 then
line(53,36)-(53+.BossLastHealth/.BossMaxHealth*934,64),_
rgba(255,255,255,192-(.BossLastHit * 3)),bf
.BossLastHit += 1
end if
if .BossHealth > 0 then
line(53,36)-(53+.BossHealth/.BossMaxHealth*934,64),_
rgb(255-.BossHealth/.BossMaxHealth*255,_
.BossHealth/.BossMaxHealth*192,0),bf
end if
if ShowTopUI < 60 then
line(53,36)-(987,64),rgb(255,255,255),b
end if
end if
if ShowTopUI >= 60 then
gfxstring(GameInfo,54,38,5,3,3,rgb(255,255,255))
end if
end with
if ShowTopUI < 59 OR (HeadingUpwards = 0 AND ShowTopUI < 60) then
ShowTopUI += 1
end if
BrickCount = disp_wall(PowerTick*(1-GamePaused),1)
if CampaignBarrier then
dim as uinteger BarrierColors(1 to 9) => {_
rgba(255,0,0,64),_
rgba(255,128,0,96),_
rgba(255,255,0,112),_
rgba(0,255,0,128),_
rgba(0,255,255,144),_
rgba(0,0,255,160),_
rgba(255,0,255,176),_
rgba(255,128,255,192),_
rgba(255,255,255,192)}
if BarrierStrength > 0 then
line(0,736)-(1023,767),BarrierColors(BarrierStrength),bf
end if
end if
if PaddleHealth > 0 AND PaddleHealth < 110 * 60 then
dim as uinteger HealthColor
dim as short DmgMulti = int(sqr(ActiveDifficulty) + 0.5)
if PaddleHealth < 15 * DmgMulti * 60 then
HealthColor = rgb(192,0,0)
elseif PaddleHealth < 30 * DmgMulti * 60 then
HealthColor = rgb(192,192,0)
else
HealthColor = rgb(64,192,64)
end if
put (192,737),PaddleBar,pset
line(197,742)-(197+min(int(PaddleHealth/60),100)/100*629,762),HealthColor,bf
if PowerTick >= 100 AND ((LevelClear = 0 AND GamePaused = 0) OR PaddleHealth >= 6000) then
if Paddle(1).Repairs > 0 AND PaddleHealth < 6000 then
PaddleHealth += 4
else
PaddleHealth += 1
end if
end if
end if
if (GameStyle AND (1 SHL STYLE_BOSS)) AND GamePaused = 0 then
for LsrID as ubyte = 1 to 20
for LsrPt as ubyte = 1 to 15
with LaserBeams(LsrID,LsrPt)
if .Y >= 768 then
.Speed = 0
else
pset(.X,.Y),rgb(255,128,0)
.X += cos(degtorad(.Angle)) * .Speed * (SpeedMod / 100)
.Y -= sin(degtorad(.Angle)) * .Speed * (SpeedMod / 100)
for PaddleID as byte = 1 to 2
if .X >= Paddle(PaddleID).X - PaddleSize/2 AND .X < Paddle(PaddleID).X + PaddleSize/2 AND _
.Y >= Paddle(PaddleID).Y AND .Y < Paddle(PaddleID).Y + PaddleHeight then
.Angle = 0
.Y = 768
if PaddleHealth > 100 * 60 then
PaddleHealth = 100 * 60
end if
PaddleHealth -= int(sqr(ActiveDifficulty) + 0.5) * 60
if PaddleHealth <= 0 then
render_paddle(0)
end if
end if
next PaddleID
end if
end with
next LsrPt
next LsrID
if PaddleSize < StandardSize AND ProhibitSpawn = 0 AND PlayerSlot(Player).Lives > 0 then
ProhibitSpawn = 1
end if
end if
particle_system
if TotalBC > 0 AND ProhibitSpawn > 0 then
GracePeriod = 240
end if
if TotalBC = 0 AND ProhibitSpawn > 0 AND GracePeriod > 0 then
if (GameStyle AND (1 SHL STYLE_CAVITY)) AND NumPlayers > 1 AND PlayerSlot(Player).Lives > 0 then
Instructions = "Waiting a few seconds..."
InstructExpire = timer + 1
GracePeriod -= 1
else
GracePeriod = 0
end if
end if
with PlayerSlot(Player)
if TotalBC = 0 AND ProhibitSpawn > 0 AND GracePeriod = 0 AND CapsFalling = 0 AND BulletsInPlay = 0 AND LevelClear = 0 then
play_clip(SFX_DEATH)
ProhibitSpawn = 0
Combo = 0
reset_paddle
.PerfectClear = 0
if (GameStyle AND (1 SHL STYLE_BONUS)) then
LevelClear = 1
else
.Lives -= 1
end if
if .Lives = 0 then
game_over
LastPlayed = timer
FrameTime = timer
end if
if (GameStyle AND (1 SHL STYLE_BONUS)) = 0 then
transfer_control
end if
end if
end with
if TotalBC = 1 AND ContinuousSplit = 1 then
force_release_balls
for BID as short = 1 to NumBalls
with Ball(BID)
if .Speed > 0 then
for NewBall as short = 1 to 100
with Ball(NewBall)
if .Speed <= 0 then
.Speed = int(Ball(BID).Speed)
.X = Ball(BID).X
.Y = Ball(BID).Y
.Spawned = 0
.Power = Ball(BID).Power
.Duration = Ball(BID).Duration
.Angle = Ball(BID).Angle + 90
TotalBC += 1
exit for,for
end if
end with
next
end if
end with
next BID
end if
if MusicActive then
MusicPitch = SpeedMod/100
if PlayerSlot(Player).Lives <= 1 OR (PlayerSlot(Player).LevelTimer < 3600 AND (GameStyle AND (1 SHL STYLE_FATAL_TIMER))) then
MusicPitch *= 1.2
end if
#IFDEF __USE_FBSOUND__
fbs_Set_SoundSpeed(musicPlr,MusicPitch)
#ENDIF
end if
with Paddle(1)
.Grabbed = .X
.Y = 736 - PaddleHeight
if GamePaused = 0 then
if ControlStyle = CTRL_AI then
dim as Basics Deepest
dim as short ObjsFound = 0
Deepest.Y = 600.0
Deepest.X = Paddle(1).X
for BID as short = 1 to NumBalls
with Ball(BID)
if .Y > Deepest.Y AND .Y < 736 + BallSize AND sin(degtorad(.Angle)) < 0 then
Deepest.Y = .Y
Deepest.X = .X
ObjsFound += 1
end if
end with
next BID
for CID as short = 1 to MaxFallCaps
with Capsule(CID)
if .Y > Deepest.Y AND .Y < 736 AND .Angle <> CAP_SLOW AND .Angle <> CAP_NEGATER AND _
.Angle <> CAP_SLOW_PAD AND .Angle <> CAP_WEAK AND .Angle <> CAP_GRAVITY then
Deepest.Y = .Y
Deepest.X = .X
ObjsFound += 1
end if
end with
next CID
if ObjsFound > 0 AND (abs(DesireX - Deepest.X) > PaddleSize/2 OR abs(DesireX - Deepest.X) < PaddleSize/100) then
DesireX = Deepest.X + irandom(-PaddleSize/4,PaddleSize/4)
elseif ObjsFound = 0 then
DesireX = Deepest.X
end if
elseif ControlStyle <= CTRL_LAPTOP then
Result = getmouse(MouseX,0,0,ButtonCombo)
if Result = 0 then
if .Reverse > 0 then
DesireX = 1024 - MouseX
else
DesireX = MouseX
end if
else
ButtonCombo = 0
end if
elseif ControlStyle = CTRL_TABLET then
Result = getmouse(MouseX,0,0,ButtonCombo)
if TapWindow > 0 then TapWindow -= 1
if Result = 0 then
if ButtonCombo > 0 then
if HoldClick = 0 then
OrigX(0) = DesireX
OrigX(1) = MouseX
HoldClick = 1
else
if .Reverse > 0 then
DesireX = OrigX(0) - (MouseX - OrigX(1))*2
else
DesireX = OrigX(0) + (MouseX - OrigX(1))*2
end if
end if
elseif HoldClick = 1 then
HoldClick = 0
TapWindow = 7
end if
end if
if .Sluggish = 0 then
if DesireX < 32 + PaddleSize/2 then DesireX = 32 + PaddleSize/2
if DesireX > 992 - PaddleSize/2 then DesireX = 992 - PaddleSize/2
else
if DesireX < 0 then DesireX = 0
if DesireX > 1024 then DesireX = 1024
end if
elseif ControlStyle = CTRL_KEYBOARD then
dim as byte MoveSpeed
if (multikey(SC_LSHIFT) OR multikey(SC_RSHIFT)) AND multikey(SC_CONTROL) then
MoveSpeed = KeyboardSpeed/4
elseif (multikey(SC_LSHIFT) OR multikey(SC_RSHIFT)) OR multikey(SC_CONTROL) then
MoveSpeed = KeyboardSpeed/2
else
MoveSpeed = KeyboardSpeed
end if
if multikey(SC_LEFT) then
if .Reverse = 0 then
DesireX -= MoveSpeed
else
DesireX += MoveSpeed
end if
end if
if multikey(SC_RIGHT) then
if .Reverse = 0 then
DesireX += MoveSpeed
else
DesireX -= MoveSpeed
end if
end if
if .Sluggish = 0 then
if DesireX < 32 + PaddleSize/2 then DesireX = 32 + PaddleSize/2
if DesireX > 992 - PaddleSize/2 then DesireX = 992 - PaddleSize/2
else
if DesireX < 0 then DesireX = 0
if DesireX > 1024 then DesireX = 1024
end if
elseif ControlStyle > CTRL_KEYBOARD then
if JoyAnalog = 0 then
dim as byte MoveSpeed, SimulButtons = 0
dim as double CombinedAxes
for BID as byte = 0 to 31
if BID <> JoyKeySetting AND (JoyButtonCombo AND (1 SHL BID)) then
SimulButtons += 1
end if
next
for AxisID as byte = 0 to 7
if JoyAxis(AxisID) > -999 then
CombinedAxes += JoyAxis(AxisID)
end if
next AxisID
if SimulButtons >= 2 then
MoveSpeed = KeyboardSpeed/4
elseif SimulButtons = 1 then
MoveSpeed = KeyboardSpeed/2
else
MoveSpeed = KeyboardSpeed
end if
if CombinedAxes < -0.25 then
if .Reverse = 0 then
DesireX -= MoveSpeed
else
DesireX += MoveSpeed
end if
end if
if CombinedAxes > 0.25 then
if .Reverse = 0 then
DesireX += MoveSpeed
else
DesireX -= MoveSpeed
end if
end if
if .Sluggish = 0 then
if DesireX < 32 + PaddleSize/2 then DesireX = 32 + PaddleSize/2
if DesireX > 992 - PaddleSize/2 then DesireX = 992 - PaddleSize/2
else
if DesireX < 0 then DesireX = 0
if DesireX > 1024 then DesireX = 1024
end if
else
if .Reverse = 0 then
DesireX = (JoyAxis(JoyKeySetting)+1)/2*1024
else
DesireX = 1024-(JoyAxis(JoyKeySetting)+1)/2*1024
end if
if .Sluggish = 0 then
if DesireX < 32 + PaddleSize/2 then DesireX = 32 + PaddleSize/2
if DesireX > 992 - PaddleSize/2 then DesireX = 992 - PaddleSize/2
else
if DesireX < 0 then DesireX = 0
if DesireX > 1024 then DesireX = 1024
end if
end if
end if
if HoldAction > 0 AND actionButton(1) = 0 then
HoldAction = 0
end if
if .Sluggish > 0 then
.X = .X + int((DesireX - .X)/25 + 0.5)
else
.X = DesireX
end if
end if
if .X < 32 + PaddleSize/2 then .X = 32 + PaddleSize/2
if .X > 992 - PaddleSize/2 then .X = 992 - PaddleSize/2
if PaddleSize > 0 then
render_paddle(PaddleSize)
put (.X-PaddleSize/2,.Y),PaddlePic,trans
if PlayerSlot(Player).MissileAmmo > 0 then
line(.X-PaddleSize/2,.Y)-(.X+PaddleSize/2-1,.Y+PaddleHeight-1),rgba(255,64,64,128),bf
elseif PlayerSlot(Player).BulletAmmo > 0 then
line(.X-PaddleSize/2,.Y)-(.X+PaddleSize/2-1,.Y+PaddleHeight-1),rgba(255,255,0,128),bf
elseif .Grabbing > 180 OR (remainder(.Grabbing,60) <= 30 AND .Grabbing > 0) then
line(.X-PaddleSize/2,.Y)-(.X+PaddleSize/2-1,.Y+PaddleHeight-1),rgba(128,128,128,128),bf
end if
end if
if GamePaused = 0 then
'Blizzard does not influence its own timer
if .Blizzard > 0 then
if SpeedMod > 100 - FreezeStr then SpeedMod -= 1
.Blizzard -= 1
else
FreezeStr = 0
if SpeedMod < 100 then SpeedMod += 1
end if
if PowerTick >= 100 then
if .Reverse > 0 then
.Reverse -= 1
if .Reverse = 0 then
if ControlStyle <= CTRL_LAPTOP then
MouseX = 1024 - MouseX
setmouse(MouseX,MouseY)
elseif ControlStyle = CTRL_TABLET then
HoldClick = 0
TapWindow = 0
end if
end if
end if
if .Sluggish > 0 then
.Sluggish -= 1
if .Sluggish = 0 then
if .Reverse > 0 then
MouseX = 1024 - .X
else
MouseX = .X
end if
end if
end if
if .Grabbing > 0 then
.Grabbing -= 1
end if
if .Repairs > 0 then
.Repairs -= 1
end if
if ProgressiveDelay > 0 then
ProgressiveDelay -= 1
end if
end if
end if
if ShowTopUI >= 60 then
if .Blizzard > 0 then
put (40,71),CapsuleBar(1),trans
put (81,73),CapsuleBarFrame,pset
line(82,74)-(min(82+int(.Blizzard/60),112),86),rgb(255,255,0),bf
end if
if .Grabbing > 0 then
put (120,71),CapsuleBar(2),trans
put (161,73),CapsuleBarFrame,pset
line(162,74)-(min(162+int(.Grabbing/60),192),86),rgb(255,255,0),bf
end if
if .Repairs > 0 then
put (200,71),CapsuleBar(3),trans
put (241,73),CapsuleBarFrame,pset
line(242,74)-(min(242+int(.Repairs/60),272),86),rgb(255,255,0),bf
end if
if .Reverse > 0 then
put (280,71),CapsuleBar(4),trans
put (321,73),CapsuleBarFrame,pset
line(322,74)-(min(322+int(.Reverse/30),352),86),rgb(255,255,0),bf
end if
if .Sluggish > 0 then
put (360,71),CapsuleBar(5),trans
put (401,73),CapsuleBarFrame,pset
line(402,74)-(min(402+int(.Sluggish/30),432),86),rgb(255,255,0),bf
end if
if .Fireball > 0 then
put (440,71),CapsuleBar(6),trans
put (481,73),CapsuleBarFrame,pset
line(482,74)-(min(482+int(.Fireball/40),512),86),rgb(255,255,0),bf
end if
if .Breakthru > 0 then
put (520,71),CapsuleBar(7),trans
put (561,73),CapsuleBarFrame,pset
line(562,74)-(min(562+int(.Breakthru/40),592),86),rgb(255,255,0),bf
end if
if .WeakDmg > 0 then
put (600,71),CapsuleBar(8),trans
put (641,73),CapsuleBarFrame,pset
line(642,74)-(min(642+int(.WeakDmg/30),672),86),rgb(255,255,0),bf
end if
if .GravBall > 0 then
put (680,71),CapsuleBar(9),trans
put (721,73),CapsuleBarFrame,pset
line(722,74)-(min(722+int(.GravBall/30),752),86),rgb(255,255,0),bf
end if
for PokerID as byte = 1 to 5
put (752+PokerID*40,71),PokerBar(PokerID),trans
next PokerID
else
if .Blizzard > 0 AND (.Blizzard > 180 OR remainder(.Blizzard,60) < 30) then
put (40,71),CapsuleBar(1),alpha,128
end if
if .Grabbing > 0 AND (.Grabbing > 180 OR remainder(.Grabbing,60) < 30) then
put (120,71),CapsuleBar(2),alpha,128
end if
if .Repairs > 0 AND (.Repairs > 180 OR remainder(.Repairs,60) < 30) then
put (200,71),CapsuleBar(3),alpha,128
end if
if .Reverse > 0 AND (.Reverse > 180 OR remainder(.Reverse,60) < 30) then
put (280,71),CapsuleBar(4),alpha,128
end if
if .Sluggish > 0 AND (.Sluggish > 180 OR remainder(.Sluggish,60) < 30) then
put (360,71),CapsuleBar(5),alpha,128
end if
if .Fireball > 0 AND (.Fireball > 180 OR remainder(.Fireball,60) < 30) then
put (440,71),CapsuleBar(6),alpha,128
end if
if .Breakthru > 0 AND (.Breakthru > 180 OR remainder(.Breakthru,60) < 30) then
put (520,71),CapsuleBar(7),alpha,128
end if