Implement & link ac_npc_p_sel2

This commit is contained in:
Cuyler36
2024-11-01 02:56:31 -04:00
parent 5d60be54f5
commit 936215f32c
10 changed files with 1913 additions and 8 deletions
+1 -1
View File
@@ -1119,7 +1119,7 @@ config.libs = [
Object(NonMatching, "actor/npc/ac_npc_mask_cat2.c"),
Object(NonMatching, "actor/npc/ac_npc_needlework.c"),
Object(Matching, "actor/npc/ac_npc_p_sel.c"),
Object(NonMatching, "actor/npc/ac_npc_p_sel2.c"),
Object(Matching, "actor/npc/ac_npc_p_sel2.c"),
Object(NonMatching, "actor/npc/ac_npc_police.c"),
Object(NonMatching, "actor/npc/ac_npc_police2.c"),
Object(NonMatching, "actor/npc/ac_npc_post_girl.c"),
+22 -1
View File
@@ -3,11 +3,33 @@
#include "types.h"
#include "m_actor.h"
#include "ac_npc.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct npc_p_sel2_s NPC_P_SEL2_ACTOR;
typedef void (*aNPS2_TALK_PROC)(NPC_P_SEL2_ACTOR*, GAME_PLAY*);
struct npc_p_sel2_s {
NPC_ACTOR npc_class;
int talk_idx;
aNPS2_TALK_PROC talk_proc;
int talk_end_flag;
int player_sum;
int player_no;
int card_file_idx;
int base_message;
int base_message2;
int card_player_num;
int card_player_idx;
int card_player_next_choice_idx;
int passport_slot;
u8 start_flag;
};
extern ACTOR_PROFILE Npc_P_Sel2_Profile;
#ifdef __cplusplus
@@ -15,4 +37,3 @@ extern ACTOR_PROFILE Npc_P_Sel2_Profile;
#endif
#endif
+199 -1
View File
@@ -6,11 +6,41 @@
#include "m_personal_id.h"
#include "m_land_h.h"
#include "m_private.h"
#include "m_diary.h"
#include "dolphin/card.h"
#ifdef __cplusplus
extern "C" {
#endif
#define mCD_LAND_SAVE_SIZE 0x72000
#define mCD_ORIGINAL_SAVE_SIZE 0xE000
#define mCD_MAIL_SAVE_SIZE 0xC000
#define mCD_DIARY_SAVE_SIZE 0xC000
#define mCD_PRESENT_SAVE_SIZE 0x2000
#define mCD_PLAYER_SAVE_SIZE 0x6000
/* Offset to start of save data when loading from card.
Skips the comment, banner, & icon data. */
#define mCD_SAVE_DATA_OFS 0x1440
#define mCD_LAND_PROTECT_CODE_MAGIC0 0x3C1C
enum {
mCD_SLOT_A,
mCD_SLOT_B,
mCD_SLOT_NUM
};
enum {
mCD_START_COND_0,
mCD_START_COND_1,
mCD_START_COND_2,
mCD_START_COND_INCOMING_FOREIGNER,
mCD_START_COND_OUTGOING_FOREIGNER,
mCD_START_COND_NUM
};
enum {
mCD_ERROR_NOT_ENABLED, // N [not enabled?]
mCD_ERROR_AREA, // A [area?]
@@ -30,22 +60,187 @@ enum {
mCD_SPACE_BG_NUM
};
enum {
mCD_ARAM_DATA_ORIGINAL,
mCD_ARAM_DATA_MAIL,
mCD_ARAM_DATA_DIARY,
mCD_ARAM_DATA_NUM
};
enum {
mCD_FILE_SAVE_MISC,
mCD_FILE_SAVE_MAIN,
mCD_FILE_SAVE_MAIN_BAK,
mCD_FILE_SAVE_MAIL,
mCD_FILE_SAVE_ORIGINAL,
mCD_FILE_SAVE_DIARY,
mCD_FILE_PRESENT,
mCD_FILE_PLAYER,
mCD_FILE_NUM
};
/* This is also a priority table where lower = higher priority */
enum {
mCD_TRANS_ERR_NONE,
mCD_TRANS_ERR_1,
mCD_TRANS_ERR_IOERROR,
mCD_TRANS_ERR_3,
mCD_TRANS_ERR_BROKEN_WRONGENCODING,
mCD_TRANS_ERR_5,
mCD_TRANS_ERR_NOT_MEMCARD,
mCD_TRANS_ERR_WRONG_LAND,
mCD_TRANS_ERR_INVALID_NOLAND_CODE,
mCD_TRANS_ERR_LAND_EXIST,
mCD_TRANS_ERR_PASSPORT_EXIST,
mCD_TRANS_ERR_NO_FILES,
mCD_TRANS_ERR_NO_SPACE,
mCD_TRANS_ERR_TOWN_INVALID,
mCD_TRANS_ERR_OTHER_TOWN,
mCD_TRANS_ERR_15,
mCD_TRANS_ERR_16,
mCD_TRANS_ERR_17,
mCD_TRANS_ERR_18,
mCD_TRANS_ERR_19,
mCD_TRANS_ERR_20,
mCD_TRANS_ERR_WRONGDEVICE,
mCD_TRANS_ERR_NOCARD,
mCD_TRANS_ERR_23,
mCD_TRANS_ERR_GENERIC,
mCD_TRANS_ERR_BUSY,
mCD_TRANS_ERR_NUM
};
enum {
mCD_HOME_SFX_NORMAL,
mCD_HOME_SFX_DELETE,
mCD_HOME_SFX_NUM
};
#define mCD_RESULT_ERROR -1
#define mCD_RESULT_BUSY 0
#define mCD_RESULT_SUCCESS 1
#define mCD_MEMCARD_SECTORSIZE 0x2000
#define mCD_ALIGN_SECTORSIZE(s) ALIGN_NEXT(s, mCD_MEMCARD_SECTORSIZE)
typedef struct {
mLd_land_info_c land;
PersonalID_c pid[PLAYER_NUM];
} mCD_persistent_data_c;
#define mCD_KEEP_ORIGINAL_PAGE_COUNT 8
#define mCD_KEEP_ORIGINAL_COUNT 12
typedef struct {
int count;
u8 _0004[mCD_KEEP_ORIGINAL_PAGE_COUNT][12];
mNW_original_design_c original[mCD_KEEP_ORIGINAL_PAGE_COUNT][mCD_KEEP_ORIGINAL_COUNT];
int _CC80; // force size to 0xCCA0
} mCD_keep_original_c ATTRIBUTE_ALIGN(32);
#define mCD_KEEP_MAIL_PAGE_COUNT 8
#define mCD_KEEP_MAIL_COUNT 20
typedef struct {
int count;
u8 _0004[mCD_KEEP_MAIL_PAGE_COUNT][12];
Mail_c mail[mCD_KEEP_MAIL_PAGE_COUNT][mCD_KEEP_MAIL_COUNT];
} mCD_keep_mail_c ATTRIBUTE_ALIGN(32);
#define mCD_KEEP_DIARY_COUNT PLAYER_NUM
#define mCD_KEEP_DIARY_ENTRY_COUNT lbRTC_MONTHS_MAX
typedef struct {
u16 checksum;
mDi_entry_c entries[mCD_KEEP_DIARY_COUNT][mCD_KEEP_DIARY_ENTRY_COUNT];
} mCD_keep_diary_c ATTRIBUTE_ALIGN(32);
typedef struct {
CARDStat stat;
s32 fileNo;
s32 freeBlocks;
s32 result;
s32 game_result;
void* workArea;
u8 _80[0x94 - 0x80];
} mCD_memMgr_card_info_c;
typedef struct {
int proc;
int _04;
s32 fileNo;
s32 chan;
int _10;
int _14;
s32 game_result;
int _1C;
} mCD_memMgr_fileInfo_c;
typedef struct {
s32 chan;
int loaded_file_type;
u32 workArea_size;
void* workArea;
int _0010;
int load_proc;
u8 _0018[0x0054 - 0x0018];
mCD_memMgr_card_info_c cards[CARD_NUM_CHANS];
int _017C;
int land_saved;
int copy_protect;
int _0188;
int _018C;
int _0190;
int _0194;
int _0198;
int _019C;
int _01A0;
int broken_file_idx;
u8 _01A8[0x11BC - 0x01A8];
char filename[32];
} mCD_memMgr_c;
/* Bonus letter */
#define mCD_PRESENT_MAX 9
typedef struct present_save_s {
u16 checksum;
u16 present_count;
Mail_c letters[mCD_PRESENT_MAX];
} PresentSave_c;
typedef union {
struct {
char comment[CARD_COMMENT_SIZE];
u8 banner[0xE00];
u8 icon[0x600];
PresentSave_c save;
};
u8 __align_sector[mCD_MEMCARD_SECTORSIZE];
} PresentSaveFile_c ATTRIBUTE_ALIGN(32);
enum {
mCD_PRESENT_TYPE_BONUS,
mCD_PRESENT_TYPE_GIFT,
mCD_PRESENT_TYPE_NUM
};
extern s32 mCD_GetThisLandSlotNo_code(int* player_no, s32* slot_card_results);
extern int mCD_GetThisLandSlotNo(void);
extern void mCD_save_data_aram_malloc();
extern void mCD_set_aram_save_data();
extern void mCD_init_card();
extern s32 mCD_InitGameStart_bg(int chan, int file_no, int sound_mode, s32* mounted_chan);
extern s32 mCD_InitGameStart_bg(int player_no, int card_private_idx, int start_cond, s32* mounted_chan);
extern int mCD_GetCardPrivateNameCopy(u8* name, int idx);
extern int mCD_CheckCardPlayerNative(int idx);
extern int mCD_CheckPassportFile(void);
extern int mCD_CheckBrokenPassportFile(int slot);
extern int mCD_GetPlayerNum(void);
extern void mCD_PrintErrInfo(gfxprint_t* gfxprint);
extern void mCD_InitAll();
@@ -53,6 +248,9 @@ extern void mCD_LoadLand();
extern void mCD_toNextLand();
extern int mCD_EraseBrokenLand_bg(void*);
extern int mCD_EraseLand_bg(int* slot);
extern int mCD_ErasePassportFile_bg(int slot);
extern int mCD_SaveErasePlayer_bg(int* slot);
extern int mCD_card_format_bg(u8);
extern void mCD_ReCheckLoadLand(GAME_PLAY* play);
+5 -4
View File
@@ -166,14 +166,15 @@ typedef struct Save_s {
/* 0x024188 */ u8 _24188;
/* 0x024189 */ u8 _24189;
/* 0x02418A */ u8 town_day;
/* 0x02418B */ u8 _2418B[0x241A0 - 0x2418B];
/* 0x02418B */ u8 _2418B[0x24198 - 0x2418B];
/* 0x024198 */ OSTime travel_hard_time;
/* 0x0241A0 */ lbRTC_time_c saved_auto_nwrite_time; /* save data notice time used for fishing tourney results? */
/* 0x0241A8 */ u8 _241A8[0x26000 - 0x241A8];
/* 0x0241A8 */ u8 _241A8[0x242A0 - 0x241A8];
} Save_t;
typedef union save_u {
Save_t save;
// u8 raw[0x26000]; /* Temp to force length */
u8 __force_sector_align[mCD_ALIGN_SECTORSIZE(sizeof(Save_t))]; /* memcard sector-size aligned */
} Save;
typedef struct transition_s {
@@ -239,7 +240,7 @@ typedef struct common_data_s {
/* 0x028590 */ u8 remove_cut_tree_info_bitfield; /* resets the cut tree states for trees in a visible acre */
/* 0x028591 */ s8 floor_idx;
/* 0x028592 */ s16 demo_profiles[2]; /* demo_profiles[0] is for demo_clip, demo_profiles[1] is for demo_clip2 */
/* 0x028596 */ u16 copy_protect_code;
/* 0x028596 */ u16 copy_protect;
/* 0x028598 */ int event_keep_flags[4];
/* 0x0285A8 */ u8 _285A8[0x0285BD - 0x0285A8];
/* 0x0285BD */ s8 player_warp_request;
+1
View File
@@ -10,6 +10,7 @@ extern "C" {
#endif
#define mFRm_SAVE_ID ('GAFE')
#define mFRm_VERSION 6
#define mFRm_ERROR_INFO_NUM 10
#define mFRm_NO_ERROR_NO 7
+3
View File
@@ -13,7 +13,10 @@ extern "C" {
#define mSC_RADIO_DAYS 13
#define mSC_LIGHTHOUSE_DAYS 17
#define mSC_TROPHY_GOLDEN_NET 28
#define mSC_TROPHY_GOLDEN_AXE 29
#define mSC_TROPHY_GOLDEN_SCOOP 30 // assumed
#define mSC_TROPHY_GOLDEN_ROD 31
enum {
mSC_EVENT_NEW_YEARS_DAY,
+191
View File
@@ -0,0 +1,191 @@
#include "ac_npc_p_sel2.h"
#include "m_common_data.h"
#include "m_player_lib.h"
#include "m_soncho.h"
#include "m_card.h"
#include "m_string.h"
#include "m_msg.h"
#include "m_font.h"
#include "m_vibctl.h"
#include "m_house.h"
#include "m_bgm.h"
#include "m_timeIn_ovl.h"
#include "dolphin/os/OSRtc.h"
enum {
aNPS2_TALK_SETUP_YURE,
aNPS2_TALK_SETUP_SOUND,
aNPS2_TALK_SETUP_VOICE,
aNPS2_TALK_SETUP_VOICE_OK,
aNPS2_TALK_WHATS_HAPPEN,
aNPS2_TALK_CHK_OPTION,
aNPS2_TALK_CHK_OPTION2,
aNPS2_TALK_CHK_CLR_VILLAGE_DATA_CARTRIDGE,
aNPS2_TALK_CLR_VILLAGE_DATA_CARTRIDGE,
aNPS2_TALK_CHK_CLR_PL_DATA,
aNPS2_TALK_CHK_CLR_PL_DATA2,
aNPS2_TALK_CHK_CLR_PL_DATA3,
aNPS2_TALK_CHK_CLR_PL_DATA4,
aNPS2_TALK_CHK_CLR_PASSPORT_FILE,
aNPS2_TALK_CLR_PASSPORT_FILE,
aNPS2_TALK_CLR_PL_DATA,
aNPS2_TALK_TI_MENU_OPEN_MSG_WAIT,
aNPS2_TALK_TI_MENU_OPEN_WAIT,
aNPS2_TALK_TI_MENU_CLOSE_WAIT,
aNPS2_TALK_SELECT_PLAYER,
aNPS2_TALK_SELECT_CARD_PLAYER,
aNPS2_TALK_CHK_FUZAI_PLAYER,
aNPS2_TALK_CHK_KITAKU_PLAYER,
aNPS2_TALK_START_TYPE0,
aNPS2_TALK_START_TYPE1,
aNPS2_TALK_START_TYPE2,
aNPS2_TALK_START_TYPE3,
aNPS2_TALK_RETURN_TITLE,
aNPS2_TALK_WAIT,
aNPS2_TALK_NUM
};
static void aNPS2_actor_ct(ACTOR* actorx, GAME* game);
static void aNPS2_actor_dt(ACTOR* actorx, GAME* game);
static void aNPS2_actor_init(ACTOR* actorx, GAME* game);
static void aNPS2_actor_move(ACTOR* actorx, GAME* game);
static void aNPS2_actor_draw(ACTOR* actorx, GAME* game);
static void aNPS2_actor_save(ACTOR* actorx, GAME* game);
// clang-format off
ACTOR_PROFILE Npc_P_Sel2_Profile = {
mAc_PROFILE_NPC_P_SEL2,
ACTOR_PART_NPC,
ACTOR_STATE_NONE,
SP_NPC_P_SEL2,
ACTOR_OBJ_BANK_KEEP,
sizeof(NPC_P_SEL2_ACTOR),
&aNPS2_actor_ct,
&aNPS2_actor_dt,
&aNPS2_actor_init,
mActor_NONE_PROC1,
&aNPS2_actor_save,
};
// clang-format on
static u8 aNPS2_sound_mode[] = { Config_SOUND_MODE_STEREO, Config_SOUND_MODE_MONO, Config_SOUND_MODE_HEADPHONES };
static u8 aNPS2_voice_mode[] = { Config_VOICE_MODE_ANIMALESE, Config_VOICE_MODE_CLICK, Config_VOICE_MODE_SILENT };
static void aNPS2_talk_request(ACTOR*, GAME*);
static int aNPS2_talk_init(ACTOR*, GAME*);
static int aNPS2_talk_end_chk(ACTOR*, GAME*);
static void aNPS2_schedule_proc(NPC_ACTOR*, GAME_PLAY*, int);
static int aNPS2_count_player_sum(void);
static int aNPS2_setup_game_start(NPC_P_SEL2_ACTOR* p_sel2, GAME_PLAY* play);
static void aNPS2_change_talk_proc(NPC_P_SEL2_ACTOR* p_sel2, GAME_PLAY* play, int talk_idx);
static u8 static_str[mChoice_CHOICE_STRING_LEN * mChoice_CHOICE_NUM];
static void aNPS2_actor_ct(ACTOR* actorx, GAME* game) {
// clang-format off
static aNPC_ct_data_c ct_data = {
&aNPS2_actor_move,
&aNPS2_actor_draw,
5,
(aNPC_TALK_REQUEST_PROC)&none_proc1,
&aNPS2_talk_init,
&aNPS2_talk_end_chk,
0,
};
// clang-format on
GAME_PLAY* play = (GAME_PLAY*)game;
if (CLIP(npc_clip)->birth_check_proc(actorx, game) == TRUE) {
NPC_P_SEL2_ACTOR* p_sel2 = (NPC_P_SEL2_ACTOR*)actorx;
p_sel2->npc_class.schedule.schedule_proc = &aNPS2_schedule_proc;
CLIP(npc_clip)->ct_proc(actorx, game, &ct_data);
actorx->status_data.weight = MASSTYPE_IMMOVABLE;
p_sel2->player_sum = aNPS2_count_player_sum();
p_sel2->npc_class.talk_info.melody_inst = 0;
p_sel2->npc_class.talk_info.memory = 0;
mPlib_request_main_demo_wait_type1(game, FALSE, NULL);
{
ACTOR* player_actor = GET_PLAYER_ACTOR_GAME_ACTOR(game);
if (player_actor != NULL) {
player_actor->state_bitfield |= ACTOR_STATE_INVISIBLE;
}
}
{
xyz_t center;
xyz_t eye;
center.x = 100.0f;
center.y = 60.0f;
center.z = 60.0f;
eye.x = 100.0f;
eye.y = 130.0f;
eye.z = 210.0f;
Camera2_change_priority(play, 0);
Camera2_request_main_lock(play, &center, &eye, 40.0f, 0, 100.0f, 400.0f, 5);
}
sAdo_SetOutMode(aNPS2_sound_mode[Save_Get(config).sound_mode]);
sAdo_SetVoiceMode(aNPS2_voice_mode[Save_Get(config).voice_mode]);
p_sel2->npc_class.condition_info.hide_request = FALSE;
p_sel2->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_FEEL_CHECK;
{
static int base_msg_table[] = { 0x13F2, 0x141A, 0x1442, 0x146A, 0x1492, 0x14BA };
p_sel2->base_message = base_msg_table[mNpc_GetNpcLooks(actorx)];
}
{
static int base_msg_table2[] = { 0x39EE, 0x39F8, 0x3A02, 0x3A0C, 0x3A16, 0x3A20 };
p_sel2->base_message2 = base_msg_table2[mNpc_GetNpcLooks(actorx)];
}
p_sel2->start_flag = FALSE;
}
}
static void aNPS2_actor_save(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->save_proc(actorx, game);
}
static void aNPS2_actor_dt(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->dt_proc(actorx, game);
}
static void aNPS2_actor_init(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->init_proc(actorx, game);
}
static void aNPS2_actor_move(ACTOR* actorx, GAME* game) {
NPC_P_SEL2_ACTOR* p_sel2 = (NPC_P_SEL2_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
CLIP(npc_clip)->move_proc(actorx, game);
if (p_sel2->start_flag == TRUE && aNPS2_setup_game_start(p_sel2, play) == TRUE) {
p_sel2->start_flag = FALSE;
}
mSC_change_player_freeze(play);
}
static void aNPS2_actor_draw(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->draw_proc(actorx, game);
}
#include "../src/actor/npc/ac_npc_p_sel2_schedule.c_inc"
#include "../src/actor/npc/ac_npc_p_sel2_talk.c_inc"
@@ -0,0 +1,40 @@
static void aNPS2_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
NPC_P_SEL2_ACTOR* p_sel2 = (NPC_P_SEL2_ACTOR*)nactorx;
if (nactorx->action.step == aNPC_ACTION_END_STEP && !p_sel2->talk_end_flag) {
nactorx->talk_info.talk_request_proc = &aNPS2_talk_request;
}
}
static void aNPS2_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
NPC_P_SEL2_ACTOR* p_sel2 = (NPC_P_SEL2_ACTOR*)nactorx;
nactorx->request.act_priority = 4;
nactorx->request.act_idx = aNPC_ACT_WAIT;
nactorx->request.act_type = aNPC_ACT_TYPE_DEFAULT;
}
static void aNPS2_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
static aNPC_SUB_PROC think_proc[] = { &aNPS2_think_init_proc, &aNPS2_think_main_proc };
(*think_proc[type])(nactorx, play);
}
static void aNPS2_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
NPC_P_SEL2_ACTOR* p_sel2 = (NPC_P_SEL2_ACTOR*)nactorx;
nactorx->think.think_proc = &aNPS2_think_proc;
CLIP(npc_clip)->think_proc(nactorx, play, aNPC_THINK_IN_BLOCK, 0);
}
static void aNPS2_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) {
if (!CLIP(npc_clip)->think_proc(nactorx, play, -1, 1)) {
CLIP(npc_clip)->think_proc(nactorx, play, -1, 2);
}
}
static void aNPS2_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) {
static aNPC_SUB_PROC sche_proc[] = { &aNPS2_schedule_init_proc, &aNPS2_schedule_main_proc };
(*sche_proc[type])(nactorx, play);
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -116,7 +116,7 @@ static void trademark_goto_demo_scene(GAME_TRADEMARK* trademark) {
Common_Set(now_private, n_private);
if (mFRm_CheckSaveData() == FALSE) {
bzero(save, sizeof(Save_t));
bzero(save, sizeof(Save));
mFRm_ClearSaveCheckData(Save_GetPointer(save_check));
private = n_private;