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

494 lines
11 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathkopafire.s
Description :
Date : 1995.
Author : H.yajima
********************************************************************************/
/*################*/
#ifdef ASSEMBLER
/*################*/
/********************************************************************************
------------------------
kopafire super program
------------------------
********************************************************************************/
e_kopafire_super:
p_initialize(item)
p_setbit(flag,stf_moveON)
p_setobjname(FIRE)
p_softspritemodeON
p_setmovedata(0,-400,-70,1000,1000,200,0,0)
p_program(s_kopafire_super_init)
p_while
p_program(s_kopafire_super)
p_inc_frame(animecounter,2)
p_loop
e_furafura_fire:
p_initialize(item)
p_setbit(flag,stf_moveON )
p_setobjname(FIRE)
p_softspritemodeON
p_setmovedata(0,-400,-70,1000,1000,200,0,0)
p_program(s_furafura_fire_init)
p_while
p_program(s_furafura_fire)
p_inc_frame(animecounter,2)
p_loop
/********************************************************************************
--------------------
bound fire program
--------------------
********************************************************************************/
e_boundfire:
p_initialize(item)
p_setbit(flag,stf_moveON | stf_playerangleON )
p_setobjname(FIRE)
p_softspritemodeON
p_while
p_program(s_boundfire)
p_loop
e_boundfire_parts:
p_initialize(item)
p_setbit(flag,stf_moveON | stf_playerangleON )
p_setobjname(FIRE)
p_softspritemodeON
p_program(s_boundfire_parts_init)
p_setmovedata(0,-400,-70,0,0,200,0,0)
p_while
p_program(s_boundfire_parts)
p_inc_frame(animecounter,2)
p_loop
/********************************************************************************
-------------------
fire ball program
-------------------
********************************************************************************/
e_fireball:
p_initialize(item)
p_setbit(flag,stf_moveON )
p_setobjname(FIRE)
p_softspritemodeON
p_program(s_fireball_init)
p_while
p_program(s_fireball)
p_inc_frame(animecounter,2)
p_loop
/********************************************************************************
--------------------------
ground fire ball program
--------------------------
********************************************************************************/
e_ground_fire:
p_initialize(item)
p_setbit(flag,stf_moveON)
p_setobjname(FIRE)
p_softspritemodeON
p_program(s_ground_fire_init)
p_setmovedata(0,-400,-70,1000,1000,200,0,0)
p_while
p_program(s_ground_fire)
p_inc_frame(animecounter,2)
p_loop
e_stop_fire:
p_initialize(item)
p_setbit(flag,stf_moveON)
p_setobjname(FIRE)
p_softspritemodeON
p_program(s_stop_fire_init)
p_setmovedata(0,-400,-70,1000,1000,200,0,0)
p_while
p_program(s_ground_fire)
p_inc_frame(animecounter,2)
p_loop
/*################*/
#else
/*################*/
/********************************************************************************
fireball hitcheck data
********************************************************************************/
static HitCheckRecord firehit = {
OBJNAME_FIRE,
20,1,0,0, /* flag,ap,hp,coin */
10,40, /* attack area */
0,0 /* damage area */
};
static HitCheckRecord groundfirehit = {
OBJNAME_FIRE,
0,1,0,0, /* flag,ap,hp,coin */
10,40, /* attack area */
0,0 /* damage area */
};
/********************************************************************************
remove smoke
********************************************************************************/
static void fire_remove_smoke(void)
{
s_remove_obj(execstp);
s_makeobj_nowpos_scale( execstp,S_NULL,e_enemy_firesmoke, 1.0);
if ( Randomf() < 0.1 ) s_makeobj_nowpos(execstp,S_coin,e_coin_timeend);
}
static int fire_areacheck(int timer)
{
if ( obj_timer > timer ) return(1);
if ( obj_bgcode == BGCHECKCODE_DAMEDE_1 ) return(1);
if ( obj_bgcode == BGCHECKCODE_SPECIAL_R2 ) return(1);
return(0);
}
/********************************************************************************
===================
Kopa Fire Program
===================
********************************************************************************/
#define kopafire_scale (execstp->s[stw_work0].f)
#define kopafire_random (execstp->s[stw_work1].d)
#define kopaY_random (execstp->s[stw_work2].f)
#define kopamother_pointer (execstp->s[stw_work3].pointer)
/********************************************************************************
KOPA ---- GROUND FIRE ----- PROGRAM
********************************************************************************/
/*
if ( obj_speedF > 0 ) obj_speedF -= 0.3;
if ( obj_speedY < -8 ) obj_speedY = -8;
obj_worldX += sin(obj_angleY)*sin(counter)*4;
obj_worldZ += cos(obj_angleY)*sin(counter)*4;
*/
extern void s_ground_fire_init(void)
{
obj_hmsselectNo = (long)(Randomf()*10);
obj_angleY = Randomd();
if ( Randomf() < 0.2 ) obj_speedY = 80;
else obj_speedY = 20;
obj_speedF = 10;
obj_gravity = -1;
kopafire_scale = 1+Randomf();
}
extern void s_stop_fire_init(void)
{
obj_hmsselectNo = (long)(Randomf()*10);
obj_angleY = Randomd();
obj_speedY = 10;
obj_speedF = 0;
kopafire_scale = 7;
}
static void fire_randommove(void)
{
long counter = ((frameCounter+kopafire_random)&0x3f)*0x400;
obj_worldX += sin(obj_angleY)*sin(counter)*4;
obj_worldZ += cos(obj_angleY)*sin(counter)*4;
}
extern void s_ground_fire(void)
{
s_enemybgcheck();
s_enemymove(78);
if ( obj_speedY < -4 ) obj_speedY = -4;
if ( obj_mode == 0 ){
s_hitOFF();
fire_randommove();
if ( obj_movestatus & MOVESTAT_BGBOUND ){
obj_mode++;
if ( s_check_pathname(e_stop_fire)) kopafire_scale = 8;
else kopafire_scale = 6 + Randomf()*2;
obj_speedF = 0;
obj_speedY = 0;
obj_gravity = 0;
}
} else {
s_hitON();
if ( obj_timer > 5 + kopafire_scale * 10 ){
kopafire_scale -= 0.15;
if ( kopafire_scale <= 0 ) fire_remove_smoke();
}
}
s_set_scale(kopafire_scale);
obj_animepositionY = 14 * (execstp->map.scale[1]); /* Animeposition Y */
s_set_hitparam(execstp,&groundfirehit);
}
/********************************************************************************
KOPA ---- NORMAL FIRE ----- PROGRAM
********************************************************************************/
extern void s_fireball_init(void)
{
obj_speedF = 30;
s_random_XZ_offset(execstp,80);
obj_hmsselectNo = (long)(Randomf()*10);
kopafire_scale = 3;
}
extern void s_fireball(void)
{
int i;
StrategyRecord *stratp;
s_set_hitparam(execstp,&firehit);
kopafire_scale += 0.5;
s_set_scale(kopafire_scale);
if ( obj_angleX > 0x800 ) obj_angleX -= 0x200;
s_3Dmove();
s_groundcheck();
if ( kopafire_scale > 30 ) s_remove_obj(execstp);
if ( obj_worldY < obj_groundY ){
obj_worldY = obj_groundY;
stratp = s_makeobj_nowpos(execstp,S_fireball_yellow,e_ground_fire);
s_remove_obj(execstp);
}
}
/********************************************************************************
========================
FURAFURA FIRE PROGRAM
========================
********************************************************************************/
extern void s_furafura_fire_init(void)
{
obj_hmsselectNo = (long)(Randomf()*10);
obj_angleY = Randomd();
if ( obj_programselect ) obj_speedF = Randomf()*(5);
else obj_speedF = Randomf()*(70);
obj_speedY = Randomf()*(20);
obj_gravity = -1;
kopafire_random = Randomf() * 64;
}
/*------------------------------------------------------------------------------*/
extern void s_furafura_fire(void)
{
static float furafura_Y_limit[] = { -8,-6,-3 };
float limit;
s_enemybgcheck();
s_enemymove(78);
fire_randommove();
if ( fire_areacheck(900) ) s_remove_obj(execstp);
if ( obj_speedY < furafura_Y_limit[obj_programselect] ) obj_speedY = furafura_Y_limit[obj_programselect];
if ( obj_movestatus & MOVESTAT_BGBOUND ){
if ( obj_programselect == 0 ) s_makeobj_nowpos(execstp,S_fireball_yellow,e_stop_fire);
else s_makeobj_nowpos(execstp,S_NULL ,e_boundfire);
s_remove_obj(execstp);
}
obj_animepositionY = 14 * (execstp->map.scale[1]); /* Animeposition Y */
}
/********************************************************************************
====================
NORMAL FIRE PROGAM
====================
********************************************************************************/
extern void s_kopafire_super_init(void)
{
s_random_XZ_offset(execstp,80);
obj_hmsselectNo = (long)(Randomf()*10);
obj_speedY = 7;
obj_speedF = 35;
kopafire_scale = 3;
kopaY_random = Randomf() * 0.5;
obj_gravity = 1;
kopafire_random = Randomf() * 64;
}
/*------------------------------------------------------------------------------*/
extern void s_kopafire_super(void)
{
int i;
StrategyRecord *stp;
s_set_hitparam(execstp,&firehit);
if ( kopafire_scale < 16 ) kopafire_scale += 0.5;
s_set_scale(kopafire_scale);
s_enemybgcheck();
s_enemymove(78);
if ( obj_timer > 20 ){
if ( obj_programselect == 0 ){
for (i=0;i<3;i++) s_makeobj_chain_scale(0,0,0,0,5.0,execstp,S_fireball_yellow,e_furafura_fire);
} else {
s_makeobj_chain_scale(1,0,0,0,8.0,execstp,S_fireball_blue, e_furafura_fire);
s_makeobj_chain_scale(2,0,0,0,8.0,execstp,S_fireball_blue, e_furafura_fire);
}
s_remove_obj(execstp);
}
}
/********************************************************************************
KOPA ---- NORMAL FIRE ----- PROGRAM
********************************************************************************/
extern void s_boundfire_parts_init(void)
{
obj_hmsselectNo = (long)(Randomf()*10);
obj_speedY = 30;
obj_speedF = 20;
kopafire_scale = execstp->map.scale[0];
kopafire_random = Randomf() * 64;
}
extern void s_boundfire_parts(void)
{
StrategyRecord *stp;
if ( obj_timer == 0 ) kopamother_pointer = (void *)s_find_obj(e_kopa);
stp = (StrategyRecord *)kopamother_pointer;
obj_speedF = 15;
obj_bound_e = -1;
s_set_scale(kopafire_scale);
s_set_hitparam(execstp,&firehit);
s_enemybgcheck();
s_enemymove(78);
if ( fire_areacheck(300) ) s_remove_obj(execstp);
if ( stp != NULL ){
if ( stp->s[stw_actionmode].d == 0 ){
if ( s_distanceXZ_obj2obj(execstp,stp) < 300 ) s_remove_obj(execstp);
}
}
}
/********************************************************************************
bound fire program
********************************************************************************/
#define boundfire_scale (execstp->s[stw_work1].f)
extern void s_boundfire(void)
{
StrategyRecord *stp;
int i;
if ( obj_timer == 0 ){
obj_angleY = s_calc_targetangle(execstp,player1stp);
boundfire_scale = 5;
}
if ( obj_timer < 16 ){
if ( (obj_timer % 2 ) == 0){
for(i=0;i<3;i++){
stp = s_makeobj_nowpos(execstp,S_fireball_blue,e_boundfire_parts);
stp->s[stw_angleY].d += i * 0x5555;
stp->map.scale[0] = boundfire_scale;
}
boundfire_scale -= 0.5;
}
} else {
s_remove_obj(execstp); /* Remove Object */
}
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/