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

189 lines
4.3 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathlooplift.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
e_doublelift:
p_initialize(control)
p_setbit(flag,stf_moveON )
p_program(s_doublelift)
p_wait(1)
p_killobj
e_looplift:
p_initialize(moveBG)
p_setbit(flag,stf_moveON | stf_playerdistON )
p_setshapeinfo(han_liftcheck_info)
p_program(s_looplift_init)
p_save_nowpos
p_while
p_program(s_looplift)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
--------------------
doublelift program
--------------------
********************************************************************************/
typedef struct {
long zoffset;
float scale[3];
float speed;
} DoubleliftRecord;
static DoubleliftRecord dlift_data[] = {
{ 145,0.7,1.5,0.7 ,7 },
{ 235,1.2,2.0,1.2 ,11.6 },
};
extern void s_copy_f(float *dst,float *src)
{
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
}
extern void s_doublelift(void)
{
long yoffset,zoffset;
int n,i;
StrategyRecord *stp;
if ( obj_programselect == 0 ) obj_programselect = 65;
yoffset = obj_programselect * 10;
n = obj_actor_high;
for(i=0;i<2;i++){
if ( i == 0 ) zoffset = -(dlift_data[n].zoffset);
else zoffset = dlift_data[n].zoffset;
stp = s_makeobj_chain(i, 0, yoffset*i, zoffset,execstp,S_commonlift,e_looplift);
stp->s[stw_work8].f = dlift_data[n].speed;
s_copy_f(stp->map.scale,dlift_data[n].scale);
}
}
/********************************************************************************
------------------
looplift program
------------------
********************************************************************************/
#define LOOPLIFT_ROLL_SPEED 10
#define LOOPLIFT_UPDOWN_SPEED 10
#define LOOPLIFT_UPDOWN_TIME 80
#define LOOPLIFT_ANGLE_SPEED 0x200
#define looplift_flag (execstp->s[stw_work1].d)
#define looplift_time (execstp->s[stw_work2].d)
/*=========== work8 use ============*/
/*------------------------------------------------------------------------------*/
static void looplift_updown(int nextmode,float speed,int time)
{
obj_angleX = 0;
obj_anglespeedX = 0;
obj_speedF = 0;
obj_speedY = speed;
if ( obj_timer > time ) obj_mode++;
}
/*------------------------------------------------------------------------------*/
static void looplift_loop(int nextmode,short anglespeed)
{
obj_speedY = 0;
obj_anglespeedX = anglespeed;
if ( obj_timer == (0x8000/s_abs_d(anglespeed)-1) ) obj_mode = nextmode;
looplift_flag = nextmode;
}
/*------------------------------------------------------------------------------*/
extern void s_looplift_init(void)
{
looplift_time = execstp->motherobj->s[stw_programselect].d;
}
/*------------------------------------------------------------------------------*/
extern void s_looplift(void)
{
float roll_speed = execstp->s[stw_work8].f;
looplift_flag = 0;
if ( obj_playerdist < 1000 ) objsound_level(NA_LSE2_WOODLIFT);
switch(obj_mode){
case 0:
if ( obj_programselect == 0 ) obj_mode = 1;
else obj_mode = 3;
break;
case 1: looplift_updown(2, LOOPLIFT_UPDOWN_SPEED,looplift_time); break;
case 2: looplift_loop( 3, LOOPLIFT_ANGLE_SPEED); break;
case 3: looplift_updown(4,-LOOPLIFT_UPDOWN_SPEED,looplift_time); break;
case 4: looplift_loop( 1,-LOOPLIFT_ANGLE_SPEED); break;
}
obj_angleX += s_abs_d(obj_anglespeedX);
obj_animeangleX += s_abs_d(obj_anglespeedX);
obj_animeangleY = obj_angleY;
if ( obj_angleX != 0 ){
obj_speedF = s_sign_d(obj_anglespeedX) * sin(obj_angleX) * roll_speed;
obj_speedY = s_sign_d(obj_anglespeedX) * cos(obj_angleX) * roll_speed;
}
if ( looplift_flag == 1 ){
obj_anglespeedX = 0;
obj_animeangleX &= 0xffff8000;
s_optionmove_F();
} else {
s_optionmove_F();
}
stMainMoveBG();
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/