mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Implement & link ac_station
This commit is contained in:
+2
-2
@@ -180,7 +180,7 @@ config.ldflags = [
|
||||
if args.debug:
|
||||
config.ldflags.append("-g")
|
||||
if args.map:
|
||||
config.ldflags.append("-nomapunused")
|
||||
config.ldflags.append("-mapunused")
|
||||
|
||||
# Use for any additional files that should cause a re-configure when modified
|
||||
config.reconfig_deps = []
|
||||
@@ -1056,7 +1056,7 @@ config.libs = [
|
||||
Object(Matching, "actor/ac_shrine.c"),
|
||||
Object(Matching, "actor/ac_sign.c"),
|
||||
Object(NonMatching, "actor/ac_snowman.c"),
|
||||
Object(NonMatching, "actor/ac_station.c"),
|
||||
Object(Matching, "actor/ac_station.c"),
|
||||
Object(Matching, "actor/ac_structure.c"),
|
||||
Object(Matching, "actor/ac_super.c"),
|
||||
Object(Matching, "actor/ac_tama.c"),
|
||||
|
||||
@@ -3,11 +3,72 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
aSTM_THINK_INIT_NONE,
|
||||
aSTM_THINK_INIT_GET_OFF_WAIT,
|
||||
aSTM_THINK_INIT_INTRO_DEMO_WAIT,
|
||||
aSTM_THINK_INIT_INTERRUPT_TURN,
|
||||
aSTM_THINK_INIT_INTERRUPT_MOVE,
|
||||
aSTM_THINK_INIT_MAKE_TRAIN,
|
||||
aSTM_THINK_INIT_MAKE_TRAIN_BF,
|
||||
aSTM_THINK_INIT_MOVE_TURN,
|
||||
aSTM_THINK_INIT_MOVE,
|
||||
aSTM_THINK_INIT_LOOK_P,
|
||||
aSTM_THINK_INIT_SEE_OFF,
|
||||
aSTM_THINK_INIT_GAME_END,
|
||||
|
||||
aSTM_THINK_INIT_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
aSTM_THINK_PROC_NONE,
|
||||
aSTM_THINK_PROC_GET_OFF_WAIT,
|
||||
aSTM_THINK_PROC_TURN,
|
||||
aSTM_THINK_PROC_LOOK_PLAYER,
|
||||
aSTM_THINK_PROC_INTERRUPT_TURN,
|
||||
aSTM_THINK_PROC_INTERRUPT_MOVE,
|
||||
aSTM_THINK_PROC_MAKE_TRAIN_BF,
|
||||
aSTM_THINK_PROC_MAKE_TRAIN,
|
||||
aSTM_THINK_PROC_TRAIN_ARRIVE_WAIT,
|
||||
aSTM_THINK_PROC_MOVE_TURN_BF,
|
||||
aSTM_THINK_PROC_MOVE,
|
||||
aSTM_THINK_PROC_IN_TRAIN,
|
||||
aSTM_THINK_PROC_IN_TRAIN2,
|
||||
aSTM_THINK_PROC_SEE_OFF,
|
||||
aSTM_THINK_PROC_TALK_WAIT,
|
||||
|
||||
aSTM_THINK_PROC_NUM
|
||||
};
|
||||
|
||||
typedef struct npc_station_actor_s NPC_STATION_MASTER_ACTOR;
|
||||
|
||||
typedef void (*aSTM_TALK_PROC)(NPC_STATION_MASTER_ACTOR*, GAME_PLAY*);
|
||||
|
||||
struct npc_station_actor_s {
|
||||
NPC_ACTOR npc_class;
|
||||
aSTM_TALK_PROC talk_proc;
|
||||
ACTOR* train_actor_p;
|
||||
f32 move_ofs_x;
|
||||
u8 think_idx;
|
||||
u8 next_think_idx;
|
||||
u8 talk_idx;
|
||||
u8 melody_save;
|
||||
u8 think_proc_idx;
|
||||
u8 sound;
|
||||
u8 happening_sound;
|
||||
u8 timer;
|
||||
u8 talk_proc_idx;
|
||||
u8 station_check_res;
|
||||
u8 chan;
|
||||
u8 station_err;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Npc_Station_Master_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +76,3 @@ extern ACTOR_PROFILE Npc_Station_Master_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,11 +3,18 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_structure.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct station_actor_s STATION_ACTOR;
|
||||
|
||||
struct station_actor_s {
|
||||
STRUCTURE_ACTOR struct_class;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Station_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -15,4 +22,3 @@ extern ACTOR_PROFILE Station_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef AC_STATION_CLIP_H
|
||||
#define AC_STATION_CLIP_H
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
aSTM_TALK_CHK_LEAVE_TALK,
|
||||
aSTM_TALK_CHK_LEAVE_TALK2,
|
||||
aSTM_TALK_SAYONARA,
|
||||
aSTM_TALK_CHK_TRAIN_TALK,
|
||||
aSTM_TALK_CHK_TRAIN2_TALK,
|
||||
aSTM_TALK_BEFORE_SAVE_TALK,
|
||||
aSTM_TALK_SAVE_TALK,
|
||||
aSTM_TALK_CHK_OVER_SAVE_TALK,
|
||||
aSTM_TALK_SAVE_TALK_END,
|
||||
aSTM_TALK_SAVE_ERROR,
|
||||
aSTM_TALK_CHK_REPAIRID,
|
||||
aSTM_TALK_REPAIRID_BF,
|
||||
aSTM_TALK_REPAIRID,
|
||||
aSTM_TALK_REPAIRID_AFTER,
|
||||
aSTM_TALK_CARDPROC,
|
||||
aSTM_TALK_END_WAIT,
|
||||
|
||||
aSTM_TALK_NUM
|
||||
};
|
||||
|
||||
typedef int (*aSTC_CHANGE_TALK_PROC)(ACTOR*, int);
|
||||
|
||||
typedef struct station_clip_s {
|
||||
aSTC_CHANGE_TALK_PROC change_talk_proc;
|
||||
} aSTC_clip_c;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+21
-21
@@ -192,32 +192,32 @@ typedef void (*aSTR_MOVE_PROC)(STRUCTURE_ACTOR*, GAME_PLAY*);
|
||||
|
||||
// sizeof(actor_structure_s) == 0x2DC
|
||||
struct actor_structure_s {
|
||||
/* 0x000*/ ACTOR actor_class;
|
||||
/* 0x174*/ int keyframe_state;
|
||||
/* 0x178*/ cKF_SkeletonInfo_R_c keyframe;
|
||||
/* 0x1E8*/ int keyframe_saved_keyframe;
|
||||
/* 0x1EC*/ s_xyz work_area[15];
|
||||
/* 0x246*/ s_xyz morph_area[15];
|
||||
/* 0x2A0*/ aSTR_MOVE_PROC action_proc;
|
||||
/* 0x2A4*/ int _2A4;
|
||||
/* 0x2A8*/ int structure_type; /* aSTR_TYPE_* */
|
||||
/* 0x2AC*/ int structure_pal; /* aSTR_PAL_* */
|
||||
/* 0x2B0*/ int request_type;
|
||||
/* 0x2B4*/ int action;
|
||||
/* 0x000 */ ACTOR actor_class;
|
||||
/* 0x174 */ int keyframe_state;
|
||||
/* 0x178 */ cKF_SkeletonInfo_R_c keyframe;
|
||||
/* 0x1E8 */ int keyframe_saved_keyframe;
|
||||
/* 0x1EC */ s_xyz work_area[15];
|
||||
/* 0x246 */ s_xyz morph_area[15];
|
||||
/* 0x2A0 */ aSTR_MOVE_PROC action_proc;
|
||||
/* 0x2A4 */ int _2A4;
|
||||
/* 0x2A8 */ int structure_type; /* aSTR_TYPE_* */
|
||||
/* 0x2AC */ int structure_pal; /* aSTR_PAL_* */
|
||||
/* 0x2B0 */ int request_type;
|
||||
/* 0x2B4 */ int action;
|
||||
|
||||
/* general purpose members with unique usage between structure actors */
|
||||
/* 0x2B8*/ int arg0;
|
||||
/* 0x2BC*/ int arg1;
|
||||
/* 0x2C0*/ int arg2;
|
||||
/* 0x2C4*/ int arg3;
|
||||
/* 0x2B8 */ int arg0;
|
||||
/* 0x2BC */ int arg1;
|
||||
/* 0x2C0 */ int arg2;
|
||||
/* 0x2C4 */ int arg3;
|
||||
|
||||
/* general purpose float members with unique usage between structure actors*/
|
||||
/* 0x2C8*/ f32 arg0_f;
|
||||
/* 0x2CC*/ f32 arg1_f;
|
||||
/* 0x2D0*/ f32 arg2_f;
|
||||
/* 0x2D4*/ f32 arg3_f;
|
||||
/* 0x2C8 */ f32 arg0_f;
|
||||
/* 0x2CC */ f32 arg1_f;
|
||||
/* 0x2D0 */ f32 arg2_f;
|
||||
/* 0x2D4 */ f32 arg3_f;
|
||||
|
||||
/* 0x2D8*/ u32 season;
|
||||
/* 0x2D8 */ u32 season;
|
||||
};
|
||||
|
||||
typedef struct actor_overlay_info_s {
|
||||
|
||||
+2
-18
@@ -5,28 +5,13 @@
|
||||
#include "m_actor.h"
|
||||
#include "c_keyframe.h"
|
||||
#include "m_lib.h"
|
||||
#include "ac_structure.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct train0_s {
|
||||
ACTOR actor_class;
|
||||
int steam_available;
|
||||
cKF_SkeletonInfo_R_c keyframe;
|
||||
int steam_timer;
|
||||
s_xyz work[15];
|
||||
s_xyz target[15];
|
||||
u8 pad4[0x2b4 - 0x2A0];
|
||||
int tr_action;
|
||||
u8 pad5[0x2BC - 0x2B8];
|
||||
int effect_num;
|
||||
int unk2c0;
|
||||
ACTOR* tr_actor_p;
|
||||
f32 tr1_pos;
|
||||
f32 tr_speed;
|
||||
u8 pad6[0x2D8 - 0x2CC];
|
||||
} TRAIN0_ACTOR;
|
||||
typedef STRUCTURE_ACTOR TRAIN0_ACTOR;
|
||||
|
||||
extern ACTOR_PROFILE Train0_Profile;
|
||||
|
||||
@@ -35,4 +20,3 @@ extern ACTOR_PROFILE Train0_Profile;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+2
-17
@@ -5,28 +5,13 @@
|
||||
#include "m_actor.h"
|
||||
#include "c_keyframe.h"
|
||||
#include "m_lib.h"
|
||||
#include "ac_structure.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct train1_s {
|
||||
ACTOR actor_class;
|
||||
int anim_state;
|
||||
cKF_SkeletonInfo_R_c keyframe;
|
||||
int timer;
|
||||
s_xyz work[15];
|
||||
s_xyz morph[15];
|
||||
u8 pad4[0x2b4 - 0x2A0];
|
||||
int tr_action;
|
||||
int player_pass_exists;
|
||||
int player_pass_leaving; // Not sure about this one
|
||||
int unk2c0;
|
||||
ACTOR* tr_actor_p;
|
||||
f32 tr_speed;
|
||||
f32 tr0_pos;
|
||||
u8 pad2[0x2D8 - 0x2CC];
|
||||
} TRAIN1_ACTOR;
|
||||
typedef STRUCTURE_ACTOR TRAIN1_ACTOR;
|
||||
|
||||
extern ACTOR_PROFILE Train1_Profile;
|
||||
|
||||
|
||||
+11
-7
@@ -84,11 +84,11 @@ enum {
|
||||
/* This is also a priority table where lower = higher priority */
|
||||
enum {
|
||||
mCD_TRANS_ERR_NONE,
|
||||
mCD_TRANS_ERR_1,
|
||||
mCD_TRANS_ERR_NONE_NEXTLAND, // leave town
|
||||
mCD_TRANS_ERR_IOERROR,
|
||||
mCD_TRANS_ERR_3,
|
||||
mCD_TRANS_ERR_DAMAGED,
|
||||
mCD_TRANS_ERR_BROKEN_WRONGENCODING,
|
||||
mCD_TRANS_ERR_5,
|
||||
mCD_TRANS_ERR_REPAIR,
|
||||
mCD_TRANS_ERR_NOT_MEMCARD,
|
||||
mCD_TRANS_ERR_WRONG_LAND,
|
||||
mCD_TRANS_ERR_INVALID_NOLAND_CODE,
|
||||
@@ -100,13 +100,13 @@ enum {
|
||||
mCD_TRANS_ERR_OTHER_TOWN,
|
||||
mCD_TRANS_ERR_15,
|
||||
mCD_TRANS_ERR_16,
|
||||
mCD_TRANS_ERR_17,
|
||||
mCD_TRANS_ERR_CORRUPT,
|
||||
mCD_TRANS_ERR_18,
|
||||
mCD_TRANS_ERR_19,
|
||||
mCD_TRANS_ERR_20,
|
||||
mCD_TRANS_ERR_TRAVEL_DATA_MISSING,
|
||||
mCD_TRANS_ERR_TRAVEL_DATA_EXISTS,
|
||||
mCD_TRANS_ERR_WRONGDEVICE,
|
||||
mCD_TRANS_ERR_NOCARD,
|
||||
mCD_TRANS_ERR_23,
|
||||
mCD_TRANS_ERR_NO_TOWN_DATA,
|
||||
mCD_TRANS_ERR_GENERIC,
|
||||
mCD_TRANS_ERR_BUSY,
|
||||
|
||||
@@ -242,6 +242,10 @@ extern int mCD_CheckPassportFile(void);
|
||||
extern int mCD_CheckBrokenPassportFile(int slot);
|
||||
extern int mCD_GetPlayerNum(void);
|
||||
|
||||
extern int mCD_CheckStation_bg(s32* chan);
|
||||
extern int mCD_SaveStation_NextLand_bg(s32* chan);
|
||||
extern int mCD_SaveStation_Passport_bg(s32* chan);
|
||||
|
||||
extern void mCD_PrintErrInfo(gfxprint_t* gfxprint);
|
||||
extern void mCD_InitAll();
|
||||
extern void mCD_LoadLand();
|
||||
|
||||
+2
-1
@@ -33,6 +33,7 @@
|
||||
#include "ac_garagara.h"
|
||||
#include "ac_turi_clip.h"
|
||||
#include "ac_hatumode_control.h"
|
||||
#include "ac_station_clip.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -91,7 +92,7 @@ typedef struct clip_s {
|
||||
/* 0x0D4 */ CLIP_NONE_PROC ball_redma_proc; /* removed in DnM+ */
|
||||
/* 0x0D8 */ void* _0D8;
|
||||
/* 0x0DC */ aAL_Clip_c* animal_logo_clip;
|
||||
/* 0x0E0 */ void* _0E0;
|
||||
/* 0x0E0 */ aSTC_clip_c* station_clip;
|
||||
/* 0x0E4 */ aTRC_clip_c* turi_clip;
|
||||
/* 0x0E8 */ SIGN_ACTOR* sign_control_actor;
|
||||
/* 0x0EC */ aAPC_Clip_c* aprilfool_control_clip;
|
||||
|
||||
@@ -3028,6 +3028,7 @@ extern int mNT_check_unknown(mActor_name_t item_no);
|
||||
#define DUMMY_HANIWA3 (DUMMY_HANIWA2 + 1)
|
||||
#define DUMMY_POST_OFFICE 0xF0FF
|
||||
#define DUMMY_NEEDLEWORK_SHOP 0xF0FF
|
||||
#define DUMMY_STATION 0xF100
|
||||
#define DUMMY_POLICE_STATION 0xF101
|
||||
#define DUMMY_RESERVE 0xF102
|
||||
#define DUMMY_SHRINE 0xF103
|
||||
|
||||
@@ -28,7 +28,7 @@ static void aID_train_birth_wait(INTRO_DEMO_ACTOR* intro_demo, GAME_PLAY* play)
|
||||
aID_change_player_demo_standing_train(&play->game);
|
||||
if (train != NULL) {
|
||||
intro_demo->train1_actor_p = train;
|
||||
train->player_pass_exists = TRUE;
|
||||
train->arg0 = TRUE;
|
||||
aID_setupAction(intro_demo, play, aID_ACT_RIDE_TRAIN);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ static void aID_ride_train(INTRO_DEMO_ACTOR* intro_demo, GAME_PLAY* play) {
|
||||
TRAIN1_ACTOR* train = intro_demo->train1_actor_p;
|
||||
|
||||
aID_change_player_demo_standing_train(&play->game);
|
||||
if (train->tr_action == 5) {
|
||||
if (train->action == 5) {
|
||||
aID_setupAction(intro_demo, play, aID_ACT_RIDE_OFF_PLAYER);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +228,7 @@ static void aID_ride_off_player_init(INTRO_DEMO_ACTOR* intro_demo, GAME_PLAY* pl
|
||||
ACTOR* station_master = Actor_info_fgName_search(&play->actor_info, SP_NPC_STATION_MASTER, ACTOR_PART_NPC);
|
||||
|
||||
intro_demo->station_master_actor_p = station_master;
|
||||
train->player_pass_exists = FALSE;
|
||||
train->arg0 = FALSE;
|
||||
mPlib_request_main_demo_getoff_train_type1(&play->game);
|
||||
intro_demo->_1A0 = 0;
|
||||
mCoBG_SetAttribute(enter_pos, mCoBG_ATTRIBUTE_STONE);
|
||||
|
||||
@@ -25,7 +25,7 @@ static void aROD_train_birth_wait(ACTOR* actor, GAME* game) {
|
||||
|
||||
if (train != NULL) {
|
||||
ride_off->train_actor = train;
|
||||
train->player_pass_exists = TRUE;
|
||||
train->arg0 = TRUE;
|
||||
aROD_setupAction(actor, game, 2);
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ static void aROD_ride_train(ACTOR* actor, GAME* game) {
|
||||
|
||||
aROD_change_player_demo_standing_train(game);
|
||||
|
||||
if (train->tr_action == 5) {
|
||||
if (train->action == 5) {
|
||||
aROD_setupAction(actor, game, 3);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ static void aROD_ride_off_player_init(ACTOR* actor, GAME* game) {
|
||||
|
||||
ride_off->station_master_actor = Actor_info_fgName_search(&play->actor_info, SP_NPC_STATION_MASTER, ACTOR_PART_NPC);
|
||||
|
||||
train->player_pass_exists = FALSE;
|
||||
train->arg0 = FALSE;
|
||||
mPlib_request_main_demo_getoff_train_type1(game);
|
||||
ride_off->_188 = 0;
|
||||
mCoBG_SetAttribute(enter_pos, mCoBG_ATTRIBUTE_STONE);
|
||||
@@ -137,4 +137,3 @@ static void aROD_actor_move(ACTOR* actor, GAME* game) {
|
||||
|
||||
ride_off->current_proc(actor, game);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
#include "ac_station.h"
|
||||
|
||||
#include "m_name_table.h"
|
||||
#include "bg_item_h.h"
|
||||
#include "m_common_data.h"
|
||||
#include "m_house.h"
|
||||
#include "m_player_lib.h"
|
||||
#include "m_demo.h"
|
||||
#include "ac_intro_demo.h"
|
||||
#include "m_bgm.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "m_rcp.h"
|
||||
#include "libforest/gbi_extensions.h"
|
||||
#include "ac_station_clip.h"
|
||||
#include "ac_npc_station_master.h"
|
||||
#include "m_msg.h"
|
||||
#include "m_font.h"
|
||||
#include "m_string.h"
|
||||
#include "m_card.h"
|
||||
#include "m_cpak.h"
|
||||
|
||||
enum {
|
||||
aSTA_ACTION_WAIT,
|
||||
|
||||
aSTA_ACTION_NUM
|
||||
};
|
||||
|
||||
static void aSTA_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aSTA_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aSTA_actor_init(ACTOR* actorx, GAME* game);
|
||||
static void aSTA_actor_draw(ACTOR* actorx, GAME* game);
|
||||
|
||||
// clang-format off
|
||||
ACTOR_PROFILE Station_Profile = {
|
||||
mAc_PROFILE_STATION,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_TA_SET,
|
||||
TRAIN_STATION,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(STATION_ACTOR),
|
||||
&aSTA_actor_ct,
|
||||
&aSTA_actor_dt,
|
||||
&aSTA_actor_init,
|
||||
&aSTA_actor_draw,
|
||||
NULL
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static u8 aSTA_shadow_vtx_fix_flg_table0[] = {
|
||||
FALSE, FALSE, TRUE, TRUE,
|
||||
FALSE, FALSE, TRUE, TRUE,
|
||||
FALSE, TRUE, TRUE, FALSE,
|
||||
TRUE, TRUE, FALSE, FALSE,
|
||||
TRUE, TRUE, FALSE, FALSE,
|
||||
TRUE, FALSE, TRUE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, TRUE, FALSE,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static u8 aSTA_shadow_vtx_fix_flg_table1[] = {
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, TRUE, FALSE,
|
||||
TRUE, FALSE, TRUE, FALSE,
|
||||
TRUE, FALSE, TRUE, FALSE,
|
||||
TRUE, FALSE, TRUE, FALSE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
FALSE, TRUE, TRUE, TRUE,
|
||||
FALSE, FALSE, TRUE, TRUE,
|
||||
FALSE, TRUE, TRUE, FALSE,
|
||||
FALSE, TRUE, TRUE, FALSE,
|
||||
FALSE, TRUE, TRUE, TRUE,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static u8 aSTA_shadow_vtx_fix_flg_table2[] = {
|
||||
FALSE, TRUE, TRUE, FALSE,
|
||||
FALSE, TRUE, TRUE, FALSE,
|
||||
TRUE, FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, TRUE, TRUE,
|
||||
TRUE, TRUE, TRUE, TRUE,
|
||||
TRUE, FALSE, TRUE, FALSE,
|
||||
FALSE, TRUE, FALSE, FALSE,
|
||||
TRUE, TRUE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, FALSE,
|
||||
TRUE, FALSE, FALSE, FALSE,
|
||||
TRUE, FALSE, TRUE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, FALSE, FALSE, TRUE,
|
||||
TRUE, TRUE, FALSE, FALSE,
|
||||
TRUE, TRUE, FALSE, TRUE,
|
||||
TRUE, FALSE,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
extern Vtx obj_station1_shadow_v[];
|
||||
extern Vtx obj_station2_shadow_v[];
|
||||
extern Vtx obj_station3_shadow_v[];
|
||||
|
||||
extern Gfx obj_station1_shadow_lowT_model[];
|
||||
extern Gfx obj_station1_shadow_hiT_model[];
|
||||
extern Gfx obj_station2_shadow_low_model[];
|
||||
extern Gfx obj_station2_shadow_hi_model[];
|
||||
extern Gfx obj_station3_shadow_low_model[];
|
||||
extern Gfx obj_station3_shadow_hi_model[];
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c aSTA_shadow_low_data0 = {
|
||||
ARRAY_COUNT(aSTA_shadow_vtx_fix_flg_table0),
|
||||
aSTA_shadow_vtx_fix_flg_table0,
|
||||
60.0f,
|
||||
obj_station1_shadow_v,
|
||||
obj_station1_shadow_lowT_model,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c aSTA_shadow_hi_data0 = {
|
||||
ARRAY_COUNT(aSTA_shadow_vtx_fix_flg_table0),
|
||||
aSTA_shadow_vtx_fix_flg_table0,
|
||||
60.0f,
|
||||
obj_station1_shadow_v,
|
||||
obj_station1_shadow_hiT_model,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c aSTA_shadow_low_data1 = {
|
||||
ARRAY_COUNT(aSTA_shadow_vtx_fix_flg_table1),
|
||||
aSTA_shadow_vtx_fix_flg_table1,
|
||||
60.0f,
|
||||
obj_station2_shadow_v,
|
||||
obj_station2_shadow_low_model,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c aSTA_shadow_hi_data1 = {
|
||||
ARRAY_COUNT(aSTA_shadow_vtx_fix_flg_table1),
|
||||
aSTA_shadow_vtx_fix_flg_table1,
|
||||
60.0f,
|
||||
obj_station2_shadow_v,
|
||||
obj_station2_shadow_hi_model,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c aSTA_shadow_low_data2 = {
|
||||
ARRAY_COUNT(aSTA_shadow_vtx_fix_flg_table2),
|
||||
aSTA_shadow_vtx_fix_flg_table2,
|
||||
60.0f,
|
||||
obj_station3_shadow_v,
|
||||
obj_station3_shadow_low_model,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c aSTA_shadow_hi_data2 = {
|
||||
ARRAY_COUNT(aSTA_shadow_vtx_fix_flg_table2),
|
||||
aSTA_shadow_vtx_fix_flg_table2,
|
||||
60.0f,
|
||||
obj_station3_shadow_v,
|
||||
obj_station3_shadow_hi_model,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_s_station1;
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_w_station1;
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_s_station2;
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_w_station2;
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_s_station3;
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_w_station3;
|
||||
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_s_station1;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_w_station1;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_s_station2;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_w_station2;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_s_station3;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_w_station3;
|
||||
|
||||
static void aSTA_setup_action(STATION_ACTOR* station, int action);
|
||||
static void aSTC_clip_ct(void);
|
||||
static void aSTC_clip_dt(void);
|
||||
|
||||
static void aSTA_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
// clang-format off
|
||||
static cKF_Skeleton_R_c* skl[][2] = {
|
||||
{ &cKF_bs_r_obj_s_station1, &cKF_bs_r_obj_w_station1 },
|
||||
{ &cKF_bs_r_obj_s_station2, &cKF_bs_r_obj_w_station2 },
|
||||
{ &cKF_bs_r_obj_s_station3, &cKF_bs_r_obj_w_station3 },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
STATION_ACTOR* station = (STATION_ACTOR*)actorx;
|
||||
int season;
|
||||
int type = Save_Get(station_type);
|
||||
|
||||
station->struct_class.season = Common_Get(time).season;
|
||||
season = station->struct_class.season == mTM_SEASON_WINTER;
|
||||
station->struct_class.arg0 = type / 5;
|
||||
station->struct_class.structure_type = aSTR_TYPE_STATION1 + station->struct_class.arg0;
|
||||
station->struct_class.structure_pal = aSTR_PAL_STATION1_A + type;
|
||||
|
||||
cKF_SkeletonInfo_R_ct(&station->struct_class.keyframe,
|
||||
skl[station->struct_class.arg0][season], NULL,
|
||||
station->struct_class.work_area, station->struct_class.morph_area);
|
||||
aSTA_setup_action(station, aSTA_ACTION_WAIT);
|
||||
actorx->world.position.x += -mFI_UT_WORLDSIZE_HALF_X_F;
|
||||
actorx->cull_width = 1260.0f;
|
||||
actorx->cull_radius = 420.0f;
|
||||
station->struct_class.keyframe_state = cKF_SkeletonInfo_R_play(&station->struct_class.keyframe);
|
||||
aSTC_clip_ct();
|
||||
}
|
||||
|
||||
static void aSTA_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
STATION_ACTOR* station = (STATION_ACTOR*)actorx;
|
||||
|
||||
cKF_SkeletonInfo_R_dt(&station->struct_class.keyframe);
|
||||
actorx->world.position.x = actorx->world.position.x - -mFI_UT_WORLDSIZE_HALF_X_F;
|
||||
aSTC_clip_dt();
|
||||
}
|
||||
|
||||
#include "../src/actor/ac_station_move.c_inc"
|
||||
#include "../src/actor/ac_station_draw.c_inc"
|
||||
#include "../src/actor/ac_station_clip.c_inc"
|
||||
@@ -0,0 +1,511 @@
|
||||
static aSTC_clip_c aSTC_clip;
|
||||
|
||||
static int aSTC_clip_change_talk_proc(ACTOR* actorx, int talk_idx);
|
||||
|
||||
static void aSTC_clip_ct(void) {
|
||||
aSTC_clip.change_talk_proc = &aSTC_clip_change_talk_proc;
|
||||
CLIP(station_clip) = &aSTC_clip;
|
||||
}
|
||||
|
||||
static void aSTC_clip_dt(void) {
|
||||
CLIP(station_clip) = NULL;
|
||||
}
|
||||
|
||||
static void aSTC_clip_change_sound(NPC_STATION_MASTER_ACTOR* master, u8 bgm_no) {
|
||||
if (master->sound != bgm_no) {
|
||||
switch (master->sound) {
|
||||
case BGM_TRAIN_PULL_INTO_TOWN:
|
||||
case BGM_TRAIN_ARRIVAL_WAIT:
|
||||
mBGMPsComp_delete_ps_demo(master->sound, 0x168);
|
||||
break;
|
||||
}
|
||||
|
||||
mBGMPsComp_make_ps_demo(bgm_no, 0x168);
|
||||
if (master->sound == BGM_FIELD_00) {
|
||||
mBGMPsComp_delete_ps_quiet();
|
||||
}
|
||||
|
||||
master->sound = bgm_no;
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_set_slot_name(int slot_no, int str_no) {
|
||||
u8 slot_name[mString_DEFAULT_STR_SIZE];
|
||||
|
||||
mString_Load_StringFromRom(slot_name, sizeof(slot_name), 0x6CD + slot_no);
|
||||
mMsg_SET_FREE_STR(str_no, slot_name, sizeof(slot_name));
|
||||
}
|
||||
|
||||
static int aSTM_chk_train_local(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
STRUCTURE_ACTOR* train1_p = (STRUCTURE_ACTOR*)Actor_info_fgName_search(&play->actor_info, TRAIN1, ACTOR_PART_ITEM);
|
||||
int ret;
|
||||
|
||||
if (train1_p == NULL || train1_p->action > 5 || Common_Get(train_action) > 5) {
|
||||
master->train_actor_p = NULL;
|
||||
Common_Set(train_coming_flag, 4);
|
||||
ret = 0;
|
||||
} else {
|
||||
master->train_actor_p = (ACTOR*)train1_p;
|
||||
ret = 1;
|
||||
Common_Set(train_coming_flag, 2);
|
||||
aSTC_clip_change_sound(master, BGM_TRAIN_ARRIVAL_WAIT);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void aSTM_cardproc(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
// clang-format off
|
||||
static u8 next_talk_act[] = {
|
||||
aSTM_TALK_CHK_TRAIN2_TALK,
|
||||
aSTM_TALK_BEFORE_SAVE_TALK,
|
||||
aSTM_TALK_CHK_TRAIN2_TALK,
|
||||
aSTM_TALK_BEFORE_SAVE_TALK,
|
||||
aSTM_TALK_CHK_OVER_SAVE_TALK,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_CHK_REPAIRID,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_END_WAIT,
|
||||
aSTM_TALK_CHK_REPAIRID,
|
||||
aSTM_TALK_END_WAIT,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static u8 msg_no[] = {
|
||||
8,
|
||||
12,
|
||||
8,
|
||||
18,
|
||||
27,
|
||||
9,
|
||||
10,
|
||||
19,
|
||||
3,
|
||||
4,
|
||||
31,
|
||||
5,
|
||||
36,
|
||||
30,
|
||||
37,
|
||||
38,
|
||||
39,
|
||||
11,
|
||||
40,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
ACTOR* actorx = (ACTOR*)master;
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
mCPk_c* cpak_p = mCPk_get_pkinfo();
|
||||
int talk_idx = -1;
|
||||
s32 chan;
|
||||
int card_ret = mCD_CheckStation_bg(&chan);
|
||||
|
||||
master->station_check_res = card_ret;
|
||||
switch (card_ret) {
|
||||
case mCD_TRANS_ERR_NONE:
|
||||
talk_idx = aSTM_chk_train_local(master, play);
|
||||
break;
|
||||
case mCD_TRANS_ERR_NONE_NEXTLAND:
|
||||
talk_idx = 2 + aSTM_chk_train_local(master, play);
|
||||
break;
|
||||
case mCD_TRANS_ERR_TRAVEL_DATA_EXISTS:
|
||||
talk_idx = 4;
|
||||
break;
|
||||
case mCD_TRANS_ERR_CORRUPT:
|
||||
talk_idx = 5;
|
||||
break;
|
||||
case mCD_TRANS_ERR_IOERROR:
|
||||
talk_idx = 6;
|
||||
break;
|
||||
case mCD_TRANS_ERR_BROKEN_WRONGENCODING:
|
||||
master->station_err = card_ret;
|
||||
talk_idx = 7;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NO_TOWN_DATA:
|
||||
talk_idx = 8;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NOCARD:
|
||||
talk_idx = 9;
|
||||
break;
|
||||
case mCD_TRANS_ERR_TRAVEL_DATA_MISSING:
|
||||
talk_idx = 10;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NO_SPACE:
|
||||
talk_idx = 11;
|
||||
break;
|
||||
case mCD_TRANS_ERR_WRONG_LAND:
|
||||
talk_idx = 12;
|
||||
break;
|
||||
case mCD_TRANS_ERR_LAND_EXIST:
|
||||
talk_idx = 13;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NO_FILES:
|
||||
talk_idx = 14;
|
||||
break;
|
||||
case mCD_TRANS_ERR_DAMAGED:
|
||||
talk_idx = 15;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NOT_MEMCARD:
|
||||
talk_idx = 16;
|
||||
break;
|
||||
case mCD_TRANS_ERR_REPAIR:
|
||||
master->station_err = card_ret;
|
||||
talk_idx = 17;
|
||||
break;
|
||||
case mCD_TRANS_ERR_WRONGDEVICE:
|
||||
talk_idx = 18;
|
||||
break;
|
||||
default:
|
||||
talk_idx = 9;
|
||||
break;
|
||||
case mCD_TRANS_ERR_BUSY:
|
||||
break;
|
||||
}
|
||||
|
||||
if (talk_idx != -1) {
|
||||
if (chan == 0 || chan == 1) {
|
||||
aSTM_set_slot_name(chan == 0, mMsg_FREE_STR3);
|
||||
aSTM_set_slot_name(chan, mMsg_FREE_STR5);
|
||||
aSTM_set_slot_name(chan, mMsg_FREE_STR4);
|
||||
}
|
||||
|
||||
master->chan = chan;
|
||||
mMsg_UNSET_LOCKCONTINUE();
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x0943 + msg_no[talk_idx]);
|
||||
aSTC_clip_change_talk_proc(actorx, next_talk_act[talk_idx]);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_chk_leave_talk(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
if (mMsg_CHECK_MAINNORMALCONTINUE() == TRUE) {
|
||||
switch (mChoice_GET_CHOSENUM()) {
|
||||
case mChoice_CHOICE0:
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_CHK_LEAVE_TALK2);
|
||||
break;
|
||||
case mChoice_CHOICE1:
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_END_WAIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_chk_leave_talk2(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
if (mMsg_CHECK_MAINNORMALCONTINUE() == TRUE) {
|
||||
mMsg_SET_LOCKCONTINUE();
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_CARDPROC);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_repairid_after(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
int order = mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 9);
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
|
||||
if (order != 0 && mMsg_Check_MainNormalContinue(msg_p) == TRUE) {
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 9, 0);
|
||||
mMsg_SET_LOCKCONTINUE();
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_CARDPROC);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_chk_train_talk(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
static u8 next_talk_act[] = { aSTM_TALK_CHK_TRAIN2_TALK, aSTM_TALK_BEFORE_SAVE_TALK };
|
||||
static u8 msg_no[] = { 8, 12 };
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int idx;
|
||||
|
||||
if (mMsg_Check_MainNormalContinue(msg_p) == TRUE) {
|
||||
idx = aSTM_chk_train_local(master, play);
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x0943 + msg_no[idx]);
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, next_talk_act[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_chk_train2_talk(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
|
||||
if (mMsg_Check_MainNormalContinue(msg_p) == TRUE) {
|
||||
if (master->station_check_res == mCD_TRANS_ERR_NONE_NEXTLAND) {
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x0955);
|
||||
} else {
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x094F);
|
||||
}
|
||||
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_BEFORE_SAVE_TALK);
|
||||
aSTC_clip_change_sound(master, BGM_TRAIN_ARRIVAL_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_before_save_talk(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
int order = mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 9);
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
|
||||
if (order != 0) {
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 9, 0);
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_SAVE_TALK);
|
||||
mMsg_Set_LockContinue(msg_p);
|
||||
Actor_info_save_actor(play);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_save_talk(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
static int msg_no[] = { 0x0950, 0x0964 };
|
||||
static u8 next_think_idx[] = { 13, 10 };
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int idx;
|
||||
int res;
|
||||
s32 chan;
|
||||
int next_msg_no;
|
||||
|
||||
if (master->station_check_res == mCD_TRANS_ERR_NONE_NEXTLAND) {
|
||||
res = mCD_SaveStation_NextLand_bg(&chan);
|
||||
} else {
|
||||
res = mCD_SaveStation_Passport_bg(&chan);
|
||||
}
|
||||
|
||||
switch (res) {
|
||||
case mCD_TRANS_ERR_NONE:
|
||||
mMsg_Unset_LockContinue(msg_p);
|
||||
idx = master->train_actor_p == NULL;
|
||||
mMsg_Set_continue_msg_num(msg_p, msg_no[idx]);
|
||||
master->next_think_idx = next_think_idx[idx];
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_SAVE_TALK_END);
|
||||
mEv_SetGateway();
|
||||
mDemo_Set_talk_return_demo_wait(TRUE);
|
||||
break;
|
||||
case mCD_TRANS_ERR_BUSY:
|
||||
break;
|
||||
default:
|
||||
if (chan == 0 || chan == 1) {
|
||||
aSTM_set_slot_name(chan == 0, mMsg_FREE_STR3);
|
||||
aSTM_set_slot_name(chan, mMsg_FREE_STR5);
|
||||
aSTM_set_slot_name(chan, mMsg_FREE_STR4);
|
||||
}
|
||||
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_SAVE_ERROR);
|
||||
switch (res) {
|
||||
case mCD_TRANS_ERR_BROKEN_WRONGENCODING:
|
||||
next_msg_no = 0x0956;
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_CHK_REPAIRID);
|
||||
master->station_err = res;
|
||||
break;
|
||||
case mCD_TRANS_ERR_REPAIR:
|
||||
next_msg_no = 0x094E;
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_CHK_REPAIRID);
|
||||
master->station_err = res;
|
||||
break;
|
||||
case mCD_TRANS_ERR_CORRUPT:
|
||||
next_msg_no = 0x094C;
|
||||
break;
|
||||
case mCD_TRANS_ERR_IOERROR:
|
||||
next_msg_no = 0x094D;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NO_TOWN_DATA:
|
||||
next_msg_no = 0x0946;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NOCARD:
|
||||
next_msg_no = 0x0947;
|
||||
break;
|
||||
case mCD_TRANS_ERR_TRAVEL_DATA_MISSING:
|
||||
next_msg_no = 0x0962;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NO_SPACE:
|
||||
next_msg_no = 0x0948;
|
||||
break;
|
||||
case mCD_TRANS_ERR_WRONG_LAND:
|
||||
next_msg_no = 0x0967;
|
||||
break;
|
||||
case mCD_TRANS_ERR_LAND_EXIST:
|
||||
next_msg_no = 0x0961;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NO_FILES:
|
||||
next_msg_no = 0x0968;
|
||||
break;
|
||||
case mCD_TRANS_ERR_DAMAGED:
|
||||
next_msg_no = 0x0969;
|
||||
break;
|
||||
case mCD_TRANS_ERR_NOT_MEMCARD:
|
||||
next_msg_no = 0x096A;
|
||||
break;
|
||||
case mCD_TRANS_ERR_WRONGDEVICE:
|
||||
next_msg_no = 0x096B;
|
||||
break;
|
||||
default:
|
||||
next_msg_no = 0x0946;
|
||||
break;
|
||||
}
|
||||
|
||||
mMsg_Unset_LockContinue(msg_p);
|
||||
mMsg_Set_continue_msg_num(msg_p, next_msg_no);
|
||||
|
||||
if (Common_Get(player_no) < PLAYER_NUM) {
|
||||
master->next_think_idx = 8;
|
||||
} else {
|
||||
master->next_think_idx = 9;
|
||||
}
|
||||
|
||||
mMsg_Set_ForceNext(msg_p);
|
||||
mBGMPsComp_make_ps_quiet(0x168);
|
||||
mBGMPsComp_delete_ps_demo(master->sound, 0x168);
|
||||
master->sound = BGM_SILENCE;
|
||||
if (master->train_actor_p == NULL) {
|
||||
Common_Set(train_coming_flag, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_save_error(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
ACTOR* actorx = (ACTOR*)master;
|
||||
|
||||
if (!mDemo_Check(mDemo_TYPE_SPEAK, actorx) && !mDemo_Check(mDemo_TYPE_TALK, actorx)) {
|
||||
switch (master->happening_sound) {
|
||||
case BGM_INTRO_ARRIVE:
|
||||
mBGMPsComp_delete_ps_happening(BGM_INTRO_ARRIVE, 0x168);
|
||||
mBGMPsComp_make_ps_happening(BGM_INTRO_NEW_TOWN, 0x168);
|
||||
master->happening_sound = BGM_INTRO_NEW_TOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
mBGMPsComp_delete_ps_quiet();
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_chk_over_save_talk(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
if (mMsg_CHECK_MAINNORMALCONTINUE() == TRUE) {
|
||||
switch (mChoice_GET_CHOSENUM()) {
|
||||
case mChoice_CHOICE0:
|
||||
master->next_think_idx = 8;
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_END_WAIT);
|
||||
break;
|
||||
case mChoice_CHOICE1:
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_CHK_TRAIN_TALK);
|
||||
aSTC_clip_change_sound(master, BGM_TRAIN_ARRIVAL_WAIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_save_talk_end(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
ACTOR* actorx = (ACTOR*)master;
|
||||
|
||||
if (master->sound != BGM_FIELD_00 && master->next_think_idx == 10) {
|
||||
if (mMsg_CHECK_MAINDISAPPEAR()) {
|
||||
if (master->sound != BGM_SILENCE) {
|
||||
mBGMPsComp_delete_ps_demo(master->sound, 0x168);
|
||||
}
|
||||
|
||||
mBGMPsComp_make_ps_quiet(0x21C);
|
||||
master->sound = BGM_FIELD_00;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) {
|
||||
if (mPlib_get_player_actor_main_index((GAME*)play) != mPlayer_INDEX_DEMO_WAIT) {
|
||||
mPlib_request_main_demo_wait_type1((GAME*)play, FALSE, NULL);
|
||||
} else {
|
||||
aSTC_clip_change_talk_proc(actorx, aSTM_TALK_END_WAIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_sayonara(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
if (mMsg_CHECK_MAINDISAPPEAR()) {
|
||||
mBGMPsComp_scene_mode(7);
|
||||
aSTC_clip_change_sound(master, BGM_TRAIN_BOARD);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_chk_repairid(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
int order = mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 9);
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
|
||||
if (order != 0 && mMsg_Check_MainNormalContinue(msg_p) == TRUE) {
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 9, 0);
|
||||
|
||||
switch (mChoice_GET_CHOSENUM()) {
|
||||
case mChoice_CHOICE0:
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_REPAIRID_BF);
|
||||
break;
|
||||
case mChoice_CHOICE1:
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_END_WAIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_repairid_bf(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
int order = mDemo_Get_OrderValue(mDemo_ORDER_NPC0, 9);
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
|
||||
if (order != 0 && mMsg_Check_MainNormalContinue(msg_p) == TRUE) {
|
||||
mDemo_Set_OrderValue(mDemo_ORDER_NPC0, 9, 0);
|
||||
mMsg_Set_LockContinue(msg_p);
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_REPAIRID);
|
||||
}
|
||||
}
|
||||
|
||||
static void aSTM_repairid(NPC_STATION_MASTER_ACTOR* master, GAME_PLAY* play) {
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int res = mCD_card_format_bg(master->chan);
|
||||
|
||||
switch (res) {
|
||||
case mCD_RESULT_SUCCESS:
|
||||
mMsg_Unset_LockContinue(msg_p);
|
||||
if (master->station_err == mCD_TRANS_ERR_BROKEN_WRONGENCODING) {
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x095A);
|
||||
} else {
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x0954);
|
||||
}
|
||||
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_REPAIRID_AFTER);
|
||||
break;
|
||||
case mCD_RESULT_ERROR:
|
||||
mMsg_Unset_LockContinue(msg_p);
|
||||
if (master->station_err == mCD_TRANS_ERR_BROKEN_WRONGENCODING) {
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x0958);
|
||||
} else {
|
||||
mMsg_Set_continue_msg_num(msg_p, 0x0952);
|
||||
}
|
||||
|
||||
aSTC_clip_change_talk_proc((ACTOR*)master, aSTM_TALK_END_WAIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int aSTC_clip_change_talk_proc(ACTOR* actorx, int talk_act) {
|
||||
// clang-format off
|
||||
static aSTM_TALK_PROC proc[] = {
|
||||
&aSTM_chk_leave_talk,
|
||||
&aSTM_chk_leave_talk2,
|
||||
&aSTM_sayonara,
|
||||
&aSTM_chk_train_talk,
|
||||
&aSTM_chk_train2_talk,
|
||||
&aSTM_before_save_talk,
|
||||
&aSTM_save_talk,
|
||||
&aSTM_chk_over_save_talk,
|
||||
&aSTM_save_talk_end,
|
||||
&aSTM_save_error,
|
||||
&aSTM_chk_repairid,
|
||||
&aSTM_repairid_bf,
|
||||
&aSTM_repairid,
|
||||
&aSTM_repairid_after,
|
||||
&aSTM_cardproc,
|
||||
(aSTM_TALK_PROC)&none_proc1,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
NPC_STATION_MASTER_ACTOR* master = (NPC_STATION_MASTER_ACTOR*)actorx;
|
||||
|
||||
master->talk_proc = proc[talk_act];
|
||||
return TRUE;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
extern Gfx obj_s_shop4_window_model[];
|
||||
extern Gfx obj_w_shop4_window_model[];
|
||||
|
||||
static int aSTA_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) {
|
||||
switch (joint_idx) {
|
||||
case 4:
|
||||
Matrix_RotateZ(-Common_Get(time.rad_hour), 1);
|
||||
break;
|
||||
case 2:
|
||||
Matrix_RotateZ(-Common_Get(time.rad_min), 1);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void aSTA_actor_draw(ACTOR* actor, GAME* game) {
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c* shadow_low_data[] = {
|
||||
&aSTA_shadow_low_data0,
|
||||
&aSTA_shadow_low_data1,
|
||||
&aSTA_shadow_low_data2,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
static bIT_ShadowData_c* shadow_hi_data[] = {
|
||||
&aSTA_shadow_hi_data0,
|
||||
&aSTA_shadow_hi_data1,
|
||||
&aSTA_shadow_hi_data2,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
GRAPH* graph;
|
||||
STATION_ACTOR* station;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
cKF_SkeletonInfo_R_c* keyframe;
|
||||
Mtx* mtx;
|
||||
u16* pal;
|
||||
LightsN* lights;
|
||||
int type;
|
||||
xyz_t light_pos;
|
||||
|
||||
graph = game->graph;
|
||||
station = (STATION_ACTOR*)actor;
|
||||
keyframe = &station->struct_class.keyframe;
|
||||
light_pos = actor->world.position;
|
||||
|
||||
mtx = GRAPH_ALLOC_TYPE(graph, Mtx, (u32)keyframe->skeleton->num_shown_joints);
|
||||
if (mtx == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
light_pos.y += 1000.0f;
|
||||
lights = Global_light_read(&play->global_light, game->graph);
|
||||
LightsN_list_check(lights, play->global_light.list, &light_pos);
|
||||
LightsN_disp(lights, game->graph);
|
||||
|
||||
pal = Common_Get(clip).structure_clip->get_pal_segment_proc(station->struct_class.structure_pal);
|
||||
_texture_z_light_fog_prim_npc(graph);
|
||||
|
||||
OPEN_POLY_OPA_DISP(graph);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, ANIME_1_TXT_SEG, pal);
|
||||
|
||||
CLOSE_POLY_OPA_DISP(graph);
|
||||
|
||||
cKF_Si3_draw_R_SV(game, keyframe, mtx, &aSTA_actor_draw_before, NULL, actor);
|
||||
type = station->struct_class.structure_type - aSTR_TYPE_STATION1;
|
||||
(*Common_Get(clip).bg_item_clip->draw_shadow_proc)(game, shadow_low_data[type], FALSE);
|
||||
(*Common_Get(clip).bg_item_clip->draw_shadow_proc)(game, shadow_hi_data[type], TRUE);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
typedef void (*aSTA_ACT_PROC)(STATION_ACTOR*, GAME_PLAY*);
|
||||
|
||||
static void aSTA_wait(STATION_ACTOR* station, GAME_PLAY* play) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
static void aSTA_setup_action(STATION_ACTOR* station, int action) {
|
||||
// clang-format off
|
||||
static cKF_Animation_R_c* ani[][2] = {
|
||||
{ &cKF_ba_r_obj_s_station1, &cKF_ba_r_obj_w_station1 },
|
||||
{ &cKF_ba_r_obj_s_station2, &cKF_ba_r_obj_w_station2 },
|
||||
{ &cKF_ba_r_obj_s_station3, &cKF_ba_r_obj_w_station3 },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void* process[] = { &aSTA_wait };
|
||||
int season = station->struct_class.season == mTM_SEASON_WINTER;
|
||||
|
||||
cKF_SkeletonInfo_R_init(&station->struct_class.keyframe, station->struct_class.keyframe.skeleton,
|
||||
ani[station->struct_class.arg0][season], 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
cKF_FRAMECONTROL_STOP, NULL);
|
||||
station->struct_class.action_proc = process[action];
|
||||
station->struct_class.action = action;
|
||||
}
|
||||
|
||||
static void aSTA_actor_move(ACTOR* actorx, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
STATION_ACTOR* station = (STATION_ACTOR*)actorx;
|
||||
|
||||
(*(aSTA_ACT_PROC)station->struct_class.action_proc)(station, play);
|
||||
}
|
||||
|
||||
static void aSTA_actor_init(ACTOR* actorx, GAME* game) {
|
||||
mFI_SetFG_common(DUMMY_STATION, actorx->home.position, FALSE);
|
||||
aSTA_actor_move(actorx, game);
|
||||
actorx->mv_proc = &aSTA_actor_move;
|
||||
}
|
||||
+11
-12
@@ -35,33 +35,32 @@ extern Gfx obj_train1_2_model[];
|
||||
static void aTR0_actor_ct(ACTOR* actor, GAME* GAME) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
cKF_SkeletonInfo_R_ct(&train0->keyframe, &cKF_bs_r_obj_train1_1, NULL, train0->work, train0->target);
|
||||
cKF_SkeletonInfo_R_ct(&train0->keyframe, &cKF_bs_r_obj_train1_1, NULL, train0->work_area, train0->morph_area);
|
||||
cKF_SkeletonInfo_R_init(&train0->keyframe, train0->keyframe.skeleton, &cKF_ba_r_obj_train1_1, 1.0f, 25.0f, 1.0f,
|
||||
0.5f, 0.0f, 1, NULL);
|
||||
cKF_SkeletonInfo_R_play(&train0->keyframe);
|
||||
train0->actor_class.cull_width = 600.0f;
|
||||
train0->actor_class.world.angle.y = 16384;
|
||||
train0->tr_action = 5;
|
||||
train0->actor_class.world.angle.y = DEG2SHORT_ANGLE2(90.0f);
|
||||
train0->action = 5;
|
||||
}
|
||||
|
||||
static void aTR0_actor_dt(ACTOR* actor, GAME* game) {
|
||||
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
xyz_t tr_home_pos;
|
||||
ACTOR* engineer_p;
|
||||
|
||||
tr_home_pos = train0->actor_class.home.position;
|
||||
mFI_SetFG_common(EMPTY_NO, tr_home_pos, FALSE);
|
||||
|
||||
mFI_SetFG_common(0, tr_home_pos, 0);
|
||||
|
||||
if (train0->tr_actor_p != NULL) {
|
||||
Actor_delete(train0->tr_actor_p);
|
||||
train0->tr_actor_p = NULL;
|
||||
engineer_p = (ACTOR*)train0->arg3;
|
||||
if (engineer_p != NULL) {
|
||||
Actor_delete(engineer_p);
|
||||
train0->arg3 = (int)NULL;
|
||||
}
|
||||
|
||||
cKF_SkeletonInfo_R_dt(&train0->keyframe);
|
||||
Common_Set(train_exists_flag, 0);
|
||||
Common_Set(train_exists_flag, FALSE);
|
||||
}
|
||||
|
||||
#include "../src/actor/ac_train0_move.c_inc"
|
||||
|
||||
#include "../src/actor/ac_train0_draw.c_inc"
|
||||
|
||||
@@ -1,35 +1,28 @@
|
||||
static void aTR0_actor_draw(ACTOR* actor, GAME* game){
|
||||
static void aTR0_actor_draw(ACTOR* actor, GAME* game) {
|
||||
u16* pal = (*Common_Get(clip).structure_clip->get_pal_segment_proc)(0x39);
|
||||
GRAPH* graph = game->graph;
|
||||
cKF_SkeletonInfo_R_c* keyf;
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
Mtx* mtx;
|
||||
Gfx* gfx;
|
||||
|
||||
keyf = &train0->keyframe;
|
||||
mtx = GRAPH_ALLOC_TYPE(graph, Mtx, keyf->skeleton->num_shown_joints);
|
||||
|
||||
if (mtx != NULL){
|
||||
if (mtx != NULL) {
|
||||
_texture_z_light_fog_prim_npc(graph);
|
||||
Matrix_push();
|
||||
Matrix_translate(train0->tr1_pos, train0->actor_class.world.position.y,
|
||||
train0->actor_class.world.position.z, 0);
|
||||
Matrix_scale(train0->actor_class.scale.x, train0->actor_class.scale.y,
|
||||
train0->actor_class.scale.z, 1);
|
||||
Matrix_translate(train0->arg0_f, train0->actor_class.world.position.y, train0->actor_class.world.position.z, 0);
|
||||
Matrix_scale(train0->actor_class.scale.x, train0->actor_class.scale.y, train0->actor_class.scale.z, 1);
|
||||
|
||||
OPEN_POLY_OPA_DISP(graph);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(POLY_OPA_DISP++, G_MWO_SEGMENT_8, pal);
|
||||
gDPLoadTLUT_Dolphin(POLY_OPA_DISP++, 15, 16, 1, pal);
|
||||
gSPDisplayList(POLY_OPA_DISP++, obj_train1_2_model);
|
||||
|
||||
CLOSE_POLY_OPA_DISP(graph);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(gfx++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(gfx++, G_MWO_SEGMENT_8, pal);
|
||||
gDPLoadTLUT_Dolphin(gfx++, 15, 16, 1, pal);
|
||||
gSPDisplayList(gfx++, obj_train1_2_model);
|
||||
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
CLOSE_DISP(graph);
|
||||
|
||||
Matrix_pull();
|
||||
cKF_Si3_draw_R_SV(game, keyf, mtx, NULL,NULL,train0);
|
||||
cKF_Si3_draw_R_SV(game, keyf, mtx, NULL, NULL, train0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,148 +1,138 @@
|
||||
static void aTR0_ctrl_engineer(ACTOR* actor, GAME* game){
|
||||
static void aTR0_ctrl_engineer(ACTOR* actor, GAME* game) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
GAME_PLAY* play = (GAME_PLAY* )game;
|
||||
|
||||
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
ACTOR* ac_p;
|
||||
|
||||
ac_p = train0->tr_actor_p;
|
||||
ac_p = (ACTOR*)train0->arg3;
|
||||
|
||||
if(ac_p == NULL){
|
||||
|
||||
if((*Common_Get(clip.npc_clip)->setupActor_proc)(play, SP_NPC_ENGINEER, -1,-1,-1,-1,-1,0,0) == 1){
|
||||
train0->tr_actor_p = Actor_info_fgName_search(&play->actor_info, SP_NPC_ENGINEER, ACTOR_PART_NPC);
|
||||
if (ac_p == NULL) {
|
||||
if (CLIP(npc_clip)->setupActor_proc(play, SP_NPC_ENGINEER, -1, -1, -1, -1, -1, 0, 0) == TRUE) {
|
||||
train0->arg3 = (int)Actor_info_fgName_search(&play->actor_info, SP_NPC_ENGINEER, ACTOR_PART_NPC);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
ac_p->world.position.x = -40.0f + train0->actor_class.world.position.x;
|
||||
ac_p->world.position.y = 47.0f + train0->actor_class.world.position.y;
|
||||
ac_p->world.position.z = 20.0f + train0->actor_class.world.position.z;
|
||||
}
|
||||
}
|
||||
|
||||
static void aTR0_set_effect(ACTOR* actor, GAME* game){
|
||||
static void aTR0_set_effect(ACTOR* actor, GAME* game) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
int calc;
|
||||
int calc;
|
||||
xyz_t pos;
|
||||
xyz_t clip_pos;
|
||||
if(train0->effect_num <= 0){
|
||||
if(train0->actor_class.speed >= 1.0f){
|
||||
calc = (12.0f/train0->actor_class.speed);
|
||||
train0->effect_num = calc;
|
||||
}
|
||||
else{
|
||||
train0->effect_num = 12;
|
||||
|
||||
if (train0->arg1 <= 0) {
|
||||
if (train0->actor_class.speed >= 1.0f) {
|
||||
calc = (12.0f / train0->actor_class.speed);
|
||||
train0->arg1 = calc;
|
||||
} else {
|
||||
train0->arg1 = 12;
|
||||
}
|
||||
xyz_t_move(&pos, &train0->actor_class.world.position);
|
||||
pos.x += 36.0f;
|
||||
pos.y += 110.0f;
|
||||
|
||||
if(mEv_CheckTitleDemo() == 0){
|
||||
clip_pos = pos;
|
||||
(*Common_Get(clip.effect_clip)->effect_make_proc)(35, clip_pos, 1,0, game, train0->actor_class.npc_id, 0,0);
|
||||
if (mEv_CheckTitleDemo() == 0) {
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_KISHA_KEMURI, pos, 1, 0, game, train0->actor_class.npc_id, 0, 0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
train0->effect_num--;
|
||||
} else {
|
||||
train0->arg1--;
|
||||
}
|
||||
}
|
||||
|
||||
static void aTR0_steam_work_sub(ACTOR* actor, GAME* game, int x_idx){
|
||||
static void aTR0_steam_work_sub(ACTOR* actor, GAME* game, int x_idx) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
xyz_t pos;
|
||||
xyz_t clip_pos;
|
||||
int unk2c0;
|
||||
static f32 setX[] = {15.0f, 22.0f};
|
||||
static s16 angl[] = {0xd000, 0x0400};
|
||||
static f32 setX[] = { 15.0f, 22.0f };
|
||||
static s16 angl[] = { 0xd000, 0x0400 };
|
||||
|
||||
pos.x = train0->actor_class.world.position.x + setX[x_idx];
|
||||
pos.y = train0->actor_class.world.position.y + 21.0f;
|
||||
pos.z = train0->actor_class.world.position.z + 42.0f;
|
||||
unk2c0 = train0->unk2c0;
|
||||
if(mEv_CheckTitleDemo() == 0){
|
||||
clip_pos = pos;
|
||||
(*Common_Get(clip.effect_clip)->effect_make_proc)(63, clip_pos, 1,angl[x_idx], game, train0->actor_class.npc_id, 0,0);
|
||||
}
|
||||
unk2c0 = train0->arg2;
|
||||
if (mEv_CheckTitleDemo() == 0) {
|
||||
(*Common_Get(clip.effect_clip)->effect_make_proc)(eEC_EFFECT_STEAM, pos, 1, angl[x_idx], game,
|
||||
train0->actor_class.npc_id, 0, 0);
|
||||
}
|
||||
unk2c0++;
|
||||
train0->unk2c0 = unk2c0 % 4;
|
||||
train0->arg2 = unk2c0 % 4;
|
||||
}
|
||||
|
||||
static void aTR0_steam_work(ACTOR* actor, GAME* game){
|
||||
static void aTR0_steam_work(ACTOR* actor, GAME* game) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
if(train0->steam_available == 1){
|
||||
if((train0->steam_timer >= 2) && (train0->steam_timer <= 5)){
|
||||
aTR0_steam_work_sub(actor,game,0);
|
||||
if (train0->keyframe_state == cKF_STATE_STOPPED) {
|
||||
if ((train0->keyframe_saved_keyframe >= 2) && (train0->keyframe_saved_keyframe <= 5)) {
|
||||
aTR0_steam_work_sub(actor, game, 0);
|
||||
}
|
||||
if((train0->steam_timer >= 13) && (train0->steam_timer <= 16)){
|
||||
aTR0_steam_work_sub(actor,game,1);
|
||||
if ((train0->keyframe_saved_keyframe >= 13) && (train0->keyframe_saved_keyframe <= 16)) {
|
||||
aTR0_steam_work_sub(actor, game, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static f32 calc_speed1(ACTOR* actor){
|
||||
static f32 calc_speed1(ACTOR* actor) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
if(F32_IS_ZERO(train0->tr_speed)){
|
||||
if (F32_IS_ZERO(train0->arg1_f)) {
|
||||
return 0.8f + train0->actor_class.speed;
|
||||
}
|
||||
|
||||
if(train0->tr_speed < train0->actor_class.speed){
|
||||
return train0->actor_class.speed + (0.5f * - (train0->tr_speed - train0->actor_class.speed));
|
||||
if (train0->arg1_f < train0->actor_class.speed) {
|
||||
return train0->actor_class.speed + (0.5f * -(train0->arg1_f - train0->actor_class.speed));
|
||||
}
|
||||
|
||||
return train0->actor_class.speed;
|
||||
}
|
||||
|
||||
static f32 calc_speed2(ACTOR* actor){
|
||||
static f32 calc_speed2(ACTOR* actor) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
int should_stop = F32_IS_ZERO(train0->actor_class.speed);
|
||||
|
||||
|
||||
return should_stop == FALSE ? train0->actor_class.speed : -0.23f;
|
||||
}
|
||||
|
||||
static void aTR0_ctrl_back_car(ACTOR* actor){
|
||||
static void aTR0_ctrl_back_car(ACTOR* actor) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
f32 tr_back_calc = train0->tr1_pos;
|
||||
f32 base_x_pos = -125.0f + train0->actor_class.world.position.x;
|
||||
tr_back_calc += 0.5f * train0->tr_speed;
|
||||
f32 tr_back_calc = train0->arg0_f;
|
||||
f32 base_x_pos = -125.0f + train0->actor_class.world.position.x;
|
||||
tr_back_calc += 0.5f * train0->arg1_f;
|
||||
|
||||
if((tr_back_calc - base_x_pos) > 2.0f){
|
||||
train0->tr_speed = calc_speed2(actor);
|
||||
train0->tr1_pos = 2.0f + base_x_pos;
|
||||
}
|
||||
else if((tr_back_calc - base_x_pos) <= 0.0f){
|
||||
train0->tr_speed = calc_speed1(actor);
|
||||
train0->tr1_pos = base_x_pos;
|
||||
}
|
||||
else{
|
||||
chase_f(&train0->tr_speed, 0.0f, 0.0025f);
|
||||
train0->tr1_pos = tr_back_calc;
|
||||
if ((tr_back_calc - base_x_pos) > 2.0f) {
|
||||
train0->arg1_f = calc_speed2(actor);
|
||||
train0->arg0_f = 2.0f + base_x_pos;
|
||||
} else if ((tr_back_calc - base_x_pos) <= 0.0f) {
|
||||
train0->arg1_f = calc_speed1(actor);
|
||||
train0->arg0_f = base_x_pos;
|
||||
} else {
|
||||
chase_f(&train0->arg1_f, 0.0f, 0.0025f);
|
||||
train0->arg0_f = tr_back_calc;
|
||||
}
|
||||
}
|
||||
|
||||
static void aTR0_animation(ACTOR* actor){
|
||||
static void aTR0_animation(ACTOR* actor) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
int av = 0;
|
||||
|
||||
int av = cKF_STATE_NONE;
|
||||
int cur_frame = train0->keyframe.frame_control.current_frame;
|
||||
cKF_SkeletonInfo_R_play(&train0->keyframe);
|
||||
|
||||
if( cur_frame!= train0->steam_timer){
|
||||
train0->steam_timer = cur_frame;
|
||||
av = 1;
|
||||
if (cur_frame != train0->keyframe_saved_keyframe) {
|
||||
train0->keyframe_saved_keyframe = cur_frame;
|
||||
av = cKF_STATE_STOPPED;
|
||||
}
|
||||
train0->steam_available = av;
|
||||
train0->keyframe_state = av;
|
||||
}
|
||||
|
||||
static void aTR0_move(ACTOR* actor){
|
||||
static void aTR0_move(ACTOR* actor) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
xyz_t pos;
|
||||
|
||||
if(train0->tr_action != Common_Get(train_action)){
|
||||
train0->tr_action = Common_Get(train_action);
|
||||
if (train0->action != Common_Get(train_action)) {
|
||||
train0->action = Common_Get(train_action);
|
||||
}
|
||||
pos = Common_Get(train_position);
|
||||
train0->actor_class.world.position.x = pos.x;
|
||||
@@ -150,9 +140,9 @@ static void aTR0_move(ACTOR* actor){
|
||||
train0->actor_class.speed = Common_Get(train_speed);
|
||||
}
|
||||
|
||||
static void aTR0_delcheck(ACTOR* actor,GAME* game){
|
||||
GAME_PLAY* play = (GAME_PLAY* )game;
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
static void aTR0_delcheck(ACTOR* actor, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
|
||||
int x;
|
||||
int z;
|
||||
@@ -160,45 +150,44 @@ static void aTR0_delcheck(ACTOR* actor,GAME* game){
|
||||
xyz_t pos;
|
||||
|
||||
pos = train0->actor_class.world.position;
|
||||
|
||||
mFI_Wpos2BlockNum(&x,&z,pos);
|
||||
x -= play->block_table.block_x;
|
||||
abs_x = x >= 0 ? x: -x;
|
||||
|
||||
if((abs_x >= 2) || (z != play->block_table.block_z) || (train0->tr_action == 0)){
|
||||
if((int)train0->tr_actor_p != 0){
|
||||
Actor_delete(train0->tr_actor_p);
|
||||
}
|
||||
mFI_Wpos2BlockNum(&x, &z, pos);
|
||||
x -= play->block_table.block_x;
|
||||
abs_x = x >= 0 ? x : -x;
|
||||
|
||||
if ((abs_x >= 2) || (z != play->block_table.block_z) || (train0->action == 0)) {
|
||||
if (train0->arg3 != 0) {
|
||||
Actor_delete((ACTOR*)train0->arg3);
|
||||
}
|
||||
Actor_delete(actor->child_actor);
|
||||
Actor_delete(actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void aTR0_actor_move(ACTOR* actor, GAME* game){
|
||||
static void aTR0_actor_move(ACTOR* actor, GAME* game) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor;
|
||||
GAME_PLAY* play = (GAME_PLAY* )game;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
f32 speed;
|
||||
aTR0_animation(actor);
|
||||
aTR0_move(actor);
|
||||
|
||||
if(!F32_IS_ZERO(train0->actor_class.speed)){
|
||||
aTR0_set_effect(actor,game);
|
||||
aTR0_steam_work(actor,game);
|
||||
if (!F32_IS_ZERO(train0->actor_class.speed)) {
|
||||
aTR0_set_effect(actor, game);
|
||||
aTR0_steam_work(actor, game);
|
||||
}
|
||||
|
||||
if(mEv_CheckTitleDemo() == 1){
|
||||
train0->tr1_pos = -125.0f + train0->actor_class.world.position.x;
|
||||
}
|
||||
else{
|
||||
if (mEv_CheckTitleDemo() == 1) {
|
||||
train0->arg0_f = -125.0f + train0->actor_class.world.position.x;
|
||||
} else {
|
||||
aTR0_ctrl_back_car(actor);
|
||||
}
|
||||
|
||||
aTR0_ctrl_engineer(actor,game);
|
||||
aTR0_ctrl_engineer(actor, game);
|
||||
|
||||
speed = (train0->actor_class.speed / 40.0f) * 10.0f;
|
||||
|
||||
if(speed >= 0.5f){
|
||||
if (speed >= 0.5f) {
|
||||
speed = 0.5f;
|
||||
}
|
||||
|
||||
|
||||
+20
-24
@@ -11,45 +11,42 @@
|
||||
#include "m_field_info.h"
|
||||
#include "m_event.h"
|
||||
|
||||
|
||||
static void aTR1_actor_ct(ACTOR* actor, GAME* game);
|
||||
static void aTR1_actor_dt(ACTOR* actor, GAME* game);
|
||||
static void aTR1_actor_move(ACTOR* actor, GAME* game);
|
||||
static void aTR1_actor_draw(ACTOR* actor, GAME* game);
|
||||
|
||||
ACTOR_PROFILE Train1_Profile = {
|
||||
mAc_PROFILE_TRAIN1,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | 1 << 11 | ACTOR_STATE_NO_MOVE_WHILE_CULLED, //figure out flag 0x800
|
||||
TRAIN1,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(TRAIN1_ACTOR),
|
||||
&aTR1_actor_ct,
|
||||
&aTR1_actor_dt,
|
||||
&aTR1_actor_move,
|
||||
&aTR1_actor_draw,
|
||||
NULL
|
||||
mAc_PROFILE_TRAIN1,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_TA_SET | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
TRAIN1,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(TRAIN1_ACTOR),
|
||||
&aTR1_actor_ct,
|
||||
&aTR1_actor_dt,
|
||||
&aTR1_actor_move,
|
||||
&aTR1_actor_draw,
|
||||
NULL,
|
||||
};
|
||||
|
||||
extern cKF_Skeleton_R_c cKF_bs_r_obj_train1_3;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_train1_3_open;
|
||||
extern cKF_Animation_R_c cKF_ba_r_obj_train1_3_close;
|
||||
|
||||
static void aTR1_setupAction(TRAIN1_ACTOR*, int);
|
||||
|
||||
static void aTR1_setupAction(ACTOR*, int);
|
||||
|
||||
static void aTR1_actor_ct(ACTOR* actor, GAME* game){
|
||||
static void aTR1_actor_ct(ACTOR* actor, GAME* game) {
|
||||
TRAIN1_ACTOR* train1 = (TRAIN1_ACTOR*)actor;
|
||||
|
||||
cKF_SkeletonInfo_R_ct(&train1->keyframe, &cKF_bs_r_obj_train1_3, NULL, train1->work, train1->morph);
|
||||
aTR1_setupAction((ACTOR*)train1, 5);
|
||||
train1->anim_state = cKF_SkeletonInfo_R_play(&train1->keyframe);
|
||||
actor->world.angle.y = 0x4000;
|
||||
train1->tr_speed = 1.0f;
|
||||
|
||||
cKF_SkeletonInfo_R_ct(&train1->keyframe, &cKF_bs_r_obj_train1_3, NULL, train1->work_area, train1->morph_area);
|
||||
aTR1_setupAction(train1, 5);
|
||||
train1->keyframe_state = cKF_SkeletonInfo_R_play(&train1->keyframe);
|
||||
actor->world.angle.y = DEG2SHORT_ANGLE2(90.0f);
|
||||
train1->arg0_f = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
static void aTR1_actor_dt(ACTOR* actor, GAME* game){
|
||||
static void aTR1_actor_dt(ACTOR* actor, GAME* game) {
|
||||
TRAIN1_ACTOR* train1 = (TRAIN1_ACTOR*)actor;
|
||||
|
||||
xyz_t tr_home_pos;
|
||||
@@ -61,5 +58,4 @@ static void aTR1_actor_dt(ACTOR* actor, GAME* game){
|
||||
}
|
||||
|
||||
#include "../src/actor/ac_train1_move.c_inc"
|
||||
|
||||
#include "../src/actor/ac_train1_draw.c_inc"
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
static void aTR1_actor_draw(ACTOR* actor, GAME* game){
|
||||
u16* pal = (*Common_Get(clip).structure_clip->get_pal_segment_proc)(0x3A);
|
||||
|
||||
static void aTR1_actor_draw(ACTOR* actor, GAME* game) {
|
||||
u16* pal = (*Common_Get(clip).structure_clip->get_pal_segment_proc)(aSTR_PAL_TRAIN1_A2);
|
||||
TRAIN1_ACTOR* train1 = (TRAIN1_ACTOR*)actor;
|
||||
|
||||
GRAPH* graph = game->graph;
|
||||
cKF_SkeletonInfo_R_c* keyf;
|
||||
Mtx* mtx;
|
||||
Gfx* gfx;
|
||||
|
||||
keyf = &train1->keyframe;
|
||||
mtx = GRAPH_ALLOC_TYPE(graph, Mtx, keyf->skeleton->num_shown_joints);
|
||||
|
||||
if(mtx != NULL){
|
||||
if (mtx != NULL) {
|
||||
_texture_z_light_fog_prim_npc(graph);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
OPEN_POLY_OPA_DISP(graph);
|
||||
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
gSPSegment(gfx++, 0x8, pal);
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
CLOSE_DISP(graph);
|
||||
gSPSegment(POLY_OPA_DISP++, ANIME_1_TXT_SEG, pal);
|
||||
|
||||
CLOSE_POLY_OPA_DISP(graph);
|
||||
|
||||
cKF_Si3_draw_R_SV(game, keyf, mtx, NULL,NULL,train1);
|
||||
cKF_Si3_draw_R_SV(game, keyf, mtx, NULL, NULL, train1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,21 @@ static f32 calc_speed1(ACTOR* actor0, ACTOR* actor1) {
|
||||
TRAIN1_ACTOR* train1 = (TRAIN1_ACTOR*)actor1;
|
||||
|
||||
if (F32_IS_ZERO(actor1->speed)) {
|
||||
return 0.8f + train0->tr_speed;
|
||||
return 0.8f + train0->arg1_f;
|
||||
}
|
||||
|
||||
if (actor1->speed < train0->tr_speed) {
|
||||
return train0->tr_speed + (0.5f * -(actor1->speed - train0->tr_speed));
|
||||
if (actor1->speed < train0->arg1_f) {
|
||||
return train0->arg1_f + (0.5f * -(actor1->speed - train0->arg1_f));
|
||||
}
|
||||
|
||||
return train0->tr_speed;
|
||||
return train0->arg1_f;
|
||||
}
|
||||
|
||||
static f32 calc_speed2(ACTOR* actor) {
|
||||
TRAIN1_ACTOR* train1 = (TRAIN1_ACTOR*)actor;
|
||||
int should_stop = F32_IS_ZERO(train1->tr0_pos);
|
||||
int should_stop = F32_IS_ZERO(train1->arg1_f);
|
||||
|
||||
return should_stop == FALSE ? train1->tr0_pos : -0.23f;
|
||||
return should_stop == FALSE ? train1->arg1_f : -0.23f;
|
||||
}
|
||||
|
||||
static void aTR1_position_move(ACTOR* actor) {
|
||||
@@ -35,7 +35,7 @@ static void aTR1_position_move(ACTOR* actor) {
|
||||
f32 base_x_pos;
|
||||
|
||||
tr_back_calc = train1->actor_class.world.position.x;
|
||||
base_x_pos = -125.0f + train0->tr1_pos;
|
||||
base_x_pos = -125.0f + train0->arg0_f;
|
||||
tr_back_calc += 0.5f * train1->actor_class.speed;
|
||||
|
||||
diff = tr_back_calc - base_x_pos;
|
||||
@@ -70,7 +70,7 @@ static void aTR1_passenger_ctrl(ACTOR* actor) {
|
||||
xyz_t pos;
|
||||
s_xyz rot;
|
||||
|
||||
if (train1->player_pass_exists == 1) {
|
||||
if (train1->arg0 == 1) {
|
||||
pos.x = train1->actor_class.world.position.x + 60.0f;
|
||||
pos.y = train1->actor_class.world.position.y + 20.0f;
|
||||
pos.z = train1->actor_class.world.position.z + 20.0f;
|
||||
@@ -81,7 +81,7 @@ static void aTR1_passenger_ctrl(ACTOR* actor) {
|
||||
->Set_force_position_angle_proc(gamePT, &pos, &rot,
|
||||
mPlayer_FORCE_POSITION_ANGLE_POSX | mPlayer_FORCE_POSITION_ANGLE_POSY |
|
||||
mPlayer_FORCE_POSITION_ANGLE_POSZ | mPlayer_FORCE_POSITION_ANGLE_ROTY);
|
||||
} else if (train1->player_pass_leaving == 1) {
|
||||
} else if (train1->arg1 == 1) {
|
||||
pos.x = train1->actor_class.world.position.x + 2.0f;
|
||||
pos.y = train1->actor_class.world.position.y + 16.0f;
|
||||
pos.z = train1->actor_class.world.position.z + 20.0f;
|
||||
@@ -92,9 +92,7 @@ static void aTR1_passenger_ctrl(ACTOR* actor) {
|
||||
}
|
||||
}
|
||||
|
||||
static void aTR1_setupAction(ACTOR* actor, int action) {
|
||||
TRAIN1_ACTOR* train1 = (TRAIN1_ACTOR*)actor;
|
||||
|
||||
static void aTR1_setupAction(TRAIN1_ACTOR* train1, int action) {
|
||||
static cKF_Animation_R_c* anime_table[] = { &cKF_ba_r_obj_train1_3_open, &cKF_ba_r_obj_train1_3_close };
|
||||
static f32 anime_end[] = { 24.0f, 32.0f };
|
||||
static int animeSeqNoTable[] = { 0, 0, 0, 0, 0, 1, 1, 0, 0 };
|
||||
@@ -111,11 +109,11 @@ static void aTR1_setupAction(ACTOR* actor, int action) {
|
||||
end = anime_end[seq_no];
|
||||
|
||||
tr_speed = 1.0f;
|
||||
train1->tr_action = action;
|
||||
train1->action = action;
|
||||
|
||||
if ((train1->tr_action == 6) || (train1->tr_action == 4)) {
|
||||
if ((mEv_CheckTitleDemo() == 0) && (tr_speed != train1->tr_speed)) {
|
||||
aTR1_OngenTrgStart(actor, 43);
|
||||
if ((train1->action == 6) || (train1->action == 4)) {
|
||||
if ((mEv_CheckTitleDemo() == 0) && (tr_speed != train1->arg0_f)) {
|
||||
aTR1_OngenTrgStart((ACTOR*)train1, 43);
|
||||
} else {
|
||||
tr_speed = end;
|
||||
}
|
||||
@@ -130,15 +128,15 @@ static void aTR1_actor_move(ACTOR* actor, GAME* game) {
|
||||
TRAIN0_ACTOR* train0 = (TRAIN0_ACTOR*)actor->parent_actor;
|
||||
cKF_SkeletonInfo_R_c* keyframe = &train1->keyframe;
|
||||
|
||||
train1->anim_state = cKF_SkeletonInfo_R_play(keyframe);
|
||||
train1->keyframe_state = cKF_SkeletonInfo_R_play(keyframe);
|
||||
if (mEv_CheckTitleDemo() <= 0) {
|
||||
aTR1_position_move((ACTOR*)train1);
|
||||
}
|
||||
aTR1_passenger_ctrl((ACTOR*)train1);
|
||||
|
||||
if (train0->tr_action != train1->tr_action) {
|
||||
aTR1_setupAction((ACTOR*)train1, train0->tr_action);
|
||||
if (train0->action != train1->action) {
|
||||
aTR1_setupAction(train1, train0->action);
|
||||
}
|
||||
|
||||
train1->tr_speed = 0.0f;
|
||||
train1->arg0_f = 0.0f;
|
||||
}
|
||||
|
||||
+3
-1
@@ -710,7 +710,9 @@ def generate_build_ninja(
|
||||
n.comment("Source files")
|
||||
|
||||
def map_path(path: Path) -> Path:
|
||||
return path.parent / (path.name + ".MAP")
|
||||
if path.suffix == '.plf' or path.suffix == '.elf':
|
||||
return path.with_suffix('.map')
|
||||
return path.parent / (path.name + ".map")
|
||||
|
||||
class LinkStep:
|
||||
def __init__(self, config: Dict[str, Any]) -> None:
|
||||
|
||||
Reference in New Issue
Block a user