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

245 lines
5.3 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathdownbar.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
/********************************************************************************
---------------------
castle down bar
---------------------
********************************************************************************/
e_downbar_object:
p_initialize(moveBG)
p_setbit( flag,stf_moveON | stf_YangleSAME)
p_setf(movebg_checkdist,300)
p_while
p_program(s_castle_downbar_1)
p_program(stMainMoveBG)
p_loop
/*====================================================*/
e_downbridge:
e_castle_downbar:
p_initialize(control)
p_setbit( flag,stf_moveON | stf_playerdistON | stf_alldispON )
p_save_nowpos
p_while
p_program(s_downbar)
p_loop
/*====================================================*/
e_d_teretrap:
p_initialize(control)
p_setbit(flag,stf_moveON | stf_playerdistON | stf_alldispON )
p_save_nowpos
/* p_program(s_areastage_init) */
p_setd(programselect,1)
p_while
p_program(s_downbar)
p_loop
/*====================================================*/
e_mapobj_motos_07:
p_initialize(control)
p_setbit( flag,stf_moveON | stf_playerdistON | stf_alldispON )
p_save_nowpos
/* p_changeshape(imm,S_motos_obj07_far) */
p_setd(programselect,2)
p_while
p_program(s_downbar)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
---------------------
castle down bar
---------------------
********************************************************************************/
#define castle_bar_accel (execstp->s[stw_work0].d)
extern short down_b_info[];
extern short d_trap_check_info[];
extern short motos_obj07_info[];
extern short e2_kuzure01_check_info[];
/*------------------------------------------------------------------------------*/
extern void s_castle_downbar_1(void)
{
switch (obj_mode){
case 0:
if ( player1stp->ride_strat == execstp ){
obj_mode++;
castle_bar_accel = 0x80 * RandomSign();
}
break;
#if 1
case 1:
s_groundcheck();
if ( obj_timer > 5 ){
obj_mode++;
objsound(NA_SE2_BRIDGEFALL);
}
break;
case 2:
if ( obj_anglespeedX < 0x400 ){
obj_anglespeedX += 0x80;
}
if ( -0x400 < obj_anglespeedZ && obj_anglespeedZ < 0x400 ){
obj_anglespeedZ += castle_bar_accel;
}
obj_gravity = -3;
s_move_animeangle();
s_optionmove_F();
if ( obj_worldY < ( obj_groundY - 300 ) ) obj_mode++;
break;
case 3:
break;
#endif
}
if ( execstp->motherobj->s[stw_mode].d == mode_castle_downbar_exit ) s_remove_obj(execstp);
}
/*------------------------------------------------------------------------------*/
/*
0 .... castle downbar
1 .... obake downbar
2 .... motos downbar
*/
typedef struct {
short count;
short Zoffset;
short Zadd;
short shape;
short *funlike;
} DownbarRecord;
static DownbarRecord downbar_data[] = {
{ 9,-512,128, S_down_bridge ,down_b_info },
{ 9,-412,103, S_movebg03 ,d_trap_check_info },
{ 9,-512,128, S_motos_obj07_near ,motos_obj07_info },
{ 9,-512,128, S_movebg11 ,e2_kuzure01_check_info },
};
static void castle_downbar_init(void)
{
StrategyRecord *stp;
int i;
int n = obj_programselect;
int x,z;
int y = 0;
int yoffset = 0;
for(i=0;i<downbar_data[n].count;i++){
x = 0;
z = 0;
if ( n == 3 ) x = downbar_data[n].Zoffset + i * downbar_data[n].Zadd;
else z = downbar_data[n].Zoffset + i * downbar_data[n].Zadd;
if ( s_check_pathname( e_mapobj_motos_07 ) ){
if ( ( i % 3 ) == 0 ) y -= 150;
yoffset = 150*3;
}
stp = s_makeobj_chain(0,x,y+yoffset,z,
execstp,
downbar_data[n].shape,
e_downbar_object
);
s_set_shapeinfo(stp,downbar_data[n].funlike);
}
obj_mode = mode_castle_downbar_main;
}
/*------------------------------------------------------------------------------*/
static void castle_downbar_main(void)
{
s_shape_hide();
if ( s_check_pathname( e_mapobj_motos_07 ) ) s_shape_disp();
else {
if ( obj_playerdist > 1200 ){
obj_mode = mode_castle_downbar_exit;
s_shape_disp();
}
}
}
/*------------------------------------------------------------------------------*/
static void castle_downbar_exit(void)
{
s_shape_disp();
obj_mode = mode_castle_downbar_wait;
}
/*------------------------------------------------------------------------------*/
static void castle_downbar_wait(void)
{
if ( s_check_pathname( e_mapobj_motos_07 ) || obj_playerdist < 1000 ){
obj_mode = mode_castle_downbar_init;
}
}
/*------------------------------------------------------------------------------*/
static void *castle_downbar_modejmp[] = {
castle_downbar_wait,
castle_downbar_init,
castle_downbar_main,
castle_downbar_exit
};
extern void s_downbar(void)
{
s_modejmp(castle_downbar_modejmp);
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/