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

230 lines
4.9 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : walker.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
#define ANM_walker_F_walk 0
#define ANM_walker_walk 1
/*################*/
#ifdef ASSEMBLER
/*################*/
e_walker:
p_initialize(enemyA)
p_setbit(flag,stf_moveON | stf_YangleSAME | stf_playerdistON )
p_set_pointer(skelanime,walker_anime)
p_set_skelanime_number(0)
p_setmovedata(80,-400,-50,0,0,200,0,0)
p_save_nowpos
p_program(s_areastage_init)
p_while
p_program(s_walker)
p_loop
e_wakidashi_kumo:
p_initialize(control)
p_setbit(flag,stf_moveON | stf_playerdistON )
p_while
p_program(s_wakidashi_kumo)
p_loop
/*################*/
#else
/*################*/
#define kumo_wakidashi_coin (execstp->s[stw_work0].d)
#define kumo_pros (execstp->s[stw_work1].d)
#define kumo_timer (execstp->s[stw_work2].d)
/********************************************************************************
C Program (walker)
********************************************************************************/
extern int s_check_gakewall(long *angle)
{
if ( obj_movestatus & MOVESTAT_WALL ){
*angle = obj_wallangleY;
return(1); /* set wallangle */
} else if ( obj_movestatus & MOVESTAT_GAKE ){
*angle = obj_angleY+0x8000; /* set gakeangle */
return(-1);
}
return(0);
}
static HitCheckRecord walker_hit = {
OBJNAME_KURIBO,
0,1,1,3, /* flag,ap,hp,coin */
130,70, /* player attack hitarea */
90,60, /* player damage hitarea */
};
extern void s_walker(void)
{
int flag;
float speed;
s_enemybgcheck();
if ( obj_process != 0 && s_hit_remove_enemy(&walker_hit,NA_SE3_MOGURA_HIT,kumo_wakidashi_coin) ) obj_process = 3;
if ( obj_process != 1 ){ kumo_pros = 0; }
switch(obj_process){
case 0:
if ( obj_movestatus & MOVESTAT_BGBOUND ) objsound(NA_SE3_BOUND_S);
if ( obj_movestatus & ( MOVESTAT_BGBOUND + MOVESTAT_BGTOUCH ) ){
obj_attX = obj_worldX;
obj_attY = obj_worldY;
obj_attZ = obj_worldZ;
obj_process++;
}
break;
case 1:
obj_speedF = 5;
if ( s_calc_playerscope() > 1000 ) obj_targetangle = s_calc_returnangle();
else {
if ( kumo_pros == 0 ){
kumo_timer = 0;
obj_targetangle = s_calc_targetangle(execstp,player1stp);
if ( s_calc_dangle(obj_targetangle,obj_angleY) < 0x800 ){
kumo_pros = 1;
obj_speedY = 20;
objsound(NA_SE3_KUMO_JUMP);
}
} else if ( kumo_pros == 1 ){
obj_speedF = 15;
kumo_timer++;
if ( kumo_timer > 50 ) kumo_pros = 0;
}
}
if ( s_check_gakewall( &obj_targetangle ) ) obj_process = 2;
s_chase_angleY(obj_targetangle,0x200 );
break;
case 2:
obj_speedF = 5;
if ( (short)obj_angleY == (short)obj_targetangle ) obj_process = 1;
if ( obj_worldY - obj_attY < -200 ){
s_remove_obj(execstp);
}
s_chase_angleY(obj_targetangle,0x400);
break;
case 3:
Mbitclr(obj_mainflag,stf_YangleSAME);
obj_speedF = -10;
obj_speedY = 30;
objsound(NA_SE3_KUMO_JUMP);
obj_process++;
break;
case 4:
obj_speedF = -10;
if ( obj_movestatus & MOVESTAT_BGBOUND ){
obj_process++;
obj_speedY = 0;
kumo_timer = 0;
Mbitset(obj_mainflag,stf_YangleSAME);
obj_mail = 0;
}
break;
case 5:
obj_speedF = 2;
kumo_timer++;
if ( kumo_timer > 30 ) obj_process = 0;
break;
}
if ( obj_speedF < 10 ) speed = 1.0;
else speed = 3.0;
s_set_skelanime_speed(0 ,speed);
if ( obj_movestatus & MOVESTAT_GROUND ) s_anime_sound(1,23,NA_SE3_KUMO_WALK);
if ( execstp->motherobj != execstp ){
if ( s_check_shapehide(execstp) ) s_remove_obj(execstp);
if ( execstp->status == 0 ) execstp->motherobj->s[stw_imm].d = 1;
}
s_enemymove(-50);
}
/********************************************************************************
C Program (walker)
********************************************************************************/
extern void s_wakidashi_kumo(void)
{
StrategyRecord *stp;
if (obj_mode == 0 ){
if ( obj_timer > 30 && 500 < obj_playerdist && obj_playerdist < 1500 ){
objsound(NA_SE3_KUMO_JUMP);
stp = s_makeobj_nowpos(execstp,S_kumo,e_walker);
stp->s[stw_work0].d = obj_work0;
stp->s[stw_speedF].f = 30;
stp->s[stw_speedY].f = 80;
obj_mode++;
obj_work0 = 1;
}
} else {
if ( obj_imm != 0 ){
obj_imm = 0;
obj_mode = 0;
}
}
/*
if ( cont1p->trigger & CONT_R )
{
stp = s_makeobj_nowpos(execstp,S_kumo,e_walker);
stp->s[stw_speedF].f = 20;
stp->s[stw_speedY].f = 80;
}
*/
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/