mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-08 03:37:05 -04:00
Implement & mostly match m_train_control.c
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#ifndef AC_STRUCTURE_H
|
||||
#define AC_STRUCTURE_H
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef ACTOR* (*aSTR_SETUP_ACTOR_PROC)(GAME_PLAY*, mActor_name_t, int, f32, f32);
|
||||
|
||||
// TODO: finish clip
|
||||
typedef struct actor_structure_clip_s {
|
||||
aSTR_SETUP_ACTOR_PROC setup_actor_proc;
|
||||
} aSTR_Clip_c;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -22,6 +22,9 @@ extern void sAdo_SysLevStart(u8 id);
|
||||
|
||||
extern void sAdo_SysTrgStart(u16 id);
|
||||
|
||||
extern void sAdos_KishaStatusLevel(f32 speed, u32 ongenNum1, u16 angle1, f32 distance1, u32 ongenNum2, u16 angle2, f32 distance2);
|
||||
extern void sAdos_KishaStatusTrg(u8 state);
|
||||
|
||||
/* Not sure about the last param name */
|
||||
extern void sAdo_VoiceSe(u8 num, u8 num2, u8 num3, s16 character_idx, u8 scale, u8 mode);
|
||||
|
||||
|
||||
@@ -127,6 +127,19 @@ struct actor_s {
|
||||
|
||||
#define mActor_NONE_PROC1 ((mActor_proc)none_proc1)
|
||||
|
||||
typedef struct actor_list_s {
|
||||
int num_actors;
|
||||
ACTOR* actor;
|
||||
} Actor_list;
|
||||
|
||||
typedef struct actor_info_s {
|
||||
int total_num;
|
||||
Actor_list list[ACTOR_PART_NUM];
|
||||
} Actor_info;
|
||||
|
||||
extern void Actor_delete(ACTOR* actor);
|
||||
extern ACTOR* Actor_info_fgName_search(Actor_info* actor_info, mActor_name_t fg_name, int part);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-1
@@ -4,6 +4,7 @@
|
||||
#include "types.h"
|
||||
#include "ac_gyoei_h.h"
|
||||
#include "ac_insect_h.h"
|
||||
#include "ac_structure.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -13,7 +14,9 @@ extern "C" {
|
||||
typedef struct clip_s {
|
||||
/* 0x000 */ void* _000[(0x07C - 0x000) / sizeof(void*)];
|
||||
/* 0x07C */ aINS_Clip_c* insect_clip;
|
||||
/* 0x080 */ void* _080[(0x0AC - 0x080) / sizeof(void*)];
|
||||
/* 0x080 */ void* _080[(0x08C - 0x080) / sizeof(void*)];
|
||||
/* 0x08C */ aSTR_Clip_c* structure_clip;
|
||||
/* 0x090 */ void* _090[(0x0AC - 0x090) / sizeof(void*)];
|
||||
/* 0x0AC */ aGYO_Clip_c* gyo_clip;
|
||||
/* 0x0B0 */ void* _0B0[(0x104 - 0x0B0) / sizeof(void*)];
|
||||
} Clip_c;
|
||||
|
||||
@@ -57,6 +57,7 @@ extern int mCoBG_CheckWaterAttribute(u32 attribute);
|
||||
extern f32 mCoBG_GetBgY_AngleS_FromWpos(s_xyz* angle_to_ground, xyz_t wpos, f32 offset);
|
||||
extern int mCoBG_CheckWaterAttribute_OutOfSea(u32 attribute);
|
||||
extern int mCoBG_CheckHole_OrgAttr(u32 attribute);
|
||||
extern f32 mCoBG_GetBgY_OnlyCenter_FromWpos2(xyz_t wpos, f32 foot_dist);
|
||||
|
||||
extern f32 mCoBG_GetWaterHeight_File(xyz_t wpos, char* file, int line);
|
||||
#define mCoBG_GetWaterHeight(wpos) mCoBG_GetWaterHeight_File(wpos, __FILE__, __LINE__)
|
||||
|
||||
+21
-3
@@ -162,7 +162,9 @@ typedef struct common_data_s {
|
||||
/* 0x02651E */ mActor_name_t last_field_id;
|
||||
/* 0x026520 */ u8 in_initial_block; /* when TRUE, the player is in the acre which they exited a building. FALSE otherwise. */
|
||||
/* 0x026521 */ u8 submenu_disabled; /* when set, submenus cannot be accessed from start button */
|
||||
/* 0x026522 */ u8 _26522[0x2666C - 0x26522];
|
||||
/* 0x026522 */ u8 sunlight_flag;
|
||||
/* 0x026523 */ u8 train_flag;
|
||||
/* 0x026522 */ u8 _26524[0x2666C - 0x26524];
|
||||
/* 0x02666C */ s16 weather;
|
||||
/* 0x02666E */ s16 weather_intensity;
|
||||
/* 0x026670 */ lbRTC_time_c weather_time;
|
||||
@@ -173,11 +175,27 @@ typedef struct common_data_s {
|
||||
/* 0x02852E */ s16 goods_power;
|
||||
/* 0x028530 */ Door_data_c door_data; /* misc door data */
|
||||
/* 0x028544 */ Door_data_c structure_exit_door_data; /* door data for when exiting a building */
|
||||
/* 0x028558 */ u8 tmp1[0x28879 - 0x28558];
|
||||
/* 0x028558 */ u8 tmp1[0x02883E - 0x28558];
|
||||
/* 0x02883E */ u8 train_coming_flag; /* state tracker for when train is going to spawn/has spawned */
|
||||
/* 0x02883F */ u8 train_exists_flag; /* state tracker for when train exists */
|
||||
/* 0x028840 */ u8 train_control_state; /* current train state */
|
||||
/* 0x028841 */ u8 train_last_control_state; /* previous train state */
|
||||
/* 0x028842 */ u8 train_signal;
|
||||
/* 0x028843 */ u8 train_day;
|
||||
/* 0x028844 */ u8 train_action;
|
||||
/* 0x028845 */ u8 train_timer;
|
||||
/* 0x028848 */ u32 train_start_timer;
|
||||
/* 0x02884C */ f32 train_speed;
|
||||
/* 0x028850 */ xyz_t train_position;
|
||||
/* 0x02885C */ f32 train_mic_distance1;
|
||||
/* 0x028860 */ f32 train_mic_distance2;
|
||||
/* 0x028864 */ u16 train_angleY1;
|
||||
/* 0x028866 */ u16 train_angleY2;
|
||||
/* 0x028868 */ u8 _028868[0x028879 - 0x028868];
|
||||
/* 0x028879 */ u8 auto_nwrite_count;
|
||||
/* 0x02887A */ lbRTC_year_t auto_nwrite_year;
|
||||
/* 0x02887C */ u8 save_error_type; /* set to one of the mFRm_ERROR_* states when save is invalid */
|
||||
/* 0x02887D */ u8 train_coming_flag; /* set when the train is coming */
|
||||
/* 0x02887D */ u8 train_approaching_flag; /* set when the train is coming */
|
||||
/* 0x02887E */ u8 buried_treasure_flag; /* when set, treasure cannot be buried */
|
||||
/* 0x02887F */ u8 spnpc_first_talk_flags;
|
||||
/* 0x028880 */ u8 needlework_first_talk_flags;
|
||||
|
||||
@@ -90,6 +90,16 @@ typedef struct location_info_s {
|
||||
/* 0x10 */ mActor_name_t* block_data;
|
||||
} mFI_unit_c;
|
||||
|
||||
typedef struct block_table_s {
|
||||
s8 block_x;
|
||||
s8 block_z;
|
||||
|
||||
f32 pos_x;
|
||||
f32 pos_z;
|
||||
|
||||
mActor_name_t* items;
|
||||
} mFI_block_tbl_c;
|
||||
|
||||
extern int mFI_CheckFieldData();
|
||||
extern mActor_name_t mFI_GetFieldId();
|
||||
extern int mFI_GetClimate();
|
||||
|
||||
@@ -466,6 +466,10 @@ extern int mNT_check_unknown(mActor_name_t item_no);
|
||||
|
||||
#define EXIT_DOOR 0x4080
|
||||
|
||||
#define TRAIN_STATION 0x5809
|
||||
#define TRAIN0 0x580A
|
||||
#define TRAIN1 0x580B
|
||||
|
||||
#define SP_NPC_START 0xD000
|
||||
#define SP_NPC_ARTIST (SP_NPC_START + 0) // D000
|
||||
#define SP_NPC_BROKER (SP_NPC_START + 1) // D001
|
||||
|
||||
+6
-2
@@ -8,6 +8,7 @@
|
||||
#include "m_camera2.h"
|
||||
#include "m_submenu.h"
|
||||
#include "m_pause.h"
|
||||
#include "m_field_info.h"
|
||||
#include "m_play_h.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -18,12 +19,15 @@ extern "C" {
|
||||
struct game_play_s {
|
||||
/* 0x0000 */ GAME game;
|
||||
// TODO: finish
|
||||
/* 0x00E0 */ u8 _00E0[0x1A68 - 0x00E0];
|
||||
/* 0x00E0 */ int _00E0;
|
||||
/* 0x00E4 */ mFI_block_tbl_c block_table;
|
||||
/* 0x00F4 */ mFI_block_tbl_c last_block_table;
|
||||
/* 0x0104 */ u8 _0104[0x1A68 - 0x0104];
|
||||
/* 0x1A68 */ View view;
|
||||
/* 0x1B88 */ Camera2 camera;
|
||||
/* 0x1CC0 */ u8 _1CC0[0x1DA0 - 0x1CC0];
|
||||
/* 0x1DA0 */ pause_t pause;
|
||||
/* 0x1DA8 */ u8 _1DA8[0x1DEC - 0x1DA8];
|
||||
/* 0x1DA8 */ Actor_info actor_info;
|
||||
/* 0x1DEC */ Submenu submenu;
|
||||
/* 0x1FA4 */ u8 _1FA4[0x200C - 0x1FA4];
|
||||
/* 0x200C */ MtxF matrix;
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum field_draw_type {
|
||||
FIELD_DRAW_TYPE_OUTDOORS,
|
||||
FIELD_DRAW_TYPE_INDOORS,
|
||||
FIELD_DRAW_TYPE_TRAIN,
|
||||
FIELD_DRAW_TYPE_PLAYER_SELECT,
|
||||
|
||||
FIELD_DRAW_TYPE_NUM
|
||||
};
|
||||
|
||||
/*
|
||||
TODO: is this right? I assume so based on file names but
|
||||
there may be a better place for this
|
||||
|
||||
@@ -61,6 +61,8 @@ enum {
|
||||
#define mTM_SECONDS_IN_HALFDAY 12*60*60
|
||||
#define mTM_SECONDS_IN_DAY 24*60*60
|
||||
|
||||
#define mTM_MINUTES_IN_HOUR 60
|
||||
|
||||
typedef struct time_calendar_term_s {
|
||||
lbRTC_month_t month;
|
||||
lbRTC_day_t day;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef M_TRAIN_CONTROL_H
|
||||
#define M_TRAIN_CONTROL_H
|
||||
|
||||
#include "types.h"
|
||||
#include "m_play_h.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define mTRC_SLOW_SPEED 2.0f // speed stopping/starting
|
||||
#define mTRC_FAST_SPEED 6.0f // speed when farther away from station
|
||||
|
||||
enum {
|
||||
mTRC_ACTION_NONE,
|
||||
mTRC_ACTION_SPAWN_MOVING,
|
||||
mTRC_ACTION_BEGIN_SLOWDOWN,
|
||||
mTRC_ACTION_BEGIN_STOP,
|
||||
mTRC_ACTION_SIGNAL_STOPPED,
|
||||
mTRC_ACTION_WAIT_STOPPED,
|
||||
mTRC_ACTION_SIGNAL_STARTING,
|
||||
mTRC_ACTION_BEGIN_PULL_OUT,
|
||||
mTRC_ACTION_SPEED_UP,
|
||||
|
||||
mTRC_ACTION_NUM
|
||||
};
|
||||
|
||||
extern void mTRC_init();
|
||||
extern void mTRC_move(GAME_PLAY* play);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user