mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Link ac_ev_soncho2
This commit is contained in:
+1
-1
@@ -1177,7 +1177,7 @@ config.libs = [
|
||||
Object(NonMatching, "actor/npc/event/ac_ev_pumpkin.c"),
|
||||
Object(Matching, "actor/npc/event/ac_ev_santa.c"),
|
||||
Object(Matching, "actor/npc/event/ac_ev_soncho.c"),
|
||||
Object(NonMatching, "actor/npc/event/ac_ev_soncho2.c"),
|
||||
Object(Matching, "actor/npc/event/ac_ev_soncho2.c"),
|
||||
Object(Matching, "actor/npc/event/ac_ev_speech_soncho.c"),
|
||||
Object(NonMatching, "actor/npc/event/ac_ev_turkey.c"),
|
||||
Object(NonMatching, "actor/npc/event/ac_ev_yomise.c"),
|
||||
|
||||
@@ -14,6 +14,7 @@ extern ACTOR_PROFILE Ev_Soncho2_Profile;
|
||||
typedef struct ac_npc_soncho2 NPC_SONCHO2;
|
||||
|
||||
typedef void (*aEV_SONCHO2_PROC)(NPC_SONCHO2* soncho, GAME_PLAY* play);
|
||||
typedef void (*aEV_SONCHO2_TALK_PROC)(NPC_SONCHO2* soncho, GAME* game);
|
||||
|
||||
struct ac_npc_soncho2 {
|
||||
NPC_ACTOR npc_class;
|
||||
|
||||
@@ -8,6 +8,20 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define aTKC_FLAG_RACE_ACTIVE (1 << 10)
|
||||
|
||||
typedef struct ac_tokyoso_event_s {
|
||||
u8 _00;
|
||||
u8 _01;
|
||||
u16 flags;
|
||||
s16 pos_04[3];
|
||||
s16 pos_0A[2][2];
|
||||
s16 angle[2];
|
||||
s16 pos_16[2];
|
||||
u8 _1A[2];
|
||||
u8 _1C[2];
|
||||
} aEv_tokyoso_c;
|
||||
|
||||
extern ACTOR_PROFILE Tokyoso_Control_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +29,3 @@ extern ACTOR_PROFILE Tokyoso_Control_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ typedef enum audio_sound_effects {
|
||||
|
||||
NA_SE_2A = 0x2A,
|
||||
|
||||
NA_SE_2F = 0x2F,
|
||||
|
||||
NA_SE_MENU_PAUSE = 0x30,
|
||||
NA_SE_31 = 0x31,
|
||||
NA_SE_32 = 0x32,
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ enum {
|
||||
};
|
||||
|
||||
extern u8 mSC_get_soncho_event();
|
||||
extern int mSC_get_soncho_field_event();
|
||||
extern u8 mSC_get_soncho_field_event();
|
||||
extern void mSC_delete_soncho(ACTOR* actor, GAME_PLAY* play);
|
||||
extern int mSC_trophy_get(u8 num);
|
||||
extern void mSC_trophy_set(u8 num);
|
||||
|
||||
@@ -4514,7 +4514,11 @@ static int mail_event_check(void) {
|
||||
target_date.day = 14;
|
||||
target_date.hour = 0;
|
||||
target_date.year = (last_time.month > date.month && last_time.month <= target_date.month) ? last_time.year : date.year;
|
||||
|
||||
// check Valentine's day is between the last event mail save date and the current date
|
||||
// also check that the current date is within a week of Valentine's day
|
||||
if (check_past_day(last_time.raw, target_date.raw, date.raw) != FALSE && date.year == last_time.year && date.day <= (target_date.day + lbRTC_WEEK)) {
|
||||
// schedule Valentine's day mail for 10 am on February 14th
|
||||
target_date.hour = 10; // 10am on Valentine's day
|
||||
Save_Get(event_save_common).valentines_day_date = target_date.raw;
|
||||
n++;
|
||||
|
||||
@@ -11,35 +11,54 @@
|
||||
#include "m_player_lib.h"
|
||||
#include "libultra/libultra.h"
|
||||
#include "m_event_map_npc.h"
|
||||
#include "ac_tokyoso_control.h"
|
||||
|
||||
int aES2_change_talk_proc(ACTOR* actorx, u8 talk_proc);
|
||||
void aES2_setup_think_proc(ACTOR* actorx, GAME* game, u8 think_proc);
|
||||
void aES2_schedule_proc(NPC_ACTOR* npc, GAME_PLAY* play, int schedule);
|
||||
static int aES2_change_talk_proc(ACTOR* actorx, u8 talk_proc);
|
||||
static void aES2_setup_think_proc(NPC_SONCHO2* soncho, GAME_PLAY* play, u8 think_proc);
|
||||
static void aES2_schedule_proc(NPC_ACTOR* npc, GAME_PLAY* play, int schedule);
|
||||
|
||||
void aES2_actor_ct(ACTOR* actor, GAME* game);
|
||||
void aES2_actor_dt(ACTOR* actor, GAME* game);
|
||||
void aES2_actor_init(ACTOR* actor, GAME* game);
|
||||
void aES2_actor_save(ACTOR* actor, GAME* game);
|
||||
void aES2_actor_move(ACTOR* actor, GAME* game);
|
||||
void aES2_actor_draw(ACTOR* actor, GAME* game);
|
||||
int aES2_talk_init(ACTOR* actorx, GAME* game);
|
||||
int aES2_talk_end_chk(NPC_SONCHO2* actorx, GAME_PLAY* game);
|
||||
static void aES2_actor_ct(ACTOR* actor, GAME* game);
|
||||
static void aES2_actor_dt(ACTOR* actor, GAME* game);
|
||||
static void aES2_actor_init(ACTOR* actor, GAME* game);
|
||||
static void aES2_actor_save(ACTOR* actor, GAME* game);
|
||||
static void aES2_actor_move(ACTOR* actor, GAME* game);
|
||||
static void aES2_actor_draw(ACTOR* actor, GAME* game);
|
||||
static int aES2_talk_init(ACTOR* actorx, GAME* game);
|
||||
static int aES2_talk_end_chk(NPC_ACTOR* nactorx, GAME* game);
|
||||
|
||||
ACTOR_PROFILE Ev_Soncho2_Profile = { mAc_PROFILE_EV_SONCHO2, ACTOR_PART_NPC, 0,
|
||||
SP_NPC_EV_SONCHO2, ACTOR_OBJ_BANK_KEEP, sizeof(NPC_SONCHO2),
|
||||
&aES2_actor_ct, &aES2_actor_dt, &aES2_actor_init,
|
||||
mActor_NONE_PROC1, &aES2_actor_save };
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Ev_Soncho2_Profile = {
|
||||
mAc_PROFILE_EV_SONCHO2,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
SP_NPC_EV_SONCHO2,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(NPC_SONCHO2),
|
||||
&aES2_actor_ct,
|
||||
&aES2_actor_dt,
|
||||
&aES2_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
&aES2_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void aES2_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = { &aES2_actor_move, &aES2_actor_draw, 5, mActor_NONE_PROC1,
|
||||
&aES2_talk_init, (aNPC_TALK_END_CHECK_PROC)&aES2_talk_end_chk, 0 };
|
||||
static void aES2_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
&aES2_actor_move,
|
||||
&aES2_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
mActor_NONE_PROC1,
|
||||
&aES2_talk_init,
|
||||
(aNPC_TALK_END_CHECK_PROC)&aES2_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
if (CLIP(npc_clip)->birth_check_proc(actorx, game) == TRUE) {
|
||||
ACTOR* player = (ACTOR*)GET_PLAYER_ACTOR_GAME(game);
|
||||
soncho->npc_class.schedule.schedule_proc = aES2_schedule_proc;
|
||||
CLIP(npc_clip)->ct_proc(actorx, game, &ct_data);
|
||||
soncho->npc_class.palActorIgnoreTimer = -1;
|
||||
soncho->npc_class.draw.sub_anim_type = 0x3;
|
||||
soncho->npc_class.draw.sub_anim_type = aNPC_SUB_ANIM_TUE;
|
||||
soncho->_9ac = FALSE;
|
||||
soncho->melody_inst = 0;
|
||||
CLIP(npc_clip)->set_dst_pos_proc((NPC_ACTOR*)actorx, player->world.position.x, player->world.position.z);
|
||||
@@ -51,41 +70,43 @@ void aES2_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_actor_save(ACTOR* actor, GAME* game) {
|
||||
static void aES2_actor_save(ACTOR* actor, GAME* game) {
|
||||
mNpc_RenewalSetNpc(actor);
|
||||
}
|
||||
|
||||
void aES2_actor_dt(ACTOR* actor, GAME* game) {
|
||||
static void aES2_actor_dt(ACTOR* actor, GAME* game) {
|
||||
CLIP(npc_clip)->dt_proc(actor, game);
|
||||
mSC_delete_soncho(actor, (GAME_PLAY*)game);
|
||||
}
|
||||
|
||||
void aES2_actor_init(ACTOR* actor, GAME* game) {
|
||||
static void aES2_actor_init(ACTOR* actor, GAME* game) {
|
||||
CLIP(npc_clip)->init_proc(actor, game);
|
||||
}
|
||||
|
||||
int aES2_set_request_act(NPC_SONCHO2* soncho, u8 priority, int idx, int type, int p7, int x, int z) {
|
||||
static int aES2_set_request_act(NPC_SONCHO2* soncho, u8 priority, int idx, int type, int obj, int x, int z) {
|
||||
u16 arg_data[aNPC_REQUEST_ARG_NUM];
|
||||
int res = FALSE;
|
||||
u16 buff[6];
|
||||
|
||||
if (priority >= soncho->npc_class.request.act_priority) {
|
||||
bzero(buff, 12);
|
||||
buff[0] = p7;
|
||||
buff[2] = x;
|
||||
buff[3] = z;
|
||||
bzero(arg_data, sizeof(arg_data));
|
||||
arg_data[0] = obj;
|
||||
arg_data[2] = x;
|
||||
arg_data[3] = z;
|
||||
soncho->npc_class.request.act_priority = priority;
|
||||
soncho->npc_class.request.act_idx = idx;
|
||||
soncho->npc_class.request.act_type = type;
|
||||
mem_copy((u8*)soncho->npc_class.request.act_args, (u8*)buff, 12);
|
||||
mem_copy((u8*)soncho->npc_class.request.act_args, (u8*)arg_data, sizeof(arg_data));
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void aES2_actor_move(ACTOR* actor, GAME* game) {
|
||||
static void aES2_actor_move(ACTOR* actor, GAME* game) {
|
||||
CLIP(npc_clip)->move_proc(actor, game);
|
||||
}
|
||||
|
||||
void aES2_actor_draw(ACTOR* actor, GAME* game) {
|
||||
static void aES2_actor_draw(ACTOR* actor, GAME* game) {
|
||||
CLIP(npc_clip)->draw_proc(actor, game);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
int aES2_kinenhin_msg(ACTOR* actorx, int msg_no) {
|
||||
static int aES2_kinenhin_msg(ACTOR* actorx, int msg_no) {
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
if (soncho->event == mSC_EVENT_HARVEST_FESTIVAL) {
|
||||
return msg_no + MSG_HARVEST_FESTIVAL;
|
||||
@@ -7,52 +7,52 @@ int aES2_kinenhin_msg(ACTOR* actorx, int msg_no) {
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_LightHouse_set_free_str() {
|
||||
static void aES2_LightHouse_set_free_str() {
|
||||
lbRTC_time_c time_1;
|
||||
lbRTC_time_c time_2;
|
||||
u8 day_str[4];
|
||||
lbRTC_TimeCopy(&time_1, &Common_Get(time).rtc_time);
|
||||
lbRTC_Add_DD(&time_1, 0x7);
|
||||
lbRTC_Add_DD(&time_1, 7);
|
||||
lbRTC_TimeCopy(&time_2, &Common_Get(time).rtc_time);
|
||||
lbRTC_Add_DD(&time_2, 0x8);
|
||||
lbRTC_Add_DD(&time_2, 8);
|
||||
mString_Load_DayStringFromRom(day_str, time_1.day);
|
||||
mMsg_Set_free_str(mMsg_Get_base_window_p(), FALSE, day_str, 4);
|
||||
mMsg_Set_free_str(mMsg_Get_base_window_p(), FALSE, day_str, sizeof(day_str));
|
||||
mString_Load_DayStringFromRom(day_str, time_2.day);
|
||||
mMsg_Set_free_str(mMsg_Get_base_window_p(), TRUE, day_str, 4);
|
||||
mMsg_Set_free_str(mMsg_Get_base_window_p(), TRUE, day_str, sizeof(day_str));
|
||||
}
|
||||
|
||||
void aES2_talk_before_give(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_talk_before_give(NPC_SONCHO2* soncho, GAME* game) {
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
if (mMsg_Check_MainNormalContinue(msg_p)) {
|
||||
if (mPr_GetPossessionItemSumWithCond(Now_Private, EMPTY_NO, mPr_ITEM_COND_NORMAL) == 0) {
|
||||
mMsg_Set_continue_msg_num(msg_p, aES2_kinenhin_msg((ACTOR*)soncho, 2));
|
||||
aES2_change_talk_proc((ACTOR*)soncho, aES2_TALK_5);
|
||||
} else {
|
||||
mMsg_Set_continue_msg_num(msg_p, aES2_kinenhin_msg((ACTOR*)soncho, 0x3));
|
||||
mMsg_Set_continue_msg_num(msg_p, aES2_kinenhin_msg((ACTOR*)soncho, 3));
|
||||
aES2_change_talk_proc((ACTOR*)soncho, aES2_TALK_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_talk_give(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_talk_give(NPC_SONCHO2* soncho, GAME* game) {
|
||||
if ((int)mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 0x1) == 0x2) {
|
||||
mSC_item_string_set(soncho->item, EMPTY_NO);
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC1, 0x0, soncho->item);
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC1, 0x1, 0x7);
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC1, 0x2, 0x0);
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC1, 0x1, aHOI_REQUEST_PUTAWAY);
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC1, 0x2, FALSE);
|
||||
mPr_SetFreePossessionItem(Now_Private, soncho->item, mPr_ITEM_COND_NORMAL);
|
||||
aES2_change_talk_proc((ACTOR*)soncho, aES2_TALK_5);
|
||||
mSC_trophy_set(soncho->event);
|
||||
}
|
||||
}
|
||||
|
||||
int aES2_change_talk_proc(ACTOR* actorx, u8 talk_proc) {
|
||||
static int aES2_change_talk_proc(ACTOR* actorx, u8 talk_proc) {
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
soncho->talk = talk_proc;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void aES2_set_norm_talk_info(ACTOR* actorx) {
|
||||
static void aES2_set_norm_talk_info(ACTOR* actorx) {
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
mDemo_Set_talk_turn(TRUE);
|
||||
mDemo_Set_camera(3);
|
||||
@@ -99,7 +99,7 @@ void aES2_set_norm_talk_info(ACTOR* actorx) {
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_norm_talk_request(ACTOR* actorx, GAME* game) {
|
||||
static void aES2_norm_talk_request(ACTOR* actorx, GAME* game) {
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
if (soncho->_9ac == FALSE) {
|
||||
mDemo_Request(mDemo_ORDER_7, actorx, aES2_set_norm_talk_info);
|
||||
@@ -108,7 +108,7 @@ void aES2_norm_talk_request(ACTOR* actorx, GAME* game) {
|
||||
}
|
||||
}
|
||||
|
||||
int aES2_talk_init(ACTOR* actorx, GAME* game) {
|
||||
static int aES2_talk_init(ACTOR* actorx, GAME* game) {
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
soncho->npc_class.talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1;
|
||||
mDemo_Set_ListenAble();
|
||||
@@ -128,22 +128,24 @@ int aES2_talk_init(ACTOR* actorx, GAME* game) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int aES2_talk_end_chk(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static aEV_SONCHO2_PROC proc[6] = { aES2_talk_before_give,
|
||||
aES2_talk_give,
|
||||
(aEV_SONCHO2_PROC)mActor_NONE_PROC1,
|
||||
(aEV_SONCHO2_PROC)mActor_NONE_PROC1,
|
||||
(aEV_SONCHO2_PROC)mActor_NONE_PROC1,
|
||||
(aEV_SONCHO2_PROC)mActor_NONE_PROC1 };
|
||||
static int aES2_talk_end_chk(NPC_ACTOR* nactorx, GAME* game) {
|
||||
static aEV_SONCHO2_TALK_PROC proc[6] = {
|
||||
aES2_talk_before_give,
|
||||
aES2_talk_give,
|
||||
(aEV_SONCHO2_TALK_PROC)mActor_NONE_PROC1,
|
||||
(aEV_SONCHO2_TALK_PROC)mActor_NONE_PROC1,
|
||||
(aEV_SONCHO2_TALK_PROC)mActor_NONE_PROC1,
|
||||
(aEV_SONCHO2_TALK_PROC)mActor_NONE_PROC1,
|
||||
};
|
||||
|
||||
ACTOR* actorx = (ACTOR*)soncho;
|
||||
GAME* game = (GAME*)play;
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)nactorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
int res = FALSE;
|
||||
proc[soncho->talk](soncho, play);
|
||||
if (mDemo_Check(0x8, actorx) == FALSE && mDemo_Check(0x7, actorx) == FALSE) {
|
||||
aES2_setup_think_proc(actorx, game, soncho->think);
|
||||
proc[soncho->talk](soncho, game);
|
||||
if (mDemo_CAN_ACTOR_TALK((ACTOR*)soncho)) {
|
||||
aES2_setup_think_proc(soncho, play, soncho->think);
|
||||
if (soncho->melody_inst) {
|
||||
soncho->npc_class.talk_info.melody_inst = soncho->melody_inst;
|
||||
nactorx->talk_info.melody_inst = soncho->melody_inst;
|
||||
soncho->melody_inst = 0;
|
||||
}
|
||||
res = TRUE;
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
void aES2_set_move_pos(NPC_SONCHO2* soncho) {
|
||||
static void aES2_set_move_pos(NPC_SONCHO2* soncho) {
|
||||
switch (soncho->think_idx) {
|
||||
case aES2_THINK_LIGHTHOUSE_QUEST_START:
|
||||
soncho->goal_x = soncho->center_x + 0xa0;
|
||||
soncho->goal_z = soncho->center_z - 0x78;
|
||||
soncho->goal_x = soncho->center_x + 4 * mFI_UT_WORLDSIZE_X;
|
||||
soncho->goal_z = soncho->center_z - 3 * mFI_UT_WORLDSIZE_X;
|
||||
break;
|
||||
case 0x8:
|
||||
soncho->goal_x = soncho->center_x + 0xc8;
|
||||
soncho->goal_z = soncho->center_z + 0x28;
|
||||
soncho->goal_x = soncho->center_x + 5 * mFI_UT_WORLDSIZE_X;
|
||||
soncho->goal_z = soncho->center_z + mFI_UT_WORLDSIZE_Z;
|
||||
break;
|
||||
case 0xa:
|
||||
soncho->goal_x = soncho->center_x - 0x78;
|
||||
soncho->goal_z = soncho->center_z - 0x78;
|
||||
soncho->goal_x = soncho->center_x - 3 * mFI_UT_WORLDSIZE_X;
|
||||
soncho->goal_z = soncho->center_z - 3 * mFI_UT_WORLDSIZE_Z;
|
||||
break;
|
||||
default:
|
||||
soncho->goal_x = soncho->center_x - 0xa0;
|
||||
soncho->goal_z = soncho->center_z + 0x28;
|
||||
soncho->goal_x = soncho->center_x - 4 * mFI_UT_WORLDSIZE_X;
|
||||
soncho->goal_z = soncho->center_z + mFI_UT_WORLDSIZE_Z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_wait(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static u8 field_table[4] = { aES2_THINK_FOOT_RACE, aES2_THINK_BALL_TOSS, aES2_THINK_TUG_O_WAR,
|
||||
aES2_THINK_AEROBICS };
|
||||
ACTOR* actorx = (ACTOR*)soncho;
|
||||
GAME* game = (GAME*)play;
|
||||
static void aES2_wait(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static u8 field_table[4] = {
|
||||
aES2_THINK_FOOT_RACE,
|
||||
aES2_THINK_BALL_TOSS,
|
||||
aES2_THINK_TUG_O_WAR,
|
||||
aES2_THINK_AEROBICS,
|
||||
};
|
||||
u8 event = mSC_get_soncho_event();
|
||||
if (event != 0xff) {
|
||||
soncho->npc_class.think.interrupt_flags = FALSE;
|
||||
@@ -31,20 +33,21 @@ void aES2_wait(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
switch (event) {
|
||||
case mSC_EVENT_SPRING_SPORTS_FAIR:
|
||||
case mSC_EVENT_FALL_SPORTS_FAIR: {
|
||||
u8 think_proc = field_table[(u8)mSC_get_soncho_field_event()];
|
||||
aES2_setup_think_proc(actorx, game, think_proc);
|
||||
u8 idx = mSC_get_soncho_field_event();
|
||||
|
||||
aES2_setup_think_proc(soncho, play, (u8)field_table[idx]);
|
||||
break;
|
||||
}
|
||||
case mSC_SPECIAL_EVENT_JAN_VACATION:
|
||||
case mSC_SPECIAL_EVENT_FEB_VACATION:
|
||||
if (Common_Get(player_no) == mPr_FOREIGNER || mSC_LightHouse_Talk_After_Check()) {
|
||||
Actor_delete(actorx);
|
||||
Actor_delete((ACTOR*)soncho);
|
||||
} else {
|
||||
aES2_setup_think_proc(actorx, game, aES2_THINK_3);
|
||||
aES2_setup_think_proc(soncho, play, aES2_THINK_3);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
aES2_setup_think_proc(actorx, game, aES2_THINK_4);
|
||||
aES2_setup_think_proc(soncho, play, aES2_THINK_4);
|
||||
break;
|
||||
}
|
||||
if (event == mSC_EVENT_NEW_YEARS_EVE_COUNTDOWN && soncho->day != 31) {
|
||||
@@ -57,113 +60,113 @@ void aES2_wait(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_look_runner(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
s16* save_area = (s16*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 0x8);
|
||||
if (save_area != NULL) {
|
||||
int flags = ((u16*)save_area)[1];
|
||||
if ((flags & 0x400) != 0) {
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_TURN2, aNPC_ACT_TYPE_TO_POINT, 0x0, save_area[5], save_area[6]);
|
||||
static void aES2_look_runner(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 0x8);
|
||||
if (tokyoso != NULL) {
|
||||
if ((tokyoso->flags & aTKC_FLAG_RACE_ACTIVE) != 0) {
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_TURN2, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT,
|
||||
tokyoso->pos_0A[0][0], tokyoso->pos_0A[0][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_bskt_birth(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_bskt_birth(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
s16 oyasiro_p[3];
|
||||
if (mFI_SetOyasiroPos(oyasiro_p)) {
|
||||
soncho->center_x = oyasiro_p[0];
|
||||
soncho->center_z = oyasiro_p[1];
|
||||
aES2_setup_think_proc((ACTOR*)soncho, (GAME*)play, aES2_THINK_LIGHTHOUSE_QUEST_START);
|
||||
aES2_setup_think_proc(soncho, play, aES2_THINK_LIGHTHOUSE_QUEST_START);
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_bskt_turn_next(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_bskt_turn_next(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
if (soncho->npc_class.action.idx == aNPC_ACT_TURN && soncho->npc_class.action.step == 0xff) {
|
||||
aES2_setup_think_proc((ACTOR*)soncho, (GAME*)play, ++soncho->think_idx);
|
||||
aES2_setup_think_proc(soncho, play, ++soncho->think_idx);
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_bskt_move_next(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_bskt_move_next(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
if (soncho->npc_class.action.idx == aNPC_ACT_WALK && soncho->npc_class.action.step == 0xff) {
|
||||
aES2_setup_think_proc((ACTOR*)soncho, (GAME*)play, ++soncho->think_idx);
|
||||
aES2_setup_think_proc(soncho, play, ++soncho->think_idx);
|
||||
} else {
|
||||
if ((s16)soncho->npc_class.movement.dst_pos_x != soncho->goal_x ||
|
||||
(s16)soncho->npc_class.movement.dst_pos_z != soncho->goal_z) {
|
||||
aES2_setup_think_proc((ACTOR*)soncho, (GAME*)play, --soncho->think_idx);
|
||||
aES2_setup_think_proc(soncho, play, --soncho->think_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_bskt_timer_next(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_bskt_timer_next(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
if (soncho->timer > 0) {
|
||||
soncho->timer--;
|
||||
} else {
|
||||
u8 think_proc = soncho->think_idx;
|
||||
if (think_proc >= aES2_THINK_d) {
|
||||
aES2_setup_think_proc((ACTOR*)soncho, (GAME*)play, aES2_THINK_LIGHTHOUSE_QUEST_START);
|
||||
aES2_setup_think_proc(soncho, play, aES2_THINK_LIGHTHOUSE_QUEST_START);
|
||||
} else {
|
||||
soncho->think_idx = ++think_proc;
|
||||
aES2_setup_think_proc((ACTOR*)soncho, (GAME*)play, think_proc);
|
||||
aES2_setup_think_proc(soncho, play, think_proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_tug_of_war(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
ACTOR* actorx = (ACTOR*)soncho;
|
||||
static void aES2_tug_of_war(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
if (soncho->timer > 0) {
|
||||
soncho->timer--;
|
||||
} else {
|
||||
aES2_setup_think_proc(actorx, (GAME*)play, soncho->think_idx);
|
||||
aES2_setup_think_proc(soncho, play, soncho->think_idx);
|
||||
}
|
||||
if (soncho->npc_class.draw.animation_id == aNPC_ANIM_CLAP1) {
|
||||
sAdo_OngenPos((u32)actorx, 0x2f, &actorx->world.position);
|
||||
sAdo_OngenPos((u32)soncho, NA_SE_2F, &soncho->npc_class.actor_class.world.position);
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_think_main_proc(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_think_main_proc(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
soncho->npc_class.condition_info.demo_flg |= aNPC_COND_DEMO_SKIP_FOOTSTEPS;
|
||||
soncho->_994(soncho, play);
|
||||
}
|
||||
|
||||
void aES2_think_init_proc(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
ACTOR* actorx = (ACTOR*)soncho;
|
||||
actorx->status_data.weight = 0xfe;
|
||||
static void aES2_think_init_proc(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
soncho->npc_class.actor_class.status_data.weight = MASSTYPE_HEAVY;
|
||||
soncho->npc_class.condition_info.hide_request = FALSE;
|
||||
aES2_setup_think_proc((ACTOR*)actorx, (GAME*)play, aES2_THINK_0);
|
||||
aES2_setup_think_proc(soncho, play, aES2_THINK_0);
|
||||
}
|
||||
|
||||
void aES2_normal_wait_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_WAIT, aNPC_ACT_TYPE_DEFAULT, 0x0, 0x0, 0x0);
|
||||
static void aES2_normal_wait_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
aES2_set_request_act(soncho, 4, aNPC_ACT_WAIT, aNPC_ACT_TYPE_DEFAULT, aNPC_ACT_OBJ_DEFAULT, 0x0, 0x0);
|
||||
}
|
||||
|
||||
void aES2_wander_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_wander_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
ACTOR* actorx = (ACTOR*)soncho;
|
||||
CLIP(npc_clip)->chg_schedule_proc((NPC_ACTOR*)soncho, play, aNPC_SCHEDULE_TYPE_WALK_WANDER);
|
||||
actorx->status_data.weight = 0x50;
|
||||
}
|
||||
|
||||
void aES2_bskt_turn_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_bskt_turn_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
aES2_set_move_pos(soncho);
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_TURN, aNPC_ACT_TYPE_TO_POINT, 0x0, soncho->goal_x, soncho->goal_z);
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_TURN, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, soncho->goal_x,
|
||||
soncho->goal_z);
|
||||
}
|
||||
|
||||
void aES2_bskt_move_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_bskt_move_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
soncho->timer = 0x12c;
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_WALK, aNPC_ACT_TYPE_TO_POINT, 0x0, soncho->goal_x, soncho->goal_z);
|
||||
aES2_set_request_act(soncho, 0x4, aNPC_ACT_WALK, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, soncho->goal_x,
|
||||
soncho->goal_z);
|
||||
}
|
||||
|
||||
void aES2_force_wait_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_force_wait_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
soncho->npc_class.action.idx = aNPC_ACT_RUN;
|
||||
aES2_normal_wait_init(soncho, play);
|
||||
}
|
||||
|
||||
void aES2_tug_of_war_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
static void aES2_tug_of_war_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
ACTOR* actorx = (ACTOR*)soncho;
|
||||
soncho->npc_class.action.idx = aNPC_ACT_WAIT;
|
||||
aES2_normal_wait_init(soncho, play);
|
||||
soncho->timer = 0x12c;
|
||||
CLIP(npc_clip)->set_dst_pos_proc((NPC_ACTOR*)soncho, actorx->world.position.x - 20.0f,
|
||||
actorx->world.position.z + 50.0f);
|
||||
soncho->npc_class.draw.main_animation.keyframe.frame_control.mode = 1;
|
||||
soncho->npc_class.draw.main_animation.keyframe.frame_control.mode = cKF_FRAMECONTROL_REPEAT;
|
||||
if (RANDOM_F(1) < 0.5f) {
|
||||
CLIP(npc_clip)->animation_init_proc(actorx, aNPC_ANIM_CLAP1, FALSE);
|
||||
} else {
|
||||
@@ -171,29 +174,34 @@ void aES2_tug_of_war_init(NPC_SONCHO2* soncho, GAME_PLAY* play) {
|
||||
}
|
||||
}
|
||||
|
||||
static u8 dt_tbl[15][5] = { { 1, 1, 0, aES2_TALK_0, aES2_THINK_0 },
|
||||
{ 0, 1, 0, aES2_TALK_0, aES2_THINK_AEROBICS },
|
||||
{ 3, 1, 0, aES2_TALK_0, aES2_THINK_BALL_TOSS },
|
||||
{ 0, 3, 1, aES2_TALK_0, aES2_THINK_3 },
|
||||
{ 0, 3, 1, aES2_TALK_1, aES2_THINK_4 },
|
||||
{ 2, 2, 1, aES2_TALK_2, aES2_THINK_FOOT_RACE },
|
||||
{ 4, 4, 1, aES2_TALK_LIGHTHOUSE_QUEST_START_1, aES2_THINK_LIGHTHOUSE_QUEST_START },
|
||||
{ 5, 5, 1, aES2_TALK_LIGHTHOUSE_QUEST_START_2, aES2_THINK_LIGHTHOUSE_QUEST_START },
|
||||
{ 4, 4, 1, aES2_TALK_5, aES2_THINK_8 },
|
||||
{ 6, 2, 1, aES2_TALK_6, aES2_THINK_8 },
|
||||
{ 4, 4, 1, aES2_TALK_7, aES2_THINK_a },
|
||||
{ 5, 5, 1, aES2_TALK_8, aES2_THINK_a },
|
||||
{ 4, 4, 1, aES2_TALK_9, aES2_THINK_c },
|
||||
{ 6, 2, 1, aES2_TALK_a, aES2_THINK_c },
|
||||
{ 7, 6, 1, aES2_TALK_TUG_O_WAR, aES2_THINK_TUG_O_WAR } };
|
||||
static aEV_SONCHO2_PROC proc_table[8] = { (aEV_SONCHO2_PROC)mActor_NONE_PROC1,
|
||||
aES2_wait,
|
||||
aES2_look_runner,
|
||||
aES2_bskt_birth,
|
||||
aES2_bskt_turn_next,
|
||||
aES2_bskt_move_next,
|
||||
aES2_bskt_timer_next,
|
||||
aES2_tug_of_war };
|
||||
// TODO: this is a struct, not a 2D array of u8s.
|
||||
static u8 dt_tbl[15][5] = {
|
||||
{ 1, 1, 0, aES2_TALK_0, aES2_THINK_0 },
|
||||
{ 0, 1, 0, aES2_TALK_0, aES2_THINK_AEROBICS },
|
||||
{ 3, 1, 0, aES2_TALK_0, aES2_THINK_BALL_TOSS },
|
||||
{ 0, 3, 1, aES2_TALK_0, aES2_THINK_3 },
|
||||
{ 0, 3, 1, aES2_TALK_1, aES2_THINK_4 },
|
||||
{ 2, 2, 1, aES2_TALK_2, aES2_THINK_FOOT_RACE },
|
||||
{ 4, 4, 1, aES2_TALK_LIGHTHOUSE_QUEST_START_1, aES2_THINK_LIGHTHOUSE_QUEST_START },
|
||||
{ 5, 5, 1, aES2_TALK_LIGHTHOUSE_QUEST_START_2, aES2_THINK_LIGHTHOUSE_QUEST_START },
|
||||
{ 4, 4, 1, aES2_TALK_5, aES2_THINK_8 },
|
||||
{ 6, 2, 1, aES2_TALK_6, aES2_THINK_8 },
|
||||
{ 4, 4, 1, aES2_TALK_7, aES2_THINK_a },
|
||||
{ 5, 5, 1, aES2_TALK_8, aES2_THINK_a },
|
||||
{ 4, 4, 1, aES2_TALK_9, aES2_THINK_c },
|
||||
{ 6, 2, 1, aES2_TALK_a, aES2_THINK_c },
|
||||
{ 7, 6, 1, aES2_TALK_TUG_O_WAR, aES2_THINK_TUG_O_WAR },
|
||||
};
|
||||
static aEV_SONCHO2_PROC proc_table[8] = {
|
||||
(aEV_SONCHO2_PROC)mActor_NONE_PROC1,
|
||||
aES2_wait,
|
||||
aES2_look_runner,
|
||||
aES2_bskt_birth,
|
||||
aES2_bskt_turn_next,
|
||||
aES2_bskt_move_next,
|
||||
aES2_bskt_timer_next,
|
||||
aES2_tug_of_war,
|
||||
};
|
||||
static aEV_SONCHO2_PROC init_table[7] = {
|
||||
(aEV_SONCHO2_PROC)mActor_NONE_PROC1,
|
||||
aES2_normal_wait_init,
|
||||
@@ -204,13 +212,12 @@ static aEV_SONCHO2_PROC init_table[7] = {
|
||||
aES2_tug_of_war_init,
|
||||
};
|
||||
|
||||
void aES2_setup_think_proc(ACTOR* actorx, GAME* game, u8 think_idx) {
|
||||
static void aES2_setup_think_proc(NPC_SONCHO2* soncho, GAME_PLAY* play, u8 think_idx) {
|
||||
static aNPC_TALK_REQUEST_PROC talk_request_table[3] = {
|
||||
(aNPC_TALK_REQUEST_PROC)mActor_NONE_PROC1,
|
||||
aES2_norm_talk_request,
|
||||
(aNPC_TALK_REQUEST_PROC)mActor_NONE_PROC1,
|
||||
};
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)actorx;
|
||||
u8* data = dt_tbl[think_idx];
|
||||
|
||||
soncho->think_idx = think_idx;
|
||||
@@ -220,40 +227,40 @@ void aES2_setup_think_proc(ACTOR* actorx, GAME* game, u8 think_idx) {
|
||||
soncho->talk = data[3];
|
||||
soncho->think = data[4];
|
||||
|
||||
init_table[data[1]](soncho, (GAME_PLAY*)game);
|
||||
init_table[data[1]](soncho, play);
|
||||
|
||||
soncho->_9ac = TRUE;
|
||||
}
|
||||
|
||||
void aES2_think_proc(NPC_ACTOR* npc, GAME_PLAY* play, int type) {
|
||||
static void aES2_think_proc(NPC_ACTOR* npc, GAME_PLAY* play, int type) {
|
||||
switch (type) {
|
||||
case 0x0:
|
||||
case aNPC_THINK_PROC_INIT:
|
||||
aES2_think_init_proc((NPC_SONCHO2*)npc, play);
|
||||
break;
|
||||
case 0x1:
|
||||
case aNPC_THINK_PROC_MAIN:
|
||||
aES2_think_main_proc((NPC_SONCHO2*)npc, play);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_schedule_init_proc(NPC_ACTOR* npc, GAME_PLAY* play) {
|
||||
static void aES2_schedule_init_proc(NPC_ACTOR* npc, GAME_PLAY* play) {
|
||||
NPC_SONCHO2* soncho = (NPC_SONCHO2*)npc;
|
||||
soncho->npc_class.think.think_proc = aES2_think_proc;
|
||||
CLIP(npc_clip)->think_proc(npc, play, aNPC_THINK_SPECIAL, 0);
|
||||
CLIP(npc_clip)->think_proc(npc, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
|
||||
}
|
||||
|
||||
void aES2_schedule_main_proc(NPC_ACTOR* npc, GAME_PLAY* play) {
|
||||
if (CLIP(npc_clip)->think_proc(npc, play, -1, 1) == FALSE) {
|
||||
CLIP(npc_clip)->think_proc(npc, play, -1, 2);
|
||||
static void aES2_schedule_main_proc(NPC_ACTOR* npc, GAME_PLAY* play) {
|
||||
if (CLIP(npc_clip)->think_proc(npc, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT) == FALSE) {
|
||||
CLIP(npc_clip)->think_proc(npc, play, -1, aNPC_THINK_TYPE_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
void aES2_schedule_proc(NPC_ACTOR* npc, GAME_PLAY* play, int type) {
|
||||
static void aES2_schedule_proc(NPC_ACTOR* npc, GAME_PLAY* play, int type) {
|
||||
switch (type) {
|
||||
case 0x0:
|
||||
case aNPC_SCHEDULE_PROC_INIT:
|
||||
aES2_schedule_init_proc(npc, play);
|
||||
break;
|
||||
case 0x1:
|
||||
case aNPC_SCHEDULE_PROC_MAIN:
|
||||
aES2_schedule_main_proc(npc, play);
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ extern u8 mSC_get_soncho_event() {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
extern int mSC_get_soncho_field_event() {
|
||||
extern u8 mSC_get_soncho_field_event() {
|
||||
if (mEv_check_status(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, mEv_STATUS_RUN)) {
|
||||
return mSC_FIELD_EVENT_FOOT_RACE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user