272 lines
6.4 KiB
OpenEdge ABL
272 lines
6.4 KiB
OpenEdge ABL
|
|
#define CANNON_ANGLEY ( (short)((obj_programselect)*256) )
|
|
|
|
/********************************************************************************
|
|
-------------------------
|
|
Ultra 64 MARIO Brothers
|
|
-------------------------
|
|
|
|
File : pathcannon.s
|
|
Description :
|
|
Date : 1995.
|
|
Author : H.yajima
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
/*################*/
|
|
#ifdef ASSEMBLER
|
|
/*################*/
|
|
|
|
/********************************************************************************
|
|
Cannon Base Program Main
|
|
********************************************************************************/
|
|
e_cannon:
|
|
e_cannon_base:
|
|
p_initialize(item)
|
|
p_setbit( flag,stf_moveON | stf_YangleSAME | stf_playerdistON | stf_alldispON )
|
|
p_makeshape(S_cannon_body,e_cannon_body)
|
|
p_setd(objname,OBJNAME_CANNON)
|
|
p_addf(worldY,-340)
|
|
p_save_nowpos
|
|
p_sethitbox(150,150)
|
|
p_hitON
|
|
p_while
|
|
p_program(s_cannon_base)
|
|
p_loop
|
|
|
|
/********************************************************************************
|
|
Cannon Body Program Main
|
|
********************************************************************************/
|
|
e_cannon_body:
|
|
p_initialize(option)
|
|
p_setbit( flag,stf_moveON | stf_YangleSAME | stf_playerdistON | stf_alldispON )
|
|
p_BGcheckYset
|
|
p_while
|
|
p_program(s_cannon_body)
|
|
p_loop
|
|
|
|
|
|
/********************************************************************************
|
|
Cannon gas Program Main
|
|
********************************************************************************/
|
|
|
|
e_gas_b:
|
|
p_initialize(option)
|
|
p_setbit(flag,stf_moveON | stf_YangleSAME | stf_FspeedON )
|
|
p_softspritemodeON
|
|
p_animereset
|
|
p_do(8)
|
|
p_program(s_gas_b)
|
|
p_animeinc
|
|
p_next
|
|
p_killshape
|
|
|
|
/*################*/
|
|
#else
|
|
/*################*/
|
|
|
|
extern void s_gas_b(void)
|
|
{
|
|
obj_worldY += obj_speedY;
|
|
}
|
|
|
|
/********************************************************************************
|
|
Cannon Program Main
|
|
********************************************************************************/
|
|
|
|
#define cannon_sinwork (execstp->s[stw_work0].d)
|
|
#define cannon_totaltime (execstp->s[stw_work1].d)
|
|
|
|
#define cannon_flag s[stw_work6].d
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_wait(void)
|
|
{
|
|
|
|
if ( obj_timer == 0 ){
|
|
obj_mail = 0;
|
|
obj_worldX = obj_attX;
|
|
obj_worldY = obj_attY;
|
|
obj_worldZ = obj_attZ;
|
|
obj_angleX = 0;
|
|
obj_angleY = CANNON_ANGLEY;
|
|
cannon_sinwork = 0;
|
|
execstp->cannon_flag = 0;
|
|
s_shapeON();
|
|
s_hitON();
|
|
}
|
|
|
|
if ( obj_playerdist < 500 ){
|
|
s_hitON();
|
|
s_shapeON();
|
|
if ( ((obj_mail & EMAIL_PLAYERHIT) != 0 ) && ((obj_mail & EMAIL_BOMB ) == 0 ) ){
|
|
obj_mode = mode_cannon_up;
|
|
execstp->cannon_flag = 1;
|
|
cannon_totaltime = 1;
|
|
} else {
|
|
obj_mail = 0;
|
|
}
|
|
} else {
|
|
s_hitOFF();
|
|
s_shapeOFF();
|
|
execstp->cannon_flag = 0;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_up(void)
|
|
{
|
|
|
|
if ( obj_timer == 0 ) objsound(NA_SE3_TAIHOUSET0);
|
|
|
|
obj_worldY +=5;
|
|
obj_worldX += (float)(((obj_timer/2) & 1)-0.5)*2;
|
|
obj_worldZ += (float)(((obj_timer/2) & 1)-0.5)*2;
|
|
|
|
if ( obj_timer > 67 ){
|
|
obj_worldX += (float)(((obj_timer/2) & 1)-0.5)*4;
|
|
obj_worldZ += (float)(((obj_timer/2) & 1)-0.5)*4;
|
|
obj_mode = mode_cannon_Yanime;
|
|
}
|
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_Yanime(void)
|
|
{
|
|
|
|
if ( obj_timer == 0 ) objsound(NA_SE3_TAIHOUSET1);
|
|
|
|
if ( obj_timer < 4 ){
|
|
obj_worldX += (float)(((obj_timer/2) & 1)-0.5)*4;
|
|
obj_worldZ += (float)(((obj_timer/2) & 1)-0.5)*4;
|
|
} else if ( obj_timer < 6 ){
|
|
} else if ( obj_timer < 6+16 ){
|
|
obj_angleY = sin(cannon_sinwork)*0x4000+CANNON_ANGLEY;
|
|
cannon_sinwork += 0x400;
|
|
} else if ( obj_timer < 6+16+4 ){
|
|
} else {
|
|
cannon_sinwork = 0;
|
|
obj_mode = mode_cannon_Xanime;
|
|
// obj_mode = mode_cannon_stanby;
|
|
}
|
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_Xanime(void)
|
|
{
|
|
|
|
if ( obj_timer == 0 ) objsound(NA_SE3_TAIHOUSET2);
|
|
|
|
if ( obj_timer < 4 ){
|
|
} else if ( obj_timer < 4+16 ){
|
|
cannon_sinwork += 0x400;
|
|
obj_angleX = sin(cannon_sinwork)*0x2000;
|
|
} else if ( obj_timer < 4+16+5 ){
|
|
} else {
|
|
obj_mode = mode_cannon_stanby;
|
|
}
|
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_stanby(void)
|
|
{
|
|
|
|
StrategyRecord *stratp;
|
|
float scale;
|
|
|
|
s_hitOFF();
|
|
s_shapeOFF();
|
|
execstp->cannon_flag = 0;
|
|
cannon_useflag = 1; /* cannon flag ON */
|
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_fire(void)
|
|
{
|
|
obj_mode = mode_cannon_fireentry;
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
static void cannon_fireentry(void)
|
|
{
|
|
|
|
StrategyRecord *stratp;
|
|
float scale;
|
|
|
|
/*--------------------------------------
|
|
if ( obj_timer < 30 ){
|
|
stratp = s_makeobj_nowpos(execstp,S_gas_b,e_gas_b);
|
|
stratp->s[stw_angleY].d = Randomd();
|
|
stratp->s[stw_speedF].f = Randomf()*20+20;
|
|
stratp->s[stw_speedY].f = cos(player1stp->s[stw_angleX].d)*40;
|
|
scale = Randomf()*3.0+3.0;
|
|
stratp->map.scale[0] = scale;
|
|
stratp->map.scale[1] = scale;
|
|
}
|
|
--------------------------------------*/
|
|
|
|
if ( obj_timer > 3 ) obj_mode = mode_cannon_wait;
|
|
|
|
}
|
|
|
|
|
|
/*-----------------------------------------------------------------------------*/
|
|
|
|
static void *cannon_modejmp[] = {
|
|
|
|
cannon_wait,
|
|
cannon_stanby,
|
|
cannon_fire,
|
|
cannon_fireentry,
|
|
cannon_up,
|
|
cannon_Xanime,
|
|
cannon_Yanime
|
|
|
|
};
|
|
|
|
|
|
extern void s_cannon_base(void)
|
|
{
|
|
|
|
s_modejmp(cannon_modejmp);
|
|
if ( cannon_totaltime != 0 ) cannon_totaltime++;
|
|
obj_mail = 0;
|
|
|
|
}
|
|
|
|
/********************************************************************************
|
|
Cannon Program Main
|
|
********************************************************************************/
|
|
|
|
|
|
extern void s_cannon_body(void)
|
|
{
|
|
|
|
StrategyRecord *base_stp = execstp->motherobj;
|
|
|
|
if ( ( ((MapNode *)(&base_stp->map))->flags ) & MAP_FLAG_ENABLE ){
|
|
s_shapeON();
|
|
s_copy_worldXYZ(execstp,execstp->motherobj);
|
|
execstp->s[stw_angleY].d = execstp->motherobj->s[stw_angleY].d;
|
|
execstp->s[stw_animeangleX].d = execstp->motherobj->s[stw_angleX].d;
|
|
} else {
|
|
s_shapeOFF();
|
|
}
|
|
|
|
}
|
|
|
|
/*################*/
|
|
#endif
|
|
/*################*/
|
|
/*===============================================================================
|
|
end end end end end end end end
|
|
===============================================================================*/
|
|
|