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

271 lines
6.6 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathhibiblock.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
/********************************************************************************
timer block
********************************************************************************/
e_timeblock_switch:
p_initialize(moveBG)
p_setd(programselect,2) /* set timer switch */
p_jmp(el_hanswitch_common) /* hanyou switch */
e_timeblock:
p_initialize(moveBG)
p_setbit(flag,stf_moveON )
p_setshapeinfo(hibi_block_info)
p_setf(movebg_checkdist,300)
p_while
p_program(s_timeblock)
p_loop
/********************************************************************************
hibi block
********************************************************************************/
e_osublock:
e_hibiblock:
p_initialize(moveBG)
el_hibiblock_common:
p_setbit(flag,stf_moveON )
p_setshapeinfo(hibi_block_info)
p_setf(movebg_checkdist,500)
p_program(s_areastage_init)
p_while
p_program(s_hibiblock)
p_program(stMainMoveBG)
p_loop
/********************************************************************************
carry block
********************************************************************************/
e_carryhit_block:
e_carryblock:
p_end
/********************************************************************************
push block
********************************************************************************/
e_pushblock:
p_initialize(moveBG)
p_setbit(flag,stf_moveON )
p_setshapeinfo(push_blockcheck_info)
p_setf(movebg_checkdist,500)
p_save_nowpos
p_while
p_program(s_pushblock)
p_program(stMainMoveBG)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
C Program ( push block)
********************************************************************************/
static HitCheckRecord push_hit = {
0,
0,0,1,0, /* flag,ap,hp,coin */
220,300,
220,300,
};
/********************************************************************************
next position BG check
********************************************************************************/
extern int s_next_bgcheck(float offset,float speed)
{
BGCheckData *bgdata;
float nextX = obj_worldX + speed * sin(obj_angleY);
float nextY;
float nextZ = obj_worldZ + speed * cos(obj_angleY);
nextY = mcBGGroundCheck(nextX,obj_worldY,nextZ,&bgdata );
if ( s_abs_f(nextY - obj_worldY) < offset ) return(1);
else return(0);
}
extern void s_pushblock(void)
{
short code;
short targetangle;
s_set_hitparam(execstp,&push_hit);
obj_speedF= 0;
if ( s_hitcheck(execstp,player1stp) ){
if ( playerWorks[0].flags & PL_FLAG_PUSHWALL ){
targetangle = s_calc_targetangle(execstp,player1stp);
if ( s_calc_dangle(targetangle,player1stp->s[stw_angleY].d) > 0x4000 ){
obj_angleY = (short)( ( (player1stp->s[stw_angleY].d) + 0x2000 ) & 0x0c000 );
if ( s_next_bgcheck(8,150) ){
obj_speedF = 4;
objsound_level(NA_LSE2_CUBE_SLIDE);
}
}
}
}
s_optionmove_F();
}
/********************************************************************************
C Program ( hibi block)
********************************************************************************/
static HitCheckRecord hibiblock_hit = {
OBJNAME_PUNCHITEM,
20,0,1,0, /* flag,ap,hp,coin */
130+20,160+40, /* player attack hitarea */
130+20,160+40, /* player attack hitarea */
};
#define hibisw_pointer (execstp->s[stw_work0].pointer)
/*------------------------------------------------------------------------------*/
static void hibiblock_inititem(void)
{
hibisw_pointer = NULL;
obj_animecounter = 1;
switch(obj_programselect){
case 0: execstp->s[stw_havecoin].d = 0; break;
case 1: execstp->s[stw_havecoin].d = 3; break;
case 2: execstp->s[stw_havecoin].d = 5; break;
case 3: s_set_scale(1.5); break;
}
}
/*------------------------------------------------------------------------------*/
extern void time_hibiblock(void)
{
StrategyRecord *stp;
s_set_hitparam(execstp,&hibiblock_hit);
s_change_shape(S_hibiblock_noshadow);
if ( obj_mode == 0 ){
s_shapeOFF();
s_hitOFF();
if ( obj_timer == 0 ) hibiblock_inititem();
if ( hibisw_pointer == NULL ) hibisw_pointer = (void *)s_find_obj(e_timeblock_switch);
if ( ( stp = (StrategyRecord *)hibisw_pointer ) != NULL ){
if ( stp->s[stw_mode].d == MODE_SWITCH_ON ){
obj_mode++;
s_shapeON();
s_shape_disp();
}
}
} else if ( obj_mode == 1 ){
s_hitON();
if ( s_flash_shape(HANSWITCH_TIMER-40,20)) obj_mode = 0;
if ( s_block_hitcheck() ){
s_kemuri();
s_boxeffect(30,S_sankaku,3,4);
obj_mode++;
objsound(NA_SE2_BLOCK_BURST);
}
stMainMoveBG();
} else {
s_hitOFF(); /* obj hit OFF */
s_shapeOFF(); /* shape OFF */
obj_mail = 0;
if ( ( stp = (StrategyRecord *)hibisw_pointer ) != NULL ){
if ( stp->s[stw_mode].d == MODE_SWITCH_OFF ) obj_mode = 0;
}
}
}
extern void time_poolblock(void)
{
extern short po_mobj04_check_info[];
StrategyRecord *stp;
s_set_shapeinfo(execstp,po_mobj04_check_info);
if ( obj_mode == 0 ){
s_shapeOFF();
s_hitOFF();
if ( hibisw_pointer == NULL ) hibisw_pointer = (void *)s_find_obj(e_timeblock_switch);
if ( ( stp = (StrategyRecord *)hibisw_pointer ) != NULL ){
if ( stp->s[stw_mode].d == MODE_SWITCH_ON ){
obj_mode++;
s_shapeON();
s_shape_disp();
}
}
} else {
s_hitON();
if ( s_flash_shape(HANSWITCH_TIMER-40,20)) obj_mode = 0;
stMainMoveBG();
}
}
/*------------------------------------------------------------------------------*/
extern void s_timeblock(void)
{
if ( obj_programselect == 0 ) time_hibiblock();
else time_poolblock();
}
/*------------------------------------------------------------------------------*/
extern void s_hibiblock(void)
{
s_set_hitparam(execstp,&hibiblock_hit);
s_change_shape(S_hibiblock_noshadow);
if ( obj_timer == 0 ) hibiblock_inititem();
if ( s_block_hitcheck() ){
s_burn_remove(46,BURNSET_NORMAL_COIN);
// s_burn_remove(46,BURNSET_ESCAPE_COIN);
obj_remove_sound(NA_SE2_BLOCK_BURST);
}
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/