-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMKANI.C
1514 lines (1131 loc) · 39.7 KB
/
MKANI.C
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
/******************************************************************************
File: mkani.c
Date: August 1994
(C) Williams Entertainment
Mortal Kombat III Animation Routines
******************************************************************************/
/* INCLUDES */
#include "system.h"
#ifdef SONY_PSX
#include "mksony.h"
#endif /* SONY_PSX */
#include "mkbkgd.h"
#include "mkobj.h"
#include "mkos.h"
#include "mkgame.h"
#include "mkutil.h"
#include "mkani.h"
#include "mkjoy.h"
#include "mkpal.h"
#include "mkguys.h"
#include "mkprop.h"
#include "mksound.h"
#include "valloc.h"
void beep_sound(void)
{
ochar_sound(0x1a);
}
void robo_laugh_sound(void)
{
ochar_sound(0x1c);
}
void camp_fire_sound(void)
{
ochar_sound(0xa);
}
void motaro_leg_stance(void)
{
current_proc->pdata.p_store1++;
if (current_proc->pdata.p_store1>=2)
{
current_proc->pdata.p_store1=0;
get_char_ani(ANIM_TABLE2,0); // arcade mod so we can get correct ptr (if psx files changes make sure to update)
// add a_stance2 to entry 0 of anitab2
}
}
void stsw_sound(void)
{
triple_sound(2);
return;
}
void st_tumble_sound(void)
{
ochar_sound(5);
return;
}
void morph_swpal(void)
{
LONG animframe;
OBJECT *obj=current_proc->pa8;
animframe=GET_LONG(current_proc->pa9); // grab img which has pal
animframe=(LONG)((ADDRESS*)COMPUTE_ADDR(obj->oheap,animframe));
animframe=GET_LONG(animframe);
animframe=(LONG)((OIMGTBL*)COMPUTE_ADDR(obj->oheap,animframe)+1);
player_swpal(current_proc,(void *)(GET_LONG(animframe)),obj);
return;
}
void boomerang_adjust(void)
{
adjust_xy_a5(current_proc->pdata.p_slave,SCX(0x48),SCY(0x20));
return;
}
extern WORD SKELRIP_P[];
extern void *finish_heap_ptr;
void useshak_bod_pal(void)
{
match_me_with_him();
player_swpal(current_proc,SKELRIP_P,current_proc->pa8);
(current_proc->pa8)->oheap=finish_heap_ptr; // switch to correct heap usasge
return;
}
extern void sk_ray1(void);
extern void sk_ray2(void);
extern void sk_ray3(void);
void spawn_bubble(void);
JUMPTBL calla_jumptbl[]=
{
0, // 0 not used
sweep_sounds, // 1
lineup_number_2, // 2
delete_slave, // 3
rsnd_big_whoosh, // 4
player_normpal, // 5
sans_repell_3, // 6
sonya_zap_pal, // 7
rsnd_footstep, // 8
air_dragon, // 9
lower_dragon, // 10
slave_inviso, // 11
slave_viso, // 12
new_float_ani, // 13
shock_init, // 14
stun_speed_3, // 15
stun_speed_6, // 16
shock_check, // 17
set_a10_to_him, // 18
set_a10_to_slave, // 19
stsw_sound, // 20
st_tumble_sound, // 21
morph_swpal, // 22
motaro_leg_stance, // 23
rsnd_stab, // 24
rsnd_whoosh, // 25
rsnd_big_block, // 26
camp_fire_sound, // 27
beep_sound, // 28
robo_laugh_sound, // 29
sk_ray1, // 30
sk_ray2, // 31
sk_ray3, // 32
rsnd_small_block, // 33
boomerang_adjust, // 34
spawn_bubble, // 35
useshak_bod_pal,
};
/******************************************************************************
Function: void find_ani_part2(short animnum)
By: David Schwartz
Date: Oct 1994
Parameters: animnum - animation # to use (special move ANIM_TABLE2)
Returns: current_proc->pa9 - ptr to start of 2nd part
Description: find the 2nd part of an animation:
the 2nd part is defined as an animation that has the format as follows:
frame 1 <--- 1st part
frame 2
...
frame N
0 <--- terminates 1st part
frame 3 <--- 2nd part
...
frame N
0 <--- terminates 2nd part
******************************************************************************/
void find_ani2_part2(short animnum)
{
get_char_ani(ANIM_TABLE2,animnum);
while ((GET_LONG(current_proc->pa9)++) != 0);
return;
}
/******************************************************************************
Function: void find_ani_part2(short animnum)
By: David Schwartz
Date: Oct 1994
Parameters: animnum - animation # to use
Returns: current_proc->pa9 - ptr to start of 2nd part
Description: find the 2nd part of an animation:
the 2nd part is defined as an animation that has the format as follows:
frame 1 <--- 1st part
frame 2
...
frame N
0 <--- terminates 1st part
frame 3 <--- 2nd part
...
frame N
0 <--- terminates 2nd part
******************************************************************************/
void find_ani_part2(short animnum)
{
get_char_ani(ANIM_TABLE1,animnum);
while ((GET_LONG(current_proc->pa9)++) != 0);
return;
}
/******************************************************************************
Function: void find_part2(void)
By: David Schwartz
Date: Oct 1994
Parameters: curent_proc->pa9 - ptr to start of frames to look out
Returns: current_proc->pa9 - ptr to start of next part
Description: find the next part of an animation:
******************************************************************************/
inline void find_part2(void)
{
while ((GET_LONG(current_proc->pa9)++) != 0);
return;
}
/******************************************************************************
Function: void find_part_a14(WORD acount)
By: David Schwartz
Date: Oct 1994
Parameters: acount - # of parts to find
Returns: None
Description: find the acount part of an animation
******************************************************************************/
void find_part_a14(WORD acount)
{
while (--acount>0)
find_part2();
return;
}
/******************************************************************************
Function: void find_last_frame(void)
By: David Schwartz
Date: Nov 1994
Parameters: Nine
Returns: None
Description: get last frame of an animation
******************************************************************************/
void find_last_frame(void)
{
/* get to end of list */
while (GET_LONG(current_proc->pa9)++ !=0);
(ADDRESS *)current_proc->pa9-=2; // last frame of sequence
return;
}
/******************************************************************************
Function: void animate2(OBJECT *obj,ADDRESS *framelist)
By: David Schwartz
Date: Sept 1994
Parameters: framelist - ptr to frame data table list
Returns: None
Description: setup frame to display
NOTE: we have kept the same structures for multipart ram as the
arcade game. PLEASE NOTE THAT ALL IMAGES HAVE BEEN PUT
TOGETHER AND THUS THERE IS ONLY ONE ENTRY PER OBJECT. IF THIS
SHOULD EVER CHANGE THEN THE ovcache field will need to be expanded to
handle each piece. Also, code will need to be modified to deal with
this.
Revisions:
11/22/94 changed frame parameter to framelist parameter. The table now points to a list
of pieces. These pieces are then used to build up the image. This makes the
code work like the arcade version.
11/21/94 added obj parameter so that routines that switch current_proc->pa8 and
the obj parameter can have current_proc->pa8 and obj to use set to two different
things.
******************************************************************************/
extern BYTE *soflor_addr;
void animate2(OBJECT *obj,ADDRESS *framelist)
{
OIMGTBL *frame;
P_RAM *pram_ptr;
RECT frame_info;
BYTE *temp;
pram_ptr=(P_RAM *)obj->oimg;
obj->oshape=framelist; // define current shape
#if !MULTI_OFF
while (((LONG)frame=GET_LONG(framelist)) != 0)
{
#else
(LONG)frame=GET_LONG(framelist);
#endif
frame=(OIMGTBL *)COMPUTE_ADDR(obj->oheap,frame);
pram_ptr->prsagptr=(ADDRESS)COMPUTE_ADDR(obj->oheap,frame->isagptr);
obj->osize.yx=pram_ptr->prsize.yx=frame->size.yx; // set size
pram_ptr->prflags=obj->oflags & (M_FLIPH+M_FLIPV); // set flip flags
switch ((pram_ptr->prflags & 0x30)>>4)
{
case 0: /* NO FLIPS */
pram_ptr->prpos.u.xpos=frame->anixoff;
pram_ptr->prpos.u.ypos=frame->aniyoff;
break;
case 1: /* H FLIPS */
pram_ptr->prpos.u.xpos=pram_ptr->prsize.u.xpos-frame->anixoff;
pram_ptr->prpos.u.ypos=frame->aniyoff;
break;
case 2: /* V FLIPS */
pram_ptr->prpos.u.xpos=frame->anixoff;
pram_ptr->prpos.u.ypos=pram_ptr->prsize.u.ypos-frame->aniyoff;
break;
case 3: /* HV FLIPS */
pram_ptr->prpos.u.xpos=pram_ptr->prsize.u.xpos-frame->anixoff;
pram_ptr->prpos.u.ypos=pram_ptr->prsize.u.ypos-frame->aniyoff;
break;
}
/* transfer image to correct page */
frame_info.w=pram_ptr->prsize.u.xpos;
frame_info.h=pram_ptr->prsize.u.ypos;
if ((obj->oflags & M_FIGHTER)==0)
{
/* vram manager call */
obj->header.t_width=frame_info.w;
obj->header.t_height=frame_info.h;
obj->ovcache=alloc_vram_mem((void *)pram_ptr->prsagptr,&(obj->header),obj->ovcache);
}
else
{
#if 1
/*************************************************
COMPRESSION CODE
*************************************************/
/* special case code for motaro, since he is so big we need to have him decomp
to a constant memory area. It so happens the soul floor data area is available, so
we will use it.
*/
if ( obj->ochar==FT_MOTARO && gstate!=GS_BUYIN)
{
temp=soflor_addr;
unbetterSimpleRLE(pram_ptr->prsagptr,&soflor_addr);
soflor_addr=temp;
pram_ptr->prsagptr=(ADDRESS)soflor_addr;
}
else
{
pram_ptr->prsagptr=(ADDRESS)uncompress_image((BYTE *)(pram_ptr->prsagptr));
}
/*************************************************
COMPRESSION CODE
*************************************************/
#endif
if (obj==p1_obj)
{
frame_info.x=PLYR_1_BASE_X;
frame_info.y=PLYR_1_BASE_Y;
}
else
{
frame_info.x=PLYR_2_BASE_X;
frame_info.y=PLYR_2_BASE_Y;
}
/* load image and setup header for fighters */
obj->header.tpage=LOADTPAGE((ADDRESS *)pram_ptr->prsagptr,TEXTURE_MODE,TRANS_RATE,frame_info.x,frame_info.y,(pram_ptr->prsize.u.xpos+3)&(~3),frame_info.h);
obj->header.t_xoffset=(frame_info.x%128)*2;
obj->header.t_yoffset=frame_info.y%256;
obj->header.t_width=frame_info.w;
obj->header.t_height=frame_info.h;
}
#if !MULTI_OFF
/* next part */
pram_ptr++; // move to next storage entry
framelist++; // move to next image entry
}
pram_ptr->prsagptr=(ADDRESS)0; // terminate list
#endif
return;
}
/******************************************************************************
Function: void do_first_a9_frame(void)
By: David Schwartz
Date: Aug 8, 1994
Parameters: None
Returns: None
Description: get frame # 1 and display first animation
******************************************************************************/
inline void do_first_a9_frame(short animnum)
{
get_char_ani(ANIM_TABLE1,animnum);
do_next_a9_frame(current_proc->pa8);
return;
}
/******************************************************************************
Function: WORD do_next_a9_frame(OBJECT *obj)
By: David Schwartz
Date: Aug 8, 1994
Parameters: current_proc->pa9 - animation table ptr
Returns: SYSTEM_CARRY_SET --> skip sleep flag
SYSTEM_CARRY_CLR --> don't skip sleep flag
SYSTEM_ZERO_SET --> end of animation reached!!
SYSTEM_ZERO_CLR --> not end of animation reached!!
Description: standard "advance to next frame" routine
ANIMATION COMMANDS MUST BE #'S THAT COULD NEVER BE OFFSETS INTO TABLES
AS LONG AS THE COMMANDS ARE LESS THEN 20, THINGS WILL BE OK. THIS IS THE
CASE BECAUSE THE FIRST 20 BYTES (AT LEAST) IS THE ANIMATION TABLE PTR LIST
******************************************************************************/
WORD do_next_a9_frame(OBJECT *obj)
{
LONG animframe;
short offset,offset1;
PROCESS *ptemp;
OBJECT *objslave;
animframe=GET_LONG(current_proc->pa9)++;
while (animframe != ANI_END)
{
switch (animframe)
{
case ANI_JUMP: // animation script "jump" command
(ADDRESS *)current_proc->pa9=(ADDRESS *)COMPUTE_ADDR(obj->oheap,GET_LONG(current_proc->pa9)); // get new animation ptr
break;
case ANI_FLIP: // animation script "flip" command
flip_multi(obj);
break;
case ANI_ADJUSTX: // animation script "adjust x" command
offset=(short)(GET_LONG(current_proc->pa9)++);
offset=offset*80/100;
multi_adjust_xy(obj,(short)offset,0);
break;
case ANI_ADJUSTXY: // animation script "adjust xy" command
offset=(short)GET_WORD(current_proc->pa9)++;
offset=offset*80/100;
offset1=(short)GET_WORD(current_proc->pa9)++;
offset1=offset1*85/100;
multi_adjust_xy(obj,offset,offset1);
break;
case ANI_NOSLEEP: // animation script "skip sleep" command
animframe=GET_LONG(current_proc->pa9)++; // grab frame which does not sleep
animate2(obj,(ADDRESS *)COMPUTE_ADDR(obj->oheap,animframe));
return(SYSTEM_CARRY_SET+SYSTEM_ZERO_CLR); // flag: dont sleep please, no end of anim
break;
case ANI_CALLA: // animation script call routine (next long)
animframe=GET_LONG(current_proc->pa9)++; // grab routine to call
if (animframe!=0)
calla_jumptbl[animframe]();
break;
case ANI_SOUND: // animation script make a sound call
animframe=GET_LONG(current_proc->pa9)++; // sound call to make
triple_sound(animframe);
break;
case ANI_OCHAR_JUMP: // animation script ochar conditional jump
animframe=GET_LONG(current_proc->pa9)++; // grab ochar to check for
if (animframe==obj->ochar)
(ADDRESS *)current_proc->pa9=(ADDRESS *)COMPUTE_ADDR(obj->oheap,GET_LONG(current_proc->pa9)); // get new animation ptr
else ((ADDRESS*)current_proc->pa9)++;
break;
case ANI_FLIP_V: // animation script vertical flip
flip_multi_v(obj);
break;
case ANI_OFFSET_XY: // animation script offset xy
/* xoffset */
offset=(short)(GET_WORD(current_proc->pa9)++);
offset=offset*80/100;
if (obj->oflags & M_FLIPH)
offset=-offset;
obj->oxpos.u.intpos=offset+(current_proc->pdata.p_otherguy)->oxpos.u.intpos;
offset=(short)(GET_WORD(current_proc->pa9)++);
offset=offset*85/100;
obj->oypos.u.intpos=offset+(current_proc->pdata.p_otherguy)->oypos.u.intpos;
break;
case ANI_SLADD: // animation script add slave
ptemp=gmo_proc((current_proc->pa8)->oheap); // get process which holds data
objslave=(OBJECT *)current_proc->a10=current_proc->pa8; // a10 = object
(current_proc->pa8)->oslink=ptemp; // oslink = process
current_proc->pa8=obj;
animframe=GET_LONG(current_proc->pa9)++; // grab image to make slave from
objslave->ochar=obj->ochar; // same ochar as thrower
current_proc->pdata.p_slave=(OBJECT *)current_proc->a10; // projectiles are slave objects
objslave->ozval=FRONT_Z+1;
match_ani_points(obj,objslave); // lineup proj with thrower
insert_object(objslave,&objlst);
break;
case ANI_SLANI: // animation script slave animate
current_proc->a10=(ADDRESS)current_proc->pdata.p_slave;
match_ani_points(obj,(OBJECT *)current_proc->a10); // always lineup slave
do_next_a9_frame((OBJECT *)current_proc->a10); // animate slave and then return
current_proc->pa8=obj;
break;
case ANI_SLANI_SLEEP: // animation script slave animate
current_proc->a10=(ADDRESS)current_proc->pdata.p_slave;
match_ani_points(obj,(OBJECT *)current_proc->a10); // always lineup slave
do_next_a9_frame((OBJECT *)current_proc->a10); // animate slave and then return
current_proc->pa8=obj;
return(SYSTEM_CARRY_CLR+SYSTEM_ZERO_CLR); // clear zero as well as carry and sleep
break;
case ANI_SWPAL: // animation script switch to next img pal
animframe=GET_LONG(current_proc->pa9); // grab img which has pal
animframe=(LONG)((ADDRESS*)COMPUTE_ADDR(obj->oheap,animframe));
animframe=GET_LONG(animframe);
animframe=(LONG)((OIMGTBL*)COMPUTE_ADDR(obj->oheap,animframe)+1);
player_swpal(current_proc,(void *)(GET_LONG(animframe)),obj);
break;
case ANI_OCHAR_SOUND:
animframe=GET_LONG(current_proc->pa9)++; // grab img which has pal
ochar_sound_stop(animframe);
ochar_sound(animframe);
break;
default:
animate2(obj,(ADDRESS *)COMPUTE_ADDR(obj->oheap,animframe));
return(SYSTEM_CARRY_CLR+SYSTEM_ZERO_CLR);
}
animframe=GET_LONG(current_proc->pa9)++; // get next frame
}
return(SYSTEM_CARRY_CLR+SYSTEM_ZERO_SET);
}
/******************************************************************************
Function: void animate_a9(WORD anispeed,WORD animnum)
By: David Schwartz
Date: Nov 1994
Parameters: anisleed - time between animation updates
animnum - anim offset to run through (ANIM_TABLE1)
Returns: None
Description: animate throught a given sequence
******************************************************************************/
void animate_a9(WORD anispeed,WORD animnum)
{
get_char_ani(ANIM_TABLE1,animnum);
mframew(anispeed);
return;
}
/******************************************************************************
Function: void animate2_a9(WORD anispeed,WORD animnum)
By: David Schwartz
Date: Nov 1994
Parameters: anispeed - time between animation updates (a0[32..16])
animnum - anim offset to run through (ANIM_TABLE2) (a0[15..0])
Returns: None
Description: animate throught a given sequence
******************************************************************************/
void animate2_a9(WORD anispeed,WORD animnum)
{
get_char_ani(ANIM_TABLE2,animnum);
mframew(anispeed);
return;
}
/******************************************************************************
Function: void pose_a9(WORD offset,WORD animnum)
By: David Schwartz
Date: Nov 1994
Parameters: offset - offset frame to pose on (a0[32..16])
animnum - anim offset to run through (ANIM_TABLE1) (a0[15..0])
Returns: None
Description: animate throught a given sequence
******************************************************************************/
void pose_a9(WORD offset,WORD animnum)
{
get_char_ani(ANIM_TABLE1,animnum);
((ADDRESS *)current_proc->pa9)+=offset;
do_next_a9_frame(current_proc->pa8);
return;
}
/******************************************************************************
Function: void pose_him_a9(WORD offset,WORD animnum)
By: David Schwartz
Date: Mar 1995
Parameters: offset - offset frame to pose on (a0[32..16])
animnum - anim offset to run through (ANIM_TABLE1) (a0[15..0])
Returns: None
Description: animate him throught a given sequence
******************************************************************************/
void pose_him_a9(WORD offset,WORD animnum)
{
PROCESS *ta13;
ta13=current_proc;
current_proc=current_proc->pdata.p_otherproc;
pose_a9(offset,animnum);
current_proc=ta13;
return;
}
/******************************************************************************
Function: void pose2_a9(WORD offset,WORD animnum)
By: David Schwartz
Date: Nov 1994
Parameters: offset - offset frame to pose on
animnum - anim offset to run through (ANIM_TABLE2)
Returns: None
Description: animate throught a given sequence
******************************************************************************/
void pose2_a9(WORD offset,WORD animnum)
{
get_char_ani(ANIM_TABLE2,animnum);
((ADDRESS *)current_proc->pa9)+=offset;
do_next_a9_frame(current_proc->pa8);
return;
}
/******************************************************************************
Function: void pose_him(WORD animnum)
By: David Schwartz
Date: Nov 1994
Parameters: animnum - anim offset to run through (ANIM_TABLE1)
Returns: None
Description: pose the other fighter
******************************************************************************/
void pose_him_a0(WORD animnum)
{
PROCESS *ptemp;
ptemp=current_proc; // pretend I am him
current_proc=current_proc->pdata.p_otherproc;
if ((short)animnum>=0) // neg, we already got an frame
get_char_ani(ANIM_TABLE1,animnum); // pass other proc new anim ptr
do_next_a9_frame(current_proc->pa8);
current_proc=ptemp;
return;
}
/******************************************************************************
Function: void mframew(WORD sleeptime)
By: David Schwartz
Date: Sept 1994
Parameters: sleep time between frames
current_proc->pa9 - table of animations
current_proc->pa8 - 1st object on list
Returns: None
Description: animate through a list of multipart frames
******************************************************************************/
void mframew(WORD sleeptime)
{
OBJECT *obj=current_proc->pa8;
WORD carry;
while (((carry=do_next_a9_frame(obj)) & SYSTEM_ZERO_MASK) != SYSTEM_ZERO_SET)
{
if ((carry & SYSTEM_CARRY_MASK) == SYSTEM_CARRY_CLR)
process_sleep(sleeptime);
}
}
/******************************************************************************
Function: void double_mframew(WORD sleeptime)
By: David Schwartz
Date: Sept 1994
Parameters: sleep time between frames
current_proc->pa9 - obj #1 anim ptr
current_proc->pa8 - obj #1
current_proc->a11 - obj #2 animptr
current_proc->a10 - obj #2
Returns: None
Description: animate through a list of multipart frames for two objects
******************************************************************************/
void double_mframew(WORD sleeptime)
{
while ((double_next_a9() & SYSTEM_ZERO_MASK) != SYSTEM_ZERO_SET)
process_sleep(sleeptime);
}
/******************************************************************************
Function: void mframew_him(WORD sleeptime)
By: David Schwartz
Date: Nov 1994
Parameters: sleep time between frames
current_proc->a11 = animptr
Returns: None
Description: animate through a list of multipart frames for the other guy
******************************************************************************/
void mframew_him(WORD sleeptime)
{
ADDRESS animtemp;
OBJECT *obj=current_proc->pa8;
animtemp=(ADDRESS)current_proc->pa9;
(ADDRESS)current_proc->pa9=current_proc->a11;
current_proc->pa8=current_proc->pdata.p_otherguy;
mframew(sleeptime);
current_proc->pa8=obj;
current_proc->a11=(ADDRESS)current_proc->pa9;
(ADDRESS)current_proc->pa9=animtemp;
return;
}
/******************************************************************************
Function: void ground_multi(OBJECT *obj)
By: David Schwartz
Date: Jan 1995
Parameters: obj - 1st object on list
Returns: None
Description: plant a dudes feet on da ground
******************************************************************************/
void ground_multi(OBJECT *obj)
{
long pos;
pos=ground_y-lowest_mpart(obj); // lowest multipart obj
obj->oypos.u.intpos+=pos; // adjust each object
return;
}
/******************************************************************************
Function: void multi_adjust_xy(OBJECT *obj,short xadj,short yadj)
By: David Schwartz
Date: Nov 1994
Parameters: obj - dude to adjust
xadj - amount to adjust him in x
xadj - amount to adjust him in x
Returns: None
Description: adjust the dudes animation pt
******************************************************************************/
void multi_adjust_xy(OBJECT *obj,short xadj,short yadj)
{
if (obj->oflags & M_FLIPH)
obj->oxpos.u.intpos-=xadj;
else obj->oxpos.u.intpos+=xadj;
obj->oypos.u.intpos+=yadj;
return;
}
/******************************************************************************
Function: void match_ani_points(OBJECT *pa8,OBJECT *pa0)
By: David Schwartz
Date: Nov 1994
Parameters: pa8 - object ot match with (a8)
pa0 - object with changes (a0)
Returns: None
Description - set a multipart object's animation x to match
another object's ani x,y
******************************************************************************/
void match_ani_points(OBJECT *pa8,OBJECT *pa0)
{
OIMGTBL *iptr;
pa0->oxpos.pos=pa8->oxpos.pos;
pa0->oypos.pos=pa8->oypos.pos;
if (pa0->oflags2 & M_MULTIPART)
{
/* multipart */
if ((pa8->oflags & M_FLIPH)!=(pa0->oflags & M_FLIPH))
flip_multi(pa0);
}
else
{
/* match_single */
if ((pa8->oflags & M_FLIPH) != (pa0->oflags & M_FLIPH)) // same direction ?
pa0->oflags^=M_FLIPH; // reverse flip bit
/* maps1 */
iptr=(OIMGTBL *)pa0->oimg;
if (pa0->oflags & M_FLIPH)
pa0->oxpos.u.intpos-=(iptr->size.u.xpos-(-iptr->anixoff));
else pa0->oxpos.u.intpos-=iptr->anixoff;
if (pa0->oflags & M_FLIPV)
pa0->oypos.u.intpos-=iptr->aniyoff;
else pa0->oypos.u.intpos+=iptr->aniyoff;
}
return;
}
/******************************************************************************
Function: int highest_mpart(OBJECT *obj)
By: David Schwartz
Date: Sept 1994
Parameters: obj - object to find highest point
Returns: coordinate of highest point (lowest value)
Description: finds the object on a multipart object thats highest off the ground (lowest value)
******************************************************************************/
int highest_mpart(OBJECT *obj)
{
int highest=0x7fff;
P_RAM *pramptr;
short ypos;
pramptr=(P_RAM *)obj->oimg;
ypos=obj->oypos.u.intpos;
#if !MULTI_OFF
while (pramptr->prsagptr != 0)
{
#endif
if ((ypos-pramptr->prpos.u.ypos)<highest)
highest=ypos-pramptr->prpos.u.ypos;
#if !MULTI_OFF
pramptr++;
}
#endif
return(highest);
}
/******************************************************************************
Function: int lowest_mpart(OBJECT *obj)
By: David Schwartz
Date: Sept 1994
Parameters: obj - object to find lowest point
Returns: coordinate of lowest point (highest value)
Description: finds the object on a multipart object thats lowest off the ground (highest value)
******************************************************************************/
int lowest_mpart(OBJECT *obj)
{
int lowest=0;
P_RAM *pramptr;
short ypos;
pramptr=(P_RAM *)obj->oimg;
ypos=obj->oypos.u.intpos;
#if !MULTI_OFF
while (pramptr->prsagptr != 0)
{
#endif
if ((ypos-pramptr->prpos.u.ypos+pramptr->prsize.u.ypos)>lowest)
lowest=ypos-pramptr->prpos.u.ypos+pramptr->prsize.u.ypos;
#if !MULTI_OFF
pramptr++;
}
#endif
return(lowest);
}
/******************************************************************************
Function: int leftmost_mpart(OBJECT *obj)
By: David Schwartz
Date: Sept 1994
Parameters: obj - object to find left pt
Returns: leftmost coordinate
Description: finds the object on a multipart object thats the leftmost (smallest value)