-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathANIM.ASM
executable file
·4968 lines (3856 loc) · 85.8 KB
/
ANIM.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: Jamie Rivett
* Initiated: 6/93
*
* COPYRIGHT (C) 1992 WILLIAMS ELECTRONICS GAMES, INC.
*
**************************************************************
.file "anim.asm"
.title "animation routines"
.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 "game.equ"
.include "plyr.equ"
.include "anim.equ"
.include "audit.equ"
.include "ring.equ"
.include "sound.h"
.include "jjxm.h"
.INCLUDE "SOUND.EQU"
.include "fontsimg.glo"
.include "bgndtbl.glo"
.include "miscimg.glo"
******************************************************************************
*
* external references
.ref p2rounds,p1rounds,xxx_dead_anim,is_final_match,FINAL_PTR
.ref get_opp_process
.ref PSTATUS,round_award
.ref PCNT,slowmo,do_roll,match_over,triple_sound,is_8_on_1
.ref match_winner,process_ptrs,square_root,set_target_offsets
.ref calc_line_x,RNDPER,wrtable_sound,rope_command,no_debris
.ref set_rope_z,SHAKER2,get_all_buttons_down,right_rproc
.ref left_rproc,adjust_health,create_dizzy_proc,get_mpart_offsets
.ref get_mpart_xsize,pal_find,round_tickcount,tgt_ground
.ref get_rope_x,allow_offscrn,ADD_TO_COMBO_COUNT,MOVE_NAME_ANNC
.ref reduce_bog,RNDRNG0,hyper_speed_on,royal_rumble
.ref kill_smove_procs,clear_lifebar
.ref wrestler_count,wrestler_count_proc
.REF IF_SILENT_ADD_VOICE
******************************************************************************
*
* external definitions
#*****************************************************************************
OANIMODE equ 0 ;word
OANIBASE equ OANIMODE+10h ;long
OANIPC equ OANIBASE+20h ;long
OANICNT equ OANIPC+20h ;word
OCUR_FRAME equ OANICNT+10h ;long
SUBR animate_wrestler
PUSH a4,a10
.ref match_time
move @match_time,a0,L
jrz #x
; callr animate_wrestler1
; callr animate_wrestler2
move a13,a10
addi ANIMODE,a10 ;primary animation
callr animate
move a13,a10
addi ANIMODE2,a10 ;secondary animation
callr animate
#x
PULL a4,a10
rets
SUBR animate_wrestler1
PUSH a4,a10
move a13,a10
addi ANIMODE,a10 ;primary animation
callr animate
PULL a4,a10
rets
SUBR animate_wrestler2
PUSH a4,a10
move a13,a10
addi ANIMODE2,a10 ;secondary animation
callr animate
PULL a4,a10
rets
********
animate ;a10 = * anim variables base
move *a10(OANIMODE),a0 ;current animation ended???
btst MODE_END_BIT,a0
jrnz _exit
.if 0
*** temp patch to step through images on player 1 !!!!
move *a13(PLYRNUM),a0
jrnz #skippit
move *a10(OANIBASE),a0,L
move *a10(OANIPC),a1,L
cmp a0,a1
jreq _next_command
move *a13(BUT_VAL_DOWN),a0
move a0,a0
jrnz _next_command
rets
#skippit
.endif
***
move *a10(OANICNT),a0 ;cur tick count
dec a0
move a0,*a10(OANICNT)
jrgt _exit
_next_command
move *a10(OANIPC),a4,L
_next_command1
move *a4+,a0 ;tick count or command
jrn #command
jrz _ani_zip ;no-op
move *a13(ANI_SPEED),a1
mpyu a0,a1
srl 8,a1
move @hyper_speed_on,a14
srl a14,a1
.if DEBUG
move a1,a1
jrge #not_z
LOCKUP
#not_z
.endif
move a1,*a10(OANICNT) ;# ticks to hold cur frame
; move a0,a1
; sll 8,a1 ;* 256
; move *a13(ANI_SPEED),a0 ;divisor * 256
; divu a0,a1 ;a1/a0
; move a1,*a10(OANICNT) ;# ticks to hold cur frame
move *a4+,a0,L ;* * multi image object
.if DEBUG
cmpi >ff800000,a0
jrhs #img_ok
LOCKUP ;bogus image pointer
#img_ok
.endif
move *a0,a0,L ;* image
.if DEBUG
jrnz #ok
LOCKUP
jruc #skp
#ok
.endif
move a0,*a10(OCUR_FRAME),L
#skp
move a4,*a10(OANIPC),L
_exit
rets
#command
; andi 0ffh,a0
; sll 5,a0 ;x 32
sll 24,a0
srl 19,a0
addi #ani_commands,a0
.if DEBUG
cmpi #ani_commands_end,a0
jrlt #cmd_ok
LOCKUP ;bogus ani command
#cmd_ok
.endif
move *a0,a0,L
jump a0
#ani_commands
.long _ani_zip ;0
.long _ani_repeat ;1
.long _ani_setmode ;2
.long _ani_zerovels ;3
.long _ani_setplyrmode ;4
.long _ani_set_yvel ;5
.long _ani_attack_on ;6
.long _ani_attack_off ;7
.long _ani_leapatopp ;8
.long _ani_attach ;9
.long _ani_detach ;10
.long _ani_waithitgnd ;11
.long _ani_xflip ;12
.long _ani_bounce ;13
.long _ani_attack_on_Z ;14
.long _ani_gravity_on ;15
.long _ani_gravity_off ;16
.long _ani_goto ;17
.long _ani_attachz ;18
.long _ani_slowmo ;19
.long _ani_waitrelease ;20
.long _ani_offset ;21
.long _ani_friction ;22
.long _ani_min_yvel ;23
.long _ani_attachvel ;24
.long _ani_throw1 ;25
.long _ani_sound ;26
.long _ani_setfacing ;27
.long _ani_pause ;28
.long _ani_ifstatus ;29
.long _ani_code ;30
.long _ani_shaker ;31
.long _ani_changeanim ;32
.long _ani_faceup ;33
.long _ani_facedown ;34
.long _ani_bouncerope ;35
.long _ani_shakeropes ;36
.long _ani_bendrope ;37
.long _ani_setspeed ;38
.long _ani_leapatpos ;39
.long _ani_zero_xzvels ;40
.long _ani_rope_z ;41
.long _ani_loop ;42
.long _ani_zip ;43
.long _ani_set_xvel ;44
.long _ani_ifnotstatus ;45
.long _ani_slide_back ;46
.long _ani_clr_damage ;47
.long _ani_set_zvel ;48
.long _ani_checkword ;49
.long _ani_face ;50
.long _ani_setword ;51
.long _ani_getup ;52
.long _ani_getup_wait ;53
.long _ani_clr_stars ;54
.long _ani_shakeall ;55
.long _ani_damage ;56
.long _ani_start_dizzy ;57
.long _ani_clr_status ;58
.long _ani_set_target ;59
.long _ani_max_x ;60
.long _ani_max_z ;61
.long _ani_max_y_vel ;62
.long _ani_superslave ;63
.long _ani_slaveanim ;64
.long _ani_rawsound ;65
.long _ani_damageopp ;66
.long _ani_rndper ;67
.long _ani_waithitopp ;68
.long _ani_attchimage ;69
.long _ani_ifoppmode ;99
.long _ani_ifbuttons ;71
.long _ani_ifnohitblock ;72
.long _ani_end ;73
.long _ani_ifrope ;74
.long _ani_ifnotrope ;75
.long _ani_opp_getup ;76
.long _ani_shakecorner ;77
.long _ani_singlestep ;78
.long _ani_superslave2 ;79
.long _ani_setoppmode ;80
.long _ani_clroppmode ;81
.long _ani_oppoffset ;82
.long _ani_ifblocked ;83
.long _ani_waitroll ;84
.long _ani_setoppfacing ;85
.long _ani_ifopp ;86
.long _ani_snot ;87
.long _ani_if_butcount_ge ;88
.long _ani_if_butcount_lt ;89
.long _ani_if_rptcount ;90
.long _ani_ifnot_rptcount ;91
.long _ani_ringcheck ;92
.long _ani_debrisat ;93
.long _ani_debris ;94
.long _ani_set_wrestler_xflip ;95
.long _ani_slideatopp ;96
.long _ani_clr_butcount ;97
.long _ani_set_rptcount ;98
.long _ani_dec_rptcount ;99
.long _ani_shadowtrail ;100
.long _ani_createproc ;101
.long _ani_target ;102
.long _ani_hmbwait ;103
.long _ani_safe_time ;104
.long _ani_setopp_plyrmode ;105
.long _ani_xflip_opp ;106
.long _ani_setlong ;107
.long _ani_immobilize ;108
.long _ani_xflip_tbl ;109
.long _ani_setoppvels ;110
.long _ani_waithitgnd2 ;111
.long _ani_set_opp_xvel ;112
.long _ani_set_attach ;113
.long _ani_inc_combo_count ;114
.long _ani_clear_combo_count ;115
.long _ani_add_move ;116
.long _ani_startattack ;117
.long _ani_changeanim_tbl ;118
.long _ani_if_rptcount_ge ;119
.long _ani_if_rptcount_lt ;120
.long _ani_waithitany ;121
.long _ani_draw_name ;122
.long _ani_set_idiot ;123
.long _ani_attchimage2 ;124
.long _ani_ground ;125
.long _ani_rot ;126
.long _ani_scroll_ctrl ;127
.long _ani_clear_climb ;128
.long _ani_opp_face ;129
.long _ani_setflag ;130
#ani_commands_end
#********
_ani_zip ;0
.if DEBUG
LOCKUP
.endif
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_repeat ;1
move *a10(OANIBASE),a4,L
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_setmode ;2
move *a4+,a0 ;mode bits
move a0,*a10(OANIMODE)
move a4,*a10(OANIPC),L
;clear some STATUS_FLAGS bits too.
move *a13(STATUS_FLAGS),a14,L
andni SF_CLEAR_BITS,a14
move a14,*a13(STATUS_FLAGS),L
;if *a13(PTIME) is nonzero, this anim was called by someone other
; than our actual wrestler process. So clearing the KOD bit isn't
; enough, since we're still sleeping. Set PTIME to 1.
move *a13(PTIME),a14
jrz _next_command
movk 1,a14
move a14,*a13(PTIME)
jruc _next_command
#********
_ani_zerovels ;3
clr a0
move a0,*a13(OBJ_XVEL),L
move a0,*a13(OBJ_YVEL),L
move a0,*a13(OBJ_ZVEL),L
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_setplyrmode ;4
;clear the climbin bit, just in case...
clr a14
move a14,*a13(CLIMBING_THRU)
move *a4+,a0
move *a13(PLYRMODE),a1 ;this is a temp fudge!!!
cmpi MODE_DEAD,a1
jreq #noset
;If going into head hold mode, don't allow getup meter
;to come out for awhile.
cmpi MODE_HEADHOLD,a0
jrnz #skp
move *a13(DELAY_METER),a14
cmpi 6*60,a14
jrge #skp
movi 9*60,a14
move a14,*a13(DELAY_METER)
#skp
move a0,*a13(PLYRMODE)
#noset
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_set_yvel ;5
move *a4+,a0,L
move a0,*a13(OBJ_YVEL),L
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_attack_on ;6
;I'm not sure we want to zero attach_proc just for starting an attack!
;Watch this....
clr a0 ;start out not attached
; move a0,*a13(ATTACH_PROC),L ;to anything
move a0,*a13(HITBLOCKER)
;The start of each attack on will clear MODE_STATUS!
move *a13(ANIMODE),a0
andni MODE_STATUS,a0
move a0,*a13(ANIMODE)
move *a13(ANIMODE),a0
ori MODE_CHECKHIT,a0
move a0,*a13(ANIMODE)
move *a4+,a0
move a0,*a13(ATTACK_MODE)
; move *a4+,a0
; move a0,*a13(OBJ_ATTXOFF)
; move *a4+,a0
; move a0,*a13(OBJ_ATTYOFF)
; move *a4+,a0
; move a0,*a13(OBJ_ATTWIDTH)
; move *a4+,a0
; move a0,*a13(OBJ_ATTHEIGHT)
move *a4+,a0,L
move a0,*a13(OBJ_ATTXOFF),L
move *a4+,a0,L
move a0,*a13(OBJ_ATTWIDTH),L
;;; clr a0
;;; move a0,*a13(OBJ_ATTZOFF)
;;; move a0,*a13(OBJ_ATTDEPTH)
movi -40,a0 ;default z width (10)
move a0,*a13(OBJ_ATTZOFF)
movi 40*2,a0 ;10*2
move a0,*a13(OBJ_ATTDEPTH)
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_attack_off ;7
;clear CHECKHIT and WAITHITOPP bits
move *a13(ANIMODE),a0
andni MODE_CHECKHIT|MODE_WAITHITOPP,a0
move a0,*a13(ANIMODE)
;clear SMART_ATTACK bit and SMART_TARGET value
move *a13(STATUS_FLAGS),a14
andni M_SMART_ATTACK,a14
move a14,*a13(STATUS_FLAGS)
clr a14
move a14,*a13(SMART_TARGET),L
;update ATTACK_TIME
move @round_tickcount,a0
move a0,*a13(ATTACK_TIME)
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_leapatopp ;8
; # ticks to reach dest
; max total distance (X and Z)
; max X distance
; max Z distance
; max Y vel
; target area of opponent
; x,y,z offset of attack box
STRUCT 0
WORD #TICKS
WORD #MAX_TOTAL_DIST
WORD #MAX_X_DIST
WORD #MAX_Z_DIST
LONG #MAX_Y_VEL
WORD #TRGT
WORD #ATT_X_OFF
WORD #ATT_Y_OFF
WORD #ATT_Z_OFF
LABEL #SIZE
.bss oppx,32
.bss oppz,32
.bss oppy,32
move a4,a14
addi #SIZE,a14
move a14,*a10(OANIPC),L
move *a13(CLOSEST_NUM),a11
X32 a11
addi process_ptrs,a11
move *a11,a11,L
move *a11(OBJ_XVEL),a5,L
move *a11(PLYRMODE),a14
cmpi MODE_RUNNING,a14
jrne #outring
move a0,a0
jrnz #outring
;if opponent is inside the ring, running and near the ropes
;then target where he is now (don't add in xvel)
move *a11(OBJ_XPOSINT),a1
move a5,a5 ;xvel
jrp #run_right
;run_left
cmpi RING_X_CENTER,a1
jrgt #outring
jruc #cnt
#run_right
cmpi RING_X_CENTER,a1
jrlt #outring
#cnt
PUSH a13
move a11,a13
calla get_rope_x
PULL a13
move *a11(OBJ_XPOSINT),a1
sub a1,a0
abs a0
cmpi 70,a0
jrgt #outring
clr a5 ;clr xvel
#outring
move *a11(OBJ_ZVEL),a6,L
move *a11(OBJ_YVEL),a7,L
move *a11(GROUND_Y),a8
sll 16,a8
addi [256,0],a8
move *a11(OBJ_XPOS),a1,L
move *a11(OBJ_ZPOS),a2,L
move *a11(OBJ_YPOS),a3,L
addi [256,0],a3
move *a4(#TICKS),a0
move *a13(OBJ_GRAVITY),a14,L
#lp0
add a5,a1 ;x + xvel
add a6,a2 ;z + zvel
move a7,a7
jrz #ok
add a7,a3 ;y + yvel
sub a14,a7 ;yvel - gravity
cmp a3,a8 ;hit ground?
jrgt #ok
move a8,a3
jruc #dn
#ok
dsj a0,#lp0
#dn
subi [256,0],a3
move a1,@oppx,L
move a2,@oppz,L
move a3,@oppy,L
move *a4(#TRGT),a0
jrn #user
btst B_TGT_GROUND,a0
jrz #ngrnd
andni TGT_GROUND,a0
calla set_target_offsets
calla tgt_ground
jruc #user
#ngrnd
calla set_target_offsets
#user
move *a13(TGT_XOFF),a0 ;target x offset
sll 16,a0
move *a11(OBJ_CONTROL),a14
btst B_FLIPH,a14
jrz #right1
neg a0
#right1
;;; move *a11(OBJ_XPOS),a1,L
move @oppx,a1,L
add a0,a1 ;def target x
move *a4(#ATT_X_OFF),a0
sll 16,a0
move *a13(OBJ_CONTROL),a14
btst B_FLIPH,a14
jrz #right0
neg a0
#right0
move *a13(OBJ_XPOS),a2,L
add a0,a2 ;att x
sub a2,a1 ;def x - att x
move a1,a14
abs a14
move *a4(#MAX_X_DIST),a0
jrn #xok
sll 16,a0
cmp a14,a0
jrge #xok
move a1,a1
jrp #no_negx
neg a0
#no_negx
move a0,a1
#xok
move a1,a5 ;delta x
move *a4(#TICKS),a0
divs a0,a1 ;a1 / a0
move a1,*a13(OBJ_XVEL),L
move *a13(TGT_ZOFF),a0 ;target z offset
sll 16,a0
;;; move *a11(OBJ_ZPOS),a1,L
move @oppz,a1,L
add a0,a1 ;def target z
move *a13(OBJ_ZPOS),a2,L
move *a4(#ATT_Z_OFF),a0
sll 16,a0
add a0,a2 ;att z
sub a2,a1 ;def z - att z
move a1,a14
abs a14
move *a4(#MAX_Z_DIST),a0
jrn #zok
sll 16,a0
cmp a14,a0
jrge #zok
move a1,a1
jrp #no_negz
neg a0
#no_negz
move a0,a1
#zok
move a1,a6 ;delta z
move *a4(#TICKS),a0
divs a0,a1 ;a1 / a0
move a1,*a13(OBJ_ZVEL),L
move *a4(#MAX_TOTAL_DIST),a9
jrn #maxok
abs a5
srl 16,a5
move a5,a1
mpyu a5,a1 ;deltax^2
move a1,a5
abs a6
srl 16,a6
move a6,a1
mpyu a6,a1 ;deltaz^2
move a1,a0
add a5,a0
calla square_root
cmp a0,a9 ;a9-a0 (will we exceed max dist?)
jrgt #maxok
sll 8,a9 ;x 256 (8 bits fractional)
divu a0,a9 ;a9/a0
move a9,a1
move *a13(OBJ_XVEL),a0,L
mpys a0,a1 ;scale down xvel
sra 8,a1 ;shift off fractional
move a1,*a13(OBJ_XVEL),L
move a9,a1
move *a13(OBJ_ZVEL),a0,L
mpys a0,a1 ;scale down yvel
sra 8,a1 ;shift off fractional
move a1,*a13(OBJ_ZVEL),L
#maxok
;to calculate YVEL taking into account gravity:
;use y-y0 = v0*t + 0.5*a*t^2
move *a4(#TICKS),a8
move a8,a1
mpyu a8,a1 ;t^2
move *a13(OBJ_GRAVITY),a0,L
mpyu a0,a1 ;a*t^2
srl 1,a1 ;1/2*a*t^2
;;; move *a11(OBJ_YPOS),a0,L ;opp y
move @oppy,a0,L
move *a13(TGT_YOFF),a14 ;target y offset
sll 16,a14
add a14,a0
move *a13(OBJ_YPOS),a2,L ;y0
move *a4(#ATT_Y_OFF),a14
sll 16,a14
add a14,a2
sub a2,a0 ;a0 = a0-a2 (y - y0)
add a0,a1
jrnn #yvel_okay
; LOCKUP
clr a1
jruc #yok
#yvel_okay
divu a8,a1 ;a1 = a1/a8 ( ((y-y0)+(1/2*a*t^2)) / t )
move *a4(#MAX_Y_VEL),a0,L
cmp a1,a0
jrge #yok
move a0,a1
#yok
move a1,*a13(OBJ_YVEL),L
;make sure both have the same INRING value
move *a11(INRING),a0
move *a13(INRING),a1
cmp a0,a1
jreq #done
;uh-oh. our INRING's don't match. Unless we're on the
; turnbuckle (or flying from it), zero the X and Z
; velocities and set the Y velocity to 50000h or something
;...unfortunately, there's no really clean way to tell if
; we're on the turnbuckle at this point since the LEAPAT doesn't
; happen until well into the anim sequence and our PLYRMODE could
; be just about anything by then. So instead we'll fudge and look
; at some other clues, like gravity and y pos. If a player has a
; Y pos that's way high (80+) pixels above GROUND_Y and no gravity,
; that sure looks like a turnbuckle, so go with it.
move *a13(ANIMODE),a14
btst MODE_NOGRAVITY_BIT,a14
jrz #nt
move *a13(OBJ_YPOSINT),a0
move *a13(GROUND_Y),a14
sub a14,a0
subi 80,a0
jrnn #done
#nt ;no good. leap in place
clr a14
move a14,*a13(OBJ_XVEL),L
move a14,*a13(OBJ_ZVEL),L
movi [5,0],a14
move a14,*a13(OBJ_YVEL),L
#done
jruc _next_command
#********
_ani_attach ;9
; move *a4+,a0 ;xoff
; move a0,*a13(ATTACH_XOFF)
; move *a4+,a0
; move a0,*a13(ATTACH_YOFF)
move *a4+,a0,L ;xoff
move a0,*a13(ATTACH_XOFF),L
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_detach ;10
move *a13(ATTACH_PROC),a1,L
jrz #done_really
clr a0
move a0,*a13(ATTACH_PROC),L ;not attached to anything
move *a1(ATTACH_PROC),a2,L
cmp a2,a13
jrne #done_really ;attach_procs don't match!
move a0,*a1(ATTACH_PROC),L ;not attached to anything
#done
;if our victim is still in mode puppet, puppet2, headheld, or
; attached, instead put him in ONGROUND.
move *a1(PLYRMODE),a14
cmpi MODE_PUPPET,a14
jreq #fix_opp
cmpi MODE_PUPPET2,a14
jreq #fix_opp
;This was fucking up the shawn franknsteiner move from headhold!
;Forcing him to dive down too low!
; cmpi MODE_HEADHELD,a14
; jreq #fix_opp
cmpi MODE_ATTACHED,a14
jreq #fix_opp
jruc #done_really
#fix_opp
movi MODE_ONGROUND,a14
move a14,*a1(PLYRMODE)
#done_really
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_waithitgnd ;11
move *a13(OBJ_YVEL),a0,L ;must have down velocity
jrp #no_gnd
;if we're the master and the attach is valid, check and see if
; our puppet has hit the ground.
move *a13(ANIMODE),a14
btst MODE_KEEPATTACHED_BIT,a14
jrz #skip_pcheck
move *a13(ATTACH_PROC),a0,L
jrz #skip_pcheck ;we're attached?
move *a0(ATTACH_PROC),a14,L
jrz #skip_pcheck ;they're attached?
cmp a13,a14
jrne #skip_pcheck ;to each other?
;ah, but if the opponent's MODE_GHOST bit is set, ignore him
move *a0(ANIMODE),a14
btst MODE_GHOST_BIT,a14
jrnz #skip_pcheck
move *a0(OBJ_YPOSINT),a1,W
move *a0(GROUND_Y),a2,W
sub a1,a2
jrnn #hit_gnd
#skip_pcheck
move *a13(OBJ_YPOSINT),a0
move *a13(GROUND_Y),a1
cmp a1,a0 ;a0-a1
jrgt #no_gnd
#hit_gnd
CALLA SMALL_BOUNCE
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#no_gnd
movk 1,a0
move a0,*a10(OANICNT) ;# ticks to hold cur frame
rets
#********
_ani_xflip ;12
move *a13(OBJ_CONTROL),a0
xori M_FLIPH,a0
move a0,*a13(OBJ_CONTROL)
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_bounce ;13
move *a4+,a0 ;Bounce value
sll 16,a0
move a0,*a13(OBJ_YVEL),L
move a4,*a10(OANIPC),L
; jruc _next_command
jruc _next_command1
#********
_ani_attack_on_Z ;14
;I'm not sure we want to zero attach_proc just for starting an attack!
;Watch this....
clr a0 ;start out not attached
; move a0,*a13(ATTACH_PROC),L ;to anything
move a0,*a13(HITBLOCKER)
move a0,*a13(ATTACH_ZOFF)
;The start of each attack on will clear MODE_STATUS!
move *a13(ANIMODE),a0
andni MODE_STATUS,a0
move a0,*a13(ANIMODE)
move *a13(ANIMODE),a0
ori MODE_CHECKHIT,a0
move a0,*a13(ANIMODE)
move *a4+,a0
move a0,*a13(ATTACK_MODE)
; move *a4+,a0
; move a0,*a13(OBJ_ATTXOFF)
; move *a4+,a0
; move a0,*a13(OBJ_ATTYOFF)
; move *a4+,a0
; move a0,*a13(OBJ_ATTZOFF)
; move *a4+,a0
; move a0,*a13(OBJ_ATTWIDTH)
; move *a4+,a0
; move a0,*a13(OBJ_ATTHEIGHT)
; move *a4+,a0
; move a0,*a13(OBJ_ATTDEPTH)
move *a4+,a0,L
move a0,*a13(OBJ_ATTXOFF),L
move *a4+,a0,L
move a0,*a13(OBJ_ATTZOFF),L
move *a4+,a0,L