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

290 lines
6.5 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Broth_wiers
-------------------------
File : pathwind.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
e_wind_effect:
p_initialize(effect)
p_setbit(flag,stf_moveON )
p_softspritemodeON
p_while
p_program(s_wind_object)
p_loop
e_wind_object:
p_initialize(player_friend)
p_setbit(flag,stf_moveON )
p_softspritemodeON
p_while
p_program(s_wind_object)
p_loop
e_wind:
p_initialize(option)
p_setbit(flag,stf_moveON | stf_playerdistON | stf_playerangleON )
p_save_nowpos
p_while
p_program(s_wind)
p_loop
e_wind_ping:
p_initialize(moveBG)
p_setbit(flag,stf_moveON | stf_YangleSAME | stf_playerdistON | stf_playerangleON )
p_setshapeinfo(ping_info)
p_set_pointer(skelanime,ping_anime)
p_set_skelanime_number(0)
p_setmovedata(0,-400,-50,0,0,200,0,0)
p_set_scale(600)
p_save_nowpos
p_while
p_program(s_wind_ping)
p_program(stMainMoveBG)
p_loop
/*################*/
#else
/*################*/
#define windping_dx(p) (p->s[stw_work3].f) /* dx */
#define windping_dz(p) (p->s[stw_work4].f) /* dz */
#define windping_pointer(p) (p->s[stw_work6].d)
#define windping_timer(p) (p->s[stw_work7].d)
/********************************************************************************
C Program (wind hitcheck program)
********************************************************************************/
#define wind_pointer (execstp->s[stw_work0].pointer)
static HitCheckRecord wind_hit = {
OBJNAME_WIND,
0,0,0,0, /* flag,ap,hp,coin */
20,70, /* player attack hitarea */
20,70, /* player damage hitarea */
};
extern void s_wind_object(void)
{
StrategyRecord *stp;
float dist;
float dx,dz,dr;
s_set_hitparam(execstp,&wind_hit);
if ( obj_timer == 0 ){
wind_pointer = (void *)s_find_obj(e_wind_ping);
s_random_XYZ_offset(execstp,100);
obj_speedF = 100*cos(obj_angleX);
obj_speedY = -100*sin(obj_angleX);
obj_angleY += s_random_f(obj_programselect * 500);
obj_alpha = 100;
}
s_optionmove_F();
if(obj_timer > 15 ) s_remove_obj(execstp);
stp = (StrategyRecord *)wind_pointer;
if ( stp != NULL ){
dx = windping_dx(stp) - obj_worldX;
dz = windping_dz(stp) - obj_worldZ;
dist = sqrtf(dx*dx+dz*dz);
if ( dist < 300 ){
s_remove_obj(execstp);
s_hitOFF();
}
}
#if 0
if ( WallCheck(&obj_worldX,&obj_worldY,&obj_worldZ,50,200) ) s_remove_obj(execstp);
#endif
}
/********************************************************************************
C Program (wind control program)
********************************************************************************/
extern void s_make_wind(int ysize,float scale,float x,float y,float z)
{
if ( frameCounter & 1 ){
s_makeobj_chain_scale(ysize,x,y,z,0.5, execstp,S_snowdust, e_wind_effect);
s_makeobj_chain_scale(ysize,x,y,z,scale,execstp,S_NULL,e_wind_object);
} else {
s_makeobj_chain_scale(ysize,x,y,z,scale,execstp,S_hiteffect,e_wind_object);
}
s_makeobj_chain_scale(ysize,x,y,z,scale,execstp,S_NULL,e_wind_object);
}
extern void s_wind(void)
{
int flag = 0;
short angle;
float wpos[3];
if ( obj_timer == 0 ) obj_work0 = obj_angleY;
if ( obj_process == 0 ){
obj_playerdist = 0;
s_copy_f(wpos,&obj_worldX);
s_set_world(execstp,1100,3328,1164);
if ( s_hitcheck_message_entry(1000,30,0x7fff )) obj_process++;
s_copy_f(&obj_worldX,wpos);
} else if ( obj_process == 1 ){
if ( s_call_enemydemo(DLOG_LOOKUP,ENEMYDEMO_SETMESSAGE,153,0) ) obj_process++;
} else {
if ( obj_playerdist < 1500 && s_abs_f(player_worldY - obj_attY ) < 500 ){
if ( ((short)(angle = obj_targetangle - obj_work0)) > 0 ){
if ( angle < 0x1500 ) obj_angleY = obj_targetangle;
else obj_angleY = obj_work0 + (0x1500);
} else {
if ( angle > -(0x1500) ) obj_angleY = obj_targetangle;
else obj_angleY = obj_work0 - (0x1500);
}
s_make_wind(12,3,0,0,0);
objsound_level(NA_LSE3_SNOWMAN_BREATH);
}
}
}
static int wind_ping_return(void)
{
obj_speedF = 0;
s_set_skelanime_speed(0,1.0);
obj_anglespeedY = 0x400;
obj_angleY += obj_anglespeedY;
if ( obj_timer == 31 ) return(1);
else return(0);
}
typedef struct {
int time;
int animeNo;
float speed;
float anime;
} WindPingRecord;
static WindPingRecord wind_ping_data[] =
{
{ 60, 0, 6, 1.0 },
{ 30, 3, 0, 1.0 },
{ 30, 0, 12, 2.0 },
{ 30, 3, 0, 1.0 },
{ 30, 0, -6, 1.0 },
{ 30, 3, 0, 1.0 },
{ -1, 0, 0, 0 },
};
extern void s_wind_ping(void)
{
float dx,dz;
float dr = 100;
obj_anglespeedY = 0;
s_enemybgcheck();
switch(obj_mode){
case 0:
if ( obj_timer == 0 ){
windping_pointer(execstp) = 0;
windping_timer(execstp) = 0;
}
if ( windping_timer(execstp) < wind_ping_data[windping_pointer(execstp)].time ){
windping_timer(execstp)++;
} else {
windping_timer(execstp) = 0;
windping_pointer(execstp)++;
if ( wind_ping_data[windping_pointer(execstp)].time < 0 ){
windping_pointer(execstp) = 0;
}
}
if ( obj_worldX < 300 ) obj_mode++;
else {
obj_speedF = wind_ping_data[windping_pointer(execstp)].speed ;
s_set_skelanime_speed( wind_ping_data[windping_pointer(execstp)].animeNo,
wind_ping_data[windping_pointer(execstp)].anime );
}
break;
case 1:
if ( wind_ping_return() ) obj_mode++;
break;
case 2:
obj_speedF = 12;
s_set_skelanime_speed(0,2.0);
if ( obj_worldX > 1700 ) obj_mode++;
break;
case 3:
if ( wind_ping_return() ) obj_mode = 0;
break;
}
s_enemymove(-78);
if ( s_erase_height(1000) == 0 ) sound_pingwalk(1);
/*================================== ping hitcheck program ==========================*/
dx = obj_worldX + 60 * sin( -0x2444 );
dz = obj_worldZ + 60 * cos( -0x2444 );
dx += dr * sin( -0x2444 + 0x4000 );
dz += dr * cos( -0x2444 + 0x4000 );
windping_dx(execstp) = dx;
windping_dz(execstp) = dz;
// dbErrPrint("x %d",(int)dx);
// dbErrPrint("z %d",(int)dz);
// dbErrPrint("r %d",(int)dr);
/*===================================================================================*/
dbErrPrint("x %d",(int)obj_worldX);
dbErrPrint("z %d",(int)obj_worldZ);
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/