From 6f6a3399f2b14e106f55034f7476c87bd400ef6e Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Wed, 30 Oct 2024 17:51:44 -0400 Subject: [PATCH] Implement & link m_event_map_npc --- .gitignore | 3 +- .vscode/settings.json | 22 - configure.py | 2 +- include/ac_set_npc_manager.h | 7 +- include/m_event_map_npc.h | 38 +- include/m_museum_display.h | 2 +- include/m_npc.h | 2 +- src/game/m_event_map_npc.c | 642 ++++++++++++++++++++++ src/game/m_event_map_npc_data.c_inc | 821 ++++++++++++++++++++++++++++ src/game/m_museum_display.c | 2 +- src/game/m_npc.c | 2 +- 11 files changed, 1510 insertions(+), 33 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 src/game/m_event_map_npc.c create mode 100644 src/game/m_event_map_npc_data.c_inc diff --git a/.gitignore b/.gitignore index b827eb4a..7745e58c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # IDE folders .idea/ .vs/ +.vscode/* # Caches __pycache__ @@ -40,4 +41,4 @@ temp/ # Ignore the N64 SDK headers since we download them include/PR/ -include/gcc/ \ No newline at end of file +include/gcc/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 0c1848a9..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "[c]": { - "files.encoding": "utf8", - "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd" - }, - "[cpp]": { - "files.encoding": "utf8", - "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd" - }, - "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter" - }, - "editor.tabSize": 2, - "files.insertFinalNewline": true, - "files.trimFinalNewlines": true, - "files.associations": { - "*.inc": "c", - ".clangd": "yaml" - }, - // Disable C/C++ IntelliSense, use clangd instead - "C_Cpp.intelliSenseEngine": "disabled", -} diff --git a/configure.py b/configure.py index fab4db1b..8aadff17 100644 --- a/configure.py +++ b/configure.py @@ -1387,7 +1387,7 @@ config.libs = [ Object(Matching, "game/m_editEndChk_ovl.c"), Object(Matching, "game/m_editor_ovl.c"), Object(Matching, "game/m_event.c"), - Object(NonMatching, "game/m_event_map_npc.c"), + Object(Matching, "game/m_event_map_npc.c"), Object(Matching, "game/m_fbdemo.c"), Object(Matching, "game/m_fbdemo_fade.c"), Object(Matching, "game/m_fbdemo_triforce.c"), diff --git a/include/ac_set_npc_manager.h b/include/ac_set_npc_manager.h index c90af98d..b65c0d2b 100644 --- a/include/ac_set_npc_manager.h +++ b/include/ac_set_npc_manager.h @@ -8,6 +8,12 @@ extern "C" { #endif +#define aSNMgr_EVENT_NORMAL_NPC_NUM mNpc_EVENT_NPC_NUM + +typedef struct set_npc_event_save_s { + u8 animal_idx[aSNMgr_EVENT_NORMAL_NPC_NUM]; +} aSNMgr_event_save_c; + extern ACTOR_PROFILE Set_Npc_Manager_Profile; #ifdef __cplusplus @@ -15,4 +21,3 @@ extern ACTOR_PROFILE Set_Npc_Manager_Profile; #endif #endif - diff --git a/include/m_event_map_npc.h b/include/m_event_map_npc.h index fc42e768..d69a65c2 100644 --- a/include/m_event_map_npc.h +++ b/include/m_event_map_npc.h @@ -4,16 +4,46 @@ #include "types.h" #include "m_actor.h" #include "m_npc.h" +#include "ac_set_npc_manager.h" #ifdef __cplusplus extern "C" { #endif -extern int mEvMN_GetJointEventRandomNpc(mActor_name_t* selected_npc_id); -extern int mEvNM_CheckJointEvent(u32 id); -extern void mEvMN_GetEventNpcName(mActor_name_t* npc_name, int event, int idx, int param_4); -extern int mEvMN_GetEventTypeMap(void); +enum { + mEvMN_TYPE_FIREWORKS_SHOW, + mEvMN_TYPE_CHERRY_BLOSSOM_FESTIVAL, + mEvMN_TYPE_SPORTS_FAIR_FOOT_RACE, + mEvMN_TYPE_SPORTS_FAIR_AEROBICS, + mEvMN_TYPE_SPORTS_FAIR_BALL_TOSS, + mEvMN_TYPE_SPORTS_FAIR_TUG_OF_WAR, + mEvMN_TYPE_HALLOWEEN, + mEvMN_TYPE_NEW_YEARS_DAY, + mEvMN_TYPE_FISHING_TOURNEY_1, + mEvMN_TYPE_FISHING_TOURNEY_2, + mEvMN_TYPE_MORNING_AEROBICS, + mEvMN_TYPE_HARVEST_MOON_FESTIVAL, + mEvMN_TYPE_HARVEST_FESTIVAL, + mEvMN_TYPE_NEW_YEARS_EVE_COUNTDOWN, + mEvMN_TYPE_KAMAKURA, + mEvMN_TYPE_GROUNDHOG_DAY, + mEvMN_TYPE_METEOR_SHOWER, + + mEvMN_TYPE_NUM +}; + extern int mEvMN_GetMapIdx(int event_type); +extern int mEvMN_GetEventTypeMap(void); +extern u32 mEvMN_GetEventBlockKind(int map_type); +extern int mEvMN_GetJointNpcMax(int map_type); +extern int mEvMN_GetEventSetUtInBlockMapIdx(int* block_ux, int* block_uz, int map_type, int idx); +extern int mEvMN_GetEventSetUtInBlock(mActor_name_t* actor_name, int* block_ux, int* block_uz, int event_type, int idx); +extern void mEvMN_GetNpcJointEv(aSNMgr_event_save_c* event_data, int event_type); +extern void mEvMN_SetNpcJointEv(aSNMgr_event_save_c* event_data, int event_type); +extern void mEvMN_GetEventNpcName(mActor_name_t* npc_name, int event_type, int animal_idx, int idx); +extern int mEvNM_CheckJointEvent(mActor_name_t npc_name); +extern int mEvMN_GetJointEventRandomNpc(mActor_name_t* npc_name_p); +extern int mEvMN_CheckLapPlayer(int block_ux, int block_uz); #ifdef __cplusplus } diff --git a/include/m_museum_display.h b/include/m_museum_display.h index ac365c64..c7b94e2e 100644 --- a/include/m_museum_display.h +++ b/include/m_museum_display.h @@ -92,7 +92,7 @@ extern void mMmd_SetFossil(int fossil_no); extern void mMmd_SetArt(int art_no); extern void mMmd_SetInsect(int insect_no); extern void mMmd_SetFish(int fish_no); -extern mMmd_GetDisplayInfo(mActor_name_t item); +extern int mMmd_GetDisplayInfo(mActor_name_t item); extern int mMmd_RequestMuseumDisplay(mActor_name_t item); extern void mMmd_MakeMuseumDisplayData(); extern void mMmd_DeletePresentedByPlayer(u8 player_no); diff --git a/include/m_npc.h b/include/m_npc.h index 80feb7ed..18b0b854 100644 --- a/include/m_npc.h +++ b/include/m_npc.h @@ -393,7 +393,7 @@ extern int mNpc_BlockNum2ReservedUtNum(int* ut_x, int* ut_z, int bx, int bz); extern void mNpc_MakeReservedListBeforeFieldct(Anmhome_c* reserved, int reserved_num, u8* reserved_count); extern void mNpc_MakeReservedListAfterFieldct(Anmhome_c* reserved, int reserved_num, u8* reserved_count, u8 bx_max, u8 bz_max); -extern mNpc_InitNpcData(); +extern void mNpc_InitNpcData(); extern void mNpc_InitNpcList(mNpc_NpcList_c* npclist, int count); extern void mNpc_SetNpcList(mNpc_NpcList_c* npclist, Animal_c* animal, int count, int malloc_flag); extern void mNpc_SetNpcinfo(ACTOR* actor, s8 npc_info_idx); diff --git a/src/game/m_event_map_npc.c b/src/game/m_event_map_npc.c new file mode 100644 index 00000000..0fa75da4 --- /dev/null +++ b/src/game/m_event_map_npc.c @@ -0,0 +1,642 @@ +#include "m_event_map_npc.h" + +#include "m_actor_type.h" +#include "m_name_table.h" +#include "m_random_field_h.h" +#include "m_event.h" +#include "m_field_info.h" +#include "m_common_data.h" +#include "ac_set_npc_manager.h" + +// clang-format off +static int l_event_map_type_table[] = { + mEv_EVENT_FIREWORKS_SHOW, + mEv_EVENT_CHERRY_BLOSSOM_FESTIVAL, + mEv_EVENT_SPORTS_FAIR_FOOT_RACE, + mEv_EVENT_SPORTS_FAIR_AEROBICS, + mEv_EVENT_SPORTS_FAIR_BALL_TOSS, + mEv_EVENT_SPORTS_FAIR_TUG_OF_WAR, + mEv_EVENT_HALLOWEEN, + mEv_EVENT_NEW_YEARS_DAY, + mEv_EVENT_FISHING_TOURNEY_1, + mEv_EVENT_FISHING_TOURNEY_2, + mEv_EVENT_MORNING_AEROBICS, + mEv_EVENT_HARVEST_MOON_FESTIVAL, + mEv_EVENT_HARVEST_FESTIVAL, + mEv_EVENT_NEW_YEARS_EVE_COUNTDOWN, + mEv_EVENT_KAMAKURA, + mEv_EVENT_GROUNDHOG_DAY, + mEv_EVENT_METEOR_SHOWER, +}; +// clang-format on + +typedef struct event_map_actor_pos_s { + u8 ux; + u8 uz; +} mEvMN_actor_pos_c; + +typedef struct event_map_actor_info_s { + mActor_name_t* name_table; + mEvMN_actor_pos_c* pos_table; +} mEvMN_actor_info_c; + +typedef struct event_map_npc_data_s { + u16 are_npc_flags; + mActor_name_t cloth; +} mEvMN_npc_data_c; + +typedef struct event_map_data_s { + u8 get_npc_idx_type; + u8 normal_npc_max; // max number of 'normal' npcs to pull in for the event + u8 map_max; // max number of 'map' variants + u8 npc_max; // max total number of npcs, both normal, special, and structure + mEvMN_actor_info_c** actor_info; + mEvMN_npc_data_c* npc_data; + u32 block_kind; +} mEvMN_data_c; + +#include "../src/game/m_event_map_npc_data.c_inc" + +static int mEvMN_GetMapIdx_sub(int event_type) { + int* event_type_p = l_event_map_type_table; + int res = -1; + int i; + + for (i = 0; i < mEvMN_TYPE_NUM; i++) { + if (*event_type_p == event_type) { + res = i; + break; + } + + event_type_p++; + } + + return res; +} + +extern int mEvMN_GetMapIdx(int event_type) { + int res = mEvMN_GetMapIdx_sub(event_type); + + if (res != -1 && l_event_set_table[res] == NULL) { + res = -1; + } + + return res; +} + +extern int mEvMN_GetEventTypeMap(void) { + int* event_type_p = l_event_map_type_table; + int res = -1; + int i; + + for (i = 0; i < mEvMN_TYPE_NUM; i++) { + if (mEv_check_status(*event_type_p, mEv_STATUS_ACTIVE)) { + res = *event_type_p; + break; + } + + event_type_p++; + } + + return res; +} + +static int mEvMN_GetDataBaseIdx(u32 block_kind) { + int res = 0; + + if (block_kind == mRF_BLOCKKIND_POOL) { + res = mFI_GetPuleIdx(); + } + + return res; +} + +extern u32 mEvMN_GetEventBlockKind(int map_type) { + mEvMN_data_c* data_p = l_event_set_table[map_type]; + u32 block_kind = mRF_BLOCKKIND_NONE; + + if (data_p != NULL) { + block_kind = data_p->block_kind; + } + + return block_kind; +} + +static int mEvMN_GetJointAllNpcMax(int map_type) { + mEvMN_data_c* data_p = l_event_set_table[map_type]; + int npc_max = 0; + + if (data_p != NULL) { + npc_max = data_p->npc_max; + } + + return npc_max; +} + +extern int mEvMN_GetJointNpcMax(int map_type) { + mEvMN_data_c* data_p = l_event_set_table[map_type]; + int normal_npc_max = 0; + + if (data_p != NULL) { + normal_npc_max = data_p->normal_npc_max; + } + + return normal_npc_max; +} + +extern int mEvMN_GetEventSetUtInBlockMapIdx(int* block_ux, int* block_uz, int map_type, int idx) { + mEvMN_data_c* data_p; + mEvMN_actor_pos_c* pos_p; + mEvMN_actor_info_c* info_p; + int base_idx; + int res; + + res = FALSE; + if (map_type >= 0 && map_type < mEvMN_TYPE_NUM) { + data_p = l_event_set_table[map_type]; + + if (data_p != NULL) { + base_idx = mEvMN_GetDataBaseIdx(data_p->block_kind); + info_p = data_p->actor_info[base_idx]; + pos_p = &info_p->pos_table[idx]; + *block_ux = pos_p->ux; + *block_uz = pos_p->uz; + res = TRUE; + } + } + + return res; +} + +extern int mEvMN_GetEventSetUtInBlock(mActor_name_t* actor_name, int* block_ux, int* block_uz, int event_type, + int idx) { + mEvMN_data_c* data_p; + mEvMN_actor_pos_c* pos_p; + mEvMN_actor_info_c* info_p; + int base_idx; + int map_idx; + int res; + + res = FALSE; + map_idx = mEvMN_GetMapIdx(event_type); + if (map_idx != -1) { + data_p = l_event_set_table[map_idx]; + + if (data_p != NULL) { + base_idx = mEvMN_GetDataBaseIdx(data_p->block_kind); + info_p = data_p->actor_info[base_idx]; + pos_p = &info_p->pos_table[idx]; + *actor_name = info_p->name_table[idx]; + *block_ux = pos_p->ux; + *block_uz = pos_p->uz; + res = TRUE; + } + } + + return res; +} + +static int mEvMN_CheckCanJointEvent(Anmmem_c* memory, PersonalID_c* pid) { + int res = FALSE; + + if (mNpc_GetAnimalMemoryIdx(pid, memory, ANIMAL_MEMORY_NUM) != -1) { + res = TRUE; + } + + return res; +} + +static void mEvMN_GetNpcIdxRandom(u8* animal_idx, int max) { + Animal_c* animal = Save_Get(animals); + int idx; + int count = 0; + int animal_count = 0; + u16 animal_bitfield = 0; + int i; + + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (mNpc_CheckFreeAnimalPersonalID(&animal->id) == FALSE) { + animal_count++; + animal_bitfield |= 1 << i; + } + + animal++; + } + + animal_count -= max; + animal -= ANIMAL_NUM_MAX; + if (animal_count > 0 && mLd_PlayerManKindCheck() == FALSE) { + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (((animal_bitfield >> i) & 1) == 1 && + mEvMN_CheckCanJointEvent(animal->memories, &Now_Private->player_ID) == FALSE) { + animal_count--; + animal_bitfield &= ~(1 << i); + + if (animal_count <= 0) { + break; + } + } + + animal++; + } + } + + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (((animal_bitfield >> i) & 1) == 1) { + count++; + } + } + + if (count < max) { + max = count; + } + + while (count > 0 && max > 0) { + if (animal_bitfield == 0) { + break; + } + + idx = RANDOM(count); + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (((animal_bitfield >> i) & 1) == 1) { + if (idx <= 0) { + *animal_idx = (u8)i; + count--; + animal_bitfield &= ~(1 << i); + break; + } + + idx--; + } + } + + if (i == ANIMAL_NUM_MAX) { + break; + } + + max--; + animal_idx++; + } +} + +typedef void (*mEvMN_GET_NPC_IDX_PROC)(u8*, int); + +static void mEvMN_GetNpcIdx(u8* animal_idx, int max, u8 type) { + static mEvMN_GET_NPC_IDX_PROC get_npc_idx[] = { &mEvMN_GetNpcIdxRandom }; + + (*get_npc_idx[type])(animal_idx, max); +} + +extern void mEvMN_GetNpcJointEv(aSNMgr_event_save_c* event_data, int event_type) { + int idx; + mEvMN_data_c* data_p; + + idx = mEvMN_GetMapIdx(event_type); + if (idx != -1) { + data_p = l_event_set_table[idx]; + + if (data_p != NULL) { + mEvMN_GetNpcIdx(event_data->animal_idx, data_p->normal_npc_max, data_p->get_npc_idx_type); + } + } +} + +static void mEvMN_ClearRemoveNpcJoint(u8* animal_idx, int max) { + Animal_c* animal; + int i; + + for (i = 0; i < max; i++) { + if (*animal_idx != 0xFF && *animal_idx < ANIMAL_NUM_MAX) { + animal = Save_GetPointer(animals[*animal_idx]); + + if (mNpc_CheckFreeAnimalInfo(animal) == TRUE) { + *animal_idx = 0xFF; + } + } + + animal_idx++; + } +} + +static void mEvMN_SetNpcJointEvRandom(u8* animal_idx, int max) { + Animal_c* animal = Save_Get(animals); + int idx; + u16 animal_bitfield = 0; + int count = 0; + int animal_count = 0; + int req_count = 0; + int i; + int j; + + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (mNpc_CheckFreeAnimalPersonalID(&animal[i].id) == FALSE) { + animal_count++; + animal_bitfield |= 1 << i; + } + } + + for (i = 0; i < max; i++) { + if (*animal_idx != 0xFF && *animal_idx < ANIMAL_NUM_MAX) { + if (((animal_bitfield >> (*animal_idx)) & 1) == 1) { + animal_count--; + } + + animal_bitfield &= ~(1 << (*animal_idx)); + } else { + req_count++; + } + + animal_idx++; + } + + animal_count -= max; + animal_idx -= max; + + if (animal_count > 0 && mLd_PlayerManKindCheck() == FALSE) { + animal = Save_Get(animals); + + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (((animal_bitfield >> i) & 1) == 1 && + mEvMN_CheckCanJointEvent(animal[i].memories, &Now_Private->player_ID) == FALSE) { + animal_count--; + animal_bitfield &= ~(1 << i); + + if (animal_count <= 0) { + break; + } + } + } + } + + for (i = 0; i < ANIMAL_NUM_MAX; i++) { + if (((animal_bitfield >> i) & 1) == 1) { + count++; + } + } + + if (count < req_count) { + req_count = count; + } + + if (req_count > 0) { + for (i = 0; i < max; i++) { + if (animal_bitfield == 0 || count <= 0) { + break; + } + + if (*animal_idx == 0xFF) { + idx = RANDOM(count); // @cleanup - we don't need this, it's leftover from a copy-paste job? + + for (j = 0; j < ANIMAL_NUM_MAX; j++) { + if (((animal_bitfield >> j) & 1) == 1) { + *animal_idx = (u8)j; + count--; + animal_bitfield &= ~(1 << j); + break; + } + } + } + + animal_idx++; + } + } +} + +extern void mEvMN_SetNpcJointEv(aSNMgr_event_save_c* event_data, int event_type) { + int idx = mEvMN_GetMapIdx(event_type); + mEvMN_data_c* data_p; + + if (idx != -1) { + data_p = l_event_set_table[idx]; + + if (data_p != NULL) { + mEvMN_ClearRemoveNpcJoint(event_data->animal_idx, data_p->normal_npc_max); + mEvMN_SetNpcJointEvRandom(event_data->animal_idx, data_p->normal_npc_max); + } + } +} + +static mNpc_EventNpc_c* mEvMN_CheckEventNpcList(mActor_name_t npc_name) { + mNpc_EventNpc_c* event_npc = Common_Get(event_npc); + mNpc_EventNpc_c* ret_npc = NULL; + int i; + + for (i = 0; i < mNpc_EVENT_NPC_NUM; i++) { + if (event_npc->in_use == TRUE && event_npc->npc_id == npc_name) { + ret_npc = event_npc; + } + + event_npc++; + } + + return ret_npc; +} + +static void mEvMN_GetFireWorksNpcName(mActor_name_t* npc_name, int map_type, int animal_idx, int idx) { + int max_npc = l_event_set_table[map_type]->normal_npc_max; + + if (idx >= 0 && idx < max_npc && map_type >= 0 && map_type < mEvMN_TYPE_NUM) { + mNpc_EventNpc_c* event_npc = mEvMN_CheckEventNpcList(*npc_name); + + if (event_npc == NULL) { + mEvMN_data_c* data_p = l_event_set_table[map_type]; + + if (data_p != NULL) { + int base_idx = mEvMN_GetDataBaseIdx(data_p->block_kind); + mEvMN_actor_info_c* info_p = data_p->actor_info[base_idx]; + mEvMN_npc_data_c* npc_p = data_p->npc_data; + mActor_name_t spnpc_name = info_p->name_table[idx]; + mActor_name_t tex_name; + mActor_name_t anm_name = *npc_name; + mActor_name_t cloth_name; + u16 check_bitfield = npc_p->are_npc_flags; + + if (((check_bitfield >> idx) & 1) == 1) { + cloth_name = npc_p->cloth; + tex_name = anm_name; + + if (cloth_name != EMPTY_NO && + mNpc_GetLooks2Sex(Save_Get(animals[animal_idx]).id.looks) == mPr_SEX_MALE) { + cloth_name++; + } + } else { + tex_name = spnpc_name; + cloth_name = EMPTY_NO; + } + + mNpc_RegistEventNpc(spnpc_name, tex_name, anm_name, cloth_name); + *npc_name = spnpc_name; + } + } else { + *npc_name = event_npc->event_id; + } + } +} + +static void mEvMN_GetHalloweenNpcName(mActor_name_t* npc_name, int map_type, int animal_idx, int idx) { + mNpc_EventNpc_c* event_npc = mEvMN_CheckEventNpcList(*npc_name); + + if (event_npc == NULL) { + int free_idx = mNpc_GetFreeEventNpcIdx(); + + if (free_idx != -1) { + mActor_name_t event_name = SP_NPC_EV_HALLOWEEN_0 + free_idx; + + mNpc_RegistEventNpc(event_name, event_name, *npc_name, EMPTY_NO); + *npc_name = event_name; + } + } else { + *npc_name = event_npc->event_id; + } +} + +typedef void (*mEvMN_SET_NAME_PROC)(mActor_name_t*, int, int, int); + +extern void mEvMN_GetEventNpcName(mActor_name_t* npc_name, int event_type, int animal_idx, int idx) { + // clang-format off + static mEvMN_SET_NAME_PROC set_name[] = { + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetHalloweenNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + &mEvMN_GetFireWorksNpcName, + }; + // clang-format on + + int map_type = mEvMN_GetMapIdx_sub(event_type); + + if (map_type != -1) { + (*set_name[map_type])(npc_name, map_type, animal_idx, idx); + } +} + +static int mEvMN_GetNpcIdxListJointEvent(u8** npc_idx_pp, int* npc_max_p) { + aSNMgr_event_save_c* event_save_p; + int event_type; + int map_type; + int res; + + res = FALSE; + *npc_idx_pp = NULL; + *npc_max_p = 0; + event_type = mEvMN_GetEventTypeMap(); + + if (event_type != -1) { + map_type = mEvMN_GetMapIdx(event_type); + + if (map_type != -1) { + event_save_p = (aSNMgr_event_save_c*)mEv_get_save_area(event_type, 15); + + if (event_save_p != NULL) { + *npc_max_p = mEvMN_GetJointNpcMax(map_type); + *npc_idx_pp = event_save_p->animal_idx; + res = TRUE; + } + } + } + + return res; +} + +extern int mEvNM_CheckJointEvent(mActor_name_t npc_name) { + u8* animal_idx_p; + int npc_max; + int animal_idx; + int res; + int i; + + res = FALSE; + + if (ITEM_NAME_GET_TYPE(npc_name) == NAME_TYPE_NPC && + mEvMN_GetNpcIdxListJointEvent(&animal_idx_p, &npc_max) == TRUE && animal_idx_p != NULL) { + animal_idx = mNpc_SearchAnimalinfo(Save_Get(animals), npc_name, ANIMAL_NUM_MAX); + + if (animal_idx != -1) { + for (i = 0; i < npc_max; i++) { + if (*animal_idx_p != 0xFF && *animal_idx_p == (u8)animal_idx) { + res = TRUE; + break; + } + + animal_idx_p++; + } + } + } + + return res; +} + +extern int mEvMN_GetJointEventRandomNpc(mActor_name_t* npc_name_p) { + Animal_c* animal; + u8* animal_idx_p; + int npc_max; + int sel_npc_idx; + int sel_idx; + int res; + + res = FALSE; + if (mEvMN_GetNpcIdxListJointEvent(&animal_idx_p, &npc_max) == TRUE) { + sel_idx = RANDOM(npc_max); + sel_npc_idx = animal_idx_p[sel_idx]; + animal = Save_GetPointer(animals[sel_npc_idx]); + *npc_name_p = animal->id.npc_id; + res = TRUE; + } + + return res; +} + +extern int mEvMN_CheckLapPlayer(int block_ux, int block_uz) { + int event_type; + int map_type; + int npc_max; + mActor_name_t name; + int ux; + int uz; + int res; + int i; + int j; + int k; + + event_type = mEvMN_GetEventTypeMap(); + if (event_type != -1) { + map_type = mEvMN_GetMapIdx(event_type); + if (map_type != -1) { + npc_max = mEvMN_GetJointAllNpcMax(map_type); + if (npc_max > 0) { + for (i = 0; i < npc_max; i++) { + mEvMN_GetEventSetUtInBlock(&name, &ux, &uz, event_type, i); + + if (ITEM_NAME_GET_TYPE(name) == NAME_TYPE_STRUCT) { + res = mFI_CheckStructureArea(block_ux, block_uz, name, ux, uz); + if (res == TRUE) { + return 2; + } + } else { + for (j = -1; j < 2; j++) { + for (k = -1; k < 2; k++) { + if (block_ux == ux + k && block_uz == uz + j) { + return 1; + } + } + } + } + } + } + } + } + + return 0; +} diff --git a/src/game/m_event_map_npc_data.c_inc b/src/game/m_event_map_npc_data.c_inc new file mode 100644 index 00000000..b889778b --- /dev/null +++ b/src/game/m_event_map_npc_data.c_inc @@ -0,0 +1,821 @@ +// clang-format off + +// hny - Happy New Year? +static mActor_name_t l_hny_set_actor0[] = { + SP_NPC_EV_HATUMODE_0, + SP_NPC_EV_HATUMODE_1, + SP_NPC_EV_HATUMODE_2, + SP_NPC_EV_HATUMODE_3, + SP_NPC_EV_HATUMODE_4, + SP_NPC_EV_MIKO, + NEWYEAR_TABLE, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_hny_map[] = { + { 7, 9 }, // SP_NPC_EV_HATUMODE_0 + { 6, 10 }, // SP_NPC_EV_HATUMODE_1 + { 9, 10 }, // SP_NPC_EV_HATUMODE_2 + { 6, 12 }, // SP_NPC_EV_HATUMODE_3 + { 9, 12 }, // SP_NPC_EV_HATUMODE_4 + { 3, 3 }, // SP_NPC_EV_MIKO + { 3, 3 }, // NEWYEAR_TABLE + { 11, 6 }, // SP_NPC_EV_SONCHO2 +}; + +static mEvMN_actor_info_c l_hny_set_dt = { l_hny_set_actor0, l_hny_map }; +static mEvMN_actor_info_c* l_hny_set_dt_table[] = { &l_hny_set_dt }; +static mEvMN_npc_data_c l_hny_set_npc = { 0b00011111, EMPTY_NO }; +static mEvMN_data_c l_hny_set_data = { 0, 4, 1, 8, l_hny_set_dt_table, &l_hny_set_npc, mRF_BLOCKKIND_SHRINE }; + +// fsh - Fishing Tourney +static mActor_name_t l_fsh_set_actor0[] = { + SP_NPC_EV_TURI_0, + SP_NPC_EV_TURI_1, + SP_NPC_EV_TURI_2, + SP_NPC_EV_TURI_3, + SP_NPC_EV_TURI_4, + SP_NPC_ANGLER, + FISHCHECK_STAND0, +}; + +static mActor_name_t l_fsh_set_actor1[] = { + SP_NPC_EV_TURI_0, + SP_NPC_EV_TURI_1, + SP_NPC_EV_TURI_2, + SP_NPC_EV_TURI_3, + SP_NPC_EV_TURI_4, + SP_NPC_ANGLER, + FISHCHECK_STAND1, +}; + +static mEvMN_actor_pos_c l_fsh_pule1_map[] = { + { 9, 7 }, // SP_NPC_EV_TURI_0 + { 3, 3 }, // SP_NPC_EV_TURI_1 + { 2, 4 }, // SP_NPC_EV_TURI_2 + { 12, 2 }, // SP_NPC_EV_TURI_3 + { 2, 11 }, // SP_NPC_EV_TURI_4 + { 10, 13 }, // SP_NPC_ANGLER + { 12, 12 }, // FISHCHECK_STAND0 +}; + +static mEvMN_actor_info_c l_fsh_pule1_set_dt = { l_fsh_set_actor0, l_fsh_pule1_map }; + +static mEvMN_actor_pos_c l_fsh_pule2_map[] = { + { 6, 5 }, // SP_NPC_EV_TURI_0 + { 13, 12 }, // SP_NPC_EV_TURI_1 + { 12, 13 }, // SP_NPC_EV_TURI_2 + { 13, 2 }, // SP_NPC_EV_TURI_3 + { 2, 3 }, // SP_NPC_EV_TURI_4 + { 5, 13 }, // SP_NPC_ANGLER + { 3, 12 }, // FISHCHECK_STAND1 +}; + +static mEvMN_actor_info_c l_fsh_pule2_set_dt = { l_fsh_set_actor1, l_fsh_pule2_map }; + +static mEvMN_actor_pos_c l_fsh_pule3_map[] = { + { 4, 10 }, // SP_NPC_EV_TURI_0 + { 4, 4 }, // SP_NPC_EV_TURI_1 + { 5, 3 }, // SP_NPC_EV_TURI_2 + { 13, 7 }, // SP_NPC_EV_TURI_3 + { 13, 3 }, // SP_NPC_EV_TURI_4 + { 10, 13 }, // SP_NPC_ANGLER + { 12, 12 }, // FISHCHECK_STAND0 +}; + +static mEvMN_actor_info_c l_fsh_pule3_set_dt = { l_fsh_set_actor0, l_fsh_pule3_map }; + +static mEvMN_actor_pos_c l_fsh_pule4_map[] = { + { 9, 5 }, // SP_NPC_EV_TURI_0 + { 2, 3 }, // SP_NPC_EV_TURI_1 + { 3, 2 }, // SP_NPC_EV_TURI_2 + { 7, 2 }, // SP_NPC_EV_TURI_3 + { 13, 10 }, // SP_NPC_EV_TURI_4 + { 5, 13 }, // SP_NPC_ANGLER + { 3, 12 }, // FISHCHECK_STAND1 +}; + +static mEvMN_actor_info_c l_fsh_pule4_set_dt = { l_fsh_set_actor1, l_fsh_pule4_map }; + +static mEvMN_actor_pos_c l_fsh_pule5_map[] = { + { 8, 7 }, // SP_NPC_EV_TURI_0 + { 12, 6 }, // SP_NPC_EV_TURI_1 + { 13, 7 }, // SP_NPC_EV_TURI_2 + { 2, 2 }, // SP_NPC_EV_TURI_3 + { 13, 13 }, // SP_NPC_EV_TURI_4 + { 10, 2 }, // SP_NPC_ANGLER + { 12, 3 }, // FISHCHECK_STAND1 +}; + +static mEvMN_actor_info_c l_fsh_pule5_set_dt = { l_fsh_set_actor1, l_fsh_pule5_map }; + +static mEvMN_actor_pos_c l_fsh_pule6_map[] = { + { 6, 6 }, // SP_NPC_EV_TURI_0 + { 12, 2 }, // SP_NPC_EV_TURI_1 + { 13, 3 }, // SP_NPC_EV_TURI_2 + { 3, 2 }, // SP_NPC_EV_TURI_3 + { 2, 13 }, // SP_NPC_EV_TURI_4 + { 10, 13 }, // SP_NPC_ANGLER + { 12, 12 }, // FISHCHECK_STAND0 +}; + +static mEvMN_actor_info_c l_fsh_pule6_set_dt = { l_fsh_set_actor0, l_fsh_pule6_map }; + +static mEvMN_actor_pos_c l_fsh_pule7_map[] = { + { 9, 10 }, // SP_NPC_EV_TURI_0 + { 13, 8 }, // SP_NPC_EV_TURI_1 + { 13, 9 }, // SP_NPC_EV_TURI_2 + { 13, 3 }, // SP_NPC_EV_TURI_3 + { 3, 13 }, // SP_NPC_EV_TURI_4 + { 2, 5 }, // SP_NPC_ANGLER + { 3, 3 }, // FISHCHECK_STAND0 +}; + +static mEvMN_actor_info_c l_fsh_pule7_set_dt = { l_fsh_set_actor0, l_fsh_pule7_map }; + +static mEvMN_actor_info_c* l_fsh_set_dt_table[] = { + &l_fsh_pule1_set_dt, + &l_fsh_pule2_set_dt, + &l_fsh_pule3_set_dt, + &l_fsh_pule4_set_dt, + &l_fsh_pule5_set_dt, + &l_fsh_pule6_set_dt, + &l_fsh_pule7_set_dt, +}; + +static mEvMN_npc_data_c l_fsh_set_npc = { 0b0011111, ITM_CLOTH022 }; +static mEvMN_data_c l_fsh_set_data = { 0, 4, 7, 7, l_fsh_set_dt_table, &l_fsh_set_npc, mRF_BLOCKKIND_POOL }; + +// rc - Radio Calisthenics +static mActor_name_t l_rc_set_actor0[] = { + SP_NPC_EV_TAISOU_1, + SP_NPC_EV_TAISOU_2, + SP_NPC_EV_TAISOU_3, + SP_NPC_EV_TAISOU_4, + SP_NPC_EV_TAISOU_0, + AEROBICS_RADIO, + SP_NPC_SONCHO_D078, +}; + +static mEvMN_actor_pos_c l_rc_map[] = { + { 4, 10 }, // SP_NPC_EV_TAISOU_1 + { 6, 10 }, // SP_NPC_EV_TAISOU_2 + { 8, 10 }, // SP_NPC_EV_TAISOU_3 + { 10, 10 }, // SP_NPC_EV_TAISOU_4 + { 7, 12 }, // SP_NPC_EV_TAISOU_0 + { 5, 13 }, // AEROBICS_RADIO + { 9, 8 }, // SP_NPC_SONCHO_D078 +}; + +static mEvMN_actor_info_c l_rc_set_dt = { l_rc_set_actor0, l_rc_map }; +static mEvMN_actor_info_c* l_rc_set_dt_table[] = { &l_rc_set_dt }; +static mEvMN_npc_data_c l_rc_set_npc = { 0b0011111, EMPTY_NO }; +static mEvMN_data_c l_rc_set_data = { 0, 4, 1, 7, l_rc_set_dt_table, &l_rc_set_npc, mRF_BLOCKKIND_SHRINE }; + +// fws - Fireworks Show +static mActor_name_t l_fws_set_actor0[] = { + SP_NPC_EV_HANABI_0, + SP_NPC_EV_HANABI_1, + SP_NPC_EV_HANABI_2, + SP_NPC_EV_HANABI_3, + SP_NPC_EV_HANABI_4, + SP_NPC_EV_YOMISE, + FIREWORKS_STALL0, +}; + +static mActor_name_t l_fws_set_actor1[] = { + SP_NPC_EV_HANABI_0, + SP_NPC_EV_HANABI_1, + SP_NPC_EV_HANABI_2, + SP_NPC_EV_HANABI_3, + SP_NPC_EV_HANABI_4, + SP_NPC_EV_YOMISE2, + FIREWORKS_STALL1, +}; + +static mEvMN_actor_pos_c l_fws_pule1_map[] = { + { 2, 3 }, + { 8, 1 }, + { 2, 11 }, + { 13, 7 }, + { 3, 3 }, + { 12, 12 }, + { 12, 12 }, +}; + +static mEvMN_actor_info_c l_fws_pule1_set_dt = { l_fws_set_actor1, l_fws_pule1_map }; + +static mEvMN_actor_pos_c l_fws_pule2_map[] = { + { 13, 13 }, + { 1, 3 }, + { 13, 2 }, + { 3, 8 }, + { 14, 7 }, + { 3, 12 }, + { 3, 12 }, +}; + +static mEvMN_actor_info_c l_fws_pule2_set_dt = { l_fws_set_actor0, l_fws_pule2_map }; + +static mEvMN_actor_pos_c l_fws_pule3_map[] = { + { 12, 2 }, + { 2, 3 }, + { 7, 2 }, + { 12, 7 }, + { 13, 7 }, + { 12, 11 }, + { 12, 11 }, +}; + +static mEvMN_actor_info_c l_fws_pule3_set_dt = { l_fws_set_actor1, l_fws_pule3_map }; + +static mEvMN_actor_pos_c l_fws_pule4_map[] = { + { 13, 11 }, + { 2, 3 }, + { 7, 2 }, + { 2, 8 }, + { 9, 12 }, + { 3, 12 }, + { 3, 12 }, +}; + +static mEvMN_actor_info_c l_fws_pule4_set_dt = { l_fws_set_actor0, l_fws_pule4_map }; + +static mEvMN_actor_pos_c l_fws_pule5_map[] = { + { 13, 6 }, + { 1, 7 }, + { 13, 13 }, + { 2, 2 }, + { 1, 11 }, + { 12, 3 }, + { 12, 3 }, +}; + +static mEvMN_actor_info_c l_fws_pule5_set_dt = { l_fws_set_actor1, l_fws_pule5_map }; + +static mEvMN_actor_pos_c l_fws_pule6_map[] = { + { 13, 2 }, + { 1, 8 }, + { 8, 1 }, + { 9, 13 }, + { 6, 14 }, + { 12, 11 }, + { 12, 11 }, +}; + +static mEvMN_actor_info_c l_fws_pule6_set_dt = { l_fws_set_actor1, l_fws_pule6_map }; + +static mEvMN_actor_pos_c l_fws_pule7_map[] = { + { 13, 12 }, + { 12, 2 }, + { 2, 11 }, + { 3, 7 }, + { 8, 1 }, + { 3, 3 }, + { 3, 3 }, +}; + +static mEvMN_actor_info_c l_fws_pule7_set_dt = { l_fws_set_actor0, l_fws_pule7_map }; + +static mEvMN_actor_info_c* l_fws_set_dt_table[] = { + &l_fws_pule1_set_dt, + &l_fws_pule2_set_dt, + &l_fws_pule3_set_dt, + &l_fws_pule4_set_dt, + &l_fws_pule5_set_dt, + &l_fws_pule6_set_dt, + &l_fws_pule7_set_dt, +}; + +static mEvMN_npc_data_c l_fws_set_npc = { 0b0011111, EMPTY_NO }; +static mEvMN_data_c l_fws_set_data = { 0, 4, 7, 7, l_fws_set_dt_table, &l_fws_set_npc, mRF_BLOCKKIND_POOL }; + +// fv - Flower Viewing +static mActor_name_t l_fv_set_actor0[] = { + SP_NPC_EV_HANAMI_0, + SP_NPC_EV_HANAMI_1, + SP_NPC_EV_HANAMI_2, + SP_NPC_EV_HANAMI_3, + SP_NPC_EV_HANAMI_4, + SAKURA_TABLE1, + SAKURA_TABLE0, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_fv_map[] = { + { 10, 6 }, + { 12, 8 }, + { 6, 10 }, + { 4, 12 }, + { 4, 6 }, + { 5, 11 }, + { 11, 7 }, + { 9, 11 }, +}; + +static mEvMN_actor_info_c l_fv_set_dt = { l_fv_set_actor0, l_fv_map }; +static mEvMN_actor_info_c* l_fv_set_dt_table[] = { &l_fv_set_dt }; +static mEvMN_npc_data_c l_fv_set_npc = { 0b0011111, EMPTY_NO }; +static mEvMN_data_c l_fv_set_data = { 0, 5, 1, 8, l_fv_set_dt_table, &l_fv_set_npc, mRF_BLOCKKIND_SHRINE }; + +/* fdd_radio - Field Day Calisthenics */ +static mActor_name_t l_fdd_radio_set_actor0[] = { + SP_NPC_EV_TAISOU_1, + SP_NPC_EV_TAISOU_2, + SP_NPC_EV_TAISOU_3, + SP_NPC_EV_TAISOU_4, + SP_NPC_EV_TAISOU_0, + AEROBICS_RADIO, + SP_NPC_SONCHO_D078, +}; + +static mEvMN_actor_pos_c l_fdd_radio_map[] = { + { 4, 10 }, + { 6, 10 }, + { 8, 10 }, + { 10, 10 }, + { 7, 12 }, + { 5, 13 }, + { 9, 8 }, +}; + +static mEvMN_actor_info_c l_fdd_radio_set_dt = { l_fdd_radio_set_actor0, l_fdd_radio_map }; +static mEvMN_actor_info_c* l_fdd_radio_set_dt_table[] = { &l_fdd_radio_set_dt }; +static mEvMN_npc_data_c l_fdd_radio_set_npc = { 0b0011111, ITM_CLOTH020 }; +static mEvMN_data_c l_fdd_radio_set_data = { 0, 4, 1, 7, l_fdd_radio_set_dt_table, &l_fdd_radio_set_npc, mRF_BLOCKKIND_SHRINE }; + +/* fdd_tokyoso - Field Day Footrace */ +static mActor_name_t l_fdd_tokyoso_set_actor0[] = { + SP_NPC_EV_TOKYOSO_0, + SP_NPC_EV_TOKYOSO_1, + SP_NPC_EV_TOKYOSO_2, + SP_NPC_EV_TOKYOSO_3, + SP_NPC_EV_TOKYOSO_4, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_fdd_tokyoso_map[] = { + { 13, 3 }, + { 11, 7 }, + { 12, 7 }, + { 14, 7 }, + { 14, 8 }, + { 5, 8 }, +}; + +static mEvMN_actor_info_c l_fdd_tokyoso_set_dt = { l_fdd_tokyoso_set_actor0, l_fdd_tokyoso_map }; +static mEvMN_actor_info_c* l_fdd_tokyoso_set_dt_table[] = { &l_fdd_tokyoso_set_dt }; +static mEvMN_npc_data_c l_fdd_tokyoso_set_npc = { 0b0011111, ITM_CLOTH020 }; +static mEvMN_data_c l_fdd_tokyoso_set_data = { 0, 5, 1, 6, l_fdd_tokyoso_set_dt_table, &l_fdd_tokyoso_set_npc, mRF_BLOCKKIND_SHRINE }; + +/* fdd_tama - Field Day Ball Toss */ +static mActor_name_t l_fdd_tama_set_actor0[] = { + SP_NPC_EV_TAMAIRE_0, + SP_NPC_EV_TAMAIRE_1, + SP_NPC_EV_TAMAIRE_2, + SP_NPC_EV_TAMAIRE_3, + SP_NPC_EV_TAMAIRE_4, + SPORTSFAIR_BALLS_RED, + SPORTSFAIR_BASKET_RED, + SPORTSFAIR_BALLS_WHITE, + SPORTSFAIR_BASKET_WHITE, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_fdd_tama_map[] = { + { 7, 12 }, + { 5, 6 }, + { 2, 9 }, + { 13, 6 }, + { 10, 9 }, + { 3, 8 }, + { 3, 8 }, + { 12, 8 }, + { 12, 8 }, + { 9, 4 }, +}; + +static mEvMN_actor_info_c l_fdd_tama_set_dt = { l_fdd_tama_set_actor0, l_fdd_tama_map }; +static mEvMN_actor_info_c* l_fdd_tama_set_dt_table[] = { &l_fdd_tama_set_dt }; +static mEvMN_npc_data_c l_fdd_tama_set_npc = { 0b0011111, ITM_CLOTH020 }; +static mEvMN_data_c l_fdd_tama_set_data = { 0, 5, 1, 10, l_fdd_tama_set_dt_table, &l_fdd_tama_set_npc, mRF_BLOCKKIND_SHRINE }; + +/* fdd_tuna - Field Day Tug o' War */ +static mActor_name_t l_fdd_tuna_set_actor0[] = { + SP_NPC_EV_TUNAHIKI_0, + SP_NPC_EV_TUNAHIKI_1, + SP_NPC_EV_TUNAHIKI_2, + SP_NPC_EV_TUNAHIKI_3, + SP_NPC_EV_TUNAHIKI_4, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_fdd_tuna_map[] = { + { 7, 10 }, + { 3, 11 }, + { 4, 11 }, + { 11, 11 }, + { 12, 11 }, + { 10, 8 }, +}; + +static mEvMN_actor_info_c l_fdd_tuna_set_dt = { l_fdd_tuna_set_actor0, l_fdd_tuna_map }; +static mEvMN_actor_info_c* l_fdd_tuna_set_dt_table[] = { &l_fdd_tuna_set_dt }; +static mEvMN_npc_data_c l_fdd_tuna_set_npc = { 0b0011111, ITM_CLOTH020 }; +static mEvMN_data_c l_fdd_tuna_set_data = { 0, 5, 1, 6, l_fdd_tuna_set_dt_table, &l_fdd_tuna_set_npc, mRF_BLOCKKIND_SHRINE }; + +// cdn - Countdown +static mActor_name_t l_cdn_set_actor0[] = { + SP_NPC_EV_COUNTDOWN_0, + SP_NPC_EV_COUNTDOWN_1, + SP_NPC_EV_COUNTDOWN_2, + SP_NPC_EV_COUNTDOWN_3, + SP_NPC_EV_COUNTDOWN_4, + NEWYEAR_COUNTDOWN0, + NEWYEAR_COUNTDOWN1, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_cdn_pule1_map[] = { + { 10, 13 }, + { 13, 9 }, + { 12, 2 }, + { 2, 3 }, + { 2, 11 }, + { 12, 12 }, + { 12, 11 }, + { 2, 11 }, +}; + +static mEvMN_actor_info_c l_cdn_pule1_set_dt = { l_cdn_set_actor0, l_cdn_pule1_map }; + +static mEvMN_actor_pos_c l_cdn_pule2_map[] = { + { 5, 13 }, + { 13, 13 }, + { 13, 2 }, + { 4, 3 }, + { 13, 12 }, + { 3, 12 }, + { 3, 11 }, + { 5, 2 }, +}; + +static mEvMN_actor_info_c l_cdn_pule2_set_dt = { l_cdn_set_actor0, l_cdn_pule2_map }; + +static mEvMN_actor_pos_c l_cdn_pule3_map[] = { + { 10, 13 }, + { 12, 8 }, + { 2, 12 }, + { 4, 3 }, + { 12, 3 }, + { 12, 12 }, + { 12, 11 }, + { 3, 13 }, +}; + +static mEvMN_actor_info_c l_cdn_pule3_set_dt = { l_cdn_set_actor0, l_cdn_pule3_map }; + +static mEvMN_actor_pos_c l_cdn_pule4_map[] = { + { 5, 13 }, + { 8, 13 }, + { 13, 10 }, + { 12, 3 }, + { 2, 3 }, + { 3, 12 }, + { 3, 11 }, + { 12, 4 }, +}; + +static mEvMN_actor_info_c l_cdn_pule4_set_dt = { l_cdn_set_actor0, l_cdn_pule4_map }; + +static mEvMN_actor_pos_c l_cdn_pule5_map[] = { + { 11, 4 }, + { 13, 6 }, + { 2, 2 }, + { 10, 2 }, + { 13, 13 }, + { 13, 4 }, + { 13, 3 }, + { 2, 13 }, +}; + +static mEvMN_actor_info_c l_cdn_pule5_set_dt = { l_cdn_set_actor0, l_cdn_pule5_map }; + +static mEvMN_actor_pos_c l_cdn_pule6_map[] = { + { 10, 13 }, + { 13, 8 }, + { 12, 2 }, + { 4, 4 }, + { 2, 13 }, + { 12, 12 }, + { 12, 11 }, + { 13, 3 }, +}; + +static mEvMN_actor_info_c l_cdn_pule6_set_dt = { l_cdn_set_actor0, l_cdn_pule6_map }; + +static mEvMN_actor_pos_c l_cdn_pule7_map[] = { + { 5, 2 }, + { 2, 7 }, + { 13, 3 }, + { 12, 13 }, + { 3, 13 }, + { 3, 3 }, + { 3, 2 }, + { 13, 11 }, +}; + +static mEvMN_actor_info_c l_cdn_pule7_set_dt = { l_cdn_set_actor0, l_cdn_pule7_map }; + +static mEvMN_actor_info_c* l_cdn_set_dt_table[] = { + &l_cdn_pule1_set_dt, + &l_cdn_pule2_set_dt, + &l_cdn_pule3_set_dt, + &l_cdn_pule4_set_dt, + &l_cdn_pule5_set_dt, + &l_cdn_pule6_set_dt, + &l_cdn_pule7_set_dt, +}; + +static mEvMN_npc_data_c l_cdn_set_npc = { 0b0011111, EMPTY_NO }; +static mEvMN_data_c l_cdn_set_data = { 0, 4, 7, 8, l_cdn_set_dt_table, &l_cdn_set_npc, mRF_BLOCKKIND_POOL }; + +/* kk - Kamakura */ +static mActor_name_t l_kk_set_actor0[] = { + SP_NPC_EV_KAMAKURA_0, +}; + +static mEvMN_actor_pos_c l_kk_map[] = { + { 4, 7 }, +}; + +static mEvMN_actor_info_c l_kk_set_dt = { l_kk_set_actor0, l_kk_map }; +static mEvMN_actor_info_c* l_kk_set_dt_table[] = { &l_kk_set_dt }; +static mEvMN_npc_data_c l_kk_set_npc = { 0b1, EMPTY_NO }; +static mEvMN_data_c l_kk_set_data = { 0, 1, 1, 1, l_kk_set_dt_table, &l_kk_set_npc, mRF_BLOCKKIND_NONE }; + +// gh - Groundhog Day +static mActor_name_t l_gh_set_actor0[] = { + SP_NPC_EV_GROUNDHOG_0, + SP_NPC_EV_GROUNDHOG_1, + SP_NPC_EV_GROUNDHOG_2, + SP_NPC_EV_GROUNDHOG_3, + SP_NPC_EV_SPEECH_SONCHO, + GHOG, +}; + +static mEvMN_actor_pos_c l_gh_map[] = { + { 5, 12 }, + { 6, 12 }, + { 8, 12 }, + { 10, 12 }, + { 8, 9 }, + { 7, 9 }, +}; + +static mEvMN_actor_info_c l_gh_set_dt = { l_gh_set_actor0, l_gh_map }; +static mEvMN_actor_info_c* l_gh_set_dt_table[] = { &l_gh_set_dt }; +static mEvMN_npc_data_c l_gh_set_npc = { 0b011111, EMPTY_NO }; +static mEvMN_data_c l_gh_set_data = { 0, 4, 1, 6, l_gh_set_dt_table, &l_gh_set_npc, mRF_BLOCKKIND_SHRINE }; + +// hm - Harvest Moon +static mActor_name_t l_hm_set_actor0[] = { + SP_NPC_EV_TUKIMI_0, + SP_NPC_EV_TUKIMI_1, + SP_NPC_EV_TUKIMI_2, + SP_NPC_EV_TUKIMI_3, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_hm_pule1_map[] = { + { 13, 7 }, + { 3, 3 }, + { 2, 4 }, + { 12, 2 }, + { 7, 12 }, +}; + +static mEvMN_actor_info_c l_hm_pule1_set_dt = { l_hm_set_actor0, l_hm_pule1_map }; + +static mEvMN_actor_pos_c l_hm_pule2_map[] = { + { 3, 8 }, + { 12, 13 }, + { 13, 12 }, + { 13, 2 }, + { 14, 2 }, +}; + +static mEvMN_actor_info_c l_hm_pule2_set_dt = { l_hm_set_actor0, l_hm_pule2_map }; + +static mEvMN_actor_pos_c l_hm_pule3_map[] = { + { 9, 13 }, + { 12, 3 }, + { 13, 3 }, + { 4, 4 }, + { 11, 8 }, +}; + +static mEvMN_actor_info_c l_hm_pule3_set_dt = { l_hm_set_actor0, l_hm_pule3_map }; + +static mEvMN_actor_pos_c l_hm_pule4_map[] = { + { 9, 12 }, + { 3, 2 }, + { 2, 3 }, + { 8, 2 }, + { 11, 11 }, +}; + +static mEvMN_actor_info_c l_hm_pule4_set_dt = { l_hm_set_actor0, l_hm_pule4_map }; + +static mEvMN_actor_pos_c l_hm_pule5_map[] = { + { 9, 2 }, + { 12, 6 }, + { 13, 7 }, + { 2, 2 }, + { 2, 13 }, +}; + +static mEvMN_actor_info_c l_hm_pule5_set_dt = { l_hm_set_actor0, l_hm_pule5_map }; + +static mEvMN_actor_pos_c l_hm_pule6_map[] = { + { 12, 8 }, + { 12, 2 }, + { 13, 3 }, + { 2, 13 }, + { 11, 9 }, +}; + +static mEvMN_actor_info_c l_hm_pule6_set_dt = { l_hm_set_actor0, l_hm_pule6_map }; + +static mEvMN_actor_pos_c l_hm_pule7_map[] = { + { 3, 7 }, + { 13, 8 }, + { 13, 9 }, + { 12, 2 }, + { 2, 8 }, +}; + +static mEvMN_actor_info_c l_hm_pule7_set_dt = { l_hm_set_actor0, l_hm_pule7_map }; + +static mEvMN_actor_info_c* l_hm_set_dt_table[] = { + &l_hm_pule1_set_dt, + &l_hm_pule2_set_dt, + &l_hm_pule3_set_dt, + &l_hm_pule4_set_dt, + &l_hm_pule5_set_dt, + &l_hm_pule6_set_dt, + &l_hm_pule7_set_dt, +}; + +static mEvMN_npc_data_c l_hm_set_npc = { 0b0011111, EMPTY_NO }; +static mEvMN_data_c l_hm_set_data = { 0, 4, 7, 5, l_hm_set_dt_table, &l_hm_set_npc, mRF_BLOCKKIND_POOL }; + +// hf - Harvest Festival +static mActor_name_t l_hf_set_actor0[] = { + SP_NPC_EV_HARVEST_0, + SP_NPC_EV_HARVEST_1, + SP_NPC_EV_HARVEST_2, + SP_NPC_EV_HARVEST_3, + SP_NPC_EV_HARVEST_4, + SP_NPC_EV_SONCHO2, + HTABLE0, + HTABLE1, + HTABLE2, +}; + +static mEvMN_actor_pos_c l_hf_map[] = { + { 10, 6 }, + { 12, 8 }, + { 5, 4 }, + { 3, 6 }, + { 4, 12 }, + { 9, 10 }, + { 4, 5 }, + { 11, 7 }, + { 5, 10 }, +}; + +static mEvMN_actor_info_c l_hf_set_dt = { l_hf_set_actor0, l_hf_map }; +static mEvMN_actor_info_c* l_hf_set_dt_table[] = { &l_hf_set_dt }; +static mEvMN_npc_data_c l_hf_set_npc = { 0b011111, EMPTY_NO }; +static mEvMN_data_c l_hf_set_data = { 0, 5, 1, 9, l_hf_set_dt_table, &l_hf_set_npc, mRF_BLOCKKIND_SHRINE }; + +// ms - Meteor Shower +static mActor_name_t l_ms_set_actor0[] = { + SP_NPC_EV_TUKIMI_0, + SP_NPC_EV_TUKIMI_1, + SP_NPC_EV_TUKIMI_2, + SP_NPC_EV_TUKIMI_3, + SP_NPC_EV_SONCHO2, +}; + +static mActor_name_t l_ms_set_actor1[] = { + SP_NPC_EV_TUKIMI_0, + SP_NPC_EV_TUKIMI_1, + SP_NPC_EV_TUKIMI_2, + SP_NPC_EV_TUKIMI_3, + SP_NPC_EV_SONCHO2, +}; + +static mEvMN_actor_pos_c l_ms_pule1_map[] = { + { 13, 7 }, + { 3, 3 }, + { 2, 4 }, + { 12, 2 }, + { 7, 12 }, +}; + +static mEvMN_actor_info_c l_ms_pule1_set_dt = { l_ms_set_actor1, l_ms_pule1_map }; + +static mEvMN_actor_pos_c l_ms_pule2_map[] = { + { 3, 8 }, + { 12, 13 }, + { 13, 12 }, + { 13, 2 }, + { 13, 2 }, +}; + +static mEvMN_actor_info_c l_ms_pule2_set_dt = { l_ms_set_actor0, l_ms_pule2_map }; + +static mEvMN_actor_pos_c l_ms_pule3_map[] = { + { 9, 13 }, + { 12, 3 }, + { 13, 3 }, + { 4, 4 }, + { 11, 8 }, +}; + +static mEvMN_actor_info_c l_ms_pule3_set_dt = { l_ms_set_actor1, l_ms_pule3_map }; + +static mEvMN_actor_pos_c l_ms_pule4_map[] = { + { 9, 12 }, + { 3, 2 }, + { 2, 3 }, + { 8, 2 }, + { 11, 11 }, +}; + +static mEvMN_actor_info_c l_ms_pule4_set_dt = { l_ms_set_actor0, l_ms_pule4_map }; + +static mEvMN_actor_pos_c l_ms_pule5_map[] = { + { 9, 2 }, + { 12, 6 }, + { 13, 7 }, + { 2, 2 }, + { 2, 13 }, +}; + +static mEvMN_actor_info_c l_ms_pule5_set_dt = { l_ms_set_actor1, l_ms_pule5_map }; + +static mEvMN_actor_pos_c l_ms_pule6_map[] = { + { 12, 8 }, + { 12, 2 }, + { 13, 3 }, + { 2, 13 }, + { 11, 9 }, +}; + +static mEvMN_actor_info_c l_ms_pule6_set_dt = { l_ms_set_actor1, l_ms_pule6_map }; + +static mEvMN_actor_pos_c l_ms_pule7_map[] = { + { 3, 7 }, + { 13, 8 }, + { 13, 9 }, + { 12, 2 }, + { 2, 8 }, +}; + +static mEvMN_actor_info_c l_ms_pule7_set_dt = { l_ms_set_actor0, l_ms_pule7_map }; + +static mEvMN_actor_info_c* l_ms_set_dt_table[] = { + &l_ms_pule1_set_dt, + &l_ms_pule2_set_dt, + &l_ms_pule3_set_dt, + &l_ms_pule4_set_dt, + &l_ms_pule5_set_dt, + &l_ms_pule6_set_dt, + &l_ms_pule7_set_dt, +}; + +static mEvMN_npc_data_c l_ms_set_npc = { 0b0011111, EMPTY_NO }; +static mEvMN_data_c l_ms_set_data = { 0, 4, 7, 5, l_ms_set_dt_table, &l_ms_set_npc, mRF_BLOCKKIND_POOL }; + +static mEvMN_data_c* l_event_set_table[] = { + &l_fws_set_data, + &l_fv_set_data, + &l_fdd_tokyoso_set_data, + &l_fdd_radio_set_data, + &l_fdd_tama_set_data, + &l_fdd_tuna_set_data, + NULL, + &l_hny_set_data, + &l_fsh_set_data, + &l_fsh_set_data, + &l_rc_set_data, + &l_hm_set_data, + &l_hf_set_data, + &l_cdn_set_data, + &l_kk_set_data, + &l_gh_set_data, + &l_ms_set_data, +}; diff --git a/src/game/m_museum_display.c b/src/game/m_museum_display.c index c0d29930..1925bce3 100644 --- a/src/game/m_museum_display.c +++ b/src/game/m_museum_display.c @@ -89,7 +89,7 @@ extern void mMmd_SetFish(int fish_no) { } } -extern mMmd_GetDisplayInfo(mActor_name_t item) { +extern int mMmd_GetDisplayInfo(mActor_name_t item) { if (item >= FTR_DINO_TRICERA_SKULL && item <= FTR_DINO_TRILOBITE_WEST) { int fossil_idx; int valid = FALSE; diff --git a/src/game/m_npc.c b/src/game/m_npc.c index c9c5ba8f..0ef68f92 100644 --- a/src/game/m_npc.c +++ b/src/game/m_npc.c @@ -2760,7 +2760,7 @@ static void mNpc_SetNpcHome(Animal_c* animal, Anmhome_c* reserved, u8 reserved_n } } -extern mNpc_InitNpcData() { +extern void mNpc_InitNpcData() { static Anmhome_c reserved[60]; u8 reserved_num = 0;