1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-12 19:04:38 +00:00

[ntsc-1.0/1.1] Match "game engine" files (#2244)

* [ntsc-1.0/1.1] Match "game engine" files

* Use R_START_BTN_X/R_START_BTN_Y

* Comment obvious bugs

* Move Magic_Fill comments

* Move EVENTINF_HORSES_INDEX printf inside #if

* Replace "this function"
This commit is contained in:
cadmic 2024-09-30 12:52:38 -07:00 committed by GitHub
parent 80ed596c56
commit bdc11c2894
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 174 additions and 25 deletions

View file

@ -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;
}