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

343 lines
9.0 KiB
OpenEdge ABL

/********************************************************************************
-------------------------
Ultra 64 MARIO Brothers
-------------------------
File : pathmotos.s
Description :
Date : 1995.10.17
Author : H.yajima
********************************************************************************/
/********************************************************************************
Enemy motos Animation !!
********************************************************************************/
#define ANM_motos_basedata_A 0
#define ANM_motos_carry 1
#define ANM_motos_carry_run 2
#define ANM_motos_carry_start 3
#define ANM_motos_down_recover 4
#define ANM_motos_down_stop 5
#define ANM_motos_pitch 6
#define ANM_motos_safe_down 7
#define ANM_motos_wait 8
#define ANM_motos_walk 9
#define ANM_motos_end ANM_motos_walk+1
/*################*/
#ifdef ASSEMBLER
/*################*/
e_motos:
p_initialize(enemyA)
p_setbit(flag,stf_moveON | stf_YangleSAME | stf_catchON | stf_playerdistON | stf_playerangleON )
p_set_pointer(skelanime,motos_anime)
p_setd(objname,OBJNAME_TAKE)
p_sethitbox(100,100)
p_setmovedata(30,-400,-50,1000,1000,200,0,0)
p_makeobj_child(S_NULL,e_motos_hand)
p_hitON
p_while
p_program(s_motos)
p_loop
e_motos_hand:
p_initialize(enemyA)
p_setbit(flag,stf_moveON | stf_YangleSAME )
p_softspritemodeON
p_while
p_program(s_motos_hand)
p_loop
/*################*/
#else
/*################*/
#define motos_work (execstp->s[stw_work0].d)
/********************************************************************************
motos
********************************************************************************/
extern unsigned long MotosProc1(int code,MapNode *node, void *data)
{
if (code == MAP_CBACK_EXEC) {
AffineMtx modelmtx;
StrategyRecord *stp = (StrategyRecord *)hmsActiveShape;
if ( stp->childobj != NULL ){
s_calc_skeleton_glbmtx(&modelmtx,(AffineMtx *)data,hmsActiveCamera->matrix);
s_calc_skeleton_glbpos(modelmtx,stp->childobj);
s_copy_worldXYZmappos(stp->childobj);
}
}
return(0);
}
extern void s_motos_hand(void)
{
StrategyRecord *firep;
execstp->s[stw_skeletonX].f = 100;
execstp->s[stw_skeletonY].f = 0;
execstp->s[stw_skeletonZ].f = 150;
obj_angleY = execstp->motherobj->s[stw_angleY].d;
switch (execstp->motherobj->s[stw_imm].d ){
case 0:
break;
case 1:
s_copy_mapwork(player1stp,execstp);
break;
case 2:
player1stp->s[stw_mail].d |= PLAYERMAIL_CARRYMODE_OFF;
playerWorks[0].velocity = 50;
execstp->motherobj->s[stw_imm].d = 0;
break;
}
#if 0
if (execstp->motherobj->s[stw_imm].d != 0){
execstp->motherobj->s[stw_imm].d = 0;
firep = s_makeobj_nowpos(execstp,S_green_kame,e_enemyfire);
firep->s[stw_speedF].f = 40;
firep->s[stw_speedY].f = 20;
firep->s[stw_angleY].d = execstp->motherobj->s[stw_angleY].d;
}
#endif
}
/********************************************************************************
Enemy AI Library
********************************************************************************/
static int s_ai_pitch(short angle,float dist)
{
if ( (s_chase_angleY(obj_targetangle,angle)) && (obj_playerdist < dist) ) return(1);
else return(0);
}
/********************************************************************************
motos program
********************************************************************************/
/*------------------------------------------------------------------------------*/
/* ##### */
/* ##### wait */
/* ##### */
/*------------------------------------------------------------------------------*/
static void motos_wait(void)
{
obj_speedF = 0;
obj_speedY = 0;
s_set_skelanimeNo(ANM_motos_wait);
if ( obj_playerdist < 500 ) obj_mode = mode_motos_player_search;
}
/*------------------------------------------------------------------------------*/
/* ##### */
/* ##### player search */
/* ##### */
/*------------------------------------------------------------------------------*/
static void motos_player_search(void)
{
s_set_skelanimeNo(ANM_motos_walk);
obj_speedF = 2;
s_chase_angleY(obj_targetangle,300);
if ( execstp->s[stw_mail].d & EMAIL_CARRYMODE_ON ){
obj_mode = mode_motos_player_carry;
execstp->s[stw_imm].d = 1;
}
}
/*------------------------------------------------------------------------------*/
/* ##### */
/* ##### player carry */
/* ##### */
/*------------------------------------------------------------------------------*/
static void motos_player_carry(void)
{
s_set_skelanimeNo(ANM_motos_carry_start);
if ( s_check_animeend() ) obj_mode = mode_motos_player_pitch;
}
/*------------------------------------------------------------------------------*/
/* ##### */
/* ##### search object */
/* ##### */
/*------------------------------------------------------------------------------*/
static void motos_player_pitch(void)
{
obj_speedF = 0;
s_set_skelanimeNo(ANM_motos_pitch);
if ( s_check_animenumber(14) ){
execstp->s[stw_imm].d = 2; /* nageru shyn kan */
execstp->hit_counter = 10; /* hit time wait!! */
}
if ( s_check_animeend() ){
obj_mode = mode_motos_wait;
Mbitclr(execstp->s[stw_mail].d,EMAIL_CARRYMODE_ON);
}
}
/*------------------------------------------------------------------------------*/
/* carry start */
/*------------------------------------------------------------------------------*/
static void motos_carry_start(void)
{
s_set_skelanimeNo(ANM_motos_carry_start);
if ( s_check_animeend() ){
if ( s_ai_pitch(0x200,500) ) obj_mode = mode_motos_pitch;
else obj_mode = mode_motos_carry_run;
}
}
/*------------------------------------------------------------------------------*/
/* carry run */
/*------------------------------------------------------------------------------*/
static void motos_carry_run(void)
{
obj_speedF = 5;
s_set_skelanimeNo(ANM_motos_carry_run);
if ( s_ai_pitch(0x200,500) ) obj_mode = mode_motos_pitch;
else obj_mode = mode_motos_carry_run;
}
/*------------------------------------------------------------------------------*/
/* pitch */
/*------------------------------------------------------------------------------*/
static void motos_pitch(void)
{
obj_speedF = 0;
s_set_skelanimeNo(ANM_motos_pitch);
if ( s_check_animenumber(14) ){
execstp->s[stw_imm].d = 0;
}
if ( s_check_animeend() ) obj_mode = mode_motos_wait;
}
/*------------------------------------------------------------------------------*/
/* fly */
/*------------------------------------------------------------------------------*/
static void motos_fly(void)
{
s_set_skelanimeNo(ANM_motos_walk);
if ( obj_movestatus & MOVESTAT_BGTOUCH ) obj_mode = mode_motos_wait;
}
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
static void motos_main(void)
{
s_enemybgcheck(); /* monky bgcheck */
switch (obj_mode){
case mode_motos_wait: motos_wait(); break;
case mode_motos_player_search: motos_player_search(); break;
case mode_motos_player_carry: motos_player_carry(); break;
case mode_motos_player_pitch: motos_player_pitch(); break;
case mode_motos_carry_start: motos_carry_start(); break;
case mode_motos_carry_run: motos_carry_run(); break;
case mode_motos_pitch: motos_pitch(); break;
case mode_motos_fly: motos_fly(); break;
default: rmonpf(("Error objmode motos\n")); }
s_enemymove(-78); /* monky moving */
}
/********************************************************************************
C Program
********************************************************************************/
extern void s_motos(void)
{
float f,y;
f = 5;
y = 0;
s_set_scale(2.0);
Mbitset(execstp->s[stw_enemyinfo].d,ENEMYINFO_CARRY);
switch(execstp->s[stw_actionmode].d){
case CHILEDMODE_NO_CATCH: motos_main(); break;
case CHILEDMODE_CATCH: s_mode_catch(ANM_motos_walk,mode_motos_wait); break;
case CHILEDMODE_THROW: s_mode_throw(f,y,mode_motos_fly); break;
// case CHILEDMODE_DROP: s_mode_drop(); break;
case CHILEDMODE_DROP: s_mode_throw(f,y,mode_motos_fly); break;
}
s_erase_shape(obj_playerdist,2000);
}
/*################*/
#endif
/*################*/
/*===============================================================================
end end end end end end end end
===============================================================================*/