Implement & link ac_set_ovl_insect.c

This commit is contained in:
Cuyler36
2023-05-27 00:50:20 -04:00
parent 1865cb5dc2
commit d583190d68
14 changed files with 2416 additions and 14 deletions
+5
View File
@@ -111,6 +111,11 @@ ac_set_ovl_gyoei.c:
.rodata: [0x80644DD0, 0x80644E00]
.data: [0x8068BCF0, 0x8068CDE8]
.bss: [0x812FCD00, 0x812FD048]
ac_set_ovl_insect.c:
.text: [0x8049A9E4, 0x8049C748]
.rodata: [0x80644E00, 0x80644E28]
.data: [0x8068CDE8, 0x8068E3C0]
.bss: [0x812FD048, 0x812FD270]
m_huusui_room_ovl.c:
.text: [0x804D1BBC, 0x804D2164]
.rodata: [0x80646558, 0x806465C8]
+59
View File
@@ -0,0 +1,59 @@
#ifndef AC_INSECT_H_H
#define AC_INSECT_H_H
#include "types.h"
#include "m_actor.h"
#include "m_lib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* sizeof(aINS_Init_c) == 0x18 */
typedef struct insect_init_s {
/* 0x00 */ int insect_type;
/* 0x04 */ xyz_t position;
/* 0x10 */ int extra_data;
/* 0x14 */ GAME* game;
} aINS_Init_c;
/* sizeof(aINS_INSECT_DUMMY_ACTOR) == 0x288 */
typedef struct insect_dummy_actor_s {
ACTOR actor;
/* TODO: finish */
} aINS_INSECT_DUMMY_ACTOR;
typedef aINS_INSECT_DUMMY_ACTOR* (*aINS_make_insect_proc)(aINS_Init_c*, int);
typedef void (*aINS_make_ant_proc)(aINS_Init_c*, s8, s8);
typedef void (*aINS_dt_proc)(ACTOR*, GAME*);
typedef aINS_INSECT_DUMMY_ACTOR* (*aINS_make_actor_proc)(GAME*, int, xyz_t*);
typedef void (*aINS_set_pl_act_tim_proc)(int, int, int);
typedef int (*aINS_chk_live_insect_proc)(int, int, GAME*);
typedef void (*aINS_position_move_proc)(ACTOR*);
typedef ACTOR* (*aINS_search_near_insect_proc)(GAME*, f32, f32);
/* sizeof(aINS_Clip_c) == 0x50 */
typedef struct ac_insect_clip_s {
/* 0x00 */ aINS_make_insect_proc make_insect_proc;
/* 0x04 */ aINS_make_ant_proc make_ant_proc; // unused clip proc in AC
/* 0x08 */ void* unused_08;
/* 0x0C */ aINS_dt_proc dt_proc;
/* 0x10 */ aINS_make_actor_proc make_actor_proc;
/* 0x14 */ aINS_set_pl_act_tim_proc set_pl_act_tim_proc;
/* 0x18 */ aINS_chk_live_insect_proc chk_live_insect_proc;
/* 0x1C */ aINS_search_near_insect_proc search_near_insect_proc;
/* 0x20 */ int pl_action;
/* 0x24 */ int pl_action_ut_x;
/* 0x28 */ int pl_action_ut_z;
/* 0x2C */ aINS_position_move_proc position_move_proc;
/* 0x30 */ int ant_spawn_pending;
/* 0x34 */ aINS_Init_c ant_spawn_info;
/* 0x4C */ u8 ant_ut_x;
/* 0x4D */ u8 ant_ut_z;
} aINS_Clip_c;
#ifdef __cplusplus
}
#endif
#endif
+19 -2
View File
@@ -12,7 +12,24 @@ extern "C" {
typedef struct actor_set_manager_s SET_MANAGER;
#define aSetMgr_SET_OVERLAY_BUF_SIZE 0x4000
#define aSetMgr_KEEP_SIZE 0x354
#define aSetMgr_INSECT_SPAWN_INFO_COUNT 43
/* sizeof(aSOI_insect_spawn_info_f_c) == 0xC */
typedef struct insect_spawn_info_f_s {
int type;
u8 spawn_area;
float weight;
} aSOI_insect_spawn_info_f_c;
/* sizeof(aSOI_insect_keep_c) == 0x210 */
typedef struct insect_keep_s {
aSOI_insect_spawn_info_f_c spawn_info[aSetMgr_INSECT_SPAWN_INFO_COUNT]; // devs forgot to update aSetMgr_INSECT_SPAWN_INFO_SIZE or something lol
int now_month;
int now_term;
u8 info_num;
u8 spawn_type;
} aSOI_insect_keep_c;
#define aSetMgr_WAIT_TIME 5 // wait time between aSetMgr_move_check_wait -> aSetMgr_move_set
@@ -51,7 +68,7 @@ enum set_manager_move_proc_type {
/* sizeof(aSetMgr_keep_c) == 0x354 */
typedef struct actor_set_manager_keep_s {
/* 0x000 */ u8 unk[0x210];
/* 0x000 */ aSOI_insect_keep_c insect_keep;
/* 0x210 */ aSOG_gyoei_keep_c gyoei_keep;
} aSetMgr_keep_c;
+126
View File
@@ -2,11 +2,137 @@
#define AC_SET_OVL_INSECT_H
#include "types.h"
#include "ac_set_manager.h"
#ifdef __cplusplus
extern "C" {
#endif
#define aSOI_TERM_TRANSITION_MAX_DAYS 5
#define aSOI_INSECT_TYPE_INVALID -1
enum insect_type {
aSOI_INSECT_TYPE_COMMON_BUTTERFLY,
aSOI_INSECT_TYPE_YELLOW_BUTTERFLY,
aSOI_INSECT_TYPE_TIGER_BUTTERFLY,
aSOI_INSECT_TYPE_PURPLE_BUTTERFLY,
aSOI_INSECT_TYPE_ROBUST_CICADA,
aSOI_INSECT_TYPE_WALKER_CICADA,
aSOI_INSECT_TYPE_EVENING_CICADA,
aSOI_INSECT_TYPE_BROWN_CICADA,
aSOI_INSECT_TYPE_BEE,
aSOI_INSECT_TYPE_COMMON_DRAGONFLY,
aSOI_INSECT_TYPE_RED_DRAGONFLY,
aSOI_INSECT_TYPE_DARNER_DRAGONFLY,
aSOI_INSECT_TYPE_BANDED_DRAGONFLY,
aSOI_INSECT_TYPE_LONG_LOCUST,
aSOI_INSECT_TYPE_MIGRATORY_LOCUST,
aSOI_INSECT_TYPE_CRICKET,
aSOI_INSECT_TYPE_GRASSHOPPER,
aSOI_INSECT_TYPE_BELL_CRICKET,
aSOI_INSECT_TYPE_PINE_CRICKET,
aSOI_INSECT_TYPE_DRONE_BEETLE,
aSOI_INSECT_TYPE_DYNASTID_BEETLE,
aSOI_INSECT_TYPE_FLAT_STAG_BEETLE,
aSOI_INSECT_TYPE_JEWEL_BEETLE,
aSOI_INSECT_TYPE_LONGHORN_BEETLE,
aSOI_INSECT_TYPE_LADYBUG,
aSOI_INSECT_TYPE_SPOTTED_LADYBUG,
aSOI_INSECT_TYPE_MANTIS,
aSOI_INSECT_TYPE_FIREFLY,
aSOI_INSECT_TYPE_COCKROACH,
aSOI_INSECT_TYPE_SAW_STAG_BEETLE,
aSOI_INSECT_TYPE_MOUNTAIN_BEETLE,
aSOI_INSECT_TYPE_GIANT_BEETLE,
aSOI_INSECT_TYPE_SNAIL,
aSOI_INSECT_TYPE_MOLE_CRICKET,
aSOI_INSECT_TYPE_POND_SKATER,
aSOI_INSECT_TYPE_BAGWORM,
aSOI_INSECT_TYPE_PILL_BUG,
aSOI_INSECT_TYPE_SPIDER,
aSOI_INSECT_TYPE_ANT,
aSOI_INSECT_TYPE_MOSQUITO,
aSOI_INSECT_TYPE_NUM,
aSOI_INSECT_TYPE_SPIRIT = aSOI_INSECT_TYPE_NUM,
aSOI_INSECT_TYPE_NONE,
aSOI_INSECT_TYPE_EXTENDED_NUM
};
#define aSOI_SPAWN_AREA_INVALID -1
enum insect_spawn_area {
aSOI_SPAWN_AREA_ON_TREE,
aSOI_SPAWN_AREA_ON_FLOWER,
aSOI_SPAWN_AREA_RAINING_ON_FLOWER,
aSOI_SPAWN_AREA_FLYING,
aSOI_SPAWN_AREA_ON_GROUND,
aSOI_SPAWN_AREA_IN_BUSH,
aSOI_SPAWN_AREA_FLYING_NEAR_WATER,
aSOI_SPAWN_AREA_ON_WATER,
aSOI_SPAWN_AREA_ON_CANDY,
aSOI_SPAWN_AREA_ON_TRASH,
aSOI_SPAWN_AREA_UNDER_ROCK,
aSOI_SPAWN_AREA_UNDERGROUND,
aSOI_SPAWN_AREA_FLYING_NEAR_FLOWERS_OR_AROUND, /* this prefers flowers, but will default to "FLYING" if no flowers are in the acre */
aSOI_SPAWN_AREA_NOTHING,
aSOI_SPAWN_AREA_NUM
};
enum insect_spawn_type {
aSOI_SPAWN_TYPE_NONE, /* none/unused? */
aSOI_SPAWN_TYPE_TOWN, /* pull from town spawns */
aSOI_SPAWN_TYPE_ISLAND, /* pull from island spawns */
aSOI_SPAWN_TYPE_SPIRIT, /* pull from town spawns but force spirit if Wisp is active */
aSOI_SPAWN_TYPE_NUM
};
enum insect_spawn_category {
aSOI_SPAWN_CATEGORY_FG_ITEM_RANGE,
aSOI_SPAWN_CATEGORY_UT_ATTRIBUTE,
aSOI_SPAWN_CATEGORY_TREE,
aSOI_SPAWN_CATEGORY_UT_ATTRIBUTE_AND_FG_ITEM_RANGE,
aSOI_SPAWN_CATEGORY_NUM
};
/**
* Insect term periods:
* TERM0: 11PM-4AM (5 hours)
* TERM1: 4AM-8AM (4 hours)
* TERM2: 8AM-4PM (8 hours)
* TERM3: 4PM-5PM (1 hour)
* TERM4: 5PM-7PM (2 hours)
* TERM5: 7PM-11PM (4 hours)
**/
#define aSOI_TERM0_START_HR 11+12 // 11:00PM
#define aSOI_TERM0_END_HR 3 // 03:59AM
#define aSOI_TERM1_START_HR 4 // 04:00AM
#define aSOI_TERM1_END_HR 7 // 07:59AM
#define aSOI_TERM2_START_HR 8 // 08:00AM
#define aSOI_TERM2_END_HR 3+12 // 03:59PM
#define aSOI_TERM3_START_HR 4+12 // 04:00PM
#define aSOI_TERM3_END_HR 4+12 // 04:59PM
#define aSOI_TERM4_START_HR 5+12 // 05:00PM
#define aSOI_TERM4_END_HR 6+12 // 06:59PM
#define aSOI_TERM5_START_HR 7+12 // 07:00PM
#define aSOI_TERM5_END_HR 10+12 // 10:59PM
enum insect_term {
aSOI_TERM0,
aSOI_TERM1,
aSOI_TERM2,
aSOI_TERM3,
aSOI_TERM4,
aSOI_TERM5,
aSOI_TERM_NUM
};
extern int aSOI_insect_set(SET_MANAGER* set_manager, GAME_PLAY* play);
#ifdef __cplusplus
+4 -1
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "ac_gyoei_h.h"
#include "ac_insect_h.h"
#ifdef __cplusplus
extern "C" {
@@ -10,7 +11,9 @@ extern "C" {
/* sizeof(Clip_c) == 0x104 */
typedef struct clip_s {
/* 0x000 */ void* _000[(0x0AC - 0x000) / sizeof(void*)];
/* 0x000 */ void* _000[(0x07C - 0x000) / sizeof(void*)];
/* 0x07C */ aINS_Clip_c* insect_clip;
/* 0x080 */ void* _080[(0x0AC - 0x080) / sizeof(void*)];
/* 0x0AC */ aGYO_Clip_c* gyo_clip;
/* 0x0B0 */ void* _0B0[(0x104 - 0x0B0) / sizeof(void*)];
} Clip_c;
+22 -2
View File
@@ -10,9 +10,28 @@ extern "C" {
enum background_attribute {
/* TODO: finish */
mCoBG_ATTRIBUTE_GRASS0,
mCoBG_ATTRIBUTE_GRASS1,
mCoBG_ATTRIBUTE_GRASS2,
mCoBG_ATTRIBUTE_GRASS3,
mCoBG_ATTRIBUTE_SOIL0,
mCoBG_ATTRIBUTE_SOIL1,
mCoBG_ATTRIBUTE_SOIL2,
mCoBG_ATTRIBUTE_BUSH = 9,
mCoBG_ATTRIBUTE_WAVE = 11,
mCoBG_ATTRIBUTE_WATERFALL = 13,
mCoBG_ATTRIBUTE_SEA = 24
mCoBG_ATTRIBUTE_WATER,
mCoBG_ATTRIBUTE_WATERFALL,
mCoBG_ATTRIBUTE_RIVER_N,
mCoBG_ATTRIBUTE_RIVER_NW,
mCoBG_ATTRIBUTE_RIVER_W,
mCoBG_ATTRIBUTE_RIVER_SW,
mCoBG_ATTRIBUTE_RIVER_S,
mCoBG_ATTRIBUTE_RIVER_SE,
mCoBG_ATTRIBUTE_RIVER_E,
mCoBG_ATTRIBUTE_RIVER_NE,
mCoBG_ATTRIBUTE_SAND,
mCoBG_ATTRIBUTE_WOOD,
mCoBG_ATTRIBUTE_SEA,
};
/* sizeof(mCoBG_CollisionData_c) == 4*/
@@ -37,6 +56,7 @@ extern u32 mCoBG_Wpos2Attribute(xyz_t wpos, char* is_diggable);
extern int mCoBG_CheckWaterAttribute(u32 attribute);
extern f32 mCoBG_GetBgY_AngleS_FromWpos(s_xyz* angle_to_ground, xyz_t wpos, f32 offset);
extern int mCoBG_CheckWaterAttribute_OutOfSea(u32 attribute);
extern int mCoBG_CheckHole_OrgAttr(u32 attribute);
extern f32 mCoBG_GetWaterHeight_File(xyz_t wpos, char* file, int line);
#define mCoBG_GetWaterHeight(wpos) mCoBG_GetWaterHeight_File(wpos, __FILE__, __LINE__)
+5 -1
View File
@@ -152,7 +152,11 @@ typedef struct common_data_s {
/* 0x026144 */ u8 tmp0[0x2614D - 0x26144];
/* 0x02614D */ u8 transFadeDuration;
/* 0x02614E */ u8 transWipeSpeed;
/* 0x02614F */ u8 tmp34[0x2852C - 0x2614F];
/* 0x02614F */ u8 tmp34[0x2666C - 0x2614F];
/* 0x02666C */ s16 weather;
/* 0x02666E */ s16 weather_intensity;
/* 0x026670 */ lbRTC_time_c weather_time;
/* 0x026678 */ u8 _26678[0x2852C - 0x26678];
/* 0x02852C */ s16 money_power;
/* 0x02852E */ s16 goods_power;
/* 0x028530 */ u8 tmp1[0x28879 - 0x28530];
+15
View File
@@ -112,6 +112,7 @@ enum event_table {
mEv_EVENT_FISHING_TOURNEY_1 = 29,
mEv_EVENT_MUSHROOM_SEASON = 47,
mEv_EVENT_FISHING_TOURNEY_2 = 54,
mEv_EVENT_GHOST = 64,
};
#define mEv_STATUS_ACTIVE (1 << 0) /* event is active */
@@ -122,10 +123,24 @@ enum event_table {
#define mEv_STATUS_ERROR (1 << 5) /* event is in error state */
#define mEv_STATUS_TALK (1 << 6) /* event requires talking to player */
#define mEv_GHOST_HITODAMA_NUM 5
typedef struct ghost_spirit_block_data_s {
u8 block_x[mEv_GHOST_HITODAMA_NUM];
u8 block_z[mEv_GHOST_HITODAMA_NUM];
} mEv_gst_hitodama_block_c;
#define mEv_GHOST_FLAG_ACTIVE 0x4000 // TODO: do these live in the ghost actor itself?
typedef struct ghost_common_s {
mEv_gst_hitodama_block_c hitodama_block_data;
u16 flags;
u8 _0C[0x2C - 0x0C];
} mEv_gst_common_c;
extern int mEv_CheckFirstJob();
extern int mEv_CheckArbeit();
extern int mEv_CheckTitleDemo();
extern int mEv_check_status(int event, s16 status);
extern s8* mEv_get_common_area(int type, s8 id);
extern int mEv_weekday2day(lbRTC_month_t month, int week_type, lbRTC_weekday_t weekday);
+3
View File
@@ -87,6 +87,7 @@ extern int mFI_GetClimate();
extern mActor_name_t* mFI_BkNumtoUtFGTop(int block_x, int block_z);
extern void mFI_ClearDeposit(int block_x, int block_z);
extern int mFI_GetLineDeposit(u16* deposit, int ut_x);
extern u16* mFI_GetDepositP(int block_x, int block_z);
extern void mFI_GetSpecialBlockNum(int* block_pos_tbl, u32* kind_list, int kind_num);
extern int mFI_SetTreasure(int* block_x, int* block_z, mActor_name_t item_no);
extern void mFI_SetFGUpData();
@@ -97,6 +98,8 @@ extern void mFI_BkandUtNum2Wpos(xyz_t* wpos_p, int block_x, int block_z, int ut_
extern void mFI_BkandUtNum2CenterWpos(xyz_t* wpos_p, int block_x, int block_z, int ut_x, int ut_z);
extern mCoBG_Collision_u* mFI_GetBkNum2ColTop(int block_x, int block_z);
extern u32 mFI_BkNum2BlockKind(int block_x, int block_z);
extern int mFI_BlockKind2BkNum(int* block_x, int* block_z, u32 block_kind);
extern int mFI_GetBlockUtNum2FG(mActor_name_t* fg_item, int block_x, int block_z, int ut_x, int ut_z);
extern void mFI_PrintNowBGNum(gfxprint_t* gfxprint);
extern void mFI_PrintFgAttr(gfxprint_t* gfxprint);
+6 -6
View File
@@ -8,13 +8,13 @@ extern "C" {
#endif
enum weather {
mEv_WEATHER_CLEAR,
mEv_WEATHER_RAIN,
mEv_WEATHER_SNOW,
mEv_WEATHER_SAKURA,
mEv_WEATHER_LEAVES,
mEnv_WEATHER_CLEAR,
mEnv_WEATHER_RAIN,
mEnv_WEATHER_SNOW,
mEnv_WEATHER_SAKURA,
mEnv_WEATHER_LEAVES,
mEv_WEATHER_NUM
mEnv_WEATHER_NUM
};
extern int mEnv_NowWeather();
+12
View File
@@ -143,6 +143,12 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define TREE_PRESENT (TREE_LIGHTS + 1)
#define TREE_BELLS 0x0069
#define ROCK_A 0x0063
#define ROCK_B (ROCK_A + 1)
#define ROCK_C (ROCK_B + 1)
#define ROCK_D (ROCK_C + 1)
#define ROCK_E (ROCK_D + 1)
#define CEDAR_TREE_BELLS 0x0078
#define CEDAR_TREE_FTR (CEDAR_TREE_BELLS + 1)
#define CEDAR_TREE_BEES (CEDAR_TREE_FTR + 1)
@@ -333,6 +339,7 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define ITM_FOOD_START 0x2800
#define ITM_FOOD_MUSHROOM 0x2805
#define ITM_FOOD_CANDY 0x2806
#define ITM_ENV_START 0x2900
#define ITM_SAPLING ITM_ENV_START
@@ -349,6 +356,11 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define ITM_COLLEGERULE 0x2B00
#define ITM_KABU_10 0x2F00
#define ITM_KABU_50 0x2F01
#define ITM_KABU_100 0x2F02
#define ITM_KABU_SPOILED 0x2F03
#define FTR_ORANGEBOX 0x30F8
#define DOOR_START 0x4000
+1 -1
View File
@@ -113,7 +113,7 @@ static int aSetMgr_ovl(aSetMgr_set_ovl_c* set_ovl, int type) {
* @param keep Pointer to the SET_MANAGER's internal aSetMgr_keep_c structure
**/
static void aSetMgr_clear_keep(aSetMgr_keep_c* keep) {
bzero(keep, aSetMgr_KEEP_SIZE);
bzero(keep, sizeof(aSetMgr_keep_c));
}
/**
+1 -1
View File
@@ -1948,7 +1948,7 @@ static void aSOG_add_kaseki_range_data(aSOG_gyoei_keep_c* keep, int time_no, int
static aSOG_gyoei_spawn_info_weight_f_c kaseki_data = FISH_SPAWN(COELACANTH, SEA, 2.0f);
/* Only the current term, while raining, and not during 9am-3:59pm */
if (is_next_term == FALSE && mEnv_NowWeather() == mEv_WEATHER_RAIN && time_no != aSOG_TIME_2) {
if (is_next_term == FALSE && mEnv_NowWeather() == mEnv_WEATHER_RAIN && time_no != aSOG_TIME_2) {
keep->spawn_weights[keep->possible_gyoei_num] = kaseki_data;
keep->possible_gyoei_num++;
}
File diff suppressed because it is too large Load Diff