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

385 lines
11 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathmaincastleobj.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
/********************************************************************************/
/* */
/* doorkey demo animation */
/* */
/********************************************************************************/
e_doorkey_demo:
p_initialize(option)
p_set_pointer(skelanime,doorkey_anime)
p_setbit(flag,stf_moveON )
p_while
p_program(s_doorkey_demo)
p_loop
e_takekey_demo:
p_initialize(option)
p_set_pointer(skelanime,doorkey_anime)
p_setbit(flag,stf_moveON )
p_while
p_program(s_takekey_demo)
p_loop
/********************************************************************************/
/* */
/* main castle water switch */
/* */
/********************************************************************************/
e_maincastle_waterswitch:
p_initialize(option)
p_program(s_maincastle_waterswitch)
p_end
/********************************************************************************/
/* */
/* main room switch */
/* */
/********************************************************************************/
e_sel1b_erase_water:
p_initialize(moveBG)
p_setbit(flag,stf_moveON)
p_setshapeinfo(selt_sss_c_info)
p_program(s_sel1b_erase_water_init)
p_while
p_program(s_sel1b_erase_water)
p_program(stMainMoveBG)
p_loop
/********************************************************************************/
/* */
/* main room switch */
/* */
/********************************************************************************/
e_sel1b_waterwall_switch:
p_initialize(moveBG)
p_setbit(flag,stf_moveON)
p_setf(movebg_checkdist,30000)
p_while
p_program(s_sel1b_waterwall_switch)
p_program(stMainMoveBG)
p_loop
/********************************************************************************/
/* */
/* ami program */
/* */
/********************************************************************************/
e_maincastle_net:
p_initialize(moveBG)
p_setbit(flag,stf_moveON)
p_setshapeinfo(main_net_info)
p_setf(movebg_checkdist,30000)
p_while
p_program(s_maincastle_net)
p_loop
/********************************************************************************/
/* */
/* main castle clock */
/* */
/********************************************************************************/
e_clock_long:
p_initialize(option)
p_setd(anglespeedZ,-0x180)
p_jmp(clock_common)
e_clock_short:
p_initialize(option)
p_setd(anglespeedZ,-0x20)
clock_common:
p_setbit(flag,stf_moveON)
p_program(s_areastage_init)
p_while
p_program(s_clock_check)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
C Program (maincastleobj)
********************************************************************************/
extern void s_sel1b_waterwall_switch(void)
{
extern short sel1b_c2_info[];
extern short sel1b_c3_info[];
if ( wave_dummy_backup & 2 ) execstp->shapeinfo = (short *)SegmentToVirtual(sel1b_c3_info);
else execstp->shapeinfo = (short *)SegmentToVirtual(sel1b_c2_info);
}
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/* water switch normal */
/********************************************************************************/
#define ERASE_WATER_YPOS -2450
#define ERASE_WATER_SWITCH_YPOS_DEC 20*4
#define erase_water_flag (execstp->s[stw_work1].d)
static void sel1b_erase_water_1(void)
{
StrategyRecord *stp;
switch(obj_mode){
case 0:
if ( s_checkplayer_hipaatack() ){
obj_mode++;
s_kemuri();
}
break;
case 1:
if ( obj_timer < 4 ) obj_worldY -= 20;
else obj_mode++;
break;
case 2:
if ( ( stp = s_find_obj(e_sel1b_erase_water) ) != NULL ){
if ( stp->s[stw_mode].d < 2 ) obj_mode++;
};
break;
case 3:
if ( ( stp = s_find_obj(e_sel1b_erase_water) ) != NULL ){
if ( stp->s[stw_mode].d >= 2 ){
obj_mode++;
BuSetItemFlag(BU_ITEM_DRAINSW); /* Set Drain Water Switch */
Na_NazoClearBgm();
}
}
break;
case 4:
objsound_level(NA_LSE2_WATERLEVEL_DOWN);
if ( obj_timer < 300 ){
waterline_basic[2] = s_chase_position(waterline_basic[2],ERASE_WATER_YPOS,5);
waterline_basic[0] = s_chase_position(waterline_basic[0],ERASE_WATER_YPOS,5);
SendMotorVib(2); /* MOTOR 1997.5.30 */
}
else obj_mode++;
break;
case 5:
break;
}
}
/********************************************************************************/
/* water switch normal */
/********************************************************************************/
static void sel1b_erase_water_2(void)
{
if ( obj_timer == 0 ){
obj_worldY -= ERASE_WATER_SWITCH_YPOS_DEC;
waterline_basic[2] = ERASE_WATER_YPOS;
waterline_basic[0] = ERASE_WATER_YPOS;
}
}
/********************************************************************************/
/* */
/* water switch main */
/* */
/********************************************************************************/
/*------------------------------------------------------------------------------*/
extern void s_sel1b_erase_water_init(void)
{
if ( BuGetItemFlag() & BU_ITEM_DRAINSW ) erase_water_flag = 1;
}
/*------------------------------------------------------------------------------*/
extern void s_sel1b_erase_water(void)
{
if ( erase_water_flag ) sel1b_erase_water_2();
else sel1b_erase_water_1();
*(waterline+1+6*2+5) = waterline_basic[2];
*(waterline+1+6*0+5) = waterline_basic[0];
}
/*------------------------------------------------------------------------------*/
extern void s_maincastle_waterswitch(void)
{
if ( BuGetItemFlag() & BU_ITEM_DRAINSW ){
*(waterline+1+6*0+5) = -800;
*(waterline+1+6*1+5) = -800;
}
}
/********************************************************************************/
/* */
/* door key animation demo */
/* */
/********************************************************************************/
extern unsigned long ZoomDoorKey(int code,MapNode *node, void *data)
{
if (code == MAP_CBACK_EXEC) {
StrategyRecord *stp = (StrategyRecord *)hmsActiveShape;
((MapScale *)(node->next))->scaling = stp->s[stw_work0].f;
}
return(0);
}
/********************************************************************************/
/* */
/* openkey demo */
/* */
/********************************************************************************/
#define doorkey_scale(n) (execstp->s[stw_work0].f = (n))
extern void s_doorkey_demo(void)
{
int anime_frame = execstp->map.skelanim.frame;
s_set_skelanimeNo(0);
if ( anime_frame < 40-2 ) doorkey_scale(0);
else if ( anime_frame < 51-2 ) doorkey_scale(0.2);
else if ( anime_frame < 60-2 ) doorkey_scale(0.2+(anime_frame-51-2)*0.11875f);
else if ( anime_frame < 61-2 ) doorkey_scale(1.10);
else if ( anime_frame < 62-2 ) doorkey_scale(1.05);
else doorkey_scale(1.0);
if ( obj_timer > 150 ) s_remove_obj(execstp);
}
/********************************************************************************/
/* */
/* takekey demo */
/* */
/********************************************************************************/
extern void s_takekey_demo(void)
{
int anime_frame = execstp->map.skelanim.frame;
s_set_skelanimeNo(1);
if ( anime_frame < 40-2 ) doorkey_scale(0.2);
else if ( anime_frame < 54-2 ) doorkey_scale(0.2+(anime_frame-40-2)*0.042857f);
else if ( anime_frame < 96-2 ) doorkey_scale(0.8);
else if ( anime_frame < 103-2 ) doorkey_scale(0.2+(103-2-anime_frame)*0.085714f);
else doorkey_scale(0.2);
if ( obj_timer > 138 ) s_remove_obj(execstp);
}
/********************************************************************************/
/* */
/* mainmap next */
/* */
/********************************************************************************/
extern void s_maincastle_net(void)
{
if ( BuGetItemFlag() & BU_ITEM_DRAINSW ){
s_change_shape(S_NULL);
} else {
stMainMoveBG();
}
}
/********************************************************************************/
/* */
/* clock program */
/* */
/********************************************************************************/
extern void s_clock_check(void)
{
BGCheckData *bgdata;
unsigned short time = obj_animeangleZ;
obj_groundY = mcBGGroundCheck(player_worldX,player_worldY,player_worldZ,&bgdata );
if ( obj_mode == 0 ){
if ( bgdata->BGattr == 0 && obj_timer > 3 ) obj_mode++;
} else if ( obj_mode == 1 ){
if ( ( bgdata != NULL ) && ( bgdata->BGattr == 244 || bgdata->BGattr == 245 || bgdata->BGattr == 246 ) ){
if ( s_check_pathname(e_clock_long) ){
if ( time < 2730 ) stage_objparameter = 3;
else if ( time < 2730*10 ) stage_objparameter = 1;
else if ( time < 2730*14 ) stage_objparameter = 2;
else if ( time < 2730*23 ) stage_objparameter = 0;
else stage_objparameter = 3;
}
obj_mode++;
} else {
// objsound_level(NA_LSE2_CLOCKHAND);
}
}
if ( obj_mode < 2 ) s_move_animeangle();
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/