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

244 lines
5.7 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathclearstar.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
/********************************************************************************
enemy making star
********************************************************************************/
e_enemystar2:
p_initialize(item)
p_setbit(flag,stf_moveON )
p_setd(programselect,1)
p_jmp(enemystar_common)
e_enemystar:
p_initialize(item)
p_setbit(flag,stf_moveON )
enemystar_common:
p_save_nowpos
p_program(check_star_backup)
p_while
p_program(s_enemystar)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
================================
Enemy Star Backup Table
================================
Used << work9 >> initialize position
********************************************************************************/
extern void check_star_backup(void)
{
int acode;
if ( ( obj_enemyinfo & ENEMYINFO_EXTSTAR ) == 0 ){
execstp->s[stw_actorcode].d = execstp->motherobj->s[stw_actorcode].d;
}
acode = (( execstp->s[stw_actorcode].d )>>24 )&0xff;
if ( s_index_bit(acode) & BuGetStarFlag(activePlayerNo-1,activeCourseNo-1) ){
s_change_shape(S_shadestar);
}
objsound(NA_SE2_STAR_APPEAR);
#ifdef yajima
rmonpf(("star %d\n",acode));
#endif
}
/********************************************************************************
===============
Star HitCheck
===============
********************************************************************************/
static HitCheckRecord tripstar_hit = {
OBJNAME_TRIPSTAR,
0,0,0,0, /* flag,ap,hp,coin */
80,50, /* player attack hitarea */
0, 0, /* player damage hitarea */
};
/********************************************************************************
STAR HITCHECK PROGRAM
********************************************************************************/
static void hitcheck_star(void)
{
s_set_hitparam(execstp,&tripstar_hit); /* Set HitCheck Param */
if ( obj_mail & EMAIL_PLAYERHIT ){
RemoveShape(execstp);
Mbitclr(obj_mail,EMAIL_PLAYERHITALL);
}
}
/*-------------------------------------------------------------------------------
check player postion
------------------------------------------------------------------------------*/
static void check_playerpos(void)
{
float dx,dz;
obj_attX = player_worldX;
obj_attZ = player_worldZ;
obj_attY = player_worldY;
obj_attY += 250;
obj_worldY = obj_attY;
dx = obj_attX - obj_worldX;
dz = obj_attZ - obj_worldZ;
obj_speedF = (sqrtf(dx*dx+dz*dz))/23;
}
/*-------------------------------------------------------------------------------
check now postion
------------------------------------------------------------------------------*/
static void check_nowpos(void)
{
obj_speedF = 0;
obj_attY = obj_worldY;
}
/********************************************************************************
Enemystar Library
********************************************************************************/
static void star_rotation(void)
{
if ( obj_anglespeedY > 0x400 ) obj_anglespeedY -= 0x40;
}
/********************************************************************************
ENEMYSTAR PROGRAM
********************************************************************************/
extern void s_enemystar(void)
{
if ( obj_mode == 0 ){
if ( obj_timer == 0 ){
cameraDemoStrat(CAM_DEMO_LOOKOBJ,execstp); //CAMERA DEMO
s_begin_enemydemo(STRATMAIN_DEMOMODE+STRATMAIN_PLAYERSTOP); //Strategy Stop
Mbitset( execstp->status,OBJECT_DEMOMOVEENTRY ); //kaijo only me
obj_anglespeedY = 0x800;
if ( obj_programselect == 0 ) check_playerpos();
else check_nowpos();
obj_angleY = s_calc_returnangle();
obj_speedY = 50;
obj_gravity = -4;
s_kemuri();
}
objsound_level(NA_LSE2_STAR_MOVE);
s_makeobj_nowpos(execstp,S_NULL,e_twinkle_special);
if ( obj_speedY < 0 && obj_worldY < obj_attY ){
obj_mode++;
obj_speedF = 0;
obj_speedY = 20;
obj_gravity = -1;
if ( execstp->s[stw_enemyinfo].d & ENEMYINFO_EXTSTAR ){
Na_Star100AppearBgm();
} else {
Na_StarAppearBgm();
}
}
} else if ( obj_mode == 1 ){
if ( obj_speedY < -4 ) obj_speedY = -4;
if ( obj_speedY < 0 && obj_worldY < obj_attY ){
demoseqcode = 1; // CAMERA DEMO END
obj_speedY = 0;
obj_gravity = 0;
obj_mode++;
}
s_makeobj_nowpos(execstp,S_NULL,e_twinkle_special);
} else if ( obj_mode == 2 ){
if ( ( Camerawork->demomode == 0 ) && ( ENDdemomode == 0 ) ){
s_end_enemydemo(STRATMAIN_DEMOMODE+STRATMAIN_PLAYERSTOP);
Mbitclr( execstp->status,OBJECT_DEMOMOVEENTRY );
obj_mode++;
}
} else {
hitcheck_star();
star_rotation();
}
s_optionmove_F();
obj_animeangleY += obj_anglespeedY;
obj_mail = 0;
}
/********************************************************************************
ENEMYSTAR PROGRAM
********************************************************************************/
extern void s_make_extstar(int starNo)
{
StrategyRecord *stp;
stp = s_makeobj_nowpos(execstp,S_polystar,e_enemystar);
stp->s[stw_actorcode].d = ( starNo << 24 );
stp->s[stw_enemyinfo].d = ENEMYINFO_EXTSTAR;
s_set_angle(stp,0,0,0);
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/