-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAWARD.ASM
executable file
·3251 lines (2792 loc) · 65 KB
/
AWARD.ASM
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
**************************************************************
*
* Software: Mike Lynch, Jason Skiles, Mark Turmell
* Initiated: 04/04/95
*
* Modified:
*
* COPYRIGHT (C) 1992 WILLIAMS ELECTRONICS GAMES, INC.
*
**************************************************************
.file "award.asm"
.title "wrestling game program"
.width 132
.option b,d,l,t
.mnolist
.include "macros.h"
.include "mproc.equ" ;Mproc equates
.include "display.equ" ;Display proc equates
.include "gsp.equ" ;Gsp asm equates
.include "sys.equ"
.include "wwfsec.equ"
.include "game.equ"
.include "audit.equ"
.include "plyr.equ"
.include "anim.equ"
.include "sound.h"
.include "ring.equ"
.include "sound.equ"
.include "damage.equ"
.include "jjxm.h"
.include "imgtbl.glo"
.include "fontsimg.glo"
.include "bgndtbl.glo"
.include "miscimg.glo"
SHOW_ACCUM_ICONS .set 0
BLOCK_ICONS .equ 2 ; 2 single rnd 5 for 2
DBL_BLOCK_ICONS .equ 5
PERFECT_ICONS .equ 2
DBL_PERFECT_ICONS .equ 5
BIG_COMEBACK_ICONS .equ 2
TWO_ROUND_SWEEP_ICONS .equ 1
FIVE_WINS_ICONS .equ 3
QUICK_VICTORY_ICONS .equ 1
POWER_MOVE_ICONS .equ 0
REVERSALS_ICONS .equ 0
HIGH_RISK_MOVE_ICONS .equ 0
COMBOS_STARTED_ICONS .equ 0
COMBO_REVERSALS_ICONS .equ 0
COMBO_BREAKER_ICONS .equ 0
ULTRA_COMBOS_ICONS .equ 0
FIRST_HIT_ICONS .equ 0
DEFEAT_HUMAN_ICONS .equ 0
GAME_COMPLETE_ICONS .equ 0
SUPER_QWK_VICTORY_ICONS .equ 0
VERY_QWK_VICTORY_ICONS .equ 0
MAX_BONUS_BARS .equ (NUM_AWARDS*2)
BONUS_RECORD_SIZE .equ 6
BONUS_BAR_YPOS .equ 230
BONUS_BAR_VEL .equ 20
BONUS_BAR_YSPACE .equ 20
BONUS_BAR_END_XPOS .equ 180
BONUS_LTEXT_START_XPOS .equ -((BONUS_BAR_END_XPOS+22)/2)
BONUS_RTEXT_START_XPOS .equ -BONUS_LTEXT_START_XPOS
BONUS_ICON1_START_XPOS .equ -22
BONUS_ICON2_START_XPOS .equ -37
BONUS_ICON3_START_XPOS .equ -52
;fer know
LIFE_MAX .equ 163 ;green pixels in life bar
BONUS_MSG_XPOS1 .equ 81
BONUS_MSG_XPOS2 .equ 321
BONUS_MSG_YPOS .equ 198
BONUS_ICON_XPOS1 .equ BONUS_MSG_XPOS1
BONUS_ICON_XPOS2 .equ BONUS_MSG_XPOS2
BONUS_ICON_YPOS .equ BONUS_MSG_YPOS+22
PROG_BICON_XPOS .equ 56
PROG_BICON_YPOS .equ 93
.if 0
DUFUS_BOX_YPOS .equ 144
DUFUS_BOX_RXPOS .equ 399-(119+40)
DUFUS_BOX_LXPOS .equ 40
.else
DUFUS_BOX_YPOS .equ 144+23
DUFUS_BOX_RXPOS .equ 399-(59+40)
DUFUS_BOX_LXPOS .equ 40+59
.endif
BOX_OUT_SOUND .equ 0aah
ZIP_IN_SOUND .equ 0b6h
POWERUP_CODE_ON .set 1
PUNCH .equ 1
BLOCK .equ 2
SUPERP .equ 4
KICK .equ 8
UP .equ 32
DOWN .equ 64
LEFT .equ 128
RIGHT .equ 256
PU_START_Y .equ 210
PU_BAR_YSPACE .equ -15
PU_LEND_X .equ 125
PU_REND_X .equ 400-PU_LEND_X
PU_LTEXT_XPOS .equ -(PU_LEND_X/2)
PU_RTEXT_XPOS .equ 400+(PU_LEND_X/2)
PU_BAR_VELOCITY .equ 25
LPUBAROID .equ TYPVELALWAYS+010h
RPUBAROID .equ TYPVELALWAYS+011h
MKDEBUG .equ 0
PUPWAITSWITCH .macro SWITCHES,FAILADDR
lp?
SLEEPK 1
dec a11
jrz :FAILADDR:
move a8,a0
calla get_but_val_down
move a0,a1
move a8,a0
calla get_stick_val_down
sll 5,a0
or a1,a0
jrz lp?
cmpi :SWITCHES:,a0
jrnz lp?
.endm
;performed by each player. They are used at the end of a match to award
;icons to the player. These are cleared before each match.
;
;The pxrnd_award arrays are used to keep track of awards on a per round basis.
;The pxmtch_award arrays are used to keep track of awards on a per match basis.
;The pxws_award arrays are used to keep track of awards on a per winstreak basis.
;
BSSX p1rnd_award, 8*NUM_AWARDS ;player 1 round awards
BSSX p2rnd_award, 8*NUM_AWARDS ;player 2 round awards
BSSX p1mtch_award, 8*NUM_AWARDS ;player 1 match awards
BSSX p2mtch_award, 8*NUM_AWARDS ;player 2 match awards
BSSX p1ws_award, 16*NUM_AWARDS ;player 1 winstreak awards
BSSX p2ws_award, 16*NUM_AWARDS ;player 2 winstreak awards
BSSX award_ok_to_die,32
BSSX pcomeback, 32*2 ;Player big comeback status
BSSX dboxes_on,32
BSSX powerup_requests,32
BSSX powerup_die,32
BSSX show_options_die,16
BSSX do_show_options,16
BSSX blocking_off,16
BSSX ring_out_on,16
BSSX buddy_mode_on,16
BSSX move_names_on,16
BSSX drone_meters_on,16
BSSX instant_combos_on,16
BSSX hyper_speed_on,16
BSSX no_ring_on,16
BSSX mk3_tip_number,16
.bss mk_cycram,16*16
.bss pwsarm, 32*2 ;Player big comeback status
.bss ptotal, 32*2 ;Player total Icon counts
.bss bar_obj_ptr, MAX_BONUS_BARS*BONUS_RECORD_SIZE*32*2
.bss bonus_bar_size, 32
.bss picon, 32*3*MAX_BONUS_BARS*2
.bss player_award_state,32
BSSX p1icon_total, 32
BSSX p2icon_total, 32
.bss icon_digit_adjust,32
.bss p1bicon,32*8
.bss p2bicon,32*8
.bss icon_string_width,32
.bss progress_icons,32*8
.bss p1dufus_obj,32*2
.bss p2dufus_obj,32*2
.bss p1dufus_msg_flags,32
.bss p2dufus_msg_flags,32
BSSX p1powerup_request,32
BSSX p2powerup_request,32
BSSX p1pins,16
BSSX p2pins,16
.ref match_time,ck_live_teammates
.ref PSTATUS,royal_rumble
.ref process_ptrs
.ref p1winstreak
.ref p2winstreak
.ref get_health
.ref p1oldwinstreak
.ref p2oldwinstreak
.ref FLASHME,FINAL_PTR
.ref triple_sound
.ref BEGINOBJ_TBL
.ref get_but_val_down
.ref get_stick_val_down
.ref get_all_buttons_cur
.ref END_MATCH_SPEECH
.ref fade_down
.ref pal_clean
.ref fade_up
.ref GET_AUD
.ref STORE_AUDIT
.ref is_8_on_1
.ref wrestler_count
.ref in_finish_move
.ref NUM_OPPS
#***************************************************************
* rst_awards - Used to zero out per round and/or per match award arrays
* Clears both players award arrays!!!
* a14 = pointer to awards array to clear
*
SUBR rst_awards
PUSH a0,a1
movi (NUM_AWARDS*2)-1,a0
clr a1
#rst_award_loop
movb a1,*a14
addk 8,a14
dsjs a0,#rst_award_loop
movi pcomeback,a0
move a1,*a0+,L
move a1,*a0,L
PULL a0,a1
rets
SUBRP accumulate_player_awards
move @royal_rumble,a14
jrnz #apa_done
X32 a0
addi process_ptrs,a0
move *a0,a1,L
jrz #apa_done
move a5,a0
addi (BLOCKS_AWD*8),a0
movb *a0,a1
jrz #no_blocks
clr a1
jruc #do_accumulate
#no_blocks
movk BLOCK_ICONS,a1
#do_accumulate
movb a1,*a0
movi NUM_RND_AWARDS,a2 ; number of awards
#acc_awards_loop
movb *a6,a3 ; Get current value of match award
movb *a5,a4 ; Get per round award
add a4,a3 ; Add to per match award
movb a3,*a6 ; Store back to per match award
addk 8,a6 ; Increment round awards pointer
addk 8,a5 ; Increment match awards pointer
dsjs a2,#acc_awards_loop ; Keep going until all are accumulated
#apa_done
rets
#***************************************************************
* accumulate_awards - accumulates the per round awards into the
* per match awards.
*
SUBR accumulate_awards
PUSH a0,a1,a2,a3,a4,a5,a6 ; Save reggies I'm gonna trash
clr a0
movi p1rnd_award,a5
movi p1mtch_award,a6
callr accumulate_player_awards
movk 1,a0
movi p2rnd_award,a5
movi p2mtch_award,a6
callr accumulate_player_awards
PULL a0,a1,a2,a3,a4,a5,a6 ; Restore reggies
movi p1rnd_award,a14 ; Clear out per round awards
callr rst_awards
rets
#***************************************************************
* rst_winstreak_awards - Used to zero out per winstreak award arrays
* a14 = pointer to player winstreak award table to clear
*
SUBR rst_winstreak_awards
PUSH a0,a1
movi NUM_AWARDS-1,a0
clr a1
#rst_ws_award_loop
move a1,*a14+,W
dsjs a0,#rst_ws_award_loop
PULL a0,a1
rets
#***************************************************************
*
* This array contains the number of ICONS to award for each item in
* the awards stuff. This array MUST be in the same order as the
* awards indecies in game.equ
*
SUBRP award_icons:
.byte POWER_MOVE_ICONS ;POWER_MOVE_AWD
.byte REVERSALS_ICONS ;REVERSAL_AWD
.byte HIGH_RISK_MOVE_ICONS ;HIGH_RISK_AWD
.byte BLOCK_ICONS ;BLOCKS_AWD
.byte COMBOS_STARTED_ICONS ;COMBOS_AWD
.byte COMBO_REVERSALS_ICONS ;COMBO_REV_AWD
.byte COMBO_BREAKER_ICONS ;COMBO_BRKR_AWD
.byte ULTRA_COMBOS_ICONS ;UCOMBOS_AWD
.byte PERFECT_ICONS ;PERFECT_AWD
.byte FIRST_HIT_ICONS ;FIRST_HIT_AWD
.byte BIG_COMEBACK_ICONS ;COMEBACK_AWD
.byte SUPER_QWK_VICTORY_ICONS ;SUPER_QUICK_AWD
.byte VERY_QWK_VICTORY_ICONS ;VERY_QUICK_AWD
.byte QUICK_VICTORY_ICONS ;QUICK_AWD
.byte DEFEAT_HUMAN_ICONS ;DFT_HUMAN_AWD
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte 0 ;Not used
.byte DBL_PERFECT_ICONS ;DBL_PERFECT_AWD
.byte TWO_ROUND_SWEEP_ICONS ;TWO_RND_AWD
.byte 0 ;Not used
.byte 0 ;Not used
.byte GAME_COMPLETE_ICONS ;GAME_CMPLT_AWD
.byte FIVE_WINS_ICONS ;FIVE_WINS_AWD
.byte 0 ;Not used
.byte 0 ;Not used
.even
#***************************************************************
* round_award - adds in round ICONS for a player.
* a0 = pointer to player data.
* a10 = award index.
*
SUBR round_award
PUSH a9,a8
move *a0(PLYRNUM),a9,W ; Get the player number
cmpi 2,a9 ; Is this a human player
jrge #ra_out ; br = nope - get out
X8 a10 ; Mult award index by 8
move a10,a8
movb *a0(PLYR_SIDE),a9 ; What side are we ?
jrz #cks_rnd_p1 ; br = player 1
addi p2rnd_award,a10 ; add player 2 round table base to index
jruc #cks_rnd_go ; increment counter
#cks_rnd_p1
addi p1rnd_award,a10 ; add player 2 round table base to index
#cks_rnd_go
addi award_icons,a8
movb *a8,a8 ; Get # ICONs to award
movb *a10,a9 ; Get current value
add a8,a9 ; Add em in
movb a9,*a10 ; Put it back
#ra_out PULL a9,a8 ; Restore A9
rets ; Get the hell out
#***************************************************************
* match_award - adds round ICONS to match ICONS total
* a0 = pointer to player data.
* a10 = award index.
*
SUBR match_award
PUSH a9,a8
move *a0(PLYRNUM),a9,W ; Get the player number
cmpi 2,a9 ; Is this a human player
jrge #ma_out ; br = nope - get out
X8 a10 ; Mult award index by 8
move a10,a8
movb *a0(PLYR_SIDE),a9 ; What side are we ?
jrz #cks_match_p1 ; br = player 1
addi p2mtch_award,a10 ; add player 2 round table base to index
jruc #cks_match_go ; increment counter
#cks_match_p1
addi p1mtch_award,a10 ; add player 2 round table base to index
#cks_match_go
addi award_icons,a8
movb *a8,a8 ; Get # ICONs to award
movb *a10,a9 ; Get current value
add a8,a9 ; Add em in
movb a9,*a10 ; Put it back
#ma_out PULL a9,a8 ; Restore A9
rets ; Get the hell out
#* NOTE - These MUST Be in the same order as the award indexes in game.equ
*
SUBRP award_text
.long PWRMVEC ; Power Move
.long HIGHRSKC ; Reversal
.long HIGHRSKC ; High Risk
.long NOBLOCK ; No Blocks
.long HIGHRSKC ; Combos Started
.long CMBOREVC ; Combo Reversals
.long HIGHRSKC ; Combo Breakers
.long HIGHRSKC ; Ultra Combos
.long PERFECT ; Perfect
.long CMBOREVC ; First Hit
.long BIGCOME ; Big Comeback
.long HIGHRSKC ; Super Quick Pin
.long HIGHRSKC ; Very Quick Pin
.long FASTVIC ; Quick Pin
.long HIGHRSKC ; Defeated Human
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long DOUBPERF ; DBL Perfect
.long TWOROUND ; First Two round win
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
.long HIGHRSKC ; Game Completed with < 5 buyins
.long FIVEWIN ; 5 Winstreak
.long 0 ; Not Yet Used
.long 0 ; Not Yet Used
;a8 = player number 0=1 1=2
;a9 = *bar record
;a11 = zip out on state #, zip in then die on state #+1
SUBRP zip_award_bar
move @player_award_state,a10,L
cmp a10,a11
jrz #zip_out
SLEEPK 1
jruc zip_award_bar
#zip_out
movi ZIP_IN_SOUND,a0
calla triple_sound
subi (BONUS_RECORD_SIZE*32),a9
addk 1,a11
move *a9((BONUS_RECORD_SIZE-1)*32),a0,W
move a8,a8
jrz #p1_zip_out
movi [-BONUS_BAR_VEL,0],a1
jruc #zip_out_loop
#p1_zip_out
movi [BONUS_BAR_VEL,0],a1
#zip_out_loop
move *a9,a10,L ; Bar
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(32),a10,L ; Text
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(64),a10,L ; 1st Icon
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(96),a10,L ; 2nd Icon
jrz #zout_done
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(128),a10,L ; 3rd Icon
jrz #zout_done
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
#zout_done
PUSHP a0,a1
SLEEPK 1
PULLP a0,a1
move *a9,a10,L
move *a10(OXPOS),a10,W
cmp a10,a0
jrnz #zip_out_loop
; JSRP flash_bar_icons
move *a9(((BONUS_RECORD_SIZE-1)*32)+16),a10,W
jrnz #no_zip_in
#wait_2nd_state
move @player_award_state,a10,L
cmp a10,a11
jrle #zip_in
SLEEPK 1
jruc #wait_2nd_state
#zip_in
SLEEPK 3
move a8,a8
jrz #p1_zip_in
movi [BONUS_BAR_VEL,0],a1
movi 399,a0
jruc #zip_in_loop
#p1_zip_in
movi [-BONUS_BAR_VEL,0],a1
clr a0
#zip_in_loop
move *a9,a10,L ; Bar
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(32),a10,L ; Text
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(64),a10,L ; 1st Icon
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(96),a10,L ; 2nd Icon
jrz #zin_done
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
move *a9(128),a10,L ; 3rd Icon
jrz #zin_done
move *a10(OXVAL),a14,L
add a1,a14
move a14,*a10(OXVAL),L
#zin_done
PUSHP a0,a1
SLEEPK 1
PULLP a0,a1
move *a9,a10,L
move *a10(OXPOS),a10,W
cmp a10,a0
jrnz #zip_in_loop
#zip_exit
move *a9,a0,L ; Bar
calla DELOBJ
move *a9(32),a0,L ; Text
calla DELOBJ
move *a9(64),a0,L ; 1st Icon
calla DELOBJ
move *a9(96),a0,L ; 2nd Icon
jrz #zip_die
calla DELOBJ
move *a9(128),a0,L ; 3rd Icon
jrz #zip_die
calla DELOBJ
#zip_die
DIE
#no_zip_in
; JSRP flash_bar_icons
move @award_ok_to_die,a10,L
addi 1,a10
move a10,@award_ok_to_die,L
#no_zip_in_wait
move @award_ok_to_die,a10,L
cmpi 4,a10
jrz #zip_exit
SLEEPK 1
jruc #no_zip_in_wait
SUBRP flash_bar_icons
PUSHP a8,a9
move a9,a10
addi 64,a10
movi 0101h,a9
#iflash_loop
move *a10+,a8,L
jrz #fbi_exit
CREATE AWARD_PID,FLASHME
jruc #iflash_loop
#fbi_exit
SLEEPK 10
PULLP a8,a9
RETP
SUBRP get_num_awards:
PUSH a6,a7,a8,a9,a11
clr a8
movi award_text,a6
movi NUM_AWARDS,a9
#gna_loop
movb *a10,a11
jrz #no_inc
move a11,*a7+,L
cmpi 5,a11
jrge #gna_big_icon
clr a11
jruc #gna_get_text_obj
#gna_big_icon
movi 1,a11
#gna_get_text_obj
move a11,*a7+,L
move *a6,*a7,L
addi 32,a7
addk 1,a8
#no_inc
addi 32,a6
addk 8,a10
dsjs a9,#gna_loop
move a8,a10
cmpi 6,a8
jrle #no_limit
movk 6,a10
#no_limit
PULL a6,a7,a8,a9,a11
rets
#****************************************************************
*
* adjust_perfects - This function is called to check to see if 2 perfects
* have been registered for a match. If so the perfects are deleted from
* a double perfect is put into the match awards and the 2 single perfects
* are removed. This allows the double perfect to be registered in the
* winstreak accumulation and the proper icon bar to be displayed at the
* end of the match.
*
SUBRP adjust_perfects
PUSH a9,a10
movi p1mtch_award,a9
addi (PERFECT_AWD*8),a9
movb *a9,a10 ; How many perfects for match
cmpi (PERFECT_ICONS*2),a10 ; Is it 2?
jrnz #nop1_dbl_perfect ; br = nope
clr a10 ; Reset match perfects
movb a10,*a9
subi (PERFECT_AWD*8),a9 ; Add a double perfect
addi (DBL_PERFECT_AWD*8),a9
movb *a9,a10
addk DBL_PERFECT_ICONS,a10
movb a10,*a9
jruc #ap_done
#nop1_dbl_perfect
movi p2mtch_award,a9
addi (PERFECT_AWD*8),a9
movb *a9,a10
cmpi (PERFECT_ICONS*2),a10
jrnz #ap_done
clr a10
movb a10,*a9
subi (PERFECT_AWD*8),a9
addi (DBL_PERFECT_AWD*8),a9
movb *a9,a10
addk DBL_PERFECT_ICONS,a10
movb a10,*a9
#ap_done
#adjust_blocks
movi p1mtch_award,a9
addi (BLOCKS_AWD*8),a9
movb *a9,a10 ; How many block awards for match
cmpi (BLOCK_ICONS*2),a10 ; Is it >= 2?
jrlt #nop1_dbl_block ; br = nope
movk DBL_BLOCK_ICONS,a10 ; Give bigger award for multiround no blocking
movb a10,*a9
#nop1_dbl_block
movi p2mtch_award,a9
addi (BLOCKS_AWD*8),a9
movb *a9,a10
cmpi (BLOCK_ICONS*2),a10
jrlt #ab_done
movk DBL_BLOCK_ICONS,a10
movb a10,*a9
#ab_done
PULL a9,a10
rets
; A8 = Player number
; A9 = *next bar icon record
SUBRP adjust_text_position
PUSH a9
subi ((BONUS_RECORD_SIZE-3)*32),a9 ;Point at Icon 2 object
#adj_t_loop
move *a9,a0,L ;Object exist ?
jrz #atp_exit ;br = no
move *a0(OIMG),a14,L ;Get image pointer
move *a14,a14,W ;Get image width
move a8,a8 ;Player 1?
jrnz #do_tadjust ;br = no
neg a14
#do_tadjust
move *a9(OXPOS),a0,W ;Get current XPos
add a14,a0 ;Adjust it
move a0,*a9(OXPOS),W ;Write it back
addi 32,a9
jruc #adj_t_loop
#atp_exit
PULL a9
rets
SUBRP create_player_awards
movi bar_obj_ptr,a9
movi p1mtch_award,a10
movi picon,a7
move a8,a8 ; player 1 ?
jrz #dpa_p1 ; br = yes
addi (MAX_BONUS_BARS*BONUS_RECORD_SIZE*32),a9
addi (MAX_BONUS_BARS*3*32),a7
movi p2mtch_award,a10
#dpa_p1
callr get_num_awards ; Get the number of awards
move a10,a10
jrz #no_awards
move a7,a0
PUSH a0
movk 1,a11
movi [BONUS_BAR_YPOS,0],a1 ;Start Y position
movi 1800h,a3 ;Start Z position
movi TYPVELALWAYS,a5 ;Object ID
clr a6
clr a7 ;Y velocity
; Make a bonus bar
#do_next_award_bar
movi BONUSBAR,a2 ;Image Pointer
movi [399,0],a0 ;Start X position
movi DMAWNZ|M_3D|M_SCRNREL,a4 ;DMA flags
movi DPLT_R_P,b0 ;Make em BLUE
move a8,a8 ;Player 1?
jrnz #do_bar ;br = no
clr a0
movi DMAWNZ|M_3D|M_SCRNREL|M_FLIPH,a4 ;DMA flags
movi DPLT_B_P,b0 ;Make em BLUE
#do_bar
mmtm sp,a1,a8
calla BEGINOBJP ;Bonus Bar
move a8,*a9+,L
mmfm sp,a1,a8
; Make the bonus bar text
movi DMAWNZ|M_3D|M_SCRNREL,a4 ;DMA flags
PULL a0
move *a0(64),a2,L
PUSH a0
movi [399+BONUS_RTEXT_START_XPOS,0],a0
move a8,a8 ;Player 1?
jrnz #do_text ;br = no
movi [BONUS_LTEXT_START_XPOS,0],a0
#do_text
addi 10h,a3
mmtm sp,a1,a8
calla BEGINOBJ ;Bonus Bar
move a8,*a9+,L
mmfm sp,a1,a8
; Make the bonus bar icon 1
PULL a0
callr get_bbicons
PUSH a0
movi [399-BONUS_ICON1_START_XPOS,0],a0 ;Start X position
move a8,a8 ;Player 1?
jrnz #do_icon_1 ;br = no
movi [BONUS_ICON1_START_XPOS,0],a0 ;Start X position
#do_icon_1
addi 10h,a3
mmtm sp,a1,a8
move *a9,a2,L
calla BEGINOBJ ;Icon 1
move a8,*a9+,L
mmfm sp,a1,a8
; Make the bonus bar icon 2
move *a9,a2,L
jrz #no_2nd_icon
movi [399-BONUS_ICON2_START_XPOS,0],a0 ;Start X position
move a8,a8 ;Player 1?
jrnz #do_icon_2 ;br = no
movi [BONUS_ICON2_START_XPOS,0],a0 ;Start X position
#do_icon_2
addi 10h,a3
mmtm sp,a1,a8
calla BEGINOBJ ;Icon 2
move a8,*a9+,L
mmfm sp,a1,a8
jruc #chk_3rd_icon
#no_2nd_icon
clr a2
move a2,*a9+,L
jruc #no_more_icons
#chk_3rd_icon
; Make the bonus bar icon 3
move *a9,a2,L
jrz #no_more_icons
movi [399-BONUS_ICON3_START_XPOS,0],a0 ;Start X position
move a8,a8 ;Player 1?
jrnz #do_icon_3 ;br = no
movi [BONUS_ICON3_START_XPOS,0],a0 ;Start X position
#do_icon_3
addi 10h,a3
mmtm sp,a1,a8
calla BEGINOBJ ;Icon 3
move a8,*a9+,L
mmfm sp,a1,a8
jruc #icon_3_done
#no_more_icons
clr a2
move a2,*a9+,L
#icon_3_done
movi (399-BONUS_BAR_END_XPOS),a0
move a8,a8 ;Player 1?
jrnz #do_td_pos ;br = no
movi BONUS_BAR_END_XPOS,a0 ;End for check award
#do_td_pos
move a0,*a9+,W ;Store Ending position
clr a0
move a0,*a9+,W ;Store NOT last
callr adjust_text_position ;Adjust text position based on number of icons
#create_bar_proc
mmtm sp,a1,a7
CREATE AWARD_PID,zip_award_bar ; Process to control this bar
mmfm sp,a1,a7
addk 1,a11
PULL a0
addi 96,a0
PUSH a0
dsj a10,#do_next_award_bar
movk 1,a0
move a0,-*a9,W ;Store last
PULL a0
rets
#no_awards
move @award_ok_to_die,a9,L
addi 1,a9
move a9,@award_ok_to_die,L
rets
SUBRP total_icons
move a8,a8
jrz #tot_p1_icons
movi p2mtch_award,a9
movi p2icon_total,a10
jruc #tot_awards
#tot_p1_icons
movi p1mtch_award,a9
movi p1icon_total,a10
#tot_awards
movi NUM_AWARDS,a11
move *a10,a8,L
#tot_awards_loop
movb *a9,a14
sll 24,a14
srl 24,a14
add a14,a8
addk 8,a9
dsjs a11,#tot_awards_loop
move a8,*a10,L
rets
SUBR clear_icon_total
move a8,a8
jrz #clr_p1_icons
clr a8
move a8,@p2icon_total,L
rets
#clr_p1_icons
move a8,@p1icon_total,L
rets
#****************************************************************
*
* create_end_rnd_awards - This PROCESS creates the icon bars displayed
* at the end of a match.
*
SUBR create_end_rnd_awards
move @royal_rumble,a14
jrz #cera_ok
DIE
#cera_ok
callr adjust_perfects
movi (MAX_BONUS_BARS*BONUS_RECORD_SIZE*2),a8
movi bar_obj_ptr,a9
clr a11
#clr_array_loop
move a11,*a9+,L
dsjs a8,#clr_array_loop
clr a8 ; Clear the state machine
move a8,@player_award_state,L
;1PLYR
move *a10(PLYR_SIDE),a8
callr create_player_awards ; Create awards for player 1
;1PLYR movk 1,a8
;1PLYR callr create_player_awards ; Create awards for player 2
movk 1,a8 ; Start the state machine
move a8,@player_award_state,L
#state_loop
movi ((TSEC*3)/4),a9 ; How long each bar is diplayed
#state_loop1
SLEEPK 1
calla get_all_buttons_cur
jrnz #quick_states
dsjs a9,#no_state_advance ; Is it time to advance the state machine?
addk 1,a8 ; Yes
move a8,@player_award_state,L
jruc #state_loop ; Reset the Sleeper time
#no_state_advance
move @award_ok_to_die,a10,L ; Is it time to exit ?
;1PLYR cmpi 2,a10
cmpi 1,a10
jrnz #state_loop1 ; br = no
clr a8
callr total_icons
movk 1,a8
callr total_icons
movi TSEC/2,a8
#wait
SLEEPK 1
calla get_all_buttons_cur
jrnz #wait_abort
dsjs a8,#wait
#wait_abort
movk 3,a8
move a8,@award_ok_to_die,L
DIE
#quick_states
SLEEPK 5
addk 1,a8
move a8,@player_award_state,L
jruc #no_state_advance
#****************************************************************
*
* is_it_a_really_quick_win - This function determines whether the win
* by the player (a10) was quick enough to be awarded an icon. If so
* an icon is awarded.
*
SUBR is_it_a_really_quick_win
PUSH a0,a1,a2
move @match_time,a0,L
move a0,a2
andi 0fh,a0
movk 10,a1
mpyu a0,a1