sm64/data/p/pathloopfish.p
2022-12-04 22:27:02 -05:00

138 lines
3.2 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathloopfish.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
e_loopfish_obj:
p_initialize(option)
p_setbit(flag,stf_moveON | stf_YangleSAME )
p_save_nowpos
p_set_pointer(skelanime,RCP_fishAnime)
p_set_skelanime_number(0)
p_while
p_program(s_loopfish_obj)
p_loop
e_loopfish:
p_initialize(option)
p_setbit(flag,stf_moveON )
p_save_nowpos
p_while
p_program(s_loopfish)
p_loop
/*################*/
#else
/*################*/
#define loopfish_randomspeed (execstp->s[stw_work0].f)
#define loopfish_randomtimer (execstp->s[stw_work1].d)
#define loopfish_angle (execstp->s[stw_work2].d)
#define loopfish_Yadd (execstp->s[stw_work3].f)
/********************************************************************************
C Program (loopfish)
********************************************************************************/
extern void s_loopfish_obj(void)
{
float rand;
switch(obj_mode){
case 0:
s_set_skelanime_speed(0,1.0);
if (obj_timer == 0 ){
loopfish_Yadd = RandomSign()*0x800;
loopfish_randomspeed = Randomf()*2;
loopfish_randomtimer = (int)(30*Randomf()) & 0xfe;
rand = Randomf()*5;
if ( rand < 2 ) obj_anglespeedX = s_random_f((float)128);
else obj_anglespeedX = 0;
}
obj_speedF = 3+loopfish_randomspeed;
if (obj_timer >= 60+loopfish_randomtimer ) obj_mode++;
if (obj_timer < (60+loopfish_randomtimer)/2 ) obj_animeangleX += obj_anglespeedX;
else obj_animeangleX -= obj_anglespeedX;
obj_speedY = -sin(obj_animeangleX)*obj_speedF;
break;
case 1:
s_set_skelanime_speed(0,2.0);
obj_angleY += loopfish_Yadd; /* turn (1) */
if (obj_timer == 15 ) obj_mode++;
break;
case 2:
s_set_skelanime_speed(0,1.0);
if (obj_timer >= 60+loopfish_randomtimer ) obj_mode++;
if (obj_timer < (60+loopfish_randomtimer)/2 ) obj_animeangleX -= obj_anglespeedX;
else obj_animeangleX += obj_anglespeedX;
break;
case 3:
s_set_skelanime_speed(0,2.0);
obj_angleY += loopfish_Yadd; /* turn (2) */
if (obj_timer == 15 ) obj_mode=0;
break;
}
obj_speedY = -sin(obj_animeangleX)*obj_speedF;
s_optionmove_F();
if ( execstp->motherobj->s[stw_mode].d == 2 ) s_remove_obj(execstp);
}
extern void s_loopfish(void)
{
StrategyRecord *stp;
int i;
switch(obj_mode){
case 0:
if ( map_areacode == 15 || map_areacode == 7 ){
for(i=0;i<15;i++){
stp = s_makeobj_chain(0,300,0,-200,execstp,S_fish,e_loopfish_obj);
s_random_XYZ_offset(stp,200);
}
obj_mode++;
}
break;
case 1:
if ( map_areacode != 15 && map_areacode != 7 ) obj_mode++;
break;
case 2:
obj_mode = 0;
break;
}
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/