Add definitions for flooring & walls, minor m_card work

This commit is contained in:
Cuyler36
2024-02-25 12:05:58 -05:00
parent e08ce97f5e
commit c70a6f0b52
19 changed files with 6930 additions and 5819 deletions
+71
View File
@@ -0,0 +1,71 @@
unsigned char itemName_paper[] = {
#include "assets/itemName_paper.inc"
};
unsigned char itemName_money[] = {
#include "assets/itemName_money.inc"
};
unsigned char itemName_tool[] = {
#include "assets/itemName_tool.inc"
};
unsigned char itemName_fish[] = {
#include "assets/itemName_fish.inc"
};
unsigned char itemName_cloth[] = {
#include "assets/itemName_cloth.inc"
};
unsigned char itemName_etc[] = {
#include "assets/itemName_etc.inc"
};
unsigned char itemName_carpet[] = {
#include "assets/itemName_carpet.inc"
};
unsigned char itemName_wall[] = {
#include "assets/itemName_wall.inc"
};
unsigned char itemName_fruit[] = {
#include "assets/itemName_fruit.inc"
};
unsigned char itemName_plant[] = {
#include "assets/itemName_plant.inc"
};
unsigned char itemName_minidisk[] = {
#include "assets/itemName_minidisk.inc"
};
unsigned char itemName_dummy[] = {
#include "assets/itemName_dummy.inc"
};
unsigned char itemName_ticket[] = {
#include "assets/itemName_ticket.inc"
};
unsigned char itemName_insect[] = {
#include "assets/itemName_insect.inc"
};
unsigned char itemName_hukubukuro[] = {
#include "assets/itemName_hukubukuro.inc"
};
unsigned char itemName_kabu[] = {
#include "assets/itemName_kabu.inc"
};
unsigned char ftrName_table[] = {
#include "assets/ftrName_table.inc"
};
unsigned char ftrName2_table[] = {
#include "assets/ftrName2_table.inc"
};
+354
View File
@@ -0,0 +1,354 @@
#include "m_card.h"
#include "dolphin/private/card.h"
#include "libultra/libultra.h"
#include "m_malloc.h"
#include "libc64/sleep.h"
typedef struct card_bg_info {
int _00;
int _04;
int _08;
int _0C;
int _10;
int _14;
int space_proc;
int tries;
int _20;
int _24;
int _28;
} mCD_bg_info_c;
static char mCD_file_name[] = "DobutsunomoriP_MURA";
static int l_mcd_err_debug[mCD_ERROR_NUM] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE };
static s32 l_mcd_err_result = CARD_RESULT_READY;
static mCD_bg_info_c l_mcd_bg_info;
static void mCD_ClearErrInfo(void) {
bzero(l_mcd_err_debug, sizeof(l_mcd_err_debug));
l_mcd_err_result = 0;
}
static void mCD_OnErrInfo(int err) {
if (err >= 0 && err < mCD_ERROR_NUM) {
l_mcd_err_debug[err] = TRUE;
}
}
static void mCD_OffErrInfo(int err) {
if (err >= 0 && err < mCD_ERROR_NUM) {
l_mcd_err_debug[err] = FALSE;
}
}
static void mCD_SetErrResult(s32 result) {
l_mcd_err_result = result;
}
extern void mCD_PrintErrInfo(gfxprint_t* gfxprint) {
gfxprint_color(gfxprint, 250, 100, 250, 255);
gfxprint_locate8x8(gfxprint, 22, 3);
if (l_mcd_err_debug[mCD_ERROR_NOT_ENABLED]) {
gfxprint_printf(gfxprint, "N");
}
if (l_mcd_err_debug[mCD_ERROR_AREA]) {
gfxprint_printf(gfxprint, "A");
}
if (l_mcd_err_debug[mCD_ERROR_WRITE]) {
gfxprint_printf(gfxprint, "W");
}
if (l_mcd_err_debug[mCD_ERROR_READ]) {
gfxprint_printf(gfxprint, "R");
}
if (l_mcd_err_debug[mCD_ERROR_CHECKSUM]) {
gfxprint_printf(gfxprint, "C");
}
if (l_mcd_err_debug[mCD_ERROR_OUTDATED]) {
gfxprint_printf(gfxprint, "O");
}
if (l_mcd_err_debug[mCD_ERROR_CREATE]) {
gfxprint_printf(gfxprint, "c");
}
if (l_mcd_err_result != CARD_RESULT_READY) {
gfxprint_printf(gfxprint, "%d", l_mcd_err_result);
}
}
static void* mCD_malloc_32(u32 size) {
return zelda_malloc_align(size, 32);
}
static int mCD_check_card_common(s32* result, s32 req_sector_size, s32 chan) {
s32 mem_size = 0;
s32 sector_size = 0;
int res = mCD_RESULT_BUSY;
*result = CARDProbeEx(chan, &mem_size, &sector_size);
if (*result == CARD_RESULT_READY && sector_size == req_sector_size) {
res = mCD_RESULT_SUCCESS;
} else if (*result != CARD_RESULT_BUSY) {
res = mCD_RESULT_ERROR;
}
return res;
}
static int mCD_check_card(s32* result, s32 req_sector_size, s32 chan) {
int ms = 0;
int check_common_res = mCD_RESULT_BUSY;
int res = mCD_RESULT_ERROR;
while (check_common_res == mCD_RESULT_BUSY && ms < 500) {
check_common_res = mCD_check_card_common(result, req_sector_size, chan);
if (check_common_res == mCD_RESULT_BUSY) {
msleep(1);
ms++;
}
}
if (check_common_res == mCD_RESULT_SUCCESS) {
res = mCD_RESULT_SUCCESS;
}
return res;
}
static int mCD_check_sector_size(s32 req_sector_size, s32 chan) {
s32 mem_size = 0;
s32 sector_size = 0;
s32 result = CARD_RESULT_BUSY;
int ms = 0;
int res = mCD_RESULT_BUSY;
while (result == CARD_RESULT_BUSY && ms < 500) {
result = CARDProbeEx(chan, &mem_size, &sector_size);
if (result == CARD_RESULT_BUSY) {
msleep(1);
ms++;
}
}
if (result == CARD_RESULT_READY) {
if (req_sector_size == sector_size) {
res = mCD_RESULT_SUCCESS;
} else {
res = mCD_RESULT_BUSY;
}
}
return res;
}
static int mCD_get_file_num_common(s32 chan) {
CARDFileInfo fileInfo;
s32 num = 0;
s32 file_no;
for (file_no = 0; file_no < CARD_MAX_FILE; file_no++) {
s32 result = CARDFastOpen(chan, file_no, &fileInfo);
if (result == CARD_RESULT_READY) {
num++;
CARDClose(&fileInfo);
}
}
return num;
}
static int mCD_get_file_num(void* workArea, s32 chan) {
int num = 0;
s32 result;
if (workArea != NULL && mCD_check_card(&result, mCD_MEMCARD_SECTORSIZE, chan) == mCD_RESULT_SUCCESS) {
result = CARDMount(chan, workArea, NULL);
if (result == CARD_RESULT_READY || result == CARD_RESULT_BROKEN) {
result = CARDCheck(chan);
num = mCD_get_file_num_common(chan);
CARDUnmount(chan);
} else if (result == CARD_RESULT_ENCODING) {
CARDUnmount(chan);
}
}
return num;
}
extern void mCD_init_card(void) {
CARDInit();
}
static void mCD_ClearCardBgInfo(mCD_bg_info_c* bg_info) {
bzero(bg_info, sizeof(mCD_bg_info_c));
}
static void mCD_StartSetCardBgInfo(void) {
mCD_ClearCardBgInfo(&l_mcd_bg_info);
}
static int mCD_get_space_bg_get_slot(s32* freeBlocks, mCD_bg_info_c* bg_info, s32 chan, s32* result, void* workArea) {
int res;
bg_info->tries++;
res = mCD_check_card_common(result, mCD_MEMCARD_SECTORSIZE, chan);
if (res == mCD_RESULT_SUCCESS && workArea != NULL) {
*freeBlocks = 0;
*result = CARDMountAsync(chan, workArea, NULL, NULL);
if (*result == CARD_RESULT_ENCODING) {
CARDUnmount(chan);
res = mCD_RESULT_ERROR;
} else if (*result != CARD_RESULT_READY && *result != CARD_RESULT_BROKEN) {
res = mCD_RESULT_ERROR;
}
bg_info->tries = 0;
} else if (res != mCD_RESULT_BUSY) {
*freeBlocks = 0;
res = mCD_RESULT_ERROR;
bg_info->tries = 0;
} else if (bg_info->tries >= 100) {
*freeBlocks = 0;
res = mCD_RESULT_ERROR;
bg_info->tries = 0;
}
return res;
}
static int mCD_get_space_bg_main(s32* freeBlocks, mCD_bg_info_c* bg_info, s32 chan, s32* result, void* workArea) {
int res = mCD_RESULT_BUSY;
*result = CARDGetResultCode(chan);
if (*result == CARD_RESULT_READY || *result == CARD_RESULT_BROKEN) {
*result = CARDCheck(chan);
if (*result == CARD_RESULT_READY) {
s32 freeFiles;
*result = CARDFreeBlocks(chan, freeBlocks, &freeFiles);
if (*result == CARD_RESULT_READY) {
res = mCD_RESULT_SUCCESS;
} else {
res = mCD_RESULT_ERROR;
}
} else {
res = mCD_RESULT_ERROR;
}
CARDUnmount(chan);
} else if (*result != CARD_RESULT_BUSY) {
if (*result == CARD_RESULT_ENCODING) {
CARDUnmount(chan);
}
res = mCD_RESULT_ERROR;
}
return res;
}
typedef int (*mCD_GET_SPACE_BG_PROC)(s32*, mCD_bg_info_c*, s32, s32*, void*);
static int mCD_get_space_bg(s32* freeBlocks, s32 chan, s32* result, void* workArea) {
static mCD_GET_SPACE_BG_PROC get_proc[mCD_SPACE_BG_NUM] = { &mCD_get_space_bg_get_slot, &mCD_get_space_bg_main };
mCD_bg_info_c* bg_info = &l_mcd_bg_info;
u8 proc_type = bg_info->space_proc;
int res = mCD_RESULT_BUSY;
*freeBlocks = 0;
if (proc_type < mCD_SPACE_BG_NUM) {
int proc_res = (*get_proc[proc_type])(freeBlocks, bg_info, chan, result, workArea);
if (proc_res == mCD_RESULT_SUCCESS) {
bg_info->space_proc++;
if (bg_info->space_proc >= mCD_SPACE_BG_NUM) {
res = mCD_RESULT_SUCCESS;
mCD_ClearCardBgInfo(bg_info);
}
} else if (proc_res != mCD_RESULT_BUSY) {
res = mCD_RESULT_ERROR;
mCD_ClearCardBgInfo(bg_info);
}
} else {
res = mCD_RESULT_ERROR;
mCD_ClearCardBgInfo(bg_info);
}
return res;
}
static void mCD_close_and_unmount(CARDFileInfo* fileInfo, s32 chan) {
CARDClose(fileInfo);
CARDUnmount(chan);
}
static int mCD_bg_check_slot(mCD_bg_info_c* bg_info, s32 chan, s32* result) {
int res = mCD_RESULT_BUSY;
int common_res = mCD_check_card_common(result, mCD_MEMCARD_SECTORSIZE, chan);
bg_info->tries++;
if (common_res == mCD_RESULT_SUCCESS) {
bg_info->space_proc++;
bg_info->tries = 0;
res = mCD_RESULT_SUCCESS;
} else if (common_res != mCD_RESULT_BUSY || bg_info->tries >= 100) {
bg_info->tries = 0;
res = mCD_RESULT_ERROR;
}
return res;
}
static int mCD_bg_init_com(mCD_bg_info_c* bg_info, s32 chan, s32* result, void** workArea_p, void** read_p, int read) {
int res;
*workArea_p = mCD_malloc_32(CARD_WORKAREA_SIZE);
if (read == TRUE) {
*read_p = mCD_malloc_32(mCD_MEMCARD_SECTORSIZE);
}
if (*workArea_p != NULL && (read == FALSE || (read == TRUE && *read_p != NULL))) {
*result = CARDMountAsync(chan, *workArea_p, NULL, NULL);
if (*result == CARD_RESULT_READY) {
bg_info->space_proc++;
res = mCD_RESULT_SUCCESS;
} else if (*result == CARD_RESULT_BROKEN) {
*result = CARDCheckAsync(chan, NULL);
if (*result == CARD_RESULT_READY) {
bg_info->space_proc++;
res = mCD_RESULT_SUCCESS;
} else {
if (*result == CARD_RESULT_BROKEN || *result == CARD_RESULT_ENCODING) {
CARDUnmount(chan);
}
res = mCD_RESULT_ERROR;
}
} else {
if (*result == CARD_RESULT_ENCODING) {
CARDUnmount(chan);
}
res = mCD_RESULT_ERROR;
}
} else {
res = mCD_RESULT_ERROR;
}
return res;
}
+3431 -2364
View File
File diff suppressed because it is too large Load Diff
+2234 -3259
View File
File diff suppressed because it is too large Load Diff
+169 -191
View File
@@ -10,272 +10,250 @@
#define sSC_MYK_ERR_MAP (1 << 7)
static int sSC_CheckSaveData_Weather() {
int weather = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather));
int intensity = mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather));
if (weather >= mEnv_WEATHER_LEAVES) {
mFRm_ERRORLINE(78);
return sSC_MYK_ERR_WEATHER;
}
else if (intensity >= mEnv_WEATHER_INTENSITY_NUM) {
mFRm_ERRORLINE(82);
return sSC_MYK_ERR_WEATHER;
}
else {
return sSC_MYK_OK;
}
int weather = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather));
int intensity = mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather));
if (weather >= mEnv_WEATHER_LEAVES) {
mFRm_ERRORLINE(78);
return sSC_MYK_ERR_WEATHER;
} else if (intensity >= mEnv_WEATHER_INTENSITY_NUM) {
mFRm_ERRORLINE(82);
return sSC_MYK_ERR_WEATHER;
} else {
return sSC_MYK_OK;
}
}
static int sSC_CheckSaveData_Shop() {
Shop_c* shop = Save_GetPointer(shop);
mSP_goods_priority_list_c* prio_list = Save_GetPointer(shop)->priority_lists;
int i;
Shop_c* shop = Save_GetPointer(shop);
mSP_goods_priority_list_c* prio_list = Save_GetPointer(shop)->priority_lists;
int i;
for (i = 0; i < mSP_KIND_MAX; i++) {
if (prio_list->a >= mSP_PRIORITY_NUM) {
mFRm_ERRORLINE(101);
return sSC_MYK_ERR_SHOP;
for (i = 0; i < mSP_KIND_MAX; i++) {
if (prio_list->a >= mSP_PRIORITY_NUM) {
mFRm_ERRORLINE(101);
return sSC_MYK_ERR_SHOP;
}
if (prio_list->b >= mSP_PRIORITY_NUM) {
mFRm_ERRORLINE(105);
return sSC_MYK_ERR_SHOP;
}
if (prio_list->c >= mSP_PRIORITY_NUM) {
mFRm_ERRORLINE(109);
return sSC_MYK_ERR_SHOP;
}
if (prio_list->pad != 0) {
mFRm_ERRORLINE(113);
return sSC_MYK_ERR_SHOP;
}
prio_list++;
}
if (prio_list->b >= mSP_PRIORITY_NUM) {
mFRm_ERRORLINE(105);
return sSC_MYK_ERR_SHOP;
}
if (prio_list->c >= mSP_PRIORITY_NUM) {
mFRm_ERRORLINE(109);
return sSC_MYK_ERR_SHOP;
}
if (prio_list->pad != 0) {
mFRm_ERRORLINE(113);
return sSC_MYK_ERR_SHOP;
}
prio_list++;
}
return sSC_MYK_OK;
return sSC_MYK_OK;
}
static int sSC_CheckHouseSize(mHm_hs_c* house) {
return house->size_info.size < mHm_HOMESIZE_NUM;
return house->size_info.size < mHm_HOMESIZE_NUM;
}
static int sSC_CheckHappyRoom(mHm_hs_c* house) {
return TRUE;
return TRUE;
}
static int sSC_CheckDoorOriginal(mHm_hs_c* house) {
if (house->door_original < mPr_ORIGINAL_DESIGN_COUNT || house->door_original == 0xFF) {
return TRUE;
}
if (house->door_original < mPr_ORIGINAL_DESIGN_COUNT || house->door_original == 0xFF) {
return TRUE;
}
return FALSE;
return FALSE;
}
static int sSCCheckOneFloorData(mHm_flr_c* floor) {
return TRUE;
return TRUE;
}
static int sSC_CheckHouseInterior(mHm_hs_c* house) {
int i;
int i;
for (i = 0; i < mHm_ROOM_NUM; i++) {
if (sSCCheckOneFloorData(house->floors + i) == 0) {
return FALSE;
for (i = 0; i < mHm_ROOM_NUM; i++) {
if (sSCCheckOneFloorData(house->floors + i) == 0) {
return FALSE;
}
}
}
return TRUE;
return TRUE;
}
static int sSC_CheckSaveData_House() {
mHm_hs_c* house;
int i;
mHm_hs_c* house;
int i;
for (i = 0; i < mHS_HOUSE_NUM; i++) {
house = Save_Get(homes) + i;
for (i = 0; i < mHS_HOUSE_NUM; i++) {
house = Save_Get(homes) + i;
if (sSC_CheckHouseSize(house) == 0) {
mFRm_ERRORLINE(220);
return sSC_MYK_ERR_HOUSE;
if (sSC_CheckHouseSize(house) == 0) {
mFRm_ERRORLINE(220);
return sSC_MYK_ERR_HOUSE;
}
if (sSC_CheckHappyRoom(house) == 0) {
mFRm_ERRORLINE(227);
return sSC_MYK_ERR_HOUSE;
}
if (sSC_CheckDoorOriginal(house) == 0) {
mFRm_ERRORLINE(234);
return sSC_MYK_ERR_HOUSE;
}
if (sSC_CheckHouseInterior(house) == 0) {
mFRm_ERRORLINE(241);
return sSC_MYK_ERR_HOUSE;
}
}
if (sSC_CheckHappyRoom(house) == 0) {
mFRm_ERRORLINE(227);
return sSC_MYK_ERR_HOUSE;
}
if (sSC_CheckDoorOriginal(house) == 0) {
mFRm_ERRORLINE(234);
return sSC_MYK_ERR_HOUSE;
}
if (sSC_CheckHouseInterior(house) == 0) {
mFRm_ERRORLINE(241);
return sSC_MYK_ERR_HOUSE;
}
}
return sSC_MYK_OK;
return sSC_MYK_OK;
}
static int sSC_CheckSaveData_Cattage() {
u8 floor = Save_Get(island).cottage.unused_wall_floor.flooring_idx;
u8 wall = Save_Get(island).cottage.unused_wall_floor.wallpaper_idx;
u8 floor = Save_Get(island).cottage.unused_wall_floor.flooring_idx;
u8 wall = Save_Get(island).cottage.unused_wall_floor.wallpaper_idx;
if (sSCCheckOneFloorData(&Save_Get(island).cottage.room) == 0) {
return sSC_MYK_ERR_CATTAGE;
}
else if (floor >= CARPET_NUM && (floor < 87 || floor > 94)) {
return sSC_MYK_ERR_CATTAGE;
}
else if (wall >= WALL_NUM && (wall < 72 || wall > 79)) {
return sSC_MYK_ERR_CATTAGE;
}
else {
return sSC_MYK_OK;
}
if (sSCCheckOneFloorData(&Save_Get(island).cottage.room) == 0) {
return sSC_MYK_ERR_CATTAGE;
} else if (floor >= CARPET_NUM && !FLOOR_IS_MY_ORIG(floor)) {
return sSC_MYK_ERR_CATTAGE;
} else if (wall >= WALL_NUM && !WALL_IS_MY_ORIG(wall)) {
return sSC_MYK_ERR_CATTAGE;
} else {
return sSC_MYK_OK;
}
}
static int sSC_CheckMuseumBitData(u8* bits, int max) {
int i;
int i;
for (i = 0; i < max; i++) {
int donator = mMmd_BIT_INFO2(bits, i);
if (donator < 0 || donator >= 6) {
mFRm_ERRORLINE(289);
return FALSE;
for (i = 0; i < max; i++) {
int donator = mMmd_BIT_INFO2(bits, i);
if (donator < 0 || donator >= 6) {
mFRm_ERRORLINE(289);
return FALSE;
}
}
}
return TRUE;
return TRUE;
}
static int sSC_CheckSaveData_MuseumDisplay() {
if (sSC_CheckMuseumBitData(Save_Get(museum_display).fossil_bit, mMmd_FOSSIL_NUM) == FALSE) {
mFRm_ERRORLINE(300);
return sSC_MYK_ERR_MUSEUMDISPLAY;
}
else if (sSC_CheckMuseumBitData(Save_Get(museum_display).art_bit, mMmd_ART_NUM) == FALSE) {
mFRm_ERRORLINE(305);
return sSC_MYK_ERR_MUSEUMDISPLAY;
}
else if (sSC_CheckMuseumBitData(Save_Get(museum_display).fish_bit, mMmd_INSECT_NUM) == FALSE) {
mFRm_ERRORLINE(310);
return sSC_MYK_ERR_MUSEUMDISPLAY;
}
else if (sSC_CheckMuseumBitData(Save_Get(museum_display).insect_bit, mMmd_FISH_NUM) == FALSE) {
mFRm_ERRORLINE(315);
return sSC_MYK_ERR_MUSEUMDISPLAY;
}
else {
return sSC_MYK_OK;
}
if (sSC_CheckMuseumBitData(Save_Get(museum_display).fossil_bit, mMmd_FOSSIL_NUM) == FALSE) {
mFRm_ERRORLINE(300);
return sSC_MYK_ERR_MUSEUMDISPLAY;
} else if (sSC_CheckMuseumBitData(Save_Get(museum_display).art_bit, mMmd_ART_NUM) == FALSE) {
mFRm_ERRORLINE(305);
return sSC_MYK_ERR_MUSEUMDISPLAY;
} else if (sSC_CheckMuseumBitData(Save_Get(museum_display).fish_bit, mMmd_INSECT_NUM) == FALSE) {
mFRm_ERRORLINE(310);
return sSC_MYK_ERR_MUSEUMDISPLAY;
} else if (sSC_CheckMuseumBitData(Save_Get(museum_display).insect_bit, mMmd_FISH_NUM) == FALSE) {
mFRm_ERRORLINE(315);
return sSC_MYK_ERR_MUSEUMDISPLAY;
} else {
return sSC_MYK_OK;
}
}
static int sSC_CheckOneOriginalData(mNW_original_design_c* original) {
if (original->palette >= mNW_PALETTE_NUM) {
mFRm_ERRORLINE(333);
return FALSE;
}
if (original->palette >= mNW_PALETTE_NUM) {
mFRm_ERRORLINE(333);
return FALSE;
}
return TRUE;
return TRUE;
}
static int sSC_CheckSaveData_Needlework() {
int j;
int i;
int j;
int i;
for (i = 0; i < PLAYER_NUM; i++) {
for (j = 0; j < mPr_ORIGINAL_DESIGN_COUNT; j++) {
if (sSC_CheckOneOriginalData(Save_Get(private + i)->my_org + j) == FALSE) {
mFRm_ERRORLINE(348);
return sSC_MYK_ERR_NEEDLEWORK;
}
for (i = 0; i < PLAYER_NUM; i++) {
for (j = 0; j < mPr_ORIGINAL_DESIGN_COUNT; j++) {
if (sSC_CheckOneOriginalData(Save_Get(private + i)->my_org + j) == FALSE) {
mFRm_ERRORLINE(348);
return sSC_MYK_ERR_NEEDLEWORK;
}
}
}
}
for (i = 0; i < mNW_TOTAL_DESIGN_NUM; i++) {
if (sSC_CheckOneOriginalData(Save_Get(needlework).original_design + i) == FALSE) {
mFRm_ERRORLINE(356);
return sSC_MYK_ERR_NEEDLEWORK;
for (i = 0; i < mNW_TOTAL_DESIGN_NUM; i++) {
if (sSC_CheckOneOriginalData(Save_Get(needlework).original_design + i) == FALSE) {
mFRm_ERRORLINE(356);
return sSC_MYK_ERR_NEEDLEWORK;
}
}
}
return sSC_MYK_OK;
return sSC_MYK_OK;
}
static int sSC_BlockInfo2Count(u32 block_kind) {
mFM_combo_info_c* combi_table = data_combi_table;
int bx;
int bz;
int count = 0;
mFM_combo_info_c* combi_table = data_combi_table;
int bx;
int bz;
int count = 0;
for (bz = 0; bz < BLOCK_Z_NUM; bz++) {
for (bx = 0; bx < BLOCK_X_NUM; bx++) {
int block_no = Save_Get(combi_table)[bz][bx].combination_type;
for (bz = 0; bz < BLOCK_Z_NUM; bz++) {
for (bx = 0; bx < BLOCK_X_NUM; bx++) {
int block_no = Save_Get(combi_table)[bz][bx].combination_type;
if (block_no < data_combi_table_number) {
u32 info = mRF_Type2BlockInfo(combi_table[block_no].type);
if (info & block_kind) {
count++;
if (block_no < data_combi_table_number) {
u32 info = mRF_Type2BlockInfo(combi_table[block_no].type);
if (info & block_kind) {
count++;
}
} else {
return -1;
}
}
}
else {
return -1;
}
}
}
return count;
return count;
}
static u32 sSC_map_perfect_table[16] = {
mRF_BLOCKKIND_PLAYER,
mRF_BLOCKKIND_SHOP,
mRF_BLOCKKIND_SHRINE,
mRF_BLOCKKIND_POLICE,
mRF_BLOCKKIND_POSTOFFICE,
mRF_BLOCKKIND_STATION,
mRF_BLOCKKIND_BRIDGE,
mRF_BLOCKKIND_SLOPE,
mRF_BLOCKKIND_POOL,
mRF_BLOCKKIND_DUMP,
mRF_BLOCKKIND_MUSEUM,
mRF_BLOCKKIND_TAILORS,
mRF_BLOCKKIND_OCEAN,
mRF_BLOCKKIND_ISLAND,
mRF_BLOCKKIND_DOCK,
mRF_BLOCKKIND_ISLAND_LEFT
};
static u32 sSC_map_perfect_table[16] = { mRF_BLOCKKIND_PLAYER, mRF_BLOCKKIND_SHOP, mRF_BLOCKKIND_SHRINE,
mRF_BLOCKKIND_POLICE, mRF_BLOCKKIND_POSTOFFICE, mRF_BLOCKKIND_STATION,
mRF_BLOCKKIND_BRIDGE, mRF_BLOCKKIND_SLOPE, mRF_BLOCKKIND_POOL,
mRF_BLOCKKIND_DUMP, mRF_BLOCKKIND_MUSEUM, mRF_BLOCKKIND_TAILORS,
mRF_BLOCKKIND_OCEAN, mRF_BLOCKKIND_ISLAND, mRF_BLOCKKIND_DOCK,
mRF_BLOCKKIND_ISLAND_LEFT };
static int sSC_CheckSaveData_Map() {
int i;
int i;
for (i = 0; i < 16; i++) {
if (sSC_BlockInfo2Count(sSC_map_perfect_table[i]) <= 0) {
mFRm_ERRORLINE(434);
return sSC_MYK_ERR_MAP;
for (i = 0; i < 16; i++) {
if (sSC_BlockInfo2Count(sSC_map_perfect_table[i]) <= 0) {
mFRm_ERRORLINE(434);
return sSC_MYK_ERR_MAP;
}
}
}
return sSC_MYK_OK;
return sSC_MYK_OK;
}
static int sChk_CheckSaveData_MYK() {
int res;
int res;
res = sSC_CheckSaveData_Weather();
res |= sSC_CheckSaveData_Shop();
res |= sSC_CheckSaveData_House();
res |= sSC_CheckSaveData_Cattage();
res |= sSC_CheckSaveData_MuseumDisplay();
res |= sSC_CheckSaveData_Needlework();
res |= sSC_CheckSaveData_Map();
res = sSC_CheckSaveData_Weather();
res |= sSC_CheckSaveData_Shop();
res |= sSC_CheckSaveData_House();
res |= sSC_CheckSaveData_Cattage();
res |= sSC_CheckSaveData_MuseumDisplay();
res |= sSC_CheckSaveData_Needlework();
res |= sSC_CheckSaveData_Map();
return res;
return res;
}
+244
View File
@@ -0,0 +1,244 @@
#include "jaudio_NES/game64.h"
#include "m_name_table.h"
// TODO: finish
#pragma force_active on
// clang-format off
static const u8 SEQ_TABLE[256] = {
247, 81, 82, 83,
84, 85, 86, 87,
88, 89, 90, 91,
92, 93, 94, 95,
96, 97, 98, 99,
100, 101, 102, 103,
104, 176, 178, 218,
219, 220, 222, 223,
224, 225, 226, 227,
229, 169, 170, 171,
68, 166, 60, 59,
168, 177, 74, 62,
63, 64, 65, 66,
67, 214, 215, 216,
217, 228, 57, 231,
221, 230, 167, 70,
71, 73, 75, 78,
79, 105, 58, 69,
72, 232, 233, 234,
235, 179, 76, 172,
173, 174, 175, 247,
247, 247, 247, 247,
180, 181, 182, 183,
184, 185, 186, 187,
188, 189, 190, 191,
192, 193, 194, 195,
196, 197, 198, 199,
200, 201, 202, 203,
204, 205, 206, 207,
208, 209, 210, 211,
212, 213, 77, 61,
77, 80, 247, 247,
111, 112, 113, 114,
115, 116, 117, 118,
119, 120, 121, 122,
123, 124, 125, 126,
127, 128, 129, 130,
131, 132, 133, 134,
135, 136, 137, 138,
139, 140, 141, 142,
143, 144, 145, 146,
147, 148, 149, 150,
151, 152, 153, 154,
155, 156, 157, 158,
159, 160, 161, 162,
163, 164, 165, 247,
247, 247, 247, 247,
247, 247, 247, 247,
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15,
16, 17, 18, 19,
20, 21, 22, 23,
24, 25, 26, 27,
28, 29, 30, 31,
32, 33, 34, 35,
36, 37, 38, 39,
40, 41, 42, 43,
44, 45, 46, 47,
48, 49, 50, 51,
52, 53, 54, 55,
56, 57, 236, 237,
241, 238, 240, 239
};
static const u16 SE_FLOOR_DATA[FLOOR_ALL_NUM] ATTRIBUTE_ALIGN(2) = {
27, 27, 32, 31,
28, 32, 31, 27,
27, 28, 29, 29,
27, 31, 28, 30,
33, 27, 30, 27,
32, 32, 31, 28,
32, 27, 35, 32,
32, 32, 27, 29,
31, 32, 28, 28,
28, 27, 28, 28,
27, 31, 36, 32,
28, 27, 33, 27,
35, 28, 32, 32,
28, 28, 32, 29,
28, 33, 27, 32,
33, 27, 32, 32,
28, 32, 32, 34,
32, 32, 27, 32,
28, 27, 29, 27,
28, 28, 27, 31,
28, 31, 28, 32,
28, 32, 32, 32,
32, 32, 32, 32,
32, 32, 32
};
// ATTRIBUTE_ALIGN(4)
static const u16 SE_ROOM_INS_DATA[] ATTRIBUTE_ALIGN(2) = {
0x505, 0x509, 0x50D, 0x511,
0x515, 0x519, 0x51D, 0x521,
0x525, 0x529, 0x501, 0x52D,
0x531, 0x535, 0x539, 0x53D,
0
};
static const u16 SE_ROOM_INS_RANDOM_OFFSET[] = {
11, 11, 11, 10,
10, 10, 12, 100,
20, 100, 45, 10,
4, 9, 2, 1,
0
};
static const u8 SHIIN2BOIN[] = {
0, 1, 2, 3,
4, 5, 1, 2,
3, 4, 5, 1,
2, 3, 4, 5,
1, 2, 3, 4,
5, 1, 2, 3,
4, 5, 1, 2,
3, 4, 5, 1,
2, 3, 4, 5,
1, 3, 5, 1,
2, 3, 4, 5,
1, 45, 1, 2,
3, 4, 5, 1,
2, 3, 4, 5,
1, 4, 5, 1,
2, 3, 4, 5,
1, 2, 3, 4,
5, 1, 2, 3,
4, 5, 3, 1,
3, 5, 0, 0,
0, 0, 0, 0,
0, 0
};
static const u8 TRGPRIO[] = {
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 50, 50, 50,
50, 60, 60, 60,
60, 60, 60, 60,
60, 70, 70, 70,
70, 70, 70, 70,
70, 70, 70, 70,
70, 70, 70, 70,
70, 70, 70, 70,
70, 70, 70, 70
};
static const u8 sou_trg_se_init[] ATTRIBUTE_ALIGN(4) = {
0, 0, 0, 0,
0, 0, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 0, 0, 0,
0, 0, 0, 0
};
static const u8 sou_voice_se_init[] ATTRIBUTE_ALIGN(4) = {
0, 0, 0, 0,
0, 0, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 128, 0, 0,
63, 0, 0, 0
};
static const u8 sou_lev_se_init[] ATTRIBUTE_ALIGN(4) = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
63, 128, 0, 0,
63, 0, 0, 0
};
static const u8 sou_lev_ongen_data_init[] ATTRIBUTE_ALIGN(4) = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
70, 28, 60, 0,
70, 28, 60, 0
};
static const u8 sou_ongen_entry_init[] ATTRIBUTE_ALIGN(4) = {
0, 0, 0, 0,
0, 0, 0, 0,
63, 0, 0, 0,
70, 28, 60, 0
};
static const u8 sou_se_fade_init[] ATTRIBUTE_ALIGN(4) = {
0, 0, 0, 0,
0, 0, 0, 0,
63, 128, 0, 0
};
// force data pooling
FORCESTRIP static int __REMOVE_TEMP() {
int a = SEQ_TABLE[55];
int b = SE_FLOOR_DATA[3];
int c = SE_ROOM_INS_DATA[6];
return a * b * c;
}
// clang-format on
#pragma force_active reset