Implement & link ac_npc_rcn_guide

This commit is contained in:
Cuyler36
2024-06-27 18:03:54 -04:00
parent 4e1f090595
commit 2469485be9
15 changed files with 1183 additions and 319 deletions
+4 -4
View File
@@ -37,9 +37,9 @@ static void change_FGUnit(ACTOR* actor, int type) {
static void aBRS_set_bgOffset(STRUCTURE_ACTOR* windmill, int idx) {
static mCoBG_OffsetTable_c height_table_ct[9] = {
{0x64, 9, 9, 9, 9, 9, 0}, {0x64, 9, 9, 9, 9, 9, 0}, {0x64, 9, 9, 9, 9, 9, 0},
{0x64, 9, 9, 9, 9, 9, 0}, {0x64, 9, 9, 9, 9, 9, 0}, {0x64, 9, 9, 9, 9, 9, 0},
{0x64, 9, 9, 9, 9, 9, 0}, {0x64, 9, 9, 9, 9, 9, 0}, {0x64, 9, 9, 9, 9, 9, 0},
{ 0x64, 9, 9, 9, 9, 9, 0 }, { 0x64, 9, 9, 9, 9, 9, 0 }, { 0x64, 9, 9, 9, 9, 9, 0 },
{ 0x64, 9, 9, 9, 9, 9, 0 }, { 0x64, 9, 9, 9, 9, 9, 0 }, { 0x64, 9, 9, 9, 9, 9, 0 },
{ 0x64, 9, 9, 9, 9, 9, 0 }, { 0x64, 9, 9, 9, 9, 9, 0 }, { 0x64, 9, 9, 9, 9, 9, 0 },
};
static mCoBG_OffsetTable_c* height_table[2] = {
@@ -182,7 +182,7 @@ static void aBRS_open_wait(STRUCTURE_ACTOR* actor, GAME_PLAY* play) {
if (actor == GET_PLAYER_ACTOR_NOW()->get_door_label_proc(gamePT)) {
aBRS_rewrite_out_data(&actor->actor_class, play);
goto_other_scene(play, &aBRS_br_shop_door_data, 1);
} else if (mPlib_check_player_actor_main_index_OutDoorMove(play) == 0) {
} else if (mPlib_check_player_actor_main_index_OutDoorMove(&play->game) == 0) {
if (aBRS_check_player(&actor->actor_class, play) == 0) {
if (aBRS_open_check(&actor->actor_class) != 2) {
aBRS_setup_action(actor, 2);
+5 -9
View File
@@ -132,7 +132,8 @@ static int aBGY_check_player2(GAME_PLAY* play) {
y = player->actor_class.world.angle.y;
res = 0;
if ((y > DEG2SHORT_ANGLE2(135.0f)) && (y < DEG2SHORT_ANGLE2(225.0f)) && (player->actor_class.speed > 0.0f)) { // 0x6000 && 0xA000
if ((y > DEG2SHORT_ANGLE2(135.0f)) && (y < DEG2SHORT_ANGLE2(225.0f)) &&
(player->actor_class.speed > 0.0f)) { // 0x6000 && 0xA000
res = 1;
}
@@ -230,7 +231,7 @@ static void aBGY_open_wait(STRUCTURE_ACTOR* buggy, GAME_PLAY* play) {
return;
}
if (mPlib_check_player_actor_main_index_OutDoorMove(play) != FALSE) {
if (mPlib_check_player_actor_main_index_OutDoorMove(&play->game) != FALSE) {
return;
}
@@ -264,12 +265,7 @@ static void aBGY_open_door(STRUCTURE_ACTOR* buggy, GAME_PLAY* play) {
}
static void aBGY_setup_action(STRUCTURE_ACTOR* buggy, int action) {
static aSTR_MOVE_PROC process[] = {
&aBGY_close_wait,
&aBGY_open_wait,
&aBGY_close_door,
&aBGY_open_door
};
static aSTR_MOVE_PROC process[] = { &aBGY_close_wait, &aBGY_open_wait, &aBGY_close_door, &aBGY_open_door };
static cKF_Animation_R_c* animation[] = { &cKF_ba_r_obj_s_uranai, &cKF_ba_r_obj_w_uranai };
static f32 start_idx[] = { 1.0f, 17.0f, 17.0f, 1.0f };
@@ -314,7 +310,7 @@ static void aBGY_actor_move(ACTOR* actor, GAME* game) {
(mDemo_Check(mDemo_TYPE_SCROLL3, &player->actor_class) == FALSE) && ((bx1 != bx2) || (bz1 != bz2))) {
Actor_delete(actor);
} else {
buggy->keyframe_state = cKF_SkeletonInfo_R_play(&buggy->keyframe);
buggy->action_proc(buggy, play);
+2 -2
View File
@@ -205,7 +205,7 @@ static int aMHS_check_player_in_intro_demo(STRUCTURE_ACTOR* my_house, GAME_PLAY*
return 0;
}
if (my_house->arg3_f == TRUE && intro_demo->player_in_intro_demo == TRUE) {
if (my_house->arg3_f == TRUE && intro_demo->player_in_house == TRUE) {
return 1;
}
@@ -405,7 +405,7 @@ static void aMHS_open_door(STRUCTURE_ACTOR* my_house, GAME_PLAY* play) {
if (demo_class != NULL) {
intro_demo = (INTRO_DEMO_ACTOR*)demo_class;
intro_demo->player_in_intro_demo = FALSE;
intro_demo->player_in_house = FALSE;
}
}
+161
View File
@@ -0,0 +1,161 @@
#include "ac_npc_rcn_guide.h"
#include "m_play.h"
#include "m_name_table.h"
#include "libultra/libultra.h"
#include "m_common_data.h"
#include "m_player_lib.h"
#include "m_bgm.h"
#include "m_msg.h"
#include "m_font.h"
#include "m_house.h"
#include "ac_intro_demo.h"
/* sizeof(aNRG_talk_data_c) == 0x0C */
typedef struct rcn_guide_talk_data_s {
/* 0x00 */ int msg_no;
/* 0x04 */ u8 turn_flag;
/* 0x05 */ u8 camera_type;
/* 0x06 */ u8 melody_flag;
/* 0x08 */ aNRG_TALK_PROC talk_proc;
} aNRG_talk_data_c;
enum {
aNRC_THINK_CALL,
aNRC_THINK_APPROACH,
aNRG_THINK_INTRODUCE,
aNRC_THINK_TURN,
aNRC_THINK_TAKE_WITH,
aNRC_THINK_EXPLAIN,
aNRC_THINK_DECIDE_HOUSE_WAIT,
aNRC_THINK_STOP_WADE,
aNRC_THINK_BEFORE_OPEN_DOOR_TALK,
aNRC_THINK_BEFORE_OPEN_DOOR_TALK2,
aNRC_THINK_ENTER_WAIT,
aNRC_THINK_RESTART_WAIT,
aNRC_THINK_RESTART_TALK,
aNRC_THINK_DECIDE_HOUSE,
aNRC_THINK_EXIT_TURN,
aNRC_THINK_EXIT,
aNRC_THINK_WAIT,
aNRC_THINK_NUM
};
enum {
aNRG_FORCE_TALK_CALL,
aNRG_FORCE_TALK_INTRODUCE,
aNRG_FORCE_TALK_EXPLAIN,
aNRG_FORCE_TALK_STOP_WADE,
aNRG_FORCE_TALK_BEFORE_OPEN_DOOR_TALK,
aNRG_FORCE_TALK_BEFORE_OPEN_DOOR2_TALK,
aNRG_FORCE_TALK_HOUSE_TAKEN,
aNRG_FORCE_TALK_HOUSE_VACANT,
aNRG_FORCE_TALK_NUM
};
enum {
aNRG_NORM_TALK_DECIDE_HOUSE,
aNRG_NORM_TALK_NUM
};
static void aNRG_actor_ct(ACTOR* actorx, GAME* game);
static void aNRG_actor_save(ACTOR* actorx, GAME* game);
static void aNRG_actor_dt(ACTOR* actorx, GAME* game);
static void aNRG_actor_init(ACTOR* actorx, GAME* game);
static void aNRG_actor_draw(ACTOR* actorx, GAME* game);
static void aNRG_actor_move(ACTOR* actorx, GAME* game);
// clang-format off
ACTOR_PROFILE Npc_Rcn_Guide_Profile = {
mAc_PROFILE_NPC_RCN_GUIDE,
ACTOR_PART_NPC,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
SP_NPC_RCN_GUIDE,
ACTOR_OBJ_BANK_KEEP,
sizeof(NPC_RCN_GUIDE_ACTOR),
&aNRG_actor_ct,
&aNRG_actor_dt,
&aNRG_actor_init,
mActor_NONE_PROC1,
&aNRG_actor_save,
};
// clang-format on
static void aNRG_force_talk_request(ACTOR* actorx, GAME* game);
static int aNRG_talk_init(ACTOR* actorx, GAME* game);
static int aNRG_talk_end_chk(ACTOR* actorx, GAME* game);
static void aNRG_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* game, int sched_idx);
static void aNRG_setup_think_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play, int think_idx);
static void aNRG_actor_ct(ACTOR* actorx, GAME* game) {
// clang-format off
static aNPC_ct_data_c ct_data = {
&aNRG_actor_move,
&aNRG_actor_draw,
5,
&aNRG_force_talk_request,
&aNRG_talk_init,
&aNRG_talk_end_chk,
0,
};
// clang-format on
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
PLAYER_ACTOR* player;
s16 angle_y;
if (Common_Get(clip).npc_clip->birth_check_proc(actorx, &play->game) == TRUE) {
rcn_guide->npc_class.schedule.schedule_proc = &aNRG_schedule_proc;
Common_Get(clip).npc_clip->ct_proc(actorx, &play->game, &ct_data);
rcn_guide->npc_class.collision.priority = 2;
rcn_guide->melody_copy = rcn_guide->npc_class.talk_info.melody_inst;
/* Set shop acre */
mFI_BlockKind2BkNum(&rcn_guide->shop_bx, &rcn_guide->shop_bz, mRF_BLOCKKIND_SHOP);
rcn_guide->npc_class.draw.main_animation.keyframe.morph_counter = 0.0f;
rcn_guide->npc_class.actor_class.status_data.weight = 255;
player = GET_PLAYER_ACTOR(play);
if (player != NULL) {
angle_y = search_position_angleY(&rcn_guide->npc_class.actor_class.world.position,
&player->actor_class.world.position);
} else {
angle_y = 0;
}
rcn_guide->npc_class.actor_class.shape_info.rotation.y = angle_y;
rcn_guide->npc_class.actor_class.world.angle.y = angle_y;
}
}
static void aNRG_actor_save(ACTOR* actorx, GAME* game) {
Common_Get(clip).npc_clip->save_proc(actorx, game);
}
static void aNRG_actor_dt(ACTOR* actorx, GAME* game) {
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)actorx;
if (rcn_guide->think_idx == 16) {
mBGMPsComp_delete_ps_demo(BGM_INTRO_STATION, 0x168);
}
Common_Get(clip).npc_clip->dt_proc(actorx, game);
}
static void aNRG_actor_init(ACTOR* actorx, GAME* game) {
Common_Get(clip).npc_clip->init_proc(actorx, game);
}
static void aNRG_actor_draw(ACTOR* actorx, GAME* game) {
Common_Get(clip).npc_clip->draw_proc(actorx, game);
}
#include "../src/ac_npc_rcn_guide_move.c_inc"
#include "../src/ac_npc_rcn_guide_talk.c_inc"
#include "../src/ac_npc_rcn_guide_schedule.c_inc"
+39
View File
@@ -0,0 +1,39 @@
static int aNRG_set_request_act(NPC_RCN_GUIDE_ACTOR* rcn_guide, u8 act_prio, u8 act_idx, u8 act_type, u16 obj, int x,
int z) {
u16 args[6];
int res = FALSE;
if (act_prio >= rcn_guide->npc_class.request.act_priority) {
bzero(args, sizeof(args));
args[0] = obj;
args[2] = x;
args[3] = z;
rcn_guide->npc_class.request.act_priority = act_prio;
rcn_guide->npc_class.request.act_idx = act_idx;
rcn_guide->npc_class.request.act_type = act_type;
mem_copy((u8*)rcn_guide->npc_class.request.act_args, (u8*)args, sizeof(args));
res = TRUE;
}
return res;
}
static void aNRG_set_house_master_name(int house_idx) {
mMsg_SET_FREE_STR(mMsg_FREE_STR0, Save_Get(private[mHS_get_pl_no(house_idx)]).player_ID.player_name,
PLAYER_NAME_LEN);
}
static void aNRG_set_shop_address(NPC_RCN_GUIDE_ACTOR* rcn_guide) {
static u8 choume_str[] = { 'Q', 'A', 'B', 'C', 'D', 'E', 'F' };
u8 str[1];
/* Set the row (Z) string */
mMsg_SET_FREE_STR(mMsg_FREE_STR1, &choume_str[rcn_guide->shop_bz], 1);
/* Set the column (X) string */
mFont_UnintToString(str, sizeof(str), rcn_guide->shop_bx, sizeof(str), TRUE, FALSE, TRUE);
mMsg_SET_FREE_STR(mMsg_FREE_STR2, str, sizeof(str));
}
static void aNRG_actor_move(ACTOR* actorx, GAME* game) {
Common_Get(clip).npc_clip->move_proc(actorx, game);
}
+406
View File
@@ -0,0 +1,406 @@
typedef void (*aNRG_THINK_INIT_PROC)(NPC_RCN_GUIDE_ACTOR*, GAME_PLAY*);
typedef struct npc_rcn_guide_setup_think_s {
aNRG_THINK_PROC think_proc;
aNRG_THINK_INIT_PROC think_init_proc;
aNPC_TALK_REQUEST_PROC talk_request_proc;
u8 talk_idx;
u8 next_think_idx;
} aNRG_setup_think_c;
static void aNRG_approach(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (rcn_guide->npc_class.action.step == aNPC_ACTION_END_STEP && rcn_guide->npc_class.action.idx == 2) {
aNRG_setup_think_proc(rcn_guide, play, aNRG_THINK_INTRODUCE);
}
}
static void aNRG_turn(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (rcn_guide->npc_class.action.step == aNPC_ACTION_END_STEP && rcn_guide->npc_class.action.idx == 3) {
aNRG_setup_think_proc(rcn_guide, play, rcn_guide->next_think_idx);
}
}
static void aNRG_take_with(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (rcn_guide->npc_class.action.step == aNPC_ACTION_END_STEP && rcn_guide->npc_class.action.idx == 2) {
int path = rcn_guide->path;
if (path >= 1) {
aNRG_setup_think_proc(rcn_guide, play, aNRC_THINK_EXPLAIN);
} else {
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_WALK2, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, 2240,
1500);
path++;
}
rcn_guide->path = path;
}
}
static void aNRG_decide_house_wait(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
int next_think_idx = -1;
if (GET_PLAYER_ACTOR_NOW()->cancel_wade_flag) {
next_think_idx = 7;
} else if (Common_Get(clip).demo_clip != NULL && Common_Get(clip).demo_clip->type == mDemo_CLIP_TYPE_INTRO_DEMO) {
ACTOR* demo_actor = (ACTOR*)Common_Get(clip).demo_clip->demo_class;
if (demo_actor != NULL) {
INTRO_DEMO_ACTOR* intro_demo = (INTRO_DEMO_ACTOR*)demo_actor;
switch (intro_demo->player_intro_demo_state) {
case 1:
next_think_idx = aNRC_THINK_BEFORE_OPEN_DOOR_TALK;
break;
case 2:
next_think_idx = aNRC_THINK_BEFORE_OPEN_DOOR_TALK2;
break;
}
}
}
if (next_think_idx >= 0) {
aNRG_setup_think_proc(rcn_guide, play, next_think_idx);
}
}
static void aNRG_enter_wait(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (Common_Get(clip).demo_clip != NULL && Common_Get(clip).demo_clip->type == mDemo_CLIP_TYPE_INTRO_DEMO) {
ACTOR* demo_actor = (ACTOR*)Common_Get(clip).demo_clip->demo_class;
if (demo_actor != NULL) {
INTRO_DEMO_ACTOR* intro_demo = (INTRO_DEMO_ACTOR*)demo_actor;
intro_demo->player_in_house = TRUE;
aNRG_setup_think_proc(rcn_guide, play, aNRC_THINK_WAIT);
}
}
}
static void aNRG_exit(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
static s16 moveX[] = { 2240, 2240, 2240, 2240 };
static s16 moveZ[] = { 1900, 1980, 1300, 1220 };
if (rcn_guide->npc_class.action.step == aNPC_ACTION_END_STEP) {
f32 posZ = rcn_guide->npc_class.actor_class.world.position.z;
int idx;
if (posZ < 1540.0f) {
if (posZ <= 1220.0f) {
idx = -1;
} else if (posZ <= 1300.0f) {
idx = 3;
} else {
idx = 2;
}
} else {
if (posZ >= 1980.0f) {
idx = -1;
} else if (posZ >= 1900.0f) {
idx = 1;
} else {
idx = 0;
}
}
if (idx == -1) {
if (Common_Get(clip).demo_clip != NULL && Common_Get(clip).demo_clip->type == mDemo_CLIP_TYPE_INTRO_DEMO) {
ACTOR* demo_actor = (ACTOR*)Common_Get(clip).demo_clip->demo_class;
if (demo_actor != NULL) {
INTRO_DEMO_ACTOR* intro_demo = (INTRO_DEMO_ACTOR*)demo_actor;
intro_demo->rcn_guide_actor_p = NULL;
Actor_delete(&rcn_guide->npc_class.actor_class);
play->submenu.disable_start_btn_flag = FALSE;
}
}
} else {
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_WALK2, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, moveX[idx],
moveZ[idx]);
}
}
}
static void aNRG_restart_wait(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
int think_idx;
if (mPlib_check_player_actor_main_index_OutDoorMove2(&play->game) == FALSE) {
switch (rcn_guide->npc_class.actor_class.actor_specific) {
case 1:
think_idx = aNRC_THINK_DECIDE_HOUSE;
break;
default:
think_idx = aNRC_THINK_RESTART_TALK;
break;
}
aNRG_setup_think_proc(rcn_guide, play, think_idx);
}
}
static void aNRG_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)nactorx;
(*rcn_guide->think_proc)(rcn_guide, play);
}
static void aNRG_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)nactorx;
int think_idx;
switch (rcn_guide->npc_class.actor_class.actor_specific) {
case 1:
case 2:
think_idx = aNRC_THINK_RESTART_WAIT;
break;
default:
think_idx = aNRC_THINK_CALL;
break;
}
aNRG_setup_think_proc(rcn_guide, play, think_idx);
rcn_guide->npc_class.condition_info.hide_request = FALSE;
}
static void aNRG_call_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
s16 angle_y = atans_table(980.0f - rcn_guide->npc_class.actor_class.world.position.z,
2320.0f - rcn_guide->npc_class.actor_class.world.position.x);
rcn_guide->npc_class.actor_class.shape_info.rotation.y = angle_y;
rcn_guide->npc_class.actor_class.world.angle.y = angle_y;
}
static void aNRG_approach_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
f32 x;
f32 z;
/* Player cannot open the start menu */
play->submenu.disable_start_btn_flag = TRUE;
/* Make the player stand around waiting */
mPlib_request_main_demo_wait_type1(&play->game, 0, NULL);
if (player != NULL) {
/* Move to a bit below where the player is */
x = player->actor_class.world.position.x;
z = player->actor_class.world.position.z + 70.0f;
} else {
/* Move to a predefined position -- how would the player even be NULL? */
x = 2320.0f;
z = 1050.0f;
}
/* Request action to move to desired location */
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_WALK2, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, x, z);
}
static void aNRG_introduce_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_WAIT, aNPC_ACT_TYPE_DEFAULT, aNPC_ACT_OBJ_DEFAULT, 0, 0);
}
static void aNRG_turn_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
mPlib_request_main_demo_wait_type1(&play->game, 0, NULL);
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_TURN, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, 2240, 1300);
}
static void aNRG_take_with_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (Common_Get(clip).demo_clip != NULL && Common_Get(clip).demo_clip->type == mDemo_CLIP_TYPE_INTRO_DEMO) {
ACTOR* demo_actor = (ACTOR*)Common_Get(clip).demo_clip->demo_class;
if (demo_actor != NULL) {
INTRO_DEMO_ACTOR* intro_demo = (INTRO_DEMO_ACTOR*)demo_actor;
intro_demo->talk_flag = TRUE;
}
}
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_WALK2, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, 2240, 1300);
}
static void aNRG_before_open_door_talk2_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
INTRO_DEMO_ACTOR* intro_demo = (INTRO_DEMO_ACTOR*)Common_Get(clip).demo_clip->demo_class;
aNRG_set_house_master_name(intro_demo->house_idx);
}
static void aNRG_exit_turn_init(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
static s16 moveX[] = { 2240, 2240 };
static s16 moveZ[] = { 1900, 1300 };
int idx = 0;
if (rcn_guide->npc_class.actor_class.world.position.z < 1540.0f) {
idx = 1;
}
aNRG_set_request_act(rcn_guide, 4, aNPC_ACT_TURN, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, moveX[idx],
moveZ[idx]);
if (Common_Get(clip).demo_clip != NULL && Common_Get(clip).demo_clip->type == mDemo_CLIP_TYPE_INTRO_DEMO) {
ACTOR* demo_actor = (ACTOR*)Common_Get(clip).demo_clip->demo_class;
if (demo_actor != NULL) {
INTRO_DEMO_ACTOR* intro_demo = (INTRO_DEMO_ACTOR*)demo_actor;
intro_demo->talk_flag = TRUE;
}
}
rcn_guide->next_think_idx = 15;
}
static void aNRG_setup_think_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play, int think_idx) {
// clang-format off
static aNRG_setup_think_c dt_tbl[] = {
{
(aNRG_THINK_PROC)&none_proc1,
&aNRG_call_init,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_APPROACH,
},
{
&aNRG_approach,
&aNRG_approach_init,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_APPROACH,
},
{
(aNRG_THINK_PROC)&none_proc1,
&aNRG_introduce_init,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_INTRODUCE,
aNRC_THINK_TURN,
},
{
&aNRG_turn,
&aNRG_turn_init,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_TAKE_WITH,
},
{
&aNRG_take_with,
&aNRG_take_with_init,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_TAKE_WITH,
},
{
(aNRG_THINK_PROC)&none_proc1,
(aNRG_THINK_INIT_PROC)&none_proc1,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_EXPLAIN,
aNRC_THINK_DECIDE_HOUSE_WAIT,
},
{
&aNRG_decide_house_wait,
&aNRG_introduce_init,
&aNRG_norm_talk_request,
aNRG_NORM_TALK_DECIDE_HOUSE,
aNRC_THINK_DECIDE_HOUSE_WAIT,
},
{
(aNRG_THINK_PROC)&none_proc1,
(aNRG_THINK_INIT_PROC)&none_proc1,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_STOP_WADE,
aNRC_THINK_DECIDE_HOUSE_WAIT,
},
{
(aNRG_THINK_PROC)&none_proc1,
(aNRG_THINK_INIT_PROC)&none_proc1,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_BEFORE_OPEN_DOOR_TALK,
aNRC_THINK_ENTER_WAIT,
},
{
(aNRG_THINK_PROC)&none_proc1,
&aNRG_before_open_door_talk2_init,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_BEFORE_OPEN_DOOR2_TALK,
aNRC_THINK_ENTER_WAIT,
},
{
&aNRG_enter_wait,
(aNRG_THINK_INIT_PROC)&none_proc1,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_ENTER_WAIT,
},
{
&aNRG_restart_wait,
(aNRG_THINK_INIT_PROC)&none_proc1,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_RESTART_WAIT,
},
{
(aNRG_THINK_PROC)&none_proc1,
(aNRG_THINK_INIT_PROC)&none_proc1,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_HOUSE_TAKEN,
aNRC_THINK_DECIDE_HOUSE_WAIT,
},
{
(aNRG_THINK_PROC)&none_proc1,
(aNRG_THINK_INIT_PROC)&none_proc1,
&aNRG_force_talk_request,
aNRG_FORCE_TALK_HOUSE_VACANT,
aNRC_THINK_DECIDE_HOUSE_WAIT,
},
{
&aNRG_turn,
&aNRG_exit_turn_init,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_EXIT_TURN,
},
{
&aNRG_exit,
(aNRG_THINK_INIT_PROC)&none_proc1,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_EXIT,
},
{
(aNRG_THINK_PROC)&none_proc1,
(aNRG_THINK_INIT_PROC)&none_proc1,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
aNRG_FORCE_TALK_CALL,
aNRC_THINK_WAIT,
},
};
// clang-format on
aNRG_setup_think_c* think_data = &dt_tbl[think_idx];
rcn_guide->think_idx = think_idx;
rcn_guide->think_proc = think_data->think_proc;
rcn_guide->npc_class.talk_info.talk_request_proc = think_data->talk_request_proc;
rcn_guide->talk_idx = think_data->talk_idx;
rcn_guide->next_think_idx = think_data->next_think_idx;
(*think_data->think_init_proc)(rcn_guide, play);
}
static void aNRG_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
static aNPC_SUB_PROC think_proc[] = { &aNRG_think_init_proc, &aNRG_think_main_proc };
(*think_proc[type])(nactorx, play);
}
static void aNRG_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
nactorx->think.think_proc = &aNRG_think_proc;
Common_Get(clip).npc_clip->think_proc(nactorx, play, aNPC_THINK_SPECIAL, 0);
}
static void aNRG_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
int res = Common_Get(clip).npc_clip->think_proc(nactorx, play, -1, 1);
if (res == 0) {
Common_Get(clip).npc_clip->think_proc(nactorx, play, -1, 2);
}
}
static void aNRG_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
static aNPC_SUB_PROC sche_proc[] = { &aNRG_schedule_init_proc, &aNRG_schedule_main_proc };
(*sche_proc[type])(nactorx, play);
}
+170
View File
@@ -0,0 +1,170 @@
enum {
aNRG_TALK_DEMAND_PAYMENT,
aNRG_TALK_MENU_OPEN_WAIT,
aNRG_TALK_MENU_CLOSE_WAIT,
aNRG_TALK_DEMO_START_WAIT,
aNRG_TALK_DEMO_END_WAIT,
aNRG_TALK_FINISHED,
aNRG_TALK_NUM
};
static void aNRG_demand_payment_change_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, int talk_proc_idx);
static void aNRG_demand_payment_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
u16 order = mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 9);
if (order != 0) {
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 9, 0);
mMsg_REQUEST_MAIN_DISAPPEAR_WAIT_TYPE1();
aNRG_demand_payment_change_talk_proc(rcn_guide, aNRG_TALK_MENU_OPEN_WAIT);
}
}
static void aNRG_menu_open_wait_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (mMsg_CHECK_MAIN_WAIT() == TRUE) {
Submenu* submenu = &play->submenu;
int idx = mPr_GetPossessionItemIdxWithCond(Now_Private, ITM_MONEY_1000, mPr_ITEM_COND_QUEST);
mSM_open_submenu(submenu, mSM_OVL_INVENTORY, mSM_IV_OPEN_QUEST, idx);
mMsg_SET_LOCKCONTINUE();
aNRG_demand_payment_change_talk_proc(rcn_guide, aNRG_TALK_MENU_CLOSE_WAIT);
}
}
static void aNRG_menu_close_wait_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
Submenu* submenu = &play->submenu;
if (submenu->open_flag == FALSE) {
if (submenu->item_p->item == EMPTY_NO) {
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
mMsg_request_main_appear_wait_type1(msg_p);
mMsg_ChangeMsgData(msg_p, 0x07EB); /* 'You better pay it all back, or I will have to...' */
mMsg_Set_ForceNext(msg_p);
mMsg_Unset_LockContinue(msg_p);
aNRG_demand_payment_change_talk_proc(rcn_guide, aNRG_TALK_DEMAND_PAYMENT); /* Go back to first state */
} else {
aNRG_demand_payment_change_talk_proc(rcn_guide, aNRG_TALK_DEMO_START_WAIT); /* Handed over the Bells */
}
}
}
static void aNRG_demo_start_wait_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (Common_Get(clip).handOverItem_clip->request_mode == aHOI_REQUEST_TRANS_WAIT) {
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 1, 3);
aNRG_demand_payment_change_talk_proc(rcn_guide, aNRG_TALK_DEMO_END_WAIT);
}
}
static void aNRG_demo_end_wait_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, GAME_PLAY* play) {
if (Common_Get(clip).handOverItem_clip->master_actor == NULL) {
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
aNRG_set_shop_address(rcn_guide);
rcn_guide->next_think_idx = 14;
mMsg_request_main_appear_wait_type1(msg_p);
mMsg_Set_ForceNext(msg_p);
aNRG_demand_payment_change_talk_proc(rcn_guide, aNRG_TALK_FINISHED);
}
}
static void aNRG_demand_payment_change_talk_proc(NPC_RCN_GUIDE_ACTOR* rcn_guide, int talk_proc_idx) {
// clang-format off
static aNRG_TALK_PROC talk_proc[] = {
&aNRG_demand_payment_talk_proc,
&aNRG_menu_open_wait_talk_proc,
&aNRG_menu_close_wait_talk_proc,
&aNRG_demo_start_wait_talk_proc,
&aNRG_demo_end_wait_talk_proc,
(aNRG_TALK_PROC)&none_proc1,
};
// clang-format on
rcn_guide->talk_proc = talk_proc[talk_proc_idx];
}
static void aNRG_set_force_talk_info(ACTOR* actorx) {
// clang-format off
static aNRG_talk_data_c dt_tbl[] = {
{ 0x07DE, TRUE, CAMERA2_PROCESS_NORMAL, TRUE, (aNRG_TALK_PROC)&none_proc1 }, /* Step down from train station */
{ 0x07DF, TRUE, CAMERA2_PROCESS_TALK, FALSE, (aNRG_TALK_PROC)&none_proc1 }, /* Ask about call from Rover */
{ 0x07E1, TRUE, CAMERA2_PROCESS_TALK, FALSE, (aNRG_TALK_PROC)&none_proc1 }, /* Show houses */
{ 0x07E2, TRUE, CAMERA2_PROCESS_NORMAL, FALSE, (aNRG_TALK_PROC)&none_proc1 }, /* Player tries leaving acre */
{ 0x07E4, FALSE, CAMERA2_PROCESS_NORMAL, FALSE, (aNRG_TALK_PROC)&none_proc1 }, /* Player enters empty house */
{ 0x07E3, FALSE, CAMERA2_PROCESS_NORMAL, FALSE, (aNRG_TALK_PROC)&none_proc1 }, /* Player enters taken house */
{ 0x07E5, TRUE, CAMERA2_PROCESS_TALK, TRUE, (aNRG_TALK_PROC)&none_proc1 }, /* Player exits taken house */
{ 0x07E6, TRUE, CAMERA2_PROCESS_TALK, TRUE, &aNRG_demand_payment_talk_proc }, /* Player exits empty house */
};
// clang-format on
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)actorx;
int talk_idx = rcn_guide->talk_idx;
aNRG_talk_data_c* data = &dt_tbl[talk_idx];
mDemo_Set_msg_num(data->msg_no);
mDemo_Set_talk_turn(data->turn_flag);
mDemo_Set_camera(data->camera_type);
rcn_guide->talk_proc_idx = aNRG_TALK_DEMAND_PAYMENT;
rcn_guide->talk_proc = data->talk_proc;
if (data->melody_flag == TRUE) {
rcn_guide->npc_class.talk_info.melody_inst = rcn_guide->melody_copy;
} else {
rcn_guide->npc_class.talk_info.melody_inst = 0;
}
if (talk_idx == 0) {
mBGMPsComp_make_ps_quiet(0);
}
}
static void aNRG_force_talk_request(ACTOR* actorx, GAME* game) {
mDemo_Request(mDemo_TYPE_SPEAK, actorx, &aNRG_set_force_talk_info);
}
static void aNRG_set_norm_talk_info(ACTOR* actorx) {
static aNRG_talk_data_c dt_tbl[] = {
{ 0x0820, TRUE, CAMERA2_PROCESS_TALK, FALSE, (aNRG_TALK_PROC)&none_proc1 }, /* Normal talk about houses */
};
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)actorx;
aNRG_talk_data_c* data = &dt_tbl[rcn_guide->talk_idx];
mDemo_Set_msg_num(data->msg_no);
mDemo_Set_talk_turn(data->turn_flag);
mDemo_Set_camera(data->camera_type);
rcn_guide->talk_proc_idx = aNRG_TALK_DEMAND_PAYMENT;
rcn_guide->talk_proc = data->talk_proc;
if (data->melody_flag == TRUE) {
rcn_guide->npc_class.talk_info.melody_inst = rcn_guide->melody_copy;
} else {
rcn_guide->npc_class.talk_info.melody_inst = 0;
}
}
static void aNRG_norm_talk_request(ACTOR* actorx, GAME* game) {
mDemo_Request(mDemo_TYPE_TALK, actorx, &aNRG_set_norm_talk_info);
}
static int aNRG_talk_init(ACTOR* actorx, GAME* game) {
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)actorx;
rcn_guide->npc_class.talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)&none_proc1;
mDemo_Set_ListenAble();
return TRUE;
}
static int aNRG_talk_end_chk(ACTOR* actorx, GAME* game) {
NPC_RCN_GUIDE_ACTOR* rcn_guide = (NPC_RCN_GUIDE_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
int res = FALSE;
(*rcn_guide->talk_proc)(rcn_guide, play);
if (mDemo_Check(mDemo_TYPE_SPEAK, actorx) == FALSE && mDemo_Check(mDemo_TYPE_TALK, actorx) == FALSE) {
/* We're done talking so move onto the next schedule step */
aNRG_setup_think_proc(rcn_guide, play, rcn_guide->next_think_idx);
res = TRUE;
}
return res;
}
+1 -1
View File
@@ -234,7 +234,7 @@ static void aSHOP_open_wait(STRUCTURE_ACTOR* shop, GAME_PLAY* play) {
actor = &shop->actor_class;
game = &play->game;
if (mPlib_check_player_actor_main_index_OutDoorMove(play) != FALSE) {
if (mPlib_check_player_actor_main_index_OutDoorMove(&play->game) != FALSE) {
return;
}