diff --git a/src/code/z_actor.c b/src/code/z_actor.c index f0d43e6320..71e25d9530 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3561,7 +3561,12 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1 mtx->zw, 0, 0, objectSlot, type); if (spawnedEnPart != NULL) { +#if OOT_VERSION < PAL_1_0 + //! @bug Wrong rotation order compared to Actor_Draw + Matrix_MtxFToZYXRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0); +#else Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0); +#endif spawnedEnPart->displayList = bodyBreak->dLists[bodyBreak->count]; spawnedEnPart->actor.scale = actor->scale; } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 803cdeaeb7..fd0a83d984 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "versions.h" #include "z64frame_advance.h" @@ -1830,7 +1831,6 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC Vec3f hitPos; Vec3f atPos; Vec3f acPos; - f32 acToHit; atPos.x = atJntSphElem->dim.worldSphere.center.x; atPos.y = atJntSphElem->dim.worldSphere.center.y; @@ -1839,7 +1839,13 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC acPos.y = acCyl->dim.pos.y; acPos.z = acCyl->dim.pos.z; if (!IS_ZERO(centerDist)) { - acToHit = acCyl->dim.radius / centerDist; + f32 acToHit = acCyl->dim.radius / centerDist; + +#if OOT_VERSION < PAL_1_0 + hitPos.x = ((atPos.x - acPos.x) * acToHit) + acPos.x; + hitPos.y = ((atPos.y - acPos.y) * acToHit) + acPos.y; + hitPos.z = ((atPos.z - acPos.z) * acToHit) + acPos.z; +#else if (acToHit <= 1.0f) { hitPos.x = ((atPos.x - acPos.x) * acToHit) + acPos.x; hitPos.y = ((atPos.y - acPos.y) * acToHit) + acPos.y; @@ -1847,6 +1853,7 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC } else { Math_Vec3f_Copy(&hitPos, &atPos); } +#endif } else { Math_Vec3f_Copy(&hitPos, &atPos); } @@ -1891,7 +1898,13 @@ void CollisionCheck_ATCylVsACJntSph(PlayState* play, CollisionCheckContext* colC acPos.y = acJntSphElem->dim.worldSphere.center.y; acPos.z = acJntSphElem->dim.worldSphere.center.z; if (!IS_ZERO(centerDist)) { - acToHit = acJntSphElem->dim.worldSphere.radius / centerDist; + f32 acToHit = acJntSphElem->dim.worldSphere.radius / centerDist; + +#if OOT_VERSION < PAL_1_0 + hitPos.x = ((atPos.x - acPos.x) * acToHit) + acPos.x; + hitPos.y = ((atPos.y - acPos.y) * acToHit) + acPos.y; + hitPos.z = ((atPos.z - acPos.z) * acToHit) + acPos.z; +#else if (acToHit <= 1.0f) { hitPos.x = ((atPos.x - acPos.x) * acToHit) + acPos.x; hitPos.y = ((atPos.y - acPos.y) * acToHit) + acPos.y; @@ -1899,6 +1912,7 @@ void CollisionCheck_ATCylVsACJntSph(PlayState* play, CollisionCheckContext* colC } else { Math_Vec3f_Copy(&hitPos, &atPos); } +#endif } else { Math_Vec3f_Copy(&hitPos, &atPos); } diff --git a/src/code/z_construct.c b/src/code/z_construct.c index e190e19d20..0720bc8b9a 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -162,8 +162,13 @@ void Interface_Init(PlayState* play) { gSaveContext.timerY[timerId] = 46; // one row of hearts } } - - if ((gSaveContext.timerState >= TIMER_STATE_UP_INIT) && (gSaveContext.timerState <= TIMER_STATE_UP_FREEZE)) { +#if OOT_VERSION < PAL_1_0 + else if ((gSaveContext.timerState >= TIMER_STATE_UP_INIT) && (gSaveContext.timerState <= TIMER_STATE_UP_FREEZE)) +#else + // No "else" + if ((gSaveContext.timerState >= TIMER_STATE_UP_INIT) && (gSaveContext.timerState <= TIMER_STATE_UP_FREEZE)) +#endif + { gSaveContext.timerState = TIMER_STATE_OFF; PRINTF(T("タイマー停止!!!!!!!!!!!!!!!!!!!!! = %d\n", "Timer Stop!!!!!!!!!!!!!!!!!!!!! = %d\n"), @@ -381,6 +386,10 @@ void Regs_InitDataImpl(void) { ZREG(65) = 21; ZREG(66) = 122; +#if OOT_VERSION < PAL_1_0 + R_START_BTN_X = 132; + R_START_BTN_Y = 17; +#endif R_ITEM_BTN_X(1) = C_LEFT_BUTTON_X; R_ITEM_BTN_X(2) = C_DOWN_BUTTON_X; R_ITEM_BTN_X(3) = C_RIGHT_BUTTON_X; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index cae5718ca1..908e01d673 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -4,6 +4,7 @@ #include "global.h" #include "ultra64.h" #include "terminal.h" +#include "versions.h" #include "z64frame_advance.h" @@ -957,9 +958,15 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex } //! @bug `gTimeSpeed` is unsigned, it can't be negative +#if OOT_VERSION < PAL_1_0 + if ((((void)0, gSaveContext.save.dayTime) > ((void)0, gSaveContext.skyboxTime)) || + (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) +#else if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeSpeed != 0) && - ((void)0, gSaveContext.save.dayTime) > gSaveContext.skyboxTime) || - (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) { + ((void)0, gSaveContext.save.dayTime) > ((void)0, gSaveContext.skyboxTime)) || + (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) +#endif + { gSaveContext.skyboxTime = ((void)0, gSaveContext.save.dayTime); } @@ -1724,8 +1731,13 @@ void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx) Vec3f windDirection = { 0.0f, 0.0f, 0.0f }; Player* player = GET_PLAYER(play); +#if OOT_VERSION < PAL_1_0 + if (!(play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_CAMERA_IN_WATER)) +#else if (!(play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_CAMERA_IN_WATER) && - (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) { + (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) +#endif + { OPEN_DISPS(gfxCtx, "../z_kankyo.c", 2799); vec.x = view->at.x - view->eye.x; diff --git a/src/code/z_message.c b/src/code/z_message.c index 920fd9bad0..9094f2580a 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -2074,8 +2074,9 @@ void Message_Decode(PlayState* play) { decodedBufPos++; msgCtx->msgBufPos++; } - } else { + } else #endif + { // English text for NTSC, eng/ger/fra text for PAL while (true) { curChar = msgCtx->msgBufDecoded[decodedBufPos] = font->msgBuf[msgCtx->msgBufPos]; @@ -2397,8 +2398,15 @@ void Message_Decode(PlayState* play) { Message_LoadItemIcon(play, font->msgBuf[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curChar == MESSAGE_BACKGROUND) { msgCtx->textboxBackgroundIdx = font->msgBuf[msgCtx->msgBufPos + 1] * 2; +#if OOT_VERSION < PAL_1_0 + //! @bug Wrong shift amounts cause textboxBackgroundForeColorIdx and textboxBackgroundBackColorIdx + //! to always be 0. Fortunately MESSAGE_BACKGROUND is only present in unused messages. + msgCtx->textboxBackgroundForeColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF0) >> 12; + msgCtx->textboxBackgroundBackColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF) >> 8; +#else msgCtx->textboxBackgroundForeColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF0) >> 4; msgCtx->textboxBackgroundBackColorIdx = font->msgBuf[msgCtx->msgBufPos + 2] & 0xF; +#endif msgCtx->textboxBackgroundYOffsetIdx = (font->msgBuf[msgCtx->msgBufPos + 3] & 0xF0) >> 4; msgCtx->textboxBackgroundUnkArg = font->msgBuf[msgCtx->msgBufPos + 3] & 0xF; DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, @@ -2448,9 +2456,7 @@ void Message_Decode(PlayState* play) { decodedBufPos++; msgCtx->msgBufPos++; } -#if OOT_NTSC } -#endif } void Message_OpenText(PlayState* play, u16 textId) { @@ -3062,9 +3068,11 @@ void Message_DrawMain(PlayState* play, Gfx** p) { msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); if (msgCtx->ocarinaStaff->pos) { PRINTF("locate=%d onpu_pt=%d\n", msgCtx->ocarinaStaff->pos, sOcarinaButtonIndexBufPos); +#if OOT_VERSION >= PAL_1_0 if (msgCtx->ocarinaStaff->pos == 1 && sOcarinaButtonIndexBufPos == 8) { sOcarinaButtonIndexBufPos = 0; } +#endif if (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 17193eee96..2fd634e5eb 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -1,6 +1,7 @@ #include "global.h" #include "quake.h" #include "terminal.h" +#include "versions.h" #include "overlays/actors/ovl_En_Sw/z_en_sw.h" static s16 sDisableAttention = false; @@ -1858,7 +1859,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_RequestCameraSetting(play, subCamId, CAM_SET_CS_3); Player_SetCsActionWithHaltedActors(play, &player->actor, PLAYER_CSACTION_5); OnePointCutscene_SetCsCamPoints(subCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); +#if OOT_VERSION >= PAL_1_0 Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); +#endif OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_8012013C[D_801202FC - 2].pos); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_8012021C[D_801202FC - 2].pos); D_8012013C[D_801202FC - 3].pos.x += @@ -1874,10 +1877,22 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act D_8012021C[D_801202FC - 3].pos.z += (D_8012021C[D_801202FC - 2].pos.z - D_8012021C[D_801202FC - 3].pos.z) / 2; +#if OOT_VERSION < PAL_1_0 + i = Quake_Request(subCam, QUAKE_TYPE_1); + Quake_SetSpeed(i, 30000); + Quake_SetPerturbations(i, 3, 1, 1, 0); + Quake_SetDuration(i, D_80120300); + + i = Quake_Request(mainCam, QUAKE_TYPE_3); + Quake_SetSpeed(i, 30000); + Quake_SetPerturbations(i, 3, 1, 1, 0); + Quake_SetDuration(i, D_80120300 + 50); +#else i = Quake_Request(mainCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 30000); Quake_SetPerturbations(i, 2, 1, 1, 0); Quake_SetDuration(i, 200); +#endif break; } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index b1bbf7c8a3..c7289316cc 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1733,12 +1733,16 @@ u8 Item_Give(PlayState* play, u8 item) { Health_ChangeBy(play, 0x10); return item; } else if (item == ITEM_MAGIC_JAR_SMALL) { + // Magic_Fill is only used to store the magicState. + // Setting the state to FILL gets immediately overwritten in Magic_RequestChange. + // I.e. magic is added not filled. +#if OOT_VERSION < PAL_1_0 + Magic_Fill(play); +#else if (gSaveContext.magicState != MAGIC_STATE_ADD) { - // This function is only used to store the magicState. - // Setting the state to FILL gets immediately overwritten in Magic_RequestChange. - // I.e. magic is added not filled Magic_Fill(play); } +#endif Magic_RequestChange(play, 12, MAGIC_ADD); @@ -1749,12 +1753,16 @@ u8 Item_Give(PlayState* play, u8 item) { return item; } else if (item == ITEM_MAGIC_JAR_BIG) { + // Magic_Fill is only used to store the magicState. + // Setting the state to FILL gets immediately overwritten in Magic_RequestChange. + // I.e. magic is added not filled. +#if OOT_VERSION < PAL_1_0 + Magic_Fill(play); +#else if (gSaveContext.magicState != MAGIC_STATE_ADD) { - // This function is only used to store the magicState. - // Setting the state to FILL gets immediately overwritten in Magic_RequestChange. - // I.e. magic is added not filled. Magic_Fill(play); } +#endif Magic_RequestChange(play, 24, MAGIC_ADD); @@ -2110,12 +2118,19 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l action += DO_ACTION_MAX; } +#if OOT_VERSION >= PAL_1_0 if (gSaveContext.language == 2) { // LANGUAGE_FRA for PAL versions action += DO_ACTION_MAX; } +#endif +#if OOT_VERSION < PAL_1_0 + if ((action != DO_ACTION_NONE) && (action != DO_ACTION_MAX + DO_ACTION_NONE)) +#else if ((action != DO_ACTION_NONE) && (action != DO_ACTION_MAX + DO_ACTION_NONE) && - (action != 2 * DO_ACTION_MAX + DO_ACTION_NONE)) { + (action != 2 * DO_ACTION_MAX + DO_ACTION_NONE)) +#endif + { osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1); DMA_REQUEST_ASYNC(&interfaceCtx->dmaRequest_160, interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE), @@ -2174,9 +2189,11 @@ void Interface_LoadActionLabelB(PlayState* play, u16 action) { action += DO_ACTION_MAX; } +#if OOT_VERSION >= PAL_1_0 if (gSaveContext.language == 2) { // LANGUAGE_FRA for PAL versions action += DO_ACTION_MAX; } +#endif interfaceCtx->unk_1FC = action; @@ -2765,7 +2782,9 @@ void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) { void Interface_DrawItemButtons(PlayState* play) { static void* cUpLabelTextures[] = LANGUAGE_ARRAY(gNaviCUpJPNTex, gNaviCUpENGTex, gNaviCUpENGTex, gNaviCUpENGTex); +#if OOT_VERSION >= PAL_1_0 static s16 startButtonLeftPos[] = { 132, 130, 130 }; +#endif InterfaceContext* interfaceCtx = &play->interfaceCtx; Player* player = GET_PLAYER(play); PauseContext* pauseCtx = &play->pauseCtx; @@ -2817,13 +2836,17 @@ void Interface_DrawItemButtons(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, START_BUTTON_R, START_BUTTON_G, START_BUTTON_B, interfaceCtx->startAlpha); -#if OOT_NTSC - gSPTextureRectangle(OVERLAY_DISP++, 132 << 2, 17 << 2, (132 + 22) << 2, 39 << 2, G_TX_RENDERTILE, 0, 0, - (s32)(1.4277344 * (1 << 10)), (s32)(1.4277344 * (1 << 10))); +#if OOT_VERSION < PAL_1_0 + gSPTextureRectangle(OVERLAY_DISP++, R_START_BTN_X << 2, R_START_BTN_Y << 2, (R_START_BTN_X + 22) << 2, + (R_START_BTN_Y + 22) << 2, G_TX_RENDERTILE, 0, 0, (s32)(1.4277344 * (1 << 10)), + (s32)(1.4277344 * (1 << 10))); +#elif OOT_NTSC + gSPTextureRectangle(OVERLAY_DISP++, 132 << 2, 17 << 2, (132 + 22) << 2, (17 + 22) << 2, G_TX_RENDERTILE, 0, + 0, (s32)(1.4277344 * (1 << 10)), (s32)(1.4277344 * (1 << 10))); #else gSPTextureRectangle(OVERLAY_DISP++, startButtonLeftPos[gSaveContext.language] << 2, 17 << 2, - (startButtonLeftPos[gSaveContext.language] + 22) << 2, 39 << 2, G_TX_RENDERTILE, 0, 0, - (s32)(1.4277344 * (1 << 10)), (s32)(1.4277344 * (1 << 10))); + (startButtonLeftPos[gSaveContext.language] + 22) << 2, (17 + 22) << 2, G_TX_RENDERTILE, + 0, 0, (s32)(1.4277344 * (1 << 10)), (s32)(1.4277344 * (1 << 10))); #endif gDPPipeSync(OVERLAY_DISP++); @@ -3519,10 +3542,12 @@ void Interface_Draw(PlayState* play) { // Revert any spoiling trade quest items for (svar1 = 0; svar1 < ARRAY_COUNT(gSpoilingItems); svar1++) { if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[svar1]) { +#if OOT_VERSION >= NTSC_1_1 gSaveContext.eventInf[EVENTINF_HORSES_INDEX] &= (u16) ~(EVENTINF_HORSES_STATE_MASK | EVENTINF_HORSES_HORSETYPE_MASK | EVENTINF_HORSES_05_MASK | EVENTINF_HORSES_06_MASK | EVENTINF_HORSES_0F_MASK); PRINTF("EVENT_INF=%x\n", gSaveContext.eventInf[EVENTINF_HORSES_INDEX]); +#endif play->nextEntranceIndex = spoilingItemEntrances[svar1]; INV_CONTENT(gSpoilingItemReverts[svar1]) = gSpoilingItemReverts[svar1]; @@ -3822,7 +3847,12 @@ void Interface_Draw(PlayState* play) { gSaveContext.subTimerSeconds--; PRINTF("TOTAL_EVENT_TM=%d\n", gSaveContext.subTimerSeconds); - if (gSaveContext.subTimerSeconds <= 0) { +#if OOT_VERSION < PAL_1_0 + if (gSaveContext.subTimerSeconds == 0) +#else + if (gSaveContext.subTimerSeconds <= 0) +#endif + { // Out of time if (!Flags_GetSwitch(play, 0x37) || ((play->sceneId != SCENE_GANON_BOSS) && @@ -4362,9 +4392,11 @@ void Interface_Update(PlayState* play) { play->nextEntranceIndex = gSaveContext.save.entranceIndex; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; +#if OOT_VERSION >= PAL_1_0 func_800F6964(30); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; +#endif } else { gSaveContext.sunsSongState = SUNSSONG_SPECIAL; } diff --git a/src/code/z_room.c b/src/code/z_room.c index a9fa462fda..6ac20bbd9a 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,6 +1,7 @@ #include "global.h" #include "fault.h" #include "terminal.h" +#include "versions.h" #if PLATFORM_N64 #include "n64dd.h" #endif @@ -350,6 +351,14 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei *gfxP = gfx; } +#if OOT_VERSION < PAL_1_0 +void func_8007FF50(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode, + u16 tlutCount) { + if (1) {} + Room_DrawBackground2D(gfxP, tex, tlut, width, height, fmt, siz, tlutMode, tlutCount, 0.0f, 0.0f); +} +#endif + #define ROOM_IMAGE_NODRAW_BACKGROUND (1 << 0) #define ROOM_IMAGE_NODRAW_OPA (1 << 1) #define ROOM_IMAGE_NODRAW_XLU (1 << 2) @@ -389,6 +398,9 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) { gfx = POLY_OPA_DISP; +#if OOT_VERSION < PAL_1_0 + if (1) +#endif { Vec3f quakeOffset; @@ -494,6 +506,9 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) { gfx = POLY_OPA_DISP; +#if OOT_VERSION < PAL_1_0 + if (1) +#endif { Vec3f quakeOffset; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 44ad2f9bba..9b04bccec8 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "versions.h" RomFile sNaviQuestHintFiles[]; @@ -382,12 +383,21 @@ BAD_RETURN(s32) Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) || (gSaveContext.save.entranceIndex == ENTR_LAKE_HYLIA_8)) { +#if OOT_VERSION >= PAL_1_0 gSaveContext.skyboxTime = ((void)0, gSaveContext.save.dayTime); +#endif +#if OOT_VERSION < PAL_1_0 + if ((gSaveContext.skyboxTime > CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime <= CLOCK_TIME(5, 0))) { + gSaveContext.skyboxTime = CLOCK_TIME(5, 0) + 1; + } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(6, 0)) && (gSaveContext.skyboxTime <= CLOCK_TIME(8, 0))) { + gSaveContext.skyboxTime = CLOCK_TIME(8, 0) + 1; +#else if ((gSaveContext.skyboxTime > CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) { gSaveContext.skyboxTime = CLOCK_TIME(5, 0) + 1; } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(6, 30)) && (gSaveContext.skyboxTime <= CLOCK_TIME(8, 0))) { gSaveContext.skyboxTime = CLOCK_TIME(8, 0) + 1; +#endif } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(16, 0)) && (gSaveContext.skyboxTime <= CLOCK_TIME(17, 0))) { gSaveContext.skyboxTime = CLOCK_TIME(17, 0) + 1; } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(18, 0) + 1) && diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 9da2f405fb..3a5060abff 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -169,6 +169,18 @@ void Sram_InitNewSave(void) { static SavePlayerData sDebugSavePlayerData = { { 'Z', 'E', 'L', 'D', 'A', 'Z' }, // newf 0, // deaths +#if OOT_VERSION < PAL_1_0 + { + 0x81, // リ + 0x87, // ン + 0x61, // ク + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + }, // playerName +#else { FILENAME_UPPERCASE('L'), FILENAME_UPPERCASE('I'), @@ -178,7 +190,8 @@ static SavePlayerData sDebugSavePlayerData = { FILENAME_SPACE, FILENAME_SPACE, FILENAME_SPACE, - }, // playerName + }, // playerName +#endif 0, // n64ddFlag 0xE0, // healthCapacity 0xE0, // health @@ -499,9 +512,11 @@ void Sram_OpenSave(SramContext* sramCtx) { if (LINK_AGE_IN_YEARS == YEARS_ADULT && !CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)) { gSaveContext.save.info.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER); +#if OOT_VERSION >= NTSC_1_1 gSaveContext.save.info.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.save.info.equips.equipment &= ~(0xF << (EQUIP_TYPE_SWORD * 4)); gSaveContext.save.info.equips.equipment |= EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4); +#endif } for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) { @@ -604,6 +619,13 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt PRINTF("\n============= S(%d) =============\n", slotNum); for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++, offset += 2) { +#if OOT_VERSION < PAL_1_0 + if (j) {} + j += 2; + if (j == 0x20) { + j = 0; + } +#endif newChecksum += *ptr++; } @@ -622,6 +644,13 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt PRINTF("================= BACK─UP ========================\n"); for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++, offset += 2) { +#if OOT_VERSION < PAL_1_0 + if (j) {} + j += 2; + if (j == 0x20) { + j = 0; + } +#endif newChecksum += *ptr++; } PRINTF(T("\n(B)SAVEチェックサム計算 j=%x mmm=%x ",