diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2023-09-15 18:36:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-15 09:36:15 -0700 |
| commit | ef0a26fd481675a955b301d1b2261ded362c4190 (patch) | |
| tree | 0c2a9de1eda9cd4d465aa4845f18f1ba16584b93 /include | |
| parent | 898b6fb3a4157f2e681a42c6f420f4b9d7152cc9 (diff) | |
NPC PR 1/3 ok (#96)
* m_npc walk ok
Co-authored-by: Maide <you@example.com>
* fix protos
* fixes
* forgor some fixes
* struct names
---------
Co-authored-by: Maide <you@example.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/6D2720.h | 23 | ||||
| -rw-r--r-- | include/6DE300.h | 16 | ||||
| -rw-r--r-- | include/m_common_data.h | 72 | ||||
| -rw-r--r-- | include/m_field_info.h | 6 | ||||
| -rw-r--r-- | include/m_land.h | 2 | ||||
| -rw-r--r-- | include/m_npc.h | 58 | ||||
| -rw-r--r-- | include/m_npc_walk.h | 105 | ||||
| -rw-r--r-- | include/m_random_field.h | 42 | ||||
| -rw-r--r-- | include/sys_math.h | 1 |
9 files changed, 233 insertions, 92 deletions
diff --git a/include/6D2720.h b/include/6D2720.h index ff40168..4fe9a80 100644 --- a/include/6D2720.h +++ b/include/6D2720.h @@ -3,7 +3,6 @@ #include "ultra64.h" -struct mNpc_walk_c; // void func_800AEA80_jp(); // void mNPS_set_schedule_area(); @@ -12,28 +11,6 @@ struct mNpc_walk_c; // void func_800AEC74_jp(); // void mNPS_schedule_manager(); void mNPS_set_all_schedule_area(void); -// void func_800AEDD0_jp(); -// void func_800AEE38_jp(); -// void func_800AEE50_jp(); -// void func_800AEEE8_jp(); -// void func_800AEF1C_jp(); -// void func_800AEF4C_jp(); -// void func_800AEFC4_jp(); -// void func_800AF060_jp(); -// void func_800AF0A8_jp(); -// void func_800AF1E0_jp(); -// void func_800AF2A8_jp(); -// void func_800AF3E8_jp(); -// void func_800AF614_jp(); -// void func_800AF7BC_jp(); -// void func_800AF84C_jp(); -// void func_800AF9C8_jp(); -// void func_800AFA1C_jp(); -void mNpcW_InitNpcWalk(struct mNpc_walk_c* npc_walk); -// void func_800AFC1C_jp(); -// void func_800AFCAC_jp(); -// void func_800AFCD8_jp(); -// void func_800AFDA8_jp(); void func_800B0010_jp(void); #endif diff --git a/include/6DE300.h b/include/6DE300.h index caa7a52..106f274 100644 --- a/include/6DE300.h +++ b/include/6DE300.h @@ -69,20 +69,6 @@ UNK_RET mQst_CheckLimitbyPossessionIdx(s32 arg0); // void func_800BC724_jp(); // void func_800BC830_jp(); // void mQst_PrintQuestInfo(); -// void func_800BCBA0_jp(); -// void func_800BCBDC_jp(); -// void func_800BCC20_jp(); -// void func_800BCC30_jp(); -// void func_800BCC40_jp(); -// void func_800BCCFC_jp(); -// void func_800BCDCC_jp(); -// void func_800BCDFC_jp(); -// void func_800BCE80_jp(); -// void func_800BCEA4_jp(); -// void func_800BCF64_jp(); -// void func_800BCFA4_jp(); -// void func_800BCFC8_jp(); -// void func_800BD02C_jp(); -// void func_800BD1E4_jp(); + #endif diff --git a/include/m_common_data.h b/include/m_common_data.h index a53d6d2..dd96b67 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -121,42 +121,42 @@ typedef enum Season { typedef struct Time_c { /* 0x00 */ u32 season; - /* 0x04 */ u32 term_idx; - /* 0x08 */ s16 bgitem_profile; - /* 0x0A */ s16 bgitem_bank; - /* 0x0C */ s32 now_sec; - /* 0x10 */ lbRTC_time_c rtc_time; - /* 0x18 */ s16 rad_min; /* clock hand radial position for mins */ - /* 0x1A */ s16 rad_hour; /* clock hand radial position for hours */ - /* 0x1C */ u8 time_signal; - /* 0x1D */ u8 under_sec; + /* 0x04 */ u32 termIdx; + /* 0x08 */ s16 bgitemProfile; + /* 0x0A */ s16 bgitemBank; + /* 0x0C */ s32 nowSec; + /* 0x10 */ lbRTC_time_c rtcTime; + /* 0x18 */ s16 radMin; + /* 0x1A */ s16 radHour; + /* 0x1C */ u8 timeSignal; + /* 0x1D */ u8 underSec; /* 0x1E */ u8 disp; - /* 0x1F */ u8 rtc_crashed; - /* 0x20 */ s32 rtc_enabled; - /* 0x24 */ s32 add_sec; - /* 0x28 */ s32 add_idx; + /* 0x1F */ u8 rtcCrashed; + /* 0x20 */ s32 rtcEnabled; + /* 0x24 */ s32 addSec; + /* 0x28 */ s32 addIdx; } Time_c; // size = 0x2C typedef struct FamicomEmuCommonData { - /* 0x00 */ s16 unk_00; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ s16 unk_06; - /* 0x08 */ s16 unk_08; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ s16 unk_0C; - /* 0x0E */ s16 unk_0E; - /* 0x10 */ s16 unk_10; - /* 0x12 */ s16 unk_12; - /* 0x14 */ s16 unk_14; - /* 0x16 */ s16 unk_16; - /* 0x18 */ s16 unk_18; - /* 0x1A */ s16 unk_1A; - /* 0x1C */ s16 unk_1C; - /* 0x1E */ s16 unk_1E; - /* 0x20 */ s16 unk_20; - /* 0x22 */ s16 unk_22; - /* 0x24 */ s16 unk_24; + /* 0x00 */ s16 unk00; + /* 0x02 */ s16 unk02; + /* 0x04 */ s16 unk04; + /* 0x06 */ s16 unk06; + /* 0x08 */ s16 unk08; + /* 0x0A */ s16 unk0A; + /* 0x0C */ s16 unk0C; + /* 0x0E */ s16 unk0E; + /* 0x10 */ s16 unk10; + /* 0x12 */ s16 unk12; + /* 0x14 */ s16 unk14; + /* 0x16 */ s16 unk16; + /* 0x18 */ s16 unk18; + /* 0x1A */ s16 unk1A; + /* 0x1C */ s16 unk1C; + /* 0x1E */ s16 unk1E; + /* 0x20 */ s16 unk20; + /* 0x22 */ s16 unk22; + /* 0x24 */ s16 unk24; }FamicomEmuCommonData; // size >= 0x26 typedef void (*CommonData_100E4_Func)(struct Game_Play*); @@ -164,7 +164,9 @@ typedef void (*CommonData_100E4_Func)(struct Game_Play*); typedef struct CommonData { /* 0x00000 */ u8 unk00000[0x14]; /* 0x00014 */ s32 unk_00014; - /* 0x00018 */ u8 unk00018[0x8]; + /* 0x00018 */ u8 nowNpcMax; + /* 0x00019 */ u8 removeAnimalIdx; + /* 0x0001A */ u8 unk1A[0x20 - 0x1A]; /* 0x00020 */ Private_c private[PLAYER_NUM]; /* player data */ /* 0x02F60 */ mLd_land_info_c land_info; /* town name & id */ /* 0x02F6A */ u8 unk02F6A[0x61E]; @@ -223,7 +225,7 @@ typedef struct CommonData { /* 0x1014C */ UNK_TYPE1 unk_1014C[0x2]; /* 0x1014E */ s16 unk_1014E; /* 0x10150 */ UNK_TYPE1 unk_10150[0x10]; - /* 0x10160 */ mNpc_NpcList_c npclist[ANIMAL_NUM_MAX]; + /* 0x10160 */ NpcList npclist[ANIMAL_NUM_MAX]; /* 0x104A8 */ u16 house_owner_name; /* 0x104AA */ u16 last_field_id; /* 0x104AC */ UNK_TYPE1 unk_104AC[0x1]; @@ -233,7 +235,7 @@ typedef struct CommonData { /* 0x10598 */ mQst_not_saved_c quest; /* 0x105A0 */ u32 scene_from_title_demo; /* 0x105A4 */ UNK_TYPE1 unk_105A4[0xF0]; - /* 0x10694 */ mNpc_walk_c npc_walk; + /* 0x10694 */ NpcWalking npcWalk; /* 0x10710 */ UNK_TYPE1 unk_10710[0x3C]; /* 0x1074C */ UNK_TYPE unk_1074C; /* 0x10750 */ UNK_TYPE1 unk_10750[0x66]; diff --git a/include/m_field_info.h b/include/m_field_info.h index 913190e..758931e 100644 --- a/include/m_field_info.h +++ b/include/m_field_info.h @@ -30,7 +30,7 @@ struct Game_Play; // void func_80088458_jp(); // void func_800884E0_jp(); // void func_800885A8_jp(); -// void func_80088710_jp(); +s32 mFI_Wpos2BlockNum(s32*, s32*, Vec3f); // void func_80088780_jp(); // void func_8008883C_jp(); // void func_800888AC_jp(); @@ -57,13 +57,13 @@ struct Game_Play; // void func_8008907C_jp(); // void func_80089114_jp(); // void func_800891AC_jp(); -// void func_80089268_jp(); +u8 mFI_BkNum2BlockType(s32,s32); // void func_800892CC_jp(); // void func_8008930C_jp(); // void func_80089348_jp(); // void func_800893C8_jp(); // void func_80089404_jp(); -// void func_80089440_jp(); +void mFI_BlockKind2BkNum(s32*,s32*,s32); // void func_800894D0_jp(); // void func_80089538_jp(); // void func_800895B8_jp(); diff --git a/include/m_land.h b/include/m_land.h index 7569415..65ecff4 100644 --- a/include/m_land.h +++ b/include/m_land.h @@ -4,7 +4,7 @@ #include "ultra64.h" // Town name character count -#define LAND_NAME_SIZE 8 +#define LAND_NAME_SIZE 6 #define LAND_NAME_MURA_SIZE (LAND_NAME_SIZE + 2) typedef struct mLd_land_info_c { diff --git a/include/m_npc.h b/include/m_npc.h index 8d83bff..62f82cf 100644 --- a/include/m_npc.h +++ b/include/m_npc.h @@ -4,27 +4,59 @@ #include "ultra64.h" #include "m_actor.h" #include "unk.h" - -struct mMl_get_npcinfo_from_mail_name_arg0; +#include "m_land.h" +#include "6DB420.h" +#include "m_mail.h" #define ANIMAL_NUM_MAX 15 /* Maximum number of villagers possible in town */ -typedef struct mNpc_NpcList_c { - /* 0x00 */ char unk00[0x38]; -} mNpc_NpcList_c; // size = 0x38 +typedef struct NpcList { + /* 0x00 */ char unk00[0x10]; + /* 0x10 */ Vec3f position; + /* 0x14 */ char unk14[0x1C]; +} NpcList; // size = 0x38 + +typedef struct AnmHome_c { + /* 0x00 */ u8 typeUnused; /* Likely the house type, but seems to be unused outside of SChk_Anmhome_c_sub */ + /* 0x01 */ u8 blockX; /* acre x position */ + /* 0x02 */ u8 blockZ; /* acre y position */ + /* 0x03 */ u8 utX; /* unit x position */ + /* 0x04 */ u8 utZ; /* unit z position */ +} AnmHome_c; // size = 0x5 + +typedef struct AnmPersonalId_c { + /* 0x00 */ u16 npcId; /* id */ + /* 0x02 */ u16 landId; /* town id */ + /* 0x04 */ u8 landName[LAND_NAME_SIZE]; /* town name */ + /* 0x0A */ u8 nameId; /* lower byte of the id */ + /* 0x0B */ u8 looks; /* internal name for personality */ +} AnmPersonalID_c; // size = 0xC typedef struct Animal_c { - /* 0x000 */ char unk000[0x528]; -} Animal_c; // size = 0x528 + /* 0x000 */ AnmPersonalID_c id; + /* 0x00C */ char unk00C[0x4D4]; + /* 0x4E0 */ AnmHome_c homeInfo; + /* 0x4E5 */ char unk4E5[0x43]; +} Animal_c; + +typedef enum NpcLooks{ + /* 0 */ NPC_LOOKS_GIRL, + /* 1 */ NPC_LOOKS_KO_GIRL, + /* 2 */ NPC_LOOKS_BOY, + /* 3 */ NPC_LOOKS_SPORT_MAN, + /* 4 */ NPC_LOOKS_GRIM_MAN, + /* 5 */ NPC_LOOKS_NANIWA_LADY, + + /* 6 */ NPC_LOOKS_NUM +}NpcLooks; -// void func_800A6810_jp(); // void func_800A6920_jp(); // void func_800A6940_jp(); // void func_800A695C_jp(); -// void func_800A6978_jp(); -// void func_800A69C8_jp(); -// void mNpc_CopyAnimalPersonalID(); -// void func_800A6A6C_jp(); +void mNpc_ClearAnimalPersonalID(AnmPersonalID_c*); +s32 mNpc_CheckFreeAnimalPersonalID(AnmPersonalID_c*); +void mNpc_CopyAnimalPersonalID(AnmPersonalID_c*, AnmPersonalID_c*); +s32 mNpc_CheckCmpAnimalPersonalID(AnmPersonalID_c*, AnmPersonalID_c*); // void func_800A6AF0_jp(); // void func_800A6B58_jp(); // void func_800A6B6C_jp(); @@ -130,7 +162,7 @@ s32 mNpc_GetLooks(u16 arg0); // void func_800AAEFC_jp(); void func_800AB054_jp(void); void func_800AB09C_jp(void); -void mNpc_SetNpcList(mNpc_NpcList_c* npclist, Animal_c* animals, s32 count, s32 malloc_flag); +void mNpc_SetNpcList(NpcList* npclist, Animal_c* animals, s32 count, s32 malloc_flag); void mNpc_SetNpcinfo(struct Actor* actor, s8 arg1); // void func_800AB498_jp(); // void func_800AB62C_jp(); diff --git a/include/m_npc_walk.h b/include/m_npc_walk.h index 6b8116c..1b5328d 100644 --- a/include/m_npc_walk.h +++ b/include/m_npc_walk.h @@ -2,10 +2,111 @@ #define M_NPC_WALK_H #include "ultra64.h" +#include "m_npc.h" -typedef struct mNpc_walk_c { +#define NPCW_GET_WALK_NUM(x) (int)((x) / 3) +#define NPCW_MAX NPCW_GET_WALK_NUM(ANIMAL_NUM_MAX) + +typedef struct NpcWalk { /* 0x00 */ char unk00[0x7C]; -} mNpc_walk_c; // size = 0x7C +} NpcWalk; // size = 0x7C + +typedef struct NpcWalkGoalData { + /* 0x0 */ u8* types; + /* 0x1 */ u8 count; + /* 0x2 */ s32 time; +} NpcWalkGoalData; // size = 0x6 + +typedef struct NpcWalkGoalDataTable { + /* 0x0 */ NpcWalkGoalData* data; + /* 0x4 */ int count; +} NpcWalkGoalDataTable; // size = 0x8 + +typedef struct NpcWalkAppear { + /* 0x0 */ u8 status; + /* 0x1 */ u8 way; +} NpcWalkAppear; // size = 0x2; + +typedef struct NpcWalkInfo { + /* 0x00 */ AnmPersonalID_c id; + /* 0x0C */ s32 idx; + /* 0x10 */ u8 status; + /* 0x11 */ u8 type; + /* 0x12 */ u8 goalX; + /* 0x13 */ u8 goalZ; + /* 0x14 */ NpcWalkAppear appearInfo; +} NpcWalkInfo; // size = 0x18 + +typedef struct NpcWalking { + /* 0x00 */ NpcWalkInfo info[NPCW_MAX]; + /* 0x78 */ u16 idxUse; + /* 0x7A */ u8 infoUse; + /* 0x7B */ u8 infoMax; +} NpcWalking; //size = 0x7C + +typedef enum WalkGoal{ + /* 0 */ NPCW_GOAL_SHRINE, /* Shrine/Wishing Well acre */ + /* 1 */ NPCW_GOAL_HOME, /* Randomly selected acre with a villager house */ + /* 2 */ NPCW_GOAL_ALONE, /* Randomly selected acre with no other animals in it */ + /* 3 */ NPCW_GOAL_MY_HOME, /* Acre containing the villager's house */ + + /* 4 */ NPCW_GOAL_NUM +}WalkGoal; + +typedef enum WalkGoalBlock{ + /* 0 */ NPCW_GOAL_BLOCK_SHRINE, + /* 1 */ NPCW_GOAL_BLOCK_HOME, + + /* 2 */ NPCW_GOAL_BLOCK_NUM +}WalkGoalBlock; + +typedef enum WalkAppearStatus { + /* 0 */ NPCW_APPEAR_STATUS_0, + /* 1 */ NPCW_APPEAR_STATUS_1, + + /* 2 */ NPCW_APPEAR_STATUS_NUM +}WalkAppearStatus; + +typedef enum WalkAppearDirection { + /* 0 */ NPCW_APPEAR_WAY_UP, + /* 1 */ NPCW_APPEAR_WAY_DOWN, + /* 2 */ NPCW_APPEAR_WAY_LEFT, + /* 3 */ NPCW_APPEAR_WAY_RIGHT, + + /* 4 */ NPCW_APPEAR_WAY_NUM +}WalkAppearDirection; + +typedef enum WalkInfoStatus { + /* 0 */ NPCW_INFO_STATUS_0, + /* 1 */ NPCW_INFO_STATUS_WALKING, + /* 2 */ NPCW_INFO_STATUS_2, + /* 3 */ NPCW_INFO_STATUS_3, + /* 4 */ NPCW_INFO_STATUS_4, + + /* 5 */ NPCW_INFO_STATUS_NUM +}WalkInfoStatus; +NpcWalkGoalData* mNpcW_GetGoalDataInfo(s32 looks, s32 time); +void mNpcW_ClearNpcWalkAppear(NpcWalkAppear* info); +void mNpcW_ClearNpcWalkInfo(NpcWalkInfo* info , s32 count); +void mNpcW_ClearNpcWalk(NpcWalking* walk); +s32 mNpcW_CheckFreeNpcWalkInfo(NpcWalkInfo* info ); +s32 mNpcW_GetFreeNpcWalkInfoIdx(NpcWalkInfo* info , s32 num ); +s32 mNpcW_GetNpcWalkInfoIdx(NpcWalkInfo* info , s32 num , AnmPersonalID_c* anmId ); +s32 mNpcW_GetNpcWalkInfoIdxbyIdx(NpcWalkInfo* info , s32 num , s32 idx ); +s32 mNpcW_DecideNpc(Animal_c* animal , u16 used ); +void mNpcW_SetNpcWalkInfo(NpcWalkInfo* info , Animal_c* animal , s32 idx ); +s32 mNpcW_ChangeNpcWalk(NpcWalking* walk , NpcWalkInfo* info ); +s32 mNpcW_GetAloneBlock(u8* goalBlockX , u8* goalBlockZ ); +void mNpcW_GetBlockXZNumExceptHome(s32* goalBlockX , s32* goalBlockZ , Animal_c* animal ); +s32 mNpcW_CheckDiffBlockWalkNpcHome(s32 blockX , s32 blockZ , NpcWalkInfo* info ); +void mNpcW_SetHomeBlockSource(NpcWalking* walk , Animal_c* animal ); +void mNpcW_InitGoalBlockSource(NpcWalking* walk , Animal_c* animal ); +void mNpcW_SetGoalBlock(NpcWalkInfo* info ); +void mNpcW_InitNpcWalk(NpcWalking* walk ); +s32 mNpcW_GetAppearStatusWay(u8* status , u8* way , Animal_c* animal ); +s32* mNpcW_GetArriveStayCountP(s32 idx ); +s32 mNpcW_GetWalkInfoStatusGoalAnimalIdx(s32* status , s32* goal , s32 idx ); +s32 mNpcW_GetNearGate(s32* targetUtX , s32* targetUtZ , s32 blockX , s32 blockZ , s32 utX , s32 utZ ); #endif diff --git a/include/m_random_field.h b/include/m_random_field.h new file mode 100644 index 0000000..ba52e3e --- /dev/null +++ b/include/m_random_field.h @@ -0,0 +1,42 @@ +#ifndef M_RANDOM_FIELD_H +#define M_RANDOM_FIELD_H + +#include "ultra64.h" + + +#define RANDOM_FIELD_BLOCKKIND_SHRINE (1 << 2) + +#define RANDOM_FIELD_BLOCK_TYPE_MAX 108 +#define RANDOM_FIELD_DIRECT_ERROR 100 + +typedef enum RandomFieldDirection { + /* 0 */ RANDOM_FIELD_DIRECT_NORTH, + /* 1 */ RANDOM_FIELD_DIRECT_WEST, + /* 2 */ RANDOM_FIELD_DIRECT_SOUTH, + /* 3 */ RANDOM_FIELD_DIRECT_EAST, + + /* 4 */ RANDOM_FIELD_DIRECT_NUM +}RandomFieldDirection; + +typedef struct RandomFieldGate { + /* 0x00 */ s32 ut0; + /* 0x04 */ s32 ut1; +} RandomFieldGate; + +// void func_800BCBA0_jp(); +// void func_800BCBDC_jp(); +// void func_800BCC20_jp(); +// void func_800BCC30_jp(); +// void func_800BCC40_jp(); +// void func_800BCCFC_jp(); +// void func_800BCDCC_jp(); +// void func_800BCDFC_jp(); +// void func_800BCE80_jp(); +// void func_800BCEA4_jp(); +// void func_800BCF64_jp(); +// void func_800BCFA4_jp(); +RandomFieldGate* mRF_BlockTypeDirect2GateData(s32*, u8, s32); +// void func_800BD02C_jp(); +// void func_800BD1E4_jp(); + +#endif diff --git a/include/sys_math.h b/include/sys_math.h index 133bdd8..028151f 100644 --- a/include/sys_math.h +++ b/include/sys_math.h @@ -2,6 +2,7 @@ #define SYS_MATH_H #include "ultra64.h" +#include "libc64/qrand.h" /* Macro to generate a random float in the range of [0, n) */ #define RANDOM_F(n) (fqrand() * (f32)(n)) |
