mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Merge branch 'ACreTeam:master' into master
This commit is contained in:
+7
-7
@@ -1094,15 +1094,15 @@ config.libs = [
|
||||
Rel(
|
||||
"actor_npc",
|
||||
[
|
||||
Object(NonMatching, "actor/npc/ac_countdown_npc0.c"),
|
||||
Object(Matching, "actor/npc/ac_countdown_npc0.c"),
|
||||
Object(NonMatching, "actor/npc/ac_countdown_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_go_home_npc.c"),
|
||||
Object(NonMatching, "actor/npc/ac_groundhog_npc0.c"),
|
||||
Object(Matching, "actor/npc/ac_halloween_npc.c"),
|
||||
Object(NonMatching, "actor/npc/ac_hanabi_npc0.c"),
|
||||
Object(NonMatching, "actor/npc/ac_hanabi_npc1.c"),
|
||||
Object(NonMatching, "actor/npc/ac_hanami_npc0.c"),
|
||||
Object(NonMatching, "actor/npc/ac_hanami_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_hanabi_npc0.c"),
|
||||
Object(Matching, "actor/npc/ac_hanabi_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_hanami_npc0.c"),
|
||||
Object(Matching, "actor/npc/ac_hanami_npc1.c"),
|
||||
Object(NonMatching, "actor/npc/ac_harvest_npc0.c"),
|
||||
Object(NonMatching, "actor/npc/ac_harvest_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_hatumode_npc0.c"),
|
||||
@@ -1281,8 +1281,8 @@ config.libs = [
|
||||
Object(NonMatching, "effect/ef_kaze.c"),
|
||||
Object(NonMatching, "effect/ef_kaze_happa.c"),
|
||||
Object(Matching, "effect/ef_kigae.c"),
|
||||
Object(NonMatching, "effect/ef_kigae_light.c"),
|
||||
Object(NonMatching, "effect/ef_kikuzu.c"),
|
||||
Object(Matching, "effect/ef_kigae_light.c"),
|
||||
Object(Matching, "effect/ef_kikuzu.c"),
|
||||
Object(Matching, "effect/ef_killer.c"),
|
||||
Object(NonMatching, "effect/ef_kisha_kemuri.c"),
|
||||
Object(NonMatching, "effect/ef_konpu.c"),
|
||||
|
||||
@@ -3,11 +3,23 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct countdown_npc0_actor_s COUNTDOWN_NPC0_ACTOR;
|
||||
|
||||
typedef void (*aCD0_ACT_PROC)(COUNTDOWN_NPC0_ACTOR *actor);
|
||||
|
||||
struct countdown_npc0_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
int action;
|
||||
aCD0_ACT_PROC act_proc;
|
||||
int term;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Countdown_Npc0_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +27,3 @@ extern ACTOR_PROFILE Countdown_Npc0_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,11 +3,24 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hanabi_npc0_actor_s HANABI_NPC0_ACTOR;
|
||||
|
||||
typedef void (*aHN0_ACT_PROC)(HANABI_NPC0_ACTOR* actor);
|
||||
|
||||
struct hanabi_npc0_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
int action;
|
||||
int next_action;
|
||||
aHN0_ACT_PROC act_proc;
|
||||
s16 base_angle;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Hanabi_Npc0_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +28,3 @@ extern ACTOR_PROFILE Hanabi_Npc0_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,11 +3,26 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hanabi_npc1_actor_s HANABI_NPC1_ACTOR;
|
||||
|
||||
typedef void (*aHN1_ACT_PROC)(HANABI_NPC1_ACTOR* actor);
|
||||
|
||||
struct hanabi_npc1_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
int action;
|
||||
aHN1_ACT_PROC act_proc;
|
||||
s16 dst_pos_x;
|
||||
s16 dst_pos_z;
|
||||
int npc_idx;
|
||||
u8 clap_se_no;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Hanabi_Npc1_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +30,3 @@ extern ACTOR_PROFILE Hanabi_Npc1_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,11 +3,24 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hanami_npc0_actor_s HANAMI_NPC0_ACTOR;
|
||||
|
||||
typedef void (*aHM0_ACT_PROC)(HANAMI_NPC0_ACTOR* actor);
|
||||
|
||||
struct hanami_npc0_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
int action;
|
||||
aHM0_ACT_PROC act_proc;
|
||||
int event_idx;
|
||||
u8 clap_se_no;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Hanami_Npc0_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +28,3 @@ extern ACTOR_PROFILE Hanami_Npc0_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,11 +3,23 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hanami_npc1_actor_s HANAMI_NPC1_ACTOR;
|
||||
|
||||
typedef void (*aHM1_ACT_PROC)(HANAMI_NPC1_ACTOR* actor);
|
||||
|
||||
struct hanami_npc1_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
int action;
|
||||
int next_action;
|
||||
aHM1_ACT_PROC act_proc;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Hanami_Npc1_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +27,3 @@ extern ACTOR_PROFILE Hanami_Npc1_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
#include "ac_countdown_npc0.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
#include "m_player_lib.h"
|
||||
#include "m_font.h"
|
||||
#include "m_msg.h"
|
||||
|
||||
enum {
|
||||
aCD0_ACT_BEFORE_WAIT,
|
||||
aCD0_ACT_FREEZE_PL_WAIT,
|
||||
aCD0_ACT_AFTER_WAIT,
|
||||
aCD0_ACT_TALK_AFTER_TURN,
|
||||
|
||||
aCD0_ACT_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
aCD0_TERM_1_HOUR,
|
||||
aCD0_TERM_30_MIN,
|
||||
aCD0_TERM_10_MIN,
|
||||
aCD0_TERM_5_MIN,
|
||||
aCD0_TERM_1_MIN,
|
||||
aCD0_TERM_NEW_YEAR,
|
||||
aCD0_TERM_AFTER_10_SEC,
|
||||
|
||||
aCD0_TERM_NUM
|
||||
};
|
||||
|
||||
static void aCD0_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aCD0_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aCD0_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aCD0_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aCD0_actor_save(ACTOR* actorx, GAME* game);
|
||||
static void aCD0_actor_init(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Countdown_Npc0_Profile = {
|
||||
mAc_PROFILE_COUNTDOWN_NPC0,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(COUNTDOWN_NPC0_ACTOR),
|
||||
aCD0_actor_ct,
|
||||
aCD0_actor_dt,
|
||||
aCD0_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aCD0_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static int aCD0_demo_flg[] = {
|
||||
aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK,
|
||||
aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK,
|
||||
aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK,
|
||||
aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void aCD0_force_talk_request(ACTOR* actorx, GAME* game);
|
||||
static void aCD0_norm_talk_request(ACTOR* actorx, GAME* game);
|
||||
static int aCD0_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aCD0_talk_end_chk(ACTOR* actorx, GAME* game);
|
||||
|
||||
static void aCD0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type);
|
||||
|
||||
static void aCD0_setupAction(COUNTDOWN_NPC0_ACTOR* actor, int action);
|
||||
|
||||
static void aCD0_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aCD0_actor_move,
|
||||
aCD0_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
aCD0_norm_talk_request,
|
||||
aCD0_talk_init,
|
||||
aCD0_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)actorx;
|
||||
|
||||
actor->npc_class.schedule.schedule_proc = aCD0_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_actor_save(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aCD0_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aCD0_actor_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aCD0_actor_move(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->move_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aCD0_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_countdown_npc0_anime.c_inc"
|
||||
#include "../src/actor/npc/ac_countdown_npc0_talk.c_inc"
|
||||
@@ -0,0 +1,12 @@
|
||||
static void aCD0_set_animation(COUNTDOWN_NPC0_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static int animeSeqNo[] = {
|
||||
aNPC_ANIM_WAIT1,
|
||||
aNPC_ANIM_WAIT_KI1,
|
||||
aNPC_ANIM_WAIT_KI1,
|
||||
aNPC_ANIM_WALK1,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
NPC_CLIP->animation_init_proc((ACTOR*)actor, animeSeqNo[action], FALSE);
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
static void aCD0_set_request_act(COUNTDOWN_NPC0_ACTOR* actor) {
|
||||
actor->npc_class.request.act_priority = 4;
|
||||
actor->npc_class.request.act_idx = aNPC_ACT_SPECIAL;
|
||||
actor->npc_class.request.act_type = aNPC_ACT_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
static void aCD0_before_wait(COUNTDOWN_NPC0_ACTOR* actor) {
|
||||
if (actor->term == aCD0_TERM_NEW_YEAR) {
|
||||
aCD0_setupAction(actor, aCD0_ACT_FREEZE_PL_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_freeze_pl_wait(COUNTDOWN_NPC0_ACTOR* actor) {
|
||||
if (actor->term == aCD0_TERM_AFTER_10_SEC) {
|
||||
actor->npc_class.talk_info.default_animation = aNPC_ANIM_WAIT_KI1;
|
||||
aCD0_setupAction(actor, aCD0_ACT_AFTER_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_talk_after_turn(COUNTDOWN_NPC0_ACTOR* actor) {
|
||||
actor->npc_class.movement.mv_angl = 0;
|
||||
actor->npc_class.movement.mv_add_angl = DEG2SHORT_ANGLE2(11.25f);
|
||||
|
||||
if (actor->npc_class.actor_class.shape_info.rotation.y == 0) {
|
||||
int next_act;
|
||||
|
||||
switch (actor->term) {
|
||||
case aCD0_TERM_NEW_YEAR:
|
||||
next_act = aCD0_ACT_FREEZE_PL_WAIT;
|
||||
break;
|
||||
case aCD0_TERM_AFTER_10_SEC:
|
||||
next_act = aCD0_ACT_AFTER_WAIT;
|
||||
break;
|
||||
default:
|
||||
next_act = aCD0_ACT_BEFORE_WAIT;
|
||||
break;
|
||||
}
|
||||
|
||||
actor->npc_class.condition_info.demo_flg = aCD0_demo_flg[next_act];
|
||||
aCD0_setupAction(actor, next_act);
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_setupAction(COUNTDOWN_NPC0_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aCD0_ACT_PROC process[] = {
|
||||
aCD0_before_wait,
|
||||
aCD0_freeze_pl_wait,
|
||||
(aCD0_ACT_PROC)none_proc1,
|
||||
aCD0_talk_after_turn,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
actor->npc_class.action.step = 0;
|
||||
actor->action = action;
|
||||
actor->act_proc = process[action];
|
||||
aCD0_set_animation(actor, action);
|
||||
}
|
||||
|
||||
static void aCD0_act_chg_data_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
nactorx->action.act_obj = aNPC_ACT_OBJ_PLAYER;
|
||||
}
|
||||
|
||||
static void aCD0_act_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)nactorx;
|
||||
int next_act;
|
||||
|
||||
if (nactorx->actor_class.shape_info.rotation.y != 0) {
|
||||
next_act = aCD0_ACT_TALK_AFTER_TURN;
|
||||
} else {
|
||||
switch (actor->term) {
|
||||
case aCD0_TERM_NEW_YEAR:
|
||||
next_act = aCD0_ACT_FREEZE_PL_WAIT;
|
||||
break;
|
||||
case aCD0_TERM_AFTER_10_SEC:
|
||||
next_act = aCD0_ACT_AFTER_WAIT;
|
||||
break;
|
||||
default:
|
||||
next_act = aCD0_ACT_BEFORE_WAIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
actor->npc_class.condition_info.demo_flg = aCD0_demo_flg[next_act];
|
||||
aCD0_setupAction(actor, next_act);
|
||||
}
|
||||
|
||||
static void aCD0_act_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)nactorx;
|
||||
|
||||
actor->act_proc(actor);
|
||||
}
|
||||
|
||||
static void aCD0_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC act_proc[] = { aCD0_act_init_proc, aCD0_act_chg_data_proc, aCD0_act_main_proc };
|
||||
|
||||
(*act_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static int aCD0_get_now_term(void) {
|
||||
int now_sec = Common_Get(time.now_sec);
|
||||
int term;
|
||||
|
||||
if (now_sec > mTM_TIME2SEC(23, 59, 0)) {
|
||||
term = aCD0_TERM_1_MIN; // 1 min before
|
||||
} else if (now_sec > mTM_TIME2SEC(23, 55, 0)) {
|
||||
term = aCD0_TERM_5_MIN; // 5 min before
|
||||
} else if (now_sec > mTM_TIME2SEC(23, 50, 0)) {
|
||||
term = aCD0_TERM_10_MIN; // 10 min before
|
||||
} else if (now_sec > mTM_TIME2SEC(23, 30, 0)) {
|
||||
term = aCD0_TERM_30_MIN; // 30 min before
|
||||
} else if (now_sec > mTM_TIME2SEC(23, 0, 0)) {
|
||||
term = aCD0_TERM_1_HOUR; // 1 hour before
|
||||
} else if (now_sec < mTM_TIME2SEC(0, 0, 10)) {
|
||||
term = aCD0_TERM_NEW_YEAR; // new years
|
||||
} else {
|
||||
term = aCD0_TERM_AFTER_10_SEC; // more 10 seconds after
|
||||
}
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
static void aCD0_set_term(COUNTDOWN_NPC0_ACTOR* actor, GAME_PLAY* play) {
|
||||
int now_term = aCD0_get_now_term();
|
||||
|
||||
if (now_term != actor->term) {
|
||||
aNPC_TALK_REQUEST_PROC talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1;
|
||||
int in_same_block = TRUE;
|
||||
int bx;
|
||||
int bz;
|
||||
|
||||
mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_POOL);
|
||||
if (bx != play->block_table.block_x || bz != play->block_table.block_z) {
|
||||
in_same_block = FALSE;
|
||||
}
|
||||
|
||||
if (now_term == aCD0_TERM_NEW_YEAR) {
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_HANABI_SWITCH, actor->npc_class.actor_class.world.position, 3, 0, (GAME*)play, RSV_NO, 0, 0);
|
||||
|
||||
if (in_same_block == TRUE) {
|
||||
mPlib_request_main_demo_wait_type1((GAME*)play, FALSE, NULL);
|
||||
}
|
||||
} else if (mDemo_Get_talk_actor() == NULL) {
|
||||
if (in_same_block == TRUE) {
|
||||
talk_request_proc = aCD0_force_talk_request;
|
||||
}
|
||||
} else if (now_term == aCD0_TERM_1_MIN) {
|
||||
mEv_set_status(mEv_EVENT_NEW_YEARS_EVE_COUNTDOWN, mEv_STATUS_PLAYSOUND);
|
||||
} else if (now_term == aCD0_TERM_AFTER_10_SEC) {
|
||||
talk_request_proc = aCD0_norm_talk_request;
|
||||
}
|
||||
|
||||
actor->npc_class.talk_info.talk_request_proc = talk_request_proc;
|
||||
actor->term = now_term;
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)nactorx;
|
||||
|
||||
if (nactorx->action.step == aNPC_ACTION_END_STEP) {
|
||||
aCD0_set_request_act(actor);
|
||||
} else {
|
||||
aCD0_set_term(actor, play);
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)nactorx;
|
||||
|
||||
nactorx->think.interrupt_flags = 0;
|
||||
nactorx->action.act_proc = aCD0_act_proc;
|
||||
aCD0_set_request_act(actor);
|
||||
}
|
||||
|
||||
static void aCD0_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC think_proc[] = { aCD0_think_init_proc, aCD0_think_main_proc };
|
||||
|
||||
(*think_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aCD0_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)nactorx;
|
||||
ACTOR* actorx = (ACTOR*)nactorx;
|
||||
s16 angle;
|
||||
|
||||
nactorx->think.think_proc = aCD0_think_proc;
|
||||
nactorx->condition_info.hide_request = FALSE;
|
||||
nactorx->palActorIgnoreTimer = -1;
|
||||
actor->term = aCD0_get_now_term();
|
||||
nactorx->talk_info.default_animation = aNPC_ANIM_WAIT1;
|
||||
nactorx->collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND;
|
||||
actorx->status_data.weight = MASSTYPE_HEAVY;
|
||||
actorx->shape_info.rotation.y = 0;
|
||||
actorx->world.angle.y = 0;
|
||||
nactorx->movement.mv_angl = 0;
|
||||
|
||||
switch (actor->term) {
|
||||
case aCD0_TERM_NEW_YEAR:
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_HANABI_SWITCH, actor->npc_class.actor_class.world.position, 3, 0, (GAME*)play, RSV_NO, 0, 0);
|
||||
break;
|
||||
case aCD0_TERM_1_MIN:
|
||||
mEv_set_status(mEv_EVENT_NEW_YEARS_EVE_COUNTDOWN, mEv_STATUS_PLAYSOUND);
|
||||
nactorx->talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1;
|
||||
break;
|
||||
}
|
||||
|
||||
NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
static void aCD0_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) {
|
||||
NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
static void aCD0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC sche_proc[] = { aCD0_schedule_init_proc, aCD0_schedule_main_proc };
|
||||
|
||||
(*sche_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aCD0_set_free_str_year(u32 year) {
|
||||
u8 year_str[4];
|
||||
|
||||
mFont_UnintToString(year_str, sizeof(year_str), year, sizeof(year_str), TRUE, FALSE, FALSE);
|
||||
mMsg_SET_FREE_STR(mMsg_FREE_STR1, year_str, sizeof(year_str));
|
||||
}
|
||||
|
||||
static void aCD0_set_free_str_min(u32 min) {
|
||||
u8 min_str[4];
|
||||
int len;
|
||||
|
||||
if (min < 10) {
|
||||
len = 1;
|
||||
} else {
|
||||
len = 2;
|
||||
}
|
||||
|
||||
mFont_UnintToString(min_str, sizeof(min_str), min, len, TRUE, FALSE, FALSE);
|
||||
mMsg_SET_FREE_STR(mMsg_FREE_STR2, min_str, len);
|
||||
}
|
||||
|
||||
static void aCD0_set_free_str(void) {
|
||||
aCD0_set_free_str_year(Common_Get(time.rtc_time.year) + 1);
|
||||
aCD0_set_free_str_min((mTM_MINUTES_IN_HOUR - 1) - Common_Get(time.rtc_time.min));
|
||||
}
|
||||
|
||||
static void aCD0_set_force_talk_info(ACTOR* actorx) {
|
||||
static int msg_base[mNpc_LOOKS_NUM] = { 0x1D6B, 0x1D80, 0x1D56, 0x1D95, 0x1DAA, 0x1DBF };
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)actorx;
|
||||
int looks = mNpc_GetNpcLooks(actorx);
|
||||
int msg_no = msg_base[looks];
|
||||
|
||||
switch (actor->term) {
|
||||
case aCD0_TERM_NEW_YEAR:
|
||||
case aCD0_TERM_AFTER_10_SEC:
|
||||
msg_no += 13;
|
||||
break;
|
||||
default:
|
||||
msg_no += (actor->term - 1) * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
mDemo_Set_msg_num(msg_no);
|
||||
mDemo_Set_camera(CAMERA2_PROCESS_STOP);
|
||||
aCD0_set_free_str();
|
||||
}
|
||||
|
||||
static void aCD0_force_talk_request(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Request(mDemo_TYPE_SPEAK, actorx, aCD0_set_force_talk_info);
|
||||
}
|
||||
|
||||
static void aCD0_set_norm_talk_info(ACTOR* actorx) {
|
||||
static int msg_base[mNpc_LOOKS_NUM] = { 0x1D68, 0x1D7D, 0x1D53, 0x1D92, 0x1DA7, 0x1DBC };
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)actorx;
|
||||
int looks = mNpc_GetNpcLooks(actorx);
|
||||
int msg_no = msg_base[looks] + RANDOM(3);
|
||||
|
||||
switch (actor->term) {
|
||||
case aCD0_TERM_NEW_YEAR:
|
||||
case aCD0_TERM_AFTER_10_SEC:
|
||||
msg_no += 17;
|
||||
break;
|
||||
default:
|
||||
msg_no += actor->term * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
mDemo_Set_msg_num(msg_no);
|
||||
aCD0_set_free_str();
|
||||
}
|
||||
|
||||
static void aCD0_norm_talk_request(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Request(mDemo_TYPE_TALK, actorx, aCD0_set_norm_talk_info);
|
||||
}
|
||||
|
||||
static int aCD0_talk_init(ACTOR* actorx, GAME* game) {
|
||||
COUNTDOWN_NPC0_ACTOR* actor = (COUNTDOWN_NPC0_ACTOR*)actorx;
|
||||
int ret = FALSE;
|
||||
|
||||
if (mDemo_Check_SpeakerAble() == TRUE) {
|
||||
if (actor->term == aCD0_TERM_1_MIN) {
|
||||
if (actor->npc_class.talk_info.talk_request_proc == aCD0_force_talk_request) {
|
||||
actor->npc_class.talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1;
|
||||
} else {
|
||||
actor->npc_class.talk_info.talk_request_proc = aCD0_norm_talk_request;
|
||||
}
|
||||
} else {
|
||||
actor->npc_class.talk_info.talk_request_proc = aCD0_norm_talk_request;
|
||||
}
|
||||
|
||||
mDemo_Set_ListenAble();
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int aCD0_talk_end_chk(ACTOR* actorx, GAME* game) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (mDemo_CAN_ACTOR_TALK(actorx)) {
|
||||
if (mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 7) != 0) {
|
||||
mEv_set_status(mEv_EVENT_NEW_YEARS_EVE_COUNTDOWN, mEv_STATUS_PLAYSOUND);
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 7, 0);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
#include "ac_hanabi_npc0.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
|
||||
enum {
|
||||
aHN0_ACT_TURN,
|
||||
aHN0_ACT_WALK,
|
||||
aHN0_ACT_HURRAHS,
|
||||
|
||||
aHN0_ACT_NUM
|
||||
};
|
||||
|
||||
static void aHN0_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aHN0_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aHN0_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aHN0_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aHN0_actor_save(ACTOR* actorx, GAME* game);
|
||||
static void aHN0_actor_init(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Hanabi_Npc0_Profile = {
|
||||
mAc_PROFILE_HANABI_NPC0,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(HANABI_NPC0_ACTOR),
|
||||
aHN0_actor_ct,
|
||||
aHN0_actor_dt,
|
||||
aHN0_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aHN0_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void aHN0_talk_request(ACTOR* actorx, GAME* game);
|
||||
static int aHN0_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aHN0_talk_end_chk(ACTOR* actorx, GAME* game);
|
||||
|
||||
static void aHN0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type);
|
||||
|
||||
static void aHN0_setupAction(HANABI_NPC0_ACTOR* actor, int action);
|
||||
|
||||
static void aHN0_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aHN0_actor_move,
|
||||
aHN0_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
aHN0_talk_request,
|
||||
aHN0_talk_init,
|
||||
aHN0_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)actorx;
|
||||
|
||||
actor->npc_class.schedule.schedule_proc = aHN0_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN0_actor_save(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN0_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN0_actor_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN0_actor_move(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->move_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN0_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_hanabi_npc0_anime.c_inc"
|
||||
#include "../src/actor/npc/ac_hanabi_npc0_talk.c_inc"
|
||||
@@ -0,0 +1,19 @@
|
||||
typedef struct {
|
||||
int seq_idx;
|
||||
u8 sub_anim_type;
|
||||
} aHN0_anime_info_c;
|
||||
|
||||
static void aHN0_set_animation(HANABI_NPC0_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aHN0_anime_info_c anime[] = {
|
||||
{aNPC_ANIM_WALK_KI1, aNPC_SUB_ANIM_UTIWA},
|
||||
{aNPC_ANIM_WALK_KI1, aNPC_SUB_ANIM_UTIWA},
|
||||
{aNPC_ANIM_BANZAI1, aNPC_SUB_ANIM_NONE},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
aHN0_anime_info_c* info_p = &anime[action];
|
||||
|
||||
actor->npc_class.draw.sub_anim_type = info_p->sub_anim_type;
|
||||
NPC_CLIP->animation_init_proc((ACTOR*)actor, info_p->seq_idx, FALSE);
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
static void aHN0_set_request_act(HANABI_NPC0_ACTOR* actor) {
|
||||
actor->npc_class.request.act_priority = 4;
|
||||
actor->npc_class.request.act_idx = aNPC_ACT_SPECIAL;
|
||||
actor->npc_class.request.act_type = aNPC_ACT_TYPE_SEARCH;
|
||||
}
|
||||
|
||||
static void aHN0_make_utiwa(ACTOR* actorx, GAME* game) {
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)actorx;
|
||||
|
||||
if (actor->npc_class.right_hand.item_actor_p == NULL) {
|
||||
ACTOR* utiwa_p = CLIP(tools_clip)->aTOL_birth_proc(TOOL_UTIWA, aTOL_ACTION_S_TAKEOUT, actorx, game, -1, NULL);
|
||||
|
||||
if (utiwa_p != NULL) {
|
||||
actor->npc_class.right_hand.item_actor_p = utiwa_p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int aHN0_check_moveRange(ACTOR* actorx, xyz_t* pos) {
|
||||
f32 max_dist = 100.0f;
|
||||
f32 dx = actorx->home.position.x - pos->x;
|
||||
f32 dz = actorx->home.position.z - pos->z;
|
||||
int ret = FALSE;
|
||||
|
||||
if (SQ(dx) + SQ(dz) > SQ(max_dist)) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int aHN0_check_inBlock(ACTOR* actorx, xyz_t* pos, int* bx, int* bz) {
|
||||
int ret = FALSE;
|
||||
|
||||
mFI_Wpos2BlockNum(bx, bz, *pos);
|
||||
if (*bx != actorx->block_x || *bz != actorx->block_z) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void aHN0_revise_moveRange(ACTOR* actorx) {
|
||||
static f32 offset[] = { 0.0f, 319.0f };
|
||||
int col_flags = 0;
|
||||
|
||||
if (aHN0_check_moveRange(actorx, &actorx->world.position) == TRUE) {
|
||||
s16 angle = search_position_angleY(&actorx->home.position, &actorx->world.position);
|
||||
|
||||
actorx->world.position.x = actorx->home.position.x + sin_s(angle) * 100.0f;
|
||||
actorx->world.position.z = actorx->home.position.z + cos_s(angle) * 100.0f;
|
||||
col_flags = mCoBG_HIT_WALL | mCoBG_HIT_WALL_FRONT;
|
||||
} else {
|
||||
int bx;
|
||||
int bz;
|
||||
|
||||
if (aHN0_check_inBlock(actorx, &actorx->world.position, &bx, &bz) == TRUE) {
|
||||
f32 x;
|
||||
f32 z;
|
||||
|
||||
mFI_BkNum2WposXZ(&x, &z, actorx->block_x, actorx->block_z);
|
||||
if (bx != actorx->block_x) {
|
||||
int idx = actorx->block_x < bx;
|
||||
|
||||
actorx->world.position.x = x + offset[idx];
|
||||
}
|
||||
|
||||
if (bz != actorx->block_z) {
|
||||
int idx = actorx->block_z < bz;
|
||||
|
||||
actorx->world.position.z = z + offset[idx];
|
||||
}
|
||||
|
||||
col_flags = mCoBG_HIT_WALL | mCoBG_HIT_WALL_FRONT;
|
||||
}
|
||||
}
|
||||
|
||||
((NPC_ACTOR*)actorx)->collision.collision_flag |= col_flags;
|
||||
}
|
||||
|
||||
static void aHN0_turn(HANABI_NPC0_ACTOR* actor) {
|
||||
if (chase_angle(&actor->npc_class.actor_class.shape_info.rotation.y, actor->npc_class.movement.mv_angl, DEG2SHORT_ANGLE2(11.25f)) == TRUE) {
|
||||
actor->next_action = aHN0_ACT_WALK;
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
}
|
||||
|
||||
actor->npc_class.actor_class.world.angle.y = actor->npc_class.actor_class.shape_info.rotation.y;
|
||||
}
|
||||
|
||||
static void aHN0_walk(HANABI_NPC0_ACTOR* actor) {
|
||||
ACTOR* actorx = (ACTOR*)actor;
|
||||
|
||||
aHN0_revise_moveRange(actorx);
|
||||
if (actor->npc_class.collision.collision_flag != 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else if (actor->npc_class.movement.move_timer > 60) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
}
|
||||
|
||||
chase_angle(&actorx->shape_info.rotation.y, actor->npc_class.movement.mv_angl, DEG2SHORT_ANGLE2(5.625f));
|
||||
actorx->world.angle.y = actorx->shape_info.rotation.y;
|
||||
}
|
||||
|
||||
static void aHN0_hurrahs(HANABI_NPC0_ACTOR* actor) {
|
||||
if (actor->npc_class.draw.main_animation_state == cKF_STATE_CONTINUE) {
|
||||
if (actor->npc_class.draw.loop_flag == 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else {
|
||||
actor->npc_class.draw.loop_flag--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN0_set_spd_info(HANABI_NPC0_ACTOR* actor, int action) {
|
||||
if (action == aHN0_ACT_WALK) {
|
||||
actor->npc_class.movement.speed.max_speed = 1.0f;
|
||||
actor->npc_class.movement.speed.acceleration = 0.1f;
|
||||
actor->npc_class.movement.speed.deceleration = 0.1f;
|
||||
} else {
|
||||
actor->npc_class.actor_class.speed = 0.0f;
|
||||
actor->npc_class.movement.speed.max_speed = 0.0f;
|
||||
actor->npc_class.movement.speed.acceleration = 0.0f;
|
||||
actor->npc_class.movement.speed.deceleration = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN0_setupAction(HANABI_NPC0_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aHN0_ACT_PROC process[] = {
|
||||
aHN0_turn,
|
||||
aHN0_walk,
|
||||
aHN0_hurrahs,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
actor->npc_class.action.step = 0;
|
||||
actor->action = action;
|
||||
actor->act_proc = process[action];
|
||||
aHN0_set_animation(actor, action);
|
||||
aHN0_set_spd_info(actor, action);
|
||||
|
||||
if (action == aHN0_ACT_HURRAHS) {
|
||||
actor->npc_class.movement.mv_angl = actor->base_angle;
|
||||
actor->npc_class.movement.mv_add_angl = DEG2SHORT_ANGLE2(11.25f);
|
||||
actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
} else {
|
||||
actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN0_act_chg_data_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
nactorx->action.act_obj = aNPC_ACT_OBJ_PLAYER;
|
||||
}
|
||||
|
||||
static void aHN0_act_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
aHN0_setupAction(actor, aHN0_ACT_WALK);
|
||||
}
|
||||
|
||||
static void aHN0_act_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
actor->act_proc(actor);
|
||||
}
|
||||
|
||||
static void aHN0_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC act_proc[] = { aHN0_act_init_proc, aHN0_act_chg_data_proc, aHN0_act_main_proc };
|
||||
|
||||
(*act_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHN0_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
static f32 chk_val[] = { 0.05f, 0.3f };
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
if (nactorx->action.step == aNPC_ACTION_END_STEP) {
|
||||
if (nactorx->action.idx == aNPC_ACT_SPECIAL) {
|
||||
int next_act;
|
||||
|
||||
if (actor->next_action != -1) {
|
||||
next_act = actor->next_action;
|
||||
} else {
|
||||
aNPC_attention_c* attention_p = &NPC_CLIP->attention;
|
||||
int idx;
|
||||
|
||||
if (attention_p->type != aNPC_ATT_TYPE_NONE) {
|
||||
idx = 1;
|
||||
} else {
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
if (RANDOM_F(1.0f) < chk_val[idx]) {
|
||||
nactorx->draw.loop_flag = 2;
|
||||
next_act = aHN0_ACT_HURRAHS;
|
||||
} else {
|
||||
s16 move_angle = (s16)((RANDOM_F(1.0f) - 0.5f) * 65536.0f);
|
||||
s16 diff_angle;
|
||||
|
||||
nactorx->movement.mv_angl = move_angle;
|
||||
diff_angle = DIFF_SHORT_ANGLE(move_angle, actor->npc_class.actor_class.shape_info.rotation.y);
|
||||
if (ABS(diff_angle) > DEG2SHORT_ANGLE2(135.0f)) {
|
||||
next_act = aHN0_ACT_TURN;
|
||||
} else if ((nactorx->collision.collision_flag & (mCoBG_HIT_WALL | mCoBG_HIT_WALL_FRONT)) == 0) {
|
||||
next_act = aHN0_ACT_WALK;
|
||||
} else {
|
||||
next_act = aHN0_ACT_TURN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nactorx->movement.move_timer = 0;
|
||||
aHN0_setupAction(actor, next_act);
|
||||
}
|
||||
|
||||
actor->next_action = -1;
|
||||
aHN0_set_request_act(actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN0_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
nactorx->think.interrupt_flags = 0;
|
||||
nactorx->action.act_proc = aHN0_act_proc;
|
||||
aHN0_set_request_act(actor);
|
||||
}
|
||||
|
||||
static void aHN0_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC think_proc[] = { aHN0_think_init_proc, aHN0_think_main_proc };
|
||||
|
||||
(*think_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHN0_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC0_ACTOR* actor = (HANABI_NPC0_ACTOR*)nactorx;
|
||||
ACTOR* actorx = (ACTOR*)nactorx;
|
||||
s16 angle;
|
||||
|
||||
nactorx->think.think_proc = aHN0_think_proc;
|
||||
nactorx->palActorIgnoreTimer = -1;
|
||||
actor->next_action = -1;
|
||||
nactorx->condition_info.hide_request = FALSE;
|
||||
actorx->status_data.weight = MASSTYPE_HEAVY;
|
||||
|
||||
angle = RANDOM_F(65536.0f);
|
||||
actorx->shape_info.rotation.y = angle;
|
||||
actorx->world.angle.y = angle;
|
||||
actor->base_angle = angle;
|
||||
|
||||
NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
static void aHN0_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) {
|
||||
NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN);
|
||||
}
|
||||
|
||||
aHN0_make_utiwa((ACTOR*)nactorx, (GAME*)play);
|
||||
}
|
||||
|
||||
static void aHN0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC schedule_proc[] = { aHN0_schedule_init_proc, aHN0_schedule_main_proc };
|
||||
|
||||
(*schedule_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHN0_set_talk_info(ACTOR* actorx) {
|
||||
static int msg_base[mNpc_LOOKS_NUM] = { 0x164F, 0x165E, 0x1640, 0x166D, 0x167C, 0x168B };
|
||||
int looks = mNpc_GetNpcLooks(actorx);
|
||||
|
||||
mDemo_Set_msg_num(msg_base[looks] + RANDOM(3));
|
||||
}
|
||||
|
||||
static void aHN0_talk_request(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Request(mDemo_TYPE_TALK, actorx, aHN0_set_talk_info);
|
||||
}
|
||||
|
||||
static int aHN0_talk_init(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Set_ListenAble();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int aHN0_talk_end_chk(ACTOR* actorx, GAME* game) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "ac_hanabi_npc1.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
|
||||
enum {
|
||||
aHN1_ACT_TURN,
|
||||
aHN1_ACT_FAN,
|
||||
aHN1_ACT_CLAPPING,
|
||||
aHN1_ACT_HURRAHS,
|
||||
|
||||
aHN1_ACT_NUM
|
||||
};
|
||||
|
||||
static void aHN1_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aHN1_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aHN1_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aHN1_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aHN1_actor_save(ACTOR* actorx, GAME* game);
|
||||
static void aHN1_actor_init(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Hanabi_Npc1_Profile = {
|
||||
mAc_PROFILE_HANABI_NPC1,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(HANABI_NPC1_ACTOR),
|
||||
aHN1_actor_ct,
|
||||
aHN1_actor_dt,
|
||||
aHN1_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aHN1_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void aHN1_talk_request(ACTOR* actorx, GAME* game);
|
||||
static int aHN1_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aHN1_talk_end_chk(ACTOR* actorx, GAME* game);
|
||||
|
||||
static void aHN1_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type);
|
||||
|
||||
static void aHN1_setupAction(HANABI_NPC1_ACTOR* actor, int action);
|
||||
|
||||
static void aHN1_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aHN1_actor_move,
|
||||
aHN1_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
aHN1_talk_request,
|
||||
aHN1_talk_init,
|
||||
aHN1_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)actorx;
|
||||
|
||||
actor->npc_class.schedule.schedule_proc = aHN1_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
actor->npc_class.palActorIgnoreTimer = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_actor_save(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN1_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN1_actor_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN1_actor_move(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->move_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHN1_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_hanabi_npc1_anime.c_inc"
|
||||
#include "../src/actor/npc/ac_hanabi_npc1_talk.c_inc"
|
||||
@@ -0,0 +1,20 @@
|
||||
typedef struct {
|
||||
int seq_idx;
|
||||
u8 sub_anim_type;
|
||||
} aHN1_anime_info_c;
|
||||
|
||||
static void aHN1_set_animation(HANABI_NPC1_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aHN1_anime_info_c anime[] = {
|
||||
{aNPC_ANIM_WALK1, aNPC_SUB_ANIM_UTIWA},
|
||||
{aNPC_ANIM_WAIT1, aNPC_SUB_ANIM_UTIWA},
|
||||
{aNPC_ANIM_CLAP1, aNPC_SUB_ANIM_NONE},
|
||||
{aNPC_ANIM_BANZAI1, aNPC_SUB_ANIM_NONE},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
aHN1_anime_info_c* info_p = &anime[action];
|
||||
|
||||
actor->npc_class.draw.sub_anim_type = info_p->sub_anim_type;
|
||||
NPC_CLIP->animation_init_proc((ACTOR*)actor, info_p->seq_idx, FALSE);
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
static void aHN1_set_request_act(HANABI_NPC1_ACTOR* actor) {
|
||||
actor->npc_class.request.act_priority = 4;
|
||||
actor->npc_class.request.act_idx = aNPC_ACT_SPECIAL;
|
||||
actor->npc_class.request.act_type = aNPC_ACT_TYPE_SEARCH;
|
||||
}
|
||||
|
||||
static void aHN1_make_utiwa(ACTOR* actorx, GAME* game) {
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)actorx;
|
||||
|
||||
if (actor->npc_class.right_hand.item_actor_p == NULL) {
|
||||
ACTOR* utiwa_p = CLIP(tools_clip)->aTOL_birth_proc(TOOL_UTIWA, aTOL_ACTION_S_TAKEOUT, actorx, game, -1, NULL);
|
||||
|
||||
if (utiwa_p != NULL) {
|
||||
actor->npc_class.right_hand.item_actor_p = utiwa_p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_turn(HANABI_NPC1_ACTOR* actor) {
|
||||
if (actor->npc_class.actor_class.shape_info.rotation.y == actor->npc_class.movement.mv_angl) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_fan(HANABI_NPC1_ACTOR* actor) {
|
||||
if (actor->npc_class.draw.main_animation_state == cKF_STATE_CONTINUE) {
|
||||
if (actor->npc_class.draw.loop_flag == 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else {
|
||||
actor->npc_class.draw.loop_flag--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_hurrahs(HANABI_NPC1_ACTOR* actor) {
|
||||
aNPC_attention_c* attention_p = &NPC_CLIP->attention;
|
||||
|
||||
if (attention_p->type == aNPC_ATT_TYPE_NONE) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else if (actor->npc_class.draw.main_animation_state == cKF_STATE_CONTINUE) {
|
||||
if (actor->npc_class.draw.loop_flag == 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else {
|
||||
actor->npc_class.draw.loop_flag--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_clapping(HANABI_NPC1_ACTOR* actor) {
|
||||
aHN1_hurrahs(actor);
|
||||
sAdo_OngenPos((u32)actor, actor->clap_se_no, &actor->npc_class.actor_class.world.position);
|
||||
}
|
||||
|
||||
static void aHN1_setupAction(HANABI_NPC1_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aHN1_ACT_PROC process[] = {
|
||||
aHN1_turn,
|
||||
aHN1_fan,
|
||||
aHN1_clapping,
|
||||
aHN1_hurrahs,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static int anm_loop_base[] = { 0, 1, 3, 3 };
|
||||
static f32 anm_loop_rnd[] = { 0.0f, 2.0f, 4.0f, 4.0f };
|
||||
static u8 clap_se_no[] = { NA_SE_2F, NA_SE_31, NA_SE_32, NA_SE_33 };
|
||||
|
||||
actor->npc_class.action.step = 0;
|
||||
actor->action = action;
|
||||
actor->act_proc = process[action];
|
||||
actor->npc_class.draw.loop_flag = anm_loop_base[action] + RANDOM(anm_loop_rnd[action]);
|
||||
aHN1_set_animation(actor, action);
|
||||
|
||||
switch (action) {
|
||||
case aHN1_ACT_HURRAHS:
|
||||
actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
break;
|
||||
case aHN1_ACT_CLAPPING:
|
||||
actor->clap_se_no = clap_se_no[RANDOM(ARRAY_COUNT(clap_se_no))];
|
||||
actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
break;
|
||||
default:
|
||||
actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_act_chg_data_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
nactorx->action.act_obj = aNPC_ACT_OBJ_PLAYER;
|
||||
}
|
||||
|
||||
static void aHN1_act_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
NPC_CLIP->set_dst_pos_proc(nactorx, actor->dst_pos_x, actor->dst_pos_z);
|
||||
nactorx->movement.mv_add_angl = DEG2SHORT_ANGLE2(11.25f);
|
||||
aHN1_setupAction(actor, aHN1_ACT_TURN);
|
||||
}
|
||||
|
||||
static void aHN1_act_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
actor->act_proc(actor);
|
||||
}
|
||||
|
||||
static void aHN1_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC act_proc[] = { aHN1_act_init_proc, aHN1_act_chg_data_proc, aHN1_act_main_proc };
|
||||
|
||||
(*act_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHN1_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
static int action[] = { aHN1_ACT_FAN, aHN1_ACT_CLAPPING, aHN1_ACT_HURRAHS };
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
if (actor->npc_class.action.step == aNPC_ACTION_END_STEP) {
|
||||
if (actor->npc_class.action.idx == aNPC_ACT_SPECIAL) {
|
||||
aNPC_attention_c* attention_p = &NPC_CLIP->attention;
|
||||
int next_act;
|
||||
|
||||
if (attention_p->type == aNPC_ATT_TYPE_NONE) {
|
||||
next_act = aHN1_ACT_FAN;
|
||||
} else {
|
||||
int idx;
|
||||
|
||||
if (actor->action == aHN1_ACT_FAN) {
|
||||
idx = 1;
|
||||
} else {
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
idx += (actor->npc_idx & 1);
|
||||
next_act = action[idx];
|
||||
}
|
||||
|
||||
aHN1_setupAction(actor, next_act);
|
||||
}
|
||||
|
||||
aHN1_set_request_act(actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHN1_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
nactorx->think.interrupt_flags = 0;
|
||||
nactorx->action.act_proc = aHN1_act_proc;
|
||||
aHN1_set_request_act(actor);
|
||||
}
|
||||
|
||||
static void aHN1_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC think_proc[] = { aHN1_think_init_proc, aHN1_think_main_proc };
|
||||
|
||||
(*think_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHN1_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
// clang-format off
|
||||
static s16 def_angle[4][7] = {
|
||||
{DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(45.0f), DEG2SHORT_ANGLE(45.0f), DEG2SHORT_ANGLE(45.0f), DEG2SHORT_ANGLE(90.0f), DEG2SHORT_ANGLE(90.0f), DEG2SHORT_ANGLE(315.0f)},
|
||||
{DEG2SHORT_ANGLE(135.0f), DEG2SHORT_ANGLE(315.0f), DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(225.0f), DEG2SHORT_ANGLE(0.0f), DEG2SHORT_ANGLE(135.0f)},
|
||||
{DEG2SHORT_ANGLE(270.0f), DEG2SHORT_ANGLE(90.0f), DEG2SHORT_ANGLE(270.0f), DEG2SHORT_ANGLE(90.0f), DEG2SHORT_ANGLE(45.0f), DEG2SHORT_ANGLE(180.0f), DEG2SHORT_ANGLE(90.0f)},
|
||||
{DEG2SHORT_ANGLE(315.0f), DEG2SHORT_ANGLE(270.0f), DEG2SHORT_ANGLE(180.0f), DEG2SHORT_ANGLE(180.0f), DEG2SHORT_ANGLE(90.0f), DEG2SHORT_ANGLE(180.0f), DEG2SHORT_ANGLE(0.0f)},
|
||||
};
|
||||
// clang-format on
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)nactorx;
|
||||
ACTOR* actorx = (ACTOR*)nactorx;
|
||||
|
||||
nactorx->think.think_proc = aHN1_think_proc;
|
||||
nactorx->condition_info.hide_request = FALSE;
|
||||
nactorx->collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND;
|
||||
actorx->status_data.weight = MASSTYPE_HEAVY;
|
||||
|
||||
{
|
||||
int pool_idx = mFI_GetPuleIdx();
|
||||
int npc_idx = actorx->npc_id - SP_NPC_EV_HANABI_1;
|
||||
s16 angle = def_angle[npc_idx][pool_idx];
|
||||
|
||||
actorx->shape_info.rotation.y = angle;
|
||||
actorx->world.angle.y = angle;
|
||||
actor->dst_pos_x = actorx->home.position.x + sin_s(angle) * mFI_UNIT_BASE_SIZE_F;
|
||||
actor->dst_pos_z = actorx->home.position.z + cos_s(angle) * mFI_UNIT_BASE_SIZE_F;
|
||||
actor->npc_idx = npc_idx;
|
||||
}
|
||||
|
||||
NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
static void aHN1_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) {
|
||||
NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN);
|
||||
}
|
||||
|
||||
aHN1_make_utiwa((ACTOR*)nactorx, (GAME*)play);
|
||||
}
|
||||
|
||||
static void aHN1_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC schedule_proc[] = { aHN1_schedule_init_proc, aHN1_schedule_main_proc };
|
||||
|
||||
(*schedule_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHN1_set_talk_info(ACTOR* actorx) {
|
||||
static int msg_base[mNpc_LOOKS_NUM] = { 0x1652, 0x1661, 0x1643, 0x1670, 0x167F, 0x168E };
|
||||
HANABI_NPC1_ACTOR* actor = (HANABI_NPC1_ACTOR*)actorx;
|
||||
int looks = mNpc_GetNpcLooks(actorx);
|
||||
|
||||
mDemo_Set_msg_num(msg_base[looks] + RANDOM(3) + actor->npc_idx * 3);
|
||||
}
|
||||
|
||||
static void aHN1_talk_request(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Request(mDemo_TYPE_TALK, actorx, aHN1_set_talk_info);
|
||||
}
|
||||
|
||||
static int aHN1_talk_init(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Set_ListenAble();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int aHN1_talk_end_chk(ACTOR* actorx, GAME* game) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
#include "ac_hanami_npc0.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
|
||||
enum {
|
||||
aHM0_ACT_WAIT,
|
||||
aHM0_ACT_MERRY,
|
||||
aHM0_ACT_DRINK,
|
||||
|
||||
aHM0_ACT_NUM
|
||||
};
|
||||
|
||||
static void aHM0_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aHM0_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aHM0_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aHM0_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aHM0_actor_save(ACTOR* actorx, GAME* game);
|
||||
static void aHM0_actor_init(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Hanami_Npc0_Profile = {
|
||||
mAc_PROFILE_HANAMI_NPC0,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(HANAMI_NPC0_ACTOR),
|
||||
aHM0_actor_ct,
|
||||
aHM0_actor_dt,
|
||||
aHM0_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aHM0_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void aHM0_talk_request(ACTOR* actorx, GAME* game);
|
||||
static int aHM0_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aHM0_talk_end_chk(ACTOR* actorx, GAME* game);
|
||||
|
||||
static void aHM0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type);
|
||||
|
||||
static void aHM0_setupAction(HANAMI_NPC0_ACTOR* actor, int action);
|
||||
|
||||
static void aHM0_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aHM0_actor_move,
|
||||
aHM0_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
aHM0_talk_request,
|
||||
aHM0_talk_init,
|
||||
aHM0_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)actorx;
|
||||
|
||||
actor->npc_class.schedule.schedule_proc = aHM0_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM0_actor_save(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM0_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM0_actor_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM0_actor_move(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->move_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM0_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_hanami_npc0_anime.c_inc"
|
||||
#include "../src/actor/npc/ac_hanami_npc0_talk.c_inc"
|
||||
@@ -0,0 +1,11 @@
|
||||
static void aHM0_set_animation(HANAMI_NPC0_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static int animeSeqNo[] = {
|
||||
aNPC_ANIM_SITDOWN_WAIT1,
|
||||
aNPC_ANIM_SITDOWN_CLAP1,
|
||||
aNPC_ANIM_SITDOWN_DRINK1,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
NPC_CLIP->animation_init_proc((ACTOR*)actor, animeSeqNo[action], FALSE);
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
static void aHM0_set_request_act(HANAMI_NPC0_ACTOR* actor) {
|
||||
actor->npc_class.request.act_priority = 4;
|
||||
actor->npc_class.request.act_idx = aNPC_ACT_SPECIAL;
|
||||
actor->npc_class.request.act_type = aNPC_ACT_TYPE_SEARCH;
|
||||
}
|
||||
|
||||
static void aHM0_make_tumbler(ACTOR* actorx, GAME* game) {
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)actorx;
|
||||
|
||||
if ((actor->event_idx & 1) == 1 && actor->npc_class.right_hand.item_actor_p == NULL) {
|
||||
ACTOR* utiwa_p = CLIP(tools_clip)->aTOL_birth_proc(TOOL_TUMBLER, aTOL_ACTION_S_TAKEOUT, actorx, game, -1, NULL);
|
||||
|
||||
if (utiwa_p != NULL) {
|
||||
actor->npc_class.right_hand.item_actor_p = utiwa_p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM0_wait(HANAMI_NPC0_ACTOR* actor) {
|
||||
if (actor->npc_class.draw.main_animation_state == cKF_STATE_CONTINUE) {
|
||||
if (actor->npc_class.draw.loop_flag == 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else {
|
||||
actor->npc_class.draw.loop_flag--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM0_merry(HANAMI_NPC0_ACTOR* actor) {
|
||||
if (actor->npc_class.draw.main_animation_state == cKF_STATE_CONTINUE) {
|
||||
if (actor->npc_class.draw.loop_flag == 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else {
|
||||
actor->npc_class.draw.loop_flag--;
|
||||
}
|
||||
}
|
||||
|
||||
sAdo_OngenPos((u32)actor, actor->clap_se_no, &actor->npc_class.actor_class.world.position);
|
||||
}
|
||||
|
||||
static void aHM0_drink(HANAMI_NPC0_ACTOR* actor) {
|
||||
if (actor->npc_class.draw.main_animation_state == cKF_STATE_STOPPED) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM0_setupAction(HANAMI_NPC0_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aHM0_ACT_PROC process[] = {
|
||||
aHM0_wait,
|
||||
aHM0_merry,
|
||||
aHM0_drink,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static int anm_loop_base[] = { 1, 2, 1 };
|
||||
static f32 anm_loop_rnd[] = { 2.0f, 3.0f, 1.0f };
|
||||
static u8 clap_se_no[] = { NA_SE_2F, NA_SE_31, NA_SE_32, NA_SE_33 };
|
||||
|
||||
actor->npc_class.action.step = 0;
|
||||
actor->action = action;
|
||||
actor->act_proc = process[action];
|
||||
actor->npc_class.draw.loop_flag = anm_loop_base[action] + RANDOM(anm_loop_rnd[action]);
|
||||
aHM0_set_animation(actor, action);
|
||||
|
||||
if (action == aHM0_ACT_MERRY) {
|
||||
actor->clap_se_no = clap_se_no[RANDOM(ARRAY_COUNT(clap_se_no))];
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM0_act_chg_data_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
nactorx->action.act_obj = aNPC_ACT_OBJ_PLAYER;
|
||||
}
|
||||
|
||||
static void aHM0_act_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
aHM0_setupAction(actor, aHM0_ACT_WAIT);
|
||||
}
|
||||
|
||||
static void aHM0_act_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
actor->act_proc(actor);
|
||||
}
|
||||
|
||||
static void aHM0_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC act_proc[] = { aHM0_act_init_proc, aHM0_act_chg_data_proc, aHM0_act_main_proc };
|
||||
|
||||
(*act_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHM0_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
static int action[] = { aHM0_ACT_WAIT, aHM0_ACT_MERRY, aHM0_ACT_DRINK };
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
if (actor->npc_class.action.step == aNPC_ACTION_END_STEP) {
|
||||
if (actor->npc_class.action.idx == aNPC_ACT_SPECIAL) {
|
||||
int idx;
|
||||
|
||||
idx = RANDOM(2);
|
||||
idx <<= (actor->event_idx & 1);
|
||||
aHM0_setupAction(actor, action[idx]);
|
||||
|
||||
}
|
||||
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
nactorx->collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND;
|
||||
aHM0_set_request_act(actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM0_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)nactorx;
|
||||
|
||||
nactorx->think.interrupt_flags = 0;
|
||||
nactorx->action.act_proc = aHM0_act_proc;
|
||||
aHM0_set_request_act(actor);
|
||||
}
|
||||
|
||||
static void aHM0_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC think_proc[] = { aHM0_think_init_proc, aHM0_think_main_proc };
|
||||
|
||||
(*think_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHM0_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
static s16 def_angle[4] = {DEG2SHORT_ANGLE2(45.0f), DEG2SHORT_ANGLE2(-90.0f), DEG2SHORT_ANGLE2(-45.0f), DEG2SHORT_ANGLE2(90.0f)};
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)nactorx;
|
||||
ACTOR* actorx = (ACTOR*)nactorx;
|
||||
int event_idx = actorx->npc_id - SP_NPC_EV_HANAMI_0;
|
||||
|
||||
nactorx->think.think_proc = aHM0_think_proc;
|
||||
nactorx->condition_info.hide_request = FALSE;
|
||||
nactorx->palActorIgnoreTimer = -1;
|
||||
nactorx->talk_info.turn = aNPC_TALK_TURN_HEAD;
|
||||
nactorx->talk_info.default_animation = aNPC_ANIM_SITDOWN_WAIT1;
|
||||
actor->event_idx = event_idx;
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
nactorx->collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND;
|
||||
actorx->status_data.weight = MASSTYPE_HEAVY;
|
||||
|
||||
{
|
||||
s16 angle = def_angle[event_idx];
|
||||
|
||||
actorx->shape_info.rotation.y = angle;
|
||||
actorx->world.angle.y = angle;
|
||||
nactorx->movement.mv_angl = angle;
|
||||
}
|
||||
|
||||
NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
static void aHM0_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) {
|
||||
NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN);
|
||||
}
|
||||
|
||||
aHM0_make_tumbler((ACTOR*)nactorx, (GAME*)play);
|
||||
}
|
||||
|
||||
static void aHM0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC schedule_proc[] = { aHM0_schedule_init_proc, aHM0_schedule_main_proc };
|
||||
|
||||
(*schedule_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHM0_set_talk_info(ACTOR* actorx) {
|
||||
static int msg_base[mNpc_LOOKS_NUM] = { 0x192D, 0x193C, 0x191E, 0x194B, 0x195A, 0x1969 };
|
||||
HANAMI_NPC0_ACTOR* actor = (HANAMI_NPC0_ACTOR*)actorx;
|
||||
int looks = mNpc_GetNpcLooks(actorx);
|
||||
|
||||
mDemo_Set_msg_num(msg_base[looks] + RANDOM(3) + actor->event_idx * 3);
|
||||
}
|
||||
|
||||
static void aHM0_talk_request(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Request(mDemo_TYPE_TALK, actorx, aHM0_set_talk_info);
|
||||
}
|
||||
|
||||
static int aHM0_talk_init(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Set_ListenAble();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int aHM0_talk_end_chk(ACTOR* actorx, GAME* game) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "ac_hanami_npc1.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
|
||||
enum {
|
||||
aHM1_ACT_TURN,
|
||||
aHM1_ACT_WALK,
|
||||
|
||||
aHM1_ACT_NUM
|
||||
};
|
||||
|
||||
static void aHM1_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aHM1_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aHM1_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aHM1_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aHM1_actor_save(ACTOR* actorx, GAME* game);
|
||||
static void aHM1_actor_init(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Hanami_Npc1_Profile = {
|
||||
mAc_PROFILE_HANAMI_NPC1,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(HANAMI_NPC1_ACTOR),
|
||||
aHM1_actor_ct,
|
||||
aHM1_actor_dt,
|
||||
aHM1_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aHM1_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void aHM1_talk_request(ACTOR* actorx, GAME* game);
|
||||
static int aHM1_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aHM1_talk_end_chk(ACTOR* actorx, GAME* game);
|
||||
|
||||
static void aHM1_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type);
|
||||
|
||||
static void aHM1_setupAction(HANAMI_NPC1_ACTOR* actor, int action);
|
||||
|
||||
static void aHM1_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aHM1_actor_move,
|
||||
aHM1_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
aHM1_talk_request,
|
||||
aHM1_talk_init,
|
||||
aHM1_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
HANAMI_NPC1_ACTOR* actor = (HANAMI_NPC1_ACTOR*)actorx;
|
||||
|
||||
actor->npc_class.schedule.schedule_proc = aHM1_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM1_actor_save(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM1_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM1_actor_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM1_actor_move(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->move_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aHM1_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_hanami_npc1_anime.c_inc"
|
||||
#include "../src/actor/npc/ac_hanami_npc1_talk.c_inc"
|
||||
@@ -0,0 +1,10 @@
|
||||
static void aHM1_set_animation(HANAMI_NPC1_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static int animeSeqNo[] = {
|
||||
aNPC_ANIM_DANCE1,
|
||||
aNPC_ANIM_DANCE1,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
NPC_CLIP->animation_init_proc((ACTOR*)actor, animeSeqNo[action], FALSE);
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
static void aHM1_set_request_act(HANAMI_NPC1_ACTOR* actor) {
|
||||
actor->npc_class.request.act_priority = 4;
|
||||
actor->npc_class.request.act_idx = aNPC_ACT_SPECIAL;
|
||||
actor->npc_class.request.act_type = aNPC_ACT_TYPE_SEARCH;
|
||||
}
|
||||
|
||||
static int aHM1_check_moveRange(ACTOR* actorx, xyz_t* pos) {
|
||||
f32 max_dist = 100.0f;
|
||||
f32 dx = actorx->home.position.x - pos->x;
|
||||
f32 dz = actorx->home.position.z - pos->z;
|
||||
int ret = FALSE;
|
||||
|
||||
if (SQ(dx) + SQ(dz) > SQ(max_dist)) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int aHM1_check_inBlock(ACTOR* actorx, xyz_t* pos, int* bx, int* bz) {
|
||||
int ret = FALSE;
|
||||
|
||||
mFI_Wpos2BlockNum(bx, bz, *pos);
|
||||
if (*bx != actorx->block_x || *bz != actorx->block_z) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void aHM1_revise_moveRange(ACTOR* actorx) {
|
||||
static f32 offset[] = { 0.0f, 319.0f };
|
||||
int col_flags = 0;
|
||||
|
||||
if (aHM1_check_moveRange(actorx, &actorx->world.position) == TRUE) {
|
||||
s16 angle = search_position_angleY(&actorx->home.position, &actorx->world.position);
|
||||
|
||||
actorx->world.position.x = actorx->home.position.x + sin_s(angle) * 100.0f;
|
||||
actorx->world.position.z = actorx->home.position.z + cos_s(angle) * 100.0f;
|
||||
col_flags = mCoBG_HIT_WALL | mCoBG_HIT_WALL_FRONT;
|
||||
} else {
|
||||
int bx;
|
||||
int bz;
|
||||
|
||||
if (aHM1_check_inBlock(actorx, &actorx->world.position, &bx, &bz) == TRUE) {
|
||||
f32 x;
|
||||
f32 z;
|
||||
|
||||
mFI_BkNum2WposXZ(&x, &z, actorx->block_x, actorx->block_z);
|
||||
if (bx != actorx->block_x) {
|
||||
int idx = actorx->block_x < bx;
|
||||
|
||||
actorx->world.position.x = x + offset[idx];
|
||||
}
|
||||
|
||||
if (bz != actorx->block_z) {
|
||||
int idx = actorx->block_z < bz;
|
||||
|
||||
actorx->world.position.z = z + offset[idx];
|
||||
}
|
||||
|
||||
col_flags = mCoBG_HIT_WALL | mCoBG_HIT_WALL_FRONT;
|
||||
}
|
||||
}
|
||||
|
||||
((NPC_ACTOR*)actorx)->collision.collision_flag |= col_flags;
|
||||
}
|
||||
|
||||
static void aHM1_turn(HANAMI_NPC1_ACTOR* actor) {
|
||||
if (chase_angle(&actor->npc_class.actor_class.shape_info.rotation.y, actor->npc_class.movement.mv_angl, DEG2SHORT_ANGLE2(11.25f)) == TRUE) {
|
||||
actor->next_action = aHM1_ACT_WALK;
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
}
|
||||
|
||||
actor->npc_class.actor_class.world.angle.y = actor->npc_class.actor_class.shape_info.rotation.y;
|
||||
}
|
||||
|
||||
static void aHM1_walk(HANAMI_NPC1_ACTOR* actor) {
|
||||
ACTOR* actorx = (ACTOR*)actor;
|
||||
|
||||
aHM1_revise_moveRange(actorx);
|
||||
if (actor->npc_class.collision.collision_flag != 0) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
} else if (actor->npc_class.movement.move_timer > 60) {
|
||||
actor->npc_class.action.step = aNPC_ACTION_END_STEP;
|
||||
}
|
||||
|
||||
chase_angle(&actorx->shape_info.rotation.y, actor->npc_class.movement.mv_angl, DEG2SHORT_ANGLE2(5.625f));
|
||||
actorx->world.angle.y = actorx->shape_info.rotation.y;
|
||||
}
|
||||
|
||||
static void aHM1_set_spd_info(HANAMI_NPC1_ACTOR* actor, int action) {
|
||||
if (action == aHM1_ACT_WALK) {
|
||||
actor->npc_class.movement.speed.max_speed = 1.0f;
|
||||
actor->npc_class.movement.speed.acceleration = 0.1f;
|
||||
actor->npc_class.movement.speed.deceleration = 0.1f;
|
||||
} else {
|
||||
actor->npc_class.actor_class.speed = 0.0f;
|
||||
actor->npc_class.movement.speed.max_speed = 0.0f;
|
||||
actor->npc_class.movement.speed.acceleration = 0.0f;
|
||||
actor->npc_class.movement.speed.deceleration = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM1_setupAction(HANAMI_NPC1_ACTOR* actor, int action) {
|
||||
// clang-format off
|
||||
static aHM1_ACT_PROC process[] = {
|
||||
aHM1_turn,
|
||||
aHM1_walk,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
actor->npc_class.action.step = 0;
|
||||
actor->action = action;
|
||||
actor->act_proc = process[action];
|
||||
aHM1_set_animation(actor, action);
|
||||
aHM1_set_spd_info(actor, action);
|
||||
}
|
||||
|
||||
static void aHM1_act_chg_data_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
nactorx->action.act_obj = aNPC_ACT_OBJ_PLAYER;
|
||||
}
|
||||
|
||||
static void aHM1_act_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC1_ACTOR* actor = (HANAMI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
aHM1_setupAction(actor, aHM1_ACT_WALK);
|
||||
}
|
||||
|
||||
static void aHM1_act_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC1_ACTOR* actor = (HANAMI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
actor->act_proc(actor);
|
||||
}
|
||||
|
||||
static void aHM1_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC act_proc[] = { aHM1_act_init_proc, aHM1_act_chg_data_proc, aHM1_act_main_proc };
|
||||
|
||||
(*act_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHM1_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC1_ACTOR* actor = (HANAMI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
if (nactorx->action.step == aNPC_ACTION_END_STEP) {
|
||||
if (nactorx->action.idx == aNPC_ACT_SPECIAL) {
|
||||
int next_act;
|
||||
|
||||
if (actor->next_action != -1) {
|
||||
next_act = actor->next_action;
|
||||
} else {
|
||||
s16 move_angle = (s16)((RANDOM_F(1.0f) - 0.5f) * 65536.0f);
|
||||
s16 diff_angle;
|
||||
|
||||
nactorx->movement.mv_angl = move_angle;
|
||||
diff_angle = DIFF_SHORT_ANGLE(move_angle, actor->npc_class.actor_class.shape_info.rotation.y);
|
||||
if (ABS(diff_angle) > DEG2SHORT_ANGLE2(135.0f)) {
|
||||
next_act = aHM1_ACT_TURN;
|
||||
} else if ((nactorx->collision.collision_flag & (mCoBG_HIT_WALL | mCoBG_HIT_WALL_FRONT)) == 0) {
|
||||
next_act = aHM1_ACT_WALK;
|
||||
} else {
|
||||
next_act = aHM1_ACT_TURN;
|
||||
}
|
||||
}
|
||||
|
||||
nactorx->movement.move_timer = 0;
|
||||
aHM1_setupAction(actor, next_act);
|
||||
}
|
||||
|
||||
actor->next_action = -1;
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
aHM1_set_request_act(actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM1_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
HANAMI_NPC1_ACTOR* actor = (HANAMI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
nactorx->think.interrupt_flags = 0;
|
||||
nactorx->action.act_proc = aHM1_act_proc;
|
||||
aHM1_set_request_act(actor);
|
||||
}
|
||||
|
||||
static void aHM1_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC think_proc[] = { aHM1_think_init_proc, aHM1_think_main_proc };
|
||||
|
||||
(*think_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHM1_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
// clang-format off
|
||||
static s16 def_angle[] = {
|
||||
DEG2SHORT_ANGLE2(45.0f),
|
||||
DEG2SHORT_ANGLE2(45.0f),
|
||||
DEG2SHORT_ANGLE2(315.0f),
|
||||
DEG2SHORT_ANGLE2(270.0f),
|
||||
DEG2SHORT_ANGLE2(0.0f),
|
||||
DEG2SHORT_ANGLE2(315.0f),
|
||||
DEG2SHORT_ANGLE2(315.0f),
|
||||
};
|
||||
// clang-format on
|
||||
HANAMI_NPC1_ACTOR* actor = (HANAMI_NPC1_ACTOR*)nactorx;
|
||||
ACTOR* actorx = (ACTOR*)nactorx;
|
||||
s16 angle;
|
||||
|
||||
nactorx->think.think_proc = aHM1_think_proc;
|
||||
nactorx->condition_info.hide_request = FALSE;
|
||||
nactorx->palActorIgnoreTimer = -1;
|
||||
actor->next_action = -1;
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
actorx->status_data.weight = MASSTYPE_HEAVY;
|
||||
|
||||
angle = def_angle[mFI_GetPuleIdx()];
|
||||
actorx->shape_info.rotation.y = angle;
|
||||
actorx->world.angle.y = angle;
|
||||
nactorx->movement.mv_angl = angle;
|
||||
|
||||
NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
static void aHM1_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) {
|
||||
NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
static void aHM1_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC sche_proc[] = { aHM1_schedule_init_proc, aHM1_schedule_main_proc };
|
||||
|
||||
(*sche_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
static void aHM1_set_talk_info(ACTOR* actorx) {
|
||||
static int msg_base[mNpc_LOOKS_NUM] = { 0x1939, 0x1948, 0x192A, 0x1957, 0x1966, 0x1975 };
|
||||
int looks = mNpc_GetNpcLooks(actorx);
|
||||
|
||||
mDemo_Set_msg_num(msg_base[looks] + RANDOM(3));
|
||||
}
|
||||
|
||||
static void aHM1_talk_request(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Request(mDemo_TYPE_TALK, actorx, aHM1_set_talk_info);
|
||||
}
|
||||
|
||||
static int aHM1_talk_init(ACTOR* actorx, GAME* game) {
|
||||
mDemo_Set_ListenAble();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int aHM1_talk_end_chk(ACTOR* actorx, GAME* game) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) {
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "ef_effect_control.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
|
||||
static void eKigae_Light_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
|
||||
static void eKigae_Light_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
|
||||
static void eKigae_Light_mv(eEC_Effect_c* effect, GAME* game);
|
||||
@@ -18,17 +20,59 @@ eEC_PROFILE_c iam_ef_kigae_light = {
|
||||
};
|
||||
|
||||
static void eKigae_Light_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
|
||||
// TODO
|
||||
if (arg0 == 1) {
|
||||
pos.x += sin_s(angle) * 20.0f - cos_s(angle) * 20.0f;
|
||||
pos.y += 35.0f;
|
||||
pos.z += cos_s(angle) * 20.0f + sin_s(angle) * 20.0f;
|
||||
} else if (arg0 == 2) {
|
||||
pos.x += sin_s(angle) * 20.0f - cos_s(angle) * 20.0f;
|
||||
pos.y += 35.0f;
|
||||
pos.z += cos_s(angle) * 20.0f + sin_s(angle) * 20.0f;
|
||||
}
|
||||
|
||||
eEC_CLIP->make_effect_proc(eEC_EFFECT_KIGAE_LIGHT, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
|
||||
}
|
||||
|
||||
static void eKigae_Light_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
// TODO
|
||||
effect->timer = 30;
|
||||
effect->scale = ZeroVec;
|
||||
effect->velocity = ZeroVec;
|
||||
effect->acceleration = ZeroVec;
|
||||
|
||||
if (effect->arg0 == 0) {
|
||||
effect->acceleration.y = -0.025f;
|
||||
}
|
||||
}
|
||||
|
||||
static void eKigae_Light_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
f32 scale;
|
||||
|
||||
if (effect->timer > 20) {
|
||||
scale = eEC_CLIP->calc_adjust_proc(effect->timer, 20, 30, 0.009f, 0.0f);
|
||||
effect->scale.x = scale;
|
||||
effect->scale.y = scale;
|
||||
effect->scale.z = scale;
|
||||
} else {
|
||||
scale = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 20, 0.0f, 0.009f);
|
||||
effect->scale.x = scale;
|
||||
effect->scale.y = scale;
|
||||
effect->scale.z = scale;
|
||||
}
|
||||
|
||||
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
|
||||
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
|
||||
}
|
||||
|
||||
extern Gfx ef_takurami01_normal_render_mode[];
|
||||
extern Gfx ef_takurami01_kira_modelT[];
|
||||
|
||||
static void eKigae_Light_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale);
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, ef_takurami01_normal_render_mode);
|
||||
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, 255);
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_takurami01_kira_modelT);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
+67
-4
@@ -1,5 +1,9 @@
|
||||
#include "ef_effect_control.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "m_rcp.h"
|
||||
|
||||
static void eKikuzu_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
|
||||
static void eKikuzu_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
|
||||
static void eKikuzu_mv(eEC_Effect_c* effect, GAME* game);
|
||||
@@ -18,17 +22,76 @@ eEC_PROFILE_c iam_ef_kikuzu = {
|
||||
};
|
||||
|
||||
static void eKikuzu_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
|
||||
// TODO
|
||||
eEC_CLIP->make_effect_proc(eEC_EFFECT_KIKUZU, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
|
||||
}
|
||||
|
||||
static void eKikuzu_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
// TODO
|
||||
f32 z = RANDOM_F(1.75f) + 0.5f;
|
||||
f32 y = RANDOM_F(4.0f) + 1.5f;
|
||||
s16* angle_p = (s16*)ct_arg;
|
||||
s16 angle = *angle_p + DEG2SHORT_ANGLE(180.0f) + RANDOM(DEG2SHORT_ANGLE2(80.0f));
|
||||
|
||||
effect->timer = RANDOM(10) * 2 + 60;
|
||||
effect->scale.x = effect->scale.y = effect->scale.z = RANDOM2_F(0.002f) + 0.004f;
|
||||
effect->position.x += RANDOM2_F(10.0f);
|
||||
effect->position.y += RANDOM2_F(10.0f);
|
||||
effect->position.z += RANDOM2_F(10.0f);
|
||||
effect->offset.x = effect->position.y;
|
||||
effect->offset.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, effect->position, 0.0f);
|
||||
effect->offset.y += 3.0f;
|
||||
effect->velocity.x = sin_s(angle) * z;
|
||||
effect->velocity.z = cos_s(angle) * z;
|
||||
effect->velocity.y = y;
|
||||
effect->acceleration.y = -0.25f;
|
||||
effect->effect_specific[0] = qrand();
|
||||
effect->effect_specific[2] = qrand();
|
||||
effect->effect_specific[1] = qrand() & 0x1FFF;
|
||||
effect->effect_specific[3] = qrand() & 0x1FFF;
|
||||
}
|
||||
|
||||
static void eKikuzu_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
effect->offset.x = effect->position.y;
|
||||
effect->offset.z = effect->offset.y;
|
||||
effect->offset.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, effect->position, 0.0f);
|
||||
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
|
||||
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
|
||||
effect->effect_specific[0] += effect->effect_specific[1];
|
||||
effect->effect_specific[2] += effect->effect_specific[3];
|
||||
|
||||
if (effect->position.y < effect->offset.y && effect->offset.x >= effect->offset.y && effect->velocity.y < 0.0f) {
|
||||
effect->position.y = effect->offset.y;
|
||||
effect->velocity.x *= 0.6f;
|
||||
effect->velocity.y *= -0.6f;
|
||||
effect->velocity.z *= 0.6f;
|
||||
effect->effect_specific[1] >>= 1;
|
||||
effect->effect_specific[3] >>= 1;
|
||||
}
|
||||
|
||||
if (effect->position.y < effect->offset.y && effect->position.y >= effect->offset.z) {
|
||||
effect->position.x -= effect->velocity.x;
|
||||
effect->position.y -= effect->velocity.y;
|
||||
effect->position.z -= effect->velocity.z;
|
||||
effect->velocity.x *= -0.6f;
|
||||
effect->velocity.z *= -0.6f;
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx ef_kikuzu01_00_modelT[];
|
||||
|
||||
static void eKikuzu_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
u8 a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 16, 0.0f, 255.0f);
|
||||
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
|
||||
Matrix_RotateX(effect->effect_specific[0], 1);
|
||||
Matrix_RotateZ(effect->effect_specific[2], 1);
|
||||
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1);
|
||||
|
||||
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 200, a);
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_kikuzu01_00_modelT);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user