-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobjectBonus.asm
More file actions
1735 lines (1631 loc) · 76.7 KB
/
objectBonus.asm
File metadata and controls
1735 lines (1631 loc) · 76.7 KB
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
; bank 2
BONUS_PLAYER_X_RANGE = 15
BONUS_PLAYER_Y_TEST_MIN = $80 +20
;
; all bonus stuff is in bank 0
if CURRENT_BANK = 2
if DO_DYING_BONUS = 1
risingBonusBehaviourXn2
; dec X_POS+u_offset1,s ; preload next user stack
dec X_POS+u_offset1,s ; preload next user stack
dec X_POS+u_offset1,s ; preload next user stack
bra risingBonusBehaviour
risingBonusBehaviourXn1
inc Y_POS+u_offset1,s ; preload next user stack
; dec X_POS+u_offset1,s ; preload next user stack
dec X_POS+u_offset1,s ; preload next user stack
bra risingBonusBehaviour
risingBonusBehaviourXp2
inc X_POS+u_offset1,s ; preload next user stack
; inc X_POS+u_offset1,s ; preload next user stack
inc X_POS+u_offset1,s ; preload next user stack
bra risingBonusBehaviour
risingBonusBehaviourXp1
inc Y_POS+u_offset1,s ; preload next user stack
; inc X_POS+u_offset1,s ; preload next user stack
inc X_POS+u_offset1,s ; preload next user stack
bra risingBonusBehaviour
risingBonusBehaviourX0
inc Y_POS+u_offset1,s ; preload next user stack
inc Y_POS+u_offset1,s ; preload next user stack
nop
risingBonusBehaviour ;#isfunction
MY_MOVE_TO_D_START
ldb #OBJECT_SCALE
stb VIA_t1_cnt_lo
lda TYPE+u_offset1,s
ldx #BonusList
ldx a,x ; in x pointer to current bonus struct
ldx ,x ; pointer to animation list of bonus
tst animDelayCounter
bpl noAnimChange2
inc BONUS_ANIM_POSITION+u_offset1,s
; check if end of animation (for now always 19 - but that might change -> 0 terminated dw list)
lda BONUS_ANIM_POSITION+u_offset1,s
anda #%01111111
asla
ldu a,x ; current active animation
bne displayBonus2
lda BONUS_ANIM_POSITION+u_offset1,s
anda #%10000000
sta BONUS_ANIM_POSITION+u_offset1,s
noAnimChange2
lda BONUS_ANIM_POSITION+u_offset1,s
anda #%01111111
asla
ldu a,x ; current active animation (no need to load 0
displayBonus2
; todo change X
inc Y_POS+u_offset1,s ; preload next user stack
inc Y_POS+u_offset1,s ; preload next user stack
lds NEXT_SHOT_OBJECT+u_offset1,s ; preload next user stack
MY_MOVE_TO_A_END
clra
pulu b,x,pc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; new list object to U
; leaves with flags set to result
; (positive = not successfull) ROM
; negative = successfull RAM
; destroys d, u
newBonusObject ;#isfunction
ldu bonuslist_empty_head
cmpu #OBJECT_LIST_COMPARE_ADDRESS
bls cs_done_nob
; set the new empty head
ldd NEXT_BONUS_OBJECT,u ; the next in out empty list will be the new
std bonuslist_empty_head ; head of our empty list
; load last of current object list
; the old head is always our next
ldd bonuslist_objects_head
std NEXT_BONUS_OBJECT,u
; newobject is always head
stu bonuslist_objects_head
inc bonusCount ; and remember that we created a new object
cs_done_nob
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
spawnBonus ;#isfunction
bsr newBonusObject ; "create" (or rather get) new object
leax ,u ; pointer to new object now in X also
cmpu #OBJECT_LIST_COMPARE_ADDRESS
bls spawnBonus_end2
; bpl spawnBonus_end ; if positve - there is no object left, jump out
; copy and initialze new enemy
; used in calb for now
ldd #simpleBonusBehaviour
std BEHAVIOUR,x
spawnBonus_end
spawnBonus_end2
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
simpleBonusBehaviour ;#isfunction
MY_MOVE_TO_D_START
lds NEXT_SHOT_OBJECT+u_offset1,s ; preload next user stack
ldb #OBJECT_SCALE
stb VIA_t1_cnt_lo
ldu #BonusE_Anim_0
MY_MOVE_TO_A_END
clra
pulu b,x,pc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fallingRankBehaviour ;#isfunction
MY_MOVE_TO_D_START
;;;;;;
; colision detection bonus -> player
; in b is still x position, so start with that
; xTest
subb playerXpos
bpl testPositive_xRank
negb
testPositive_xRank
cmpb #BONUS_PLAYER_X_RANGE
bhi notHit_Rank
; yTest
ldb Y_POS +u_offset1,s
cmpb #BONUS_PLAYER_Y_TEST_MIN
lblt playerCaughtRank
notHit_Rank
displayContinueRank
ldb #OBJECT_SCALE
stb VIA_t1_cnt_lo
ldx #RankMarkerCircle_Anim
inc BONUS_ANIM_POSITION+u_offset1,s
; check if end of animation (for now always 19 - but that might change -> 0 terminated dw list)
lda BONUS_ANIM_POSITION+u_offset1,s
asla
ldu a,x ; current active animation
bne displayRank
clr BONUS_ANIM_POSITION+u_offset1,s
noAnimChangeRank
lda BONUS_ANIM_POSITION+u_offset1,s
asla
ldu a,x ; current active animation (no need to load 0
displayRank
dec Y_POS+u_offset1,s ; preload next user stack
lda #$7f
cmpa Y_POS+u_offset1,s
lbeq removeBonus
lda TYPE+u_offset1,s
cmpa #4
blo noSpeedp
dec Y_POS+u_offset1,s ; preload next user stack
ldb #$7f
cmpb Y_POS+u_offset1,s
lbeq removeBonus
cmpa #8
blo noSpeedp
dec Y_POS+u_offset1,s ; preload next user stack
ldb #$7f
cmpb Y_POS+u_offset1,s
lbeq removeBonus
noSpeedp
sts StringOutputBuffer_0
lda TYPE+u_offset1,s
lds #MY_STACK-4 ; higher stack damage other stack saves :-( ; CBFC ; correct the stack to default address
pshs u
ldu #RankList
ldu a,u
MY_MOVE_TO_A_END
jsr SMVB_drawSmart
puls u
lds StringOutputBuffer_0
lds NEXT_SHOT_OBJECT+u_offset1,s ; preload next user stack
clra
pulu b,x,pc
RankList
dw RankMarker1
dw RankMarker2
dw RankMarker3
dw RankMarker4
dw RankMarker5
dw RankMarker6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fallingBonusBehaviour ;#isfunction
MY_MOVE_TO_D_START
continnueWithFallin
;;;;;;
; colision detection bonus -> player
; in b is still x position, so start with that
; xTest
subb playerXpos
bpl testPositive_xBonus
negb
testPositive_xBonus
cmpb #BONUS_PLAYER_X_RANGE
bhi notHit_bonus
; yTest
ldb Y_POS +u_offset1,s
cmpb #BONUS_PLAYER_Y_TEST_MIN
lblt playerCaughtBonus
notHit_bonus
displayContinueBonus
ldb #OBJECT_SCALE
stb VIA_t1_cnt_lo
lda TYPE+u_offset1,s
ldx #BonusList
ldx a,x ; in x pointer to current bonus struct
ldx ,x ; pointer to animation list of bonus
tst animDelayCounter
bpl noAnimChange
inc BONUS_ANIM_POSITION+u_offset1,s
; check if end of animation (for now always 19 - but that might change -> 0 terminated dw list)
lda BONUS_ANIM_POSITION+u_offset1,s
anda #%01111111
asla
ldu a,x ; current active animation
bne displayBonus
lda BONUS_ANIM_POSITION+u_offset1,s
anda #%10000000
sta BONUS_ANIM_POSITION+u_offset1,s
noAnimChange
lda BONUS_ANIM_POSITION+u_offset1,s
anda #%01111111
asla
ldu a,x ; current active animation (no need to load 0
displayBonus
dec Y_POS+u_offset1,s ; preload next user stack
tst BONUS_ANIM_POSITION+u_offset1,s
bpl nodoublespeedBonus
dec Y_POS+u_offset1,s ; preload next user stack
nodoublespeedBonus
lda #-$7f+2
cmpa Y_POS+u_offset1,s
lbge removeBonus
lds NEXT_SHOT_OBJECT+u_offset1,s ; preload next user stack
MY_MOVE_TO_A_END
clra
pulu b,x,pc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
UPDATE_EMPTY_BONUS_2 macro
dec bonusCount
ldy bonuslist_empty_head ; set u free, as new free head
sty NEXT_BONUS_OBJECT,x ; load to u the next linked list element
stx bonuslist_empty_head
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MUST BE USED ONCE ONLY!
CHECK_EXTRA_COMPLETED macro
lda bonusCollect
cmpa #1+2+4+8+16
lbne notAllYet\?
lda playSoundFlags
anda #%11000000
bne noExtraSound\?
REPLACE_1_2_EXTRACollectedData_varFromIRQ1_3
ldx #0 ;EXTRACollectedData
stx sfx_pointer_1
noExtraSound\?
lda playerNumberOfBulletsPerShot
cmpa #6
bne notFullYet\?
ldy #player_score
lda multiplyer
lsra
lsra
sta bonusCollect
addAgainBonus\? ; add 20000 points
ldd #9999
ldu #scoreBack1\?
jmp addScore_d
scoreBack1\?
ldd #9999
ldu #scoreBack2\?
jmp addScore_d
scoreBack2\?
dec bonusCollect
bmi notFullYet\?
bne addAgainBonus\?
notFullYet\?
clr bonusCollect
clr bonusDisplay
lda secretBonusCounter
bpl noLaserDiscovered\?
lda inGameSecrets
anda #SECRET_ORDERED_EXTRA
bne secretKnown2\?
lda inGameSecrets
ora #SECRET_ORDERED_EXTRA
sta inGameSecrets
PLAY_SECRET_JINGLE
REPLACE_1_2_SecretString_varFrom1_1\? ; bank 1 replace
ldd #0 ;SecretString
INIT_MESSAGE_D
secretKnown2\?
REPLACE_1_2_bandit_varFromIRQ1_132
ldx #0 ; bandit
jmp jmpBankIRQ1Shift
backFromBandit
adjustAndRemove
ldy #removeBonus
jmp adjustAndJumpY
noLaserDiscovered\?
lda secretBonusCounter
anda #$ff-$80
sta secretBonusCounter ; reset EXTRA BONUS counter in case of a fail
lda playerMaxShotInAir
cmpa #MAX_PLAYERSHOT_OBJECTS
beq noAdditionalShotEither\?
inc playerMaxShotInAir
noAdditionalShotEither\?
lda playerNumberOfBulletsPerShot
inca
cmpa #7
bhs toManyShoot\?
sta playerNumberOfBulletsPerShot
toManyShoot\?
jmp adjustAndRemove
notAllYet\?
lda playSoundFlags
anda #%11000000
bne noExtraSound22\?
REPLACE_1_2_letterData_varFromIRQ1_3
ldx #0 ;letterData
stx sfx_pointer_1
noExtraSound22\?
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dw BonusMoney200Caught
bonusHandleJumper
dw BonusECaught
dw BonusXCaught
dw BonusTCaught
dw BonusRCaught
dw BonusACaught
dw BonusShotPlusCaught
dw BonusFasterCaught
dw BonusFasterShotCaught
dw BonusSlowerCaught
dw BonusShotMinusCaught
dw BonusMoney5Caught
dw BonusMoney20Caught
dw BonusMoney50Caught
dw BonusArmorCaught
dw BonusShieldCaught
dw BonusSwoopCaught
dw BonusShot1Caught
dw BonusShot2Caught
dw BonusShot3Caught
dw BonusShot4Caught
dw BonusMinestormCaught
dw BonusMult2Caught
dw BonusMult5Caught
dw BonusBombCashCaught
dw BonusBombDiamondCaught
dw BonusTimerCaught
dw BonusSlowerShotCaught
dw BonusCashDoublerCaught
dw BonusShotPowerupCaught
dw BonusLifeCaught
dw BonusDrunkenCaught
dw BonusAutofireCaught
dw removeBonus
RankHandleJumper
dw rank1Caught
dw rank2Caught
dw rank3Caught
dw rank4Caught
dw rank5Caught
dw rank6Caught
dw rankNegative
dw removeBonus
if TEST_VOX = 1
;REPLACE_0_2_voxMoney_varFromIRQ0_10 dw 0 ;voxMoney
dw 0 ;voxMoney - just zero NO address, otherwise other vox will just be BROKEN
voxData
REPLACE_0_2_voxExtraLetter_varFromIRQ0_1 dw 0
REPLACE_0_2_voxExtraLetter_varFromIRQ0_2 dw 0
REPLACE_0_2_voxExtraLetter_varFromIRQ0_3 dw 0
REPLACE_0_2_voxExtraLetter_varFromIRQ0_4 dw 0
REPLACE_0_2_voxExtraLetter_varFromIRQ0_5 dw 0
REPLACE_0_2_voxExtraBullet_varFromIRQ0_1 dw 0
REPLACE_0_2_voxFighterSpeed_varFromIRQ0_1 dw 0
REPLACE_0_2_voxShotSpeed_varFromIRQ0_1 dw 0
REPLACE_0_2_voxSucker_varFromIRQ0_1 dw 0
REPLACE_0_2_voxSucker_varFromIRQ0_2 dw 0
dw 0 ;voxMoney - just zero NO address, otherwise other vox will just be BROKEN
dw 0 ;voxMoney - just zero NO address, otherwise other vox will just be BROKEN
dw 0 ;voxMoney - just zero NO address, otherwise other vox will just be BROKEN
REPLACE_0_2_voxArmor_varFromIRQ0_1 dw 0
REPLACE_0_2_voxShield_varFromIRQ0_1 dw 0
REPLACE_0_2_voxScoop_varFromIRQ0_1 dw 0
REPLACE_0_2_voSingleShot_varFromIRQ0_1 dw 0
REPLACE_0_2_voxDoubleShot_varFromIRQ0_1 dw 0
REPLACE_0_2_voxTrippleShot_varFromIRQ0_1 dw 0
REPLACE_0_2_voxBonus_varFromIRQ0_6 dw 0
REPLACE_0_2_voxMinestorm_varFromIRQ0_1 dw 0
REPLACE_0_2_voxMultiply_varFromIRQ0_1 dw 0
REPLACE_0_2_voxMultiply_varFromIRQ0_2 dw 0
REPLACE_0_2_voxCashBomb_varFromIRQ0_1 dw 0
REPLACE_0_2_voxDiamondBomb_varFromIRQ0_1 dw 0
REPLACE_0_2_voxTime_varFromIRQ0_1 dw 0
REPLACE_0_2_voxSucker_varFromIRQ0_3 dw 0
REPLACE_0_2_voxDoubleCash_varFromIRQ0_1 dw 0
REPLACE_0_2_voxShotPower_varFromIRQ0_1 dw 0
REPLACE_0_2_voxExtraLife_varFromIRQ0_1 dw 0 ;voxExtraLife
REPLACE_0_2_voxDrunken_varFromIRQ0_1 dw 0
REPLACE_0_2_voxAutofire_varFromIRQ0_1 dw 0
endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
playerCaughtBonus ;#isfunction
;REPLACE_1_2_bandit_varFromIRQ1_1312
; ldx #0 ; bandit
; jmp jmpBankIRQ1Shift
lda TYPE +u_offset1,s
if TEST_VOX = 1
ldu #voxData
ldu a,u
beq noNewVoxData
stu vox_addr
noNewVoxData
endif
ldu #bonusHandleJumper
jmp [a,u]
playerCaughtRank ;#isfunction
if TEST_VOX = 1
REPLACE_1_2_voxRankMarker_varFromIRQ0_1
ldu #0 ; voxRankMarker
stu vox_addr
endif
lda TYPE +u_offset1,s
ldu #RankHandleJumper
jmp [a,u]
rank1Caught
; here check correct order of RANK
lda rankCollected
bne destroyRankOrder1
lda secretBonusCounter
ora #$40
sta secretBonusCounter
bra contRank1
destroyRankOrder1
lda secretBonusCounter
anda #$ff-$40
sta secretBonusCounter
contRank1
lda rankCollected
ora #COLLECTED_RANK1
sta rankCollected
jmp rankCaughtEnd
rank2Caught
; here check correct order of RANK
lda rankCollected
cmpa #1
beq contRank2
lda secretBonusCounter
anda #$ff-$40
sta secretBonusCounter
contRank2
lda rankCollected
ora #COLLECTED_RANK2
sta rankCollected
jmp rankCaughtEnd
rank3Caught
; here check correct order of RANK
lda rankCollected
cmpa #1+2
beq contRank3
lda secretBonusCounter
anda #$ff-$40
sta secretBonusCounter
contRank3
lda rankCollected
ora #COLLECTED_RANK3
sta rankCollected
jmp rankCaughtEnd
rank4Caught
; here check correct order of RANK
lda rankCollected
cmpa #1+2+4
beq contRank4
lda secretBonusCounter
anda #$ff-$40
sta secretBonusCounter
contRank4
lda rankCollected
ora #COLLECTED_RANK4
sta rankCollected
bra rankCaughtEnd
rank5Caught
; here check correct order of RANK
lda rankCollected
cmpa #1+2+4+8
beq contRank5
lda secretBonusCounter
anda #$ff-$40
sta secretBonusCounter
contRank5
lda rankCollected
ora #COLLECTED_RANK5
sta rankCollected
bra rankCaughtEnd
rank6Caught
; here check correct order of RANK
lda rankCollected
cmpa #1+2+4+8+16
bne destoryRanksSecret
lda secretBonusCounter
anda #SECRET_ORDERED_RANKS
beq destoryRanksSecret ; if not gotten in order ->
lda inGameSecrets
anda #SECRET_ORDERED_RANKS
bne contRank6
lda inGameSecrets
ora #SECRET_ORDERED_RANKS
sta inGameSecrets
PLAY_SECRET_JINGLE
lda rankCollected
ora #COLLECTED_RANK6
sta rankCollected
REPLACE_1_2_SecretString_varFrom1_7 ; bank 1 replace
ldd #0 ;SecretString
INIT_MESSAGE_D
jmp removeBonus
destoryRanksSecret
lda secretBonusCounter
anda #$ff-$40
sta secretBonusCounter
contRank6
lda rankCollected
ora #COLLECTED_RANK6
sta rankCollected
bra rankCaughtEnd
rankNegative
bra rankbonusCaughtEnd2
rankCaughtEnd
lda rankCollected
anda #%00111111
cmpa #%00111111
bne rankNotFull
REPLACE_1_2_rankAllString_varFrom1_1 ; bank 1 replace
ldd #0 ;rankAllString
bra rankCaught2End
rankNotFull
REPLACE_1_2_rankString_varFrom1_1 ; bank 1 replace
ldd #0 ;rankString
rankCaught2End
INIT_MESSAGE_D
lda playSoundFlags
anda #%11000000
bne rankbonusCaughtEnd2
REPLACE_1_2_rankData_varFromIRQ1_2
ldx #0 ; rankData
stx sfx_pointer_1
rankbonusCaughtEnd2
jmp removeBonus
BonusBombDiamondCaught
; go thru all enemy objects that are still "normal" enemies (no shield)
; and swith their behaviour to "fallDiamondBehaviour"
; respect "attacker" flag
lda lockPurchased
bita #ENEMY_DESTRUCTED_FLAG
bne allEnemiesHandled ; in warp, enemy list is not available
ldu enemylist_objects_head
handleEnemiesLoop
cmpu #ENEMY_DONE
beq allEnemiesHandled
;
; sort out all enemies which should not be
; "exploded"
lda ALL_PURPOSE,u
bmi nextEnemy ; negative is Explosion
ldx BEHAVIOUR,u
REPLACE_1_2_enemyPlayerControlledRightBehaviour_varFrom1_1 ; bank 1 replace
cmpx #0 ;enemyPlayerControlledRightBehaviour
beq nextEnemy
REPLACE_1_2_enemyPlayerControlledLeftBehaviour_varFrom1_1 ; bank 1 replace
cmpx #0 ;enemyPlayerControlledLeftBehaviour
beq nextEnemy
; handle shield enemies
ldx ENEMY_STRUCT,u
REPLACE_1_2_enemy3Definition_varFrom1_43 ; bank 1 replace
cmpx #0 ;enemy3Definition
beq nextEnemy
REPLACE_1_2_enemySW3DefinitionShield_varFrom1_43 ; bank 1 replace
cmpx #0 ;enemySW3DefinitionShield
beq nextEnemy
; enemy struct not available since it is in BANK 1
; bne nextEnemy
; no change to "explosion"
; check attacker
; ADD_POINTS_ENEMY_DESTROY - destroys u, don't do it - diamonds collected give points!
inc bonusHitCount
lda #-1
sta ALL_PURPOSE ,u ; negative means this enemy is an explosion
ldx BEHAVIOUR,u
REPLACE_1_2_enemySingleAttackAbsolutBehaviour_varFrom1_1 ; bank 1 replace
cmpx #0 ;enemySingleAttackAbsolutBehaviour
beq wasAttacker_b1
REPLACE_1_2_enemySingleAttackRelativeBehaviour_varFrom1_1 ; bank 1 replace
cmpx #0 ;enemySingleAttackRelativeBehaviour
bne wasNotAttacker_b1
wasAttacker_b1
dec attackPatternCount
wasNotAttacker_b1
; test if enemy is bug, if so get correct position
REPLACE_1_2_lastNormalEnemyAddress_varFrom1_1 ; bank 1 replace
cmpx #0 ; lastNormalEnemyAddress
blo normalEnemy_b1
; bug enemy - change positions
lda Y_POS16,u
ldb X_POS16,u
std Y_POS,u
normalEnemy_b1
REPLACE_1_2_fallDiamondBehaviour_varFrom1_1 ; bank 1 replace
ldd #0 ;fallDiamondBehaviour
std BEHAVIOUR,u
clr ANIM_POSITION,u
nextEnemy
ldu NEXT_ENEMY_OBJECT,u
bra handleEnemiesLoop
allEnemiesHandled
REPLACE_1_2_diamonbombString_varFrom1_1 ; bank 1 replace
ldd #0 ;diamonbombString
jmp bonusCaughtEndSound
BonusBombCashCaught
; go thru all enemy objects that are still "normal" enemies (no shield)
; and swith their behaviour to "fallDiamondBehaviour"
; respect "attacker" flag
lda lockPurchased
bita #ENEMY_DESTRUCTED_FLAG
bne allEnemiesHandled_C ; in warp, enemy list is not available
ldu enemylist_objects_head
handleEnemiesLoop_C
cmpu #ENEMY_DONE
beq allEnemiesHandled_C
;
; sort out all enemies which should not be
; "exploded"
lda ALL_PURPOSE,u
bmi nextEnemy_C ; negative is Explosion
ldx BEHAVIOUR,u
REPLACE_1_2_enemyPlayerControlledRightBehaviour_varFrom1_3 ; bank 1 replace
cmpx #0 ;enemyPlayerControlledRightBehaviour
beq nextEnemy_C
REPLACE_1_2_enemyPlayerControlledLeftBehaviour_varFrom1_3 ; bank 1 replace
cmpx #0 ;enemyPlayerControlledLeftBehaviour
beq nextEnemy_C
; handle shield enemies
ldx ENEMY_STRUCT,u
REPLACE_1_2_enemy3Definition_varFrom1_42 ; bank 1 replace
cmpx #0 ;enemy3Definition
beq nextEnemy_C
REPLACE_1_2_enemySW3DefinitionShield_varFrom1_42 ; bank 1 replace
cmpx #0 ;enemySW3DefinitionShield
beq nextEnemy_C
inc bonusHitCount
lda #-1
sta ALL_PURPOSE ,u ; negative means this enemy is an explosion
ldx BEHAVIOUR,u
REPLACE_1_2_enemySingleAttackAbsolutBehaviour_varFrom1_4 ; bank 1 replace
cmpx #0 ;enemySingleAttackAbsolutBehaviour
beq wasAttacker_b1_C
REPLACE_1_2_enemySingleAttackRelativeBehaviour_varFrom1_4 ; bank 1 replace
cmpx #0 ;enemySingleAttackRelativeBehaviour
bne wasNotAttacker_b1_C
wasAttacker_b1_C
dec attackPatternCount
wasNotAttacker_b1_C
; test if enemy is bug, if so get correct position
REPLACE_1_2_lastNormalEnemyAddress_varFrom1_22 ; bank 1 replace
cmpx #0 ; lastNormalEnemyAddress
blo normalEnemy_b1_C
; bug enemy - change positions
lda Y_POS16,u
ldb X_POS16,u
std Y_POS,u
normalEnemy_b1_C
REPLACE_1_2_fallCashBehaviour_varFrom1_2 ; bank 1 replace
ldd #0 ;fallCashBehaviour
std BEHAVIOUR,u
clr ANIM_POSITION,u
nextEnemy_C
ldu NEXT_ENEMY_OBJECT,u
bra handleEnemiesLoop_C
allEnemiesHandled_C
REPLACE_1_2_cashbombString_varFrom1_1 ; bank 1 replace
ldd #0 ;cashbombString
jmp bonusCaughtEndSound
BonusTimerCaught
ldd bonusTimerLength
addd #250 ; add five seconds
bpl timeOk
ldd #$7fff ; maximum timer!
timeOk
std bonusTimerLength
REPLACE_1_2_timerString_varFrom1_31 ; bank 1 replace
ldd #0 ;timerString
jmp bonusCaughtEndSound
BonusSlowerShotCaught
ldd playerShotSpeed
cmpd #MIN_SHOT_SPEED
lbls bonusCaughtEnd_bonusComplete
subd #SPEED_DELTA
std playerShotSpeed
ADJUST_SHOT_RADIUS
; check three in a row are collected
; check fro secret
; check if last bonus was -S
lda lastCollectedBonus
cmpa TYPE +u_offset1,s
beq notFirst3Bullets
; set counter to 1
lda secretBonusCounter
anda #%11111100 ; counter to zero
inca ; increase one
sta secretBonusCounter
bra continueLessRateNormal
notFirst3Bullets
lda secretBonusCounter
anda #%00000011 ; counter to zero
cmpa #%00000010 ; if old value was two -> than new value will be three -> success!
beq secretFirst3RateLessFound
; just increase count by one
inc secretBonusCounter
bra continueLessRateNormal
secretFirst3RateLessFound
lda secretBonusCounter
anda #%11111100 ; counter to zero
sta secretBonusCounter ; reset counter
; just store to discovered secrets!
lda inGameSecrets
anda #SECRET_3_RATE_SUCKERS
bne continueLessRateNormal
lda inGameSecrets
ora #SECRET_3_RATE_SUCKERS
sta inGameSecrets
lda shopAllowFlags
ora #SHOP_SUPER_BOMB_L
sta shopAllowFlags
PLAY_SECRET_JINGLE
REPLACE_1_2_SecretString_varFrom1_3 ; bank 1 replace
ldd #0 ;SecretString
jmp bonusCaughtEnd
continueLessRateNormal
; check if 3 -rates are collected, if so addsuperbomb
lda secretBonusCounter
anda #%00001100
lsra
lsra
inca
lsla
lsla
ldb secretBonusCounter ; delet old counter otherwise we or it with old value
andb #%11110011
stb secretBonusCounter
ora secretBonusCounter
sta secretBonusCounter
anda #%00001100
cmpa #%00001100
lbne nosm
inc smartBombsAvailable
; reset only "3" counter for bomb add, not any other counter
; sooo... reload bonus counter
lda secretBonusCounter
anda #%11110011
sta secretBonusCounter
lda inGameSecrets
anda #SECRET_RATE_SUCKERS
bne secretKnown1
lda inGameSecrets
ora #SECRET_RATE_SUCKERS
sta inGameSecrets
PLAY_SECRET_JINGLE
REPLACE_1_2_SecretString_varFrom1_1 ; bank 1 replace
ldd #0 ;SecretString
jmp bonusCaughtEnd
secretKnown1
REPLACE_1_2_smartBombAdded_varFrom1_1 ; bank 1 replace
ldd #0 ;smartBombAdded
jmp malusCaughtEnd
BonusCashDoublerCaught
ldd playerCashW
addd playerCashW
ldx playerCashW
std playerCashW
cmpx playerCashW
bls noRollOver_1
lda diverseFlags
ora #BIT_FLAG_CASH_ROLLOVER
sta diverseFlags
noRollOver_1
REPLACE_1_2_cashDouble_varFrom1_1 ; bank 1 replace
ldd #0 ; cashDouble
jmp bonusCaughtEndSound
BonusLifeCaught
lda playerLives
cmpa # '9'
lbeq bonusCaughtEnd_bonusComplete
inca
sta playerLives ; not more than 9 lives!
noExtraLife
REPLACE_1_2_extraLifeString_varFrom1_1 ; bank 1 replace
ldd #0 ; extraLifeString
jmp bonusCaughtEndSound
BonusDrunkenCaught
ADD_CASH 300
lda secretBonusCounter
anda #%00100000 ; enable drunken master
bne secretDrunkenFound
lda #DRUNKEN_TIME
sta drunkTimer
lda lastCollectedBonus
cmpa TYPE +u_offset1,s
beq notFirstDrunkenBonus
; set counter to 1
lda secretBonusCounter
anda #%11111100 ; counter to zero
inca ; increase one
sta secretBonusCounter
bra continueDrunkenNormal
notFirstDrunkenBonus
lda secretBonusCounter
anda #%00000011 ; counter to zero
cmpa #%00000010 ; if old value was two -> than new value will be three -> success!
beq secretDrunkenFound
; just increase count by one
inc secretBonusCounter
bra continueDrunkenNormal
secretDrunkenFound
lda secretBonusCounter
anda #%11111100 ; counter to zero
ora #%00100000 ; enable drunken master
sta secretBonusCounter ; reset counter
REPLACE_1_2_DrunkenMasterString_varFrom1_2 ; bank 1 replace
ldd #0 ;DrunkenMasterString
jmp bonusCaughtEndSound
continueDrunkenNormal
REPLACE_1_2_drunkenString_varFrom1_1 ; bank 1 replace
ldd #0 ; drunkenString
jmp bonusCaughtEndSound
BonusAutofireCaught
lda diverseFlags ; autofire is "1"
ora #1
sta diverseFlags ; autofire is "1"
REPLACE_1_2_autofireString_varFrom1_1 ; bank 1 replace
ldd #0 ; autofireString
jmp bonusCaughtEndSound
BonusShotPowerupCaught
inc bulletDamageAdjust
lda bulletDamageAdjust
cmpa #MAX_BULLET_POWER_ADJUST ; I "THINK" 15 is max - not sure though - lol
blo shotDamageOk
lda #MAX_BULLET_POWER_ADJUST
sta bulletDamageAdjust
shotDamageOk
; ADJUST_SHOT_DAMAGE
ldy #REPLACE_1_2_damagePlus_varFrom1_1
jmp adjustAndJumpY
REPLACE_1_2_damagePlus_varFrom1_1 ; bank 1 replace
ldd #0 ; damagePlus Double
jmp bonusCaughtEndSound
nosm
REPLACE_1_2_slowerGunSpeed_varFrom1_1 ; bank 1 replace
ldd #0 ;slowerGunSpeed
jmp malusCaughtEnd
BonusMult5Caught
ldd bonusTimerLength
std multTimer
lda multiplyer
anda #NON_MULTIPLYER_BITS
ora #MULTIPLY_5_OR
; lda #5
sta multiplyer
ldd # "x5"
std scoreExtraBuffer-1
lda #$80
sta scoreExtraBuffer+1
REPLACE_1_2_multi5String_varFrom1_1 ; bank 1 replace
ldd #0 ;multi5String
jmp bonusCaughtEndSound
BonusMult2Caught
ldd bonusTimerLength
std multTimer
; lda #2
lda multiplyer
anda #NON_MULTIPLYER_BITS
ora #MULTIPLY_2_OR
sta multiplyer
ldd # "x2"
std scoreExtraBuffer-1
lda #$80
sta scoreExtraBuffer+1
REPLACE_1_2_multi2String_varFrom1_1 ; bank 1 replace
ldd #0 ;multi2String
jmp bonusCaughtEndSound
BonusShotPlusCaught
lda playerMaxShotInAir
cmpa #MAX_PLAYERSHOT_OBJECTS
lbeq bonusCaughtEnd_bonusComplete
inc playerMaxShotInAir
REPLACE_1_2_extraBullet_varFrom1_1 ; bank 1 replace
ldd #0 ;extraBullet
jmp bonusCaughtEndSound
BonusFasterCaught
ldd playerSpeed
cmpd #MAX_PLAYER_SPEED
lbhi bonusCaughtEnd_bonusComplete
addd #SPEED_DELTA
std playerSpeed
REPLACE_1_2_extraSpeed_varFrom1_1 ; bank 1 replace
ldd #0 ;extraSpeed
jmp bonusCaughtEndSound
BonusFasterShotCaught
ldd playerShotSpeed
cmpd #MAX_SHOT_SPEED
lbhi bonusCaughtEnd_bonusComplete
addd #SPEED_DELTA
std playerShotSpeed
ADJUST_SHOT_RADIUS
REPLACE_1_2_extraGunSpeed_varFrom1_1 ; bank 1 replace
ldd #0 ;extraGunSpeed
jmp bonusCaughtEndSound
BonusShot1Caught
lda playerMaxShotInAir
cmpa #MAX_PLAYERSHOT_OBJECTS -6 ; max up to 4 shots
bhs notShotInc1
inc playerMaxShotInAir
notShotInc1
lda playerNumberOfBulletsPerShot
cmpa #1
ble noDowngradeCheck1
lda downgradeImmunity
anda #IMUNITY_BITS
; tst downgradeImmunity
; if at least 1 - do not downgrade
bne noDowngrade1
noDowngradeCheck1
lda playerNumberOfBulletsPerShot
cmpa #6
bne noBigLoss
lda downgradeImmunity ; while immune -> no biggest loss!
anda #IMUNITY_BITS
bne noBigLoss
lda inGameSecrets
ora #BIGGEST_LOSS_FLAG