diff --git a/configure.py b/configure.py index bbf16323..f22b21c0 100644 --- a/configure.py +++ b/configure.py @@ -961,7 +961,7 @@ config.libs = [ Object(NonMatching, "actor/ac_ghog.c"), Object(Matching, "actor/ac_goza.c"), Object(Matching, "actor/ac_groundhog_control.c"), - Object(NonMatching, "actor/ac_gyo_kage.c"), + Object(Matching, "actor/ac_gyo_kage.c"), Object(NonMatching, "actor/ac_gyo_kaseki.c"), Object(NonMatching, "actor/ac_gyo_release.c"), Object(NonMatching, "actor/ac_gyo_test.c"), diff --git a/include/ac_gyo_kage.h b/include/ac_gyo_kage.h index d38749fe..c6f7c777 100644 --- a/include/ac_gyo_kage.h +++ b/include/ac_gyo_kage.h @@ -10,9 +10,24 @@ extern "C" { extern ACTOR_PROFILE Gyo_Kage_Profile; +typedef struct gyo_kage_actor_s GYO_KAGE_ACTOR; + +struct gyo_kage_actor_s { + ACTOR actor_class; + ACTOR* gyoei_actor; + s16 type; + int _17C; + ClObjPipe_c col_pipe; + int delete_timer; + s16 draw_frame; + u8 exist_flag; + u8 wall_flag; + u32 alpha; + int data_id; +}; + #ifdef __cplusplus } #endif #endif - diff --git a/include/ac_gyoei.h b/include/ac_gyoei.h index 5bfadea6..57745771 100644 --- a/include/ac_gyoei.h +++ b/include/ac_gyoei.h @@ -11,10 +11,10 @@ extern "C" { #define aGYO_MAX_GYOEI 2 enum { - aGYO_TYPE_TEST, - aGYO_TYPE_KASEKI, + aGYO_GYO_TYPE_TEST, + aGYO_GYO_TYPE_KASEKI, - aGYO_TYPE_NUM + aGYO_GYO_TYPE_NUM }; enum { @@ -31,6 +31,76 @@ enum { aGYO_DRAW_TYPE_NUM }; +/* TODO: should we use the internal names for fish? */ +enum fish_type { + aGYO_TYPE_CRUCIAN_CARP, + aGYO_TYPE_BROOK_TROUT, + aGYO_TYPE_CARP, + aGYO_TYPE_KOI, + aGYO_TYPE_CATFISH, + aGYO_TYPE_SMALL_BASS, + aGYO_TYPE_BASS, + aGYO_TYPE_LARGE_BASS, + aGYO_TYPE_BLUEGILL, + aGYO_TYPE_GIANT_CATFISH, + aGYO_TYPE_GIANT_SNAKEHEAD, + aGYO_TYPE_BARBEL_STEED, + aGYO_TYPE_DACE, + aGYO_TYPE_PALE_CHUB, + aGYO_TYPE_BITTERLING, + aGYO_TYPE_LOACH, + aGYO_TYPE_POND_SMELT, + aGYO_TYPE_SWEETFISH, + aGYO_TYPE_CHERRY_SALMON, + aGYO_TYPE_LARGE_CHAR, + aGYO_TYPE_RAINBOW_TROUT, + aGYO_TYPE_STRINGFISH, + aGYO_TYPE_SALMON, + aGYO_TYPE_GOLDFISH, + aGYO_TYPE_PIRANHA, + aGYO_TYPE_AROWANA, + aGYO_TYPE_EEL, + aGYO_TYPE_FRESHWATER_GOBY, + aGYO_TYPE_ANGELFISH, + aGYO_TYPE_GUPPY, + aGYO_TYPE_POPEYED_GOLDFISH, + aGYO_TYPE_COELACANTH, + aGYO_TYPE_CRAWFISH, + aGYO_TYPE_FROG, + aGYO_TYPE_KILLIFISH, + aGYO_TYPE_JELLYFISH, + aGYO_TYPE_SEA_BASS, + aGYO_TYPE_RED_SNAPPER, + aGYO_TYPE_BARRED_KNIFEJAW, + aGYO_TYPE_ARAPAIMA, + + aGYO_TYPE_NUM, + + /* non-fish fish */ + aGYO_TYPE_WHALE = aGYO_TYPE_NUM, + aGYO_TYPE_EMPTY_CAN, + aGYO_TYPE_BOOT, + aGYO_TYPE_OLD_TIRE, + aGYO_TYPE_SALMON2, + + aGYO_TYPE_EXTENDED_NUM +}; + +#define aGYO_TYPE_INVALID -1 + +enum { + aGYO_SIZE_XXS, + aGYO_SIZE_XS, + aGYO_SIZE_S, + aGYO_SIZE_M, + aGYO_SIZE_L, + aGYO_SIZE_XL, + aGYO_SIZE_XXL, + aGYO_SIZE_WHALE, + + aGYO_SIZE_NUM +}; + typedef struct gyo_ctrl_actor_s aGYO_CTRL_ACTOR; typedef void (*aGYO_ACT_PROC)(ACTOR*, GAME*); diff --git a/include/ac_set_ovl_gyoei.h b/include/ac_set_ovl_gyoei.h index b76059a2..99caa5b5 100644 --- a/include/ac_set_ovl_gyoei.h +++ b/include/ac_set_ovl_gyoei.h @@ -3,6 +3,7 @@ #include "types.h" #include "ac_set_manager.h" +#include "ac_gyoei.h" #ifdef __cplusplus extern "C" { @@ -22,63 +23,6 @@ enum fish_spawn_area { aSOG_SPAWN_AREA_NUM }; -#define aSOG_FISH_TYPE_INVALID -1 - -/* TODO: should we use the internal names for fish? */ -enum fish_type { - aSOG_FISH_TYPE_CRUCIAN_CARP, - aSOG_FISH_TYPE_BROOK_TROUT, - aSOG_FISH_TYPE_CARP, - aSOG_FISH_TYPE_KOI, - aSOG_FISH_TYPE_CATFISH, - aSOG_FISH_TYPE_SMALL_BASS, - aSOG_FISH_TYPE_BASS, - aSOG_FISH_TYPE_LARGE_BASS, - aSOG_FISH_TYPE_BLUEGILL, - aSOG_FISH_TYPE_GIANT_CATFISH, - aSOG_FISH_TYPE_GIANT_SNAKEHEAD, - aSOG_FISH_TYPE_BARBEL_STEED, - aSOG_FISH_TYPE_DACE, - aSOG_FISH_TYPE_PALE_CHUB, - aSOG_FISH_TYPE_BITTERLING, - aSOG_FISH_TYPE_LOACH, - aSOG_FISH_TYPE_POND_SMELT, - aSOG_FISH_TYPE_SWEETFISH, - aSOG_FISH_TYPE_CHERRY_SALMON, - aSOG_FISH_TYPE_LARGE_CHAR, - aSOG_FISH_TYPE_RAINBOW_TROUT, - aSOG_FISH_TYPE_STRINGFISH, - aSOG_FISH_TYPE_SALMON, - aSOG_FISH_TYPE_GOLDFISH, - aSOG_FISH_TYPE_PIRANHA, - aSOG_FISH_TYPE_AROWANA, - aSOG_FISH_TYPE_EEL, - aSOG_FISH_TYPE_FRESHWATER_GOBY, - aSOG_FISH_TYPE_ANGELFISH, - aSOG_FISH_TYPE_GUPPY, - aSOG_FISH_TYPE_POPEYED_GOLDFISH, - aSOG_FISH_TYPE_COELACANTH, - aSOG_FISH_TYPE_CRAWFISH, - aSOG_FISH_TYPE_FROG, - aSOG_FISH_TYPE_KILLIFISH, - aSOG_FISH_TYPE_JELLYFISH, - aSOG_FISH_TYPE_SEA_BASS, - aSOG_FISH_TYPE_RED_SNAPPER, - aSOG_FISH_TYPE_BARRED_KNIFEJAW, - aSOG_FISH_TYPE_ARAPAIMA, - - aSOG_FISH_TYPE_NUM, - - /* non-fish fish */ - aSOG_FISH_TYPE_WHALE = aSOG_FISH_TYPE_NUM, - aSOG_FISH_TYPE_EMPTY_CAN, - aSOG_FISH_TYPE_BOOT, - aSOG_FISH_TYPE_OLD_TIRE, - aSOG_FISH_TYPE_SALMON2, - - aSOG_FISH_TYPE_EXTENDED_NUM -}; - #define aSOG_TIME_NO_0_END 3 /* 9pm-3:59am */ #define aSOG_TIME_NO_1_END 8 /* 4am-8:59am */ #define aSOG_TIME_NO_2_END 12 + 3 /* 9am-3:59pm */ diff --git a/include/m_actor.h b/include/m_actor.h index eb09342b..ff2b93f5 100644 --- a/include/m_actor.h +++ b/include/m_actor.h @@ -32,6 +32,8 @@ typedef void (*mActor_proc)(ACTOR*, GAME*); #define ACTOR_STATE_24 (1 << 24) #define ACTOR_STATE_25 (1 << 25) #define ACTOR_STATE_26 (1 << 26) +#define ACTOR_STATE_27 (1 << 27) +#define ACTOR_STATE_28 (1 << 28) #define ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES (1 << 29) #define ACTOR_STATE_IN_DEMO (1 << 30) diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h index 6292ecf9..4fd3647b 100644 --- a/include/m_collision_bg.h +++ b/include/m_collision_bg.h @@ -202,6 +202,14 @@ typedef struct wall_info_s { s16 type; } mCoBG_WallInfo_c; +enum { + mCoBG_WALL_TYPE0, + mCoBG_WALL_TYPE1, + + // TODO + mCoBG_WALL_TYPE_NUM +}; + typedef struct collision_bg_check_s { mCoBG_Collision_u collision_units[5]; mCoBG_CheckResult_c result; diff --git a/src/actor/ac_gyo_kage.c b/src/actor/ac_gyo_kage.c new file mode 100644 index 00000000..19a0264e --- /dev/null +++ b/src/actor/ac_gyo_kage.c @@ -0,0 +1,240 @@ +#include "ac_gyo_kage.h" + +#include "ac_gyoei.h" +#include "m_name_table.h" +#include "m_common_data.h" +#include "sys_matrix.h" +#include "m_rcp.h" + +static void aGYO_KAGE_actor_ct(ACTOR* actorx, GAME* game); +static void aGYO_KAGE_actor_dt(ACTOR* actorx, GAME* game); +static void aGYO_KAGE_actor_move(ACTOR* actorx, GAME* game); +static void aGYO_KAGE_actor_draw(ACTOR* actorx, GAME* game); + +// clang-format off +ACTOR_PROFILE Gyo_Kage_Profile = { + mAc_PROFILE_GYO_KAGE, + ACTOR_PART_BG, + ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED, + EMPTY_NO, + ACTOR_OBJ_BANK_KEEP, + sizeof(GYO_KAGE_ACTOR), + &aGYO_KAGE_actor_ct, + &aGYO_KAGE_actor_dt, + &aGYO_KAGE_actor_move, + &aGYO_KAGE_actor_draw, + NULL, +}; +// clang-format on + +#include "../src/actor/ac_gyoei_data.c_inc" + +f32 aGYO_KAGE_shadow_scale[aGYO_SIZE_NUM] = { 0.3f, 0.4f, 0.5f, 0.5f, 0.6f, 0.8f, 1.2f, 10.0f }; + +static s16 aGYO_KAGE_Get_flow_angle(ACTOR* actorx) { + xyz_t flow; + s16 angle; + + mCoBG_GetWaterFlow(&flow, actorx->bg_collision_check.result.unit_attribute); + angle = atans_table(flow.z, flow.x); + return angle; +} + +static void aGYO_KAGE_effect_hamon(ACTOR* actorx, GAME* game, s16 arg) { + xyz_t pos = actorx->world.position; + f32 water_height = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 139); + s16 angle = aGYO_KAGE_Get_flow_angle(actorx); + + pos.y = water_height; + eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, angle, game, EMPTY_NO, arg, 0); +} + +static u8 aGYO_KAGE_Wall_Check(ACTOR* actorx) { + GYO_KAGE_ACTOR* gyo_kage = (GYO_KAGE_ACTOR*)actorx; + u8 res = FALSE; + + if ((actorx->bg_collision_check.result.hit_wall & mCoBG_HIT_WALL_FRONT) != 0) { + int hit_count = actorx->bg_collision_check.result.hit_wall_count; + + if (hit_count != 0) { + int i; + + for (i = 0; i < hit_count; i++) { + if (actorx->bg_collision_check.wall_info[i].type == mCoBG_WALL_TYPE0) { + s16 wall_angle = actorx->bg_collision_check.wall_info[i].angleY; + s16 goal_angle = wall_angle - (DEG2SHORT_ANGLE2(180.0f) + actorx->world.angle.y); + + if (goal_angle < 0) { + actorx->world.angle.y += DEG2SHORT_ANGLE2(90.0f); + } else { + actorx->world.angle.y -= DEG2SHORT_ANGLE2(90.0f); + } + + actorx->shape_info.rotation.y = actorx->world.angle.y; + gyo_kage->wall_flag = TRUE; + res = TRUE; + break; + } + } + } + } + + return res; +} + +static void aGYO_KAGE_actor_ct(ACTOR* actorx, GAME* game) { + GYO_KAGE_ACTOR* gyo_kage = (GYO_KAGE_ACTOR*)actorx; + GAME_PLAY* play = (GAME_PLAY*)game; + u32 atr; + f32 scale; + + actorx->drawn = TRUE; + actorx->shape_info.draw_shadow = FALSE; + gyo_kage->data_id = -1; + gyo_kage->gyoei_actor = NULL; + + scale = aGYO_KAGE_shadow_scale[actorx->actor_specific] * 0.02f; + actorx->scale.x = scale; + actorx->scale.y = scale; + actorx->scale.z = scale; + actorx->speed = 2.0f; + actorx->shape_info.rotation.y = actorx->world.angle.y; + gyo_kage->delete_timer = 100; + gyo_kage->draw_frame = 38; + gyo_kage->exist_flag = TRUE; + gyo_kage->wall_flag = FALSE; + + atr = mCoBG_Wpos2BgAttribute_Original(actorx->world.position); + if (mCoBG_CheckWaterAttribute(atr)) { + actorx->world.position.y = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 244) - 8.0f; + } + + gyo_kage->gyoei_actor = Actor_info_name_search(&play->actor_info, mAc_PROFILE_GYOEI, ACTOR_PART_CONTROL); +} + +static void aGYO_KAGE_actor_dt(ACTOR* actorx, GAME* game) { + GYO_KAGE_ACTOR* gyo_kage = (GYO_KAGE_ACTOR*)actorx; + + gyo_kage->exist_flag = FALSE; + ClObjPipe_dt(game, &gyo_kage->col_pipe); +} + +static void aGYO_KAGE_BGcheck(ACTOR* actorx) { + mCoBG_BgCheckControll(NULL, actorx, 40.0f, 0.0f, FALSE, FALSE, 1); +} + +static void aGYO_KAGE_Cullcheck(ACTOR* actorx, GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + + if (actorx->block_x != play->block_table.block_x || actorx->block_z != play->block_table.block_z) { + Actor_delete(actorx); + } +} + +static void aGYO_KAGE_position_move(ACTOR* actorx) { + GYO_KAGE_ACTOR* gyo_kage = (GYO_KAGE_ACTOR*)actorx; + + xyz_t_move(&actorx->last_world_position, &actorx->world.position); + if (gyo_kage->draw_frame <= 0) { + gyo_kage->draw_frame = 38; + } else { + gyo_kage->draw_frame--; + } + + Actor_position_moveF(actorx); + actorx->world.position.y = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 339) - 8.0f; +} + +static void aGYO_KAGE_actor_move(ACTOR* actorx, GAME* game) { + GYO_KAGE_ACTOR* gyo_kage = (GYO_KAGE_ACTOR*)actorx; + int timer; + + if (gyo_kage->gyoei_actor != NULL && ((GYOEI_ACTOR*)gyo_kage->gyoei_actor)->exist[0] != 0) { + ((GYOEI_ACTOR*)gyo_kage->gyoei_actor)->exist[0] = 0; + } + + actorx->state_bitfield &= ~ACTOR_STATE_24; + if ((actorx->state_bitfield & ACTOR_STATE_NO_MOVE_WHILE_CULLED) == 0) { + return; + } + + aGYO_KAGE_position_move(actorx); + aGYO_KAGE_BGcheck(actorx); + + if (gyo_kage->delete_timer == 96) { + switch (actorx->actor_specific) { + case 0: + case 1: + aGYO_KAGE_effect_hamon(actorx, game, 2); + break; + case 3: + aGYO_KAGE_effect_hamon(actorx, game, 1); + break; + case 2: + case 4: + case 5: + aGYO_KAGE_effect_hamon(actorx, game, 0); + break; + default: + break; + } + } + + if (gyo_kage->delete_timer == 0) { + timer = 0; + } else { + timer = --gyo_kage->delete_timer; + } + + if (timer == 0) { + Actor_delete(actorx); + } else { + if (aGYO_KAGE_Wall_Check(actorx) && gyo_kage->wall_flag == FALSE) { + return; + } + + chase_f(&actorx->speed, 0.0f, 0.02f); + gyo_kage->wall_flag = FALSE; + } + + aGYO_KAGE_Cullcheck(actorx, game); +} + +extern Gfx act_gyoei02_00_modelT[]; + +static void aGYO_KAGE_actor_draw(ACTOR* actorx, GAME* game) { + GYO_KAGE_ACTOR* gyo_kage = (GYO_KAGE_ACTOR*)actorx; + GRAPH* graph = game->graph; + int tex_idx0; + int tex_idx1; + int alpha = ((int)(gyo_kage->delete_timer * 0.5f) - 10) * 6; + s16 angle_x = actorx->shape_info.rotation.x; + s16 angle_y = actorx->shape_info.rotation.y + DEG2SHORT_ANGLE2(180.0f); + int frame = (int)(gyo_kage->draw_frame * 0.5f); + + Matrix_push(); + _texture_z_light_fog_prim_xlu(graph); + tex_idx0 = aGYO_2tile_texture_idx[frame][0]; + tex_idx1 = aGYO_2tile_texture_idx[frame][1]; + if (alpha <= 0) { + alpha = 0; + } + gyo_kage->alpha = alpha; + + Matrix_translate(actorx->world.position.x, actorx->world.position.y, actorx->world.position.z, 0); + Matrix_RotateX(angle_x, 1); + Matrix_RotateY(angle_y, 1); + Matrix_scale(actorx->scale.x * 0.4f, actorx->scale.y, actorx->scale.z, 1); + + OPEN_DISP(graph); + + gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, aGYO_texture_table[tex_idx0]); + gSPSegment(NEXT_POLY_XLU_DISP, ANIME_2_TXT_SEG, aGYO_texture_table[tex_idx1]); + gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, aGYO_prim_f[frame], 0, 0, 0, gyo_kage->alpha); + gSPDisplayList(NEXT_POLY_XLU_DISP, act_gyoei02_00_modelT); + + CLOSE_DISP(graph); + + Matrix_pull(); +} diff --git a/src/actor/ac_gyoei_data.c_inc b/src/actor/ac_gyoei_data.c_inc new file mode 100644 index 00000000..b48cdf0e --- /dev/null +++ b/src/actor/ac_gyoei_data.c_inc @@ -0,0 +1,63 @@ +extern u8 act_gyoei02_0_int_i4[]; +extern u8 act_gyoei02_1_int_i4[]; +extern u8 act_gyoei02_2_int_i4[]; +extern u8 act_gyoei02_3_int_i4[]; + +// clang-format off +static u8* aGYO_texture_table[] = { + act_gyoei02_0_int_i4, + act_gyoei02_1_int_i4, + act_gyoei02_2_int_i4, + act_gyoei02_3_int_i4, +}; +// clang-format on + +// clang-format off +static u8 aGYO_2tile_texture_idx[][2] = { + { 0, 3 }, + { 0, 3 }, + { 0, 3 }, + { 0, 3 }, + { 0, 3 }, + { 2, 3 }, + { 2, 3 }, + { 2, 3 }, + { 2, 3 }, + { 2, 3 }, + { 2, 1 }, + { 2, 1 }, + { 2, 1 }, + { 2, 1 }, + { 2, 1 }, + { 0, 1 }, + { 0, 1 }, + { 0, 1 }, + { 0, 1 }, + { 0, 1 }, +}; +// clang-format on + +// clang-format off +static u8 aGYO_prim_f[] = { + 51, + 102, + 153, + 204, + 255, + 204, + 153, + 102, + 51, + 0, + 51, + 102, + 153, + 204, + 255, + 204, + 153, + 102, + 51, + 0, +}; +// clang-format on diff --git a/src/actor/ac_gyoei_type.c_inc b/src/actor/ac_gyoei_type.c_inc index c2e64738..0d793bcf 100644 --- a/src/actor/ac_gyoei_type.c_inc +++ b/src/actor/ac_gyoei_type.c_inc @@ -6,50 +6,50 @@ typedef struct gyoei_type_s { // clang-format off static aGYO_type_c gyoei_type[] = { - { 1, 3, 4 }, // aSOG_FISH_TYPE_CRUCIAN_CARP - { 2, 3, 2 }, // aSOG_FISH_TYPE_BROOK_TROUT - { 4, 2, 3 }, // aSOG_FISH_TYPE_CARP - { 4, 2, 3 }, // aSOG_FISH_TYPE_KOI - { 4, 3, 4 }, // aSOG_FISH_TYPE_CATFISH - { 1, 3, 3 }, // aSOG_FISH_TYPE_SMALL_BASS - { 3, 2, 2 }, // aSOG_FISH_TYPE_BASS - { 4, 1, 1 }, // aSOG_FISH_TYPE_LARGE_BASS - { 1, 4, 4 }, // aSOG_FISH_TYPE_BLUEGILL - { 5, 2, 4 }, // aSOG_FISH_TYPE_GIANT_CATFISH - { 5, 2, 1 }, // aSOG_FISH_TYPE_GIANT_SNAKEHEAD - { 4, 2, 3 }, // aSOG_FISH_TYPE_BARBEL_STEED - { 3, 3, 3 }, // aSOG_FISH_TYPE_DACE - { 1, 3, 3 }, // aSOG_FISH_TYPE_PALE_CHUB - { 0, 2, 1 }, // aSOG_FISH_TYPE_BITTERLING - { 0, 3, 3 }, // aSOG_FISH_TYPE_LOACH - { 0, 3, 3 }, // aSOG_FISH_TYPE_POND_SMELT - { 1, 2, 1 }, // aSOG_FISH_TYPE_SWEETFISH - { 1, 1, 1 }, // aSOG_FISH_TYPE_CHERRY_SALMON - { 4, 1, 1 }, // aSOG_FISH_TYPE_LARGE_CHAR - { 3, 2, 2 }, // aSOG_FISH_TYPE_RAINBOW_TROUT - { 5, 1, 1 }, // aSOG_FISH_TYPE_STRINGFISH - { 4, 2, 1 }, // aSOG_FISH_TYPE_SALMON - { 0, 2, 3 }, // aSOG_FISH_TYPE_GOLDFISH - { 1, 4, 3 }, // aSOG_FISH_TYPE_PIRANHA - { 3, 3, 2 }, // aSOG_FISH_TYPE_AROWANA - { 2, 1, 1 }, // aSOG_FISH_TYPE_EEL - { 1, 2, 4 }, // aSOG_FISH_TYPE_FRESHWATER_GOBY - { 1, 2, 2 }, // aSOG_FISH_TYPE_ANGELFISH - { 0, 2, 3 }, // aSOG_FISH_TYPE_GUPPY - { 0, 2, 3 }, // aSOG_FISH_TYPE_POPEYED_GOLDFISH - { 5, 2, 0 }, // aSOG_FISH_TYPE_COELACANTH - { 1, 4, 4 }, // aSOG_FISH_TYPE_CRAWFISH - { 0, 4, 3 }, // aSOG_FISH_TYPE_FROG - { 0, 2, 2 }, // aSOG_FISH_TYPE_KILLIFISH - { 3, 2, 4 }, // aSOG_FISH_TYPE_JELLYFISH - { 4, 3, 2 }, // aSOG_FISH_TYPE_SEA_BASS - { 4, 2, 1 }, // aSOG_FISH_TYPE_RED_SNAPPER - { 4, 2, 0 }, // aSOG_FISH_TYPE_BARRED_KNIFEJAW - { 6, 1, 1 }, // aSOG_FISH_TYPE_ARAPAIMA - { 7, 1, 1 }, // aSOG_FISH_TYPE_WHALE - { 0, 1, 3 }, // aSOG_FISH_TYPE_EMPTY_CAN - { 3, 2, 4 }, // aSOG_FISH_TYPE_BOOT - { 4, 2, 4 }, // aSOG_FISH_TYPE_OLD_TIRE - { 4, 2, 1 }, // aSOG_FISH_TYPE_SALMON2 + { aGYO_SIZE_XS, 3, 4 }, // aGYO_TYPE_CRUCIAN_CARP + { aGYO_SIZE_S, 3, 2 }, // aGYO_TYPE_BROOK_TROUT + { aGYO_SIZE_L, 2, 3 }, // aGYO_TYPE_CARP + { aGYO_SIZE_L, 2, 3 }, // aGYO_TYPE_KOI + { aGYO_SIZE_L, 3, 4 }, // aGYO_TYPE_CATFISH + { aGYO_SIZE_XS, 3, 3 }, // aGYO_TYPE_SMALL_BASS + { aGYO_SIZE_M, 2, 2 }, // aGYO_TYPE_BASS + { aGYO_SIZE_L, 1, 1 }, // aGYO_TYPE_LARGE_BASS + { aGYO_SIZE_XS, 4, 4 }, // aGYO_TYPE_BLUEGILL + { aGYO_SIZE_XL, 2, 4 }, // aGYO_TYPE_GIANT_CATFISH + { aGYO_SIZE_XL, 2, 1 }, // aGYO_TYPE_GIANT_SNAKEHEAD + { aGYO_SIZE_L, 2, 3 }, // aGYO_TYPE_BARBEL_STEED + { aGYO_SIZE_M, 3, 3 }, // aGYO_TYPE_DACE + { aGYO_SIZE_XS, 3, 3 }, // aGYO_TYPE_PALE_CHUB + { aGYO_SIZE_XXS, 2, 1 }, // aGYO_TYPE_BITTERLING + { aGYO_SIZE_XXS, 3, 3 }, // aGYO_TYPE_LOACH + { aGYO_SIZE_XXS, 3, 3 }, // aGYO_TYPE_POND_SMELT + { aGYO_SIZE_XS, 2, 1 }, // aGYO_TYPE_SWEETFISH + { aGYO_SIZE_XS, 1, 1 }, // aGYO_TYPE_CHERRY_SALMON + { aGYO_SIZE_L, 1, 1 }, // aGYO_TYPE_LARGE_CHAR + { aGYO_SIZE_M, 2, 2 }, // aGYO_TYPE_RAINBOW_TROUT + { aGYO_SIZE_XL, 1, 1 }, // aGYO_TYPE_STRINGFISH + { aGYO_SIZE_L, 2, 1 }, // aGYO_TYPE_SALMON + { aGYO_SIZE_XXS, 2, 3 }, // aGYO_TYPE_GOLDFISH + { aGYO_SIZE_XS, 4, 3 }, // aGYO_TYPE_PIRANHA + { aGYO_SIZE_M, 3, 2 }, // aGYO_TYPE_AROWANA + { aGYO_SIZE_S, 1, 1 }, // aGYO_TYPE_EEL + { aGYO_SIZE_XS, 2, 4 }, // aGYO_TYPE_FRESHWATER_GOBY + { aGYO_SIZE_XS, 2, 2 }, // aGYO_TYPE_ANGELFISH + { aGYO_SIZE_XXS, 2, 3 }, // aGYO_TYPE_GUPPY + { aGYO_SIZE_XXS, 2, 3 }, // aGYO_TYPE_POPEYED_GOLDFISH + { aGYO_SIZE_XL, 2, 0 }, // aGYO_TYPE_COELACANTH + { aGYO_SIZE_XS, 4, 4 }, // aGYO_TYPE_CRAWFISH + { aGYO_SIZE_XXS, 4, 3 }, // aGYO_TYPE_FROG + { aGYO_SIZE_XXS, 2, 2 }, // aGYO_TYPE_KILLIFISH + { aGYO_SIZE_M, 2, 4 }, // aGYO_TYPE_JELLYFISH + { aGYO_SIZE_L, 3, 2 }, // aGYO_TYPE_SEA_BASS + { aGYO_SIZE_L, 2, 1 }, // aGYO_TYPE_RED_SNAPPER + { aGYO_SIZE_L, 2, 0 }, // aGYO_TYPE_BARRED_KNIFEJAW + { aGYO_SIZE_XXL, 1, 1 }, // aGYO_TYPE_ARAPAIMA + { aGYO_SIZE_WHALE, 1, 1 }, // aGYO_TYPE_WHALE + { aGYO_SIZE_XXS, 1, 3 }, // aGYO_TYPE_EMPTY_CAN + { aGYO_SIZE_M, 2, 4 }, // aGYO_TYPE_BOOT + { aGYO_SIZE_L, 2, 4 }, // aGYO_TYPE_OLD_TIRE + { aGYO_SIZE_L, 2, 1 }, // aGYO_TYPE_SALMON2 }; // clang-format on diff --git a/src/actor/ac_set_ovl_gyoei.c b/src/actor/ac_set_ovl_gyoei.c index ddc4513d..66e2bbf8 100644 --- a/src/actor/ac_set_ovl_gyoei.c +++ b/src/actor/ac_set_ovl_gyoei.c @@ -15,7 +15,7 @@ /* sizeof(aSOG_term_info_c) == 4 */ typedef struct term_info_s { - /* 0x00 */ s16 type; /* fish type (aSOG_FISH_TYPE_*) */ + /* 0x00 */ s16 type; /* fish type (aGYO_TYPE_*) */ /* 0x02 */ u8 spawn_area; /* spawn area (aSOG_SPAWN_AREA_*) */ /* 0x03 */ u8 weight; /* weight value */ } aSOG_term_info_c; @@ -26,7 +26,7 @@ typedef struct term_list_s { /* 0x04 */ aSOG_term_info_c* term_info; /* pointer to term info items */ } aSOG_term_list_c; -#define FISH_SPAWN(fish, area, weight) { aSOG_FISH_TYPE_##fish, aSOG_SPAWN_AREA_##area, weight } +#define FISH_SPAWN(fish, area, weight) { aGYO_TYPE_##fish, aSOG_SPAWN_AREA_##area, weight } static aSOG_term_info_c r_m1_t0[14] = { FISH_SPAWN(CRUCIAN_CARP, RIVER, 5), @@ -1329,13 +1329,13 @@ static int aSOG_gyoei_place_check(u8 spawn_area, u32 block_type) { * @param block_type Current acre type flags * @param info_count Number of spawns in spawn_info * @param env_rate Town environment rating spawn % modifier rate - * @return Spawn is invalid: aSOG_FISH_TYPE_INVALID/aSOG_FISH_TYPE_NUM, otherwise index into the spawn_info table to try spawning + * @return Spawn is invalid: aGYO_TYPE_INVALID/aGYO_TYPE_NUM, otherwise index into the spawn_info table to try spawning **/ static int aSOG_gyoei_get_idx_sub(aSOG_gyoei_spawn_info_weight_f_c* spawn_info, int* set_table, u32 block_type, int info_count, f32 env_rate) { f32 total_spawn_weight = 0.0f; f32 selected_weight; f32 now_weight; - int selected_idx = aSOG_FISH_TYPE_INVALID; + int selected_idx = aGYO_TYPE_INVALID; aSOG_gyoei_spawn_info_weight_f_c* spawn_info_p = spawn_info; int* set_table_p = set_table; int i; @@ -1366,7 +1366,7 @@ static int aSOG_gyoei_get_idx_sub(aSOG_gyoei_spawn_info_weight_f_c* spawn_info, if (selected_weight >= now_weight) { *set_table_p = TRUE; if (!aSOG_gyoei_place_check(spawn_info_p->spawn_area, block_type)) { - selected_idx = aSOG_FISH_TYPE_NUM; + selected_idx = aGYO_TYPE_NUM; } else { selected_idx = i; @@ -1389,7 +1389,7 @@ static int aSOG_gyoei_get_idx_sub(aSOG_gyoei_spawn_info_weight_f_c* spawn_info, * @param spawn_info Pointer to the possible spawns * @param info_count Number of spawns in spawn_info * @param block_type Current acre type flags - * @return Spawn is invalid: aSOG_FISH_TYPE_INVALID/aSOG_FISH_TYPE_NUM, otherwise index into the spawn_info table to try spawning + * @return Spawn is invalid: aGYO_TYPE_INVALID/aGYO_TYPE_NUM, otherwise index into the spawn_info table to try spawning **/ static int aSOG_gyoei_get_idx(aSOG_gyoei_spawn_info_weight_f_c* spawn_info, int info_count, u32 block_type) { static f32 env_rate_table[mFAs_FIELDRANK_NUM] = { @@ -1402,13 +1402,13 @@ static int aSOG_gyoei_get_idx(aSOG_gyoei_spawn_info_weight_f_c* spawn_info, int 1.000f /* Field Rank 6 */ }; - int set_table[aSOG_FISH_TYPE_NUM]; + int set_table[aGYO_TYPE_NUM]; f32 env_rate; int field_rank; int i; - int idx = aSOG_FISH_TYPE_INVALID; + int idx = aGYO_TYPE_INVALID; - bzero(set_table, aSOG_FISH_TYPE_NUM * sizeof(int)); + bzero(set_table, aGYO_TYPE_NUM * sizeof(int)); field_rank = mFAs_GetFieldRank(); if (field_rank < mFAs_FIELDRANK_ZERO || field_rank > mFAs_FIELDRANK_SIX) { @@ -1425,7 +1425,7 @@ static int aSOG_gyoei_get_idx(aSOG_gyoei_spawn_info_weight_f_c* spawn_info, int /* keep trying to roll a fish until a valid one is found for the current acre or all have been exhausted */ for (i = 0; i < info_count; i++) { idx = aSOG_gyoei_get_idx_sub(spawn_info, set_table, block_type, info_count, env_rate); - if (idx == aSOG_FISH_TYPE_INVALID || idx != aSOG_FISH_TYPE_NUM) { + if (idx == aGYO_TYPE_INVALID || idx != aGYO_TYPE_NUM) { break; } } @@ -1454,7 +1454,7 @@ static int aSOG_gyoei_set_gyoei_data(aSOG_set_data_c* set_data, int* block_xz, i u32 attribute; xyz_t wpos; - if (type != aSOG_FISH_TYPE_INVALID) { + if (type != aGYO_TYPE_INVALID) { fg_p = fg_idx_table; for (ut_z = 0; ut_z < UT_TOTAL_NUM - 1; ut_z++) { *fg_p++ = 0xffff; @@ -1469,7 +1469,7 @@ static int aSOG_gyoei_set_gyoei_data(aSOG_set_data_c* set_data, int* block_xz, i if (ut_z >= 2 && ut_z < UT_Z_NUM - 2 && ut_x >= 2 && ut_x < UT_X_NUM - 2) { attribute = collision_data->data.unit_attribute; switch (set_data->type) { - case aSOG_FISH_TYPE_LARGE_CHAR: + case aGYO_TYPE_LARGE_CHAR: { if (attribute == mCoBG_ATTRIBUTE_WATERFALL) { valid_fg_num++; @@ -1479,11 +1479,11 @@ static int aSOG_gyoei_set_gyoei_data(aSOG_set_data_c* set_data, int* block_xz, i } /* ocean fish */ - case aSOG_FISH_TYPE_COELACANTH: - case aSOG_FISH_TYPE_JELLYFISH: - case aSOG_FISH_TYPE_SEA_BASS: - case aSOG_FISH_TYPE_RED_SNAPPER: - case aSOG_FISH_TYPE_BARRED_KNIFEJAW: + case aGYO_TYPE_COELACANTH: + case aGYO_TYPE_JELLYFISH: + case aGYO_TYPE_SEA_BASS: + case aGYO_TYPE_RED_SNAPPER: + case aGYO_TYPE_BARRED_KNIFEJAW: { if (attribute == mCoBG_ATTRIBUTE_SEA && attribute != mCoBG_ATTRIBUTE_WAVE) { f32 bg_y; @@ -1504,8 +1504,8 @@ static int aSOG_gyoei_set_gyoei_data(aSOG_set_data_c* set_data, int* block_xz, i break; } - case aSOG_FISH_TYPE_SALMON: - case aSOG_FISH_TYPE_SALMON2: + case aGYO_TYPE_SALMON: + case aGYO_TYPE_SALMON2: { if (mCoBG_CheckWaterAttribute(attribute)) { if (attribute == mCoBG_ATTRIBUTE_SEA && attribute != mCoBG_ATTRIBUTE_WAVE) { @@ -1534,7 +1534,7 @@ static int aSOG_gyoei_set_gyoei_data(aSOG_set_data_c* set_data, int* block_xz, i break; } - case aSOG_FISH_TYPE_WHALE: + case aGYO_TYPE_WHALE: { if (ut_z >= 5 && ut_z < UT_Z_NUM - 5 && ut_x >= 5 && ut_x < UT_X_NUM - 5 && mCoBG_CheckWaterAttribute(attribute)) { valid_fg_num++; @@ -1587,7 +1587,7 @@ static int aSOG_gyoei_set_gyoei_data(aSOG_set_data_c* set_data, int* block_xz, i static int aSOG_gyoei_decide_gyoei(aSOG_set_data_c* set_data, int* block_xz, aSOG_gyoei_spawn_info_weight_f_c* spawn_info, int info_count, u32 block_type) { int res = FALSE; int idx = aSOG_gyoei_get_idx(spawn_info, info_count, block_type); // decide fish - if (idx != aSOG_FISH_TYPE_INVALID) { + if (idx != aGYO_TYPE_INVALID) { aSOG_gyoei_spawn_info_weight_f_c* selected_info = spawn_info + idx; int spawn_area = selected_info->spawn_area; if (spawn_area < aSOG_SPAWN_AREA_NUM) { @@ -1616,7 +1616,7 @@ static int aSOG_gyoei_make(aSOG_set_data_c* set_data, int* block_xz, GAME* game) init_data.fish_type = set_data->type; switch (init_data.fish_type) { - case aSOG_FISH_TYPE_LARGE_CHAR: + case aGYO_TYPE_LARGE_CHAR: { aSOG_get_fall_attribute_position(&wpos); break; diff --git a/src/actor/ac_uki_move.c_inc b/src/actor/ac_uki_move.c_inc index 899b5ac6..48052d20 100644 --- a/src/actor/ac_uki_move.c_inc +++ b/src/actor/ac_uki_move.c_inc @@ -68,7 +68,7 @@ static mActor_name_t aUKI_get_fish_type(ACTOR* actorx) { // clang-format on mActor_name_t item = EMPTY_NO; - if (uki->gyo_type >= 0 && uki->gyo_type < aSOG_FISH_TYPE_EXTENDED_NUM) { + if (uki->gyo_type >= 0 && uki->gyo_type < aGYO_TYPE_EXTENDED_NUM) { item = fish_data[uki->gyo_type]; } @@ -892,9 +892,9 @@ static void aUKI_set_proc_bite(ACTOR* actorx, GAME* game, int arg) { aUKI_effect_sibuki(actorx, game, 0); switch (uki->gyo_type) { - case aSOG_FISH_TYPE_EMPTY_CAN: - case aSOG_FISH_TYPE_BOOT: - case aSOG_FISH_TYPE_OLD_TIRE: + case aGYO_TYPE_EMPTY_CAN: + case aGYO_TYPE_BOOT: + case aGYO_TYPE_OLD_TIRE: uki->frame_timer = 26; break; default: diff --git a/src/game/m_inventory_ovl.c b/src/game/m_inventory_ovl.c index 760d45f2..eb014914 100644 --- a/src/game/m_inventory_ovl.c +++ b/src/game/m_inventory_ovl.c @@ -68,7 +68,7 @@ enum { static mIV_Ovl_c inv_ovl_data; // clang-format off -#define F(n) aSOG_FISH_TYPE_##n +#define F(n) aGYO_TYPE_##n /* Fish collection layout */ static u8 mIV_fish_collect_list[] = { diff --git a/src/game/m_player_main_notice_rod.c_inc b/src/game/m_player_main_notice_rod.c_inc index 554ee0b8..f0a9b2f3 100644 --- a/src/game/m_player_main_notice_rod.c_inc +++ b/src/game/m_player_main_notice_rod.c_inc @@ -29,7 +29,7 @@ static void Player_actor_setup_main_Notice_rod(ACTOR* actor, GAME* game) { uki = (UKI_ACTOR*)player->fishing_rod_actor_p; type = uki->gyo_type; - if (uki != NULL && type >= aSOG_FISH_TYPE_CRUCIAN_CARP) { + if (uki != NULL && type >= aGYO_TYPE_CRUCIAN_CARP) { int free_space = mPlib_Get_space_putin_item(); if (free_space >= 0) { @@ -39,7 +39,7 @@ static void Player_actor_setup_main_Notice_rod(ACTOR* actor, GAME* game) { main_notice->not_full_pocket = FALSE; } - if (type < aSOG_FISH_TYPE_NUM + 1) { + if (type < aGYO_TYPE_NUM + 1) { main_notice->already_collected = mSM_CHECK_LAST_FISH_GET(type); mSM_COLLECT_FISH_SET(type); } @@ -47,7 +47,7 @@ static void Player_actor_setup_main_Notice_rod(ACTOR* actor, GAME* game) { main_notice->not_full_pocket = FALSE; } - if (type == aSOG_FISH_TYPE_BARRED_KNIFEJAW) { + if (type == aGYO_TYPE_BARRED_KNIFEJAW) { mISL_SetNowPlayerAction(mISL_PLAYER_ACTION_NOTICE_FISHING_ROD); } Player_actor_InitAnimation_Base2(actor, game, mPlayer_ANIM_GET_T2, mPlayer_ANIM_GET_T2, 1.0f, 1.0f, 0.5f, -3.0f, 0, @@ -99,7 +99,7 @@ static void Player_actor_SearchAnimation_Notice_rod(ACTOR* actor, GAME* game, f3 } static void Player_actor_AppearMark_Notice_rod(ACTOR* actor) { - static int use_mark_gyoei_type = aSOG_FISH_TYPE_KILLIFISH; + static int use_mark_gyoei_type = aGYO_TYPE_KILLIFISH; PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; mPlayer_main_notice_rod_c* main_notice = &player->main_data.notice_rod; @@ -110,7 +110,7 @@ static void Player_actor_AppearMark_Notice_rod(ACTOR* actor) { if (uki != NULL) { int type = uki->gyo_type; - if (type >= aSOG_FISH_TYPE_CRUCIAN_CARP) { + if (type >= aGYO_TYPE_CRUCIAN_CARP) { int killfish = FALSE; if (type == use_mark_gyoei_type) { @@ -157,8 +157,8 @@ static void Player_actor_Notice_rod_demo_ct(ACTOR* actor) { if (uki != NULL) { int type = uki->gyo_type; - if (type >= aSOG_FISH_TYPE_CRUCIAN_CARP) { - if (type < aSOG_FISH_TYPE_NUM + 1) { + if (type >= aGYO_TYPE_CRUCIAN_CARP) { + if (type < aGYO_TYPE_NUM + 1) { if (player->now_main_index == mPlayer_INDEX_NOTICE_ROD) { mPlayer_main_notice_rod_c* main_notice = &player->main_data.notice_rod; u8 str[16];