mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-22 22:24:16 -04:00
Implement & link ac_uki, player refactors
This commit is contained in:
@@ -675,6 +675,10 @@ ac_train_window.c:
|
||||
.text: [0x804AC510, 0x804AD428]
|
||||
.rodata: [0x80645FA8, 0x80645FF8]
|
||||
.data: [0x8068F600, 0x8068F830]
|
||||
ac_uki.c:
|
||||
.text: [0x804AD644, 0x804AFC14]
|
||||
.rodata: [0x80646010, 0x806460D8]
|
||||
.data: [0x8068F858, 0x8068FC68]
|
||||
bg_cherry_item.c:
|
||||
.text: [0x804AFC14, 0x804B6FB4]
|
||||
.rodata: [0x806460D8, 0x80646178]
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "libultra/ultratypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -16,12 +17,12 @@ enum {
|
||||
aUKI_STATUS_FLOAT,
|
||||
aUKI_STATUS_VIB,
|
||||
aUKI_STATUS_COMEBACK,
|
||||
aUKI_STATUS_7,
|
||||
aUKI_STATUS_CATCH,
|
||||
|
||||
aUKI_STATUS_NUM
|
||||
};
|
||||
|
||||
typedef void (*aUKI_SET_VALUE_PROC)(ACTOR* actorx, xyz_t pos, xyz_t pos_speed, int param_4, int command);
|
||||
typedef void (*aUKI_SET_VALUE_PROC)(ACTOR* actorx, xyz_t pos, xyz_t pos_speed, int angle_speed_y, int command);
|
||||
typedef mActor_name_t (*aUKI_GET_FISH_TYPE)(ACTOR* actorx);
|
||||
|
||||
/* sizeof(UKI_ACTOR) == 0x2B8 */
|
||||
|
||||
@@ -83,6 +83,8 @@ typedef enum audio_sound_effects {
|
||||
|
||||
NA_SE_ROD_STROKE = 0x109,
|
||||
NA_SE_ROD_BACK,
|
||||
NA_SE_10B,
|
||||
NA_SE_10C,
|
||||
|
||||
NA_SE_HANABI0 = HANABI(0x10F),
|
||||
NA_SE_HANABI1 = HANABI(0x110),
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ typedef enum bank_id {
|
||||
ACTOR_OBJ_BANK_KEITAI,
|
||||
ACTOR_OBJ_BANK_46,
|
||||
ACTOR_OBJ_BANK_47,
|
||||
ACTOR_OBJ_BANK_48,
|
||||
ACTOR_OBJ_BANK_UKI,
|
||||
ACTOR_OBJ_BANK_49,
|
||||
ACTOR_OBJ_BANK_50,
|
||||
ACTOR_OBJ_BANK_51,
|
||||
|
||||
@@ -2551,6 +2551,7 @@ extern int mNT_check_unknown(mActor_name_t item_no);
|
||||
#define ETC_SNOWMAN_BALL_A (ETC_START + 13)
|
||||
#define ETC_SNOWMAN_BALL_B (ETC_START + 14)
|
||||
#define ETC_TRAIN_WINDOW (ETC_START + 17)
|
||||
#define ETC_UKI (ETC_START + 18)
|
||||
|
||||
#define MISC_ACTOR_START 0x9000
|
||||
#define MISC_ACTOR_SAMPLE MISC_ACTOR_START
|
||||
|
||||
+1
-1
@@ -2070,7 +2070,7 @@ typedef struct controller_data_s {
|
||||
s8 btn_a;
|
||||
s8 trigger_btn_b;
|
||||
s8 btn_b;
|
||||
mActor_name_t equiped_item;
|
||||
mActor_name_t equipped_item;
|
||||
} mPlayer_Controller_Data_c;
|
||||
|
||||
typedef struct player_eye_pattern_s {
|
||||
|
||||
@@ -91,6 +91,8 @@ typedef u32 unknown;
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#define FLOOR(n, f) (((n) / (f)) * (f))
|
||||
|
||||
#define F32_IS_ZERO(v) (fabsf(v) < 0.008f)
|
||||
|
||||
/* ARGB8 color format (32 bits) to RGB5A3 color format (16 bits) */
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
typedef struct gyoei_type_s {
|
||||
short size;
|
||||
short search_area;
|
||||
int byte_time;
|
||||
} aGYO_type_c;
|
||||
|
||||
// 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
|
||||
};
|
||||
// clang-format on
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
#include "ac_uki.h"
|
||||
|
||||
#include "m_play.h"
|
||||
#include "m_name_table.h"
|
||||
#include "ac_set_ovl_gyoei.h"
|
||||
#include "m_vibctl.h"
|
||||
#include "m_common_data.h"
|
||||
#include "ef_effect_control.h"
|
||||
#include "m_player_lib.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "m_actor_shadow.h"
|
||||
|
||||
enum {
|
||||
aUKI_PROC_CARRY,
|
||||
aUKI_PROC_READY,
|
||||
aUKI_PROC_AIR,
|
||||
aUKI_PROC_CAST,
|
||||
aUKI_PROC_WAIT,
|
||||
aUKI_PROC_HIT,
|
||||
aUKI_PROC_TOUCH,
|
||||
aUKI_PROC_BITE,
|
||||
aUKI_PROC_CATCH,
|
||||
aUKI_PROC_GET,
|
||||
aUKI_PROC_FORCE,
|
||||
|
||||
aUKI_PROC_NUM
|
||||
};
|
||||
|
||||
static void aUKI_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aUKI_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aUKI_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aUKI_actor_draw(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Uki_Profile = {
|
||||
mAc_PROFILE_UKI,
|
||||
ACTOR_PART_BG,
|
||||
ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
ETC_UKI,
|
||||
ACTOR_OBJ_BANK_UKI,
|
||||
sizeof(UKI_ACTOR),
|
||||
&aUKI_actor_ct,
|
||||
&aUKI_actor_dt,
|
||||
&aUKI_actor_move,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static ClObjPipeData_c aUKI_CoInfoData = {
|
||||
0x3D, 0x20, ClObj_TYPE_PIPE,
|
||||
0x01,
|
||||
8, 8, 0, 0, 0, 0,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static StatusData_c aUKI_StatusData = { 0, 8, 8, 0, 50 };
|
||||
|
||||
#include "../src/ac_gyoei_type.c_inc"
|
||||
|
||||
typedef struct uki_vib_s {
|
||||
int n_frames;
|
||||
int attack_frames;
|
||||
int sustain_frames;
|
||||
int release_frames;
|
||||
} aUKI_vib_c;
|
||||
|
||||
static void aUKI_set_value(ACTOR* actorx, xyz_t pos, xyz_t pos_speed, int angle_speed_y, int command);
|
||||
static mActor_name_t aUKI_get_fish_type(ACTOR* actorx);
|
||||
static void aUKI_set_proc(ACTOR* actorx, GAME* game, int proc, int arg);
|
||||
|
||||
static void aUKI_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
Shape_Info_init(actorx, 0.0, &mAc_ActorShadowEllipse, 4.5, 8.5);
|
||||
actorx->shape_info.draw_shadow = FALSE;
|
||||
ClObjPipe_ct(game, &uki->col_pipe);
|
||||
ClObjPipe_set5(game, &uki->col_pipe, actorx, &aUKI_CoInfoData);
|
||||
CollisionCheck_Status_set3(&actorx->status_data, &aUKI_StatusData);
|
||||
actorx->max_velocity_y = -20.0;
|
||||
actorx->gravity = 1.2;
|
||||
actorx->speed = 0.0;
|
||||
uki->_194 = 0.0;
|
||||
Matrix_copy_MtxF(&uki->mtxf, &MtxF_clear);
|
||||
actorx->scale.x = 0.01;
|
||||
actorx->scale.y = 0.01;
|
||||
actorx->scale.z = 0.01;
|
||||
actorx->world.position = uki->right_hand_pos;
|
||||
uki->set_value_proc = &aUKI_set_value;
|
||||
uki->get_fish_type_proc = &aUKI_get_fish_type;
|
||||
uki->child_actor = NULL;
|
||||
uki->frame_timer = 2;
|
||||
uki->cast_timer = 0;
|
||||
uki->touch_timer = 0;
|
||||
uki->touched_flag = FALSE;
|
||||
uki->hit_water_flag = FALSE;
|
||||
uki->gyo_type = -1;
|
||||
uki->color[0] = 255;
|
||||
uki->color[1] = 255;
|
||||
uki->color[2] = 255;
|
||||
uki->gyo_command = 0;
|
||||
uki->gyo_status = 0;
|
||||
uki->status = aUKI_STATUS_CARRY;
|
||||
uki->proc = aUKI_PROC_CARRY;
|
||||
uki->coast_flag = FALSE;
|
||||
uki->_2B5 = 0;
|
||||
}
|
||||
|
||||
static void aUKI_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
ClObjPipe_dt(game, &uki->col_pipe);
|
||||
}
|
||||
|
||||
#include "../src/ac_uki_move.c_inc"
|
||||
#include "../src/ac_uki_draw.c_inc"
|
||||
@@ -0,0 +1,90 @@
|
||||
static void aUKI_rotate_calc(UKI_ACTOR* uki) {
|
||||
f32 angle_x = (uki->position_speed.x * 30.0f) / 6.0f;
|
||||
f32 angle_z = (uki->position_speed.z * 30.0f) / 6.0f;
|
||||
f32 sin = sin_s(uki->uki_rot_speed);
|
||||
|
||||
uki->uki_angle.x = DEG2SHORT_ANGLE2(180.0f + (angle_x * sin));
|
||||
uki->uki_angle.z = DEG2SHORT_ANGLE2(180.0f + (angle_z * sin));
|
||||
uki->uki_rot_speed += DEG2SHORT_ANGLE2(5.625f);
|
||||
}
|
||||
|
||||
extern Gfx tol_uki1_model[];
|
||||
extern Gfx tol_uki2_model[];
|
||||
|
||||
static void aUKI_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
ACTOR* player_actor = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
||||
GRAPH* graph = game->graph;
|
||||
mActor_name_t item;
|
||||
|
||||
OPEN_POLY_OPA_DISP(graph);
|
||||
|
||||
Matrix_mult(&uki->mtxf, 1);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
switch (uki->proc) {
|
||||
case aUKI_PROC_CARRY:
|
||||
aUKI_rotate_calc(uki);
|
||||
Matrix_RotateY(player_actor->shape_info.rotation.y, 1);
|
||||
break;
|
||||
case aUKI_PROC_READY:
|
||||
case aUKI_PROC_AIR:
|
||||
uki->uki_angle.x = search_position_angleX(&actorx->world.position, &uki->rod_top_position);
|
||||
uki->uki_angle.y = search_position_angleY(&actorx->world.position, &uki->rod_top_position);
|
||||
uki->uki_angle.x += DEG2SHORT_ANGLE2(180.0f);
|
||||
Matrix_RotateY(uki->uki_angle.y, 1);
|
||||
Matrix_RotateX(uki->uki_angle.x, 1);
|
||||
break;
|
||||
case aUKI_PROC_CAST:
|
||||
add_calc_short_angle2(&uki->uki_angle.x, DEG2SHORT_ANGLE2(90.0f), 1.0f - sqrtf(0.95f), 1024, 0);
|
||||
uki->uki_angle.y = search_position_angleY(&actorx->world.position, &uki->rod_top_position);
|
||||
Matrix_RotateY(uki->uki_angle.y, 1);
|
||||
Matrix_RotateX(uki->uki_angle.x, 1);
|
||||
break;
|
||||
case aUKI_PROC_HIT:
|
||||
uki->uki_angle.y = search_position_angleY(&actorx->world.position, &uki->rod_top_position);
|
||||
if (uki->frame_timer < 10) {
|
||||
add_calc_short_angle2(&uki->uki_angle.x, DEG2SHORT_ANGLE2(0.0f), 1.0f - sqrtf(0.9f), 2048, 0);
|
||||
} else {
|
||||
uki->uki_angle.x = search_position_angleX(&actorx->world.position, &uki->rod_top_position);
|
||||
uki->uki_angle.x += DEG2SHORT_ANGLE2(-90.0f);
|
||||
}
|
||||
Matrix_RotateY(uki->uki_angle.y, 1);
|
||||
Matrix_RotateX(uki->uki_angle.x, 1);
|
||||
break;
|
||||
case aUKI_PROC_WAIT:
|
||||
if (uki->cast_timer == 0) {
|
||||
add_calc_short_angle2(&uki->uki_angle.x, DEG2SHORT_ANGLE2(0.0f), 1.0f - sqrtf(0.8f),
|
||||
DEG2SHORT_ANGLE2(45.0f), 0);
|
||||
} else {
|
||||
add_calc_short_angle2(&uki->uki_angle.x, DEG2SHORT_ANGLE2(90.0f), 1.0f - sqrtf(0.95f), 1024, 0);
|
||||
}
|
||||
uki->uki_angle.y = search_position_angleY(&actorx->world.position, &uki->rod_top_position);
|
||||
Matrix_RotateY(uki->uki_angle.y, 1);
|
||||
Matrix_RotateX(uki->uki_angle.x, 1);
|
||||
break;
|
||||
case aUKI_PROC_BITE:
|
||||
if (uki->gyo_status == 4) {
|
||||
add_calc_short_angle2(&uki->uki_angle.x, DEG2SHORT_ANGLE2(-90.0f), 1.0f - sqrtf(0.95f), 1024, 0);
|
||||
Matrix_RotateY(uki->uki_angle.y, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, uki->color[0], uki->color[1], uki->color[2], 255);
|
||||
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
item = mPlib_Get_controller_data_for_title_demo_p()->equipped_item;
|
||||
} else {
|
||||
item = Now_Private->equipment;
|
||||
}
|
||||
|
||||
if (item == ITM_ROD) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, tol_uki1_model);
|
||||
} else {
|
||||
gSPDisplayList(POLY_OPA_DISP++, tol_uki2_model);
|
||||
}
|
||||
|
||||
CLOSE_POLY_OPA_DISP(graph);
|
||||
}
|
||||
@@ -0,0 +1,991 @@
|
||||
static void set_collision(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
CollisionCheck_Uty_ActorWorldPosSetPipeC(actorx, &uki->col_pipe);
|
||||
CollisionCheck_setOC(game, &play->collision_check, &uki->col_pipe.collision_obj);
|
||||
}
|
||||
|
||||
static void aUKI_set_value(ACTOR* actorx, xyz_t pos, xyz_t pos_speed, int angle_speed_y, int command) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->right_hand_pos = pos;
|
||||
uki->position_speed = pos_speed;
|
||||
uki->angle_speed_y = angle_speed_y;
|
||||
uki->command = command;
|
||||
}
|
||||
|
||||
static mActor_name_t aUKI_get_fish_type(ACTOR* actorx) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
// clang-format off
|
||||
static mActor_name_t fish_data[] = {
|
||||
ITM_FISH00,
|
||||
ITM_FISH01,
|
||||
ITM_FISH02,
|
||||
ITM_FISH03,
|
||||
ITM_FISH04,
|
||||
ITM_FISH05,
|
||||
ITM_FISH06,
|
||||
ITM_FISH07,
|
||||
ITM_FISH08,
|
||||
ITM_FISH09,
|
||||
ITM_FISH10,
|
||||
ITM_FISH11,
|
||||
ITM_FISH12,
|
||||
ITM_FISH13,
|
||||
ITM_FISH14,
|
||||
ITM_FISH15,
|
||||
ITM_FISH16,
|
||||
ITM_FISH17,
|
||||
ITM_FISH18,
|
||||
ITM_FISH19,
|
||||
ITM_FISH20,
|
||||
ITM_FISH21,
|
||||
ITM_FISH22,
|
||||
ITM_FISH23,
|
||||
ITM_FISH24,
|
||||
ITM_FISH25,
|
||||
ITM_FISH26,
|
||||
ITM_FISH27,
|
||||
ITM_FISH28,
|
||||
ITM_FISH29,
|
||||
ITM_FISH30,
|
||||
ITM_FISH31,
|
||||
ITM_FISH32,
|
||||
ITM_FISH33,
|
||||
ITM_FISH34,
|
||||
ITM_FISH35,
|
||||
ITM_FISH36,
|
||||
ITM_FISH37,
|
||||
ITM_FISH38,
|
||||
ITM_FISH39,
|
||||
ITM_FISH39,
|
||||
ITM_DUST0_EMPTY_CAN,
|
||||
ITM_DUST1_BOOT,
|
||||
ITM_DUST2_OLD_TIRE,
|
||||
ITM_FISH22,
|
||||
};
|
||||
// clang-format on
|
||||
mActor_name_t item = EMPTY_NO;
|
||||
|
||||
if (uki->gyo_type >= 0 && uki->gyo_type < aSOG_FISH_TYPE_EXTENDED_NUM) {
|
||||
item = fish_data[uki->gyo_type];
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
static void aUKI_chase_color(int* col_p, u32 target, int step) {
|
||||
u32 now = *col_p;
|
||||
|
||||
if (now != target) {
|
||||
int n_step = (f32)step * 0.5f;
|
||||
|
||||
if (n_step > 0) {
|
||||
int d = now - target;
|
||||
|
||||
if (d > n_step) {
|
||||
*col_p = now + n_step;
|
||||
} else {
|
||||
*col_p = target;
|
||||
}
|
||||
} else {
|
||||
int d = now - target;
|
||||
|
||||
if (d < n_step) {
|
||||
*col_p = now - -n_step;
|
||||
} else {
|
||||
*col_p = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_BGcheck(ACTOR* actorx) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
f32 ground_y;
|
||||
f32 water_y;
|
||||
f32 y;
|
||||
|
||||
switch (mCoBG_Wpos2Attribute(actorx->world.position, NULL)) {
|
||||
case mCoBG_ATTRIBUTE_SEA:
|
||||
case mCoBG_ATTRIBUTE_WAVE:
|
||||
case mCoBG_ATTRIBUTE_SAND: {
|
||||
ground_y = mCoBG_GetBgY_AngleS_FromWpos(NULL, actorx->world.position, 0.0f);
|
||||
water_y = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 237);
|
||||
uki->range = 5.0f;
|
||||
if ((water_y - ground_y) < 10.0f) {
|
||||
y = 0.0f;
|
||||
} else {
|
||||
y = -12.0f;
|
||||
}
|
||||
|
||||
if (uki->proc == 6 && (water_y - ground_y) < 20.0f) {
|
||||
actorx->world.angle.y += DEG2SHORT_ANGLE2(180.0f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case mCoBG_ATTRIBUTE_WATERFALL: {
|
||||
uki->range = 11.0f;
|
||||
y = -12.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
if (uki->proc == 4) {
|
||||
if (uki->cast_timer != 0) {
|
||||
uki->range = 12.0f;
|
||||
y = 0.0f;
|
||||
} else {
|
||||
chase_f(&uki->range, 40.0f, 0.05f);
|
||||
y = -12.0f;
|
||||
}
|
||||
} else {
|
||||
uki->range = 12.0f;
|
||||
y = -12.0f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (uki->proc) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 5:
|
||||
mCoBG_BgCheckControll(NULL, actorx, uki->range, y, TRUE, TRUE, 1);
|
||||
break;
|
||||
default:
|
||||
mCoBG_BgCheckControll(NULL, actorx, uki->range, y, TRUE, FALSE, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_touch_vib_proc(UKI_ACTOR* uki) {
|
||||
static aUKI_vib_c vib_data_table[] = {
|
||||
// clang-format off
|
||||
{ 60, 0, 1, 10 },
|
||||
{ 70, 0, 1, 10 },
|
||||
{ 80, 0, 1, 10 },
|
||||
{ 90, 0, 1, 10 },
|
||||
{ 100, 0, 1, 10 },
|
||||
{ 100, 1, 2, 9 },
|
||||
{ 100, 2, 2, 7 },
|
||||
{ 100, 2, 2, 7 },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
if (uki->gyo_type >= 0) {
|
||||
s16 idx = gyoei_type[uki->gyo_type].size;
|
||||
aUKI_vib_c* vib_p = &vib_data_table[idx];
|
||||
|
||||
mVibctl_simple_entry(vib_p->n_frames, mVibctl_VIB_PROG_FFF, vib_p->attack_frames, vib_p->sustain_frames,
|
||||
vib_p->release_frames, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_bite_vib_proc(ACTOR* actorx) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
static aUKI_vib_c vib_data_table[] = {
|
||||
// clang-format off
|
||||
{ 40, 5, 60, 3 },
|
||||
{ 50, 5, 60, 3 },
|
||||
{ 60, 5, 60, 3 },
|
||||
{ 70, 5, 60, 3 },
|
||||
{ 80, 5, 60, 3 },
|
||||
{ 90, 5, 60, 3 },
|
||||
{ 100, 5, 60, 3 },
|
||||
{ 100, 5, 60, 3 },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
if (uki->gyo_type >= 0) {
|
||||
s16 idx = gyoei_type[uki->gyo_type].size;
|
||||
aUKI_vib_c* vib_p = &vib_data_table[idx];
|
||||
|
||||
mVibctl_simple_entry(vib_p->n_frames, mVibctl_VIB_PROG_IMPACT, vib_p->attack_frames, vib_p->sustain_frames,
|
||||
vib_p->release_frames, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_clear_spd(ACTOR* actorx) {
|
||||
actorx->speed = 0.0f;
|
||||
actorx->position_speed.x = 0.0f;
|
||||
actorx->position_speed.z = 0.0f;
|
||||
}
|
||||
|
||||
static void aUKI_parabola_init(UKI_ACTOR* uki, const xyz_t* p0, const xyz_t* p1, s16 timer, u8 type) {
|
||||
f32 y_param;
|
||||
f32 f = (f32)(int)timer;
|
||||
f32 step = f * 0.5f;
|
||||
f32 dx = p1->x - p0->x;
|
||||
f32 dy = p1->y - p0->y;
|
||||
f32 dz = p1->z - p0->z;
|
||||
|
||||
if (dy > 100.0f) {
|
||||
y_param = 12.0f;
|
||||
} else {
|
||||
y_param = 4.5f;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 0: {
|
||||
uki->parabola_vec[0].x = dx / f;
|
||||
uki->parabola_vec[0].y = dy / f;
|
||||
uki->parabola_vec[0].z = dz / f;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
uki->parabola_vec[1].y = (2.0f * (y_param * f - dy)) / SQ(f);
|
||||
uki->parabola_vec[0].x = dx / step;
|
||||
uki->parabola_vec[0].y = y_param - uki->parabola_vec[1].y;
|
||||
uki->parabola_vec[0].z = dz / step;
|
||||
uki->parabola_vec[1].x = uki->parabola_vec[0].x / f;
|
||||
uki->parabola_vec[1].z = uki->parabola_vec[0].z / f;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
uki->parabola_acc[1].y = (2.0f * (y_param * f - dy)) / SQ(f);
|
||||
uki->parabola_acc[0].x = dx / step;
|
||||
uki->parabola_acc[0].y = y_param - uki->parabola_acc[1].y;
|
||||
uki->parabola_acc[0].z = dz / step;
|
||||
uki->parabola_acc[1].x = uki->parabola_acc[0].x / f;
|
||||
uki->parabola_acc[1].z = uki->parabola_acc[0].z / f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_parabola_move(ACTOR* actorx, u8 type) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
switch (type) {
|
||||
case 0:
|
||||
xyz_t_add(&actorx->world.position, &uki->parabola_vec[0], &actorx->world.position);
|
||||
break;
|
||||
case 1:
|
||||
xyz_t_add(&actorx->world.position, &uki->parabola_vec[0], &actorx->world.position);
|
||||
xyz_t_sub(&uki->parabola_vec[0], &uki->parabola_vec[1], &uki->parabola_vec[0]);
|
||||
break;
|
||||
case 2:
|
||||
xyz_t_add(&uki->uki_pos, &uki->parabola_acc[0], &uki->uki_pos);
|
||||
xyz_t_sub(&uki->parabola_acc[0], &uki->parabola_acc[1], &uki->parabola_acc[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static s16 aUKI_Get_flow_angle(ACTOR* actorx) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
xyz_t flow;
|
||||
|
||||
mCoBG_GetWaterFlow(&flow, actorx->bg_collision_check.result.unit_attribute);
|
||||
return atans_table(flow.z, flow.x);
|
||||
}
|
||||
|
||||
static void aUKI_effect_sibuki(ACTOR* actorx, GAME* game, s16 arg) {
|
||||
xyz_t pos = actorx->world.position;
|
||||
s16 flow_angle;
|
||||
|
||||
pos.y = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 575);
|
||||
flow_angle = aUKI_Get_flow_angle(actorx);
|
||||
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_MIZU, pos, 1, flow_angle, game, EMPTY_NO, arg, 0);
|
||||
}
|
||||
|
||||
static void aUKI_effect_hamon(ACTOR* actorx, GAME* game, s16 arg) {
|
||||
xyz_t pos = actorx->world.position;
|
||||
s16 flow_angle;
|
||||
|
||||
pos.y = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 603);
|
||||
flow_angle = aUKI_Get_flow_angle(actorx);
|
||||
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, pos, 1, flow_angle, game, EMPTY_NO, arg, 0);
|
||||
}
|
||||
|
||||
static void aUKI_movement(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
s16 flow_angle;
|
||||
|
||||
flow_angle = aUKI_Get_flow_angle(actorx);
|
||||
if (actorx->player_distance_xz < 130.0f ||
|
||||
actorx->bg_collision_check.result.unit_attribute == mCoBG_ATTRIBUTE_WATERFALL) {
|
||||
if (uki->gyo_command != 1) {
|
||||
if (uki->touch_timer != 5) {
|
||||
uki->touch_timer = 0;
|
||||
}
|
||||
|
||||
chase_f(&actorx->speed, 0.45f, 0.1f);
|
||||
} else {
|
||||
chase_f(&actorx->speed, 0.225f, 0.1f);
|
||||
}
|
||||
|
||||
actorx->position_speed.x = actorx->speed * sin_s(flow_angle);
|
||||
actorx->position_speed.z = actorx->speed * cos_s(flow_angle);
|
||||
} else {
|
||||
if (uki->gyo_command != 1) {
|
||||
if (uki->touch_timer != 5) {
|
||||
uki->touch_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
actorx->speed = 0.8f;
|
||||
actorx->position_speed.x = actorx->speed * sin_s(actorx->player_angle_y);
|
||||
actorx->position_speed.z = actorx->speed * cos_s(actorx->player_angle_y);
|
||||
}
|
||||
|
||||
if (actorx->player_distance_xz > 127.0f && (play->game_frame % 10) == 0) {
|
||||
aUKI_effect_hamon(actorx, game, 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_coast_wave(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
switch (mCoBG_Wpos2Attribute(actorx->world.position, NULL)) {
|
||||
case mCoBG_ATTRIBUTE_WAVE:
|
||||
case mCoBG_ATTRIBUTE_SAND:
|
||||
aUKI_clear_spd(actorx);
|
||||
if (uki->coast_flag == FALSE) {
|
||||
uki->coast_flag = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
aUKI_movement(actorx, game);
|
||||
Actor_position_move(actorx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_vib_calc(ACTOR* actorx, f32 height, f32 max_speed_y, f32 gravity) {
|
||||
if (actorx->world.position.y < height) {
|
||||
actorx->max_velocity_y = max_speed_y;
|
||||
} else {
|
||||
actorx->max_velocity_y = -max_speed_y;
|
||||
}
|
||||
|
||||
actorx->gravity = gravity;
|
||||
}
|
||||
|
||||
static void aUKI_set_spd_relations_in_water(ACTOR* actorx, GAME* game) {
|
||||
static s16 angl_add_table[] = { DEG2SHORT_ANGLE2(1.40625f), DEG2SHORT_ANGLE2(5.625f) };
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
s16 flow_angle;
|
||||
int idx;
|
||||
f32 water_height = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 772);
|
||||
|
||||
if (uki->gyo_command == 2) {
|
||||
if (uki->gyo_status == 4) {
|
||||
f32 height = water_height + 7.5f;
|
||||
|
||||
if (uki->touch_timer != 6) {
|
||||
aUKI_vib_calc(actorx, height, 2.0f, 1.0f);
|
||||
if (actorx->world.position.y >= height) {
|
||||
uki->touch_timer = 6;
|
||||
}
|
||||
} else {
|
||||
aUKI_vib_calc(actorx, height, 0.3f, 0.1f);
|
||||
}
|
||||
} else {
|
||||
f32 height = water_height - 7.5f;
|
||||
|
||||
if (uki->touch_timer != 5) {
|
||||
aUKI_vib_calc(actorx, height, 1.5f, 0.5f);
|
||||
if (actorx->world.position.y < (water_height - 7.5f)) {
|
||||
uki->touch_timer = 5;
|
||||
}
|
||||
} else {
|
||||
aUKI_vib_calc(actorx, height, 0.3f, 0.1f);
|
||||
}
|
||||
}
|
||||
} else if (uki->gyo_command == 1) {
|
||||
if (uki->touched_flag) {
|
||||
uki->touched_flag = FALSE;
|
||||
uki->touch_timer = 2;
|
||||
aUKI_effect_hamon(actorx, game, 2);
|
||||
aUKI_touch_vib_proc(uki);
|
||||
}
|
||||
|
||||
switch (uki->touch_timer) {
|
||||
case 4:
|
||||
aUKI_vib_calc(actorx, water_height, 0.3f, -0.050000005f);
|
||||
break;
|
||||
case 0:
|
||||
case 2:
|
||||
water_height -= 1.7f;
|
||||
aUKI_vib_calc(actorx, water_height, 0.9f, 1.0f);
|
||||
if (actorx->world.position.y < water_height) {
|
||||
uki->touch_timer = 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
aUKI_vib_calc(actorx, water_height, 0.9f, 1.0f);
|
||||
if (actorx->world.position.y >= water_height) {
|
||||
uki->touch_timer = 4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (uki->proc == 4) {
|
||||
flow_angle = aUKI_Get_flow_angle(actorx);
|
||||
idx = ABS((s16)(actorx->world.angle.y - flow_angle)) > DEG2SHORT_ANGLE2(90.0f);
|
||||
|
||||
chase_angle(&actorx->world.angle.y, flow_angle, angl_add_table[idx]);
|
||||
actorx->shape_info.rotation.y = actorx->world.angle.y;
|
||||
}
|
||||
|
||||
if (actorx->bg_collision_check.result.unit_attribute == mCoBG_ATTRIBUTE_WATERFALL) {
|
||||
if (actorx->world.position.y < water_height) {
|
||||
if (uki->touch_timer == 5) {
|
||||
aUKI_vib_calc(actorx, water_height, 0.9f, 1.0f);
|
||||
} else {
|
||||
aUKI_vib_calc(actorx, water_height, 0.3f, -0.050000005f);
|
||||
}
|
||||
} else {
|
||||
actorx->max_velocity_y = -3.0f;
|
||||
actorx->gravity = 3.0f;
|
||||
}
|
||||
|
||||
switch (uki->proc) {
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
uki->gyo_status = 1;
|
||||
actorx->position_speed.y = 0.0f;
|
||||
uki->gyo_command = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (uki->touch_timer == 5) {
|
||||
aUKI_vib_calc(actorx, water_height, 0.9f, 1.0f);
|
||||
if (actorx->world.position.y >= water_height) {
|
||||
aUKI_effect_hamon(actorx, game, 1);
|
||||
uki->touch_timer = 0;
|
||||
}
|
||||
} else {
|
||||
aUKI_vib_calc(actorx, water_height, 0.3f, -0.050000005f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_color(ACTOR* actorx) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
f32 water_height = mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 911);
|
||||
|
||||
if (actorx->world.position.y < (water_height - 3.0f)) {
|
||||
aUKI_chase_color(&uki->color[0], 100, -52);
|
||||
aUKI_chase_color(&uki->color[1], 100, -52);
|
||||
aUKI_chase_color(&uki->color[2], 128, -43);
|
||||
} else {
|
||||
aUKI_chase_color(&uki->color[0], 255, 52);
|
||||
aUKI_chase_color(&uki->color[1], 255, 52);
|
||||
aUKI_chase_color(&uki->color[2], 255, 43);
|
||||
}
|
||||
}
|
||||
|
||||
static u8 aUKI_force_command(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
u8 res = FALSE;
|
||||
|
||||
switch (uki->command) {
|
||||
case 8:
|
||||
res = TRUE;
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_FORCE, 0);
|
||||
break;
|
||||
case 7:
|
||||
res = TRUE;
|
||||
aUKI_clear_spd(actorx);
|
||||
uki->frame_timer = 52;
|
||||
aUKI_parabola_init(uki, &actorx->world.position, &uki->right_hand_pos, uki->frame_timer, 1);
|
||||
uki->status = aUKI_STATUS_COMEBACK;
|
||||
aUKI_effect_sibuki(actorx, game, 1);
|
||||
sAdo_OngenTrgStart(NA_SE_10C, &actorx->world.position);
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_FORCE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void aUKI_carry(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
actorx->world.position = uki->right_hand_pos;
|
||||
uki->uki_pos = uki->right_hand_pos;
|
||||
|
||||
if (uki->command == 2) {
|
||||
int timer;
|
||||
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_READY, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_ready(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
int timer;
|
||||
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
switch (uki->command) {
|
||||
case 3:
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CAST, 0);
|
||||
break;
|
||||
case 4:
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_AIR, 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
aUKI_parabola_move(actorx, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_air(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
int timer;
|
||||
|
||||
aUKI_parabola_move(actorx, 0);
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
aUKI_clear_spd(actorx);
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CARRY, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_cast(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
int timer;
|
||||
|
||||
aUKI_parabola_move(actorx, 1);
|
||||
if (actorx->bg_collision_check.result.is_in_water) {
|
||||
uki->hit_water_flag = TRUE;
|
||||
aUKI_effect_sibuki(actorx, game, 3);
|
||||
mVibctl_simple_entry(50, mVibctl_VIB_PROG_FFF, 0, 1, 15, 0.0f);
|
||||
uki->status = aUKI_STATUS_FLOAT;
|
||||
sAdo_OngenTrgStart(NA_SE_10B, &actorx->world.position);
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_WAIT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_wait(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->hit_water_flag = FALSE;
|
||||
uki->uki_pos = actorx->world.position;
|
||||
chase_f(&actorx->position_speed.y, actorx->max_velocity_y, actorx->gravity);
|
||||
|
||||
if (aUKI_force_command(actorx, game) == FALSE) {
|
||||
int timer;
|
||||
|
||||
if (uki->cast_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->cast_timer;
|
||||
}
|
||||
|
||||
if (timer == 0 && uki->gyo_command == 1) {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_TOUCH, 0);
|
||||
} else if (uki->command == 6) {
|
||||
int timer;
|
||||
|
||||
aUKI_clear_spd(actorx);
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_HIT, 1);
|
||||
}
|
||||
} else {
|
||||
aUKI_coast_wave(actorx, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_hit(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
int timer;
|
||||
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
if (uki->gyo_status == 5) {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CATCH, 0);
|
||||
} else {
|
||||
uki->gyo_command = 0;
|
||||
uki->gyo_status = 0;
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CARRY, 0);
|
||||
}
|
||||
} else {
|
||||
aUKI_parabola_move(actorx, 1);
|
||||
aUKI_parabola_move(actorx, 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_touch(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
chase_f(&actorx->position_speed.y, actorx->max_velocity_y, actorx->gravity);
|
||||
if (aUKI_force_command(actorx, game) == FALSE) {
|
||||
if (uki->gyo_command == 2) {
|
||||
aUKI_touch_vib_proc(uki);
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_BITE, 0);
|
||||
} else if (uki->command == 6) {
|
||||
int timer;
|
||||
|
||||
aUKI_clear_spd(actorx);
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_HIT, 1);
|
||||
}
|
||||
} else {
|
||||
aUKI_movement(actorx, game);
|
||||
}
|
||||
|
||||
Actor_position_move(actorx);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_bite(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
// clang-format off
|
||||
static s16 angl[] = {
|
||||
DEG2SHORT_ANGLE2(10.1513671875f),
|
||||
DEG2SHORT_ANGLE2(9.4647216796875f),
|
||||
DEG2SHORT_ANGLE2(8.778076171875f),
|
||||
DEG2SHORT_ANGLE2(8.778076171875f),
|
||||
DEG2SHORT_ANGLE2(8.0914306640625f),
|
||||
DEG2SHORT_ANGLE2(7.40478515625f),
|
||||
DEG2SHORT_ANGLE2(7.03125f),
|
||||
DEG2SHORT_ANGLE2(7.03125),
|
||||
};
|
||||
// clang-format on
|
||||
// clang-format off
|
||||
static f32 spd[] = {
|
||||
0.1f,
|
||||
0.2f,
|
||||
0.3f,
|
||||
0.3f,
|
||||
0.4f,
|
||||
0.6f,
|
||||
0.8f,
|
||||
0.8f,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
chase_f(&actorx->position_speed.y, actorx->max_velocity_y, actorx->gravity);
|
||||
if (aUKI_force_command(actorx, game) == FALSE) {
|
||||
if (uki->gyo_command == 2) {
|
||||
if (uki->command == 6) {
|
||||
int timer;
|
||||
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
aUKI_clear_spd(actorx);
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_HIT, 3);
|
||||
aUKI_parabola_init(uki, &uki->uki_pos, &uki->left_hand_pos, uki->frame_timer, 2);
|
||||
uki->gyo_status = 5;
|
||||
} else {
|
||||
s16 idx = gyoei_type[uki->gyo_type].size;
|
||||
f32 angle = angl[idx];
|
||||
|
||||
actorx->world.angle.y += (int)(angle * 0.5f);
|
||||
actorx->shape_info.rotation.y = actorx->world.angle.y;
|
||||
actorx->speed = spd[idx];
|
||||
actorx->position_speed.x = actorx->speed * sin_s(actorx->world.angle.y);
|
||||
actorx->position_speed.z = actorx->speed * cos_s(actorx->world.angle.y);
|
||||
Actor_position_move(actorx);
|
||||
|
||||
uki->uki_pos = uki->gyo_pos;
|
||||
uki->gyo_status = 4;
|
||||
|
||||
if (uki->status != aUKI_STATUS_VIB) {
|
||||
aUKI_bite_vib_proc(actorx);
|
||||
}
|
||||
|
||||
uki->status = aUKI_STATUS_VIB;
|
||||
}
|
||||
} else {
|
||||
if ((game->frame_counter % 10) == 0) {
|
||||
aUKI_touch_vib_proc(uki);
|
||||
}
|
||||
|
||||
Actor_position_move(actorx);
|
||||
}
|
||||
} else {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_WAIT, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_catch(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
actorx->world.position = uki->right_hand_pos;
|
||||
uki->uki_pos = uki->left_hand_pos;
|
||||
|
||||
switch (uki->command) {
|
||||
case 1:
|
||||
uki->gyo_command = 0;
|
||||
uki->gyo_status = 8;
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CARRY, 0);
|
||||
break;
|
||||
case 5:
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_GET, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_get(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
actorx->world.position = uki->right_hand_pos;
|
||||
uki->uki_pos = uki->left_hand_pos;
|
||||
|
||||
if (uki->command == 1) {
|
||||
uki->gyo_command = 0;
|
||||
uki->gyo_status = 0;
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CARRY, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_force(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
if (uki->status == aUKI_STATUS_COMEBACK) {
|
||||
int timer;
|
||||
|
||||
if (uki->frame_timer == 0) {
|
||||
timer = 0;
|
||||
} else {
|
||||
timer = --uki->frame_timer;
|
||||
}
|
||||
|
||||
if (timer == 0) {
|
||||
aUKI_set_proc(actorx, game, aUKI_PROC_CARRY, 0);
|
||||
} else {
|
||||
aUKI_parabola_move(actorx, 1);
|
||||
}
|
||||
} else {
|
||||
aUKI_force_command(actorx, game);
|
||||
}
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_carry(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
actorx->position_speed.y = 0.0f;
|
||||
uki->frame_timer = 4;
|
||||
uki->status = aUKI_STATUS_CARRY;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_ready(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
ACTOR* player_actor = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
||||
xyz_t target_pos;
|
||||
|
||||
uki->frame_timer = 32;
|
||||
target_pos = actorx->world.position;
|
||||
target_pos.x -= 30.0f * sin_s(player_actor->shape_info.rotation.y);
|
||||
target_pos.z -= 30.0f * cos_s(player_actor->shape_info.rotation.y);
|
||||
aUKI_parabola_init(uki, &actorx->world.position, &target_pos, 20, 0);
|
||||
uki->status = aUKI_STATUS_READY;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_air(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->frame_timer = 14;
|
||||
aUKI_parabola_init(uki, &actorx->world.position, &uki->uki_pos, uki->frame_timer, 0);
|
||||
uki->status = aUKI_STATUS_CARRY;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_cast(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->frame_timer = 50;
|
||||
uki->cast_timer = 40;
|
||||
aUKI_parabola_init(uki, &actorx->world.position, &uki->cast_goal_point, uki->frame_timer, 1);
|
||||
uki->status = aUKI_STATUS_CAST;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_wait(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->frame_timer = 12;
|
||||
uki->gyo_status = 1;
|
||||
uki->gyo_type = -1;
|
||||
uki->child_actor = NULL;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_hit(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
Submenu* submenu_p = &play->submenu;
|
||||
|
||||
xyz_t_move(&submenu_p->water_pos, &actorx->world.position);
|
||||
uki->frame_timer = 52;
|
||||
aUKI_parabola_init(uki, &actorx->world.position, &uki->right_hand_pos, uki->frame_timer, 1);
|
||||
uki->status = aUKI_STATUS_COMEBACK;
|
||||
|
||||
if (uki->coast_flag) {
|
||||
uki->coast_flag = FALSE;
|
||||
} else {
|
||||
aUKI_effect_sibuki(actorx, game, arg);
|
||||
}
|
||||
|
||||
sAdo_OngenTrgStart(NA_SE_10C, &actorx->world.position);
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_touch(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
aUKI_clear_spd(actorx);
|
||||
aUKI_movement(actorx, game);
|
||||
Actor_position_move(actorx);
|
||||
|
||||
uki->frame_timer = 12;
|
||||
uki->gyo_status = 2;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_bite(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
static s16 timer[] = { 26, 39, 39, 39, 52, 65, 78, 78 };
|
||||
|
||||
aUKI_clear_spd(actorx);
|
||||
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:
|
||||
uki->frame_timer = 26;
|
||||
break;
|
||||
default:
|
||||
uki->frame_timer = (int)((f32)(int)timer[gyoei_type[uki->gyo_type].size] * 2.0f);
|
||||
break;
|
||||
}
|
||||
|
||||
uki->gyo_status = 3;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_catch(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->frame_timer = 20;
|
||||
uki->gyo_status = 6;
|
||||
uki->status = aUKI_STATUS_CATCH;
|
||||
}
|
||||
|
||||
static void aUKI_set_proc_get(ACTOR* actorx, GAME* game, int arg) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
uki->gyo_status = 7;
|
||||
}
|
||||
|
||||
typedef void (*aUKI_INIT_PROC)(ACTOR*, GAME*, int);
|
||||
|
||||
static void aUKI_set_proc(ACTOR* actorx, GAME* game, int proc, int arg) {
|
||||
// clang-format off
|
||||
static aUKI_INIT_PROC init_proc[] = {
|
||||
&aUKI_set_proc_carry,
|
||||
&aUKI_set_proc_ready,
|
||||
&aUKI_set_proc_air,
|
||||
&aUKI_set_proc_cast,
|
||||
&aUKI_set_proc_wait,
|
||||
&aUKI_set_proc_hit,
|
||||
&aUKI_set_proc_touch,
|
||||
&aUKI_set_proc_bite,
|
||||
&aUKI_set_proc_catch,
|
||||
&aUKI_set_proc_get,
|
||||
(aUKI_INIT_PROC)&none_proc1,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
(*init_proc[proc])(actorx, game, arg);
|
||||
uki->proc = proc;
|
||||
}
|
||||
|
||||
typedef void (*aUKI_MOVE_PROC)(ACTOR*, GAME*);
|
||||
|
||||
static void aUKI_actor_move(ACTOR* actorx, GAME* game) {
|
||||
UKI_ACTOR* uki = (UKI_ACTOR*)actorx;
|
||||
|
||||
if (uki->command != 0) {
|
||||
// clang-format off
|
||||
static aUKI_MOVE_PROC Uki_move_proc[] = {
|
||||
&aUKI_carry,
|
||||
&aUKI_ready,
|
||||
&aUKI_air,
|
||||
&aUKI_cast,
|
||||
&aUKI_wait,
|
||||
&aUKI_hit,
|
||||
&aUKI_touch,
|
||||
&aUKI_bite,
|
||||
&aUKI_catch,
|
||||
&aUKI_get,
|
||||
&aUKI_force,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
ACTOR* player_actor;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
|
||||
actorx->dw_proc = &aUKI_actor_draw;
|
||||
player_actor = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
||||
sin = sin_s(player_actor->shape_info.rotation.y);
|
||||
cos = cos_s(player_actor->shape_info.rotation.y);
|
||||
|
||||
uki->right_hand_pos.x += 3.0f * sin + -7.0f * cos;
|
||||
uki->right_hand_pos.y += 6.0f;
|
||||
uki->right_hand_pos.z += 3.0f * cos - -7.0f * sin;
|
||||
|
||||
(*Uki_move_proc[uki->proc])(actorx, game);
|
||||
aUKI_BGcheck(actorx);
|
||||
aUKI_set_spd_relations_in_water(actorx, game);
|
||||
aUKI_color(actorx);
|
||||
set_collision(actorx, game);
|
||||
|
||||
} else {
|
||||
actorx->dw_proc = NULL;
|
||||
}
|
||||
}
|
||||
@@ -47,5 +47,5 @@ extern Actor_data FIELD_TOOL_FIELD_actor_data[] = {
|
||||
};
|
||||
|
||||
extern s16 FIELD_TOOL_FIELD_object_bank[] = {
|
||||
ACTOR_OBJ_BANK_48, // 0
|
||||
ACTOR_OBJ_BANK_UKI, // 0
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ extern Actor_data TEST03_actor_data[] = {
|
||||
};
|
||||
|
||||
extern s16 TEST03_object_bank[] = {
|
||||
ACTOR_OBJ_BANK_48, // 0
|
||||
ACTOR_OBJ_BANK_UKI, // 0
|
||||
ACTOR_OBJ_BANK_PSNOWMAN, // 1
|
||||
ACTOR_OBJ_BANK_AIRPLANE, // 2
|
||||
ACTOR_OBJ_BANK_MURAL, // 3
|
||||
|
||||
@@ -61,6 +61,6 @@ extern Actor_data TEST_FD_NPC_LAND_actor_data[] = {
|
||||
};
|
||||
|
||||
extern s16 TEST_FD_NPC_LAND_object_bank[] = {
|
||||
ACTOR_OBJ_BANK_48, // 0
|
||||
ACTOR_OBJ_BANK_UKI, // 0
|
||||
ACTOR_OBJ_BANK_AC_SIGN, // 1
|
||||
};
|
||||
|
||||
@@ -48,5 +48,5 @@ extern Actor_data TITLE_DEMO_actor_data[] = {
|
||||
};
|
||||
|
||||
extern s16 TITLE_DEMO_object_bank[] = {
|
||||
ACTOR_OBJ_BANK_48, // 0
|
||||
ACTOR_OBJ_BANK_UKI, // 0
|
||||
};
|
||||
|
||||
@@ -4,13 +4,8 @@ static s16 Player_actor_Item_Get_goal_balloon_lean_angle(ACTOR* actor) {
|
||||
|
||||
static void Player_actor_Item_Setup_main_balloon_normal(ACTOR* actor, int item_kind, int kind) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
int check = FALSE;
|
||||
|
||||
if (mPlayer_ITEM_IS_BALLOON(kind)) {
|
||||
check = TRUE;
|
||||
}
|
||||
|
||||
if (check == FALSE) {
|
||||
if (mPlayer_ITEM_IS_BALLOON(kind) == FALSE) {
|
||||
player->balloon_lean_angle = Player_actor_Item_Get_goal_balloon_lean_angle(actor);
|
||||
player->balloon_angle = ZeroSVec;
|
||||
player->balloon_anim_max_frame = player->item_keyframe.frame_control.max_frames;
|
||||
|
||||
+113
-42
@@ -6,7 +6,7 @@ static void Player_actor_Set_ItemNoSubmenu(mActor_name_t item) {
|
||||
|
||||
static mActor_name_t Player_actor_Get_ItemNoSubmenu(void) {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return mPlib_Get_controller_data_for_title_demo_p()->equiped_item;
|
||||
return mPlib_Get_controller_data_for_title_demo_p()->equipped_item;
|
||||
} else {
|
||||
return Common_Get(now_private)->equipment;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ static s8 Player_actor_Get_ItemKind_from_submenu(void) {
|
||||
}
|
||||
|
||||
static s8 Player_actor_Get_ItemKind_fromScene(void) {
|
||||
if (Player_actor_CheckScene_AbleOutItem(Save_Get(scene_no)) != 0) {
|
||||
if (Player_actor_CheckScene_AbleOutItem(Save_Get(scene_no))) {
|
||||
return Player_actor_Get_ItemKind_from_submenu();
|
||||
}
|
||||
return -1;
|
||||
@@ -33,16 +33,11 @@ static s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) {
|
||||
} else if (player->able_hand_all_item_in_demo != FALSE) {
|
||||
return scene_kind;
|
||||
} else {
|
||||
if (able == 0) {
|
||||
if (able == mPlayer_ABLE_ITEM_CAN_USE_ALL) {
|
||||
return scene_kind;
|
||||
} else if (able == 1) {
|
||||
int holdable = mPlayer_ITEM_IS_UMBRELLA(scene_kind) || mPlayer_ITEM_IS_BALLOON(scene_kind) ||
|
||||
mPlayer_ITEM_IS_WINDMILL(scene_kind) || mPlayer_ITEM_IS_FAN(scene_kind)
|
||||
|
||||
? TRUE
|
||||
: FALSE;
|
||||
|
||||
if (holdable) {
|
||||
} else if (able == mPlayer_ABLE_ITEM_CAN_USE_UMBRELLA) {
|
||||
if ((mPlayer_ITEM_IS_UMBRELLA(scene_kind) || mPlayer_ITEM_IS_BALLOON(scene_kind) ||
|
||||
mPlayer_ITEM_IS_WINDMILL(scene_kind) || mPlayer_ITEM_IS_FAN(scene_kind)) != FALSE) {
|
||||
return scene_kind;
|
||||
}
|
||||
}
|
||||
@@ -51,36 +46,110 @@ static s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) {
|
||||
}
|
||||
|
||||
static int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) {
|
||||
// clang-format off
|
||||
static const s8 data[] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 20,
|
||||
20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_NET_NORMAL,
|
||||
mPlayer_ITEM_MAIN_NET_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_UMBRELLA_NORMAL,
|
||||
mPlayer_ITEM_MAIN_ROD_NORMAL,
|
||||
mPlayer_ITEM_MAIN_ROD_NORMAL,
|
||||
mPlayer_ITEM_MAIN_SCOOP_NORMAL,
|
||||
mPlayer_ITEM_MAIN_SCOOP_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_BALLOON_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_WINDMILL_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
mPlayer_ITEM_MAIN_FAN_NORMAL,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
if (mPlayer_ITEM_KIND_VALID(kind)) {
|
||||
return data[kind];
|
||||
} else {
|
||||
return 0;
|
||||
return mPlayer_ITEM_MAIN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_birth_umbrella(ACTOR* actor, GAME* game) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
int is_umbrella;
|
||||
aTOL_Clip_c* tools;
|
||||
s8 kind;
|
||||
|
||||
if (player->umbrella_actor == NULL) {
|
||||
tools = Common_Get(clip).tools_clip;
|
||||
if (tools != NULL &&
|
||||
(player->umbrella_state == 1 || player->umbrella_state == 4 || player->umbrella_state == 2)) {
|
||||
is_umbrella = FALSE;
|
||||
(player->umbrella_state == aTOL_ACTION_TAKEOUT || player->umbrella_state == aTOL_ACTION_S_TAKEOUT ||
|
||||
player->umbrella_state == aTOL_ACTION_PUTAWAY)) {
|
||||
kind = player->item_kind;
|
||||
if (mPlayer_ITEM_IS_UMBRELLA(kind)) {
|
||||
is_umbrella = TRUE;
|
||||
}
|
||||
|
||||
if (is_umbrella) {
|
||||
if (mPlayer_ITEM_IS_UMBRELLA(kind) != FALSE) {
|
||||
player->umbrella_actor = tools->aTOL_birth_proc(kind - mPlayer_ITEM_KIND_UMBRELLA00,
|
||||
player->umbrella_state, actor, game, -1, 0);
|
||||
|
||||
@@ -131,7 +200,7 @@ static void Player_actor_Item_DMA_Data(ACTOR* actor, int skl_idx, int anim_idx,
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
int change_bank = Player_actor_Change_ItemBank(actor, skl_idx, anim_idx);
|
||||
|
||||
if ((skl_idx >= 0) && (mPlib_Get_Item_DataPointerType(skl_idx) != 0)) {
|
||||
if ((skl_idx >= 0) && (mPlib_Get_Item_DataPointerType(skl_idx) != mPlayer_ITEM_DATA_TYPE_GFX)) {
|
||||
cKF_Skeleton_R_c* skeleton;
|
||||
cKF_SkeletonInfo_R_c* keyf;
|
||||
s_xyz* joint_work;
|
||||
@@ -168,7 +237,7 @@ static void Player_actor_Item_Set_Command_forUki(ACTOR* actor, int command) {
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) {
|
||||
static void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int main_index) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p;
|
||||
|
||||
@@ -177,10 +246,10 @@ static void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) {
|
||||
xyz_t pos;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
switch (arg0) {
|
||||
case 0x35:
|
||||
case 0x36:
|
||||
case 0x37:
|
||||
switch (main_index) {
|
||||
case mPlayer_INDEX_COLLECT_ROD:
|
||||
case mPlayer_INDEX_VIB_ROD:
|
||||
case mPlayer_INDEX_FLY_ROD:
|
||||
pos = actor->world.position;
|
||||
rot = actor->shape_info.rotation.y;
|
||||
|
||||
@@ -200,7 +269,7 @@ static void Player_actor_Item_Set_RightHandPos_forUki(ACTOR* actor, int arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) {
|
||||
static void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int main_index) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
UKI_ACTOR* rod = (UKI_ACTOR*)player->fishing_rod_actor_p;
|
||||
|
||||
@@ -209,10 +278,10 @@ static void Player_actor_Item_Set_LeftHandPos_forUki(ACTOR* actor, int arg0) {
|
||||
xyz_t pos;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
switch (arg0) {
|
||||
case 0x35:
|
||||
case 0x36:
|
||||
case 0x37:
|
||||
switch (main_index) {
|
||||
case mPlayer_INDEX_COLLECT_ROD:
|
||||
case mPlayer_INDEX_VIB_ROD:
|
||||
case mPlayer_INDEX_FLY_ROD:
|
||||
pos = actor->world.position;
|
||||
rot = actor->shape_info.rotation.y;
|
||||
|
||||
@@ -249,11 +318,11 @@ static void Player_actor_Item_Set_AngleSpeedY_forUki(ACTOR* actor) {
|
||||
int y = player->shape_angle_delta.y;
|
||||
|
||||
if (y > 0) {
|
||||
if (y > 0x8000) {
|
||||
y = -(0x10000 - y);
|
||||
if (y > DEG2SHORT_ANGLE2(180.0f)) {
|
||||
y = -(DEG2SHORT_ANGLE2(360.0f) - y);
|
||||
}
|
||||
} else if (y < -0x8000) {
|
||||
y += 0x10000;
|
||||
} else if (y < DEG2SHORT_ANGLE2(-180.0f)) {
|
||||
y += DEG2SHORT_ANGLE2(360.0f);
|
||||
}
|
||||
|
||||
rod->angle_speed_y = y;
|
||||
@@ -286,20 +355,22 @@ static void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_id
|
||||
|
||||
if (!umbrella) {
|
||||
if (player->umbrella_actor != NULL && Common_Get(clip).tools_clip != NULL) {
|
||||
Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor, 3);
|
||||
Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor,
|
||||
aTOL_ACTION_DESTRUCT);
|
||||
player->umbrella_actor = NULL;
|
||||
}
|
||||
|
||||
player->umbrella_state = 4;
|
||||
player->umbrella_state = aTOL_ACTION_S_TAKEOUT;
|
||||
} else {
|
||||
TOOLS_ACTOR* tool = (TOOLS_ACTOR*)player->umbrella_actor;
|
||||
if (tool != NULL && (kind - mPlayer_ITEM_KIND_UMBRELLA00) != tool->tool_name) {
|
||||
if (Common_Get(clip).tools_clip != NULL) {
|
||||
Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor, 3);
|
||||
Common_Get(clip).tools_clip->aTOL_chg_request_mode_proc(actor, player->umbrella_actor,
|
||||
aTOL_ACTION_DESTRUCT);
|
||||
player->umbrella_actor = NULL;
|
||||
}
|
||||
|
||||
player->umbrella_state = 4;
|
||||
player->umbrella_state = aTOL_ACTION_S_TAKEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +388,7 @@ static void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label;
|
||||
|
||||
if (label != NULL && player->item_net_catch_type == 0) {
|
||||
if (label != NULL && player->item_net_catch_type == mPlayer_NET_CATCH_TYPE_INSECT) {
|
||||
Matrix_push();
|
||||
Matrix_translate(pos->x, pos->y, pos->z, FALSE);
|
||||
Matrix_get(&label->matrix_work);
|
||||
|
||||
@@ -188,14 +188,9 @@ static void Player_actor_Item_net_CulcJointAngle_dummy_net(ACTOR* actor) {
|
||||
|
||||
};
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
int valid = FALSE;
|
||||
int index = player->now_main_index;
|
||||
|
||||
if (mPlayer_MAIN_INDEX_VALID(index)) {
|
||||
valid = TRUE;
|
||||
}
|
||||
|
||||
if (valid == FALSE || proc[index] == NULL) {
|
||||
if (mPlayer_MAIN_INDEX_VALID(index) == FALSE || proc[index] == NULL) {
|
||||
return;
|
||||
} else {
|
||||
proc[index](actor);
|
||||
|
||||
@@ -78,13 +78,13 @@ static int Player_actor_Item_Check_Status_forUki_cast(ACTOR* actor) {
|
||||
|
||||
if (rod != NULL) {
|
||||
switch (rod->status) {
|
||||
case 4:
|
||||
case 5:
|
||||
return 1;
|
||||
case aUKI_STATUS_FLOAT:
|
||||
case aUKI_STATUS_VIB:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int Player_actor_Item_main_rod_cast(ACTOR* actor, GAME* game) {
|
||||
@@ -124,7 +124,7 @@ static void Player_actor_Item_SetFrame_forUki_relax(ACTOR* actor, GAME* game) {
|
||||
f32 frame = player->item_keyframe.frame_control.current_frame;
|
||||
f32 target;
|
||||
xyz_t pos;
|
||||
if (rod->status != 3) {
|
||||
if (rod->status != aUKI_STATUS_CAST) {
|
||||
f32 end_pos = 2.0f + (61.5f + actor->world.position.y);
|
||||
|
||||
Player_actor_Get_ItemRodVirtualTopPos(actor, &pos);
|
||||
|
||||
+2
-2
@@ -3360,7 +3360,7 @@ extern mPlayer_Controller_Data_c* mPlib_Get_controller_data_for_title_demo_p(voi
|
||||
|
||||
extern void mPlib_Clear_controller_data_for_title_demo(void) {
|
||||
bzero(&controller_data_for_title_demo, sizeof(controller_data_for_title_demo));
|
||||
controller_data_for_title_demo.equiped_item = ITM_PAPER_START; /* @BUG - this should be a tool, not paper */
|
||||
controller_data_for_title_demo.equipped_item = ITM_PAPER_START; /* @BUG - this should be a tool, not paper */
|
||||
}
|
||||
|
||||
extern void mPlib_SetData1_controller_data_for_title_demo(int btn_a, int btn_b, f32 stick_x, f32 stick_y) {
|
||||
@@ -3382,7 +3382,7 @@ extern void mPlib_SetData1_controller_data_for_title_demo(int btn_a, int btn_b,
|
||||
}
|
||||
|
||||
extern void mPlib_SetData2_controller_data_for_title_demo(mActor_name_t item) {
|
||||
controller_data_for_title_demo.equiped_item = item;
|
||||
controller_data_for_title_demo.equipped_item = item;
|
||||
}
|
||||
|
||||
extern int mPlib_Check_CorrectPlayerPos_forEvent(void) {
|
||||
|
||||
@@ -14,7 +14,7 @@ static void Player_actor_setup_main_Dma(ACTOR* actorx, GAME* game) {
|
||||
static void Player_actor_request_proc_index_fromDma(ACTOR* actorx, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
Object_Exchange_c* exchange = &play->object_exchange;
|
||||
int bank_idx = mSc_bank_regist_check(exchange, 14);
|
||||
int bank_idx = mSc_bank_regist_check(exchange, ACTOR_OBJ_BANK_14);
|
||||
PLAYER_ACTOR* actor = (PLAYER_ACTOR*)actorx;
|
||||
int i;
|
||||
cKF_SkeletonInfo_R_c* keyf;
|
||||
|
||||
@@ -33,7 +33,7 @@ static void Player_actor_setup_main_Door(ACTOR* actor, GAME* game) {
|
||||
player->requested_main_index_data.door.angle_y, 9.0f, keyf, 5);
|
||||
Player_actor_InitAnimation_Base2(actor, game, anim_idx, anim_idx, 1.0f, 1.0f, 0.5f, -9.0f, 0, 0);
|
||||
Player_actor_setup_main_Base(actor, game);
|
||||
mBGMPsComp_scene_mode(0xC);
|
||||
mBGMPsComp_scene_mode(12);
|
||||
}
|
||||
|
||||
static int Player_actor_CulcAnimation_Door(ACTOR* actor, f32* frame_calc) {
|
||||
@@ -45,7 +45,7 @@ static void Player_actor_Movement_Door(ACTOR* actor) {
|
||||
|
||||
cKF_SkeletonInfo_R_AnimationMove_base(&actor->world.position, &actor->shape_info.rotation.y, &actor->scale,
|
||||
actor->world.angle.y, &player->keyframe0);
|
||||
Player_actor_Movement_Base_Stop(actor, 0);
|
||||
Player_actor_Movement_Base_Stop(actor, FALSE);
|
||||
Player_actor_Set_force_shadow_position_fromWorldPosition(actor);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ static void Player_actor_setup_main_Takeout_item(ACTOR* actorx, GAME* game) {
|
||||
if (mPlayer_ITEM_IS_UMBRELLA(item_kind) != FALSE) {
|
||||
ACTOR* umbrella_p;
|
||||
|
||||
player->umbrella_state = 1;
|
||||
player->umbrella_state = aTOL_ACTION_TAKEOUT;
|
||||
umbrella_p = Player_actor_Get_umbrella_p(actorx, game);
|
||||
Player_actor_InitAnimation_Base2(actorx, game, mPlayer_ANIM_UMB_OPEN1, mPlayer_ANIM_UMB_OPEN1, 1.0f, 1.0f, 0.5f,
|
||||
-5.0f, cKF_FRAMECONTROL_STOP, mPlayer_PART_TABLE_NORMAL);
|
||||
|
||||
Reference in New Issue
Block a user