mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-07 20:11:51 -04:00
Finish most of work on Aus game code, only need to set up f_furniture
This commit is contained in:
+7
-7
@@ -1069,7 +1069,7 @@ config.libs = [
|
||||
Object(Matching, "actor/ac_museum_picture.c"),
|
||||
Object(Matching, "actor/ac_my_house.c"),
|
||||
Object(Matching, "actor/ac_my_indoor.c"),
|
||||
Object(Matching, "actor/ac_my_room.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "actor/ac_my_room.c"),
|
||||
Object(Matching, "actor/ac_nameplate.c"),
|
||||
Object(Matching, "actor/ac_needlework_indoor.c"),
|
||||
Object(Matching, "actor/ac_needlework_shop.c"),
|
||||
@@ -1121,7 +1121,7 @@ config.libs = [
|
||||
Object(Matching, "actor/ac_tunahiki_control.c"),
|
||||
Object(Matching, "actor/ac_turi.c"),
|
||||
Object(Matching, "actor/ac_uki.c"),
|
||||
Object(Matching, "actor/ac_weather.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "actor/ac_weather.c"),
|
||||
Object(Matching, "actor/ac_weather_fine.c"),
|
||||
Object(Matching, "actor/ac_weather_leaf.c"),
|
||||
Object(Matching, "actor/ac_weather_rain.c"),
|
||||
@@ -1165,7 +1165,7 @@ config.libs = [
|
||||
Object(Matching, "actor/npc/ac_npc_mamedanuki.c"),
|
||||
Object(Matching, "actor/npc/ac_npc_mask_cat.c"),
|
||||
Object(Matching, "actor/npc/ac_npc_mask_cat2.c"),
|
||||
Object(Matching, "actor/npc/ac_npc_needlework.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "actor/npc/ac_npc_needlework.c"),
|
||||
Object(Matching, "actor/npc/ac_npc_p_sel.c"),
|
||||
Object(Matching, "actor/npc/ac_npc_p_sel2.c"),
|
||||
Object(Matching, "actor/npc/ac_npc_police.c"),
|
||||
@@ -1258,12 +1258,12 @@ config.libs = [
|
||||
Rel(
|
||||
"bg_item",
|
||||
[
|
||||
Object(Matching, "bg_item/bg_cherry_item.c"),
|
||||
Object(Matching, "bg_item/bg_item.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "bg_item/bg_cherry_item.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "bg_item/bg_item.c"),
|
||||
Object(Matching, "bg_item/bg_police_item.c"),
|
||||
Object(Matching, "bg_item/bg_post_item.c"),
|
||||
Object(Matching, "bg_item/bg_winter_item.c"),
|
||||
Object(Matching, "bg_item/bg_xmas_item.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "bg_item/bg_winter_item.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "bg_item/bg_xmas_item.c"),
|
||||
],
|
||||
),
|
||||
Rel(
|
||||
|
||||
@@ -48,8 +48,8 @@ struct balloon_actor_s {
|
||||
};
|
||||
|
||||
extern void Ac_Balloon_request_hide(ACTOR* actorx, GAME* game);
|
||||
extern void Ac_Balloon_request_fly(ACTOR* actorx, GAME* game, int balloon_type, s_xyz* angle_p, s16 lean, xyz_t* pos_p,
|
||||
f32 start_frame, f32 speed);
|
||||
extern void Ac_Balloon_request_fly(ACTOR* actorx, GAME* game, int balloon_type, const s_xyz* angle_p, s16 lean,
|
||||
const xyz_t* pos_p, f32 start_frame, f32 speed);
|
||||
|
||||
extern ACTOR_PROFILE Balloon_Profile;
|
||||
|
||||
|
||||
@@ -13,8 +13,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Aus version increased program size by 0x04 bytes
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
#define aBTD_LOADER_SIZE 0xC83C
|
||||
#define aBTD_PROGRAM_SIZE 0x15248
|
||||
#else
|
||||
#define aBTD_LOADER_SIZE 0xC83C
|
||||
#define aBTD_PROGRAM_SIZE 0x15244
|
||||
#endif
|
||||
|
||||
enum {
|
||||
aBTD_ACTION_SENDO_BIRTH_WAIT,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "m_debug_mode.h"
|
||||
#include "m_rcp.h"
|
||||
#include "ac_gyoei.h"
|
||||
#include "sys_math.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef int (*aMR_JUDGE_BREED_NEW_FTR_PROC)(GAME* game, u16 ftr_no, int* ut_x, i
|
||||
typedef mActor_name_t (*aMR_SEARCH_PICKUP_FURNITURE_PROC)(GAME* game);
|
||||
typedef void (*aMR_FURNITURE2ITEMBAG_PROC)(GAME* game);
|
||||
typedef int (*aMR_JUDGE_PLAYER_ACTION_PROC)(xyz_t* wpos0, xyz_t* wpos1, int ftr_actor_idx);
|
||||
typedef void (*aMR_PLAYER_MOVE_FURNITURE_PROC)(int ftr_actor_idx, xyz_t* wpos);
|
||||
typedef void (*aMR_PLAYER_MOVE_FURNITURE_PROC)(int ftr_actor_idx, const xyz_t* wpos);
|
||||
typedef int (*aMR_FTR_ID_2_WPOS_PROC)(xyz_t* wpos, int ftr_id);
|
||||
typedef int (*aMR_UNIT_NUM_2_FTR_ITEMNO_FTRID_PROC)(mActor_name_t* ftr_item_no, int* ftr_id, int ut_x, int ut_z,
|
||||
int layer);
|
||||
|
||||
@@ -820,6 +820,9 @@ typedef struct npc_speed_s {
|
||||
enum {
|
||||
aNPC_MOVE_RANGE_TYPE_BLOCK,
|
||||
aNPC_MOVE_RANGE_TYPE_CIRCLE,
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
aNPC_MOVE_RANGE_TYPE_SQUARE,
|
||||
#endif
|
||||
|
||||
aNPC_MOVE_RANGE_TYPE_NUM
|
||||
};
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ extern "C" {
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern u32 __float_max[];
|
||||
#define FLT_MAX *(float*)__float_max;
|
||||
#define FLT_MAX (*(float*)__float_max)
|
||||
#else
|
||||
#define FLT_MAX (3.4028235e+38f)
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
#define VER_GAFE01_00 0
|
||||
#define VER_GAFU01_00 1
|
||||
|
||||
// TODO: add PAL version to this check
|
||||
// Adjusts values based on regional frame rate (Hz)
|
||||
#if VERSION == VER_GAFU01_00
|
||||
#define FRAMERATE_ADJ(n) (((n) * 60) / 50) // less frames so more value
|
||||
#define FRAMERATE_TIMER(n) (((n) * 50) / 60) // less frames so less timer
|
||||
#define FRAMERATE_SELECT(f60, f50) (f50)
|
||||
#else
|
||||
#define FRAMERATE_ADJ(n) (n)
|
||||
#define FRAMERATE_TIMER(n) (n)
|
||||
#define FRAMERATE_SELECT(f60, f50) (f60)
|
||||
#endif
|
||||
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed long s32;
|
||||
|
||||
@@ -41,8 +41,8 @@ static void Ac_Balloon_main_hide(ACTOR* actorx, GAME* game) {
|
||||
Ac_Balloon_Movement_hide(actorx, game);
|
||||
}
|
||||
|
||||
extern void Ac_Balloon_request_fly(ACTOR* actorx, GAME* game, int balloon_type, s_xyz* angle_p, s16 lean, xyz_t* pos_p,
|
||||
f32 start_frame, f32 speed) {
|
||||
extern void Ac_Balloon_request_fly(ACTOR* actorx, GAME* game, int balloon_type, const s_xyz* angle_p, s16 lean,
|
||||
const xyz_t* pos_p, f32 start_frame, f32 speed) {
|
||||
BALLOON_ACTOR* balloon = (BALLOON_ACTOR*)actorx;
|
||||
|
||||
balloon->setup_mode = Ac_Balloon_MODE_FLY;
|
||||
|
||||
+10
-8
@@ -61,7 +61,7 @@ static void aBEE_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
}
|
||||
|
||||
static f32 aBEE_calc_scale_sub(f32* scale_p, f32 target, f32 frac, f32 max_step) {
|
||||
return add_calc(scale_p, target, 1.0f - sqrtf(1.0f - frac), max_step * 0.5f, 0.0f);
|
||||
return add_calc(scale_p, target, CALC_EASE(frac), max_step * 0.5f, 0.0f);
|
||||
}
|
||||
|
||||
static void aBEE_calc_scale(BEE_ACTOR* bee, f32 frac, f32 max_step) {
|
||||
@@ -85,6 +85,7 @@ static void aBEE_fly_move_common(BEE_ACTOR* bee, GAME* game) {
|
||||
f32 speed;
|
||||
f32 angle = fabsf(90.0f - bee->start_frame) * 7.5f;
|
||||
int speed_angle;
|
||||
s16 d_angle;
|
||||
s16 abs_speed_angle;
|
||||
f32 target_frame;
|
||||
f32 diff;
|
||||
@@ -99,8 +100,9 @@ static void aBEE_fly_move_common(BEE_ACTOR* bee, GAME* game) {
|
||||
break;
|
||||
}
|
||||
|
||||
add_calc_short_angle2(&bee->add_angle, bee->base_angle - (s16)angle, 1.0f - sqrtf(0.6f), 250, 0);
|
||||
add_calc_short_angle2(&bee->actor_class.world.angle.y, bee->actor_class.player_angle_y, 1.0f - sqrtf(0.6f), bee->add_angle >> 1, 0);
|
||||
d_angle = bee->base_angle - (s16)angle;
|
||||
add_calc_short_angle2(&bee->add_angle, d_angle, CALC_EASE(0.4f), 250, 0);
|
||||
add_calc_short_angle2(&bee->actor_class.world.angle.y, bee->actor_class.player_angle_y, CALC_EASE(0.4f), bee->add_angle >> 1, 0);
|
||||
bee->actor_class.shape_info.rotation.y = bee->actor_class.world.angle.y;
|
||||
speed_angle = (int)(bee->actor_class.world.angle.y - bee->actor_class.player_angle_y);
|
||||
abs_speed_angle = ABS((s16)speed_angle);
|
||||
@@ -110,7 +112,7 @@ static void aBEE_fly_move_common(BEE_ACTOR* bee, GAME* game) {
|
||||
|
||||
bee->speed = 2.9f;
|
||||
bee->speed += fabsf((f32)((DEG2SHORT_ANGLE2(180.0f) - abs_speed_angle) / DEG2SHORT_ANGLE2(30.0f)));
|
||||
add_calc(&bee->actor_class.speed, bee->speed, 1.0f - sqrtf(0.7f), 0.15f, 0.0f);
|
||||
add_calc(&bee->actor_class.speed, bee->speed, CALC_EASE(0.3f), 0.15f, 0.0f);
|
||||
|
||||
bee->bobbing_counter += 0x900;
|
||||
if (player != NULL) {
|
||||
@@ -124,7 +126,7 @@ static void aBEE_fly_move_common(BEE_ACTOR* bee, GAME* game) {
|
||||
} else if (target_frame > 180.0f) {
|
||||
target_frame = 180.0f;
|
||||
}
|
||||
add_calc(&bee->start_frame, target_frame, 1.0f - sqrtf(0.5f), 5.0f, 0.0f);
|
||||
add_calc(&bee->start_frame, target_frame, CALC_EASE(0.5f), 5.0f, 0.0f);
|
||||
|
||||
diff = fabsf(90.0f - bee->start_frame);
|
||||
bee->size.x = (0.75f + diff / 360.0f) * 0.01f;
|
||||
@@ -134,8 +136,8 @@ static void aBEE_fly_move_common(BEE_ACTOR* bee, GAME* game) {
|
||||
}
|
||||
|
||||
static void aBEE_calc_fly_angle(ACTOR* actorx) {
|
||||
add_calc_short_angle2(&actorx->shape_info.rotation.z, 0, 1.0f - sqrtf(0.7f), 1000, 0);
|
||||
add_calc_short_angle2(&actorx->shape_info.rotation.x, 0, 1.0f - sqrtf(0.7f), 1000, 0);
|
||||
add_calc_short_angle2(&actorx->shape_info.rotation.z, 0, CALC_EASE(0.3f), 1000, 0);
|
||||
add_calc_short_angle2(&actorx->shape_info.rotation.x, 0, CALC_EASE(0.3f), 1000, 0);
|
||||
}
|
||||
|
||||
static void aBEE_appear(ACTOR* actorx, GAME* game) {
|
||||
@@ -354,7 +356,7 @@ static void aBEE_actor_move(ACTOR* actorx, GAME* game) {
|
||||
|
||||
(*bee->action_proc)(actorx, game);
|
||||
aBEE_anime_proc(bee);
|
||||
add_calc(&actorx->world.position.y, bee->pos_y, 1.0f - sqrtf(0.7f), 1.5f, 0.0f);
|
||||
add_calc(&actorx->world.position.y, bee->pos_y, CALC_EASE(0.3f), 1.5f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+161
-156
@@ -8,31 +8,33 @@
|
||||
#include "libultra/libultra.h"
|
||||
#include "sys_matrix.h"
|
||||
|
||||
enum {
|
||||
aBT_DIRECTION_TO_ISLAND,
|
||||
aBT_DIRECTION_FROM_ISLAND,
|
||||
#define aBT_FURROW_MAX_SPEED FRAMERATE_ADJ(0.625f)
|
||||
|
||||
aBT_DIRECTION_NUM
|
||||
enum {
|
||||
aBT_DIRECTION_TO_ISLAND,
|
||||
aBT_DIRECTION_FROM_ISLAND,
|
||||
|
||||
aBT_DIRECTION_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
aBT_ACTION_DEMO_CTRL_BIRTH_WAIT,
|
||||
aBT_ACTION_WAIT,
|
||||
aBT_ACTION_PL_RIDE_MOVE_START_WAIT,
|
||||
aBT_ACTION_PL_RIDE_MOVE_END_WAIT,
|
||||
aBT_ACTION_PL_RIDE_ON_START_WAIT,
|
||||
aBT_ACTION_PL_RIDE_ON_END_WAIT,
|
||||
aBT_ACTION_SITDOWN_END_WAIT,
|
||||
aBT_ACTION_MOVE_WAIT,
|
||||
aBT_ACTION_MOVE,
|
||||
aBT_ACTION_MOMENT,
|
||||
aBT_ACTION_DRAW_UP,
|
||||
aBT_ACTION_ARRIVE_CALL_END_WAIT,
|
||||
aBT_ACTION_PL_RIDE_OFF_START_WAIT,
|
||||
aBT_ACTION_PL_RIDE_OFF_END_WAIT,
|
||||
aBT_ACTION_ANCHOR,
|
||||
aBT_ACTION_DEMO_CTRL_BIRTH_WAIT,
|
||||
aBT_ACTION_WAIT,
|
||||
aBT_ACTION_PL_RIDE_MOVE_START_WAIT,
|
||||
aBT_ACTION_PL_RIDE_MOVE_END_WAIT,
|
||||
aBT_ACTION_PL_RIDE_ON_START_WAIT,
|
||||
aBT_ACTION_PL_RIDE_ON_END_WAIT,
|
||||
aBT_ACTION_SITDOWN_END_WAIT,
|
||||
aBT_ACTION_MOVE_WAIT,
|
||||
aBT_ACTION_MOVE,
|
||||
aBT_ACTION_MOMENT,
|
||||
aBT_ACTION_DRAW_UP,
|
||||
aBT_ACTION_ARRIVE_CALL_END_WAIT,
|
||||
aBT_ACTION_PL_RIDE_OFF_START_WAIT,
|
||||
aBT_ACTION_PL_RIDE_OFF_END_WAIT,
|
||||
aBT_ACTION_ANCHOR,
|
||||
|
||||
aBT_ACTION_NUM
|
||||
aBT_ACTION_NUM
|
||||
};
|
||||
|
||||
static void aBT_actor_ct(ACTOR*, GAME*);
|
||||
@@ -41,36 +43,36 @@ static void aBT_actor_init(ACTOR*, GAME*);
|
||||
static void aBT_actor_draw(ACTOR*, GAME*);
|
||||
|
||||
ACTOR_PROFILE Boat_Profile = {
|
||||
mAc_PROFILE_BOAT,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_TA_SET | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
BOAT,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(BOAT_ACTOR),
|
||||
&aBT_actor_ct,
|
||||
&aBT_actor_dt,
|
||||
&aBT_actor_init,
|
||||
&aBT_actor_draw,
|
||||
NULL
|
||||
mAc_PROFILE_BOAT,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_TA_SET | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
BOAT,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(BOAT_ACTOR),
|
||||
&aBT_actor_ct,
|
||||
&aBT_actor_dt,
|
||||
&aBT_actor_init,
|
||||
&aBT_actor_draw,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static xyz_t aBT_chk_point[] = {
|
||||
// Position Z-X X Z
|
||||
{ 3420.0f, 0.0f, 4260.0f }, // F-5 unit 5.5 - 10.5
|
||||
{ 3380.0f, 0.0f, 4300.0f }, // F-5 unit 4.5 - 11.5
|
||||
{ 3340.0f, 0.0f, 4380.0f }, // F-5 unit 3.5 - 13.5
|
||||
{ 3340.0f, 0.0f, 4620.0f }, // G-5 unit 3.5 - 3.5
|
||||
{ 3740.0f, 0.0f, 4980.0f }, // G-5 unit 13.5 - 12.5
|
||||
{ 3740.0f, 0.0f, 5220.0f }, // H-5 unit 13.5 - 2.5
|
||||
{ 3700.0f, 0.0f, 5300.0f }, // H-5 unit 12.5 - 4.5
|
||||
{ 3660.0f, 0.0f, 5340.0f } // H-5 unit 11.5 - 5.5
|
||||
// Position Z-X X Z
|
||||
{ 3420.0f, 0.0f, 4260.0f }, // F-5 unit 5.5 - 10.5
|
||||
{ 3380.0f, 0.0f, 4300.0f }, // F-5 unit 4.5 - 11.5
|
||||
{ 3340.0f, 0.0f, 4380.0f }, // F-5 unit 3.5 - 13.5
|
||||
{ 3340.0f, 0.0f, 4620.0f }, // G-5 unit 3.5 - 3.5
|
||||
{ 3740.0f, 0.0f, 4980.0f }, // G-5 unit 13.5 - 12.5
|
||||
{ 3740.0f, 0.0f, 5220.0f }, // H-5 unit 13.5 - 2.5
|
||||
{ 3700.0f, 0.0f, 5300.0f }, // H-5 unit 12.5 - 4.5
|
||||
{ 3660.0f, 0.0f, 5340.0f }, // H-5 unit 11.5 - 5.5
|
||||
};
|
||||
|
||||
static int aBT_last_point_idx[aBT_DIRECTION_NUM] = { 7, 0 };
|
||||
|
||||
s16 aBT_init_angleY[aBT_DIRECTION_NUM] = {
|
||||
DEG2SHORT_ANGLE(-45.0f), // 0xE000
|
||||
DEG2SHORT_ANGLE(135.0f) // 0x6000
|
||||
DEG2SHORT_ANGLE(-45.0f), // 0xE000
|
||||
DEG2SHORT_ANGLE(135.0f), // 0x6000
|
||||
};
|
||||
|
||||
static void aBT_setupAction(BOAT_ACTOR* boat_actor, GAME_PLAY* play, int action);
|
||||
@@ -80,143 +82,146 @@ extern cKF_Skeleton_R_c cKF_bs_r_obj_e_boat;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_e_boat;
|
||||
|
||||
static void aBT_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
|
||||
if (aBT_check_other_boat(actorx, game) == TRUE) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &boat_actor->keyframe;
|
||||
int direction = aBT_DIRECTION_TO_ISLAND;
|
||||
|
||||
if (actorx->block_z != 6) {
|
||||
direction = aBT_DIRECTION_FROM_ISLAND;
|
||||
if (aBT_check_other_boat(actorx, game) == TRUE) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &boat_actor->keyframe;
|
||||
int direction = aBT_DIRECTION_TO_ISLAND;
|
||||
|
||||
if (actorx->block_z != 6) {
|
||||
direction = aBT_DIRECTION_FROM_ISLAND;
|
||||
}
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
actorx->world.position.y = 1.0f + mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 333);
|
||||
#else
|
||||
actorx->world.position.y = 1.0f + mCoBG_GetWaterHeight_File(actorx->world.position, __FILE__, 326);
|
||||
#endif
|
||||
actorx->shape_info.rotation.y = aBT_init_angleY[direction];
|
||||
actorx->world.angle.y = aBT_init_angleY[direction];
|
||||
xyz_t_move(&actorx->home.position, &actorx->world.position);
|
||||
|
||||
/* Load & play boat rocking animation */
|
||||
cKF_SkeletonInfo_R_ct(keyframe, &cKF_bs_r_obj_e_boat, NULL, boat_actor->work, boat_actor->morph);
|
||||
cKF_SkeletonInfo_R_init(keyframe, keyframe->skeleton, &cKF_ba_r_obj_e_boat, 1.0f, 81.0f, 1.0f, 0.0f, 0.0f,
|
||||
cKF_FRAMECONTROL_REPEAT, NULL);
|
||||
cKF_SkeletonInfo_R_play(keyframe);
|
||||
|
||||
actorx->gravity = 0.003f;
|
||||
actorx->max_velocity_y = 0.1f;
|
||||
actorx->position_speed.y = 0.1f;
|
||||
boat_actor->roll_timer = 200;
|
||||
boat_actor->direction = direction;
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_DEMO_CTRL_BIRTH_WAIT);
|
||||
mCoBG_MakeBoatCollision(actorx, &actorx->world.position, &actorx->shape_info.rotation.y);
|
||||
} else {
|
||||
Actor_delete(actorx); // another boat already exists
|
||||
}
|
||||
|
||||
#line 326
|
||||
actorx->world.position.y = 1.0f + mCoBG_GetWaterHeight(actorx->world.position);
|
||||
actorx->shape_info.rotation.y = aBT_init_angleY[direction];
|
||||
actorx->world.angle.y = aBT_init_angleY[direction];
|
||||
xyz_t_move(&actorx->home.position, &actorx->world.position);
|
||||
|
||||
/* Load & play boat rocking animation */
|
||||
cKF_SkeletonInfo_R_ct(keyframe, &cKF_bs_r_obj_e_boat, NULL, boat_actor->work, boat_actor->morph);
|
||||
cKF_SkeletonInfo_R_init(keyframe, keyframe->skeleton, &cKF_ba_r_obj_e_boat, 1.0f, 81.0f, 1.0f, 0.0f, 0.0f, cKF_FRAMECONTROL_REPEAT, NULL);
|
||||
cKF_SkeletonInfo_R_play(keyframe);
|
||||
|
||||
actorx->gravity = 0.003f;
|
||||
actorx->max_velocity_y = 0.1f;
|
||||
actorx->position_speed.y = 0.1f;
|
||||
boat_actor->roll_timer = 200;
|
||||
boat_actor->direction = direction;
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_DEMO_CTRL_BIRTH_WAIT);
|
||||
mCoBG_MakeBoatCollision(actorx, &actorx->world.position, &actorx->shape_info.rotation.y);
|
||||
}
|
||||
else {
|
||||
Actor_delete(actorx); // another boat already exists
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &boat_actor->keyframe;
|
||||
BOAT_DEMO_ACTOR* boat_demo;
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &boat_actor->keyframe;
|
||||
BOAT_DEMO_ACTOR* boat_demo;
|
||||
|
||||
cKF_SkeletonInfo_R_dt(keyframe);
|
||||
mFI_SetFG_common(BOAT, actorx->home.position, FALSE);
|
||||
cKF_SkeletonInfo_R_dt(keyframe);
|
||||
mFI_SetFG_common(BOAT, actorx->home.position, FALSE);
|
||||
|
||||
boat_demo = (BOAT_DEMO_ACTOR*)actorx->parent_actor;
|
||||
if (boat_demo != NULL && boat_demo->boat_actor == boat_actor) {
|
||||
boat_demo->boat_actor = NULL;
|
||||
}
|
||||
boat_demo = (BOAT_DEMO_ACTOR*)actorx->parent_actor;
|
||||
if (boat_demo != NULL && boat_demo->boat_actor == boat_actor) {
|
||||
boat_demo->boat_actor = NULL;
|
||||
}
|
||||
|
||||
mCoBG_DeleteBoatCollision(actorx);
|
||||
mCoBG_DeleteBoatCollision(actorx);
|
||||
}
|
||||
|
||||
#include "../src/actor/ac_boat_move.c_inc"
|
||||
|
||||
static u32 aBT_calc_furrow_alpha(BOAT_ACTOR* boat_actor) {
|
||||
f32 speed = boat_actor->actor_class.speed;
|
||||
f32 speed = boat_actor->actor_class.speed;
|
||||
|
||||
if (speed > 0.625f) {
|
||||
speed = 0.625f;
|
||||
}
|
||||
if (speed > aBT_FURROW_MAX_SPEED) {
|
||||
speed = aBT_FURROW_MAX_SPEED;
|
||||
}
|
||||
|
||||
return (u32)((speed / 0.625f) * 150.0f);
|
||||
return (u32)((speed / aBT_FURROW_MAX_SPEED) * 150.0f);
|
||||
}
|
||||
|
||||
static int aBT_actor_draw_before(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape, u8* joint_flags, void* arg, s_xyz* joint_rot, xyz_t* joint_pos) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)arg;
|
||||
static int aBT_actor_draw_before(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape,
|
||||
u8* joint_flags, void* arg, s_xyz* joint_rot, xyz_t* joint_pos) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)arg;
|
||||
|
||||
switch (joint_idx) {
|
||||
case 3:
|
||||
{
|
||||
Matrix_translate(boat_actor->actor_class.world.position.x, boat_actor->actor_class.world.position.y, boat_actor->actor_class.world.position.z, MTX_LOAD);
|
||||
Matrix_RotateY(boat_actor->actor_class.shape_info.rotation.y, MTX_MULT);
|
||||
Matrix_scale(boat_actor->actor_class.scale.x, boat_actor->actor_class.scale.y, boat_actor->actor_class.scale.z, MTX_MULT);
|
||||
break;
|
||||
switch (joint_idx) {
|
||||
case 3: {
|
||||
Matrix_translate(boat_actor->actor_class.world.position.x, boat_actor->actor_class.world.position.y,
|
||||
boat_actor->actor_class.world.position.z, MTX_LOAD);
|
||||
Matrix_RotateY(boat_actor->actor_class.shape_info.rotation.y, MTX_MULT);
|
||||
Matrix_scale(boat_actor->actor_class.scale.x, boat_actor->actor_class.scale.y,
|
||||
boat_actor->actor_class.scale.z, MTX_MULT);
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: {
|
||||
joint_rot->x = 0;
|
||||
joint_rot->y = 0;
|
||||
joint_rot->z = boat_actor->_2CC; // boat furrow joint?
|
||||
break;
|
||||
}
|
||||
|
||||
case 6: {
|
||||
joint_rot->x = 0;
|
||||
joint_rot->y = 0;
|
||||
joint_rot->z = boat_actor->_2D0; // boat furrow joint?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case 5:
|
||||
{
|
||||
joint_rot->x = 0;
|
||||
joint_rot->y = 0;
|
||||
joint_rot->z = boat_actor->_2CC; // boat furrow joint?
|
||||
break;
|
||||
}
|
||||
|
||||
case 6:
|
||||
{
|
||||
joint_rot->x = 0;
|
||||
joint_rot->y = 0;
|
||||
joint_rot->z = boat_actor->_2D0; // boat furrow joint?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void aBT_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &boat_actor->keyframe;
|
||||
GRAPH* graph = game->graph;
|
||||
Gfx* scroll_gfx;
|
||||
f32 _2C8 = boat_actor->_2C8 - actorx->speed * 0.5f;
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &boat_actor->keyframe;
|
||||
GRAPH* graph = game->graph;
|
||||
Gfx* scroll_gfx;
|
||||
f32 _2C8 = boat_actor->_2C8 - actorx->speed * 0.5f;
|
||||
|
||||
while (_2C8 < -32.0f) {
|
||||
_2C8 += 32.0f;
|
||||
}
|
||||
|
||||
boat_actor->_2C8 = _2C8;
|
||||
scroll_gfx = two_tex_scroll_dolphin(graph, 0, 0, 0, 32, 32, 1, 0, _2C8 * 8.0f, 32, 32);
|
||||
|
||||
if (scroll_gfx != NULL) {
|
||||
Mtx* mtx = GRAPH_ALLOC_TYPE(graph, Mtx, keyframe->skeleton->num_shown_joints);
|
||||
|
||||
if (mtx != NULL) {
|
||||
Gfx* gfx;
|
||||
u16* pal = Common_Get(clip).structure_clip->get_pal_segment_proc(aSTR_PAL_BOAT);
|
||||
|
||||
_texture_z_light_fog_prim(graph);
|
||||
_texture_z_light_fog_prim_xlu(graph);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
gDPPipeSync(gfx++);
|
||||
gDPLoadTLUT_Dolphin(gfx++, 15, 16, 1, pal);
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
|
||||
gfx = NOW_POLY_XLU_DISP;
|
||||
gDPPipeSync(gfx++);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_9, scroll_gfx);
|
||||
gDPLoadTLUT_Dolphin(gfx++, 15, 16, 1, pal);
|
||||
gDPSetEnvColor(gfx++, 155, 155, 255, aBT_calc_furrow_alpha(boat_actor));
|
||||
SET_POLY_XLU_DISP(gfx);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
|
||||
cKF_Si3_draw_R_SV(game, keyframe, mtx, &aBT_actor_draw_before, NULL, actorx);
|
||||
while (_2C8 < -32.0f) {
|
||||
_2C8 += 32.0f;
|
||||
}
|
||||
|
||||
boat_actor->_2C8 = _2C8;
|
||||
scroll_gfx = two_tex_scroll_dolphin(graph, 0, 0, 0, 32, 32, 1, 0, _2C8 * 8.0f, 32, 32);
|
||||
|
||||
if (scroll_gfx != NULL) {
|
||||
Mtx* mtx = GRAPH_ALLOC_TYPE(graph, Mtx, keyframe->skeleton->num_shown_joints);
|
||||
|
||||
if (mtx != NULL) {
|
||||
Gfx* gfx;
|
||||
u16* pal = Common_Get(clip).structure_clip->get_pal_segment_proc(aSTR_PAL_BOAT);
|
||||
|
||||
_texture_z_light_fog_prim(graph);
|
||||
_texture_z_light_fog_prim_xlu(graph);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
gDPPipeSync(gfx++);
|
||||
gDPLoadTLUT_Dolphin(gfx++, 15, 16, 1, pal);
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
|
||||
gfx = NOW_POLY_XLU_DISP;
|
||||
gDPPipeSync(gfx++);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_9, scroll_gfx);
|
||||
gDPLoadTLUT_Dolphin(gfx++, 15, 16, 1, pal);
|
||||
gDPSetEnvColor(gfx++, 155, 155, 255, aBT_calc_furrow_alpha(boat_actor));
|
||||
SET_POLY_XLU_DISP(gfx);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
|
||||
cKF_Si3_draw_R_SV(game, keyframe, mtx, &aBT_actor_draw_before, NULL, actorx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+243
-289
@@ -1,433 +1,387 @@
|
||||
static int aBTD_check_sendo_and_boat(BOAT_DEMO_ACTOR* boat_demo) {
|
||||
int res = TRUE;
|
||||
int res = TRUE;
|
||||
|
||||
if (boat_demo->npc_sendo_actor == NULL) {
|
||||
if (boat_demo->boat_actor != NULL) {
|
||||
Actor_delete((ACTOR*)boat_demo->boat_actor);
|
||||
if (boat_demo->npc_sendo_actor == NULL) {
|
||||
if (boat_demo->boat_actor != NULL) {
|
||||
Actor_delete((ACTOR*)boat_demo->boat_actor);
|
||||
}
|
||||
|
||||
res = FALSE;
|
||||
}
|
||||
|
||||
res = FALSE;
|
||||
}
|
||||
if (boat_demo->boat_actor == NULL) {
|
||||
if (boat_demo->npc_sendo_actor != NULL) {
|
||||
Actor_delete((ACTOR*)boat_demo->npc_sendo_actor);
|
||||
}
|
||||
|
||||
if (boat_demo->boat_actor == NULL) {
|
||||
if (boat_demo->npc_sendo_actor != NULL) {
|
||||
Actor_delete((ACTOR*)boat_demo->npc_sendo_actor);
|
||||
res = FALSE;
|
||||
}
|
||||
|
||||
res = FALSE;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int aBTD_regist_island_npc_info() {
|
||||
Island_c* island = Save_GetPointer(island);
|
||||
Animal_c* animal = &island->animal;
|
||||
mNpc_NpcList_c* npclist = Common_Get(island_npclist);
|
||||
int res;
|
||||
Island_c* island = Save_GetPointer(island);
|
||||
Animal_c* animal = &island->animal;
|
||||
mNpc_NpcList_c* npclist = Common_Get(island_npclist);
|
||||
int res;
|
||||
|
||||
mNpc_SetNpcList(npclist, animal, mISL_ISLANDER_NUM, TRUE);
|
||||
mNpc_SetNpcList(npclist, animal, mISL_ISLANDER_NUM, TRUE);
|
||||
|
||||
res = mFI_RegistMoveActorList(
|
||||
npclist->name,
|
||||
animal->home_info.block_x, animal->home_info.block_z,
|
||||
animal->home_info.ut_x, animal->home_info.ut_z,
|
||||
-ANIMAL_NUM_MAX,
|
||||
0
|
||||
);
|
||||
res = mFI_RegistMoveActorList(npclist->name, animal->home_info.block_x, animal->home_info.block_z,
|
||||
animal->home_info.ut_x, animal->home_info.ut_z, -ANIMAL_NUM_MAX, 0);
|
||||
|
||||
if (res == TRUE) {
|
||||
mNPS_set_island_schedule_area(&animal->id);
|
||||
}
|
||||
if (res == TRUE) {
|
||||
mNPS_set_island_schedule_area(&animal->id);
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int aBTD_unregist_island_npc_info() {
|
||||
mNpc_NpcList_c* npclist = Common_Get(island_npclist);
|
||||
Island_c* island = Save_GetPointer(island);
|
||||
Animal_c* animal = &island->animal;
|
||||
int res = mFI_UnregistMoveActorList(
|
||||
npclist->name,
|
||||
animal->home_info.block_x,
|
||||
animal->home_info.block_z
|
||||
);
|
||||
mNpc_NpcList_c* npclist = Common_Get(island_npclist);
|
||||
Island_c* island = Save_GetPointer(island);
|
||||
Animal_c* animal = &island->animal;
|
||||
int res = mFI_UnregistMoveActorList(npclist->name, animal->home_info.block_x, animal->home_info.block_z);
|
||||
|
||||
if (res == TRUE) {
|
||||
mNPS_reset_schedule_area(&Save_Get(island).animal.id);
|
||||
mNpc_InitNpcList(npclist, mISL_ISLANDER_NUM);
|
||||
}
|
||||
if (res == TRUE) {
|
||||
mNPS_reset_schedule_area(&Save_Get(island).animal.id);
|
||||
mNpc_InitNpcList(npclist, mISL_ISLANDER_NUM);
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void aBTD_chg_regist_island_npc_info(BOAT_DEMO_ACTOR* boat_demo) {
|
||||
if (boat_demo->at_island == FALSE) {
|
||||
if (boat_demo->island_npc_info_registered == FALSE && aBTD_regist_island_npc_info() == TRUE) {
|
||||
boat_demo->island_npc_info_registered = TRUE;
|
||||
if (boat_demo->at_island == FALSE) {
|
||||
if (boat_demo->island_npc_info_registered == FALSE && aBTD_regist_island_npc_info() == TRUE) {
|
||||
boat_demo->island_npc_info_registered = TRUE;
|
||||
}
|
||||
} else {
|
||||
if (boat_demo->island_npc_info_registered == TRUE && aBTD_unregist_island_npc_info() == TRUE) {
|
||||
boat_demo->island_npc_info_registered = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (boat_demo->island_npc_info_registered == TRUE && aBTD_unregist_island_npc_info() == TRUE) {
|
||||
boat_demo->island_npc_info_registered = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_setup_castaway(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->action > aBTD_ACTION_PL_RIDE_ON_START_WAIT && boat_demo->action != aBTD_ACTION_ANCHOR_WAIT) {
|
||||
if (mEv_check_status(mEv_EVENT_DOZAEMON, mEv_STATUS_RUN) && (Common_Get(spnpc_first_talk_flags) & (1 << aNPC_SPNPC_BIT_DOZAEMON)) == 0) {
|
||||
mEv_dozaemon_c* dozaemon_ev = (mEv_dozaemon_c*)mEv_reserve_save_area(mEv_EVENT_DOZAEMON, 13); // Shouldn't this be mEv_get_save_area?
|
||||
if (boat_demo->action > aBTD_ACTION_PL_RIDE_ON_START_WAIT && boat_demo->action != aBTD_ACTION_ANCHOR_WAIT) {
|
||||
if (mEv_check_status(mEv_EVENT_DOZAEMON, mEv_STATUS_RUN) &&
|
||||
(Common_Get(spnpc_first_talk_flags) & (1 << aNPC_SPNPC_BIT_DOZAEMON)) == 0) {
|
||||
mEv_dozaemon_c* dozaemon_ev =
|
||||
(mEv_dozaemon_c*)mEv_reserve_save_area(mEv_EVENT_DOZAEMON, 13); // Shouldn't this be mEv_get_save_area?
|
||||
|
||||
if (
|
||||
(dozaemon_ev == NULL || (dozaemon_ev->flags & 1) == 0) &&
|
||||
Save_Get(event_save_common).dozaemon_completed != TRUE &&
|
||||
boat_demo->castaway_actor == NULL
|
||||
) {
|
||||
int setupActor = (*Common_Get(clip).npc_clip->setupActor_proc)(play, SP_NPC_CASTAWAY, -1, -1, -1, -1 , -1, 0, 0);
|
||||
if ((dozaemon_ev == NULL || (dozaemon_ev->flags & 1) == 0) &&
|
||||
Save_Get(event_save_common).dozaemon_completed != TRUE && boat_demo->castaway_actor == NULL) {
|
||||
int setupActor =
|
||||
(*Common_Get(clip).npc_clip->setupActor_proc)(play, SP_NPC_CASTAWAY, -1, -1, -1, -1, -1, 0, 0);
|
||||
|
||||
if (setupActor == TRUE) {
|
||||
EV_CASTAWAY_ACTOR* castaway = (EV_CASTAWAY_ACTOR*)Actor_info_fgName_search(&play->actor_info, SP_NPC_CASTAWAY, ACTOR_PART_NPC);
|
||||
if (setupActor == TRUE) {
|
||||
EV_CASTAWAY_ACTOR* castaway = (EV_CASTAWAY_ACTOR*)Actor_info_fgName_search(
|
||||
&play->actor_info, SP_NPC_CASTAWAY, ACTOR_PART_NPC);
|
||||
|
||||
if (castaway != NULL) {
|
||||
boat_demo->castaway_actor = castaway;
|
||||
}
|
||||
if (castaway != NULL) {
|
||||
boat_demo->castaway_actor = castaway;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_change_season(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->at_island == TRUE) {
|
||||
mFI_SetClimate(mFI_CLIMATE_0);
|
||||
mFM_returnSeason();
|
||||
aWeather_RequestChangeWeatherFromIsland();
|
||||
mNpc_ClearIslandPresentFtrInfo();
|
||||
mNpc_SetIslandGetLetter(FALSE);
|
||||
mNpc_SetIslandCheckFtrMsg(FALSE);
|
||||
}
|
||||
else {
|
||||
mFI_SetClimate(mFI_CLIMATE_ISLAND);
|
||||
mFM_toSummer();
|
||||
aWeather_RequestChangeWeatherToIsland();
|
||||
mISL_ChangeBG();
|
||||
mRmTp_DecideCottageDefaultLightSwitch();
|
||||
mSP_SelectRandomItemToAGB();
|
||||
mISL_ClearNowPlayerAction();
|
||||
mNpc_SetIslandPresentFtr();
|
||||
mNpc_SetIslandRoomFtr(&Save_Get(island).animal);
|
||||
mNpc_SetIslandGetLetter(FALSE);
|
||||
mNpc_SetIslandCheckFtrMsg(FALSE);
|
||||
}
|
||||
if (boat_demo->at_island == TRUE) {
|
||||
mFI_SetClimate(mFI_CLIMATE_0);
|
||||
mFM_returnSeason();
|
||||
aWeather_RequestChangeWeatherFromIsland();
|
||||
mNpc_ClearIslandPresentFtrInfo();
|
||||
mNpc_SetIslandGetLetter(FALSE);
|
||||
mNpc_SetIslandCheckFtrMsg(FALSE);
|
||||
} else {
|
||||
mFI_SetClimate(mFI_CLIMATE_ISLAND);
|
||||
mFM_toSummer();
|
||||
aWeather_RequestChangeWeatherToIsland();
|
||||
mISL_ChangeBG();
|
||||
mRmTp_DecideCottageDefaultLightSwitch();
|
||||
mSP_SelectRandomItemToAGB();
|
||||
mISL_ClearNowPlayerAction();
|
||||
mNpc_SetIslandPresentFtr();
|
||||
mNpc_SetIslandRoomFtr(&Save_Get(island).animal);
|
||||
mNpc_SetIslandGetLetter(FALSE);
|
||||
mNpc_SetIslandCheckFtrMsg(FALSE);
|
||||
}
|
||||
|
||||
mBI_change_bg_item(play);
|
||||
mBI_change_bg_item(play);
|
||||
}
|
||||
|
||||
static void aBTD_sendo_birth_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (Common_Get(clip).npc_clip != NULL && Common_Get(clip).npc_clip->setupActor_proc != NULL) {
|
||||
int sendo_birth = (*Common_Get(clip).npc_clip->setupActor_proc)(play, SP_NPC_SENDO, -1, -1, -1, -1, -1, 0, 0);
|
||||
if (Common_Get(clip).npc_clip != NULL && Common_Get(clip).npc_clip->setupActor_proc != NULL) {
|
||||
int sendo_birth = (*Common_Get(clip).npc_clip->setupActor_proc)(play, SP_NPC_SENDO, -1, -1, -1, -1, -1, 0, 0);
|
||||
|
||||
if (sendo_birth == TRUE) {
|
||||
NPC_SENDO_ACTOR* sendo_actor = (NPC_SENDO_ACTOR*)Actor_info_fgName_search(&play->actor_info, SP_NPC_SENDO, ACTOR_PART_NPC);
|
||||
if (sendo_birth == TRUE) {
|
||||
NPC_SENDO_ACTOR* sendo_actor =
|
||||
(NPC_SENDO_ACTOR*)Actor_info_fgName_search(&play->actor_info, SP_NPC_SENDO, ACTOR_PART_NPC);
|
||||
|
||||
if (sendo_actor != NULL) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)Actor_info_fgName_search(&play->actor_info, BOAT, ACTOR_PART_ITEM);
|
||||
if (sendo_actor != NULL) {
|
||||
BOAT_ACTOR* boat_actor =
|
||||
(BOAT_ACTOR*)Actor_info_fgName_search(&play->actor_info, BOAT, ACTOR_PART_ITEM);
|
||||
|
||||
boat_demo->npc_sendo_actor = sendo_actor;
|
||||
boat_demo->boat_actor = boat_actor;
|
||||
boat_demo->npc_sendo_actor = sendo_actor;
|
||||
boat_demo->boat_actor = boat_actor;
|
||||
|
||||
sendo_actor->npc_class.actor_class.parent_actor = (ACTOR*)boat_demo;
|
||||
boat_actor->actor_class.parent_actor = (ACTOR*)boat_demo;
|
||||
sendo_actor->npc_class.actor_class.parent_actor = (ACTOR*)boat_demo;
|
||||
boat_actor->actor_class.parent_actor = (ACTOR*)boat_demo;
|
||||
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_ON_START_WAIT);
|
||||
}
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_ON_START_WAIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_pl_ride_on_start_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (aBTD_check_sendo_and_boat(boat_demo) == FALSE) {
|
||||
Actor_delete((ACTOR*)boat_demo);
|
||||
}
|
||||
else if (boat_demo->demo_act == aBTD_DEMO_PL_RIDE_ON_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_ON_END_WAIT);
|
||||
}
|
||||
if (aBTD_check_sendo_and_boat(boat_demo) == FALSE) {
|
||||
Actor_delete((ACTOR*)boat_demo);
|
||||
} else if (boat_demo->demo_act == aBTD_DEMO_PL_RIDE_ON_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_ON_END_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_pl_ride_on_end_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->demo_act == aBTD_DEMO_START_CALL_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_START_CALL_END_WAIT);
|
||||
}
|
||||
if (boat_demo->demo_act == aBTD_DEMO_START_CALL_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_START_CALL_END_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_start_call_end_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->demo_act == aBTD_DEMO_MOVE_BOAT_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SONG_BGM_START_WAIT);
|
||||
}
|
||||
if (boat_demo->demo_act == aBTD_DEMO_MOVE_BOAT_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SONG_BGM_START_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_song_bgm_start_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
boat_demo->song_bgm_timer--;
|
||||
boat_demo->song_bgm_timer--;
|
||||
|
||||
if (boat_demo->song_bgm_timer <= 0) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SING_SENDO_START_WAIT);
|
||||
}
|
||||
if (boat_demo->song_bgm_timer <= 0) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SING_SENDO_START_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_sing_sendo_start_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
boat_demo->song_bgm_timer--;
|
||||
boat_demo->song_bgm_timer--;
|
||||
|
||||
if (boat_demo->song_bgm_timer <= 0) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SING_SENDO_MSG_SET_WAIT);
|
||||
}
|
||||
if (boat_demo->song_bgm_timer <= 0) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SING_SENDO_MSG_SET_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_sing_sendo_msg_set_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
int msg_no = mMsg_Get_msg_num(mMsg_Get_base_window_p());
|
||||
|
||||
if (msg_no == boat_demo->sing_msg_no) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SENDO_DIALOGUE_START_WAIT);
|
||||
}
|
||||
int msg_no = mMsg_Get_msg_num(mMsg_Get_base_window_p());
|
||||
|
||||
if (msg_no == boat_demo->sing_msg_no) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SENDO_DIALOGUE_START_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_sendo_dialogue_start_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
int msg_no = mMsg_Get_msg_num(mMsg_Get_base_window_p());
|
||||
|
||||
if (msg_no == boat_demo->sing_msg_no) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SING_SENDO_START_WAIT2);
|
||||
}
|
||||
int msg_no = mMsg_Get_msg_num(mMsg_Get_base_window_p());
|
||||
|
||||
if (msg_no == boat_demo->sing_msg_no) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_SING_SENDO_START_WAIT2);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_sing_sendo_start_wait2(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
int msg_no = mMsg_Get_msg_num(mMsg_Get_base_window_p());
|
||||
|
||||
if (msg_no == boat_demo->sing_msg_no) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_MOVE_BOAT_END_WAIT);
|
||||
}
|
||||
int msg_no = mMsg_Get_msg_num(mMsg_Get_base_window_p());
|
||||
|
||||
aBTD_chg_regist_island_npc_info(boat_demo);
|
||||
if (msg_no == boat_demo->sing_msg_no) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_MOVE_BOAT_END_WAIT);
|
||||
}
|
||||
|
||||
aBTD_chg_regist_island_npc_info(boat_demo);
|
||||
}
|
||||
|
||||
static void aBTD_move_boat_end_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->demo_act == aBTD_DEMO_TOUCH_WHARF_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_TOUCH_WHARF_END_WAIT);
|
||||
}
|
||||
if (boat_demo->demo_act == aBTD_DEMO_TOUCH_WHARF_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_TOUCH_WHARF_END_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_touch_wharf_end_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->touching_wharf == FALSE) {
|
||||
boat_demo->touch_wharf_timer--;
|
||||
if (boat_demo->touching_wharf == FALSE) {
|
||||
boat_demo->touch_wharf_timer--;
|
||||
|
||||
if (boat_demo->touch_wharf_timer <= 0) {
|
||||
sAdo_OngenTrgStart(0x165, &boat_demo->boat_actor->actor_class.world.position);
|
||||
boat_demo->touching_wharf = TRUE;
|
||||
if (boat_demo->touch_wharf_timer <= 0) {
|
||||
sAdo_OngenTrgStart(0x165, &boat_demo->boat_actor->actor_class.world.position);
|
||||
boat_demo->touching_wharf = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (boat_demo->demo_act == aBTD_DEMO_PL_RIDE_OFF_START) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_OFF_START_WAIT);
|
||||
}
|
||||
if (boat_demo->demo_act == aBTD_DEMO_PL_RIDE_OFF_START) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_OFF_START_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_pl_ride_off_start_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->demo_act == aBTD_DEMO_PL_RIDE_OFF_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_OFF_END_WAIT);
|
||||
}
|
||||
if (boat_demo->demo_act == aBTD_DEMO_PL_RIDE_OFF_END) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_PL_RIDE_OFF_END_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_pl_ride_off_end_wait(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (boat_demo->demo_act == aBTD_DEMO_ANCHOR) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_ANCHOR_WAIT);
|
||||
}
|
||||
if (boat_demo->demo_act == aBTD_DEMO_ANCHOR) {
|
||||
aBTD_setupAction(boat_demo, play, aBTD_ACTION_ANCHOR_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_anchor(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
if (aBTD_check_sendo_and_boat(boat_demo) == FALSE) {
|
||||
Actor_delete((ACTOR*)boat_demo);
|
||||
}
|
||||
if (aBTD_check_sendo_and_boat(boat_demo) == FALSE) {
|
||||
Actor_delete((ACTOR*)boat_demo);
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*aBTD_INIT_PROC)(BOAT_DEMO_ACTOR*, GAME_PLAY*);
|
||||
|
||||
static void aBTD_start_call_end_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
mBGMPsComp_make_ps_quietField(0x168);
|
||||
mBGMPsComp_make_ps_quietField(0x168);
|
||||
}
|
||||
|
||||
static void aBTD_song_bgm_start_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
boat_demo->song_bgm_timer = 0;
|
||||
boat_demo->song_bgm_timer = 0;
|
||||
}
|
||||
|
||||
static void aBTD_sing_sendo_start_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
static int player_pattern_table[2][2] = {
|
||||
{ 0, 1 },
|
||||
{ 2, 3 }
|
||||
};
|
||||
static int player_pattern_table[2][2] = { { 0, 1 }, { 2, 3 } };
|
||||
|
||||
static u8 sing_1st_part_bgm_no[4][5] = {
|
||||
{ 0x5C, 0x5D, 0x5E, 0x5F, 0x60 },
|
||||
{ 0x66, 0x67, 0x68, 0x69, 0x6A },
|
||||
{ 0x61, 0x62, 0x63, 0x64, 0x65 },
|
||||
{ 0x6B, 0x6C, 0x6D, 0x6E, 0x6F }
|
||||
};
|
||||
static u8 sing_1st_part_bgm_no[4][5] = {
|
||||
{ 0x5C, 0x5D, 0x5E, 0x5F, 0x60 },
|
||||
{ 0x66, 0x67, 0x68, 0x69, 0x6A },
|
||||
{ 0x61, 0x62, 0x63, 0x64, 0x65 },
|
||||
{ 0x6B, 0x6C, 0x6D, 0x6E, 0x6F },
|
||||
};
|
||||
|
||||
static int sing_1st_part_msg_base_no[4] = {
|
||||
0x3091,
|
||||
0x3163,
|
||||
0x3096,
|
||||
0x3168
|
||||
};
|
||||
static int sing_1st_part_msg_base_no[4] = { 0x3091, 0x3163, 0x3096, 0x3168 };
|
||||
|
||||
int at_island = boat_demo->at_island;
|
||||
int gender = Common_Get(now_private)->gender;
|
||||
int kappn_song;
|
||||
int player_pattern;
|
||||
int at_island = boat_demo->at_island;
|
||||
int gender = Common_Get(now_private)->gender;
|
||||
int kappn_song;
|
||||
int player_pattern;
|
||||
|
||||
do {
|
||||
kappn_song = RANDOM(5);
|
||||
if (!at_island) {
|
||||
if (kappn_song != Save_Get(island).last_song_to_island) {
|
||||
Save_Get(island).last_song_to_island = kappn_song;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (kappn_song != Save_Get(island).last_song_from_island) {
|
||||
Save_Get(island).last_song_from_island = kappn_song;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (TRUE);
|
||||
|
||||
player_pattern = player_pattern_table[at_island][gender];
|
||||
boat_demo->player_pattern = player_pattern;
|
||||
mBGMPsComp_make_ps_lost_fanfare(sing_1st_part_bgm_no[player_pattern][kappn_song], 0x168);
|
||||
boat_demo->sing_msg_no = sing_1st_part_msg_base_no[player_pattern] + kappn_song;
|
||||
boat_demo->sing_dialog_ofs = RANDOM(10);
|
||||
boat_demo->sing_2nd_part = RANDOM(10);
|
||||
boat_demo->song_bgm_timer = 930;
|
||||
do {
|
||||
kappn_song = RANDOM(5);
|
||||
if (!at_island) {
|
||||
if (kappn_song != Save_Get(island).last_song_to_island) {
|
||||
Save_Get(island).last_song_to_island = kappn_song;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (kappn_song != Save_Get(island).last_song_from_island) {
|
||||
Save_Get(island).last_song_from_island = kappn_song;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (TRUE);
|
||||
|
||||
player_pattern = player_pattern_table[at_island][gender];
|
||||
boat_demo->player_pattern = player_pattern;
|
||||
mBGMPsComp_make_ps_lost_fanfare(sing_1st_part_bgm_no[player_pattern][kappn_song], 0x168);
|
||||
boat_demo->sing_msg_no = sing_1st_part_msg_base_no[player_pattern] + kappn_song;
|
||||
boat_demo->sing_dialog_ofs = RANDOM(10);
|
||||
boat_demo->sing_2nd_part = RANDOM(10);
|
||||
boat_demo->song_bgm_timer = FRAMERATE_TIMER(930);
|
||||
}
|
||||
|
||||
static void aBTD_sendo_dialogue_start_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
static int sing_dialogue_msg_base_no[4] = {
|
||||
0x309B,
|
||||
0x316D,
|
||||
0x30A5,
|
||||
0x3177
|
||||
};
|
||||
static int sing_dialogue_msg_base_no[4] = { 0x309B, 0x316D, 0x30A5, 0x3177 };
|
||||
|
||||
int msg_no = sing_dialogue_msg_base_no[boat_demo->player_pattern] + boat_demo->sing_dialog_ofs;
|
||||
int msg_no = sing_dialogue_msg_base_no[boat_demo->player_pattern] + boat_demo->sing_dialog_ofs;
|
||||
|
||||
mMsg_Set_continue_msg_num(mMsg_Get_base_window_p(), msg_no);
|
||||
boat_demo->sing_msg_no = msg_no;
|
||||
mMsg_sound_set_voice_silent(mMsg_Get_base_window_p(), TRUE);
|
||||
aBTD_change_season(boat_demo, play);
|
||||
mMsg_Set_continue_msg_num(mMsg_Get_base_window_p(), msg_no);
|
||||
boat_demo->sing_msg_no = msg_no;
|
||||
mMsg_sound_set_voice_silent(mMsg_Get_base_window_p(), TRUE);
|
||||
aBTD_change_season(boat_demo, play);
|
||||
}
|
||||
|
||||
static void aBTD_sing_sendo_start_wait2_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
static u8 sing_2nd_part_bgm_no[10] = {
|
||||
0x70, 0x71, 0x72, 0x73, 0x74,
|
||||
0x75, 0x76, 0x77, 0x78, 0x79
|
||||
};
|
||||
static u8 sing_2nd_part_bgm_no[10] = { 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79 };
|
||||
|
||||
static int sing_2nd_part_msg_base_no[4] = {
|
||||
0x30AF,
|
||||
0x3181,
|
||||
0x30AF,
|
||||
0x3181
|
||||
};
|
||||
static int sing_2nd_part_msg_base_no[4] = { 0x30AF, 0x3181, 0x30AF, 0x3181 };
|
||||
|
||||
int song_no;
|
||||
int msg_no;
|
||||
|
||||
int song_no;
|
||||
int msg_no;
|
||||
|
||||
mMsg_sound_unset_voice_silent(mMsg_Get_base_window_p(), TRUE);
|
||||
mMsg_sound_unset_voice_silent(mMsg_Get_base_window_p(), TRUE);
|
||||
|
||||
song_no = sing_2nd_part_bgm_no[boat_demo->sing_2nd_part];
|
||||
mBGMPsComp_make_ps_demo(song_no, 0x168);
|
||||
boat_demo->sing_2nd_part_bgm_no = song_no;
|
||||
song_no = sing_2nd_part_bgm_no[boat_demo->sing_2nd_part];
|
||||
mBGMPsComp_make_ps_demo(song_no, 0x168);
|
||||
boat_demo->sing_2nd_part_bgm_no = song_no;
|
||||
|
||||
msg_no = sing_2nd_part_msg_base_no[boat_demo->player_pattern] + boat_demo->sing_2nd_part;
|
||||
mMsg_Set_continue_msg_num(mMsg_Get_base_window_p(), msg_no);
|
||||
boat_demo->sing_msg_no = msg_no;
|
||||
msg_no = sing_2nd_part_msg_base_no[boat_demo->player_pattern] + boat_demo->sing_2nd_part;
|
||||
mMsg_Set_continue_msg_num(mMsg_Get_base_window_p(), msg_no);
|
||||
boat_demo->sing_msg_no = msg_no;
|
||||
}
|
||||
|
||||
static void aBTD_move_boat_end_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
mMsg_sound_set_voice_silent(mMsg_Get_base_window_p(), TRUE);
|
||||
mMsg_sound_set_voice_silent(mMsg_Get_base_window_p(), TRUE);
|
||||
}
|
||||
|
||||
static void aBTD_touch_wharf_end_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
boat_demo->touching_wharf = FALSE;
|
||||
boat_demo->touch_wharf_timer = 190;
|
||||
boat_demo->touching_wharf = FALSE;
|
||||
boat_demo->touch_wharf_timer = FRAMERATE_TIMER(190);
|
||||
}
|
||||
|
||||
static void aBTD_pl_ride_off_start_wait_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
mBGMPsComp_delete_ps_demo(boat_demo->sing_2nd_part_bgm_no, 0x168);
|
||||
mBGMPsComp_delete_ps_demo(boat_demo->sing_2nd_part_bgm_no, 0x168);
|
||||
}
|
||||
|
||||
static void aBTD_anchor_init(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play) {
|
||||
mBGMPsComp_delete_ps_quietField();
|
||||
mBGMPsComp_delete_ps_quietField();
|
||||
|
||||
if (boat_demo->castaway_actor != NULL) {
|
||||
Actor_delete((ACTOR*)boat_demo->castaway_actor);
|
||||
}
|
||||
if (boat_demo->castaway_actor != NULL) {
|
||||
Actor_delete((ACTOR*)boat_demo->castaway_actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBTD_init_proc(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play, int action) {
|
||||
static aBTD_INIT_PROC init_proc[aBTD_ACTION_NUM] = {
|
||||
(aBTD_INIT_PROC)&none_proc1,
|
||||
(aBTD_INIT_PROC)&none_proc1,
|
||||
(aBTD_INIT_PROC)&none_proc1,
|
||||
&aBTD_start_call_end_wait_init,
|
||||
&aBTD_song_bgm_start_wait_init,
|
||||
&aBTD_sing_sendo_start_wait_init,
|
||||
(aBTD_INIT_PROC)&none_proc1,
|
||||
&aBTD_sendo_dialogue_start_wait_init,
|
||||
&aBTD_sing_sendo_start_wait2_init,
|
||||
&aBTD_move_boat_end_wait_init,
|
||||
&aBTD_touch_wharf_end_wait_init,
|
||||
&aBTD_pl_ride_off_start_wait_init,
|
||||
(aBTD_INIT_PROC)&none_proc1,
|
||||
&aBTD_anchor_init
|
||||
};
|
||||
static aBTD_INIT_PROC init_proc[aBTD_ACTION_NUM] = {
|
||||
(aBTD_INIT_PROC)&none_proc1, (aBTD_INIT_PROC)&none_proc1,
|
||||
(aBTD_INIT_PROC)&none_proc1, &aBTD_start_call_end_wait_init,
|
||||
&aBTD_song_bgm_start_wait_init, &aBTD_sing_sendo_start_wait_init,
|
||||
(aBTD_INIT_PROC)&none_proc1, &aBTD_sendo_dialogue_start_wait_init,
|
||||
&aBTD_sing_sendo_start_wait2_init, &aBTD_move_boat_end_wait_init,
|
||||
&aBTD_touch_wharf_end_wait_init, &aBTD_pl_ride_off_start_wait_init,
|
||||
(aBTD_INIT_PROC)&none_proc1, &aBTD_anchor_init,
|
||||
};
|
||||
|
||||
(*init_proc[action])(boat_demo, play);
|
||||
(*init_proc[action])(boat_demo, play);
|
||||
}
|
||||
|
||||
static void aBTD_setupAction(BOAT_DEMO_ACTOR* boat_demo, GAME_PLAY* play, int action) {
|
||||
static aBTD_PROC process[aBTD_ACTION_NUM] = {
|
||||
&aBTD_sendo_birth_wait,
|
||||
&aBTD_pl_ride_on_start_wait,
|
||||
&aBTD_pl_ride_on_end_wait,
|
||||
&aBTD_start_call_end_wait,
|
||||
&aBTD_song_bgm_start_wait,
|
||||
&aBTD_sing_sendo_start_wait,
|
||||
&aBTD_sing_sendo_msg_set_wait,
|
||||
&aBTD_sendo_dialogue_start_wait,
|
||||
&aBTD_sing_sendo_start_wait2,
|
||||
&aBTD_move_boat_end_wait,
|
||||
&aBTD_touch_wharf_end_wait,
|
||||
&aBTD_pl_ride_off_start_wait,
|
||||
&aBTD_pl_ride_off_end_wait,
|
||||
&aBTD_anchor
|
||||
};
|
||||
static aBTD_PROC process[aBTD_ACTION_NUM] = {
|
||||
&aBTD_sendo_birth_wait, &aBTD_pl_ride_on_start_wait,
|
||||
&aBTD_pl_ride_on_end_wait, &aBTD_start_call_end_wait,
|
||||
&aBTD_song_bgm_start_wait, &aBTD_sing_sendo_start_wait,
|
||||
&aBTD_sing_sendo_msg_set_wait, &aBTD_sendo_dialogue_start_wait,
|
||||
&aBTD_sing_sendo_start_wait2, &aBTD_move_boat_end_wait,
|
||||
&aBTD_touch_wharf_end_wait, &aBTD_pl_ride_off_start_wait,
|
||||
&aBTD_pl_ride_off_end_wait, &aBTD_anchor,
|
||||
};
|
||||
|
||||
boat_demo->action_proc = process[action];
|
||||
boat_demo->action = action;
|
||||
aBTD_init_proc(boat_demo, play, action);
|
||||
boat_demo->action_proc = process[action];
|
||||
boat_demo->action = action;
|
||||
aBTD_init_proc(boat_demo, play, action);
|
||||
}
|
||||
|
||||
static void aBTD_actor_move(ACTOR* actorx, GAME* game) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
BOAT_ACTOR* boat_actor = boat_demo->boat_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
BOAT_ACTOR* boat_actor = boat_demo->boat_actor;
|
||||
|
||||
if (boat_actor != NULL) {
|
||||
actorx->shape_info.rotation.x = boat_actor->actor_class.shape_info.rotation.x;
|
||||
actorx->shape_info.rotation.y = boat_actor->actor_class.shape_info.rotation.y;
|
||||
boat_demo->boat_speed = boat_actor->actor_class.speed;
|
||||
}
|
||||
if (boat_actor != NULL) {
|
||||
actorx->shape_info.rotation.x = boat_actor->actor_class.shape_info.rotation.x;
|
||||
actorx->shape_info.rotation.y = boat_actor->actor_class.shape_info.rotation.y;
|
||||
boat_demo->boat_speed = boat_actor->actor_class.speed;
|
||||
}
|
||||
|
||||
aBTD_setup_castaway(boat_demo, play);
|
||||
(*boat_demo->action_proc)(boat_demo, play);
|
||||
aBTD_setup_castaway(boat_demo, play);
|
||||
(*boat_demo->action_proc)(boat_demo, play);
|
||||
}
|
||||
|
||||
+384
-406
@@ -1,580 +1,558 @@
|
||||
static void aBT_passenger_ctrl(BOAT_ACTOR* boat_actor) {
|
||||
if (boat_actor->actor_class.child_actor != NULL) {
|
||||
xyz_t passenger_pos;
|
||||
s_xyz passenger_angle;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
if (boat_actor->actor_class.child_actor != NULL) {
|
||||
xyz_t passenger_pos;
|
||||
s_xyz passenger_angle;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
xyz_t_add(&boat_actor->actor_class.world.position, &boat_demo->passenger_ofs, &passenger_pos);
|
||||
passenger_angle.y = boat_actor->actor_class.shape_info.rotation.y - DEG2SHORT_ANGLE(-180.0f);
|
||||
xyz_t_add(&boat_actor->actor_class.world.position, &boat_demo->passenger_ofs, &passenger_pos);
|
||||
passenger_angle.y = boat_actor->actor_class.shape_info.rotation.y - DEG2SHORT_ANGLE(-180.0f);
|
||||
|
||||
(*GET_PLAYER_ACTOR_NOW()->Set_force_position_angle_proc)(
|
||||
gamePT,
|
||||
&passenger_pos, &passenger_angle,
|
||||
mPlayer_FORCE_POSITION_ANGLE_POSX | mPlayer_FORCE_POSITION_ANGLE_POSY | mPlayer_FORCE_POSITION_ANGLE_POSZ |
|
||||
mPlayer_FORCE_POSITION_ANGLE_ROTY
|
||||
);
|
||||
(*GET_PLAYER_ACTOR_NOW()->Set_force_position_angle_proc)(
|
||||
gamePT, &passenger_pos, &passenger_angle,
|
||||
mPlayer_FORCE_POSITION_ANGLE_POSX | mPlayer_FORCE_POSITION_ANGLE_POSY | mPlayer_FORCE_POSITION_ANGLE_POSZ |
|
||||
mPlayer_FORCE_POSITION_ANGLE_ROTY);
|
||||
|
||||
mPlib_Set_boat_angleZ(boat_actor->actor_class.shape_info.rotation.z);
|
||||
}
|
||||
mPlib_Set_boat_angleZ(boat_actor->actor_class.shape_info.rotation.z);
|
||||
}
|
||||
}
|
||||
|
||||
static int aBT_check_other_boat(ACTOR* actorx, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
ACTOR* actor = play->actor_info.list[ACTOR_PART_ITEM].actor;
|
||||
int res = TRUE;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
ACTOR* actor = play->actor_info.list[ACTOR_PART_ITEM].actor;
|
||||
int res = TRUE;
|
||||
|
||||
while (TRUE) {
|
||||
ACTOR* other_actor = Actor_info_fgName_search_sub(actor, BOAT);
|
||||
while (TRUE) {
|
||||
ACTOR* other_actor = Actor_info_fgName_search_sub(actor, BOAT);
|
||||
|
||||
if (other_actor == NULL) {
|
||||
break;
|
||||
}
|
||||
else if (other_actor != actorx) {
|
||||
res = FALSE;
|
||||
break;
|
||||
if (other_actor == NULL) {
|
||||
break;
|
||||
} else if (other_actor != actorx) {
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
actor = other_actor->next_actor;
|
||||
}
|
||||
|
||||
actor = other_actor->next_actor;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void aBT_anime_proc(BOAT_ACTOR* boat_actor) {
|
||||
if (boat_actor->action == aBT_ACTION_MOVE) {
|
||||
NPC_SENDO_ACTOR* sendo_actor = ((BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor)->npc_sendo_actor;
|
||||
if (boat_actor->action == aBT_ACTION_MOVE) {
|
||||
NPC_SENDO_ACTOR* sendo_actor = ((BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor)->npc_sendo_actor;
|
||||
|
||||
/* Attempt to sync boat animation with Kapp'n's animation */
|
||||
if (sendo_actor != NULL && sendo_actor->npc_class.draw.animation_id == 123) {
|
||||
cKF_SkeletonInfo_R_c* keyframe = &sendo_actor->npc_class.draw.main_animation.keyframe;
|
||||
/* Attempt to sync boat animation with Kapp'n's animation */
|
||||
if (sendo_actor != NULL && sendo_actor->npc_class.draw.animation_id == 123) {
|
||||
cKF_SkeletonInfo_R_c* keyframe = &sendo_actor->npc_class.draw.main_animation.keyframe;
|
||||
|
||||
boat_actor->keyframe.frame_control.current_frame = keyframe->frame_control.current_frame;
|
||||
boat_actor->keyframe.frame_control.current_frame = keyframe->frame_control.current_frame;
|
||||
|
||||
if (
|
||||
cKF_FrameControl_passCheck_now(&keyframe->frame_control, 35.0f) == TRUE ||
|
||||
cKF_FrameControl_passCheck_now(&keyframe->frame_control, 52.0f) == TRUE
|
||||
) {
|
||||
boat_actor->roll_timer = 400;
|
||||
}
|
||||
if (cKF_FrameControl_passCheck_now(&keyframe->frame_control, 35.0f) == TRUE ||
|
||||
cKF_FrameControl_passCheck_now(&keyframe->frame_control, 52.0f) == TRUE) {
|
||||
boat_actor->roll_timer = 400;
|
||||
}
|
||||
}
|
||||
|
||||
cKF_SkeletonInfo_R_play(&boat_actor->keyframe);
|
||||
}
|
||||
|
||||
cKF_SkeletonInfo_R_play(&boat_actor->keyframe);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_roll_ctrl(BOAT_ACTOR* boat_actor) {
|
||||
int timer = boat_actor->roll_timer;
|
||||
int timer_sub = timer - 200;
|
||||
int roll_cycle;
|
||||
int timer = boat_actor->roll_timer;
|
||||
int timer_sub = timer - 200;
|
||||
int roll_cycle;
|
||||
|
||||
if (ABS(timer_sub) < 2) {
|
||||
timer = 200;
|
||||
}
|
||||
else if (timer_sub < 0) {
|
||||
timer += 2;
|
||||
}
|
||||
else {
|
||||
timer -= 2;
|
||||
}
|
||||
if (ABS(timer_sub) < 2) {
|
||||
timer = 200;
|
||||
} else if (timer_sub < 0) {
|
||||
timer += 2;
|
||||
} else {
|
||||
timer -= 2;
|
||||
}
|
||||
|
||||
boat_actor->roll_timer = timer;
|
||||
roll_cycle = boat_actor->roll_cycle;
|
||||
roll_cycle += timer;
|
||||
boat_actor->roll_cycle = roll_cycle;
|
||||
boat_actor->actor_class.shape_info.rotation.z = sin_s(roll_cycle) * 1024.0f; // [-5.625f, 5.625f] degree rocking arc
|
||||
boat_actor->roll_timer = timer;
|
||||
roll_cycle = boat_actor->roll_cycle;
|
||||
roll_cycle += timer;
|
||||
boat_actor->roll_cycle = roll_cycle;
|
||||
boat_actor->actor_class.shape_info.rotation.z = sin_s(roll_cycle) * 1024.0f; // [-5.625f, 5.625f] degree rocking arc
|
||||
}
|
||||
|
||||
static int aBT_check_alive(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
int bx;
|
||||
int bz;
|
||||
int alive = FALSE;
|
||||
int bx;
|
||||
int bz;
|
||||
int alive = FALSE;
|
||||
|
||||
if (
|
||||
mFI_Wpos2BlockNum(&bx, &bz, boat_actor->actor_class.world.position) == TRUE &&
|
||||
play->block_table.block_x == bx && play->block_table.block_z == bz
|
||||
) {
|
||||
alive = TRUE;
|
||||
}
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, boat_actor->actor_class.world.position) == TRUE &&
|
||||
play->block_table.block_x == bx && play->block_table.block_z == bz) {
|
||||
alive = TRUE;
|
||||
}
|
||||
|
||||
return alive;
|
||||
return alive;
|
||||
}
|
||||
|
||||
static void aBT_up_down_proc(BOAT_ACTOR* boat_actor) {
|
||||
if (boat_actor->actor_class.world.position.y < boat_actor->actor_class.home.position.y) {
|
||||
if (boat_actor->actor_class.max_velocity_y < 0.0f) {
|
||||
boat_actor->actor_class.gravity = 0.003f + RANDOM_F(0.002f);
|
||||
}
|
||||
if (boat_actor->actor_class.world.position.y < boat_actor->actor_class.home.position.y) {
|
||||
if (boat_actor->actor_class.max_velocity_y < 0.0f) {
|
||||
boat_actor->actor_class.gravity = 0.003f + RANDOM_F(0.002f);
|
||||
}
|
||||
|
||||
boat_actor->actor_class.max_velocity_y = 0.1f;
|
||||
}
|
||||
else {
|
||||
if (boat_actor->actor_class.max_velocity_y > 0.0f) {
|
||||
boat_actor->actor_class.gravity = 0.003f + RANDOM_F(0.002f);
|
||||
}
|
||||
boat_actor->actor_class.max_velocity_y = 0.1f;
|
||||
} else {
|
||||
if (boat_actor->actor_class.max_velocity_y > 0.0f) {
|
||||
boat_actor->actor_class.gravity = 0.003f + RANDOM_F(0.002f);
|
||||
}
|
||||
|
||||
boat_actor->actor_class.max_velocity_y = -0.1f;
|
||||
}
|
||||
boat_actor->actor_class.max_velocity_y = -0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_position_move(BOAT_ACTOR* boat_actor) {
|
||||
aBT_up_down_proc(boat_actor);
|
||||
Actor_position_moveF((ACTOR*)boat_actor);
|
||||
aBT_up_down_proc(boat_actor);
|
||||
Actor_position_moveF((ACTOR*)boat_actor);
|
||||
|
||||
if ((boat_actor->actor_class.world.position.y - boat_actor->actor_class.home.position.y) - -1.6f < 0.0f) {
|
||||
boat_actor->actor_class.world.position.y = boat_actor->actor_class.home.position.y + -1.6f;
|
||||
}
|
||||
if ((boat_actor->actor_class.world.position.y - boat_actor->actor_class.home.position.y) - -1.6f < 0.0f) {
|
||||
boat_actor->actor_class.world.position.y = boat_actor->actor_class.home.position.y + -1.6f;
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_calc_wave_angl(BOAT_ACTOR* boat_actor, s16 angle) {
|
||||
f32 var_f1_2;
|
||||
f32 var_f2_2;
|
||||
s16 var_r30;
|
||||
s16 var_r4;
|
||||
s16 var_r5;
|
||||
s16 _2CC_diff = boat_actor->_2CC;
|
||||
s16 _2D0_diff = boat_actor->_2D0;
|
||||
s16 half_rudder = ABS(boat_actor->rudder) * 0.5f;
|
||||
|
||||
_2CC_diff -= angle;
|
||||
_2D0_diff -= angle;
|
||||
|
||||
if (ABS((int)_2CC_diff) >= 0x300) {
|
||||
var_f2_2 = (f32)ABS(_2CC_diff);
|
||||
if (var_f2_2 > 1536.0f) {
|
||||
var_f2_2 = 1536.0f;
|
||||
}
|
||||
|
||||
if (half_rudder > 40) {
|
||||
var_r4 = half_rudder;
|
||||
}
|
||||
else {
|
||||
var_r4 = 40;
|
||||
f32 var_f1_2;
|
||||
f32 var_f2_2;
|
||||
s16 var_r30;
|
||||
s16 var_r4;
|
||||
s16 var_r5;
|
||||
s16 _2CC_diff = boat_actor->_2CC;
|
||||
s16 _2D0_diff = boat_actor->_2D0;
|
||||
s16 half_rudder = ABS(boat_actor->rudder) * 0.5f;
|
||||
|
||||
_2CC_diff -= angle;
|
||||
_2D0_diff -= angle;
|
||||
|
||||
if (ABS((int)_2CC_diff) >= 0x300) {
|
||||
var_f2_2 = (f32)ABS(_2CC_diff);
|
||||
if (var_f2_2 > 1536.0f) {
|
||||
var_f2_2 = 1536.0f;
|
||||
}
|
||||
|
||||
if (half_rudder > 40) {
|
||||
var_r4 = half_rudder;
|
||||
} else {
|
||||
var_r4 = 40;
|
||||
}
|
||||
|
||||
var_r5 = ((int)((f32)(var_r4 - 30) * ((var_f2_2 - 768.0f) / 768.0f)) + 30);
|
||||
} else {
|
||||
var_r5 = 30;
|
||||
}
|
||||
|
||||
var_r5 = ((int)((f32)(var_r4 - 30) * ((var_f2_2 - 768.0f) / 768.0f)) + 30);
|
||||
}
|
||||
else {
|
||||
var_r5 = 30;
|
||||
}
|
||||
|
||||
if (ABS(_2D0_diff) >= 0x600) {
|
||||
var_f1_2 = (f32)ABS(_2D0_diff);
|
||||
if (var_f1_2 > 2304.0f) {
|
||||
var_f1_2 = 2304.0f;
|
||||
if (ABS(_2D0_diff) >= 0x600) {
|
||||
var_f1_2 = (f32)ABS(_2D0_diff);
|
||||
if (var_f1_2 > 2304.0f) {
|
||||
var_f1_2 = 2304.0f;
|
||||
}
|
||||
|
||||
if (half_rudder > 30) {
|
||||
var_r4 = half_rudder;
|
||||
} else {
|
||||
var_r4 = 30;
|
||||
}
|
||||
|
||||
var_r30 = ((int)((f32)(var_r4 - 20) * ((var_f1_2 - 1536.0f) / 768.0f)) + 20);
|
||||
} else {
|
||||
var_r30 = 20;
|
||||
}
|
||||
|
||||
if (half_rudder > 30) {
|
||||
var_r4 = half_rudder;
|
||||
}
|
||||
else {
|
||||
var_r4 = 30;
|
||||
}
|
||||
|
||||
var_r30 = ((int)((f32)(var_r4 - 20) * ((var_f1_2 - 1536.0f) / 768.0f)) + 20);
|
||||
}
|
||||
else {
|
||||
var_r30 = 20;
|
||||
}
|
||||
|
||||
chase_angle(&_2CC_diff, 0, var_r5);
|
||||
chase_angle(&_2D0_diff, 0, var_r30);
|
||||
boat_actor->_2CC = _2CC_diff;
|
||||
boat_actor->_2D0 = _2D0_diff;
|
||||
|
||||
chase_angle(&_2CC_diff, 0, var_r5);
|
||||
chase_angle(&_2D0_diff, 0, var_r30);
|
||||
boat_actor->_2CC = _2CC_diff;
|
||||
boat_actor->_2D0 = _2D0_diff;
|
||||
}
|
||||
|
||||
static void aBT_ctrl_rudder(BOAT_ACTOR* boat_actor, s16 p0, s16 p1, s16 p2) {
|
||||
s16 rudder = boat_actor->rudder;
|
||||
s16 step;
|
||||
s16 rudder = boat_actor->rudder;
|
||||
s16 step;
|
||||
|
||||
if (rudder * p2 >= 0) {
|
||||
if (p1 > 256) {
|
||||
step = ((p1 - 256) * 14) / 768 + 2;
|
||||
if (rudder * p2 >= 0) {
|
||||
if (p1 > 256) {
|
||||
step = ((p1 - 256) * 14) / 768 + 2;
|
||||
|
||||
if (step > 16) {
|
||||
if (step > 16) {
|
||||
step = 16;
|
||||
}
|
||||
} else {
|
||||
step = 2;
|
||||
}
|
||||
} else {
|
||||
step = 16;
|
||||
}
|
||||
}
|
||||
else {
|
||||
step = 2;
|
||||
|
||||
step /= 2.0f;
|
||||
if (p0 == 0) {
|
||||
rudder = 0;
|
||||
} else if (p0 < 0) {
|
||||
rudder -= step;
|
||||
|
||||
if (rudder < -38) {
|
||||
rudder = -38;
|
||||
}
|
||||
} else {
|
||||
rudder += step;
|
||||
|
||||
if (rudder > 38) {
|
||||
rudder = 38;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
step = 16;
|
||||
}
|
||||
|
||||
step /= 2.0f;
|
||||
if (p0 == 0) {
|
||||
rudder = 0;
|
||||
}
|
||||
else if (p0 < 0) {
|
||||
rudder -= step;
|
||||
|
||||
if (rudder < -38) {
|
||||
rudder = -38;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rudder += step;
|
||||
|
||||
if (rudder > 38) {
|
||||
rudder = 38;
|
||||
}
|
||||
}
|
||||
|
||||
boat_actor->rudder = rudder;
|
||||
boat_actor->rudder = rudder;
|
||||
}
|
||||
|
||||
static void aBT_ctrl_direction(BOAT_ACTOR* boat_actor) {
|
||||
int point = boat_actor->point;
|
||||
s16 anglY = boat_actor->actor_class.shape_info.rotation.y;
|
||||
xyz_t* chk_point = &aBT_chk_point[point];
|
||||
f32 dZ = chk_point->z - boat_actor->actor_class.world.position.z;
|
||||
f32 dX = chk_point->x - boat_actor->actor_class.world.position.x;
|
||||
s16 p2 = atans_table(dZ, dX);
|
||||
s16 p0 = p2 - boat_actor->actor_class.world.angle.y; // diff to target rotation
|
||||
s16 p1 = ABS(p0);
|
||||
f32 rudder;
|
||||
int point = boat_actor->point;
|
||||
xyz_t* chk_point;
|
||||
f32 dZ;
|
||||
f32 dX;
|
||||
s16 p2;
|
||||
s16 p0;
|
||||
s16 p1;
|
||||
s16 anglY;
|
||||
f32 rudder;
|
||||
|
||||
aBT_ctrl_rudder(boat_actor, p0, p1, p2);
|
||||
rudder = boat_actor->rudder * 0.5f;
|
||||
|
||||
if ((f32)p0 * rudder <= 0.0f && (f32)p1 < ABS(rudder)) {
|
||||
boat_actor->actor_class.world.angle.y = p2;
|
||||
}
|
||||
else {
|
||||
boat_actor->actor_class.world.angle.y += rudder;
|
||||
}
|
||||
anglY = boat_actor->actor_class.shape_info.rotation.y;
|
||||
chk_point = &aBT_chk_point[point];
|
||||
dZ = chk_point->z - boat_actor->actor_class.world.position.z;
|
||||
dX = chk_point->x - boat_actor->actor_class.world.position.x;
|
||||
p2 = atans_table(dZ, dX);
|
||||
p0 = p2 - boat_actor->actor_class.world.angle.y; // diff to target rotation
|
||||
p1 = ABS(p0);
|
||||
|
||||
boat_actor->actor_class.shape_info.rotation.y = boat_actor->actor_class.world.angle.y;
|
||||
aBT_calc_wave_angl(boat_actor, boat_actor->actor_class.shape_info.rotation.y - anglY);
|
||||
aBT_ctrl_rudder(boat_actor, p0, p1, p2);
|
||||
|
||||
if (boat_actor->direction == aBT_DIRECTION_TO_ISLAND) {
|
||||
if (dZ < 0.0f) {
|
||||
boat_actor->point = point + 1;
|
||||
rudder = FRAMERATE_ADJ(boat_actor->rudder * 0.5f);
|
||||
if ((f32)p0 * rudder <= 0.0f && (f32)p1 < ABS(rudder)) {
|
||||
boat_actor->actor_class.world.angle.y = p2;
|
||||
} else {
|
||||
boat_actor->actor_class.world.angle.y += rudder;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (dZ > 0.0f) {
|
||||
boat_actor->point = point - 1;
|
||||
|
||||
boat_actor->actor_class.shape_info.rotation.y = boat_actor->actor_class.world.angle.y;
|
||||
aBT_calc_wave_angl(boat_actor, boat_actor->actor_class.shape_info.rotation.y - anglY);
|
||||
|
||||
if (boat_actor->direction == aBT_DIRECTION_TO_ISLAND) {
|
||||
if (dZ < 0.0f) {
|
||||
boat_actor->point = point + 1;
|
||||
}
|
||||
} else {
|
||||
if (dZ > 0.0f) {
|
||||
boat_actor->point = point - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_calc_speed(BOAT_ACTOR* boat_actor) {
|
||||
f32 target;
|
||||
f32 step;
|
||||
f32 target;
|
||||
f32 step;
|
||||
|
||||
if (boat_actor->point == aBT_last_point_idx[boat_actor->direction]) {
|
||||
target = 0.0f;
|
||||
step = 0.0017f;
|
||||
}
|
||||
else {
|
||||
target = 0.625f;
|
||||
step = 0.01f;
|
||||
}
|
||||
if (boat_actor->point == aBT_last_point_idx[boat_actor->direction]) {
|
||||
target = 0.0f;
|
||||
step = FRAMERATE_SELECT(0.0017f, 0.0021f);
|
||||
} else {
|
||||
target = FRAMERATE_ADJ(0.625f);
|
||||
step = 0.01f;
|
||||
}
|
||||
|
||||
chase_f(&boat_actor->actor_class.speed, target, step);
|
||||
chase_f(&boat_actor->actor_class.speed, target, step);
|
||||
}
|
||||
|
||||
static void aBT_demo_ctrl_birth_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
ACTOR* boat_demo = Actor_info_make_actor(&play->actor_info, (GAME*)play, mAc_PROFILE_BOAT_DEMO, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, EMPTY_NO, -1, -1, -1);
|
||||
ACTOR* boat_demo = Actor_info_make_actor(&play->actor_info, (GAME*)play, mAc_PROFILE_BOAT_DEMO, 0.0f, 0.0f, 0.0f, 0,
|
||||
0, 0, -1, -1, -1, EMPTY_NO, -1, -1, -1);
|
||||
|
||||
if (boat_demo != NULL) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_WAIT);
|
||||
}
|
||||
if (boat_demo != NULL) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (aBT_check_alive(boat_actor, play) == FALSE) {
|
||||
boat_actor->action = -1;
|
||||
}
|
||||
else {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
if (aBT_check_alive(boat_actor, play) == FALSE) {
|
||||
boat_actor->action = -1;
|
||||
} else {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
if (boat_demo != NULL && boat_demo->action == aBTD_ACTION_PL_RIDE_ON_END_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_MOVE_START_WAIT);
|
||||
if (boat_demo != NULL && boat_demo->action == aBTD_ACTION_PL_RIDE_ON_END_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_MOVE_START_WAIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_move_start_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
GAME* game = (GAME*)play;
|
||||
GAME* game = (GAME*)play;
|
||||
|
||||
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_DEMO_WALK) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_MOVE_END_WAIT);
|
||||
}
|
||||
else {
|
||||
s16 dir = boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(90.0f);
|
||||
f32 x = cos_s(dir);
|
||||
f32 z = sin_s(dir);
|
||||
|
||||
mPlib_request_main_demo_walk_type1(
|
||||
game,
|
||||
boat_actor->actor_class.world.position.x + x * 56.0f, boat_actor->actor_class.world.position.z + z * 56.0f,
|
||||
1.0f,
|
||||
0
|
||||
);
|
||||
}
|
||||
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_DEMO_WALK) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_MOVE_END_WAIT);
|
||||
} else {
|
||||
s16 dir = boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(90.0f);
|
||||
f32 x = cos_s(dir);
|
||||
f32 z = sin_s(dir);
|
||||
|
||||
mPlib_request_main_demo_walk_type1(game, boat_actor->actor_class.world.position.x + x * 56.0f,
|
||||
boat_actor->actor_class.world.position.z + z * 56.0f, 1.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_move_end_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (mPlib_Get_end_player_demo_walk()) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_ON_START_WAIT);
|
||||
}
|
||||
if (mPlib_Get_end_player_demo_walk()) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_ON_START_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_on_start_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETON_BOAT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_ON_END_WAIT);
|
||||
}
|
||||
else {
|
||||
s16 dir = boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(90.0f);
|
||||
f32 x = cos_s(dir);
|
||||
f32 z = sin_s(dir);
|
||||
|
||||
mPlib_request_main_demo_geton_boat_type1(
|
||||
boat_actor->actor_class.world.position.x + x * 56.0f, boat_actor->actor_class.world.position.z + z * 56.0f,
|
||||
boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(-90.0f)
|
||||
);
|
||||
}
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETON_BOAT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_ON_END_WAIT);
|
||||
} else {
|
||||
s16 dir = boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(90.0f);
|
||||
f32 x = cos_s(dir);
|
||||
f32 z = sin_s(dir);
|
||||
|
||||
mPlib_request_main_demo_geton_boat_type1(
|
||||
boat_actor->actor_class.world.position.x + x * 56.0f, boat_actor->actor_class.world.position.z + z * 56.0f,
|
||||
boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(-90.0f));
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_on_end_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETON_BOAT_SITDOWN) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_SITDOWN_END_WAIT);
|
||||
}
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETON_BOAT_SITDOWN) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_SITDOWN_END_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_sitdown_end_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETON_BOAT_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOVE_WAIT);
|
||||
}
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETON_BOAT_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOVE_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_move_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
if (boat_demo != NULL && boat_demo->action == aBTD_ACTION_SONG_BGM_START_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOVE);
|
||||
}
|
||||
if (boat_demo != NULL && boat_demo->action == aBTD_ACTION_SONG_BGM_START_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOVE);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_move(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
aBT_ctrl_direction(boat_actor);
|
||||
aBT_ctrl_direction(boat_actor);
|
||||
|
||||
if (boat_actor->direction == aBT_DIRECTION_TO_ISLAND) {
|
||||
if (boat_actor->point >= 8) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_DRAW_UP);
|
||||
}
|
||||
else {
|
||||
if (boat_actor->action == aBT_ACTION_MOVE && boat_actor->point == 7) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOMENT);
|
||||
}
|
||||
if (boat_actor->direction == aBT_DIRECTION_TO_ISLAND) {
|
||||
if (boat_actor->point >= 8) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_DRAW_UP);
|
||||
} else {
|
||||
if (boat_actor->action == aBT_ACTION_MOVE && boat_actor->point == 7) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOMENT);
|
||||
}
|
||||
|
||||
aBT_calc_speed(boat_actor);
|
||||
}
|
||||
}
|
||||
else if (boat_actor->point <= -1) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_DRAW_UP);
|
||||
}
|
||||
else {
|
||||
if (boat_actor->action == aBT_ACTION_MOVE && boat_actor->point == 0) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOMENT);
|
||||
}
|
||||
aBT_calc_speed(boat_actor);
|
||||
}
|
||||
} else if (boat_actor->point <= -1) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_DRAW_UP);
|
||||
} else {
|
||||
if (boat_actor->action == aBT_ACTION_MOVE && boat_actor->point == 0) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_MOMENT);
|
||||
}
|
||||
|
||||
aBT_calc_speed(boat_actor);
|
||||
}
|
||||
aBT_calc_speed(boat_actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_draw_up(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
int last_point_idx = aBT_last_point_idx[boat_actor->direction];
|
||||
xyz_t* last_chk_point = &aBT_chk_point[last_point_idx];
|
||||
s16 anglY = boat_actor->actor_class.shape_info.rotation.y;
|
||||
int drawn_up_point = 0;
|
||||
int last_point_idx = aBT_last_point_idx[boat_actor->direction];
|
||||
xyz_t* last_chk_point = &aBT_chk_point[last_point_idx];
|
||||
s16 anglY = boat_actor->actor_class.shape_info.rotation.y;
|
||||
int drawn_up_point = 0;
|
||||
|
||||
chase_f(&boat_actor->rudder, 16.0f, 0.5f);
|
||||
chase_f(&boat_actor->rudder, 16.0f, 0.5f);
|
||||
|
||||
/* Wait for proper rotation */
|
||||
if (chase_angle(&boat_actor->actor_class.shape_info.rotation.y, aBT_init_angleY[boat_actor->direction], boat_actor->rudder) == TRUE) {
|
||||
drawn_up_point++;
|
||||
}
|
||||
/* Wait for proper rotation */
|
||||
if (chase_angle(&boat_actor->actor_class.shape_info.rotation.y, aBT_init_angleY[boat_actor->direction],
|
||||
FRAMERATE_ADJ(boat_actor->rudder)) == TRUE) {
|
||||
drawn_up_point++;
|
||||
}
|
||||
|
||||
boat_actor->actor_class.world.angle.y = boat_actor->actor_class.shape_info.rotation.y;
|
||||
aBT_calc_wave_angl(boat_actor, boat_actor->actor_class.shape_info.rotation.y - anglY);
|
||||
boat_actor->actor_class.world.angle.y = boat_actor->actor_class.shape_info.rotation.y;
|
||||
aBT_calc_wave_angl(boat_actor, boat_actor->actor_class.shape_info.rotation.y - anglY);
|
||||
|
||||
/* Wait for proper X coordinate */
|
||||
if (chase_f(&boat_actor->actor_class.world.position.x, last_chk_point->x, 0.05f) == TRUE) {
|
||||
drawn_up_point++;
|
||||
}
|
||||
/* Wait for proper X coordinate */
|
||||
if (chase_f(&boat_actor->actor_class.world.position.x, last_chk_point->x, 0.05f) == TRUE) {
|
||||
drawn_up_point++;
|
||||
}
|
||||
|
||||
/* Wait for proper Z coordinate */
|
||||
if (chase_f(&boat_actor->actor_class.world.position.z, last_chk_point->z, 0.05f) == TRUE) {
|
||||
drawn_up_point++;
|
||||
}
|
||||
/* Wait for proper Z coordinate */
|
||||
if (chase_f(&boat_actor->actor_class.world.position.z, last_chk_point->z, 0.05f) == TRUE) {
|
||||
drawn_up_point++;
|
||||
}
|
||||
|
||||
/* Ensure all three criteria are met */
|
||||
if (drawn_up_point == 3) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_ARRIVE_CALL_END_WAIT);
|
||||
}
|
||||
/* Ensure all three criteria are met */
|
||||
if (drawn_up_point == 3) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_ARRIVE_CALL_END_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_arrive_call_end_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
if (boat_demo->action == aBTD_ACTION_PL_RIDE_OFF_END_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_OFF_START_WAIT);
|
||||
}
|
||||
if (boat_demo->action == aBTD_ACTION_PL_RIDE_OFF_END_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_OFF_START_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_off_start_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETOFF_BOAT_STANDUP) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_OFF_END_WAIT);
|
||||
}
|
||||
else {
|
||||
xyz_t pos;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
s16 dir = boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(-90.0f);
|
||||
f32 z = cos_s(dir);
|
||||
f32 x = sin_s(dir);
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_GETOFF_BOAT_STANDUP) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_PL_RIDE_OFF_END_WAIT);
|
||||
} else {
|
||||
xyz_t pos;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
s16 dir = boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(-90.0f);
|
||||
f32 z = cos_s(dir);
|
||||
f32 x = sin_s(dir);
|
||||
|
||||
pos.x = player->actor_class.world.position.x + x * 47.0f;
|
||||
pos.y = 40.0f;
|
||||
pos.z = player->actor_class.world.position.z + z * 47.0f;
|
||||
pos.x = player->actor_class.world.position.x + x * 47.0f;
|
||||
pos.y = 40.0f;
|
||||
pos.z = player->actor_class.world.position.z + z * 47.0f;
|
||||
|
||||
mPlib_request_main_demo_getoff_boat_standup_type1(&pos, boat_actor->actor_class.shape_info.rotation.y + DEG2SHORT_ANGLE(-90.0f));
|
||||
}
|
||||
mPlib_request_main_demo_getoff_boat_standup_type1(&pos, boat_actor->actor_class.shape_info.rotation.y +
|
||||
DEG2SHORT_ANGLE(-90.0f));
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_off_end_wait(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_ANCHOR);
|
||||
}
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) == mPlayer_INDEX_DEMO_WAIT) {
|
||||
aBT_setupAction(boat_actor, play, aBT_ACTION_ANCHOR);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_anchor(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
if (aBT_check_alive(boat_actor, play) == FALSE) {
|
||||
boat_actor->action = -1;
|
||||
}
|
||||
if (aBT_check_alive(boat_actor, play) == FALSE) {
|
||||
boat_actor->action = -1;
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*aBT_INIT_PROC)(BOAT_ACTOR*, GAME_PLAY*);
|
||||
|
||||
static void aBT_wait_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
boat_actor->actor_class.speed = 0.0f;
|
||||
boat_actor->actor_class.speed = 0.0f;
|
||||
}
|
||||
|
||||
static void aBT_sitdown_end_wait_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
boat_actor->actor_class.child_actor = (ACTOR*)player;
|
||||
xyz_t_sub(&player->actor_class.world.position, &boat_actor->actor_class.world.position, &boat_demo->passenger_ofs);
|
||||
boat_actor->roll_timer += 800;
|
||||
boat_actor->actor_class.position_speed.y = -0.2f;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
boat_actor->actor_class.child_actor = (ACTOR*)player;
|
||||
xyz_t_sub(&player->actor_class.world.position, &boat_actor->actor_class.world.position, &boat_demo->passenger_ofs);
|
||||
boat_actor->roll_timer += 800;
|
||||
boat_actor->actor_class.position_speed.y = -0.2f;
|
||||
}
|
||||
|
||||
static void aBT_move_wait_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
boat_demo->demo_act = aBTD_DEMO_START_CALL_END;
|
||||
boat_demo->demo_act = aBTD_DEMO_START_CALL_END;
|
||||
}
|
||||
|
||||
static void aBT_move_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
static int chk_point_idx[aBT_DIRECTION_NUM] = { 1, 6 };
|
||||
static int chk_point_idx[aBT_DIRECTION_NUM] = { 1, 6 };
|
||||
|
||||
boat_actor->point = chk_point_idx[boat_actor->direction];
|
||||
boat_actor->point = chk_point_idx[boat_actor->direction];
|
||||
}
|
||||
|
||||
static void aBT_moment_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
boat_demo->demo_act = aBTD_DEMO_TOUCH_WHARF_END;
|
||||
boat_demo->demo_act = aBTD_DEMO_TOUCH_WHARF_END;
|
||||
}
|
||||
|
||||
static void aBT_draw_up_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
boat_actor->actor_class.speed = 0.0f;
|
||||
boat_actor->actor_class.speed = 0.0f;
|
||||
}
|
||||
|
||||
static void aBT_arrive_call_end_wait_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
boat_demo->demo_act = aBTD_DEMO_PL_RIDE_OFF_START;
|
||||
boat_demo->demo_act = aBTD_DEMO_PL_RIDE_OFF_START;
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_off_start_wait_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
boat_actor->actor_class.child_actor = NULL;
|
||||
boat_actor->actor_class.child_actor = NULL;
|
||||
}
|
||||
|
||||
static void aBT_pl_ride_off_end_wait_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
boat_actor->roll_timer += 800;
|
||||
boat_actor->roll_timer += 800;
|
||||
}
|
||||
|
||||
static void aBT_anchor_init(BOAT_ACTOR* boat_actor, GAME_PLAY* play) {
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
BOAT_DEMO_ACTOR* boat_demo = (BOAT_DEMO_ACTOR*)boat_actor->actor_class.parent_actor;
|
||||
|
||||
boat_demo->demo_act = aBTD_DEMO_ANCHOR;
|
||||
mPlib_request_main_wait_type3((GAME*)play);
|
||||
boat_demo->demo_act = aBTD_DEMO_ANCHOR;
|
||||
mPlib_request_main_wait_type3((GAME*)play);
|
||||
}
|
||||
|
||||
static void aBT_setupAction(BOAT_ACTOR* boat_actor, GAME_PLAY* play, int action) {
|
||||
static aBT_INIT_PROC init_proc[aBT_ACTION_NUM] = {
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
&aBT_wait_init,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
&aBT_sitdown_end_wait_init,
|
||||
&aBT_move_wait_init,
|
||||
&aBT_move_init,
|
||||
&aBT_moment_init,
|
||||
&aBT_draw_up_init,
|
||||
&aBT_arrive_call_end_wait_init,
|
||||
&aBT_pl_ride_off_start_wait_init,
|
||||
&aBT_pl_ride_off_end_wait_init,
|
||||
&aBT_anchor_init
|
||||
};
|
||||
static aBT_INIT_PROC init_proc[aBT_ACTION_NUM] = {
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
&aBT_wait_init,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
(aBT_INIT_PROC)&none_proc1,
|
||||
&aBT_sitdown_end_wait_init,
|
||||
&aBT_move_wait_init,
|
||||
&aBT_move_init,
|
||||
&aBT_moment_init,
|
||||
&aBT_draw_up_init,
|
||||
&aBT_arrive_call_end_wait_init,
|
||||
&aBT_pl_ride_off_start_wait_init,
|
||||
&aBT_pl_ride_off_end_wait_init,
|
||||
&aBT_anchor_init,
|
||||
};
|
||||
|
||||
static aBT_PROC process[aBT_ACTION_NUM] = {
|
||||
&aBT_demo_ctrl_birth_wait,
|
||||
&aBT_wait,
|
||||
&aBT_pl_ride_move_start_wait,
|
||||
&aBT_pl_ride_move_end_wait,
|
||||
&aBT_pl_ride_on_start_wait,
|
||||
&aBT_pl_ride_on_end_wait,
|
||||
&aBT_sitdown_end_wait,
|
||||
&aBT_move_wait,
|
||||
&aBT_move,
|
||||
&aBT_move,
|
||||
&aBT_draw_up,
|
||||
&aBT_arrive_call_end_wait,
|
||||
&aBT_pl_ride_off_start_wait,
|
||||
&aBT_pl_ride_off_end_wait,
|
||||
&aBT_anchor
|
||||
};
|
||||
|
||||
boat_actor->action = action;
|
||||
boat_actor->action_proc = process[action];
|
||||
(*init_proc[action])(boat_actor, play);
|
||||
static aBT_PROC process[aBT_ACTION_NUM] = {
|
||||
&aBT_demo_ctrl_birth_wait,
|
||||
&aBT_wait,
|
||||
&aBT_pl_ride_move_start_wait,
|
||||
&aBT_pl_ride_move_end_wait,
|
||||
&aBT_pl_ride_on_start_wait,
|
||||
&aBT_pl_ride_on_end_wait,
|
||||
&aBT_sitdown_end_wait,
|
||||
&aBT_move_wait,
|
||||
&aBT_move,
|
||||
&aBT_move,
|
||||
&aBT_draw_up,
|
||||
&aBT_arrive_call_end_wait,
|
||||
&aBT_pl_ride_off_start_wait,
|
||||
&aBT_pl_ride_off_end_wait,
|
||||
&aBT_anchor,
|
||||
};
|
||||
|
||||
boat_actor->action = action;
|
||||
boat_actor->action_proc = process[action];
|
||||
(*init_proc[action])(boat_actor, play);
|
||||
}
|
||||
|
||||
static void aBT_actor_move(ACTOR* actorx, GAME* game) {
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
BOAT_ACTOR* boat_actor = (BOAT_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
aBT_anime_proc(boat_actor);
|
||||
aBT_position_move(boat_actor);
|
||||
aBT_roll_ctrl(boat_actor);
|
||||
(*boat_actor->action_proc)(boat_actor, play);
|
||||
aBT_passenger_ctrl(boat_actor);
|
||||
aBT_anime_proc(boat_actor);
|
||||
aBT_position_move(boat_actor);
|
||||
aBT_roll_ctrl(boat_actor);
|
||||
(*boat_actor->action_proc)(boat_actor, play);
|
||||
aBT_passenger_ctrl(boat_actor);
|
||||
|
||||
if (boat_actor->action == -1) {
|
||||
Actor_delete(actorx);
|
||||
}
|
||||
if (boat_actor->action == -1) {
|
||||
Actor_delete(actorx);
|
||||
}
|
||||
}
|
||||
|
||||
static void aBT_actor_init(ACTOR* actorx, GAME* game) {
|
||||
mFI_SetFG_common(DUMMY_BOAT, actorx->home.position, FALSE);
|
||||
aBT_actor_move(actorx, game);
|
||||
actorx->mv_proc = &aBT_actor_move;
|
||||
mFI_SetFG_common(DUMMY_BOAT, actorx->home.position, FALSE);
|
||||
aBT_actor_move(actorx, game);
|
||||
actorx->mv_proc = &aBT_actor_move;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,13 @@ static f32 Cottage_npc_light_aim(STRUCTURE_ACTOR* cottage) {
|
||||
schedule = mNPS_get_schedule_area(&island_villager->id);
|
||||
now_sec = Common_Get(time.now_sec);
|
||||
|
||||
// Aus changes the NPC islander cottage's lights to be on as long as they aren't asleep,
|
||||
// instead of only being on when they're inside and awake.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (schedule != NULL && schedule->current_type != mNPS_SCHED_SLEEP && island_villager->is_home != FALSE &&
|
||||
#else
|
||||
if (schedule != NULL && schedule->current_type == mNPS_SCHED_IN_HOUSE && island_villager->is_home != FALSE &&
|
||||
#endif
|
||||
(now_sec >= (18 * mTM_SECONDS_IN_HOUR) || now_sec <= (5 * mTM_SECONDS_IN_HOUR)) && cottage->request_type != Cottage_ACTION_OPEN_PL_OUT_INIT) {
|
||||
return 1.0f;
|
||||
}
|
||||
@@ -458,7 +464,11 @@ static void Cottage_my_set_bgOffset(STRUCTURE_ACTOR* cottage, int offs) {
|
||||
pos.x = cottage->actor_class.home.position.x + ((mFI_UT_WORLDSIZE_X_F * (f32)unit_offset[i].x));
|
||||
pos.z = cottage->actor_class.home.position.z + ((mFI_UT_WORLDSIZE_Z_F * (f32)unit_offset[i].z));
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
mCoBG_SetPluss5PointOffset_file(pos, rewrite_data[i], __FILE__, 790);
|
||||
#else
|
||||
mCoBG_SetPluss5PointOffset_file(pos, rewrite_data[i], __FILE__, 787);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,6 +498,18 @@ static void Cottage_npc_set_bgOffset(STRUCTURE_ACTOR* cottage, int offs) {
|
||||
|
||||
offset = height_table[offs];
|
||||
for (i = 0; i < 3; i++) {
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
pos.z = cottage->actor_class.home.position.z + addZ[i];
|
||||
|
||||
pos.x = cottage->actor_class.home.position.x + addX[0];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, offset[0], __FILE__, 839);
|
||||
|
||||
pos.x = cottage->actor_class.home.position.x + addX[1];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, offset[1], __FILE__, 843);
|
||||
|
||||
pos.x = cottage->actor_class.home.position.x + addX[2];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, offset[2], __FILE__, 847);
|
||||
#else
|
||||
pos.z = cottage->actor_class.home.position.z + addZ[i];
|
||||
|
||||
pos.x = cottage->actor_class.home.position.x + addX[0];
|
||||
@@ -498,6 +520,7 @@ static void Cottage_npc_set_bgOffset(STRUCTURE_ACTOR* cottage, int offs) {
|
||||
|
||||
pos.x = cottage->actor_class.home.position.x + addX[2];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, offset[2], __FILE__, 844);
|
||||
#endif
|
||||
|
||||
offset += 3;
|
||||
}
|
||||
|
||||
+47
-100
@@ -11,18 +11,17 @@ static void aDOU_actor_init(ACTOR*, GAME*);
|
||||
static void aDOU_actor_draw(ACTOR*, GAME*);
|
||||
|
||||
ACTOR_PROFILE Douzou_Profile = {
|
||||
mAc_PROFILE_DOUZOU,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_TA_SET,
|
||||
DOUZOU,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(STRUCTURE_ACTOR),
|
||||
|
||||
&aDOU_actor_ct,
|
||||
&aDOU_actor_dt,
|
||||
&aDOU_actor_init,
|
||||
&aDOU_actor_draw,
|
||||
NULL
|
||||
mAc_PROFILE_DOUZOU,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_TA_SET,
|
||||
DOUZOU,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(STRUCTURE_ACTOR),
|
||||
&aDOU_actor_ct,
|
||||
&aDOU_actor_dt,
|
||||
&aDOU_actor_init,
|
||||
&aDOU_actor_draw,
|
||||
NULL,
|
||||
};
|
||||
|
||||
extern u8 obj_s_douzou_b1_tex_pic_i4[];
|
||||
@@ -60,39 +59,15 @@ extern u8 obj_w_douzou_b7_tex_pic_i4[];
|
||||
extern u8 obj_w_douzou_g8_tex_pic_i4[];
|
||||
|
||||
static u8* eye_tbl[2 * (mPr_SEX_NUM * mPr_FACE_TYPE_NUM)] = {
|
||||
obj_s_douzou_b1_tex_pic_i4,
|
||||
obj_s_douzou_b2_tex_pic_i4,
|
||||
obj_s_douzou_b3_tex_pic_i4,
|
||||
obj_s_douzou_b4_tex_pic_i4,
|
||||
obj_s_douzou_b5_tex_pic_i4,
|
||||
obj_s_douzou_b6_tex_pic_i4,
|
||||
obj_s_douzou_b7_tex_pic_i4,
|
||||
obj_s_douzou_b8_tex_pic_i4,
|
||||
obj_s_douzou_g1_tex_pic_i4,
|
||||
obj_s_douzou_g2_tex_pic_i4,
|
||||
obj_s_douzou_g3_tex_pic_i4,
|
||||
obj_s_douzou_g4_tex_pic_i4,
|
||||
obj_s_douzou_g5_tex_pic_i4,
|
||||
obj_s_douzou_g6_tex_pic_i4,
|
||||
obj_s_douzou_b7_tex_pic_i4,
|
||||
obj_s_douzou_g8_tex_pic_i4,
|
||||
obj_s_douzou_b1_tex_pic_i4, obj_s_douzou_b2_tex_pic_i4, obj_s_douzou_b3_tex_pic_i4, obj_s_douzou_b4_tex_pic_i4,
|
||||
obj_s_douzou_b5_tex_pic_i4, obj_s_douzou_b6_tex_pic_i4, obj_s_douzou_b7_tex_pic_i4, obj_s_douzou_b8_tex_pic_i4,
|
||||
obj_s_douzou_g1_tex_pic_i4, obj_s_douzou_g2_tex_pic_i4, obj_s_douzou_g3_tex_pic_i4, obj_s_douzou_g4_tex_pic_i4,
|
||||
obj_s_douzou_g5_tex_pic_i4, obj_s_douzou_g6_tex_pic_i4, obj_s_douzou_b7_tex_pic_i4, obj_s_douzou_g8_tex_pic_i4,
|
||||
|
||||
obj_w_douzou_b1_tex_pic_i4,
|
||||
obj_w_douzou_b2_tex_pic_i4,
|
||||
obj_w_douzou_b3_tex_pic_i4,
|
||||
obj_w_douzou_b4_tex_pic_i4,
|
||||
obj_w_douzou_b5_tex_pic_i4,
|
||||
obj_w_douzou_b6_tex_pic_i4,
|
||||
obj_w_douzou_b7_tex_pic_i4,
|
||||
obj_w_douzou_b8_tex_pic_i4,
|
||||
obj_w_douzou_g1_tex_pic_i4,
|
||||
obj_w_douzou_g2_tex_pic_i4,
|
||||
obj_w_douzou_g3_tex_pic_i4,
|
||||
obj_w_douzou_g4_tex_pic_i4,
|
||||
obj_w_douzou_g5_tex_pic_i4,
|
||||
obj_w_douzou_g6_tex_pic_i4,
|
||||
obj_w_douzou_b7_tex_pic_i4,
|
||||
obj_w_douzou_g8_tex_pic_i4,
|
||||
obj_w_douzou_b1_tex_pic_i4, obj_w_douzou_b2_tex_pic_i4, obj_w_douzou_b3_tex_pic_i4, obj_w_douzou_b4_tex_pic_i4,
|
||||
obj_w_douzou_b5_tex_pic_i4, obj_w_douzou_b6_tex_pic_i4, obj_w_douzou_b7_tex_pic_i4, obj_w_douzou_b8_tex_pic_i4,
|
||||
obj_w_douzou_g1_tex_pic_i4, obj_w_douzou_g2_tex_pic_i4, obj_w_douzou_g3_tex_pic_i4, obj_w_douzou_g4_tex_pic_i4,
|
||||
obj_w_douzou_g5_tex_pic_i4, obj_w_douzou_g6_tex_pic_i4, obj_w_douzou_b7_tex_pic_i4, obj_w_douzou_g8_tex_pic_i4,
|
||||
};
|
||||
|
||||
extern u8 obj_s_douzou_bm1_tex_pic_i4[];
|
||||
@@ -106,39 +81,15 @@ extern u8 obj_w_douzou_gm1_tex_pic_i4[];
|
||||
extern u8 obj_w_douzou_gm2_tex_pic_i4[];
|
||||
|
||||
static u8* mouth_tbl[2 * (mPr_SEX_NUM * mPr_FACE_TYPE_NUM)] = {
|
||||
obj_s_douzou_bm2_tex_pic_i4,
|
||||
obj_s_douzou_bm1_tex_pic_i4,
|
||||
obj_s_douzou_bm1_tex_pic_i4,
|
||||
obj_s_douzou_bm2_tex_pic_i4,
|
||||
obj_s_douzou_bm1_tex_pic_i4,
|
||||
obj_s_douzou_bm1_tex_pic_i4,
|
||||
obj_s_douzou_bm1_tex_pic_i4,
|
||||
obj_s_douzou_bm2_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm2_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_bm2_tex_pic_i4, obj_s_douzou_bm1_tex_pic_i4, obj_s_douzou_bm1_tex_pic_i4, obj_s_douzou_bm2_tex_pic_i4,
|
||||
obj_s_douzou_bm1_tex_pic_i4, obj_s_douzou_bm1_tex_pic_i4, obj_s_douzou_bm1_tex_pic_i4, obj_s_douzou_bm2_tex_pic_i4,
|
||||
obj_s_douzou_gm1_tex_pic_i4, obj_s_douzou_gm1_tex_pic_i4, obj_s_douzou_gm1_tex_pic_i4, obj_s_douzou_gm1_tex_pic_i4,
|
||||
obj_s_douzou_gm2_tex_pic_i4, obj_s_douzou_gm1_tex_pic_i4, obj_s_douzou_gm1_tex_pic_i4, obj_s_douzou_gm1_tex_pic_i4,
|
||||
|
||||
obj_w_douzou_bm2_tex_pic_i4,
|
||||
obj_w_douzou_bm1_tex_pic_i4,
|
||||
obj_w_douzou_bm1_tex_pic_i4,
|
||||
obj_w_douzou_bm2_tex_pic_i4,
|
||||
obj_w_douzou_bm1_tex_pic_i4,
|
||||
obj_w_douzou_bm1_tex_pic_i4,
|
||||
obj_w_douzou_bm1_tex_pic_i4,
|
||||
obj_w_douzou_bm2_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm2_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4
|
||||
obj_w_douzou_bm2_tex_pic_i4, obj_w_douzou_bm1_tex_pic_i4, obj_w_douzou_bm1_tex_pic_i4, obj_w_douzou_bm2_tex_pic_i4,
|
||||
obj_w_douzou_bm1_tex_pic_i4, obj_w_douzou_bm1_tex_pic_i4, obj_w_douzou_bm1_tex_pic_i4, obj_w_douzou_bm2_tex_pic_i4,
|
||||
obj_w_douzou_gm1_tex_pic_i4, obj_w_douzou_gm1_tex_pic_i4, obj_w_douzou_gm1_tex_pic_i4, obj_w_douzou_gm1_tex_pic_i4,
|
||||
obj_w_douzou_gm2_tex_pic_i4, obj_w_douzou_gm1_tex_pic_i4, obj_w_douzou_gm1_tex_pic_i4, obj_w_douzou_gm1_tex_pic_i4,
|
||||
};
|
||||
|
||||
static f32 zpostbl[mHS_HOUSE_NUM] = { 200.0f, 200.0f, 280.0f, 280.0f };
|
||||
@@ -147,12 +98,8 @@ static f32 xpostbl[mHS_HOUSE_NUM] = { 0.0f, 200.0f, -40.0f, 160.0f };
|
||||
extern Vtx obj_s_douzou_shadow_v[];
|
||||
extern Gfx obj_s_douzou_shadow_model[];
|
||||
static u8 aDOU_shadow_vtx_fix_flg_table[8] = { TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE };
|
||||
static bIT_ShadowData_c aDOU_shadow_data = {
|
||||
8, aDOU_shadow_vtx_fix_flg_table,
|
||||
60.0f,
|
||||
obj_s_douzou_shadow_v,
|
||||
obj_s_douzou_shadow_model
|
||||
};
|
||||
static bIT_ShadowData_c aDOU_shadow_data = { 8, aDOU_shadow_vtx_fix_flg_table, 60.0f, obj_s_douzou_shadow_v,
|
||||
obj_s_douzou_shadow_model };
|
||||
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_s_douzou;
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_w_douzou;
|
||||
@@ -161,34 +108,34 @@ static void aDOU_set_bgOffset(ACTOR*, int);
|
||||
static void aDOU_setup_action(ACTOR*, int);
|
||||
static void aDOU_keep_item(ACTOR*);
|
||||
|
||||
|
||||
static void aDOU_actor_ct(ACTOR* actor, GAME* game) {
|
||||
static cKF_Skeleton_R_c* skl[2] = { &cKF_bs_r_obj_s_douzou, &cKF_bs_r_obj_w_douzou };
|
||||
static cKF_Skeleton_R_c* skl[2] = { &cKF_bs_r_obj_s_douzou, &cKF_bs_r_obj_w_douzou };
|
||||
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)actor;
|
||||
xyz_t wpos;
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)actor;
|
||||
xyz_t wpos;
|
||||
|
||||
douzou->season = Common_Get(time).season;
|
||||
cKF_SkeletonInfo_R_ct(&douzou->keyframe, skl[douzou->season == mTM_SEASON_WINTER], NULL, douzou->work_area, douzou->morph_area);
|
||||
aDOU_set_bgOffset(actor, 1);
|
||||
douzou->season = Common_Get(time).season;
|
||||
cKF_SkeletonInfo_R_ct(&douzou->keyframe, skl[douzou->season == mTM_SEASON_WINTER], NULL, douzou->work_area,
|
||||
douzou->morph_area);
|
||||
aDOU_set_bgOffset(actor, 1);
|
||||
|
||||
wpos.x = actor->world.position.x + xpostbl[0];
|
||||
wpos.y = actor->world.position.y;
|
||||
wpos.z = actor->world.position.z + zpostbl[0];
|
||||
wpos.x = actor->world.position.x + xpostbl[0];
|
||||
wpos.y = actor->world.position.y;
|
||||
wpos.z = actor->world.position.z + zpostbl[0];
|
||||
|
||||
actor->world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(wpos, 0.0f);
|
||||
actor->cull_width = 850.0f;
|
||||
actor->cull_radius = 850.0f;
|
||||
actor->world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(wpos, 0.0f);
|
||||
actor->cull_width = 850.0f;
|
||||
actor->cull_radius = 850.0f;
|
||||
|
||||
aDOU_setup_action((ACTOR*)douzou, 0);
|
||||
cKF_SkeletonInfo_R_play(&douzou->keyframe);
|
||||
aDOU_keep_item(actor);
|
||||
aDOU_setup_action((ACTOR*)douzou, 0);
|
||||
cKF_SkeletonInfo_R_play(&douzou->keyframe);
|
||||
aDOU_keep_item(actor);
|
||||
}
|
||||
|
||||
static void aDOU_actor_dt(ACTOR* actor, GAME* game) {
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)actor;
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)actor;
|
||||
|
||||
cKF_SkeletonInfo_R_dt(&douzou->keyframe);
|
||||
cKF_SkeletonInfo_R_dt(&douzou->keyframe);
|
||||
}
|
||||
|
||||
#include "../src/actor/ac_douzou_move.c_inc"
|
||||
|
||||
+108
-111
@@ -4,143 +4,140 @@
|
||||
#include "bg_item_h.h"
|
||||
#include "m_house.h"
|
||||
|
||||
static int aDOU_actor_draw_before(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape,
|
||||
u8* joint_flags, void* arg, s_xyz* joint_rot, xyz_t* joint_pos) {
|
||||
static rgba_t prmcolor[mHS_HOUSE_NUM] = {
|
||||
{ 255, 255, 0, 255 },
|
||||
{ 200, 200, 255, 255 },
|
||||
{ 255, 100, 50, 255 },
|
||||
{ 0, 255, 40, 255 },
|
||||
};
|
||||
|
||||
static int aDOU_actor_draw_before(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape, u8* joint_flags, void* arg, s_xyz* joint_rot, xyz_t* joint_pos) {
|
||||
static rgba_t prmcolor[mHS_HOUSE_NUM] = {
|
||||
{ 255, 255, 0, 255 },
|
||||
{ 200, 200, 255, 255 },
|
||||
{ 255, 100, 50, 255 },
|
||||
{ 0, 255, 40, 255 }
|
||||
};
|
||||
static rgba_t envcolor[mHS_HOUSE_NUM] = {
|
||||
{ 100, 30, 0, 255 },
|
||||
{ 80, 80, 100, 255 },
|
||||
{ 40, 20, 0, 255 },
|
||||
{ 0, 30, 30, 255 },
|
||||
};
|
||||
|
||||
static rgba_t envcolor[mHS_HOUSE_NUM] = {
|
||||
{ 100, 30, 0, 255 },
|
||||
{ 80, 80, 100, 255 },
|
||||
{ 40, 20, 0, 255 },
|
||||
{ 0, 30, 30, 255 }
|
||||
};
|
||||
static f32 scltbl[mHS_HOUSE_NUM] = {
|
||||
1.00f,
|
||||
0.85f,
|
||||
0.70f,
|
||||
0.55f,
|
||||
};
|
||||
|
||||
static f32 scltbl[mHS_HOUSE_NUM] = {
|
||||
1.00f,
|
||||
0.85f,
|
||||
0.70f,
|
||||
0.55f
|
||||
};
|
||||
GRAPH* graph = game->graph;
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)arg;
|
||||
int draw = FALSE;
|
||||
int color = douzou->arg1;
|
||||
|
||||
GRAPH* graph = game->graph;
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)arg;
|
||||
int draw = FALSE;
|
||||
int color = douzou->arg1;
|
||||
|
||||
if (joint_idx == 2) {
|
||||
f32 scale = scltbl[color];
|
||||
Matrix_scale(scale, scale, scale, MTX_MULT);
|
||||
}
|
||||
|
||||
/* Decide which sex of model to draw (keyframes [2, 4] are male, [5, 7] are female) */
|
||||
if (joint_idx == 2 || joint_idx == 3 || joint_idx == 4) {
|
||||
/* Male actor draw check */
|
||||
if (douzou->arg0 >= mPr_FACE_TYPE_NUM) {
|
||||
*joint_shape = NULL;
|
||||
if (joint_idx == 2) {
|
||||
f32 scale = scltbl[color];
|
||||
Matrix_scale(scale, scale, scale, MTX_MULT);
|
||||
}
|
||||
else {
|
||||
draw = TRUE;
|
||||
|
||||
/* Decide which sex of model to draw (keyframes [2, 4] are male, [5, 7] are female) */
|
||||
if (joint_idx == 2 || joint_idx == 3 || joint_idx == 4) {
|
||||
/* Male actor draw check */
|
||||
if (douzou->arg0 >= mPr_FACE_TYPE_NUM) {
|
||||
*joint_shape = NULL;
|
||||
} else {
|
||||
draw = TRUE;
|
||||
}
|
||||
} else if (joint_idx == 5 || joint_idx == 6 || joint_idx == 7) {
|
||||
/* Female actor draw check */
|
||||
if (douzou->arg0 <= mPr_FACE_TYPE7) {
|
||||
*joint_shape = NULL;
|
||||
} else {
|
||||
draw = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (joint_idx == 5 || joint_idx == 6 || joint_idx == 7) {
|
||||
/* Female actor draw check */
|
||||
if (douzou->arg0 <= mPr_FACE_TYPE7) {
|
||||
*joint_shape = NULL;
|
||||
|
||||
if (draw || joint_idx == 8) {
|
||||
Gfx* gfx;
|
||||
OPEN_DISP(graph);
|
||||
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetEnvColor(gfx++, envcolor[color].r, envcolor[color].g, envcolor[color].b, 255);
|
||||
gDPSetPrimColor(gfx++, 0, 255, prmcolor[color].r, prmcolor[color].g, prmcolor[color].b, prmcolor[color].a);
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
else {
|
||||
draw = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (draw || joint_idx == 8) {
|
||||
Gfx* gfx;
|
||||
OPEN_DISP(graph);
|
||||
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetEnvColor(gfx++, envcolor[color].r, envcolor[color].g, envcolor[color].b, 255);
|
||||
gDPSetPrimColor(gfx++, 0, 255, prmcolor[color].r, prmcolor[color].g, prmcolor[color].b, prmcolor[color].a);
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void aDOU_actor_draw(ACTOR* actor, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
GRAPH* graph = game->graph;
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)actor;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &douzou->keyframe;
|
||||
u16* pal = (*Common_Get(clip).structure_clip->get_pal_segment_proc)(aSTR_PAL_DOUZOU_DAI);
|
||||
int disp_joints = keyframe->skeleton->num_shown_joints;
|
||||
Mtx* m;
|
||||
int i;
|
||||
|
||||
_texture_z_light_fog_prim(graph);
|
||||
|
||||
for (i = 0; i < mHS_HOUSE_NUM; i++) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
GRAPH* graph = game->graph;
|
||||
STRUCTURE_ACTOR* douzou = (STRUCTURE_ACTOR*)actor;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &douzou->keyframe;
|
||||
u16* pal = (*Common_Get(clip).structure_clip->get_pal_segment_proc)(aSTR_PAL_DOUZOU_DAI);
|
||||
int disp_joints = keyframe->skeleton->num_shown_joints;
|
||||
Mtx* m;
|
||||
int type;
|
||||
int eye_type;
|
||||
int mouth_type;
|
||||
if (aDOU_set_check(i)) {
|
||||
m = GRAPH_ALLOC_TYPE(graph, Mtx, disp_joints);
|
||||
int i;
|
||||
|
||||
if (m == NULL) {
|
||||
return;
|
||||
}
|
||||
_texture_z_light_fog_prim(graph);
|
||||
|
||||
douzou->arg0 = aDOU_get_douzou_type(i);
|
||||
type = douzou->arg0;
|
||||
mouth_type = type;
|
||||
eye_type = type;
|
||||
for (i = 0; i < mHS_HOUSE_NUM; i++) {
|
||||
if (aDOU_set_check(i)) {
|
||||
m = GRAPH_ALLOC_TYPE(graph, Mtx, disp_joints);
|
||||
|
||||
if (douzou->season == mTM_SEASON_WINTER) {
|
||||
mouth_type = type + mPr_SEX_NUM * mPr_FACE_TYPE_NUM;
|
||||
eye_type = type + mPr_SEX_NUM * mPr_FACE_TYPE_NUM;
|
||||
}
|
||||
if (m == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
douzou->arg1 = aDOU_get_color(i);
|
||||
douzou->arg0 = aDOU_get_douzou_type(i);
|
||||
type = douzou->arg0;
|
||||
mouth_type = type;
|
||||
eye_type = type;
|
||||
|
||||
Matrix_push();
|
||||
if (douzou->season == mTM_SEASON_WINTER) {
|
||||
mouth_type = type + mPr_SEX_NUM * mPr_FACE_TYPE_NUM;
|
||||
eye_type = type + mPr_SEX_NUM * mPr_FACE_TYPE_NUM;
|
||||
}
|
||||
|
||||
{
|
||||
Gfx* gfx;
|
||||
douzou->arg1 = aDOU_get_color(i);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_A, pal);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_8, eye_tbl[eye_type]);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_9, mouth_tbl[mouth_type]);
|
||||
Matrix_push();
|
||||
|
||||
Matrix_translate(xpostbl[i] * 100.0f, 0.0f, zpostbl[i] * 100.0f, MTX_MULT);
|
||||
{
|
||||
Gfx* gfx;
|
||||
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
OPEN_DISP(graph);
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
|
||||
{
|
||||
xyz_t wpos;
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
xyz_t_move(&wpos, &actor->world.position);
|
||||
wpos.x += xpostbl[i];
|
||||
wpos.z += zpostbl[i];
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_A, pal);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_8, eye_tbl[eye_type]);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_9, mouth_tbl[mouth_type]);
|
||||
|
||||
Setpos_HiliteReflect_init(&wpos, play);
|
||||
}
|
||||
Matrix_translate(xpostbl[i] * 100.0f, 0.0f, zpostbl[i] * 100.0f, MTX_MULT);
|
||||
|
||||
cKF_Si3_draw_R_SV(game, keyframe, m, &aDOU_actor_draw_before, NULL, actor);
|
||||
(*Common_Get(clip).bg_item_clip->draw_shadow_proc)(game, &aDOU_shadow_data, FALSE);
|
||||
Matrix_pull();
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
{
|
||||
xyz_t wpos;
|
||||
|
||||
xyz_t_move(&wpos, &actor->world.position);
|
||||
wpos.x += xpostbl[i];
|
||||
wpos.z += zpostbl[i];
|
||||
|
||||
Setpos_HiliteReflect_init(&wpos, play);
|
||||
}
|
||||
|
||||
cKF_Si3_draw_R_SV(game, keyframe, m, &aDOU_actor_draw_before, NULL, actor);
|
||||
(*Common_Get(clip).bg_item_clip->draw_shadow_proc)(game, &aDOU_shadow_data, FALSE);
|
||||
Matrix_pull();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3665,6 +3665,7 @@ static int river_start_block(int* bx, int* bz) {
|
||||
}
|
||||
|
||||
static void river_stream(u8* blocks, int count) {
|
||||
int n = count;
|
||||
int river_bx;
|
||||
int river_bz;
|
||||
int i;
|
||||
@@ -3672,7 +3673,7 @@ static void river_stream(u8* blocks, int count) {
|
||||
|
||||
// zero out block data
|
||||
j = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
for (count; count > 0; count--) {
|
||||
blocks[j + 0] = 0;
|
||||
blocks[j + 1] = 0;
|
||||
j += 2;
|
||||
@@ -3681,7 +3682,7 @@ static void river_stream(u8* blocks, int count) {
|
||||
// find the start block
|
||||
if (river_start_block(&river_bx, &river_bz)) {
|
||||
// trace the river
|
||||
for (i = 1; i < count && river_bz < 7; i++) {
|
||||
for (i = 1; i < n && river_bz < 7; i++) {
|
||||
blocks[(i - 1) * 2 + 0] = river_bx;
|
||||
blocks[(i - 1) * 2 + 1] = river_bz;
|
||||
|
||||
|
||||
+380
-389
@@ -15,45 +15,45 @@ static void Bg_Draw_Actor_move(ACTOR* actorx, GAME* game);
|
||||
static void Bg_Draw_Actor_draw(ACTOR* actorx, GAME* game);
|
||||
|
||||
ACTOR_PROFILE Field_Draw_Profile = {
|
||||
mAc_PROFILE_FIELD_DRAW,
|
||||
ACTOR_PART_FG,
|
||||
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(FIELD_DRAW_ACTOR),
|
||||
&Bg_Draw_Actor_ct,
|
||||
&Bg_Draw_Actor_dt,
|
||||
&Bg_Draw_Actor_move,
|
||||
&Bg_Draw_Actor_draw,
|
||||
NULL
|
||||
mAc_PROFILE_FIELD_DRAW,
|
||||
ACTOR_PART_FG,
|
||||
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(FIELD_DRAW_ACTOR),
|
||||
&Bg_Draw_Actor_ct,
|
||||
&Bg_Draw_Actor_dt,
|
||||
&Bg_Draw_Actor_move,
|
||||
&Bg_Draw_Actor_draw,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void aFD_MakeMarinScrollInfo(ACTOR* actorx, GAME* game);
|
||||
|
||||
enum {
|
||||
aFD_SEARCH_FULL,
|
||||
aFD_SEARCH_CURRENT,
|
||||
aFD_SEARCH_ROW,
|
||||
aFD_SEARCH_FULL,
|
||||
aFD_SEARCH_CURRENT,
|
||||
aFD_SEARCH_ROW,
|
||||
|
||||
aFD_SEARCH_NUM
|
||||
aFD_SEARCH_NUM
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int sound_source_no;
|
||||
int bx;
|
||||
int bz;
|
||||
f32 dist;
|
||||
int sound_source_no;
|
||||
int bx;
|
||||
int bz;
|
||||
f32 dist;
|
||||
} aFD_ongen_info_c;
|
||||
|
||||
typedef struct {
|
||||
int sound_source_no;
|
||||
int bx;
|
||||
int bz;
|
||||
int sound_source_no;
|
||||
int bx;
|
||||
int bz;
|
||||
} aFD_ongen_info2_c;
|
||||
|
||||
typedef struct {
|
||||
s16 offset_x;
|
||||
s16 offset_z;
|
||||
s16 offset_x;
|
||||
s16 offset_z;
|
||||
} aFD_offset_c;
|
||||
|
||||
/*
|
||||
@@ -62,497 +62,488 @@ typedef struct {
|
||||
7 6 8
|
||||
*/
|
||||
static aFD_offset_c aFD_block_offset_table[] = {
|
||||
{ 0, 0 }, // current
|
||||
{ -1, 0 }, // left
|
||||
{ 1, 0 }, // right
|
||||
{ 0, -1 }, // top
|
||||
{ -1, -1 }, // top-left
|
||||
{ 1, -1 }, // top-right
|
||||
{ 0, 1 }, // bot
|
||||
{ -1, 1 }, // bot-left
|
||||
{ 1, 1 } // bot-right
|
||||
{ 0, 0 }, // current
|
||||
{ -1, 0 }, // left
|
||||
{ 1, 0 }, // right
|
||||
{ 0, -1 }, // top
|
||||
{ -1, -1 }, // top-left
|
||||
{ 1, -1 }, // top-right
|
||||
{ 0, 1 }, // bot
|
||||
{ -1, 1 }, // bot-left
|
||||
{ 1, 1 }, // bot-right
|
||||
};
|
||||
|
||||
static Gfx* aFD_MakeEnvSetDisplayList(u8 r, u8 g, u8 b, u8 a, GAME* game) {
|
||||
Gfx* gfx = GRAPH_ALLOC_TYPE(game->graph, Gfx, 2);
|
||||
Gfx* gfx = GRAPH_ALLOC_TYPE(game->graph, Gfx, 2);
|
||||
|
||||
if (gfx != NULL) {
|
||||
gDPSetEnvColor(gfx + 0, r, g, b, a);
|
||||
gSPEndDisplayList(gfx + 1);
|
||||
return gfx;
|
||||
}
|
||||
if (gfx != NULL) {
|
||||
gDPSetEnvColor(gfx + 0, r, g, b, a);
|
||||
gSPEndDisplayList(gfx + 1);
|
||||
return gfx;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int aFD_OperateWaterSound(xyz_t* center_pos, ACTOR* actorx, s16 ongen_type, u8 se_no, f32 ofs_x, f32 ofs_z, int search_type) {
|
||||
static aFD_ongen_info_c dist_info[9 * mFM_SOUND_SOURCE_NUM];
|
||||
static int ongen_block_count_table[aFD_SEARCH_NUM] = { 9, 1, 3 };
|
||||
int res = FALSE;
|
||||
int search_clamped = search_type >= 0 && search_type < aFD_SEARCH_NUM ? search_type : aFD_SEARCH_FULL;
|
||||
int ongen_block_count = ongen_block_count_table[search_clamped];
|
||||
int i;
|
||||
int j;
|
||||
int source_num = 0;
|
||||
aFD_ongen_info2_c ongen_info[2] = { { -1, 0, 0 }, { -1, 0, 0 } };
|
||||
int bx;
|
||||
int bz;
|
||||
static int aFD_OperateWaterSound(xyz_t* center_pos, ACTOR* actorx, s16 ongen_type, u8 se_no, f32 ofs_x, f32 ofs_z,
|
||||
int search_type) {
|
||||
static aFD_ongen_info_c dist_info[9 * mFM_SOUND_SOURCE_NUM];
|
||||
static int ongen_block_count_table[aFD_SEARCH_NUM] = { 9, 1, 3 };
|
||||
int res = FALSE;
|
||||
int search_clamped = search_type >= 0 && search_type < aFD_SEARCH_NUM ? search_type : aFD_SEARCH_FULL;
|
||||
int ongen_block_count = ongen_block_count_table[search_clamped];
|
||||
int i;
|
||||
int j;
|
||||
int source_num = 0;
|
||||
aFD_ongen_info2_c ongen_info[2] = { { -1, 0, 0 }, { -1, 0, 0 } };
|
||||
int bx;
|
||||
int bz;
|
||||
int search_bx;
|
||||
int search_bz;
|
||||
f32 dx;
|
||||
f32 dz;
|
||||
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, *center_pos)) {
|
||||
for (i = 0; i < ongen_block_count; i++) {
|
||||
int search_bx = bx + aFD_block_offset_table[i].offset_x;
|
||||
int search_bz = bz + aFD_block_offset_table[i].offset_z;
|
||||
mFM_bg_sound_source_c* source = mFI_GetSoundSourcePBlockNum(search_bx, search_bz);
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, *center_pos)) {
|
||||
for (i = 0; i < ongen_block_count; i++) {
|
||||
int search_bx = bx + aFD_block_offset_table[i].offset_x;
|
||||
int search_bz = bz + aFD_block_offset_table[i].offset_z;
|
||||
mFM_bg_sound_source_c* source = mFI_GetSoundSourcePBlockNum(search_bx, search_bz);
|
||||
|
||||
if (source != NULL) {
|
||||
if (source != NULL) {
|
||||
for (j = 0; j < mFM_SOUND_SOURCE_NUM; j++) {
|
||||
if (source->kind == ongen_type) {
|
||||
aFD_ongen_info_c* info = &dist_info[source_num];
|
||||
f32 dx = center_pos->x - source->pos.x;
|
||||
f32 dz = center_pos->z - source->pos.z;
|
||||
|
||||
for (j = 0; j < mFM_SOUND_SOURCE_NUM; j++) {
|
||||
if (source->kind == ongen_type) {
|
||||
aFD_ongen_info_c* info = &dist_info[source_num++];
|
||||
f32 dx = center_pos->x - source->pos.x;
|
||||
f32 dz = center_pos->z - source->pos.z;
|
||||
source_num++;
|
||||
info->sound_source_no = j;
|
||||
info->bx = search_bx;
|
||||
info->bz = search_bz;
|
||||
info->dist = SQ(dx) + SQ(dz);
|
||||
}
|
||||
|
||||
info->sound_source_no = j;
|
||||
info->bx = search_bx;
|
||||
info->bz = search_bz;
|
||||
info->dist = (dx * dx) + (dz * dz);
|
||||
}
|
||||
|
||||
source++;
|
||||
source++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (source_num != 0) {
|
||||
int i;
|
||||
f32 closest_dist = 10000000.0f;
|
||||
int closest_idx = -1;
|
||||
|
||||
/* Find the closest sound */
|
||||
for (i = 0; i < source_num; i++) {
|
||||
if (dist_info[i].dist < closest_dist) {
|
||||
ongen_info[0].sound_source_no = dist_info[i].sound_source_no;
|
||||
ongen_info[0].bx = dist_info[i].bx;
|
||||
ongen_info[0].bz = dist_info[i].bz;
|
||||
|
||||
closest_idx = i;
|
||||
closest_dist = dist_info[i].dist;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the second closest sound (if any) */
|
||||
closest_dist = 10000000.0f;
|
||||
for (i = 0; i < source_num; i++) {
|
||||
if (i != closest_idx) {
|
||||
if (dist_info[i].dist < closest_dist) {
|
||||
ongen_info[1].sound_source_no = dist_info[i].sound_source_no;
|
||||
ongen_info[1].bx = dist_info[i].bx;
|
||||
ongen_info[1].bz = dist_info[i].bz;
|
||||
|
||||
closest_dist = dist_info[i].dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Start playing the sounds */
|
||||
for (i = 0; i < ARRAY_COUNT(ongen_info); i++) {
|
||||
aFD_ongen_info2_c* info = &ongen_info[i];
|
||||
|
||||
if (info->sound_source_no != -1) {
|
||||
u32 ongen_id = (u32)actorx + (mFI_GetBlockXMax() * info->bz + info->bx) * mFM_SOUND_SOURCE_NUM +
|
||||
info->sound_source_no;
|
||||
mFM_bg_sound_source_c* source = mFI_GetSoundSourcePBlockNum(info->bx, info->bz);
|
||||
|
||||
if (source != NULL) {
|
||||
xyz_t ongen_pos = source[info->sound_source_no].pos;
|
||||
|
||||
ongen_pos.x += ofs_x;
|
||||
ongen_pos.z += ofs_z;
|
||||
ongen_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(source[info->sound_source_no].pos, 0.0f) + 40.0f;
|
||||
sAdo_OngenPos(ongen_id, se_no, &ongen_pos);
|
||||
res = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (source_num != 0) {
|
||||
int closest_idx = -1;
|
||||
f32 closest_dist = 10000000.0f;
|
||||
|
||||
/* Find the closest sound */
|
||||
for (i = 0; i < source_num; i++) {
|
||||
if (dist_info[i].dist < closest_dist) {
|
||||
ongen_info[0].sound_source_no = dist_info[i].sound_source_no;
|
||||
ongen_info[0].bx = dist_info[i].bx;
|
||||
ongen_info[0].bz = dist_info[i].bz;
|
||||
|
||||
closest_idx = i;
|
||||
closest_dist = dist_info[i].dist;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the second closest sound (if any) */
|
||||
closest_dist = 10000000.0f;
|
||||
for (i = 0; i < source_num; i++) {
|
||||
if (i != closest_idx) {
|
||||
if (dist_info[i].dist < closest_dist) {
|
||||
ongen_info[1].sound_source_no = dist_info[i].sound_source_no;
|
||||
ongen_info[1].bx = dist_info[i].bx;
|
||||
ongen_info[1].bz = dist_info[i].bz;
|
||||
|
||||
closest_dist = dist_info[i].dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Start playing the sounds */
|
||||
for (i = 0; i < ARRAY_COUNT(ongen_info); i++) {
|
||||
aFD_ongen_info2_c* info = &ongen_info[i];
|
||||
|
||||
if (info->sound_source_no != -1) {
|
||||
u32 ongen_id = (u32)actorx + (mFI_GetBlockXMax() * info->bz + info->bx) * mFM_SOUND_SOURCE_NUM + info->sound_source_no;
|
||||
mFM_bg_sound_source_c* source = mFI_GetSoundSourcePBlockNum(info->bx, info->bz);
|
||||
|
||||
if (source != NULL) {
|
||||
xyz_t ongen_pos = source[info->sound_source_no].pos;
|
||||
|
||||
ongen_pos.x += ofs_x;
|
||||
ongen_pos.z += ofs_z;
|
||||
ongen_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(source[info->sound_source_no].pos, 0.0f) + 40.0f;
|
||||
sAdo_OngenPos(ongen_id, se_no, &ongen_pos);
|
||||
res = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static f32 aFD_position_offset = 0.0f;
|
||||
|
||||
static void aFD_SetActorPosition(ACTOR* actorx, GAME_PLAY* play) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
|
||||
actorx->world.position = player->actor_class.world.position;
|
||||
actorx->world.position.y += aFD_position_offset;
|
||||
actorx->world.position = player->actor_class.world.position;
|
||||
actorx->world.position.y += aFD_position_offset;
|
||||
}
|
||||
|
||||
static void aFD_PrepareFieldDraw(ACTOR* actorx, GAME* game) {
|
||||
/*
|
||||
6 7 8
|
||||
3 4 5
|
||||
0 1 2
|
||||
*/
|
||||
static aFD_offset_c draw_block_offset_table[] = {
|
||||
{ -1, 1 }, // bot-left
|
||||
{ 0, 1 }, // bot
|
||||
{ 1, 1 }, // bot-right
|
||||
{ -1, 0 }, // left
|
||||
{ 0, 0 }, // current
|
||||
{ 1, 0 }, // right
|
||||
{ -1, -1 }, // top-left
|
||||
{ 0, -1 }, // top
|
||||
{ 1, -1 } // top-right
|
||||
};
|
||||
/*
|
||||
6 7 8
|
||||
3 4 5
|
||||
0 1 2
|
||||
*/
|
||||
static aFD_offset_c draw_block_offset_table[] = {
|
||||
{ -1, 1 }, // bot-left
|
||||
{ 0, 1 }, // bot
|
||||
{ 1, 1 }, // bot-right
|
||||
{ -1, 0 }, // left
|
||||
{ 0, 0 }, // current
|
||||
{ 1, 0 }, // right
|
||||
{ -1, -1 }, // top-left
|
||||
{ 0, -1 }, // top
|
||||
{ 1, -1 }, // top-right
|
||||
};
|
||||
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_block_c* block = field_draw->block;
|
||||
mFM_field_draw_info_c* draw_info = mFI_BGDisplayListTop();
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
int bx;
|
||||
int bz;
|
||||
int i;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_block_c* block = field_draw->block;
|
||||
mFM_field_draw_info_c* draw_info = mFI_BGDisplayListTop();
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
int bx;
|
||||
int bz;
|
||||
int i;
|
||||
|
||||
mFI_Wpos2BlockNum(&bx, &bz, player->actor_class.world.position);
|
||||
aFD_SetActorPosition(actorx, play);
|
||||
mFI_Wpos2BlockNum(&bx, &bz, player->actor_class.world.position);
|
||||
aFD_SetActorPosition(actorx, play);
|
||||
|
||||
for (i = 0; i < aFD_BLOCK_DRAW_NUM; i++) {
|
||||
block->bx = bx + draw_block_offset_table[i].offset_x;
|
||||
block->bz = bz + draw_block_offset_table[i].offset_z;
|
||||
mFI_BkNum2WposXZ(&block->wpos.x, &block->wpos.z, block->bx, block->bz);
|
||||
block->wpos.y = mFI_BkNum2BaseHeight(block->bx, block->bz);
|
||||
block->exist = TRUE;
|
||||
block++;
|
||||
}
|
||||
for (i = 0; i < aFD_BLOCK_DRAW_NUM; i++) {
|
||||
block->bx = bx + draw_block_offset_table[i].offset_x;
|
||||
block->bz = bz + draw_block_offset_table[i].offset_z;
|
||||
mFI_BkNum2WposXZ(&block->wpos.x, &block->wpos.z, block->bx, block->bz);
|
||||
block->wpos.y = mFI_BkNum2BaseHeight(block->bx, block->bz);
|
||||
block->exist = TRUE;
|
||||
block++;
|
||||
}
|
||||
|
||||
aFD_MakeMarinScrollInfo(actorx, game);
|
||||
aFD_MakeMarinScrollInfo(actorx, game);
|
||||
}
|
||||
|
||||
static void aFD_SetPositionOffset(f32 ofs) {
|
||||
aFD_position_offset = ofs;
|
||||
aFD_position_offset = ofs;
|
||||
}
|
||||
|
||||
static void aFD_SetDefaultPositionOffset() {
|
||||
aFD_SetPositionOffset(1000.0f);
|
||||
aFD_SetPositionOffset(1000.0f);
|
||||
}
|
||||
|
||||
static void Bg_Draw_Actor_ct(ACTOR* actorx, GAME* game) {
|
||||
aFD_PrepareFieldDraw(actorx, game);
|
||||
aFD_SetDefaultPositionOffset();
|
||||
aFD_PrepareFieldDraw(actorx, game);
|
||||
aFD_SetDefaultPositionOffset();
|
||||
}
|
||||
|
||||
static void Bg_Draw_Actor_dt(ACTOR* actorx, GAME* game) {
|
||||
|
||||
}
|
||||
|
||||
static void Bg_Draw_Actor_move(ACTOR* actorx, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
int bx;
|
||||
int bz;
|
||||
int pond_x;
|
||||
int pond_z;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
int bx;
|
||||
int bz;
|
||||
int pond_x;
|
||||
int pond_z;
|
||||
|
||||
aFD_PrepareFieldDraw(actorx, game);
|
||||
aFD_PrepareFieldDraw(actorx, game);
|
||||
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, player->actor_class.world.position)) {
|
||||
if ((mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
aFD_OperateWaterSound(&player->actor_class.world.position, actorx, 2, 28, 0.0f, 175.0f, aFD_SEARCH_ROW);
|
||||
}
|
||||
else {
|
||||
aFD_OperateWaterSound(&player->actor_class.world.position, actorx, 1, 11, 0.0f, 0.0f, aFD_SEARCH_FULL);
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, player->actor_class.world.position)) {
|
||||
if ((mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
aFD_OperateWaterSound(&player->actor_class.world.position, actorx, 2, 28, 0.0f, 175.0f, aFD_SEARCH_ROW);
|
||||
} else {
|
||||
aFD_OperateWaterSound(&player->actor_class.world.position, actorx, 1, 11, 0.0f, 0.0f, aFD_SEARCH_FULL);
|
||||
}
|
||||
|
||||
if (mRF_SearchPond(&pond_x, &pond_z, bx, bz)) {
|
||||
xyz_t frog_se_pos;
|
||||
xyz_t pond_pos;
|
||||
|
||||
/* Play the frog sound effect */
|
||||
if (rtc_time->month >= lbRTC_MAY && rtc_time->month <= lbRTC_AUGUST &&
|
||||
((rtc_time->hour >= 18 && rtc_time->hour <= 21) || (rtc_time->hour >= 4 && rtc_time->hour <= 6))) {
|
||||
frog_se_pos.x = mFI_UNIT_BASE_SIZE_F + (f32)pond_x * mFI_UNIT_BASE_SIZE_F;
|
||||
frog_se_pos.y = 0.0f;
|
||||
frog_se_pos.z = mFI_UNIT_BASE_SIZE_F + (f32)pond_z * mFI_UNIT_BASE_SIZE_F;
|
||||
frog_se_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(frog_se_pos, 0.0f);
|
||||
sAdo_OngenPos((u32)&Bg_Draw_Actor_move, 0xA1, &frog_se_pos);
|
||||
}
|
||||
|
||||
/* Pond sound effect */
|
||||
pond_pos.x = mFI_UNIT_BASE_SIZE_F * 0.5f + (f32)pond_x * mFI_UNIT_BASE_SIZE_F;
|
||||
pond_pos.y = 0.0f;
|
||||
pond_pos.z = mFI_UNIT_BASE_SIZE_F * 0.5f + (f32)pond_z * mFI_UNIT_BASE_SIZE_F;
|
||||
pond_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(pond_pos, 0.0f);
|
||||
sAdo_OngenPos((u32)&Bg_Draw_Actor_ct, 0x16, &pond_pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (mRF_SearchPond(&pond_x, &pond_z, bx, bz)) {
|
||||
xyz_t frog_se_pos;
|
||||
xyz_t pond_pos;
|
||||
if (GETREG(CRV, 39)) {
|
||||
int i;
|
||||
|
||||
/* Play the frog sound effect */
|
||||
if (
|
||||
rtc_time->month >= lbRTC_MAY && rtc_time->month <= lbRTC_AUGUST &&
|
||||
(
|
||||
(rtc_time->hour >= 18 && rtc_time->hour <= 21) ||
|
||||
(rtc_time->hour >= 4 && rtc_time->hour <= 6)
|
||||
)
|
||||
) {
|
||||
frog_se_pos.x = mFI_UNIT_BASE_SIZE_F + (f32)pond_x * mFI_UNIT_BASE_SIZE_F;
|
||||
frog_se_pos.y = 0.0f;
|
||||
frog_se_pos.z = mFI_UNIT_BASE_SIZE_F + (f32)pond_z * mFI_UNIT_BASE_SIZE_F;
|
||||
frog_se_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(frog_se_pos, 0.0f);
|
||||
sAdo_OngenPos((u32)&Bg_Draw_Actor_move, 0xA1, &frog_se_pos);
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
// ??
|
||||
}
|
||||
|
||||
/* Pond sound effect */
|
||||
pond_pos.x = mFI_UNIT_BASE_SIZE_F * 0.5f + (f32)pond_x * mFI_UNIT_BASE_SIZE_F;
|
||||
pond_pos.y = 0.0f;
|
||||
pond_pos.z = mFI_UNIT_BASE_SIZE_F * 0.5f + (f32)pond_z * mFI_UNIT_BASE_SIZE_F;
|
||||
pond_pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(pond_pos, 0.0f);
|
||||
sAdo_OngenPos((u32)&Bg_Draw_Actor_ct, 0x16, &pond_pos);
|
||||
SETREG(CRV, 39, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETREG(CRV, 39)) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
// ??
|
||||
}
|
||||
|
||||
SETREG(CRV, 39, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Culling box which is aproximately 128:25 (5.12:1) on the xz plane */
|
||||
/* NOTE: these vertices are only included because they are not used in any art asset */
|
||||
static Vtx aFD_culling_vtx[] ATTRIBUTE_ALIGN(32) = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 0, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 2000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 2000, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 2000, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 2000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
// clang-format off
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 0, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 2000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 2000, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 2000, 10240, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 10240, 2000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static Gfx aFD_cull_set_gfx[] ATTRIBUTE_ALIGN(32) = {
|
||||
gsSPClearGeometryMode(G_FOG | G_LIGHTING),
|
||||
gsSPVertex(&aFD_culling_vtx[0], 8, 0),
|
||||
gsSPCullDisplayList(0, 7),
|
||||
gsSPSetGeometryMode(G_FOG | G_LIGHTING),
|
||||
gsSPEndDisplayList(),
|
||||
gsSPClearGeometryMode(G_FOG | G_LIGHTING),
|
||||
gsSPVertex(&aFD_culling_vtx[0], 8, 0),
|
||||
gsSPCullDisplayList(0, 7),
|
||||
gsSPSetGeometryMode(G_FOG | G_LIGHTING),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
static Gfx aFD_cull_set_model[] ATTRIBUTE_ALIGN(32) = {
|
||||
gsSPDisplayList(aFD_cull_set_gfx),
|
||||
gsSPDisplayList(SEGMENT_ADDR(G_MWO_SEGMENT_A, 0)), /* Dynamic segment 0x0A */
|
||||
gsSPEndDisplayList(),
|
||||
gsSPDisplayList(aFD_cull_set_gfx),
|
||||
gsSPDisplayList(SEGMENT_ADDR(G_MWO_SEGMENT_A, 0)), /* Dynamic segment 0x0A */
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
static EVW_ANIME_SCROLL aFD_texture_scroll2_data[2] = {
|
||||
{ 1, -1, 32, 32 },
|
||||
{ -1, -2, 32, 32 }
|
||||
};
|
||||
static EVW_ANIME_SCROLL aFD_texture_scroll2_data[2] = { { 1, -1, 32, 32 }, { -1, -2, 32, 32 } };
|
||||
|
||||
static EVW_ANIME_DATA aFD_evw_data = {
|
||||
-4, EVW_ANIME_TYPE_SCROLL2, aFD_texture_scroll2_data
|
||||
};
|
||||
static EVW_ANIME_DATA aFD_evw_data = { -4, EVW_ANIME_TYPE_SCROLL2, aFD_texture_scroll2_data };
|
||||
|
||||
static void aFD_SetRiverFlow(GAME_PLAY* play) {
|
||||
Evw_Anime_Set(play, &aFD_evw_data);
|
||||
Evw_Anime_Set(play, &aFD_evw_data);
|
||||
}
|
||||
|
||||
static void aFD_SetViewerData(EVW_ANIME_DATA* data, GAME_PLAY* play) {
|
||||
if (data != NULL) {
|
||||
Evw_Anime_Set(play, data);
|
||||
}
|
||||
else {
|
||||
aFD_SetRiverFlow(play);
|
||||
}
|
||||
if (data != NULL) {
|
||||
Evw_Anime_Set(play, data);
|
||||
} else {
|
||||
aFD_SetRiverFlow(play);
|
||||
}
|
||||
}
|
||||
|
||||
static int aFD_SetBeachColorOpaSegment(ACTOR* actorx, GAME* game, int bx, int bz) {
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_marin_info_c* marin_info = &field_draw->marin_info;
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_marin_info_c* marin_info = &field_draw->marin_info;
|
||||
|
||||
if ((mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
Gfx* gfx = aFD_MakeEnvSetDisplayList(marin_info->beach_env_color.r, marin_info->beach_env_color.g, marin_info->beach_env_color.b, marin_info->beach_env_color.a, game);
|
||||
if ((mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
Gfx* gfx = aFD_MakeEnvSetDisplayList(marin_info->beach_env_color.r, marin_info->beach_env_color.g,
|
||||
marin_info->beach_env_color.b, marin_info->beach_env_color.a, game);
|
||||
|
||||
if (gfx == NULL) {
|
||||
return FALSE;
|
||||
if (gfx == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPSegment(NEXT_BG_OPA_DISP, G_MWO_SEGMENT_C, gfx);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPSegment(NEXT_BG_OPA_DISP, G_MWO_SEGMENT_C, gfx);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int aFD_SetMarinScrollXluSegment(ACTOR* actorx, GAME* game, int bx, int bz) {
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_marin_info_c* marin_info = &field_draw->marin_info;
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_marin_info_c* marin_info = &field_draw->marin_info;
|
||||
|
||||
if ((mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
Gfx* gfx0 = two_tex_scroll_dolphin(game->graph, 0, 0, marin_info->tile0_scroll << 1, 32, 32, 1, 0, marin_info->tile1_scroll << 1, 32, 64);
|
||||
Gfx* gfx1 = two_tex_scroll_dolphin(game->graph, 0, 0, marin_info->tile0_scroll << 1, 32, 32, 1, 0, marin_info->tile1_scroll << 1, 32, 32);
|
||||
if ((mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
Gfx* gfx0 = two_tex_scroll_dolphin(game->graph, 0, 0, marin_info->tile0_scroll << 1, 32, 32, 1, 0,
|
||||
marin_info->tile1_scroll << 1, 32, 64);
|
||||
Gfx* gfx1 = two_tex_scroll_dolphin(game->graph, 0, 0, marin_info->tile0_scroll << 1, 32, 32, 1, 0,
|
||||
marin_info->tile1_scroll << 1, 32, 32);
|
||||
|
||||
if (gfx0 == NULL || gfx1 == NULL) {
|
||||
return FALSE;
|
||||
if (gfx0 == NULL || gfx1 == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_B, gfx0);
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_D, gfx1);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_B, gfx0);
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_D, gfx1);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void aFD_DrawBg(Gfx* gfx, int exists, GAME* game) {
|
||||
if (gfx != NULL) {
|
||||
OPEN_DISP(game->graph);
|
||||
if (gfx != NULL) {
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPSegment(NEXT_BG_OPA_DISP, G_MWO_SEGMENT_A, gfx); /* Bg display list is called in between culling microcode */
|
||||
gSPDisplayList(NEXT_BG_OPA_DISP, aFD_cull_set_model);
|
||||
gSPSegment(NEXT_BG_OPA_DISP, G_MWO_SEGMENT_A, gfx); /* Bg display list is called in between culling microcode */
|
||||
gSPDisplayList(NEXT_BG_OPA_DISP, aFD_cull_set_model);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
}
|
||||
|
||||
static void aFD_DrawXluBg(Gfx* gfx, int exists, GAME* game) {
|
||||
if (gfx != NULL) {
|
||||
OPEN_DISP(game->graph);
|
||||
if (gfx != NULL) {
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
if (mFI_GetFieldId() == mFI_FIELD_ROOM_BUGGY) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
static xyz_t ball = { 160.0f, 70.0f, 180.0f }; // Katrina's crystal ball highlight
|
||||
if (mFI_GetFieldId() == mFI_FIELD_ROOM_BUGGY) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
static xyz_t ball = { 160.0f, 70.0f, 180.0f }; // Katrina's crystal ball highlight
|
||||
|
||||
Setpos_HiliteReflect_xlu_init(&ball, play);
|
||||
Setpos_HiliteReflect_xlu_init(&ball, play);
|
||||
}
|
||||
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, gfx);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, gfx);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*aFD_DRAW_PROC)(GAME* game);
|
||||
|
||||
static void aFD_DrawBlock(aFD_block_c* block, ACTOR* actorx, GAME* game) {
|
||||
static aFD_DRAW_PROC draw_proc[] = {
|
||||
(aFD_DRAW_PROC)&none_proc1,
|
||||
&Global_kankyo_set_room_prim,
|
||||
&Global_kankyo_set_room_prim,
|
||||
(aFD_DRAW_PROC)&none_proc1
|
||||
};
|
||||
static aFD_DRAW_PROC draw_proc[] = { (aFD_DRAW_PROC)&none_proc1, &Global_kankyo_set_room_prim,
|
||||
&Global_kankyo_set_room_prim, (aFD_DRAW_PROC)&none_proc1 };
|
||||
|
||||
int block_type = mFI_BkNum2BlockType(block->bx, block->bz);
|
||||
s8 anime_frame_count;
|
||||
EVW_ANIME_DATA* anime_data;
|
||||
u32 exist = block->exist;
|
||||
Gfx* opa_gfx;
|
||||
Gfx* xlu_gfx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
int block_type = mFI_BkNum2BlockType(block->bx, block->bz);
|
||||
s8 anime_frame_count;
|
||||
EVW_ANIME_DATA* anime_data;
|
||||
u32 exist = block->exist;
|
||||
Gfx* opa_gfx;
|
||||
Gfx* xlu_gfx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
if (exist != FALSE) {
|
||||
opa_gfx = mFI_GetBGDisplayListRom(block->bx, block->bz);
|
||||
xlu_gfx = mFI_GetBGDisplayListRom_XLU(block->bx, block->bz);
|
||||
anime_data = mFI_GetBGTexAnimInfo(&anime_frame_count, block->bx, block->bz);
|
||||
if (exist != FALSE) {
|
||||
opa_gfx = mFI_GetBGDisplayListRom(block->bx, block->bz);
|
||||
xlu_gfx = mFI_GetBGDisplayListRom_XLU(block->bx, block->bz);
|
||||
anime_data = mFI_GetBGTexAnimInfo(&anime_frame_count, block->bx, block->bz);
|
||||
|
||||
Matrix_translate(block->wpos.x, block->wpos.y, block->wpos.z, MTX_LOAD);
|
||||
Matrix_scale(0.0625f, 0.0625f, 0.0625f, MTX_MULT);
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
_texture_z_light_fog_prim_bg(game->graph);
|
||||
Matrix_translate(block->wpos.x, block->wpos.y, block->wpos.z, MTX_LOAD);
|
||||
Matrix_scale(0.0625f, 0.0625f, 0.0625f, MTX_MULT);
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
_texture_z_light_fog_prim_bg(game->graph);
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(NEXT_BG_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(NEXT_BG_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
CLOSE_DISP(game->graph);
|
||||
|
||||
aFD_SetViewerData(anime_data, play);
|
||||
(*draw_proc[Common_Get(field_draw_type)])(game);
|
||||
aFD_SetViewerData(anime_data, play);
|
||||
(*draw_proc[Common_Get(field_draw_type)])(game);
|
||||
|
||||
if (aFD_SetBeachColorOpaSegment(actorx, game, block->bx, block->bz)) {
|
||||
u32 kind = mFI_BkNum2BlockKind(block->bx, block->bz);
|
||||
if (aFD_SetBeachColorOpaSegment(actorx, game, block->bx, block->bz)) {
|
||||
u32 kind = mFI_BkNum2BlockKind(block->bx, block->bz);
|
||||
|
||||
switch (GETREG(MYKREG, 77)) {
|
||||
case 0:
|
||||
{
|
||||
// Draw all BG
|
||||
aFD_DrawBg(opa_gfx, exist, game);
|
||||
break;
|
||||
switch (GETREG(MYKREG, 77)) {
|
||||
case 0: {
|
||||
// Draw all BG
|
||||
aFD_DrawBg(opa_gfx, exist, game);
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
// Do not draw BG unless we're in an island block
|
||||
if ((kind & mRF_BLOCKKIND_ISLAND) == 0) {
|
||||
aFD_DrawBg(opa_gfx, exist, game);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
// Do not draw BG at all
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// Draw all BG
|
||||
aFD_DrawBg(opa_gfx, exist, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
// Do not draw BG unless we're in an island block
|
||||
if ((kind & mRF_BLOCKKIND_ISLAND) == 0) {
|
||||
aFD_DrawBg(opa_gfx, exist, game);
|
||||
}
|
||||
|
||||
break;
|
||||
if (aFD_SetMarinScrollXluSegment(actorx, game, block->bx, block->bz)) {
|
||||
if (GETREG(MYKREG, 77) != 3) {
|
||||
aFD_DrawXluBg(xlu_gfx, exist, game);
|
||||
}
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
// Do not draw BG at all
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// Draw all BG
|
||||
aFD_DrawBg(opa_gfx, exist, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aFD_SetMarinScrollXluSegment(actorx, game, block->bx, block->bz)) {
|
||||
if (GETREG(MYKREG, 77) != 3) {
|
||||
aFD_DrawXluBg(xlu_gfx, exist, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aFD_MakeMarinScrollInfo(ACTOR* actorx, GAME* game) {
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_marin_info_c* marin_info = &field_draw->marin_info;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_marin_info_c* marin_info = &field_draw->marin_info;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
int frame = play->game_frame % 300;
|
||||
f32 frame_f = (f32)frame;
|
||||
f32 wave_radian = (frame_f / 300.0f) * F_PI * 2.0f;
|
||||
f32 wave_cos = cosf_table(wave_radian);
|
||||
f32 beach_cos = cosf_table((wave_radian - 1.2f) + (f32)GETREG(MYKREG, 53) * 0.01f);
|
||||
int frame = play->game_frame % 300;
|
||||
f32 frame_f = (f32)frame;
|
||||
f32 wave_radian = (frame_f / 300.0f) * F_PI * 2.0f;
|
||||
f32 wave_cos = cosf_table(wave_radian);
|
||||
f32 beach_cos = cosf_table((wave_radian - 1.2f) + (f32)GETREG(MYKREG, 53) * 0.01f);
|
||||
|
||||
marin_info->frame = frame;
|
||||
marin_info->tile0_scroll = (int)((f32)play->game_frame * -0.42666667f) - 7;
|
||||
marin_info->tile1_scroll = (int)(wave_cos * -32.0f - -32.0f);
|
||||
marin_info->frame = frame;
|
||||
marin_info->tile0_scroll = (int)((f32)play->game_frame * -0.42666667f) - 7;
|
||||
marin_info->tile1_scroll = (int)(wave_cos * -32.0f - -32.0f);
|
||||
|
||||
mCoBG_WaveCos2BgCheck(wave_cos);
|
||||
mCoBG_WaveCos2BgCheck(wave_cos);
|
||||
|
||||
marin_info->beach_env_color.r = (u8)(int)(144.0f + ((beach_cos * -21.0f) + 21.0f));
|
||||
marin_info->beach_env_color.g = (u8)(int)(128.0f + ((beach_cos * -18.0f) + 18.0f));
|
||||
marin_info->beach_env_color.b = (u8)(int)( 96.0f + ((beach_cos * -14.0f) + 14.0f));
|
||||
marin_info->beach_env_color.a = (u8)255;
|
||||
marin_info->beach_env_color.r = (u8)(int)(144.0f + ((beach_cos * -21.0f) + 21.0f));
|
||||
marin_info->beach_env_color.g = (u8)(int)(128.0f + ((beach_cos * -18.0f) + 18.0f));
|
||||
marin_info->beach_env_color.b = (u8)(int)(96.0f + ((beach_cos * -14.0f) + 14.0f));
|
||||
marin_info->beach_env_color.a = (u8)255;
|
||||
}
|
||||
|
||||
static void Bg_Draw_Actor_draw(ACTOR* actorx, GAME* game) {
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_block_c* block = field_draw->block;
|
||||
int i;
|
||||
FIELD_DRAW_ACTOR* field_draw = (FIELD_DRAW_ACTOR*)actorx;
|
||||
aFD_block_c* block = field_draw->block;
|
||||
int i;
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gDPSetTexEdgeAlpha(NEXT_BG_OPA_DISP, 144);
|
||||
gDPSetTexEdgeAlpha(NEXT_POLY_XLU_DISP, 144);
|
||||
gDPSetTextureAdjustMode(NEXT_BG_OPA_DISP, G_TA_DOLPHIN);
|
||||
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_DOLPHIN);
|
||||
gDPSetTexEdgeAlpha(NEXT_BG_OPA_DISP, 144);
|
||||
gDPSetTexEdgeAlpha(NEXT_POLY_XLU_DISP, 144);
|
||||
gDPSetTextureAdjustMode(NEXT_BG_OPA_DISP, G_TA_DOLPHIN);
|
||||
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_DOLPHIN);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
CLOSE_DISP(game->graph);
|
||||
|
||||
for (i = 0; i < aFD_BLOCK_DRAW_NUM; i++) {
|
||||
aFD_DrawBlock(block, actorx, game);
|
||||
block++;
|
||||
}
|
||||
for (i = 0; i < aFD_BLOCK_DRAW_NUM; i++) {
|
||||
aFD_DrawBlock(block, actorx, game);
|
||||
block++;
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
gDPSetTextureAdjustMode(NEXT_BG_OPA_DISP, G_TA_N64);
|
||||
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_N64);
|
||||
gDPSetTextureAdjustMode(NEXT_BG_OPA_DISP, G_TA_N64);
|
||||
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_N64);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ static void aHTC_clip_talk_info(ACTOR* actorx, int type) {
|
||||
// clang-format off
|
||||
static aHN0_talk_info_c dt_tbl0[] = {
|
||||
{ 1, aHN0_TALK_WAIT },
|
||||
{ 0, aHN0_TALK_WAIT },
|
||||
// { 0, aHN0_TALK_WAIT },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -341,8 +341,20 @@ static void aHUS_set_bgOffset(ACTOR* actorx, int idx) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
#if VERSION == VER_GAFU01_00
|
||||
pos.z = actorx->home.position.z + addZ[i];
|
||||
|
||||
pos.x = actorx->home.position.x + addX[0];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_p[0], __FILE__, 623);
|
||||
|
||||
pos.x = actorx->home.position.x + addX[1];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_p[1], __FILE__, 627);
|
||||
|
||||
pos.x = actorx->home.position.x + addX[2];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_p[2], __FILE__, 631);
|
||||
#elif VERSION == VER_GAFE01_00
|
||||
pos.z = actorx->home.position.z + addZ[i];
|
||||
|
||||
pos.x = actorx->home.position.x + addX[0];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_p[0], __FILE__, 620);
|
||||
|
||||
@@ -351,6 +363,7 @@ static void aHUS_set_bgOffset(ACTOR* actorx, int idx) {
|
||||
|
||||
pos.x = actorx->home.position.x + addX[2];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_p[2], __FILE__, 628);
|
||||
#endif
|
||||
|
||||
ofs_p += 3;
|
||||
}
|
||||
@@ -371,8 +384,13 @@ static f32 aHUS_ctrl_light(HOUSE_ACTOR* house) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (sched_p->current_type == mNPS_SCHED_IN_HOUSE && animal_p->is_home == TRUE &&
|
||||
(now_sec >= (18 * mTM_SECONDS_IN_HOUR) || now_sec <= (5 * mTM_SECONDS_IN_HOUR))) {
|
||||
// Aus changed lights to always be on at night as long as villager is awake
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (sched_p->current_type != mNPS_SCHED_SLEEP && animal_p->is_home == TRUE &&
|
||||
#else
|
||||
if (sched_p->current_type == mNPS_SCHED_IN_HOUSE && animal_p->is_home == TRUE &&
|
||||
#endif
|
||||
(now_sec >= mTM_TIME2SEC(18, 0, 0) || now_sec <= mTM_TIME2SEC(5, 0, 0))) {
|
||||
if (house->request_type == 2) {
|
||||
return 0.0f;
|
||||
} else {
|
||||
|
||||
@@ -412,10 +412,8 @@ static void aIBT_wait(ACTOR* actor, GAME* game) {
|
||||
} else if (aIBT_check_patience(insect,game) == TRUE) {
|
||||
aIBT_setupAction(insect, aIBT_ACTION_AVOID, game);
|
||||
} else {
|
||||
f32 step = sqrtf(0.5);
|
||||
|
||||
add_calc_short_angle2(&actor->shape_info.rotation.y,
|
||||
actor->world.angle.y, 1.0f - step, 0x2000, 0);
|
||||
actor->world.angle.y, CALC_EASE(0.5f), 0x2000, 0);
|
||||
|
||||
if ((insect->type >= 0xF) || (insect->type < 0xD)) {
|
||||
int idx = insect->type - 15;
|
||||
|
||||
@@ -69,6 +69,10 @@ extern void aITT_actor_init(ACTOR* actorx, GAME* game) {
|
||||
actorx->world.position.y = 6.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(actorx->world.position, -19.0f);
|
||||
actorx->shape_info.draw_shadow = FALSE;
|
||||
xyz_t_move(&actorx->home.position, &actorx->world.position);
|
||||
// Aus stores the spawn unit in work variables
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
mFI_Wpos2UtNum(&insect->s32_work0, &insect->s32_work3, actorx->world.position);
|
||||
#endif
|
||||
action = aITT_ACT_WAIT;
|
||||
} else {
|
||||
// aINS_INIT_RELEASE
|
||||
@@ -212,6 +216,11 @@ static int aITT_check_patience(ACTOR* actorx, GAME* game) {
|
||||
insect->patience = 100.0f;
|
||||
} else if (aITT_check_player_scoop(actorx) == TRUE) {
|
||||
insect->patience = 100.0f;
|
||||
// Aus version checks if the insect is in a unit without a flower
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
} else if (aITT_check_flower(actorx) == FALSE) {
|
||||
insect->patience = 100.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (insect->patience > 90.0f) {
|
||||
@@ -492,7 +501,8 @@ static void aITT_actor_move(ACTOR* actorx, GAME* game) {
|
||||
// @BUG - They forgot to make a separate case for the snail,
|
||||
// so it uses the ladybug/spotted ladybug/mantis let escape behavior.
|
||||
// This was fixed in the Australian release.
|
||||
#ifndef BUGFIXES
|
||||
// Aus version fixes this!
|
||||
#if !defined(BUGFIXES) && VERSION < VER_GAFU01_00
|
||||
aITT_setupAction(insect, aITT_ACT_LET_ESCAPE, game);
|
||||
#else
|
||||
int action;
|
||||
|
||||
@@ -32,7 +32,12 @@ static void aMBX_check_take_mail(MAILBOX_ACTOR* actor, GAME_PLAY* play) {
|
||||
int abs_dAngle = ABS(dAngle);
|
||||
|
||||
if (abs_dAngle < aMBX_PLAYER_OPEN_ANGLE && player->a_btn_pressed == TRUE && pl_no == Common_Get(player_no) && player->item_in_front == (DUMMY_MAILBOX0 + arrange_idx)) {
|
||||
// Aus version changed the reset count needed for the 'free roam' Resetti interaction
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (Common_Get(reset_flag) == TRUE && Now_Private->reset_count < 4) {
|
||||
#else
|
||||
if (Common_Get(reset_flag) == TRUE && Now_Private->reset_count < 3) {
|
||||
#endif
|
||||
Common_Set(reset_type, 5);
|
||||
} else if (!mPr_NullCheckPersonalID(&Save_Get(homes[arrange_idx]).ownerID)) {
|
||||
Submenu* submenu = &play->submenu;
|
||||
|
||||
@@ -74,12 +74,12 @@ static void aMKBC_clip_roll_draw(GAME_PLAY* play, int timer, int page) {
|
||||
start_idx = page_table[page];
|
||||
end_idx = page_table[page + 1];
|
||||
|
||||
if (timer < 40 || timer > 446) {
|
||||
if (timer < 40 || timer > FRAMERATE_SELECT(446, 372)) {
|
||||
alpha = 0;
|
||||
} else if (timer < 120) {
|
||||
alpha = (u8)((timer - 40) * 3.1875f);
|
||||
} else if (timer > 366) {
|
||||
alpha = (u8)((446 - timer) * 3.1875f);
|
||||
} else if (timer > FRAMERATE_SELECT(366, 292)) {
|
||||
alpha = (u8)((FRAMERATE_SELECT(446, 372) - timer) * 3.1875f);
|
||||
} else {
|
||||
alpha = 255;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ static void aMKBC_clip_roll_proc(NPC_TOTAKEKE_ACTOR* kk, GAME_PLAY* play) {
|
||||
kk_save->_00 = 550;
|
||||
}
|
||||
|
||||
if (kk->show_timer >= 4800) {
|
||||
if (kk->show_timer >= FRAMERATE_TIMER(4800)) {
|
||||
if (kk->majin_flag) {
|
||||
kk_save->bitfield |= aNTT_FLAG_SP_DELETE_MAJIN;
|
||||
kk->majin_flag = FALSE;
|
||||
@@ -296,7 +296,7 @@ static void aMKBC_clip_roll_proc(NPC_TOTAKEKE_ACTOR* kk, GAME_PLAY* play) {
|
||||
kk_save->_00 = 120;
|
||||
} else if (now_sec >= mTM_TIME2SEC(20, 45, 0) && now_sec <= mTM_TIME2SEC(20, 55, 0)) {
|
||||
if (kk->majin_flag == FALSE) {
|
||||
if (kk->show_timer >= 3600 && kk->show_timer < 3610) {
|
||||
if (kk->show_timer >= FRAMERATE_TIMER(3600) && kk->show_timer < FRAMERATE_SELECT(3610, 3010)) {
|
||||
mFI_Wpos2UtNum_inBlock(&ux, &uz, actorx->world.position);
|
||||
kk->majin_flag = CLIP(npc_clip)->setupActor_proc(play, SP_NPC_MAJIN5, -1, -1, -1, table_p->block_x, table_p->block_z, ux, uz);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ static Vtx obj_e_mikanbox_v[] = {
|
||||
extern Gfx obj_e_mikanbox_copyrightT_model[];
|
||||
extern Gfx obj_e_mikanbox_copyrightT_model2[];
|
||||
|
||||
// Aus version redid the copyright model so it doesn't need
|
||||
// scaling nor draw commands in the func body
|
||||
static void aMIK_copyright_draw(GAME* game) {
|
||||
GRAPH* graph = game->graph;
|
||||
aNTT_event_save_c* kk_save = (aNTT_event_save_c*)mEv_get_save_area(mEv_EVENT_KK_SLIDER, 10);
|
||||
@@ -27,12 +29,16 @@ static void aMIK_copyright_draw(GAME* game) {
|
||||
gDPPipeSync(NEXT_FONT_DISP);
|
||||
gDPSetPrimColor(NEXT_FONT_DISP, 0, 128, 255, 255, 255, alpha);
|
||||
gSPDisplayList(NEXT_FONT_DISP, obj_e_mikanbox_copyrightT_model);
|
||||
#if VERSION < VER_GAFU01_00
|
||||
gSPVertex(NEXT_FONT_DISP, obj_e_mikanbox_v, 4, 0);
|
||||
gSP2Triangles(NEXT_FONT_DISP, 0, 1, 2, 0, 0, 2, 3, 0);
|
||||
#endif
|
||||
|
||||
Matrix_push();
|
||||
Matrix_translate(0.0f, -900.0f, 0.0f, MTX_MULT);
|
||||
#if VERSION < VER_GAFU01_00
|
||||
Matrix_scale(0.85f, 0.85f, 1.0f, MTX_MULT);
|
||||
#endif
|
||||
gSPMatrix(NEXT_FONT_DISP, _Matrix_to_Mtx_new(graph), G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
gSPDisplayList(NEXT_FONT_DISP, obj_e_mikanbox_copyrightT_model2);
|
||||
Matrix_pull();
|
||||
|
||||
@@ -153,6 +153,7 @@ static void aMSC_check_connect_agb_start_wait(MSCORE_CONTROL_ACTOR* mscore_ctrl,
|
||||
}
|
||||
}
|
||||
|
||||
// Aus version sets force next flag when connection fails
|
||||
static void aMSC_check_connect_agb_end_wait(MSCORE_CONTROL_ACTOR* mscore_ctrl, GAME_PLAY* play) {
|
||||
int next_act_idx = -1;
|
||||
|
||||
@@ -177,6 +178,9 @@ static void aMSC_check_connect_agb_end_wait(MSCORE_CONTROL_ACTOR* mscore_ctrl, G
|
||||
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x3DDF);
|
||||
mMsg_Unset_LockContinue(msg_p);
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
mMsg_SET_FORCENEXT();
|
||||
#endif
|
||||
mGcgba_EndComm();
|
||||
aMSC_setupAction(mscore_ctrl, aMSC_ACT_TALK_END_WAIT);
|
||||
}
|
||||
|
||||
@@ -985,6 +985,116 @@ void Museum_Fish_BGCheck(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: fakematch
|
||||
#if VERSION == VER_GAFU01_00
|
||||
void Museum_Fish_Kusa_Check(MUSEUM_FISH_ACTOR* actor, GAME* game) {
|
||||
static int kusa_group_tbl[14] = {
|
||||
mfish_TANK_0,
|
||||
mfish_TANK_2,
|
||||
mfish_TANK_1,
|
||||
mfish_TANK_3,
|
||||
mfish_TANK_3,
|
||||
mfish_TANK_4,
|
||||
mfish_TANK_4,
|
||||
mfish_TANK_4,
|
||||
mfish_TANK_4,
|
||||
mfish_TANK_4,
|
||||
mfish_TANK_0,
|
||||
mfish_TANK_2,
|
||||
mfish_TANK_1,
|
||||
mfish_TANK_3,
|
||||
};
|
||||
|
||||
MUSEUM_FISH_ACTOR* realActor = (MUSEUM_FISH_ACTOR*)actor; // dangit!
|
||||
MUSEUM_FISH_PRIVATE_DATA* f = realActor->prvFish;
|
||||
int i;
|
||||
int j;
|
||||
s16 v;
|
||||
f32 f30 = 0.0f;
|
||||
f32 f29 = 0.0f;
|
||||
f32 f28 = 0.0f;
|
||||
f32 temp;
|
||||
f32 f1;
|
||||
f32 z;
|
||||
f32 x;
|
||||
f32 dSQ;
|
||||
f32 dx;
|
||||
f32 dy;
|
||||
f32 t;
|
||||
f32 sq;
|
||||
f32 d;
|
||||
|
||||
for (i = 0; i < aGYO_TYPE_NUM; i++, f++) {
|
||||
f->_62E_flags &= ~0x100;
|
||||
|
||||
// this if statement salso works as a continue statement
|
||||
if (f->fish_idx != aGYO_TYPE_EEL && f->fish_idx != aGYO_TYPE_COELACANTH &&
|
||||
f->fish_idx != aGYO_TYPE_FROG) {
|
||||
|
||||
for (j = 0; j < 14; j++) {
|
||||
f1 = (j < 5) ? 90.0f : (j < 10) ? 115.0f : 80.0f;
|
||||
|
||||
if (kusa_group_tbl[j] == f->tank && f->objchk_pos.y < f1) {
|
||||
if (kusa_group_tbl[j] == mfish_TANK_4) {
|
||||
if (f->fish_idx == aGYO_TYPE_COELACANTH) {
|
||||
d = 5.0f + f->init_data._08;
|
||||
} else {
|
||||
d = 10.0f + f->init_data._08;
|
||||
}
|
||||
dSQ = SQ(d);
|
||||
} else {
|
||||
d = 5.0f + f->init_data._08;
|
||||
dSQ = SQ(d);
|
||||
}
|
||||
|
||||
x = f->objchk_pos.x - (kusa_pos[j].x + realActor->prvKusa[j]._540.x);
|
||||
z = f->objchk_pos.z - (kusa_pos[j].z + realActor->prvKusa[j]._540.z);
|
||||
|
||||
sq = SQ(x) + SQ(z);
|
||||
if (sq < dSQ) {
|
||||
v = atans_table(z, x);
|
||||
|
||||
temp = d - sqrtf(sq);
|
||||
temp *= 0.1f;
|
||||
// d -= sqrtf(sq);
|
||||
// d *= 0.1f;
|
||||
f30 += sin_s(v) * (temp);
|
||||
if (kusa_group_tbl[j] == mfish_TANK_4) {
|
||||
f29 += MAX(cos_s(v), 0.2f) * temp;
|
||||
} else {
|
||||
f29 += cos_s(v) * temp;
|
||||
}
|
||||
|
||||
f28 += 1;
|
||||
|
||||
realActor->prvKusa[j]._540.x -= (f->init_data._20 * 1.5f) * temp * sin_s(v);
|
||||
|
||||
if (kusa_group_tbl[j] == mfish_TANK_4) {
|
||||
realActor->prvKusa[j]._540.z -= (f->init_data._20 * 1.5f) * temp * MAX(cos_s(v), 0.1f);
|
||||
} else {
|
||||
realActor->prvKusa[j]._540.z -= (f->init_data._20 * 1.5f) * temp * cos_s(v);
|
||||
}
|
||||
t = SQ(realActor->prvKusa[j]._540.x) + SQ(realActor->prvKusa[j]._540.z);
|
||||
t = sqrtf(t);
|
||||
if (t > 4.0f) {
|
||||
xyz_t_mult_v(&realActor->prvKusa[j]._540, 4.0f / t);
|
||||
}
|
||||
realActor->prvKusa[j]._538.y = DEG2SHORT_ANGLE(3.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (f28 > 0.0f) {
|
||||
f->_62E_flags |= 0x100;
|
||||
f->position.x += (f30 / f28);
|
||||
f->position.z += (f29 / f28);
|
||||
}
|
||||
f28 = 0.0f;
|
||||
f29 = 0.0f;
|
||||
f30 = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void Museum_Fish_Kusa_Check(MUSEUM_FISH_ACTOR* actor, GAME* game) {
|
||||
static int kusa_group_tbl[14] = {
|
||||
mfish_TANK_0,
|
||||
@@ -1087,6 +1197,7 @@ void Museum_Fish_Kusa_Check(MUSEUM_FISH_ACTOR* actor, GAME* game) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Museum_Fish_Object_Check(MUSEUM_FISH_ACTOR* actor, GAME* game) {
|
||||
int i;
|
||||
@@ -1345,14 +1456,14 @@ void mfish_get_player_area(MUSEUM_FISH_ACTOR* actor, GAME* gamex) {
|
||||
}
|
||||
|
||||
void mfish_get_flow_vec(xyz_t* pos, MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
f32 v;
|
||||
xyz_t p2;
|
||||
xyz_t p = suisou_pos[actor->tank];
|
||||
xyz_t t;
|
||||
xyz_t p3;
|
||||
|
||||
f32 xy;
|
||||
|
||||
f32 s;
|
||||
f32 v;
|
||||
f32 xy;
|
||||
s16 s2;
|
||||
|
||||
f32 d;
|
||||
|
||||
@@ -132,10 +132,13 @@ void mfish_bass_normal_process_init(MUSEUM_FISH_PRIVATE_DATA* fishActor) {
|
||||
}
|
||||
|
||||
void mfish_bass_normal_process(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
f32 v;
|
||||
f32 v2;
|
||||
|
||||
if (((actor->_62E_flags & 0x200) != 0 && actor->_632 > DEG2SHORT_ANGLE(20)) || actor->_640 > 0) {
|
||||
f32 v = (actor->_5AC.y * 0.03f + 0.02f);
|
||||
v = (actor->_5AC.y * 0.03f + 0.02f);
|
||||
add_calc2(&actor->_5EC,
|
||||
v + (actor->_5AC.y * 0.02f + 0.03f) * (float)((actor->_632 - DEG2SHORT_ANGLE(20)) / 364),
|
||||
(actor->_5AC.y * 0.03f + 0.02f) + (actor->_5AC.y * 0.02f + 0.03f) * (float)((actor->_632 - DEG2SHORT_ANGLE(20)) / 364),
|
||||
actor->_5AC.y * 0.04f + 0.01f, actor->_5AC.y * 0.02f + 0.01f);
|
||||
add_calc(&actor->_5E8, actor->_5F0, CALC_EASE(v), actor->_5EC * 0.5f, 0.025f);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ void mfish_unagi_rail_move(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
v = 0.0f;
|
||||
}
|
||||
v3 = search_position_distance(&actor->position, &pp[actor->_642]);
|
||||
if ((f32)(__fabs(chase_xyz_t(&actor->position, &pp[actor->_642], v2))) < 0.008f) {
|
||||
if (F32_IS_ZERO(chase_xyz_t(&actor->position, &pp[actor->_642], v2))) {
|
||||
if (actor->_640 < unagi_rail_num_tbl[actor->_646] - 1) {
|
||||
actor->_640++;
|
||||
} else {
|
||||
@@ -170,7 +170,7 @@ void mfish_unagi_normal_to_reverse(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex)
|
||||
}
|
||||
|
||||
v1 = search_position_distance(&actor->position, &p[actor->_642]);
|
||||
if ((f32)__fabs(chase_xyz_t(&actor->position, &p[actor->_642], v0)) < 0.008f) {
|
||||
if (F32_IS_ZERO(chase_xyz_t(&actor->position, &p[actor->_642], v0))) {
|
||||
if (actor->_640 < 11) {
|
||||
actor->_640++;
|
||||
} else {
|
||||
@@ -217,7 +217,7 @@ void mfish_unagi_rail_move_reverse(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex)
|
||||
c = 0.0f;
|
||||
}
|
||||
v1 = search_position_distance(&actor->position, &p[actor->_642]);
|
||||
if ((f32)__fabs(chase_xyz_t(&actor->position, &p[actor->_642], v0)) < 0.008f) {
|
||||
if (F32_IS_ZERO(chase_xyz_t(&actor->position, &p[actor->_642], v0))) {
|
||||
if (actor->_640 > 1) {
|
||||
actor->_640--;
|
||||
} else if (actor->_640 == 1) {
|
||||
@@ -268,7 +268,7 @@ void mfish_unagi_reverse_to_normal(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex)
|
||||
c = 0.0f;
|
||||
}
|
||||
v1 = search_position_distance(&actor->position, &p[actor->_642]);
|
||||
if ((f32)__fabs(chase_xyz_t(&actor->position, &p[actor->_642], v0)) < 0.008f) {
|
||||
if (F32_IS_ZERO(chase_xyz_t(&actor->position, &p[actor->_642], v0))) {
|
||||
if (actor->_640 > 1) {
|
||||
actor->_640--;
|
||||
} else if (actor->_640 == 1) {
|
||||
|
||||
@@ -842,7 +842,7 @@ void Museum_Insect_Actor_dt(ACTOR* actor, GAME* game) {
|
||||
void Museum_Insect_Actor_move(ACTOR* actorx, GAME* game) {
|
||||
MUSEUM_INSECT_ACTOR* actor = (MUSEUM_INSECT_ACTOR*)actorx;
|
||||
int i;
|
||||
actor->actor.world.position.y = 4000.f;
|
||||
actorx->world.position.y = 4000.f;
|
||||
Museum_Insect_Talk_process(actorx, game);
|
||||
for (i = 0; i < aINS_INSECT_TYPE_NUM; i++) {
|
||||
if (actor->privInsects[i]._8C & 1) {
|
||||
@@ -856,17 +856,20 @@ extern Gfx obj_museum4_water_modelT[];
|
||||
|
||||
void Museum_Insect_Actor_draw(ACTOR* actorx, GAME* game) {
|
||||
MUSEUM_INSECT_ACTOR* actor = (MUSEUM_INSECT_ACTOR*)actorx;
|
||||
GRAPH* graph;
|
||||
int i;
|
||||
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
Evw_Anime_Set((GAME_PLAY*)game, &obj_museum4_water_evw_anime);
|
||||
graph = game->graph;
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
Matrix_translate(100.0f, 0.0f, 0.0f, MTX_LOAD);
|
||||
Matrix_scale(0.01f, 0.01f, 0.01f, MTX_MULT);
|
||||
OPEN_DISP(graph);
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum4_water_modelT);
|
||||
CLOSE_DISP(graph);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
|
||||
for (i = 0; i < aINS_INSECT_TYPE_NUM; i++) {
|
||||
if (actor->privInsects[i]._8C & 1) {
|
||||
if (GETREG(TAKREG, 0) == i + 1) {
|
||||
|
||||
@@ -36,7 +36,7 @@ void mi_dango_move_init(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
void mi_dango_move(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
actor->_7C = 0;
|
||||
actor->_6E--;
|
||||
if ((f32)__fabs(actor->_40) < 0.008f) {
|
||||
if (F32_IS_ZERO(actor->_40)) {
|
||||
if (actor->_6E < 0) {
|
||||
actor->_40 = RANDOM_F(0.1f) + 0.065f;
|
||||
actor->_6E = (s16)RANDOM_F(560.f) + 40;
|
||||
|
||||
@@ -155,7 +155,7 @@ void genji_light_move(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
void genji_light_draw(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
xyz_t p = actor->_1C;
|
||||
u8 a, b;
|
||||
if ((f32)__fabs(actor->_0C) < 0.008f) {
|
||||
if (F32_IS_ZERO(actor->_0C)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -427,13 +427,13 @@ void minsect_tonbo_rock_process(MUSEUM_INSECT_PRIVATE_DATA* actor, GAME* game) {
|
||||
}
|
||||
if (chase_s(&actor->_7E, atans_table(p2.y, p2.z), (s16)DEG2SHORT_ANGLE2(v)) &&
|
||||
chase_s(&actor->_80, atans_table(p2.y, -p2.x), (s16)DEG2SHORT_ANGLE2(v)) &&
|
||||
(f32)__fabs(actor->_1C.x - p.x) < 0.008f && (f32)__fabs(actor->_1C.y - p.y) < 0.008f &&
|
||||
(f32)__fabs(actor->_1C.z - p.z) < 0.008f) {
|
||||
F32_IS_ZERO(actor->_1C.x - p.x) && F32_IS_ZERO(actor->_1C.y - p.y) &&
|
||||
F32_IS_ZERO(actor->_1C.z - p.z)) {
|
||||
minsect_tonbo_rock_wait_process_init(actor, game);
|
||||
}
|
||||
}
|
||||
} else if ((f32)__fabs(actor->_1C.x - p.x) < 0.008f && (f32)__fabs(actor->_1C.y - p.y) < 0.008f &&
|
||||
(f32)__fabs(actor->_1C.z - p.z) < 0.008f) {
|
||||
} else if (F32_IS_ZERO(actor->_1C.x - p.x) && F32_IS_ZERO(actor->_1C.y - p.y) &&
|
||||
F32_IS_ZERO(actor->_1C.z - p.z)) {
|
||||
minsect_tonbo_rock_wait_process_init(actor, game);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ static void Museum_Picture_Actor_dt(ACTOR* actorx, GAME* game) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
static void aMP_DrawOneArt(aMP_pos_c* pos_xz, Gfx* disp, GAME* game) {
|
||||
static void aMP_DrawOneArt(const aMP_pos_c* pos_xz, Gfx* disp, GAME* game) {
|
||||
GRAPH* graph = game->graph;
|
||||
xyz_t pos = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -117,10 +117,10 @@ static void Museum_Picture_Actor_draw(ACTOR* actorx, GAME* game) {
|
||||
}
|
||||
|
||||
static int aMP_CheckTalkAble(xyz_t* pos, int direct, GAME* game, f32 dist) {
|
||||
static int direct_table[] = { mRmTp_DIRECT_NORTH, -1, -1, mRmTp_DIRECT_WEST,
|
||||
mRmTp_DIRECT_WEST, -1, -1, mRmTp_DIRECT_SOUTH,
|
||||
mRmTp_DIRECT_SOUTH, -1, -1, mRmTp_DIRECT_EAST,
|
||||
mRmTp_DIRECT_EAST, -1, -1, mRmTp_DIRECT_NORTH };
|
||||
static int direct_table[] = {
|
||||
mRmTp_DIRECT_NORTH, -1, -1, mRmTp_DIRECT_WEST, mRmTp_DIRECT_WEST, -1, -1, mRmTp_DIRECT_SOUTH,
|
||||
mRmTp_DIRECT_SOUTH, -1, -1, mRmTp_DIRECT_EAST, mRmTp_DIRECT_EAST, -1, -1, mRmTp_DIRECT_NORTH,
|
||||
};
|
||||
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR((GAME_PLAY*)game);
|
||||
|
||||
@@ -128,11 +128,7 @@ static int aMP_CheckTalkAble(xyz_t* pos, int direct, GAME* game, f32 dist) {
|
||||
f32 dx = player->actor_class.world.position.x - pos->x;
|
||||
f32 dz = player->actor_class.world.position.z - pos->z;
|
||||
|
||||
if (sqrtf(dx * dx + dz * dz) <= dist) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
return sqrtf(SQ(dx) + SQ(dz)) <= dist ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -415,10 +415,9 @@ static void aMI_DrawMyStep(ACTOR* actorx, GAME* game) {
|
||||
int size = aMI_size_dsp_table[my_indoor->room_kind].size;
|
||||
|
||||
if (size >= 0 && size < aMI_ROOM_SIZE_NUM) {
|
||||
GRAPH* graph = game->graph;
|
||||
xyz_t* pos = &step_draw_pos[size];
|
||||
|
||||
OPEN_DISP(graph);
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
Matrix_translate(pos->x, pos->y, pos->z, MTX_LOAD);
|
||||
Matrix_scale(aMI_scale_x_table[i] * 0.01f, 0.01f, 0.01f, MTX_MULT);
|
||||
@@ -427,7 +426,7 @@ static void aMI_DrawMyStep(ACTOR* actorx, GAME* game) {
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(NEXT_POLY_OPA_DISP, aMI_step_data[i].disp);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -853,8 +853,8 @@ static void aMR_InitHaniwaOnTable(ACTOR* actorx) {
|
||||
int* haniwa_on_table_p = my_room->haniwa_on_table;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < aMR_HANIWA_ON_TABLE_NUM; i++, haniwa_on_table_p++) {
|
||||
*haniwa_on_table_p = -1;
|
||||
for (i = 0; i < aMR_HANIWA_ON_TABLE_NUM; i++) {
|
||||
*haniwa_on_table_p++ = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1403,7 +1403,8 @@ static void aMR_SecureFurnitureBank(MY_ROOM_ACTOR* my_room, GAME* game) {
|
||||
bank_p = (u8*)zelda_malloc_align(size, 32);
|
||||
my_room->bank0_p = bank_p;
|
||||
for (i = 0; i < my_room->bank_count0; i++) {
|
||||
l_bank_address_table[i] = bank_p + i * aMR_FTR_BANK_SIZE;
|
||||
int size = i * aMR_FTR_BANK_SIZE;
|
||||
l_bank_address_table[i] = bank_p + (int)size;
|
||||
}
|
||||
|
||||
if (my_room->bank_count1 > 0) {
|
||||
@@ -1487,7 +1488,7 @@ static int aMR_JudgeBreedNewFurniture(GAME* game, u16 ftr_no, int* ut_x, int* ut
|
||||
static mActor_name_t aMR_SearchPickupFurniture(GAME* game);
|
||||
static void aMR_Furniture2ItemBag(GAME* game);
|
||||
static int aMR_JudgePlayerAction(xyz_t* wpos0, xyz_t* wpos1, int ftr_actor_idx);
|
||||
static void aMR_PlayerMoveFurniture(int ftr_actor_idx, xyz_t* wpos);
|
||||
static void aMR_PlayerMoveFurniture(int ftr_actor_idx, const xyz_t* wpos);
|
||||
static int aMR_ftrID2Wpos(xyz_t* wpos, int ftr_id);
|
||||
static int aMR_UnitNum2FtrItemNoFtrID(mActor_name_t* ftr_item_no, int* ftr_id, int ut_x, int ut_z, int layer);
|
||||
static void aMR_FtrID2ExtinguishFurniture(int ftr_id);
|
||||
@@ -1699,10 +1700,10 @@ static void aMR_OneMDFurnitureSwitchOn(void) {
|
||||
|
||||
static void aMR_InitFurnitureWork(void) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = mCoBG_LAYER0; i < mCoBG_LAYER2; i++) {
|
||||
u8* place_p = aMR_place_table[i & 1];
|
||||
int j;
|
||||
|
||||
for (j = 0; j < UT_TOTAL_NUM; j++) {
|
||||
if (*place_p != 201 && *place_p != 200) {
|
||||
|
||||
@@ -7,7 +7,7 @@ extern void aMR_SetSurprise(ACTOR* actorx, s16 angle_y) {
|
||||
}
|
||||
}
|
||||
|
||||
static int aMR_MakeIndoorGoki(xyz_t* pos, s16 arg, s16 angle_y, GAME* game) {
|
||||
static int aMR_MakeIndoorGoki(const xyz_t* pos, s16 arg, s16 angle_y, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
ACTOR* actor = Actor_info_make_actor(&play->actor_info, game, mAc_PROFILE_HOUSE_GOKI, pos->x, pos->y, pos->z, 0,
|
||||
angle_y, 0, -1, -1, -1, EMPTY_NO, arg, -1, -1);
|
||||
|
||||
@@ -726,6 +726,7 @@ static void aMR_AllContactCheck(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* cont
|
||||
|
||||
extern cKF_Animation_R_c cKF_ba_r_furniture_pull;
|
||||
|
||||
// Aus plays move animation at half speed
|
||||
static void aMR_SetPullMoveAnime(FTR_ACTOR* ftr_actor, GAME* game, MY_ROOM_ACTOR* my_room,
|
||||
aMR_contact_info_c* contact_info) {
|
||||
cKF_SkeletonInfo_R_c* keyframe = &my_room->keyframe;
|
||||
@@ -743,11 +744,17 @@ static void aMR_SetPullMoveAnime(FTR_ACTOR* ftr_actor, GAME* game, MY_ROOM_ACTOR
|
||||
cKF_SkeletonInfo_R_Animation_Set_base_shape_trs(keyframe, 0.0f, 0.0f, 0.0f, 0, 0, 0);
|
||||
cKF_SkeletonInfo_R_AnimationMove_ct_base(pos, pos, 0, 0, 0.0f, keyframe, TRUE);
|
||||
cKF_SkeletonInfo_R_init_standard_stop_morph(keyframe, &cKF_ba_r_furniture_pull, NULL, -3.0f);
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
keyframe->frame_control.speed = 0.5f;
|
||||
#endif
|
||||
|
||||
cKF_SkeletonInfo_R_play(keyframe);
|
||||
}
|
||||
|
||||
extern cKF_Animation_R_c cKF_ba_r_furniture_push;
|
||||
|
||||
// Aus plays move animation at half speed
|
||||
static void aMR_SetPushMoveAnime(FTR_ACTOR* ftr_actor, GAME* game, MY_ROOM_ACTOR* my_room,
|
||||
aMR_contact_info_c* contact_info) {
|
||||
cKF_SkeletonInfo_R_c* keyframe = &my_room->keyframe;
|
||||
@@ -765,6 +772,11 @@ static void aMR_SetPushMoveAnime(FTR_ACTOR* ftr_actor, GAME* game, MY_ROOM_ACTOR
|
||||
cKF_SkeletonInfo_R_Animation_Set_base_shape_trs(keyframe, 0.0f, 0.0f, 0.0f, 0, 0, 0);
|
||||
cKF_SkeletonInfo_R_AnimationMove_ct_base(pos, pos, 0, 0, 0.0f, keyframe, TRUE);
|
||||
cKF_SkeletonInfo_R_init_standard_stop(keyframe, &cKF_ba_r_furniture_push, NULL);
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
keyframe->frame_control.speed = 0.5f;
|
||||
#endif
|
||||
|
||||
cKF_SkeletonInfo_R_play(keyframe);
|
||||
}
|
||||
|
||||
@@ -1334,11 +1346,11 @@ static void aMR_MngFtrContactAction(ACTOR* actorx, GAME* game) {
|
||||
|
||||
#include "../src/actor/ac_my_room_action.c_inc"
|
||||
|
||||
static f32 aMR_GetDistXZ(const xyz_t* pos0, const xyz_t* pos1) {
|
||||
static f32 aMR_GetDistXZ(xyz_t* pos0, xyz_t* pos1) {
|
||||
f32 diff_x = pos0->x - pos1->x;
|
||||
f32 diff_z = pos0->z - pos1->z;
|
||||
|
||||
return sqrtf((diff_x * diff_x) + (diff_z * diff_z));
|
||||
return sqrtf(SQ(diff_x) + SQ(diff_z));
|
||||
}
|
||||
|
||||
static void aMR_SetFurnitureBaseNorm(aFTR_collision_c* ftr_col) {
|
||||
@@ -1399,7 +1411,7 @@ static void aMR_MakeBaseFurnitureCollisionData(aFTR_collision_c* ftr_col, u16 ft
|
||||
ftr_col[3].edge_contact_ratio = edge_z;
|
||||
}
|
||||
|
||||
static void aMR_PlussPosition(aFTR_collision_c* ftr_col, const xyz_t* plus_amount) {
|
||||
static void aMR_PlussPosition(aFTR_collision_c* ftr_col, xyz_t* plus_amount) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < aFTR_EDGE_COL_NUM; i++) {
|
||||
@@ -1627,15 +1639,13 @@ static int aMR_JudgePickUpCommon(mActor_name_t* pickup_item_p, ACTOR* actorx, in
|
||||
static int square_offset_data[] = { 0, -1, -UT_X_NUM, -(UT_X_NUM + 1) };
|
||||
|
||||
static mActor_name_t aMR_SearchPickupFurniture(GAME* game) {
|
||||
mActor_name_t layer1_item;
|
||||
ACTOR* actorx = aMR_CLIP->my_room_actor_p;
|
||||
MY_ROOM_ACTOR* my_room = (MY_ROOM_ACTOR*)actorx;
|
||||
u32 player_no = Common_Get(player_no);
|
||||
mActor_name_t* fg_layer1_p = aMR_GetLayerTopFg(mCoBG_LAYER1);
|
||||
mActor_name_t* fg_layer0_p = aMR_GetLayerTopFg(mCoBG_LAYER0);
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
if (mCoBG_CheckUtFlat(&GET_PLAYER_ACTOR(play)->actor_class.world.position) == FALSE) {
|
||||
if (mCoBG_CheckUtFlat(&GET_PLAYER_ACTOR_GAME_ACTOR(game)->world.position) == FALSE) {
|
||||
return EMPTY_NO;
|
||||
}
|
||||
|
||||
@@ -1646,8 +1656,9 @@ static mActor_name_t aMR_SearchPickupFurniture(GAME* game) {
|
||||
|
||||
my_room->pickup_info.ftrID = -1;
|
||||
if (aMR_CheckRoomOwner(player_no, my_room)) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
s16 player_angle = player->actor_class.shape_info.rotation.y;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
ACTOR* playerx = GET_PLAYER_ACTOR_GAME_ACTOR(game);
|
||||
s16 player_angle = playerx->shape_info.rotation.y;
|
||||
int ut_x;
|
||||
int ut_z;
|
||||
int target_ut_x;
|
||||
@@ -1667,8 +1678,9 @@ static mActor_name_t aMR_SearchPickupFurniture(GAME* game) {
|
||||
FTR_ACTOR* ftr_actor;
|
||||
u8 exists2;
|
||||
FTR_ACTOR* ftr_actor2;
|
||||
mActor_name_t layer1_item;
|
||||
|
||||
aMR_Wpos2PlaceNumber(&ut_x, &ut_z, player->actor_class.world.position, 0);
|
||||
aMR_Wpos2PlaceNumber(&ut_x, &ut_z, playerx->world.position, 0);
|
||||
ut = ut_x + ut_z * UT_X_NUM;
|
||||
|
||||
/* Search the three closest 'in front of' units relative to the player's look direction */
|
||||
@@ -1679,8 +1691,8 @@ static mActor_name_t aMR_SearchPickupFurniture(GAME* game) {
|
||||
target_ut = target_ut_x + target_ut_z * UT_X_NUM;
|
||||
mFI_UtNum2CenterWpos(&ut_pos, target_ut_x, target_ut_z);
|
||||
|
||||
dX = player->actor_class.world.position.x - ut_pos.x;
|
||||
dZ = player->actor_class.world.position.z - ut_pos.z;
|
||||
dX = playerx->world.position.x - ut_pos.x;
|
||||
dZ = playerx->world.position.z - ut_pos.z;
|
||||
dist_sq = SQ(dX) + SQ(dZ);
|
||||
|
||||
if (aMR_UnitNum2FtrItemNoFtrID(&item, &ftrID, target_ut_x, target_ut_z, mCoBG_LAYER1) &&
|
||||
@@ -1700,8 +1712,8 @@ static mActor_name_t aMR_SearchPickupFurniture(GAME* game) {
|
||||
}
|
||||
}
|
||||
|
||||
layer1_item = fg_layer1_p[target_ut];
|
||||
if (ITEM_NAME_GET_TYPE((int)fg_layer1_p[target_ut]) == NAME_TYPE_ITEM1 && dist_sq <= SQ(56.0f)) {
|
||||
if (ITEM_NAME_GET_TYPE(fg_layer1_p[target_ut]) == NAME_TYPE_ITEM1 && dist_sq <= SQ(56.0f)) {
|
||||
layer1_item = fg_layer1_p[target_ut];
|
||||
my_room->pickup_info.leaf_pos.x = (f32)target_ut_x * mFI_UT_WORLDSIZE_X_F + mFI_UT_WORLDSIZE_HALF_X_F;
|
||||
my_room->pickup_info.leaf_pos.y = 0.0f;
|
||||
my_room->pickup_info.leaf_pos.z = (f32)target_ut_z * mFI_UT_WORLDSIZE_Z_F + mFI_UT_WORLDSIZE_HALF_Z_F;
|
||||
@@ -3022,7 +3034,7 @@ static int aMR_JudgePlayerAction(xyz_t* out_pos0, xyz_t* out_pos1, int ftrID) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void aMR_PlayerMoveFurniture(int ftrID, xyz_t* pos) {
|
||||
static void aMR_PlayerMoveFurniture(int ftrID, const xyz_t* pos) {
|
||||
if (l_aMR_work.ftr_actor_list != NULL && l_aMR_work.used_list != NULL) {
|
||||
FTR_ACTOR* ftr_actor = &l_aMR_work.ftr_actor_list[ftrID];
|
||||
xyz_t* ftr_pos = &ftr_actor->position;
|
||||
|
||||
@@ -206,11 +206,7 @@ static int aPT_CheckTalkAble(xyz_t* pos, int direct, GAME* game, f32 dist) {
|
||||
f32 dx = playerx->world.position.x - pos->x;
|
||||
f32 dz = playerx->world.position.z - pos->z;
|
||||
|
||||
if (sqrtf(SQ(dx) + SQ(dz)) <= dist) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return sqrtf(SQ(dx) + SQ(dz)) <= dist ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -301,6 +297,7 @@ static void aPT_Connect_AGB_to_Rcv_Init(PTERMINAL_ACTOR* actor, GAME* game) {
|
||||
mGcgba_EndComm();
|
||||
}
|
||||
|
||||
// Aus version sets the force next flag upon fail
|
||||
static void aPT_Connect_AGB_to_Rcv(PTERMINAL_ACTOR* actor, GAME* game) {
|
||||
if (mMsg_CHECK_MAINNORMALCONTINUE()) {
|
||||
if (mMsg_GET_MSG_NUM() == 0x3DEF) {
|
||||
@@ -317,6 +314,9 @@ static void aPT_Connect_AGB_to_Rcv(PTERMINAL_ACTOR* actor, GAME* game) {
|
||||
if (actor->counter >= 60) {
|
||||
mMsg_UNSET_LOCKCONTINUE();
|
||||
mMsg_SET_CONTINUE_MSG_NUM(0x3DF3);
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
mMsg_SET_FORCENEXT();
|
||||
#endif
|
||||
aPT_Setup(actor, game, aPT_PROC_WAIT);
|
||||
}
|
||||
break;
|
||||
@@ -334,6 +334,7 @@ static void aPT_Connect_AGB_to_Snd_Init(PTERMINAL_ACTOR* actor, GAME* game) {
|
||||
mGcgba_EndComm();
|
||||
}
|
||||
|
||||
// Aus version sets the force next flag upon fail
|
||||
static void aPT_Connect_AGB_to_Snd(PTERMINAL_ACTOR* actor, GAME* game) {
|
||||
if (mMsg_CHECK_MAINNORMALCONTINUE()) {
|
||||
if (mMsg_GET_MSG_NUM() == 0x3DF2) {
|
||||
@@ -350,6 +351,9 @@ static void aPT_Connect_AGB_to_Snd(PTERMINAL_ACTOR* actor, GAME* game) {
|
||||
if (actor->counter >= 60) {
|
||||
mMsg_UNSET_LOCKCONTINUE();
|
||||
mMsg_SET_CONTINUE_MSG_NUM(0x3DF3);
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
mMsg_SET_FORCENEXT();
|
||||
#endif
|
||||
aPT_Setup(actor, game, aPT_PROC_WAIT);
|
||||
}
|
||||
break;
|
||||
|
||||
+4
-2
@@ -67,15 +67,15 @@ static void aRP_make_vtx(Vtx* vtx) {
|
||||
};
|
||||
|
||||
Vtx* make;
|
||||
int fact;
|
||||
u8* flag;
|
||||
int i;
|
||||
int fact;
|
||||
|
||||
flag = flg;
|
||||
fact = (*(f32*)mEv_get_save_area(0xE, 9) * 100.0f);
|
||||
make = tol_rope_1_v;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tol_rope_1_v, Vtx); i++, vtx++, flag++) {
|
||||
for (i = 0; i < ARRAY_SIZE(tol_rope_1_v, Vtx); i++) {
|
||||
vtx[0] = make[0];
|
||||
|
||||
if (flag[0] == 1) {
|
||||
@@ -85,6 +85,8 @@ static void aRP_make_vtx(Vtx* vtx) {
|
||||
}
|
||||
|
||||
make++;
|
||||
vtx++;
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ static void aSCR_set_bgOffset(STRUCTURE_ACTOR* car, int offs) {
|
||||
static f32 addZ[] = { 40.0f, 0.0f, -40.0f };
|
||||
|
||||
mCoBG_OffsetTable_c* offset;
|
||||
int i;
|
||||
int j;
|
||||
int i;
|
||||
xyz_t pos;
|
||||
|
||||
offset = height_table[offs];
|
||||
|
||||
@@ -1309,7 +1309,12 @@ static int aSOG_gyoei_place_check(u8 spawn_area, u32 block_type) {
|
||||
break;
|
||||
|
||||
case aSOG_SPAWN_AREA_RIVER_MOUTH:
|
||||
// Aus version clarifies that 'river mouth' spawns can only spawn in the river & sea block.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if ((block_type & (mRF_BLOCKKIND_RIVER | mRF_BLOCKKIND_MARINE)) != (mRF_BLOCKKIND_RIVER | mRF_BLOCKKIND_MARINE)) {
|
||||
#else
|
||||
if ((block_type & mRF_BLOCKKIND_RIVER) != mRF_BLOCKKIND_RIVER) {
|
||||
#endif
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -273,6 +273,7 @@ static void Shop_Goods_Actor_single_drawR(GAME* game, mActor_name_t item, xyz_t*
|
||||
LightsN* lightsN;
|
||||
|
||||
if (item >= data_p->item_start && item <= data_p->item_end) {
|
||||
const aSG_data_c* data_p = &src_data_p[i];
|
||||
int xlu_flag = data_p->xlu_gfx0[mode] != NULL;
|
||||
GRAPH* graph;
|
||||
|
||||
|
||||
@@ -64,6 +64,45 @@ static u8* aSM_SucureBank(size_t size, GAME* game) {
|
||||
return (u8*)zelda_malloc_align(size, 32);
|
||||
}
|
||||
|
||||
// TODO: fakematch
|
||||
#if VERSION == VER_GAFU01_00
|
||||
static int aSM_SecureManakinBank(ACTOR* actorx, GAME* game) {
|
||||
SHOP_MANEKIN_ACTOR* shop_manekin = (SHOP_MANEKIN_ACTOR*)actorx;
|
||||
int count = shop_manekin->current_block_manekin_num;
|
||||
MANEKIN_ACTOR* manekin = shop_manekin->manekin_actors;
|
||||
int i;
|
||||
u8* tex_p;
|
||||
u8* pal_p;
|
||||
u32 size;
|
||||
u32 pal_size;
|
||||
u32 ofs;
|
||||
|
||||
// size = (count + 1) * mNW_DESIGN_TEX_SIZE;
|
||||
tex_p = aSM_SucureBank((count + 1) * mNW_DESIGN_TEX_SIZE, game);
|
||||
if (tex_p == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
manekin[i].tex_p = tex_p + (int)(i * mNW_DESIGN_TEX_SIZE);
|
||||
}
|
||||
|
||||
shop_manekin->naked_tex_p = tex_p + (count * mNW_DESIGN_TEX_SIZE);
|
||||
|
||||
pal_p = aSM_SucureBank((count + 1) * mNW_PALETTE_SIZE, game);
|
||||
if (pal_p == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
manekin[i].palette_p = pal_p + (int)(i << 5);
|
||||
}
|
||||
|
||||
shop_manekin->naked_pal_p = pal_p + (int)(count << 5);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
static int aSM_SecureManakinBank(ACTOR* actorx, GAME* game) {
|
||||
SHOP_MANEKIN_ACTOR* shop_manekin = (SHOP_MANEKIN_ACTOR*)actorx;
|
||||
int count = shop_manekin->current_block_manekin_num;
|
||||
@@ -98,6 +137,7 @@ static int aSM_SecureManakinBank(ACTOR* actorx, GAME* game) {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void aSM_SearchManekinPlace(int* ux, int* uz, mActor_name_t* item, int idx, int bx, int bz) {
|
||||
mActor_name_t* fg_p = mFI_BkNumtoUtFGTop(bx, bz);
|
||||
|
||||
@@ -28,12 +28,21 @@ static void aSHR_set_bgOffset(ACTOR* actorx, int table_idx) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
xyz_t pos;
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
pos.z = actorx->home.position.z + addZ[i];
|
||||
pos.x = actorx->home.position.x + addX[0];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, height_table_p[0], __FILE__, 241);
|
||||
|
||||
pos.x = actorx->home.position.x + addX[1];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, height_table_p[1], __FILE__, 245);
|
||||
#else
|
||||
pos.z = actorx->home.position.z + addZ[i];
|
||||
pos.x = actorx->home.position.x + addX[0];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, height_table_p[0], __FILE__, 238);
|
||||
|
||||
pos.x = actorx->home.position.x + addX[1];
|
||||
mCoBG_SetPluss5PointOffset_file(pos, height_table_p[1], __FILE__, 242);
|
||||
#endif
|
||||
|
||||
height_table_p += 2;
|
||||
}
|
||||
|
||||
+9
-7
@@ -323,8 +323,14 @@ static int aSIGN_actor_set_target(SIGN_ACTOR* sign, GAME* game) {
|
||||
int abs_angle_y = ABS(angle_y);
|
||||
|
||||
if (abs_angle_y < DEG2SHORT_ANGLE2(45.0f)) {
|
||||
// TODO: fakematch? Why do these differ?
|
||||
#if VERSION == VER_GAFU01_00
|
||||
s16 d_angle_y =
|
||||
(angle_y + DEG2SHORT_ANGLE2(180.0f)) - player_actor->shape_info.rotation.y;
|
||||
(s16)(angle_y + DEG2SHORT_ANGLE2(180.0f)) - player_actor->shape_info.rotation.y;
|
||||
#else
|
||||
s16 d_angle_y =
|
||||
(angle_y + DEG2SHORT_ANGLE2(180.0f)) - player_actor->shape_info.rotation.y;
|
||||
#endif
|
||||
s16 diff_angle_y = ABS(d_angle_y);
|
||||
|
||||
if (diff_angle_y <= DEG2SHORT_ANGLE2(68.83483f)) {
|
||||
@@ -761,7 +767,7 @@ static void aSIGN_random_set(void) {
|
||||
for (bx = 0; bx < bx_max; bx++) {
|
||||
fg_p = mFI_BkNumtoUtFGTop(bx, bz);
|
||||
for (ut_z = 0; ut_z < UT_Z_NUM; ut_z++) {
|
||||
for (ut_x = 0; ut_x < UT_X_NUM; ut_x++) {
|
||||
for (ut_x = 0; ut_x < UT_X_NUM; ut_x++, fg_p++) {
|
||||
if (*fg_p == TREE && GETREG(NMREG, 0) == 1000) {
|
||||
mFI_UtNumtoFGSet_common(SIGNBOARD_START + (qrand() >> 27), bx * UT_X_NUM + ut_x,
|
||||
bz * UT_Z_NUM + ut_z, TRUE);
|
||||
@@ -771,8 +777,6 @@ static void aSIGN_random_set(void) {
|
||||
bz * UT_Z_NUM + ut_z, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
fg_p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -792,12 +796,10 @@ static void aSIGN_all_clear(void) {
|
||||
for (bx = 0; bx < bx_max; bx++) {
|
||||
fg_p = mFI_BkNumtoUtFGTop(bx, bz);
|
||||
for (ut_z = 0; ut_z < UT_Z_NUM; ut_z++) {
|
||||
for (ut_x = 0; ut_x < UT_X_NUM; ut_x++) {
|
||||
for (ut_x = 0; ut_x < UT_X_NUM; ut_x++, fg_p++) {
|
||||
if (*fg_p >= SIGNBOARD_START && *fg_p < (SIGNBOARD_END + 1)) {
|
||||
mFI_UtNumtoFGSet_common(EMPTY_NO, bx * UT_X_NUM + ut_x, bz * UT_Z_NUM + ut_z, TRUE);
|
||||
}
|
||||
|
||||
fg_p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ static void aUKI_clear_spd(ACTOR* actorx) {
|
||||
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) {
|
||||
static void aUKI_parabola_init(UKI_ACTOR* uki, xyz_t* p0, xyz_t* p1, s16 timer, u8 type) {
|
||||
f32 y_param;
|
||||
f32 f = (f32)(int)timer;
|
||||
f32 step = f * 0.5f;
|
||||
|
||||
+35
-13
@@ -112,12 +112,13 @@ static int aWeather_GetWeatherPrvNum(ACTOR* actor) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
int i;
|
||||
int num = 0;
|
||||
|
||||
for (i = 100; i != 0; i--, priv++, num++) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
if (priv->use == 0) {
|
||||
return num;
|
||||
return i;
|
||||
}
|
||||
|
||||
priv++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -373,7 +374,11 @@ static void aWeather_SnowInAdvance(ACTOR* actorx, GAME* game, int moves) {
|
||||
|
||||
static void Weather_Actor_ct(ACTOR* actor, GAME* game) {
|
||||
static s16 DemoWeatherTbl[5][2] = {
|
||||
3, 1, 1, 2, 0, 0, 0, 0, 2, 1,
|
||||
{ mEnv_WEATHER_SAKURA, mEnv_WEATHER_INTENSITY_LIGHT },
|
||||
{ mEnv_WEATHER_RAIN, mEnv_WEATHER_INTENSITY_NORMAL },
|
||||
{ mEnv_WEATHER_CLEAR, mEnv_WEATHER_INTENSITY_NONE },
|
||||
{ mEnv_WEATHER_CLEAR, mEnv_WEATHER_INTENSITY_NONE },
|
||||
{ mEnv_WEATHER_SNOW, mEnv_WEATHER_INTENSITY_LIGHT },
|
||||
};
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
@@ -399,7 +404,13 @@ static void Weather_Actor_ct(ACTOR* actor, GAME* game) {
|
||||
weather->current_status = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather));
|
||||
weather->next_status = weather->current_status;
|
||||
weather->current_level = mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather));
|
||||
// Aus version sets the aim level to the current level (from save) rather than from the
|
||||
// common data struct
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
weather->current_aim_level = weather->current_level;
|
||||
#else
|
||||
weather->current_aim_level = Common_Get(weather_intensity);
|
||||
#endif
|
||||
}
|
||||
|
||||
weather->ptr = NULL;
|
||||
@@ -526,17 +537,19 @@ static void aWeather_MoveWeatherPrv(ACTOR* actorx, GAME* game) {
|
||||
|
||||
static int aWeather_CountWeatherPrivate(ACTOR* actorx) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actorx;
|
||||
int i;
|
||||
int count;
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
int count;
|
||||
int i;
|
||||
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < 100; i++, priv++) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
|
||||
if (priv->use != 0) {
|
||||
count++;
|
||||
}
|
||||
|
||||
priv++;
|
||||
}
|
||||
|
||||
return count;
|
||||
@@ -660,18 +673,22 @@ static void aWeather_MakeKaminari(ACTOR* actorx) {
|
||||
}
|
||||
|
||||
static void Weather_Actor_move(ACTOR* actor, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
xyz_t* pos;
|
||||
WEATHER_ACTOR* weather;
|
||||
GAME_PLAY* play;
|
||||
Camera2* camera;
|
||||
CameraLookat* lookat;
|
||||
s16 angle;
|
||||
s16 umbrella;
|
||||
|
||||
mActor_name_t field_id;
|
||||
|
||||
pos = Camera2_getCenterPos_p();
|
||||
weather = (WEATHER_ACTOR*)actor;
|
||||
play = (GAME_PLAY*)game;
|
||||
camera = &play->camera;
|
||||
lookat = &camera->lookat;
|
||||
angle = search_position_angleY(&lookat->center, &lookat->eye);
|
||||
|
||||
angle = search_position_angleY(&camera->lookat.center, &camera->lookat.eye);
|
||||
aWeather_MakeKaminari(actor);
|
||||
aWeather_CheckWeatherTimer(actor);
|
||||
aWeather_MakeWeatherPrv(actor, game);
|
||||
@@ -683,9 +700,14 @@ static void Weather_Actor_move(ACTOR* actor, GAME* game) {
|
||||
|
||||
aWeather_ChangeWeatherTime0(actor);
|
||||
|
||||
if (Common_Get(weather) == 1) {
|
||||
if (Common_Get(weather) == mEnv_WEATHER_RAIN) {
|
||||
umbrella = mPlib_check_player_open_umbrella(game);
|
||||
#if VERSION == VER_GAFU01_00
|
||||
field_id = mFI_GetFieldId();
|
||||
if (mFI_GET_TYPE(field_id) == mFI_FIELDTYPE2_FG && umbrella != weather->umbrella_flag) {
|
||||
#else
|
||||
if (umbrella != weather->umbrella_flag) {
|
||||
#endif
|
||||
aWeather_ChangeEnvSE(actor, game, weather->current_status, weather->current_level);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,13 @@ aWeather_Profile_c iam_weather_rain = {
|
||||
static int aWeatherRain_DecideMakeRainCount(ACTOR* actor) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
if (weather->current_level == 1) {
|
||||
if (weather->current_level == mEnv_WEATHER_INTENSITY_LIGHT) {
|
||||
return 1;
|
||||
} else if (weather->current_level == mEnv_WEATHER_INTENSITY_NORMAL) {
|
||||
return 2;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return (weather->current_level - 2 ? 0 : -1) + 3;
|
||||
}
|
||||
|
||||
static void aWeatherRain_make(ACTOR* actor, GAME* game) {
|
||||
|
||||
@@ -510,8 +510,9 @@ static u8 aNPC_get_greeting_step(ACTOR* actorx) {
|
||||
}
|
||||
|
||||
static void aNPC_act_greeting_chg_step(NPC_ACTOR* nactorx, u8 step) {
|
||||
// Why 11? is this a bug?
|
||||
// clang-format off
|
||||
static u8 act_idx[] = {
|
||||
static u8 act_idx[11] = {
|
||||
aNPC_ACTION_TYPE_TURN,
|
||||
aNPC_ACTION_TYPE_WALK,
|
||||
aNPC_ACTION_TYPE_PAL_WAIT,
|
||||
@@ -522,6 +523,7 @@ static void aNPC_act_greeting_chg_step(NPC_ACTOR* nactorx, u8 step) {
|
||||
aNPC_ACTION_TYPE_GET_CHANGE,
|
||||
aNPC_ACTION_TYPE_GET_CHANGE,
|
||||
aNPC_ACTION_TYPE_GET_CHANGE,
|
||||
aNPC_ACT_GREETING_STEP_TURN, // bug?
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -90,9 +90,16 @@ static void aNPC_act_react_tool_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
|
||||
if (nactorx->think.force_call_flag == aNPC_FORCE_CALL_REQUEST) {
|
||||
nactorx->condition_info.demo_flg = 0;
|
||||
} else {
|
||||
// Aus version removes the check skip flags for movement bounding
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_ENTRANCE_CHECK | aNPC_COND_DEMO_SKIP_HEAD_LOOKAT |
|
||||
aNPC_COND_DEMO_SKIP_TALK_CHECK | aNPC_COND_DEMO_SKIP_ITEM | aNPC_COND_DEMO_SKIP_FORWARD_CHECK |
|
||||
aNPC_COND_DEMO_SKIP_MOVE_Y;
|
||||
#else
|
||||
nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_ENTRANCE_CHECK | aNPC_COND_DEMO_SKIP_HEAD_LOOKAT |
|
||||
aNPC_COND_DEMO_SKIP_TALK_CHECK | aNPC_COND_DEMO_SKIP_ITEM | aNPC_COND_DEMO_SKIP_FORWARD_CHECK |
|
||||
aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK;
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (feel) {
|
||||
|
||||
@@ -105,19 +105,16 @@ static void aNPC_set_anime_se_info(NPC_ACTOR* nactorx, aNPC_Animation_c* anim) {
|
||||
nactorx->draw.se.rfoot.num_check_frames = 0;
|
||||
}
|
||||
|
||||
n = data_table_p->other_se_type;
|
||||
if (n != aNPC_OTHER_SE_TYPE_NONE) {
|
||||
if (data_table_p->other_se_type != aNPC_OTHER_SE_TYPE_NONE) {
|
||||
n = data_table_p->other_se_type;
|
||||
nactorx->draw.se.other_se_type = n;
|
||||
other_data_p = data_table_p->other_se_data;
|
||||
dst_data_p = nactorx->draw.se.other_se;
|
||||
|
||||
while (n != 0) {
|
||||
for (i = 0; i != n; i++, other_data_p++, dst_data_p++) {
|
||||
dst_data_p->se_data.num_check_frames = other_data_p->se_data.num_check_frames;
|
||||
dst_data_p->se_data.check_frame_tbl = other_data_p->se_data.check_frame_tbl;
|
||||
dst_data_p->se_no = other_data_p->se_no;
|
||||
other_data_p++;
|
||||
dst_data_p++;
|
||||
n--;
|
||||
}
|
||||
} else {
|
||||
aNPC_other_se_data_c* dst_data_p = nactorx->draw.se.other_se;
|
||||
|
||||
@@ -14,6 +14,43 @@ static void aMJN2_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
|
||||
(*act_proc[type])(nactorx, play);
|
||||
}
|
||||
|
||||
// Aus adds a missing check for pressing Y (opens inventory),
|
||||
// and a check for interactions with signboards.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static int aMJN2_check_submenu(GAME_PLAY* play) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (chkTrigger(BUTTON_START) || chkTrigger(BUTTON_Y) || mSM_CHECK_OPEN_MAP() == TRUE) {
|
||||
ret = TRUE;
|
||||
} else {
|
||||
ACTOR* playerx = GET_PLAYER_ACTOR_ACTOR(play);
|
||||
|
||||
if (playerx != NULL) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)playerx;
|
||||
|
||||
if (player->a_btn_pressed == TRUE &&
|
||||
ABS(DIFF_SHORT_ANGLE(playerx->shape_info.rotation.y, DEG2SHORT_ANGLE(-180.0f))) < DEG2SHORT_ANGLE2(45.0f)) {
|
||||
if (ITEM_IS_SIGNBOARD(player->item_in_front)) {
|
||||
ret = TRUE;
|
||||
} else {
|
||||
switch (player->item_in_front) {
|
||||
case MESSAGE_BOARD0:
|
||||
case MESSAGE_BOARD1:
|
||||
case MAP_BOARD0:
|
||||
case MAP_BOARD1:
|
||||
ret = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int aMJN2_check_submenu(GAME_PLAY* play) {
|
||||
int ret = FALSE;
|
||||
|
||||
@@ -43,6 +80,7 @@ static int aMJN2_check_submenu(GAME_PLAY* play) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void aMJN2_start_wait(NPC_MAJIN2_ACTOR* actor, GAME_PLAY* play) {
|
||||
if (!mPlib_check_player_actor_main_index_OutDoorMove2((GAME*)play)) {
|
||||
|
||||
@@ -289,15 +289,19 @@ static void aNM2_make_shasho(NPC_MASK_CAT2_ACTOR* actorx, GAME_PLAY* play) {
|
||||
}
|
||||
|
||||
static BOOL aNM2_chk_mask_texture() {
|
||||
int i;
|
||||
u8* design_data;
|
||||
BOOL res = FALSE;
|
||||
for (i = mNW_DESIGN_TEX_SIZE, design_data = Save_Get(mask_cat.design.design.data); i > 0; i--, design_data++) {
|
||||
u8* design_data = Save_Get(mask_cat.design.design.data);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mNW_DESIGN_TEX_SIZE; i++) {
|
||||
if (*design_data != 0xFF) {
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
design_data++;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,43 @@ static int aNPC_circleRangeCheck(NPC_ACTOR* nactorx, xyz_t* rev_pos_p, xyz_t pos
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Aus added this function
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static int aNPC_squareRangeCheck(NPC_ACTOR* nactorx, xyz_t pos) {
|
||||
int ux;
|
||||
int uz;
|
||||
int ret = TRUE;
|
||||
|
||||
if (mFI_Wpos2UtNum_inBlock(&ux, &uz, pos) == TRUE) {
|
||||
if (ux < 1 || ux > (UT_X_NUM - 1) || uz < 1 || uz > (UT_Z_NUM - 1)) {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
// is this supposed to be 'Revise'?
|
||||
// Aus removes the condition flag checks and collision kind check
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static void aNPC_circleRangeRevice(NPC_ACTOR* nactorx) {
|
||||
xyz_t rev_pos;
|
||||
int res = aNPC_circleRangeCheck(nactorx, &rev_pos, nactorx->actor_class.world.position);
|
||||
|
||||
if (nactorx->movement.range_type == aNPC_MOVE_RANGE_TYPE_CIRCLE) {
|
||||
if (nactorx->action.type != aNPC_ACT_TYPE_SEARCH ||
|
||||
(nactorx->movement.target != NULL && nactorx->movement.target->part != ACTOR_PART_PLAYER)) {
|
||||
nactorx->actor_class.world.position.x += rev_pos.x;
|
||||
nactorx->actor_class.world.position.z += rev_pos.z;
|
||||
}
|
||||
} else if (res == TRUE && nactorx->condition_info.entrance_flag == aNPC_ENTRANCE_TYPE_NONE) {
|
||||
nactorx->movement.range_type = aNPC_MOVE_RANGE_TYPE_CIRCLE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void aNPC_circleRangeRevice(NPC_ACTOR* nactorx) {
|
||||
if ((nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV) == 0 &&
|
||||
(nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_LOVE_CHECK) == 0 &&
|
||||
@@ -100,6 +136,48 @@ static void aNPC_circleRangeRevice(NPC_ACTOR* nactorx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Aus version adds this function
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static void aNPC_moveRangeRevice(NPC_ACTOR* nactorx) {
|
||||
int bx;
|
||||
int bz;
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if ((nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV) == 0 &&
|
||||
(nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_LOVE_CHECK) == 0 &&
|
||||
nactorx->collision.check_kind == aNPC_BG_CHECK_TYPE_RANGE) {
|
||||
switch (nactorx->movement.range_type) {
|
||||
case aNPC_MOVE_RANGE_TYPE_BLOCK:
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, nactorx->actor_class.world.position) == TRUE) {
|
||||
if (bx != nactorx->actor_class.block_x || bz != nactorx->actor_class.block_z) {
|
||||
xyz_t_move(&nactorx->actor_class.world.position, &nactorx->actor_class.last_world_position);
|
||||
nactorx->actor_class.block_x = bx;
|
||||
nactorx->actor_class.block_z = bz;
|
||||
}
|
||||
} else {
|
||||
xyz_t_move(&nactorx->actor_class.world.position, &nactorx->actor_class.last_world_position);
|
||||
nactorx->actor_class.block_x = bx;
|
||||
nactorx->actor_class.block_z = bz;
|
||||
}
|
||||
break;
|
||||
case aNPC_MOVE_RANGE_TYPE_CIRCLE:
|
||||
break;
|
||||
case aNPC_MOVE_RANGE_TYPE_SQUARE:
|
||||
if (mFI_Wpos2UtNum_inBlock(&ux, &uz, nactorx->actor_class.world.position) == TRUE) {
|
||||
if (ux < 1 || ux >= (UT_X_NUM - 1) || uz < 1 || uz >= (UT_Z_NUM - 1)) {
|
||||
xyz_t_move(&nactorx->actor_class.world.position, &nactorx->actor_class.last_world_position);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
aNPC_circleRangeRevice(nactorx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int aNPC_moveRangeCheck2(NPC_ACTOR* nactorx, xyz_t* rev_pos_p, xyz_t pos, u8 range_type) {
|
||||
int ret = TRUE;
|
||||
@@ -115,6 +193,12 @@ static int aNPC_moveRangeCheck2(NPC_ACTOR* nactorx, xyz_t* rev_pos_p, xyz_t pos,
|
||||
case aNPC_MOVE_RANGE_TYPE_CIRCLE:
|
||||
ret = aNPC_circleRangeCheck(nactorx, rev_pos_p, pos);
|
||||
break;
|
||||
// Aus version adds this new move range bound type
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
case aNPC_MOVE_RANGE_TYPE_SQUARE:
|
||||
ret = aNPC_squareRangeCheck(nactorx, pos);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
// Aus version increased client program size by 0x04 bytes
|
||||
// and loader program by 0x3C bytes
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
#define aNNW_CLIENT_PRG_SIZE 0xACC4
|
||||
#define aNNW_CLIENT_LDR_SIZE 0x8D5C
|
||||
#else
|
||||
#define aNNW_CLIENT_PRG_SIZE 0xACC0
|
||||
#define aNNW_CLIENT_LDR_SIZE 0x8D20
|
||||
#endif
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
static u8 aNNW_client_prg[] = {
|
||||
|
||||
@@ -129,11 +129,15 @@ static u8 aNNW_next_target(NPC_NEEDLEWORK_ACTOR* actor, GAME_PLAY* play) {
|
||||
return 0;
|
||||
} else {
|
||||
for (i = 0; i < 5; i++) {
|
||||
// TODO: This likely explains why the other tables in this TU needed to be 1D instead of 2D
|
||||
// TODO: fakematch
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
area = near_area_table[now_area][i];
|
||||
#else
|
||||
u8* table_p = (u8*)near_area_table;
|
||||
|
||||
table_p += now_area * 5;
|
||||
area = table_p[i];
|
||||
#endif
|
||||
if (area == player_area) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -170,12 +170,10 @@ static int aNNW_trend_check_umbrella(int umbrella_idx) {
|
||||
int count;
|
||||
|
||||
animals = Save_Get(animals);
|
||||
i = 0;
|
||||
count = 0;
|
||||
idx = (umbrella_idx & 3) + UMBRELLA_NUM;
|
||||
umbrella_idx += UMBRELLA_NUM;
|
||||
|
||||
for (i; i < ANIMAL_NUM_MAX; i++) {
|
||||
|
||||
for (i = 0, count = 0; i < ANIMAL_NUM_MAX; i++) {
|
||||
animal = &animals[i];
|
||||
if (!mNpc_CheckFreeAnimalPersonalID(&animal->id)) {
|
||||
if (animal->umbrella_id == umbrella_idx || animal->umbrella_id == idx) {
|
||||
|
||||
@@ -18,10 +18,10 @@ static void aNRST_think_door(NPC_RESTART_ACTOR* actor, GAME_PLAY* play) {
|
||||
int arrange_idx = mHS_get_arrange_idx(Common_Get(player_no));
|
||||
|
||||
door_data.next_scene_id = SCENE_FG;
|
||||
door_data.exit_position.x = 2240;
|
||||
door_data.exit_position.z = 2240;
|
||||
door_data.exit_type = 1;
|
||||
door_data.extra_data = 1;
|
||||
door_data.exit_position.x = 2240;
|
||||
door_data.exit_position.z = 2240;
|
||||
door_data.exit_position.y = 0;
|
||||
door_data.door_actor_name = EMPTY_NO;
|
||||
door_data.wipe_type = WIPE_TYPE_FADE_BLACK;
|
||||
|
||||
@@ -15,19 +15,21 @@ static void aSEN_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aSEN_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aSEN_actor_save(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Npc_Sendo_Profile = {
|
||||
mAc_PROFILE_NPC_SENDO,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
SP_NPC_SENDO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(NPC_SENDO_ACTOR),
|
||||
&aSEN_actor_ct,
|
||||
&aSEN_actor_dt,
|
||||
&aSEN_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
&aSEN_actor_save
|
||||
mAc_PROFILE_NPC_SENDO,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
SP_NPC_SENDO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(NPC_SENDO_ACTOR),
|
||||
aSEN_actor_ct,
|
||||
aSEN_actor_dt,
|
||||
aSEN_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aSEN_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static int aSEN_talk_init(ACTOR*, GAME*);
|
||||
static int aSEN_talk_end_chk(ACTOR*, GAME*);
|
||||
@@ -38,48 +40,48 @@ static void aSEN_setup_think_proc(NPC_SENDO_ACTOR*, GAME_PLAY*, u8);
|
||||
static MtxF aSEN_matrix;
|
||||
|
||||
static void aSEN_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
&aSEN_actor_move,
|
||||
&aSEN_actor_draw,
|
||||
5,
|
||||
(aNPC_TALK_REQUEST_PROC)&none_proc1,
|
||||
&aSEN_talk_init,
|
||||
&aSEN_talk_end_chk,
|
||||
0
|
||||
};
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
&aSEN_actor_move,
|
||||
&aSEN_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_SPECIAL,
|
||||
(aNPC_TALK_REQUEST_PROC)&none_proc1,
|
||||
&aSEN_talk_init,
|
||||
&aSEN_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
if ((*Common_Get(clip).npc_clip->birth_check_proc)(actorx, game) == TRUE) {
|
||||
NPC_ACTOR* npc_actor = (NPC_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
NPC_ACTOR* npc_actor = (NPC_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
npc_actor->schedule.schedule_proc = &aSEN_schedule_proc;
|
||||
(*Common_Get(clip).npc_clip->ct_proc)(actorx, game, &ct_data);
|
||||
}
|
||||
npc_actor->schedule.schedule_proc = &aSEN_schedule_proc;
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSEN_actor_save(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->save_proc)(actorx, game);
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aSEN_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
NPC_SENDO_ACTOR* sendo = (NPC_SENDO_ACTOR*)actorx;
|
||||
BOAT_DEMO_ACTOR* boat_demo;
|
||||
|
||||
(*Common_Get(clip).npc_clip->dt_proc)(actorx, game);
|
||||
NPC_SENDO_ACTOR* sendo = (NPC_SENDO_ACTOR*)actorx;
|
||||
BOAT_DEMO_ACTOR* boat_demo;
|
||||
|
||||
boat_demo = (BOAT_DEMO_ACTOR*)actorx->parent_actor;
|
||||
if (boat_demo != NULL && boat_demo->npc_sendo_actor == sendo) {
|
||||
boat_demo->npc_sendo_actor = NULL;
|
||||
}
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
|
||||
boat_demo = (BOAT_DEMO_ACTOR*)actorx->parent_actor;
|
||||
if (boat_demo != NULL && boat_demo->npc_sendo_actor == sendo) {
|
||||
boat_demo->npc_sendo_actor = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void aSEN_actor_init(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->init_proc)(actorx, game);
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aSEN_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
Matrix_put(&aSEN_matrix);
|
||||
(*Common_Get(clip).npc_clip->draw_proc)(actorx, game);
|
||||
Matrix_put(&aSEN_matrix);
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/ac_npc_sendo_move.c_inc"
|
||||
|
||||
@@ -825,9 +825,9 @@ static int aNSC_check_money_overflow(u32 p1, u32 counter) {
|
||||
}
|
||||
|
||||
static int aNSC_check_buy_item_sub(u32* quant, mActor_name_t itm_name) {
|
||||
int i;
|
||||
mActor_name_t* item = Now_Private->inventory.pockets;
|
||||
int res = aNSC_CHECK_BUY_NORMAL_SUB;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
|
||||
if (*item == itm_name) {
|
||||
|
||||
@@ -208,7 +208,18 @@ static int aNPC_check_entrance(NPC_ACTOR* nactorx) {
|
||||
}
|
||||
|
||||
aNPC_set_request_act(nactorx, 2, act, aNPC_ACT_TYPE_TO_POINT, arg_data);
|
||||
// Aus version changes special NPC movement time to be within a sub-square of the acre,
|
||||
// instead of anywhere in the acre. This was probably added to stop the Jingle glitch
|
||||
// where you can talk to Jingle from another acre and break his logic.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (aNPC_IS_NRM_NPC(nactorx)) {
|
||||
nactorx->movement.range_type = aNPC_MOVE_RANGE_TYPE_BLOCK;
|
||||
} else {
|
||||
nactorx->movement.range_type = aNPC_MOVE_RANGE_TYPE_SQUARE;
|
||||
}
|
||||
#else
|
||||
nactorx->movement.range_type = aNPC_MOVE_RANGE_TYPE_BLOCK;
|
||||
#endif
|
||||
} else {
|
||||
aNPC_set_request_act(nactorx, 2, aNPC_ACT_WAIT, aNPC_ACT_TYPE_DEFAULT, aNPC_req_default_data);
|
||||
}
|
||||
|
||||
@@ -53,25 +53,25 @@ static void aNTT_roll2(NPC_TOTAKEKE_ACTOR *totakeke, GAME_PLAY *play) {
|
||||
CLIP(mikanbox_clip)->roll_proc(totakeke, play);
|
||||
weather = CLIP(weather_clip);
|
||||
if (weather != NULL) {
|
||||
if (totakeke->roll4_count == 0x15e0) {
|
||||
if (totakeke->roll4_count == FRAMERATE_SELECT(5600, 4665)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_SAKURA, mEnv_WEATHER_INTENSITY_HEAVY);
|
||||
} else if (totakeke->roll4_count == 0x51e) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(1310, 1090)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_RAIN, mEnv_WEATHER_INTENSITY_HEAVY);
|
||||
} else if (totakeke->roll4_count == 0x992) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(2450, 2041)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_LEAVES, mEnv_WEATHER_INTENSITY_HEAVY);
|
||||
} else if (totakeke->roll4_count == 0xf46) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(3910, 3258)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_SNOW, mEnv_WEATHER_INTENSITY_HEAVY);
|
||||
} else if (totakeke->roll4_count == 0x74e) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(1870, 1558)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_RAIN, mEnv_WEATHER_INTENSITY_NONE);
|
||||
} else if (totakeke->roll4_count == 0xb9a) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(2970, 2550)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_LEAVES, mEnv_WEATHER_INTENSITY_NONE);
|
||||
} else if (totakeke->roll4_count == 0x12c0) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(4800, 3975)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_SNOW, mEnv_WEATHER_INTENSITY_NONE);
|
||||
} else if (totakeke->roll4_count == 0x18ce) {
|
||||
} else if (totakeke->roll4_count == FRAMERATE_SELECT(6350, 5165)) {
|
||||
weather->change_weather(weather->actor, mEnv_WEATHER_SAKURA, mEnv_WEATHER_INTENSITY_NONE);
|
||||
}
|
||||
}
|
||||
if (totakeke->roll2_count > 0x1be) {
|
||||
if (totakeke->roll2_count > FRAMERATE_SELECT(446, 372)) {
|
||||
totakeke->_9a2 += 1;
|
||||
if (totakeke->_9a2 >= 0x10) {
|
||||
aNTT_setup_think_proc(totakeke, play, 0x8);
|
||||
@@ -87,19 +87,19 @@ static void aNTT_roll4(NPC_TOTAKEKE_ACTOR *totakeke, GAME_PLAY *play) {
|
||||
aNTT_event_save_c *save = (aNTT_event_save_c *)mEv_get_save_area(mEv_EVENT_KK_SLIDER, 0xa);
|
||||
totakeke->roll4_count += 1;
|
||||
CLIP(mikanbox_clip)->roll_proc(totakeke, play);
|
||||
if (totakeke->roll4_count >= 0x1d88 || totakeke->roll4_count <= 0x1c70) {
|
||||
if (totakeke->roll4_count >= FRAMERATE_SELECT(7560, 6330) || totakeke->roll4_count <= FRAMERATE_SELECT(7280, 6070)) {
|
||||
save->copyright_alpha = 0;
|
||||
} else if (totakeke->roll4_count > 0x1d38) {
|
||||
save->copyright_alpha = 3.1875f * (0x1d88 - totakeke->roll4_count);
|
||||
} else if (totakeke->roll4_count < 0x1cc0) {
|
||||
save->copyright_alpha = 3.1875f * (totakeke->roll4_count - 0x1c70);
|
||||
} else if (totakeke->roll4_count > FRAMERATE_SELECT(7480, 6250)) {
|
||||
save->copyright_alpha = 3.1875f * (FRAMERATE_SELECT(7560, 6330) - totakeke->roll4_count);
|
||||
} else if (totakeke->roll4_count < FRAMERATE_SELECT(7360, 6150)) {
|
||||
save->copyright_alpha = 3.1875f * (totakeke->roll4_count - FRAMERATE_SELECT(7280, 6070));
|
||||
} else {
|
||||
save->copyright_alpha = 255;
|
||||
}
|
||||
|
||||
if (CLIP(mikanbox_clip) != NULL) {
|
||||
CLIP(mikanbox_clip)->sound_proc(totakeke, play, 0);
|
||||
if (CLIP(mikanbox_clip)->section_chk_proc(0x4) && totakeke->roll4_count > 0x1d88) {
|
||||
if (CLIP(mikanbox_clip)->section_chk_proc(0x4) && totakeke->roll4_count > FRAMERATE_SELECT(7560, 6330)) {
|
||||
save->copyright_alpha = 0;
|
||||
aNTT_setup_think_proc(totakeke, play, 0x9);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ int aECPD_check_possession() {
|
||||
mActor_name_t* pocket = Now_Private->inventory.pockets;
|
||||
int i;
|
||||
int res = FALSE;
|
||||
for (i = mPr_POCKETS_SLOT_COUNT; i > 0; i--) {
|
||||
for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
|
||||
if (ITEM_NAME_GET_TYPE(*pocket) == NAME_TYPE_ITEM1) {
|
||||
if (ITEM_NAME_GET_CAT(*pocket) == ITEM1_CAT_CARPET) {
|
||||
res = TRUE;
|
||||
@@ -184,11 +184,13 @@ void aECPD_1st_check_init(EV_CARPETPEDDLER_ACTOR* peddler, GAME_PLAY* play) {
|
||||
u8 item_str[mIN_ITEM_NAME_LEN];
|
||||
u8 price_str[6];
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int n = Save_Get(event_save_data).special.event.arabian.used;
|
||||
int price = eECPD_PRICE_START;
|
||||
int i;
|
||||
for (i = 0; i != Save_Get(event_save_data).special.event.arabian.used; i++) {
|
||||
|
||||
for (n; n != 0; n--) {
|
||||
price *= 2;
|
||||
}
|
||||
|
||||
peddler->price = price;
|
||||
mFont_UnintToString(price_str, sizeof(price_str), price, 0x5, TRUE, FALSE, TRUE);
|
||||
mMsg_Set_free_str(msg_p, 0x0, price_str, sizeof(price_str));
|
||||
|
||||
@@ -6,24 +6,24 @@
|
||||
#include "m_play.h"
|
||||
|
||||
enum {
|
||||
aESNT_ACTION_TALK_END_WAIT,
|
||||
aESNT_ACTION_CHK_WISH_1ST,
|
||||
aESNT_ACTION_CHK_WISH_2ND,
|
||||
aESNT_ACTION_CHK_WISH_FINAL,
|
||||
aESNT_ACTION_CHK_WISH_MORE,
|
||||
aESNT_ACTION_MOTION_START_WAIT,
|
||||
aESNT_ACTION_MOTION_END_WAIT,
|
||||
aESNT_ACTION_TALK_END_WAIT,
|
||||
aESNT_ACTION_CHK_WISH_1ST,
|
||||
aESNT_ACTION_CHK_WISH_2ND,
|
||||
aESNT_ACTION_CHK_WISH_FINAL,
|
||||
aESNT_ACTION_CHK_WISH_MORE,
|
||||
aESNT_ACTION_MOTION_START_WAIT,
|
||||
aESNT_ACTION_MOTION_END_WAIT,
|
||||
|
||||
aESNT_ACTION_NUM
|
||||
aESNT_ACTION_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
aESNT_WISH_FTR,
|
||||
aESNT_WISH_CLOTH,
|
||||
aESNT_WISH_WALL,
|
||||
aESNT_WISH_CARPET,
|
||||
aESNT_WISH_FTR,
|
||||
aESNT_WISH_CLOTH,
|
||||
aESNT_WISH_WALL,
|
||||
aESNT_WISH_CARPET,
|
||||
|
||||
aESNT_WISH_NUM
|
||||
aESNT_WISH_NUM
|
||||
};
|
||||
|
||||
#define aESNT_TALK_TALK_SAME_PLAYER_NUM 3
|
||||
@@ -41,21 +41,21 @@ enum {
|
||||
#define aESNT_TALK_NO_MORE_PRESENTS_NUM 3
|
||||
|
||||
enum {
|
||||
aESNT_TALK_TALK_SAME_PLAYER,
|
||||
aESNT_TALK_TALK_OTHER_PLAYER = aESNT_TALK_TALK_SAME_PLAYER + aESNT_TALK_TALK_SAME_PLAYER_NUM,
|
||||
aESNT_TALK_FINAL_PRESENT = aESNT_TALK_TALK_OTHER_PLAYER + aESNT_TALK_TALK_OTHER_PLAYER_NUM,
|
||||
aESNT_TALK_FINAL_NO_PRESENT = aESNT_TALK_FINAL_PRESENT + aESNT_TALK_FINAL_PRESENT_NUM,
|
||||
aESNT_TALK_SAME_BLOCK = aESNT_TALK_FINAL_NO_PRESENT + aESNT_TALK_FINAL_NO_PRESENT_NUM,
|
||||
aESNT_TALK_HELLO = aESNT_TALK_SAME_BLOCK + aESNT_TALK_SAME_BLOCK_NUM,
|
||||
aESNT_TALK_CHK_1ST = aESNT_TALK_HELLO + aESNT_TALK_HELLO_NUM,
|
||||
aESNT_TALK_CHK_2ND = aESNT_TALK_CHK_1ST + aESNT_TALK_CHK_1ST_NUM,
|
||||
aESNT_TALK_CHK_FINAL = aESNT_TALK_CHK_2ND + aESNT_TALK_CHK_2ND_NUM,
|
||||
aESNT_TALK_ALMOST_RECOGNIZE = aESNT_TALK_CHK_FINAL + aESNT_TALK_CHK_FINAL_NUM,
|
||||
aESNT_TALK_FINAL_PRESENT2 = aESNT_TALK_ALMOST_RECOGNIZE + aESNT_TALK_ALMOST_RECOGNIZE_NUM,
|
||||
aESNT_TALK_FINAL_NO_PRESENT2 = aESNT_TALK_FINAL_PRESENT2 + aESNT_TALK_FINAL_PRESENT2_NUM,
|
||||
aESNT_TALK_NO_MORE_PRESENTS = aESNT_TALK_FINAL_NO_PRESENT2 + aESNT_TALK_FINAL_NO_PRESENT2_NUM,
|
||||
aESNT_TALK_TALK_SAME_PLAYER,
|
||||
aESNT_TALK_TALK_OTHER_PLAYER = aESNT_TALK_TALK_SAME_PLAYER + aESNT_TALK_TALK_SAME_PLAYER_NUM,
|
||||
aESNT_TALK_FINAL_PRESENT = aESNT_TALK_TALK_OTHER_PLAYER + aESNT_TALK_TALK_OTHER_PLAYER_NUM,
|
||||
aESNT_TALK_FINAL_NO_PRESENT = aESNT_TALK_FINAL_PRESENT + aESNT_TALK_FINAL_PRESENT_NUM,
|
||||
aESNT_TALK_SAME_BLOCK = aESNT_TALK_FINAL_NO_PRESENT + aESNT_TALK_FINAL_NO_PRESENT_NUM,
|
||||
aESNT_TALK_HELLO = aESNT_TALK_SAME_BLOCK + aESNT_TALK_SAME_BLOCK_NUM,
|
||||
aESNT_TALK_CHK_1ST = aESNT_TALK_HELLO + aESNT_TALK_HELLO_NUM,
|
||||
aESNT_TALK_CHK_2ND = aESNT_TALK_CHK_1ST + aESNT_TALK_CHK_1ST_NUM,
|
||||
aESNT_TALK_CHK_FINAL = aESNT_TALK_CHK_2ND + aESNT_TALK_CHK_2ND_NUM,
|
||||
aESNT_TALK_ALMOST_RECOGNIZE = aESNT_TALK_CHK_FINAL + aESNT_TALK_CHK_FINAL_NUM,
|
||||
aESNT_TALK_FINAL_PRESENT2 = aESNT_TALK_ALMOST_RECOGNIZE + aESNT_TALK_ALMOST_RECOGNIZE_NUM,
|
||||
aESNT_TALK_FINAL_NO_PRESENT2 = aESNT_TALK_FINAL_PRESENT2 + aESNT_TALK_FINAL_PRESENT2_NUM,
|
||||
aESNT_TALK_NO_MORE_PRESENTS = aESNT_TALK_FINAL_NO_PRESENT2 + aESNT_TALK_FINAL_NO_PRESENT2_NUM,
|
||||
|
||||
aESNT_TALK_NUM = aESNT_TALK_NO_MORE_PRESENTS + aESNT_TALK_NO_MORE_PRESENTS_NUM
|
||||
aESNT_TALK_NUM = aESNT_TALK_NO_MORE_PRESENTS + aESNT_TALK_NO_MORE_PRESENTS_NUM
|
||||
};
|
||||
|
||||
static void aESNT_actor_ct(ACTOR*, GAME*);
|
||||
@@ -69,72 +69,80 @@ static int aESNT_talk_init(ACTOR*, GAME*);
|
||||
static int aESNT_talk_end_chk(ACTOR*, GAME*);
|
||||
static void aESNT_setupAction(EVENT_SANTA_ACTOR*, GAME_PLAY*, int);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Ev_Santa_Profile = {
|
||||
mAc_PROFILE_EV_SANTA,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
SP_NPC_SANTA,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(EVENT_SANTA_ACTOR),
|
||||
&aESNT_actor_ct,
|
||||
&aESNT_actor_dt,
|
||||
&aESNT_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
&aESNT_actor_save
|
||||
mAc_PROFILE_EV_SANTA,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_NONE,
|
||||
SP_NPC_SANTA,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(EVENT_SANTA_ACTOR),
|
||||
aESNT_actor_ct,
|
||||
aESNT_actor_dt,
|
||||
aESNT_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
aESNT_actor_save,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void aESNT_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
&aESNT_actor_move,
|
||||
&aESNT_actor_draw,
|
||||
3,
|
||||
&aESNT_talk_request,
|
||||
&aESNT_talk_init,
|
||||
&aESNT_talk_end_chk,
|
||||
0
|
||||
};
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
aESNT_actor_move,
|
||||
aESNT_actor_draw,
|
||||
aNPC_CT_SCHED_TYPE_WANDER,
|
||||
aESNT_talk_request,
|
||||
aESNT_talk_init,
|
||||
aESNT_talk_end_chk,
|
||||
0,
|
||||
};
|
||||
|
||||
EVENT_SANTA_ACTOR* santa = (EVENT_SANTA_ACTOR*)actorx;
|
||||
EVENT_SANTA_ACTOR* santa = (EVENT_SANTA_ACTOR*)actorx;
|
||||
|
||||
if ((*Common_Get(clip).npc_clip->birth_check_proc)(actorx, game) == TRUE) {
|
||||
mEv_santa_event_c* event_p;
|
||||
mEv_santa_event_common_c* event_common_p;
|
||||
|
||||
(*Common_Get(clip).npc_clip->ct_proc)(actorx, game, &ct_data);
|
||||
santa->setup_talk_proc = &aESNT_setupAction;
|
||||
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
|
||||
mEv_santa_event_c* event_p;
|
||||
mEv_santa_event_common_c* event_common_p;
|
||||
|
||||
event_p = (mEv_santa_event_c*)mEv_get_save_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
if (event_p == NULL) {
|
||||
/* Reserve event data */
|
||||
event_p = (mEv_santa_event_c*)mEv_reserve_save_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
bzero(event_p, sizeof(mEv_santa_event_c));
|
||||
mPr_ClearPersonalID(&event_p->pid);
|
||||
NPC_CLIP->ct_proc(actorx, game, &ct_data);
|
||||
santa->setup_talk_proc = &aESNT_setupAction;
|
||||
// Aus version adds logic to prevent jingle from being in the border units of an acre.
|
||||
// This was added to fix the exploit where by trapping Jingle in a border acre,
|
||||
// he could be tricked over and over without having to find him again.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
santa->npc_class.movement.range_type = aNPC_MOVE_RANGE_TYPE_SQUARE;
|
||||
#endif
|
||||
|
||||
event_p = (mEv_santa_event_c*)mEv_get_save_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
if (event_p == NULL) {
|
||||
/* Reserve event data */
|
||||
event_p = (mEv_santa_event_c*)mEv_reserve_save_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
bzero(event_p, sizeof(mEv_santa_event_c));
|
||||
mPr_ClearPersonalID(&event_p->pid);
|
||||
}
|
||||
santa->event_p = event_p;
|
||||
|
||||
event_common_p = (mEv_santa_event_common_c*)mEv_get_common_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
if (event_common_p == NULL) {
|
||||
event_common_p = (mEv_santa_event_common_c*)mEv_reserve_common_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
}
|
||||
santa->event_common_p = event_common_p;
|
||||
}
|
||||
santa->event_p = event_p;
|
||||
|
||||
event_common_p = (mEv_santa_event_common_c*)mEv_get_common_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
if (event_common_p == NULL) {
|
||||
event_common_p = (mEv_santa_event_common_c*)mEv_reserve_common_area(mEv_EVENT_TOY_DAY_JINGLE, 0);
|
||||
}
|
||||
santa->event_common_p = event_common_p;
|
||||
}
|
||||
}
|
||||
|
||||
static void aESNT_actor_save(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->save_proc)(actorx, game);
|
||||
NPC_CLIP->save_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aESNT_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->dt_proc)(actorx, game);
|
||||
mEv_actor_dying_message(mEv_EVENT_TOY_DAY_JINGLE, actorx);
|
||||
NPC_CLIP->dt_proc(actorx, game);
|
||||
mEv_actor_dying_message(mEv_EVENT_TOY_DAY_JINGLE, actorx);
|
||||
}
|
||||
|
||||
static void aESNT_actor_init(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->init_proc)(actorx, game);
|
||||
NPC_CLIP->init_proc(actorx, game);
|
||||
}
|
||||
|
||||
static void aESNT_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->draw_proc)(actorx, game);
|
||||
NPC_CLIP->draw_proc(actorx, game);
|
||||
}
|
||||
|
||||
#include "../src/actor/npc/event/ac_ev_santa_move.c_inc"
|
||||
|
||||
@@ -712,8 +712,9 @@ static void bIT_actor_drop_move_fly(bg_item_drop_c* drop);
|
||||
static void bIT_actor_drop_move_wait(bg_item_drop_c* drop);
|
||||
|
||||
static int bIT_actor_drop_entry_main(bg_item_drop_table_c* drop_info, bg_item_drop_c* src_drop) {
|
||||
int res = FALSE;
|
||||
mActor_name_t* fg_item_p;
|
||||
bg_item_drop_c* drop = drop_info->drop_p;
|
||||
int res = FALSE;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < drop_info->count; i++, drop++) {
|
||||
@@ -751,7 +752,7 @@ static int bIT_actor_drop_entry_main(bg_item_drop_table_c* drop_info, bg_item_dr
|
||||
xyz_t_move(&drop->last_position, &src_drop->position);
|
||||
|
||||
if (drop->fg_item != HONEYCOMB) {
|
||||
mActor_name_t* fg_item_p = mFI_GetUnitFG(src_drop->target_position);
|
||||
fg_item_p = mFI_GetUnitFG(src_drop->target_position);
|
||||
|
||||
if (fg_item_p != NULL) {
|
||||
drop->target_pos_fg_item = *fg_item_p;
|
||||
@@ -1062,8 +1063,8 @@ static void drop_fruit(mActor_name_t fg_item, int ut_x, int ut_z, xyz_t* drop_po
|
||||
static int BIT_actor_tree_cutcount_check(GAME* game, int ut_x, int ut_z) {
|
||||
bg_item_common_c* common_p = bIT_CLIP->bg_item_common_p;
|
||||
int res = 0;
|
||||
int bx;
|
||||
int i;
|
||||
int bx;
|
||||
int bz;
|
||||
|
||||
for (i = 0; i < common_p->item_table.count; i++) {
|
||||
@@ -1761,7 +1762,7 @@ static void bit_cmn_single_draw_loop_type1(GRAPH* graph, Gfx** gfx_pp, bIT_draw_
|
||||
}
|
||||
|
||||
static void bit_cmn_single_draw_item_shadow(GRAPH* graph, bg_item_draw_part_c* draw_part,
|
||||
bIT_draw_pos_entry_c* draw_pos_entry, f32 shadow_pos, rgba_t* color) {
|
||||
bIT_draw_pos_entry_c* draw_pos_entry, f32 shadow_pos, const rgba_t* color) {
|
||||
bg_item_draw_list_c* draw_list = draw_part->shadow_draw_list;
|
||||
|
||||
if (draw_list != NULL) {
|
||||
@@ -2058,12 +2059,12 @@ static void bit_cmn_single_drawS(GAME* game, bg_item_common_info_c* common_info,
|
||||
}
|
||||
|
||||
static void bIT_common_info_tbl_copy(bg_item_tbl_c* dst, bg_item_tbl_c* src) {
|
||||
int i;
|
||||
u8* src_p = src->info;
|
||||
u8* dst_p = dst->info;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < UT_TOTAL_NUM; i++) {
|
||||
*dst_p++ = *src_p++;
|
||||
for (i = 0; i < UT_TOTAL_NUM; i++, dst_p++, src_p++) {
|
||||
*dst_p = *src_p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2458,8 +2459,8 @@ static void bg_item_common_chg_BGDataR(bg_item_common_c* common) {
|
||||
}
|
||||
}
|
||||
|
||||
static void bg_item_common_outPutData(GAME_PLAY* play, bg_item_draw_pos_c* draw_pos, s16 next, int gfx_idx,
|
||||
xyz_t* pos) {
|
||||
static void bg_item_common_outPutData(const GAME_PLAY* const play, bg_item_draw_pos_c* const draw_pos, const s16 next, int gfx_idx,
|
||||
const xyz_t* const pos) {
|
||||
Matrix_translate(pos->x, pos->y, pos->z, MTX_LOAD);
|
||||
Matrix_scale(0.01f, 0.01f, 0.01f, MTX_MULT);
|
||||
Matrix_get(&draw_pos->mtxf);
|
||||
@@ -2467,8 +2468,8 @@ static void bg_item_common_outPutData(GAME_PLAY* play, bg_item_draw_pos_c* draw_
|
||||
draw_pos->sub_idx = gfx_idx;
|
||||
}
|
||||
|
||||
static void bg_item_common_classifyitemDataTable(GAME_PLAY* play, bg_item_draw_table_c* draw_table,
|
||||
mFI_block_tbl_c* block_table, u16* start_idx_tbl,
|
||||
static void bg_item_common_classifyitemDataTable(const GAME_PLAY* const play, bg_item_draw_table_c* draw_table,
|
||||
const mFI_block_tbl_c* block_table, u16* start_idx_tbl,
|
||||
bg_item_type_data_c** type_data_table,
|
||||
bg_item_draw_part_table_c* draw_part_table) {
|
||||
Matrix_push();
|
||||
@@ -2578,17 +2579,17 @@ static void bg_item_common_classifyitemDataTable(GAME_PLAY* play, bg_item_draw_t
|
||||
|
||||
// Part 3
|
||||
|
||||
static void bg_item_common_set_draw_tbl(GAME_PLAY* play, bg_item_draw_table_c* draw_tbl, mFI_block_tbl_c* block_tbl,
|
||||
static void bg_item_common_set_draw_tbl(GAME_PLAY* play, bg_item_draw_table_c* draw_tbl, const mFI_block_tbl_c* block_tbl,
|
||||
bg_item_type_data_c** type_data_table,
|
||||
bg_item_draw_part_table_c* draw_part_table) {
|
||||
bg_item_draw_pos_c* draw_pos;
|
||||
u16 start_idx_tbl[bIT_DRAW_TYPE_MAX];
|
||||
int i;
|
||||
u16* start_idx_p = start_idx_tbl;
|
||||
u16* draw_start_idx_p;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bIT_DRAW_TYPE_MAX; i++, start_idx_p++) {
|
||||
*start_idx_p = 0;
|
||||
for (i = 0; i < bIT_DRAW_TYPE_MAX; i++) {
|
||||
*start_idx_p++ = 0;
|
||||
}
|
||||
|
||||
draw_pos = draw_tbl->draw_data.draw_pos;
|
||||
@@ -2600,8 +2601,8 @@ static void bg_item_common_set_draw_tbl(GAME_PLAY* play, bg_item_draw_table_c* d
|
||||
|
||||
start_idx_p = start_idx_tbl;
|
||||
draw_start_idx_p = draw_tbl->draw_data.idx_p;
|
||||
for (i = 0; i < bIT_DRAW_TYPE_MAX; i++, start_idx_p++, draw_start_idx_p++) {
|
||||
*draw_start_idx_p = *start_idx_p;
|
||||
for (i = 0; i < bIT_DRAW_TYPE_MAX; i++) {
|
||||
*draw_start_idx_p++ = *start_idx_p++;
|
||||
}
|
||||
|
||||
draw_tbl->draw_flag = TRUE;
|
||||
@@ -2993,7 +2994,7 @@ static void bg_item_common_draw_item_body(GRAPH* graph, Gfx** gfx_pp, bg_item_dr
|
||||
typedef void (*bIT_DRAW_SHADOW_PROC)(GRAPH*, Gfx**, bg_item_draw_list_c*, int, Vtx*, bg_item_draw_pos_c*, Gfx**);
|
||||
|
||||
static void bg_item_common_draw_item_shadow(GRAPH* graph, Gfx** gfx_pp, bg_item_draw_part_c* draw_part,
|
||||
bg_item_draw_pos_c* draw_pos, f32 shadow_pos, rgba_t* shadow_color) {
|
||||
bg_item_draw_pos_c* draw_pos, f32 shadow_pos, const rgba_t* shadow_color) {
|
||||
bg_item_draw_list_c* draw_list = draw_part->shadow_draw_list;
|
||||
|
||||
if (draw_list != NULL) {
|
||||
|
||||
@@ -64,7 +64,7 @@ static void bPI_set_draw_tbl(BG_POLICE_ITEM_ACTOR* bg_police_item, bPI_draw_tbl_
|
||||
u16* start_idx_p = draw_tbl->draw_data.start_idx;
|
||||
u16* draw_start_p = draw_start;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(draw_start); i++) {
|
||||
for (i = 1; i < ARRAY_COUNT(draw_start) + 1; i++) {
|
||||
*start_idx_p++ = *draw_start_p++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,3 @@ void osWritebackDCache(void* buf, u32 len) {
|
||||
u32 osGetCount(void) {
|
||||
return OSGetTick();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user