mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Implement & link ac_tunahiki_npc1, last actor
This commit is contained in:
+1
-1
@@ -1154,7 +1154,7 @@ config.libs = [
|
||||
Object(Matching, "actor/npc/ac_tukimi_npc0.c"),
|
||||
Object(Matching, "actor/npc/ac_tukimi_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_tunahiki_npc0.c"),
|
||||
Object(NonMatching, "actor/npc/ac_tunahiki_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_tunahiki_npc1.c"),
|
||||
Object(Matching, "actor/npc/ac_turi_npc0.c"),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -22,6 +22,13 @@ extern "C" {
|
||||
|
||||
#define aTNC_FLAG_SHAKE (1 << 15)
|
||||
|
||||
#define aTNC_NPCID2IDX(id) ((id - SP_NPC_EV_TUNAHIKI_0))
|
||||
#define aTNC_NPCID2MEMBER(id) (aTNC_NPCID2IDX(id) & 1)
|
||||
#define aTNC_NPCID2TEAM(id) (aTNC_NPCID2IDX(id) & 2)
|
||||
|
||||
#define aTNC_NPCIDX2DELETEFLG(n) (aTNC_FLAG_NPC_DELETE0 << aTNC_NPCID2IDX(n))
|
||||
#define aTNC_NPCIDX2TALKFLG(n) (aTNC_FLAG_NPC_TALK0 << aTNC_NPCID2IDX(n))
|
||||
|
||||
enum {
|
||||
aTNC_NPC_STATE0,
|
||||
aTNC_NPC_STATE1,
|
||||
|
||||
@@ -3,11 +3,30 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct tunahiki_npc1_actor_s TUNAHIKI_NPC1_ACTOR;
|
||||
|
||||
typedef void (*aTNN1_THINK_PROC)(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play);
|
||||
typedef void (*aTNN1_TALK_PROC)(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play);
|
||||
|
||||
struct tunahiki_npc1_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
aTNN1_THINK_PROC think_proc;
|
||||
aTNN1_TALK_PROC talk_proc;
|
||||
int base_msg;
|
||||
s16 dir;
|
||||
s16 timer;
|
||||
u8 talk_idx;
|
||||
u8 think_idx;
|
||||
u8 next_think_idx;
|
||||
u8 change_flag;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Tunahiki_Npc1_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +34,3 @@ extern ACTOR_PROFILE Tunahiki_Npc1_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ typedef enum audio_sound_effects {
|
||||
|
||||
NA_SE_104 = 0x104,
|
||||
|
||||
NA_SE_106 = 0x106,
|
||||
NA_SE_107 = 0x107,
|
||||
NA_SE_108 = 0x108,
|
||||
NA_SE_ROD_STROKE = 0x109,
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
#include "ac_tunahiki_npc1.h"
|
||||
|
||||
#include "ac_tunahiki_control.h"
|
||||
#include "m_common_data.h"
|
||||
#include "m_player_lib.h"
|
||||
#include "m_font.h"
|
||||
#include "m_msg.h"
|
||||
#include "m_soncho.h"
|
||||
#include "libultra/libultra.h"
|
||||
|
||||
// TODO: coordinate enum types with ac_tunahiki_control
|
||||
|
||||
// enum {
|
||||
// aTNN1_THINK_BIRTH,
|
||||
// aTNN1_THINK_KYORO_MAE,
|
||||
// aTNN1_THINK_KYORO,
|
||||
// aTNN1_THINK_WALK_TURN,
|
||||
// aTNN1_THINK_WALK,
|
||||
// aTNN1_THINK_HIROU_MAE,
|
||||
// aTNN1_THINK_HIROU,
|
||||
// aTNN1_THINK_HIROU_SP,
|
||||
// aTNN1_THINK_HIROU_END,
|
||||
// aTNN1_THINK_NAGERU,
|
||||
// aTNN1_THINK_NAGERU_END,
|
||||
|
||||
// aTNN1_THINK_NUM
|
||||
// };
|
||||
|
||||
// enum {
|
||||
// aTNN1_THINK_PROC_NONE,
|
||||
// aTNN1_THINK_PROC_TIMER_NEXT,
|
||||
// aTNN1_THINK_PROC_BIRTH,
|
||||
// aTNN1_THINK_PROC_TURN_NEXT,
|
||||
// aTNN1_THINK_PROC_WALK,
|
||||
// aTNN1_THINK_PROC_HIROU,
|
||||
// aTNN1_THINK_PROC_HIROU_SP,
|
||||
// aTNN1_THINK_PROC_ANIME_NEXT,
|
||||
// aTNN1_THINK_PROC_NAGERU,
|
||||
// aTNN1_THINK_PROC_NAGERU_END,
|
||||
|
||||
// aTNN1_THINK_PROC_NUM
|
||||
// };
|
||||
|
||||
// enum {
|
||||
// aTNN1_THINK_INIT_PROC_NONE,
|
||||
// aTNN1_THINK_INIT_PROC_NORMAL_WAIT,
|
||||
// aTNN1_THINK_INIT_PROC_MOVE,
|
||||
// aTNN1_THINK_INIT_PROC_KYORO_MAE,
|
||||
// aTNN1_THINK_INIT_PROC_KYORO,
|
||||
// aTNN1_THINK_INIT_PROC_WALK_TURN,
|
||||
// aTNN1_THINK_INIT_PROC_HIROU_MAE,
|
||||
// aTNN1_THINK_INIT_PROC_HIROU,
|
||||
// aTNN1_THINK_INIT_PROC_HIROU_SP,
|
||||
// aTNN1_THINK_INIT_PROC_HIROU_END,
|
||||
// aTNN1_THINK_INIT_PROC_NAGERU,
|
||||
// aTNN1_THINK_INIT_PROC_NAGERU_END,
|
||||
|
||||
// aTNN1_THINK_INIT_PROC_NUM
|
||||
// };
|
||||
|
||||
static void aTNN1_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aTNN1_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aTNN1_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aTNN1_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aTNN1_actor_save(ACTOR* actorx, GAME* game);
|
||||
static void aTNN1_actor_init(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Tunahiki_Npc1_Profile = {
|
||||
mAc_PROFILE_TUNAHIKI_NPC1,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
SP_NPC_EV_TUNAHIKI_1,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(TUNAHIKI_NPC1_ACTOR),
|
||||
aTNN1_actor_ct,
|
||||
aTNN1_actor_dt,
|
||||
aTNN1_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aTNN1_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static int aTNN1_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aTNN1_talk_end_chk(ACTOR* actorx, GAME* game);
|
||||
|
||||
static void aTNN1_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type);
|
||||
static void aTNN1_setup_think_proc(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play, u8 think_idx);
|
||||
|
||||
static void aTNN1_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aTNN1_actor_move,
|
||||
aTNN1_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
(aNPC_TALK_REQUEST_PROC)none_proc1,
|
||||
aTNN1_talk_init,
|
||||
aTNN1_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)actorx;
|
||||
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
static int base_msg_table[] = { 0x1984, 0x1990, 0x1978, 0x199C, 0x19A8, 0x19B4 };
|
||||
|
||||
actor->npc_class.schedule.schedule_proc = aTNN1_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
|
||||
actor->npc_class.palActorIgnoreTimer = -1;
|
||||
actor->change_flag = FALSE;
|
||||
actor->npc_class.head.lock_flag = TRUE;
|
||||
actor->npc_class.talk_info.turn = aNPC_TALK_TURN_NONE;
|
||||
actor->base_msg = base_msg_table[mNpc_GetNpcLooks(actorx)];
|
||||
actor->npc_class.collision.check_kind = mCoBG_CHECK_TYPE_NORMAL;
|
||||
actorx->world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(actorx->world.position, 0.0f);
|
||||
actorx->position_speed.y = 0.0f;
|
||||
actorx->gravity = 0.0f;
|
||||
actorx->max_velocity_y = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void aTNN1_actor_save(ACTOR* actorx, GAME* game) {
|
||||
mNpc_RenewalSetNpc(actorx);
|
||||
}
|
||||
|
||||
static void aTNN1_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
tunahiki->flag |= aTNC_NPCIDX2DELETEFLG(actorx->npc_id);
|
||||
}
|
||||
|
||||
static void aTNN1_actor_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static int aTNN1_set_request_act(TUNAHIKI_NPC1_ACTOR* actor, u8 prio, u8 idx, u8 type, u16 obj, s16 move_x, s16 move_z) {
|
||||
int res = FALSE;
|
||||
|
||||
if (prio >= actor->npc_class.request.act_priority) {
|
||||
u16 args[6];
|
||||
|
||||
bzero(args, sizeof(args));
|
||||
args[0] = obj;
|
||||
args[2] = move_x;
|
||||
args[3] = move_z;
|
||||
actor->npc_class.request.act_priority = prio;
|
||||
actor->npc_class.request.act_idx = idx;
|
||||
actor->npc_class.request.act_type = type;
|
||||
mem_copy((u8*)actor->npc_class.request.act_args, (u8*)args, sizeof(args));
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void aTNN1_actor_move(ACTOR* actorx, GAME* game) {
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)actorx;
|
||||
|
||||
NPC_CLIP->move_proc(actorx, game);
|
||||
actorx->world.position.z = actorx->home.position.z;
|
||||
|
||||
if (actor->think_idx != 0 && tunahiki != NULL) {
|
||||
actorx->world.position.x = actorx->home.position.x + tunahiki->rope_base;
|
||||
}
|
||||
|
||||
if (tunahiki != NULL) {
|
||||
if (tunahiki->npc_state == aTNC_NPC_STATE2 && (tunahiki->flag & aTNC_NPCIDX2DELETEFLG(actorx->npc_id)) == 0) {
|
||||
Actor_delete(actorx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_tunahiki_npc1_talk.c_inc"
|
||||
#include "../src/actor/npc/ac_tunahiki_npc1_schedule.c_inc"
|
||||
|
||||
static void aTNN1_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
static void aTNN1_make_ase(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
xyz_t pos;
|
||||
ACTOR* actorx = (ACTOR*)actor;
|
||||
|
||||
pos.x = (actorx->world.position.x + actor->npc_class.right_hand.pos.x) * 0.5f;
|
||||
pos.y = actor->npc_class.right_hand.pos.y * 3.0f - actorx->world.position.y * 2.0f;
|
||||
pos.z = actorx->world.position.z;
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_ASE2, pos, 1, 0, (GAME*)play, actorx->npc_id, 0, 0);
|
||||
}
|
||||
|
||||
static void aTNN1_aiko(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
ACTOR* actorx = (ACTOR*)actor;
|
||||
f32 rng = fqrand();
|
||||
|
||||
actorx->world.position.x = actorx->home.position.x + tunahiki->rope_base;
|
||||
actorx->world.position.z = actorx->home.position.z;
|
||||
|
||||
if (cKF_FrameControl_passCheck_now(&actor->npc_class.draw.main_animation.keyframe.frame_control, 6.0f)) {
|
||||
tunahiki->flag |= aTNC_FLAG_SHAKE;
|
||||
tunahiki->speed = tunahiki->next_speed;
|
||||
|
||||
if (actor->think_idx == 3) {
|
||||
aTNN1_make_ase(actor, play);
|
||||
actor->timer = 1;
|
||||
}
|
||||
} else if (cKF_FrameControl_passCheck_now(&actor->npc_class.draw.main_animation.keyframe.frame_control, 24.0f)) {
|
||||
tunahiki->flag &= ~aTNC_FLAG_SHAKE;
|
||||
|
||||
if (actor->think_idx == 3) {
|
||||
eEC_CLIP->effect_kill_proc(eEC_EFFECT_ASE2, actorx->npc_id);
|
||||
actor->timer = 0;
|
||||
}
|
||||
|
||||
if (rng < 0.45f) {
|
||||
tunahiki->next_speed = RANDOM_F(20.0f) + 3.0f;
|
||||
} else if (rng < 0.9f) {
|
||||
tunahiki->next_speed = -(RANDOM_F(20.0f) + 3.0f);
|
||||
} else {
|
||||
tunahiki->next_speed = 0.0f;
|
||||
}
|
||||
} else if (actor->think_idx != 3) {
|
||||
if (tunahiki->speed * actor->dir > 8.0f && (
|
||||
cKF_FrameControl_passCheck_now(&actor->npc_class.draw.main_animation.keyframe.frame_control, 12.0f) ||
|
||||
cKF_FrameControl_passCheck_now(&actor->npc_class.draw.main_animation.keyframe.frame_control, 18.0f))
|
||||
) {
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_DASH_ASIMOTO, actorx->world.position, 1, actorx->shape_info.rotation.y, (GAME*)play, actorx->npc_id, actorx->bg_collision_check.result.unit_attribute, 0);
|
||||
|
||||
if (aTNC_NPCID2MEMBER(actorx->npc_id) != 0 && cKF_FrameControl_passCheck_now(&actor->npc_class.draw.main_animation.keyframe.frame_control, 12.0f)) {
|
||||
sAdo_OngenTrgStart(NA_SE_106, &actorx->world.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cKF_FrameControl_stop_proc(&actor->npc_class.draw.main_animation.keyframe.frame_control) == TRUE) {
|
||||
if (-(tunahiki->rope_base * actor->dir) > 5.0f) {
|
||||
aTNN1_setup_think_proc(actor, play, 2);
|
||||
} else if (-(tunahiki->rope_base * actor->dir) < -5.0f && tunahiki->next_speed * actor->dir >= 0.0f) {
|
||||
aTNN1_setup_think_proc(actor, play, 3);
|
||||
} else {
|
||||
aTNN1_setup_think_proc(actor, play, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aTNN1_birth(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
|
||||
if (tunahiki != NULL && tunahiki->npc_state == aTNC_NPC_STATE1) {
|
||||
actor->npc_class.actor_class.state_bitfield |= ACTOR_STATE_NO_MOVE_WHILE_CULLED;
|
||||
aTNN1_setup_think_proc(actor, play, 1);
|
||||
tunahiki->next_speed = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void aTNN1_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)nactorx;
|
||||
|
||||
if (mDemo_Check(mDemo_TYPE_TALK, (ACTOR*)nactorx) != TRUE) {
|
||||
if (actor->npc_class.action.step == aNPC_ACTION_END_STEP) {
|
||||
actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y;
|
||||
}
|
||||
|
||||
actor->think_proc(actor, play);
|
||||
}
|
||||
}
|
||||
|
||||
static void aTNN1_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)nactorx;
|
||||
ACTOR* actorx = (ACTOR*)actor;
|
||||
|
||||
if (((actorx->npc_id - SP_NPC_EV_TUNAHIKI_1) & 2) == 0) {
|
||||
actor->dir = 1;
|
||||
actorx->world.angle.y = DEG2SHORT_ANGLE2(90.0f);
|
||||
actorx->shape_info.rotation.y = DEG2SHORT_ANGLE2(90.0f);
|
||||
} else {
|
||||
actor->dir = -1;
|
||||
actorx->world.angle.y = DEG2SHORT_ANGLE2(-90.0f);
|
||||
actorx->shape_info.rotation.y = DEG2SHORT_ANGLE2(-90.0f);
|
||||
}
|
||||
|
||||
NPC_CLIP->set_dst_pos_proc(nactorx, actorx->world.position.x + (actor->dir * 10.0f), actorx->world.position.z);
|
||||
|
||||
if (aTNC_NPCID2IDX(actorx->npc_id) == 2 || aTNC_NPCID2IDX(actorx->npc_id) == 3) {
|
||||
actorx->world.position.x += actor->dir * 95.0f;
|
||||
} else {
|
||||
actorx->world.position.x += actor->dir * 85.0f;
|
||||
}
|
||||
|
||||
actorx->world.position.z += actor->dir * 5.0f;
|
||||
|
||||
actorx->home.position.x = actorx->world.position.x;
|
||||
actorx->home.position.z = actorx->world.position.z;
|
||||
|
||||
actorx->status_data.weight = MASSTYPE_HEAVY;
|
||||
((NPC_ACTOR*)actorx)->condition_info.hide_request = FALSE;
|
||||
aTNN1_setup_think_proc(actor, play, 0);
|
||||
((NPC_ACTOR*)actorx)->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y;
|
||||
}
|
||||
|
||||
static void aTNN1_normal_wait_init(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
aTNN1_set_request_act(actor, 4, aNPC_ACT_WAIT, aNPC_ACT_TYPE_DEFAULT, aNPC_ACT_OBJ_DEFAULT, 0, 0);
|
||||
}
|
||||
|
||||
static void aTNN1_common_init(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play, int anim_idx) {
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
|
||||
actor->npc_class.action.idx = aNPC_ACT_WAIT;
|
||||
aTNN1_normal_wait_init(actor, play);
|
||||
NPC_CLIP->animation_init_proc((ACTOR*)actor, anim_idx, FALSE);
|
||||
actor->npc_class.draw.main_animation.keyframe.frame_control.mode = cKF_FRAMECONTROL_STOP;
|
||||
actor->npc_class.talk_info.default_animation = anim_idx;
|
||||
actor->npc_class.draw.main_animation.keyframe.frame_control.current_frame = tunahiki->counter * 0.5f;
|
||||
}
|
||||
|
||||
static void aTNN1_aiko_init(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
aTNN1_common_init(actor, play, aNPC_ANIM_TUNAHIKI_AIKO1);
|
||||
}
|
||||
|
||||
static void aTNN1_yuri_init(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
aTNN1_common_init(actor, play, aNPC_ANIM_TUNAHIKI_YURI1);
|
||||
}
|
||||
|
||||
static void aTNN1_furi_init(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play) {
|
||||
aTNN1_common_init(actor, play, aNPC_ANIM_TUNAHIKI_FURI1);
|
||||
}
|
||||
|
||||
enum {
|
||||
aTNN1_TALK_REQUEST_NONE,
|
||||
aTNN1_TALK_REQUEST_NORM,
|
||||
|
||||
aTNN1_TALK_REQUEST_NUM
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u8 think_proc_idx;
|
||||
u8 think_init_idx;
|
||||
u8 talk_request_idx;
|
||||
u8 talk_idx;
|
||||
u8 think_idx_after_talk;
|
||||
} aTNN1_think_data_c;
|
||||
|
||||
// TODO: enums for these
|
||||
static aTNN1_think_data_c dt_tbl[] = {
|
||||
{0x01, 0x01, 0x00, 0x00, 0x00},
|
||||
{0x02, 0x02, 0x01, 0x00, 0x01},
|
||||
{0x02, 0x03, 0x01, 0x01, 0x02},
|
||||
{0x02, 0x04, 0x01, 0x02, 0x03},
|
||||
};
|
||||
|
||||
static aTNN1_THINK_PROC proc_table[] = {
|
||||
(aTNN1_THINK_PROC)none_proc1,
|
||||
aTNN1_birth,
|
||||
aTNN1_aiko,
|
||||
};
|
||||
|
||||
typedef void (*aTNN1_THINK_INIT_PROC)(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play);
|
||||
|
||||
static aTNN1_THINK_INIT_PROC init_table[] = {
|
||||
(aTNN1_THINK_INIT_PROC)none_proc1,
|
||||
aTNN1_normal_wait_init,
|
||||
aTNN1_aiko_init,
|
||||
aTNN1_yuri_init,
|
||||
aTNN1_furi_init,
|
||||
};
|
||||
|
||||
static void aTNN1_setup_think_proc(TUNAHIKI_NPC1_ACTOR* actor, GAME_PLAY* play, u8 think_idx) {
|
||||
static aNPC_TALK_REQUEST_PROC talk_request_table[] = { (aNPC_TALK_REQUEST_PROC)none_proc1, aTNN1_norm_talk_request, (aNPC_TALK_REQUEST_PROC)none_proc1 };
|
||||
aTNN1_think_data_c* dt;
|
||||
|
||||
dt = &dt_tbl[think_idx];
|
||||
actor->think_idx = think_idx;
|
||||
actor->think_proc = proc_table[dt->think_proc_idx];
|
||||
actor->npc_class.talk_info.talk_request_proc = talk_request_table[dt->talk_request_idx];
|
||||
actor->talk_idx = dt->talk_idx;
|
||||
actor->next_think_idx = dt->think_idx_after_talk;
|
||||
(*init_table[dt->think_init_idx])(actor, play);
|
||||
actor->change_flag = TRUE;
|
||||
}
|
||||
|
||||
static void aTNN1_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
switch (type) {
|
||||
case aNPC_THINK_PROC_INIT:
|
||||
aTNN1_think_init_proc(nactorx, play);
|
||||
break;
|
||||
case aNPC_THINK_PROC_MAIN:
|
||||
aTNN1_think_main_proc(nactorx, play);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void aTNN1_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
nactorx->think.think_proc = aTNN1_think_proc;
|
||||
NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
static void aTNN1_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 aTNN1_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
switch (type) {
|
||||
case aNPC_SCHEDULE_PROC_INIT:
|
||||
aTNN1_schedule_init_proc(nactorx, play);
|
||||
break;
|
||||
case aNPC_SCHEDULE_PROC_MAIN:
|
||||
aTNN1_schedule_main_proc(nactorx, play);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
enum {
|
||||
aTNN1_TALK_END_WAIT,
|
||||
|
||||
aTNN1_TALK_NUM
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int msg_no;
|
||||
u8 turn;
|
||||
u8 camera;
|
||||
} aTNN1_talk_data_c;
|
||||
|
||||
static void aTNN1_set_norm_talk_info(ACTOR* actorx) {
|
||||
static aTNN1_talk_data_c dt_tbl[] = {
|
||||
{0x0003, TRUE, CAMERA2_PROCESS_TALK},
|
||||
{0x0006, TRUE, CAMERA2_PROCESS_TALK},
|
||||
{0x0009, TRUE, CAMERA2_PROCESS_TALK},
|
||||
};
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)actorx;
|
||||
aTNN1_talk_data_c* data_p = &dt_tbl[actor->talk_idx];
|
||||
|
||||
mDemo_Set_msg_num(actor->base_msg + data_p->msg_no + RANDOM(3));
|
||||
mDemo_Set_talk_turn(data_p->turn);
|
||||
mDemo_Set_camera(data_p->camera);
|
||||
actor->talk_proc = (aTNN1_TALK_PROC)none_proc1;
|
||||
}
|
||||
|
||||
static void aTNN1_norm_talk_request(ACTOR* actorx, GAME* game) {
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)actorx;
|
||||
|
||||
if (!actor->change_flag) {
|
||||
mDemo_Request(mDemo_TYPE_TALK, actorx, aTNN1_set_norm_talk_info);
|
||||
} else {
|
||||
actor->change_flag = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static int aTNN1_talk_init(ACTOR* actorx, GAME* game) {
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)actorx;
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
|
||||
actor->npc_class.talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1;
|
||||
mDemo_Set_ListenAble();
|
||||
mDemo_Start(actorx);
|
||||
tunahiki->flag |= aTNC_NPCIDX2TALKFLG(actorx->npc_id);
|
||||
|
||||
if (actor->timer != 0) {
|
||||
eEC_CLIP->effect_kill_proc(eEC_EFFECT_ASE2, actorx->npc_id);
|
||||
actor->timer = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int aTNN1_talk_end_chk(ACTOR* actorx, GAME* game) {
|
||||
TUNAHIKI_NPC1_ACTOR* actor = (TUNAHIKI_NPC1_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
int ret = FALSE;
|
||||
aEv_tunahiki_c* tunahiki = (aEv_tunahiki_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, 9);
|
||||
|
||||
actor->talk_proc(actor, play);
|
||||
if (mDemo_CAN_ACTOR_TALK(actorx)) {
|
||||
aTNN1_setup_think_proc(actor, play, actor->next_think_idx);
|
||||
tunahiki->flag &= ~aTNC_NPCIDX2TALKFLG(actorx->npc_id);
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
actor->npc_class.draw.main_animation.keyframe.frame_control.current_frame = tunahiki->counter * 0.5f;
|
||||
actorx->world.position.z = actorx->home.position.z;
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user