Implement & link ac_event_manager

This commit is contained in:
Cuyler36
2025-02-07 10:47:58 -05:00
parent 66325624aa
commit 1e944fd7a8
15 changed files with 4827 additions and 70 deletions
+1 -1
View File
@@ -967,7 +967,7 @@ config.libs = [
Object(Matching, "actor/ac_dummy.c"),
Object(Matching, "actor/ac_dump.c"),
Object(Matching, "actor/ac_effectbg.c"),
Object(NonMatching, "actor/ac_event_manager.c"),
Object(Matching, "actor/ac_event_manager.c"),
Object(Matching, "actor/ac_fallS.c"),
Object(Matching, "actor/ac_fallSESW.c"),
Object(Matching, "actor/ac_field_draw.c"),
+14 -8
View File
@@ -16,7 +16,7 @@ enum {
aEvMgr_EVENT_PLACE_SHRINE = 4,
};
typedef int (*aEvMgr_TITLE_FADE_PROC)(EVENT_MANAGER_ACTOR*, int, u8, int);
typedef int (*aEvMgr_TITLE_FADE_PROC)(EVENT_MANAGER_ACTOR*, int, int, u32);
typedef struct event_manager_clip_s {
EVENT_MANAGER_ACTOR* event_manager_actor;
@@ -29,15 +29,22 @@ typedef struct event_manager_field_info_s {
int reserve_num;
} aEvMgr_field_info_c;
typedef struct event_manager_player_pos_s {
int bx;
int bz;
int last_bx;
int last_bz;
} aEvMgr_player_pos_c;
struct event_manager_actor_s {
ACTOR actor_class;
int player_bx;
int player_bz;
int player_last_bx;
int player_last_bz;
aEvMgr_player_pos_c player_pos;
u8 _184[0x1E8 - 0x184];
aEvMgr_field_info_c field_info;
u8 _1F8[0x208 - 0x1F8];
int _1F8;
int _1FC;
int month_day;
int day_hour;
int change;
BlockOrUnit_c next_block;
BlockOrUnit_c pool_block;
@@ -50,7 +57,7 @@ struct event_manager_actor_s {
int player_home_exists;
BlockOrUnit_c dock_block;
int dock_block_exists;
int _250;
int skip_event_at_wade;
int _254;
aEvMgr_Clip_c clip;
};
@@ -62,4 +69,3 @@ extern ACTOR_PROFILE Event_Manager_Profile;
#endif
#endif
+4 -1
View File
@@ -62,6 +62,10 @@ struct groundhog_control_actor_s {
int attention_mode;
};
typedef struct groundhog_save_s {
int _00;
} aGHC_save_c;
extern ACTOR_PROFILE Groundhog_Control_Profile;
#ifdef __cplusplus
@@ -69,4 +73,3 @@ extern ACTOR_PROFILE Groundhog_Control_Profile;
#endif
#endif
+17 -6
View File
@@ -4,22 +4,33 @@
#include "types.h"
#include "m_play.h"
enum {
Debug_Display_SHAPE_O_TXT, // 16x16 sprite with O
Debug_Display_SHAPE_X_TXT, // 16x16 sprite with X
Debug_Display_SHAPE_CIRCLE_TXT, // 16x16 sprite with circle
Debug_Display_SHAPE_CROSSHAIR_TXT, // 16x16 sprite with crosshair
Debug_Display_SHAPE_ARROW_MODEL, // 3D model of an arrow
Debug_Display_SHAPE_CAMERA_MODEL, // 3D model of a camera
Debug_Display_SHAPE_NUM
};
typedef struct debug_display_s Debug_display;
struct debug_display_s{
struct debug_display_s {
xyz_t pos;
s_xyz rot;
xyz_t scale;
rgba8888_t color;
s16 type;
s16 shape;
Debug_display* next;
};
extern void Debug_Display_init();
extern Debug_display* Debug_Display_new(f32 posX, f32 posY, f32 posZ, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, u8 r, u8 g, u8 b, u8 alpha, s16 type, GRAPH* graph);
extern Debug_display* Debug_Display_new(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX,
f32 scaleY, f32 scaleZ, u8 r, u8 g, u8 b, u8 alpha, s16 shape, GRAPH* graph);
extern void Debug_Display_output(GAME_PLAY* play);
extern Debug_display* debug_display;
#endif
#endif
+10 -5
View File
@@ -401,6 +401,9 @@ typedef struct ghost_spirit_block_data_s {
#define mEv_GHOST_FLAG_ACTIVE 0x4000 // TODO: do these live in the ghost actor itself?
#define mEv_GHOST_FLAG_RETURNED_SPIRITS 0x8000
#define mEv_GHOST_COMMON_SPAWNED_SPIRITS 0x8000
typedef struct ghost_common_s {
mEv_gst_hitodama_block_c hitodama_block_data;
u16 flags;
@@ -448,12 +451,14 @@ typedef struct designer_event_s {
mActor_name_t gifted_cloths[mEv_DESGINER_NUM];
} mEv_designer_c;
#define mEv_BROKER_ITEM_NUM 3
typedef struct broker_event_s {
PersonalID_c pid[2];
PersonalID_c pid[mEv_BROKER_ITEM_NUM - 1];
lbRTC_time_c end_time;
int used;
mActor_name_t sold_items[2];
mActor_name_t items[3];
mActor_name_t sold_items[mEv_BROKER_ITEM_NUM - 1];
mActor_name_t items[mEv_BROKER_ITEM_NUM];
} mEv_broker_c;
typedef struct artist_event_s {
@@ -486,7 +491,7 @@ typedef union {
typedef struct special_event_s {
lbRTC_time_c scheduled;
u32 type;
u32 kind;
mEv_special_u event;
} mEv_special_c;
@@ -660,7 +665,7 @@ extern int mEv_clear_common_area(int type, u8 id);
extern mEv_place_data_c* mEv_reserve_common_place(int type, u8 id);
extern mEv_place_data_c* mEv_get_common_place(int type, u8 id);
extern int mEv_clear_common_place(int type, u8 id);
extern int mEv_use_block_by_other_event(int type, BlockOrUnit_c* block);
extern int mEv_use_block_by_other_event(int type, BlockOrUnit_c block);
extern void mEv_erase_FG_all_in_common_place();
extern void mEv_clear_rumor();
extern int mEv_spread_rumor(int type);
+1
View File
@@ -41,6 +41,7 @@ extern "C" {
#define mFI_BK_WORLDSIZE_HALF_Z_F (mFI_BK_WORLDSIZE_Z_F / 2.0f)
#define mFI_POS2UT(pos) ((int)((pos) / mFI_UNIT_BASE_SIZE_F))
#define mFI_BK_UT_2_POS(bk, ut) (((bk) * UT_BASE_NUM + (ut)) * mFI_UNIT_BASE_SIZE_F)
#define mFI_ROW_TO_CHARSTR(row) ((row) + 'A')
#define mFI_COL_TO_CHARSTR(col) ((col) + '0')
+1
View File
@@ -18,6 +18,7 @@ extern "C" {
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
#define CLAMP_MAX(x, max) ((max) < (x) ? (max) : (x))
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (((x) > (max) ? (max) : (x))))
#define CLAMP2(x, min, max) ((min) < (x) ? (((x) < (max) ? (x) : (max))) : (min))
/* Float modulo operator */
#define MOD_F(a, m) (a - (int)((a) * (1.0f / (m))) * (m))
+3
View File
@@ -169,6 +169,7 @@ typedef struct offset_table_s {
#define INSECT_NUM INSECT_ONLY_NUM + 5 // 5 spirits
#define HUKUBUKURO_NUM 2
#define KABU_NUM 4
#define SPIRIT_NUM 5
// #define WALL_MY_ORIG_START (72)
// #define WALL_MY_ORIG_NUM (8)
@@ -3401,6 +3402,8 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define RSV_TREE 0xFE1A
#define RSV_DOOR 0xFE1B
#define RSV_FE1C 0xFE1C
#define RSV_BRIDGE0 0xFE1D
#define RSV_BRIDGE1 0xFE1E
#define RSV_FE1F 0xFE1F
#define RSV_CLOTH 0xFE20
#define RSV_CLOTH1 0xFE21
+1 -1
View File
@@ -362,7 +362,7 @@ extern int mNpc_SendMailtoNpc(Mail_c* mail);
extern void mNpc_ClearRemail(Anmremail_c* remail);
extern void mNpc_Remail();
extern u8 mNpc_GetPaperType();
extern int mNpc_SendVtdayMail(int type);
extern int mNpc_SendVtdayMail();
extern int mNpc_CheckFriendship(PersonalID_c* pid, Animal_c* animal);
extern int mNpc_SendEventBirthdayCard(PersonalID_c* pid);
extern int mNpc_SendEventBirthdayCard2(PersonalID_c* pid, int player_no);
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -480,10 +480,10 @@ static void aFSN_actor_move(ACTOR* actorx, GAME* game) {
player->actor_class.world.position.x + sin_s(actorx->player_angle_y - (s16)-0x8000) * 30.0f,
player->actor_class.world.position.y + 60.0f,
player->actor_class.world.position.z + cos_s(actorx->player_angle_y - (s16)-0x8000) * 30.0f,
1.0f, 1.0f, 1.0f,
0, rot_y, 0,
1.0f, 1.0f, 1.0f,
250, 100, 120, 128,
4,
Debug_Display_SHAPE_ARROW_MODEL,
game->graph
);
}
+1 -1
View File
@@ -1456,7 +1456,7 @@ static int aQMgr_decide_msg_special_ev(QUEST_MANAGER_ACTOR* manager, int looks)
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
int i;
ev_kind = Save_Get(event_save_data).special.type;
ev_kind = Save_Get(event_save_data).special.kind;
if (ev_kind != -1) {
// clang-format off
+44 -38
View File
@@ -2,29 +2,36 @@
#include "m_rcp.h"
#include "sys_matrix.h"
enum {
Debug_Display_DRAW_SPRITE,
Debug_Display_DRAW_POLYGON,
Debug_Display_DRAW_TYPE_NUM
};
typedef void (*DEBUG_DISP_PROC)(Debug_display*, void*, GAME_PLAY*);
typedef struct debug_display_info_s{
typedef struct debug_display_info_s {
/* 0x0 */ s16 type;
/* 0x4 */ void* arg;
} Debug_display_info;
} Debug_display_info;
static void debug_display_output_sprite_16x16_I8(Debug_display *, void *, GAME_PLAY *);
static void debug_display_output_polygon(Debug_display *, void *, GAME_PLAY *);
static void debug_display_output_sprite_16x16_I8(Debug_display*, void*, GAME_PLAY*);
static void debug_display_output_polygon(Debug_display*, void*, GAME_PLAY*);
Debug_display* debug_display;
void Debug_Display_init(){
extern void Debug_Display_init(void) {
debug_display = NULL;
}
extern Debug_display* Debug_Display_new(f32 posX, f32 posY, f32 posZ, f32 scaleX, f32 scaleY, f32 scaleZ,
s16 rotX, s16 rotY, s16 rotZ, u8 r, u8 g, u8 b, u8 alpha, s16 type, GRAPH* graph){
extern Debug_display* Debug_Display_new(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX,
f32 scaleY, f32 scaleZ, u8 r, u8 g, u8 b, u8 alpha, s16 shape, GRAPH* graph) {
Debug_display* display = debug_display;
debug_display = GRAPH_ALLOC(graph, sizeof(Debug_display) + 4);
Debug_display* prev_display = debug_display;
// allocate new debug display, aligned to 8 bytes to match Gfx size
debug_display = GRAPH_ALLOC(graph, ALIGN_NEXT(sizeof(Debug_display), 8));
debug_display->pos.x = posX;
debug_display->pos.y = posY;
debug_display->pos.z = posZ;
@@ -34,35 +41,37 @@ s16 rotX, s16 rotY, s16 rotZ, u8 r, u8 g, u8 b, u8 alpha, s16 type, GRAPH* graph
debug_display->scale.x = scaleX;
debug_display->scale.y = scaleY;
debug_display->scale.z = scaleZ;
debug_display->color.r = r;
debug_display->color.g = g;
debug_display->color.b = b;
debug_display->color.a = alpha;
debug_display->type = type;
debug_display->next = display;
debug_display->color.r = r;
debug_display->color.g = g;
debug_display->color.b = b;
debug_display->color.a = alpha;
debug_display->shape = shape;
debug_display->next = prev_display;
return debug_display;
return debug_display;
}
extern void* no_txt;
extern void* nx_txt;
extern void* np_txt;
extern void* nt_txt;
extern u8 no_txt[];
extern u8 nx_txt[];
extern u8 np_txt[];
extern u8 nt_txt[];
extern Gfx darrow_model[];
extern Gfx camera_model[];
extern void Debug_Display_output(GAME_PLAY* play){
static DEBUG_DISP_PROC debug_display_output_proc[] = { debug_display_output_sprite_16x16_I8, debug_display_output_polygon};
extern void Debug_Display_output(GAME_PLAY* play) {
static DEBUG_DISP_PROC debug_display_output_proc[] = { debug_display_output_sprite_16x16_I8,
debug_display_output_polygon };
static Debug_display_info debug_display_shape_data[] = {
{0, &no_txt}, {0, &nx_txt}, {0, &np_txt}, {0, &nt_txt}, {1, darrow_model}, {1, camera_model},
};
{ Debug_Display_DRAW_SPRITE, no_txt }, { Debug_Display_DRAW_SPRITE, nx_txt },
{ Debug_Display_DRAW_SPRITE, np_txt }, { Debug_Display_DRAW_SPRITE, nt_txt },
{ Debug_Display_DRAW_POLYGON, darrow_model }, { Debug_Display_DRAW_POLYGON, camera_model },
};
Debug_display_info* data;
Debug_display* display = debug_display;
Debug_display* display = debug_display;
while(display != NULL){
data = &debug_display_shape_data[display->type];
while (display != NULL) {
data = &debug_display_shape_data[display->shape];
debug_display_output_proc[data->type](display, data->arg, play);
display = display->next;
}
@@ -70,39 +79,37 @@ extern void Debug_Display_output(GAME_PLAY* play){
extern Gfx RCP_debug_texture_16x16_8[];
static void debug_display_output_sprite_16x16_I8(Debug_display* display, void* txt, GAME_PLAY* play){
static void debug_display_output_sprite_16x16_I8(Debug_display* display, void* txt, GAME_PLAY* play) {
OPEN_DISP(play->game.graph);
softsprite_prim(play->game.graph);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 0, display->color.r, display->color.g, display->color.b, display->color.a);
Matrix_translate(display->pos.x, display->pos.y, display->pos.z, 0);
Matrix_scale(display->scale.x, display->scale.y, display->scale.z, 1);
Matrix_mult(&play->billboard_matrix, 1);
Matrix_rotateXYZ(display->rot.x, display->rot.y, display->rot.z, 1);
gDPLoadTextureBlock(NEXT_POLY_XLU_DISP, txt, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_XLU_DISP, RCP_debug_texture_16x16_8);
CLOSE_DISP(play->game.graph);
}
static void debug_display_output_polygon(Debug_display* display, void* dl, GAME_PLAY* play) {
static Lights1 material = gdSPDefLights1(128, 128, 128, 255, 255, 255, 73, 73, 73);
OPEN_DISP(play->game.graph);
polygon_z_light_prim(play->game.graph);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 0, display->color.r, display->color.g, display->color.b, display->color.a);
gSPSetLights1(NEXT_POLY_XLU_DISP, material);
gSPSetLights1(NEXT_POLY_XLU_DISP, material);
Matrix_softcv3_load(&display->rot, display->pos.x, display->pos.y, display->pos.z);
Matrix_scale(display->scale.x, display->scale.y, display->scale.z, 1);
@@ -111,4 +118,3 @@ static void debug_display_output_polygon(Debug_display* display, void* dl, GAME_
gSPDisplayList(NEXT_POLY_XLU_DISP, dl);
CLOSE_DISP(play->game.graph);
}
+6 -6
View File
@@ -31,7 +31,7 @@ typedef union ymdh {
static int update_save_area(void);
extern void mEv_ClearSpecialEvent(mEv_special_c* special_event) {
special_event->type = -1;
special_event->kind = -1;
bzero(&special_event->event, sizeof(mEv_special_u));
bzero(Common_GetPointer(special_event_common), sizeof(mEv_event_common_u));
}
@@ -2448,13 +2448,13 @@ extern int mEv_clear_common_place(int type, u8 id) {
return 0;
}
extern int mEv_use_block_by_other_event(int type, BlockOrUnit_c* block) {
extern int mEv_use_block_by_other_event(int type, BlockOrUnit_c block) {
mEv_common_data_c* ev_common = Common_GetPointer(event_common);
int i;
for (i = 0; i < mEv_PLACE_NUM; i++) {
if (((1 << i) & ev_common->place_use_bitfield) != 0) {
if (ev_common->place[i].data.block.x == block->x && ev_common->place[i].data.block.z == block->z &&
if (ev_common->place[i].data.block.x == block.x && ev_common->place[i].data.block.z == block.z &&
ev_common->place[i].info.type != type) {
return TRUE;
}
@@ -2682,8 +2682,8 @@ extern int mEv_get_special_event_state() {
mEv_ymdh_u today_date_start;
int event_type;
if (Save_Get(event_save_data).special.type <= mEv_SPNPC_END) {
event_type = special_events[Save_Get(event_save_data).special.type];
if (Save_Get(event_save_data).special.kind <= mEv_SPNPC_END) {
event_type = special_events[Save_Get(event_save_data).special.kind];
} else {
return FALSE;
}
@@ -2716,7 +2716,7 @@ extern int mEv_get_special_event_state() {
res = mEv_SPECIAL_STATE_ACTIVE;
} else if (check_ymdh_range(today_date.raw, event_date_start.raw, event_date.raw)) {
res = mEv_SPECIAL_STATE_SCHEDULED_TODAY;
} else if (Save_Get(event_save_data).special.type != 0xFFFFFFFF && event_date_start.raw > today_date_start.raw) {
} else if (Save_Get(event_save_data).special.kind != 0xFFFFFFFF && event_date_start.raw > today_date_start.raw) {
res = mEv_SPECIAL_STATE_SCHEDULED_LATER;
}
+1 -1
View File
@@ -1760,7 +1760,7 @@ static void mNpc_SendEventPresentMailSex(int* selected, u8* type, Animal_c* anim
/* this used to be mNpc_SendEventPresentMail_common in DnM and DnM+ (handled both valentine's day & white day) */
extern int mNpc_SendVtdayMail(int type) {
extern int mNpc_SendVtdayMail() {
u8 types[ANIMAL_NUM_MAX];
int other_sex_best_friends[ANIMAL_NUM_MAX];
Animal_c* animal_p;