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

319 lines
7.0 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathpakun.s
Description :
Date : 1995.10.30
Author : H.yajima
********************************************************************************/
#define PAKUN_NEARDIST 400
/***************************************************************/
/* ANIMATION HEADER DEFINE pakun */
/***************************************************************/
#define ANM_pakun_angry 0
#define ANM_pakun_damage 1
#define ANM_pakun_down 2
#define ANM_pakun_eat_base 3
#define ANM_pakun_eating 4
#define ANM_pakun_miss_eating 5
#define ANM_pakun_sleep_start 6
#define ANM_pakun_sleep_tmp 7
#define ANM_pakun_sleeping 8
#define ANM_pakun_wait 9
#define ANM_pakun_end 10
/*=============================================================*/
/* END END */
/*=============================================================*/
/*################*/
#ifdef ASSEMBLER
/*################*/
e_pakun:
p_initialize(enemyA)
p_setbit(flag,stf_moveON | stf_YangleSAME | stf_playerdistON | stf_playerangleON )
p_set_pointer(skelanime,pakun_anime)
p_set_skelanime_number(0)
p_setobjname(DAMAGE)
p_sethitbox(100,200)
p_setdamagebox(50,200)
p_hitON
p_setd(ap,3)
p_setd(havecoin,5)
p_makeshape(S_bubble,e_hanapoo)
p_setf(shapeLOD,2000)
p_save_nowpos
p_while
p_program(s_pakun)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
C Program
********************************************************************************/
#define pakun_scale (execstp->s[stw_work1].f)
#define pakun_sound (execstp->s[stw_work0].d)
/*-------------------------------------------------------------------------------
pakun init
-------------------------------------------------------------------------------*/
static void pakun_init(void)
{
s_hitOFF();
s_set_skelanimeNo(ANM_pakun_sleeping);
s_set_scale(1.0);
if ( obj_playerdist < 1200 ) obj_mode = mode_pakun_sleep;
}
/*-------------------------------------------------------------------------------
pakun sleep
-------------------------------------------------------------------------------*/
static int pakun_attackcheck(void)
{
int i;
int flag = 1;
if ( (obj_mail & EMAIL_PLAYERHIT) != 0 ){
Na_PukkunBgmEnd();
if ( obj_mail & EMAIL_PLAYERATTACK ){
objsound(NA_SE3_FLOWERDOWN);
for(i=0;i<20;i++){
s_makeobj_nowpos(execstp,S_syabon,e_balloon_gomi);
}
obj_mode = mode_pakun_down;
} else {
obj_mode = mode_pakun_sleepOFF;
}
Mbitclr(obj_mail,EMAIL_PLAYERHITALL);
} else {
flag = 0;
}
return(flag);
}
static void pakun_sleep(void)
{
s_hitON();
s_set_objname(PUNCHATTACK);
s_set_skelanimeNo(ANM_pakun_sleeping);
s_sethitbox(250,200);
s_setdamagebox(150,100);
obj_ap = 0;
if ( obj_playerdist < PAKUN_NEARDIST ){
if ( s_player_speedcheck() ) obj_mode = mode_pakun_sleepOFF;
} else if ( obj_playerdist < 1000 ){
Na_PukkunBgmStart();
pakun_sound = 0;
} else if ( pakun_sound == 0){
pakun_sound++;
Na_PukkunBgmEnd();
}
pakun_attackcheck();
}
static void pakun_sleepOFF(void)
{
obj_ap = 3;
if ( obj_timer == 0 ) Na_PukkunBgmEnd();
if ( pakun_attackcheck() == 0 ){
if ( obj_timer > 10 ) obj_mode = mode_pakun_angry;
}
}
/*--------------------------------
pakun down start
---------------------------------*/
static void check_pakun_erase(void)
{
if ( execstp->status & OBJECT_ERASE ) obj_mode = mode_pakun_init;
}
static void pakun_down(void)
{
s_hitOFF();
s_set_skelanimeNo(ANM_pakun_down);
Mbitclr(obj_mail,EMAIL_PLAYERHITALL);
if ( s_check_animeend() ) obj_mode = mode_pakun_down_end;
check_pakun_erase();
}
/*--------------------------------
pakun down small down
--------------------------------*/
static void pakun_down_end(void)
{
if ( obj_timer == 0 ){
objsound(NA_SE3_DOWN_TO_SMALL);
pakun_scale = 1.0;
}
if ( pakun_scale > 0 ){
pakun_scale -= 0.04;
} else {
pakun_scale = 0;
// s_kemuri();
s_make_bluecoin();
obj_mode = mode_pakun_down_wait;
}
s_set_scale(pakun_scale);
check_pakun_erase();
}
/*--------------------------------
pakun down wait
---------------------------------*/
static void pakun_down_wait(void)
{
if ( obj_playerdist > 1200 ) obj_mode = mode_pakun_down_zoom;
}
/*--------------------------------
pakun down zoom
---------------------------------*/
static void pakun_down_zoom(void)
{
s_set_skelanimeNo(ANM_pakun_sleeping);
if ( obj_timer == 0 ) pakun_scale = 0.3;
if ( pakun_scale < 1.0 ) pakun_scale += 0.02;
else {
pakun_scale = 1.0;
obj_mode = mode_pakun_init;
}
s_set_scale(pakun_scale);
}
/*-------------------------------------------------------------------------------
pakun attack
-------------------------------------------------------------------------------*/
char pakunsound[] = { 12,28,50,64,-1 };
static void pakun_angry(void)
{
int anime_frame = execstp->map.skelanim.frame;
s_hitON();
s_set_objname(DAMAGE);
s_set_skelanimeNo(ANM_pakun_angry);
s_sethitbox(150,100);
s_setdamagebox(150,100);
if ( s_check_chartable(anime_frame,pakunsound) ) objsound(NA_SE3_FLOWERVOICE);
obj_angleY = s_chase_angle(obj_angleY,obj_targetangle,0x400);
if ( obj_playerdist > PAKUN_NEARDIST+100 && s_check_animeend() ) obj_mode = mode_pakun_wait;
// if ( (obj_mail & EMAIL_PLAYERATTACK ) && ( PL_IsMetalMario(marioWorks) != 0) ) obj_mode = mode_pakun_down;
if ( (obj_mail & EMAIL_PLAYERHIT ) && (PL_IsMetalMario(marioWorks) != 0) ) obj_mode = mode_pakun_down;
}
/*-------------------------------------------------------------------------------
pakun attack
-------------------------------------------------------------------------------*/
extern int s_player_speedcheck(void)
{
if ( playerWorks[0].speed[1] > 10 ) return(1);
if ( playerWorks[0].velocity > 10 ) return(1);
return(0);
}
static void pakun_wait(void)
{
s_hitOFF();
s_set_skelanimeNo(ANM_pakun_sleep_start);
if ( s_check_animeend() ) obj_mode = mode_pakun_sleep;
if ( obj_playerdist < PAKUN_NEARDIST && s_player_speedcheck() ) obj_mode = mode_pakun_angry;
}
/********************************************************************************
pakun program main
********************************************************************************/
static void *pakun_modejmp[] = {
pakun_init,
pakun_sleep,
pakun_angry,
pakun_sleepOFF,
pakun_wait,
pakun_down,
pakun_down_end,
pakun_down_wait,
pakun_down_zoom
};
extern void s_pakun(void)
{
s_modejmp(pakun_modejmp);
if ( activeStageNo == 24 ){
if ( player_worldY > 3400 ) s_shape_hide();
else s_shape_disp();
}
obj_mail = 0;
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/