Merge changes from develop-zhora

This commit is contained in:
Christopher Leggett 2022-08-02 19:17:08 -04:00
commit a007bfd14a
No known key found for this signature in database
GPG key ID: 7093AE5FF7037D79
86 changed files with 2252 additions and 892 deletions

View file

@ -544,10 +544,10 @@ u8 gDefaultShortNoteGateTimeTable[] = {
};
AdsrEnvelope gDefaultEnvelope[] = {
{ 0x0100, 0x007D },
{ 0xE803, 0x007D },
{ 0xFFFF, 0x0000 },
{ 0x0000, 0x0000 },
{ BE16SWAP_CONST(1), BE16SWAP_CONST(32000) },
{ BE16SWAP_CONST(1000), BE16SWAP_CONST(32000) },
{ BE16SWAP_CONST(-1), BE16SWAP_CONST(0) },
{ BE16SWAP_CONST(0), BE16SWAP_CONST(0) },
};
NoteSubEu gZeroNoteSub = { 0 };

View file

@ -246,7 +246,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
retry:
case ADSR_STATE_LOOP:
adsr->delay = (s16)BOMSWAP16(adsr->envelope[adsr->envIndex].delay);
adsr->delay = (s16)BE16SWAP(adsr->envelope[adsr->envIndex].delay);
switch (adsr->delay) {
case ADSR_DISABLE:
adsr->action.s.state = ADSR_STATE_DISABLED;
@ -255,7 +255,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
adsr->action.s.state = ADSR_STATE_HANG;
break;
case ADSR_GOTO:
adsr->envIndex = (s16)BOMSWAP16(adsr->envelope[adsr->envIndex].arg);
adsr->envIndex = (s16)BE16SWAP(adsr->envelope[adsr->envIndex].arg);
goto retry;
case ADSR_RESTART:
adsr->action.s.state = ADSR_STATE_INITIAL;
@ -266,7 +266,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
if (adsr->delay == 0) {
adsr->delay = 1;
}
adsr->target = (s16)BOMSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
adsr->target = (s16)BE16SWAP(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
adsr->target = adsr->target * adsr->target;
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
adsr->action.s.state = ADSR_STATE_FADE;

View file

@ -1340,13 +1340,13 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
break;
case 0xB2:
offset = (u16)parameters[0];
channel->unk_22 = BOMSWAP16(*(u16*)(seqPlayer->seqData + (uintptr_t)(offset + scriptState->value * 2)));
channel->unk_22 = BE16SWAP(*(u16*)(seqPlayer->seqData + (uintptr_t)(offset + scriptState->value * 2)));
break;
case 0xB4:
channel->dynTable = (void*)&seqPlayer->seqData[channel->unk_22];
break;
case 0xB5:
channel->unk_22 = BOMSWAP16(((u16*)(channel->dynTable))[scriptState->value]);
channel->unk_22 = BE16SWAP(((u16*)(channel->dynTable))[scriptState->value]);
break;
case 0xB6:
scriptState->value = (*channel->dynTable)[0][scriptState->value];

View file

@ -355,36 +355,20 @@ void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, Gl
}
} else {
if (actorCategory == ACTORCAT_PLAYER) {
naviColor->inner.r = CVar_GetS32("gNavi_Idle_Inner_R", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_Idle_Inner_G", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_Idle_Inner_B", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_Idle_Outer_R", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_Idle_Outer_G", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_Idle_Outer_B", naviColor->outer.b);
naviColor->inner = CVar_GetRGBA("gNavi_Idle_Inner", naviColor->inner);
naviColor->outer = CVar_GetRGBA("gNavi_Idle_Outer", naviColor->outer);
}
if (actorCategory == ACTORCAT_NPC) {
naviColor->inner.r = CVar_GetS32("gNavi_NPC_Inner_R", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_NPC_Inner_G", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_NPC_Inner_B", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_NPC_Outer_R", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_NPC_Outer_G", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_NPC_Outer_B", naviColor->outer.b);
naviColor->inner = CVar_GetRGBA("gNavi_NPC_Inner", naviColor->inner);
naviColor->outer = CVar_GetRGBA("gNavi_NPC_Outer", naviColor->outer);
}
if (actorCategory == ACTORCAT_BOSS || actorCategory == ACTORCAT_ENEMY) {
naviColor->inner.r = CVar_GetS32("gNavi_Enemy_Inner_R", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_Enemy_Inner_G", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_Enemy_Inner_B", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_Enemy_Outer_R", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_Enemy_Outer_G", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_Enemy_Outer_B", naviColor->outer.b);
naviColor->inner = CVar_GetRGBA("gNavi_Enemy_Inner", naviColor->inner);
naviColor->outer = CVar_GetRGBA("gNavi_Enemy_Outer", naviColor->outer);
}
if (actorCategory == ACTORCAT_PROP) {
naviColor->inner.r = CVar_GetS32("gNavi_Prop_Inner_R", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_Prop_Inner_G", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_Prop_Inner_B", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_Prop_Outer_R", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_Prop_Outer_G", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_Prop_Outer_B", naviColor->outer.b);
naviColor->inner = CVar_GetRGBA("gNavi_Prop_Inner", naviColor->inner);
naviColor->outer = CVar_GetRGBA("gNavi_Prop_Outer", naviColor->outer);
}
}

View file

@ -8,7 +8,7 @@ void SaveContext_Init(void) {
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.nextCutsceneIndex = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.nextDayTime = 0xFFFF;

View file

@ -8,7 +8,6 @@ void func_80110990(GlobalContext* globalCtx) {
void func_801109B0(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
u32 parameterSize;
u16 doActionOffset;
u8 temp;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
@ -49,30 +48,11 @@ void func_801109B0(GlobalContext* globalCtx) {
ASSERT(interfaceCtx->doActionSegment != NULL);
if (gSaveContext.language == LANGUAGE_ENG) {
doActionOffset = 0;
} else if (gSaveContext.language == LANGUAGE_GER) {
doActionOffset = 0x2B80;
} else {
doActionOffset = 0x5700;
}
uint32_t attackDoActionTexSize = ResourceMgr_LoadTexSizeByName(gAttackDoActionENGTex);
memcpy(interfaceCtx->doActionSegment, ResourceMgr_LoadTexByName(gAttackDoActionENGTex), attackDoActionTexSize);
memcpy(interfaceCtx->doActionSegment + (attackDoActionTexSize / 2), ResourceMgr_LoadTexByName(gCheckDoActionENGTex), attackDoActionTexSize);
memcpy(interfaceCtx->doActionSegment, ResourceMgr_LoadTexByName(gAttackDoActionENGTex), 0x180);
memcpy(interfaceCtx->doActionSegment + 0x180, ResourceMgr_LoadTexByName(gCheckDoActionENGTex), 0x180);
//DmaMgr_SendRequest1(interfaceCtx->doActionSegment, (uintptr_t)_do_action_staticSegmentRomStart + doActionOffset, 0x300,
//__FILE__, __LINE__);
if (gSaveContext.language == LANGUAGE_ENG) {
doActionOffset = 0x480;
} else if (gSaveContext.language == LANGUAGE_GER) {
doActionOffset = 0x3000;
} else {
doActionOffset = 0x5B80;
}
memcpy(interfaceCtx->doActionSegment + 0x300, ResourceMgr_LoadTexByName(gReturnDoActionENGTex), 0x180);
//DmaMgr_SendRequest1(interfaceCtx->doActionSegment + 0x300, (uintptr_t)_do_action_staticSegmentRomStart + doActionOffset,
//0x180);
memcpy(interfaceCtx->doActionSegment + attackDoActionTexSize, ResourceMgr_LoadTexByName(gReturnDoActionENGTex), ResourceMgr_LoadTexSizeByName(gReturnDoActionENGTex));
interfaceCtx->iconItemSegment = GAMESTATE_ALLOC_MC(
&globalCtx->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems));

View file

@ -493,7 +493,8 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
// Automatically skip certain cutscenes when in rando
// cmd->base == 33: Zelda escaping with impa cutscene
bool randoCsSkip = (gSaveContext.n64ddFlag && cmd->base == 33);
// cmd->base == 8: Traveling back/forward in time cutscene
bool randoCsSkip = (gSaveContext.n64ddFlag && (cmd->base == 33 || cmd->base == 8));
bool debugCsSkip = (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) &&
(gSaveContext.fileNum != 0xFEDC) && CVar_GetS32("gDebugEnabled", 0));

View file

@ -184,16 +184,6 @@ static u16 sDgnMinimapTexIndexOffset[10] = {
0, 13, 32, 49, 76, 114, 158, 190, 217, 227,
};
static u16 sOwMinimapTexSize[24] = {
2920, 2560, 1560, 2784, 2976, 2040, 3240, 2336, 2080, 2600, 1792, 1888,
3400, 1792, 1888, 2040, 3120, 2304, 2176, 1888, 1560, 3240, 2600, 3400,
};
static u16 sOwMinimapTexOffset[24] = {
0x0000, 0x0B68, 0x1568, 0x1B80, 0x2660, 0x3200, 0x39F8, 0x46A0, 0x4FC0, 0x57E0, 0x6208, 0x6908,
0x7068, 0x7DB0, 0x84B0, 0x8C10, 0x9408, 0xA038, 0xA938, 0xB1B8, 0xB918, 0xBF30, 0xCBD8, 0xD600,
};
static s16 sOwMinimapPosX[24] = {
216, 216, 218, 202, 202, 250, 216, 234, 234, 216, 234, 234,
216, 234, 234, 250, 216, 234, 234, 234, 218, 80, 80, 216,
@ -319,14 +309,13 @@ static u8 sFloorID[10][8] = {
static s16 sSkullFloorIconY[10] = { -47, -47, -33, -47, -47, -5, -19, -47, -99, -99 };
MapData gMapDataTable = {
sFloorTexIndexOffset, sBossFloor, sRoomPalette,
sMaxPaletteCount, sPaletteRoom, sRoomCompassOffsetX,
sRoomCompassOffsetY, sDgnMinimapCount, sDgnMinimapTexIndexOffset,
sOwMinimapTexSize, sOwMinimapTexOffset, sOwMinimapPosX,
sOwMinimapPosY, sOwCompassInfo, sDgnMinimapTexIndexBase,
sDgnCompassInfo, sOwMinimapWidth, sOwMinimapHeight,
sOwEntranceIconPosX, sOwEntranceIconPosY, sOwEntranceFlag,
sFloorCoordY, sSwitchEntryCount, sSwitchFromRoom,
sSwitchFromFloor, sSwitchToRoom, sFloorID,
sSkullFloorIconY,
sFloorTexIndexOffset, sBossFloor, sRoomPalette,
sMaxPaletteCount, sPaletteRoom, sRoomCompassOffsetX,
sRoomCompassOffsetY, sDgnMinimapCount, sDgnMinimapTexIndexOffset,
sOwMinimapPosX, sOwMinimapPosY, sOwCompassInfo,
sDgnMinimapTexIndexBase, sDgnCompassInfo, sOwMinimapWidth,
sOwMinimapHeight, sOwEntranceIconPosX, sOwEntranceIconPosY,
sOwEntranceFlag, sFloorCoordY, sSwitchEntryCount,
sSwitchFromRoom, sSwitchFromFloor, sSwitchToRoom,
sFloorID, sSkullFloorIconY,
};

View file

@ -412,8 +412,10 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
//(uintptr_t)_map_grand_staticSegmentRomStart + gMapData->owMinimapTexOffset[extendedMapIndex],
//gMapData->owMinimapTexSize[mapIndex], __FILE__, __LINE__);
if (sEntranceIconMapIndex < 24)
memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(minimapTableOW[sEntranceIconMapIndex]), gMapData->owMinimapTexSize[mapIndex]);
if (sEntranceIconMapIndex < 24) {
const char* textureName = minimapTableOW[sEntranceIconMapIndex];
memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
}
interfaceCtx->unk_258 = mapIndex;
break;
@ -445,7 +447,8 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
//((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0),
//0xFF0, __FILE__, __LINE__);
memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room]), 0xFF0);
const char* textureName = minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room];
memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room];
R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room];

View file

@ -1196,7 +1196,7 @@ void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) {
R_TEXTBOX_ICON_YPOS = y + 6;
R_TEXTBOX_ICON_SIZE = 32;
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
ResourceMgr_LoadTexByName(gItemIcons[itemId]), 0x1000);
ResourceMgr_LoadTexByName(gItemIcons[itemId]), ResourceMgr_LoadTexSizeByName(gItemIcons[itemId]));
// "Item 32-0"
osSyncPrintf("アイテム32-0\n");
} else {
@ -1204,7 +1204,7 @@ void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) {
R_TEXTBOX_ICON_YPOS = y + 10;
R_TEXTBOX_ICON_SIZE = 24;
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
ResourceMgr_LoadTexByName(gItemIcons[itemId]), 0x900);
ResourceMgr_LoadTexByName(gItemIcons[itemId]), ResourceMgr_LoadTexSizeByName(gItemIcons[itemId]));
// "Item 24"
osSyncPrintf("アイテム24%d (%d) {%d}\n", itemId, itemId - ITEM_KOKIRI_EMERALD, 84);
}
@ -1565,9 +1565,9 @@ void Message_Decode(GlobalContext* globalCtx) {
msgCtx->textboxBackgroundUnkArg = font->msgBuf[msgCtx->msgBufPos + 3] & 0xF;
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
ResourceMgr_LoadTexByName(gRedMessageXLeftTex), 0x900);
ResourceMgr_LoadTexByName(gRedMessageXLeftTex), ResourceMgr_LoadTexSizeByName(gRedMessageXLeftTex));
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900,
ResourceMgr_LoadTexByName(gRedMessageXRightTex), 0x900);
ResourceMgr_LoadTexByName(gRedMessageXRightTex), ResourceMgr_LoadTexSizeByName(gRedMessageXRightTex));
msgCtx->msgBufPos += 3;
R_TEXTBOX_BG_YPOS = R_TEXTBOX_Y + 8;
@ -1688,7 +1688,8 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
// "Text Box Type"
osSyncPrintf("吹き出し種類=%d\n", msgCtx->textBoxType);
if (textBoxType < TEXTBOX_TYPE_NONE_BOTTOM) {
memcpy(msgCtx->textboxSegment, ResourceMgr_LoadTexByName(msgStaticTbl[messageStaticIndices[textBoxType]]), MESSAGE_STATIC_TEX_SIZE);
const char* textureName = msgStaticTbl[messageStaticIndices[textBoxType]];
memcpy(msgCtx->textboxSegment, ResourceMgr_LoadTexByName(textureName), MESSAGE_STATIC_TEX_SIZE);
if (textBoxType == TEXTBOX_TYPE_BLACK) {
msgCtx->textboxColorRed = 0;
msgCtx->textboxColorGreen = 0;

View file

@ -1041,18 +1041,37 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
break;
case 4020:
if (CVar_GetS32("gFasterHeavyBlockLift", 0)) {
D_8012368C[0].timerInit *= (1.0f / 3.0f);
D_8012368C[1].timerInit *= (1.0f / 3.0f);
D_8012368C[2].timerInit *= (1.0f / 3.0f);
D_8012368C[3].timerInit *= (1.0f / 3.0f);
}
csInfo->keyFrames = D_8012368C;
csInfo->keyFrameCnt = 4;
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
break;
case 4021:
if (CVar_GetS32("gFasterHeavyBlockLift", 0)) {
D_8012372C[0].timerInit *= (1.0f / 3.0f);
D_8012372C[1].timerInit *= (1.0f / 3.0f);
D_8012372C[2].timerInit *= (1.0f / 3.0f);
D_8012372C[3].timerInit *= (1.0f / 3.0f);
}
csInfo->keyFrames = D_8012372C;
csInfo->keyFrameCnt = 4;
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
break;
case 4022:
if (CVar_GetS32("gFasterHeavyBlockLift", 0)) {
D_801237CC[0].timerInit *= (1.0f / 3.0f);
D_801237CC[1].timerInit *= (1.0f / 3.0f);
D_801237CC[2].timerInit *= (1.0f / 3.0f);
D_801237CC[3].timerInit *= (1.0f / 3.0f);
D_801237CC[4].timerInit *= (1.0f / 3.0f);
}
csCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit +
D_801237CC[2].timerInit + D_801237CC[4].timerInit;

View file

@ -624,21 +624,21 @@ static OnePointCsFull D_801235C4[5] = {
{ 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
};
static OnePointCsFull D_8012368C[4] = {
OnePointCsFull D_8012368C[4] = {
{ 0x0F, 0xFF, 0x0101, 10, 0, 60.0f, 1.0f, { -1110.0f, -180.0f, -840.0f }, { -985.0f, -220.0f, -840.0f } },
{ 0x02, 0xFF, 0x0101, 70, -45, 75.0f, 1.0f, { -1060.0f, -160.0f, -840.0f }, { -1005.0f, -230.0f, -840.0f } },
{ 0x0F, 0xFF, 0x0000, 10, -45, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
{ 0x0F, 0xFF, 0x0101, 180, 9, 80.0f, 1.0f, { -1205.0f, -175.0f, -840.0f }, { -1305.0f, -230.0f, -828.0f } },
};
static OnePointCsFull D_8012372C[4] = {
OnePointCsFull D_8012372C[4] = {
{ 0x0F, 0xFF, 0x0142, 10, 0, 70.0f, 1.0f, { 0.0f, 80.0f, 0.0f }, { -1650.0f, 200.0f, -2920.0f } },
{ 0x02, 0xFF, 0x0142, 110, -2, 50.0f, 0.5f, { 0.0f, 150.0f, 0.0f }, { -1320.0f, 170.0f, -2900.0f } },
{ 0x0B, 0xFF, 0x4242, 100, 2, 70.0f, 0.1f, { 0.0f, 150.0f, 50.0f }, { -1.0f, -1.0f, -1.0f } },
{ 0x03, 0xFF, 0x4242, 60, 2, 45.0f, 0.01f, { 0.0f, 150.0f, 50.0f }, { 0.0f, 200.0f, -80.0f } },
};
static OnePointCsFull D_801237CC[5] = {
OnePointCsFull D_801237CC[5] = {
{ 0x8F, 0xFF, 0x4242, 20, 0, 50.0f, 1.0f, { 0.0f, 50.0f, -10.0f }, { 0.0f, 0.0f, 100.0f } },
{ 0x0A, 0xFF, 0x0101, 80, 0, 75.0f, 1.0f, { 2900.0f, 1300.0f, 530.0f }, { 2800.0f, 1190.0f, 540.0f } },
{ 0x0F, 0xFF, 0x0000, 10, 0, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },

View file

@ -10,10 +10,31 @@
#include <assert.h>
#endif
// TODO extract this information from the texture definitions themselves
#define DO_ACTION_TEX_WIDTH 48
#define DO_ACTION_TEX_HEIGHT 16
#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex))
static uint16_t _doActionTexWidth, _doActionTexHeight = -1;
static uint16_t DO_ACTION_TEX_WIDTH() {
return 48;
// TODO: Figure out why Ship::Texture is not returning a valid width
if (_doActionTexWidth == -1)
_doActionTexWidth = ResourceMgr_LoadTexWidthByName(gCheckDoActionENGTex);
return _doActionTexWidth;
}
static uint16_t DO_ACTION_TEX_HEIGHT() {
return 16;
// TODO: Figure out why Ship::Texture is not returning a valid height
if (_doActionTexHeight == -1)
_doActionTexHeight = ResourceMgr_LoadTexHeightByName(gCheckDoActionENGTex);
return _doActionTexHeight;
}
static uint32_t _doActionTexSize = -1;
static uint32_t DO_ACTION_TEX_SIZE() {
if (_doActionTexSize == -1)
_doActionTexSize = ResourceMgr_LoadTexSizeByName(gCheckDoActionENGTex);
return _doActionTexSize;
}
// The button statuses include the A button when most things are only the equip item buttons
// So, when indexing into it with a item button index, we need to adjust
@ -2457,8 +2478,8 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l
if (action != DO_ACTION_NONE) {
//osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
memcpy(interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE), ResourceMgr_LoadTexByName(doAction),
DO_ACTION_TEX_SIZE);
memcpy(interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE()), ResourceMgr_LoadTexByName(doAction),
DO_ACTION_TEX_SIZE());
//DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160,
//interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE),
//(uintptr_t)_do_action_staticSegmentRomStart + (action * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE,
@ -2467,7 +2488,7 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l
} else {
gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->doActionSegment);
//func_80086D5C(SEGMENTED_TO_VIRTUAL(sDoActionTextures[loadOffset]), DO_ACTION_TEX_SIZE / 4);
func_80086D5C(interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE / 4);
func_80086D5C(interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE()), DO_ACTION_TEX_SIZE() / 4);
}
}
@ -2545,7 +2566,7 @@ void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) {
// OTRTODO
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE);
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE(), ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE());
//DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE,
//(uintptr_t)_do_action_staticSegmentRomStart + (action * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE, 0,
//&interfaceCtx->loadQueue, NULL, __FILE__, __LINE__);
@ -3181,7 +3202,7 @@ void func_80088B34(s16 arg0) {
void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) {
OPEN_DISPS(gfxCtx);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, texture, G_IM_FMT_IA, DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0,
gDPLoadTextureBlock_4b(OVERLAY_DISP++, texture, G_IM_FMT_IA, DO_ACTION_TEX_WIDTH(), DO_ACTION_TEX_HEIGHT(), 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);
@ -3254,8 +3275,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
const s16 rStartLabelY_ori = R_START_LABEL_Y(gSaveContext.language)+Y_Margins_StartBtn;
const s16 PosX_StartBtn_ori = OTRGetRectDimensionFromRightEdge(startButtonLeftPos[gSaveContext.language]+X_Margins_StartBtn);
const s16 PosY_StartBtn_ori = 16+Y_Margins_StartBtn;
s16 StartBTN_Label_W = DO_ACTION_TEX_WIDTH;
s16 StartBTN_Label_H = DO_ACTION_TEX_HEIGHT;
s16 StartBTN_Label_W = DO_ACTION_TEX_WIDTH();
s16 StartBTN_Label_H = DO_ACTION_TEX_HEIGHT();
int StartBTN_Label_H_Scaled = StartBTN_Label_H * 1.0f;
int StartBTN_Label_W_Scaled = StartBTN_Label_W * 1.0f;
int StartBTN_Label_W_factor = (1 << 10) * StartBTN_Label_W / StartBTN_Label_W_Scaled;
@ -3511,10 +3532,11 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
doAction = newName;
}
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA,
DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP,
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE() * 2, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE());
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE() * 2, G_IM_FMT_IA,
DO_ACTION_TEX_WIDTH(), DO_ACTION_TEX_HEIGHT(), 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);
//const s16 rStartLabelX = OTRGetRectDimensionFromRightEdge(R_START_LABEL_X(gSaveContext.language)+Right_HUD_Margin);
@ -4330,7 +4352,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
// Invalidate Do Action textures as they may have changed
gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->doActionSegment);
gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE);
gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE());
gSPSegment(OVERLAY_DISP++, 0x02, interfaceCtx->parameterSegment);
gSPSegment(OVERLAY_DISP++, 0x07, interfaceCtx->doActionSegment);
@ -4630,14 +4652,14 @@ void Interface_Draw(GlobalContext* globalCtx) {
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE, G_IM_FMT_IA,
DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP,
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE(), G_IM_FMT_IA,
DO_ACTION_TEX_WIDTH(), DO_ACTION_TEX_HEIGHT(), 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);
R_B_LABEL_DD = (1 << 10) / (WREG(37 + gSaveContext.language) / 100.0f);
gSPWideTextureRectangle(OVERLAY_DISP++, BbtnPosX << 2, BbtnPosY << 2,
(BbtnPosX + DO_ACTION_TEX_WIDTH) << 2,
(BbtnPosY + DO_ACTION_TEX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0,
(BbtnPosX + DO_ACTION_TEX_WIDTH()) << 2,
(BbtnPosY + DO_ACTION_TEX_HEIGHT()) << 2, G_TX_RENDERTILE, 0, 0,
R_B_LABEL_DD, R_B_LABEL_DD);
}
@ -4723,12 +4745,14 @@ void Interface_Draw(GlobalContext* globalCtx) {
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, dpadAlpha);
}
gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"),
G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 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);
gSPWideTextureRectangle(OVERLAY_DISP++, DpadPosX << 2, DpadPosY << 2,
(DpadPosX + 32) << 2, (DpadPosY + 32) << 2,
G_TX_RENDERTILE, 0, 0, (1 << 10), (1 << 10));
if (fullUi) {
gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"),
G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 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);
gSPWideTextureRectangle(OVERLAY_DISP++, DpadPosX << 2, DpadPosY << 2,
(DpadPosX + 32) << 2, (DpadPosY + 32) << 2,
G_TX_RENDERTILE, 0, 0, (1 << 10), (1 << 10));
}
// DPad-Up Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[4] < 0xF0) {
@ -4846,7 +4870,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
if ((interfaceCtx->unk_1EC < 2) || (interfaceCtx->unk_1EC == 3)) {
Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment);
} else {
Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE);
Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE());
}
gDPPipeSync(OVERLAY_DISP++);

View file

@ -4,7 +4,7 @@
#include <string.h>
#include "soh/Enhancements/gameconsole.h"
#include "../libultraship/ImGuiImpl.h"
#include "soh/frame_interpolation.h"
void* D_8012D1F0 = NULL;
@ -190,6 +190,7 @@ void Gameplay_Destroy(GameState* thisx) {
KaleidoManager_Destroy();
ZeldaArena_Cleanup();
Fault_RemoveClient(&D_801614B8);
disableBetaQuest();
gGlobalCtx = NULL;
}
@ -237,10 +238,11 @@ void GivePlayerRandoRewardZeldaLightArrowsGift(GlobalContext* globalCtx, Randomi
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT &&
(gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_TOKINOMA) &&
!Flags_GetTreasure(globalCtx, 0x1E) && player != NULL && !Player_InBlockingCsMode(globalCtx, player) &&
globalCtx->sceneLoadFlag == 0 && player->getItemId == GI_NONE) {
globalCtx->sceneLoadFlag == 0) {
GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_ARROW_LIGHT);
GiveItemWithoutActor(globalCtx, getItemId);
Flags_SetTreasure(globalCtx, 0x1E);
player->pendingFlag.flagID = 0x1E;
player->pendingFlag.flagType = FLAG_SCENE_TREASURE;
}
}
@ -260,6 +262,7 @@ void GivePlayerRandoRewardSariaGift(GlobalContext* globalCtx, RandomizerCheck ch
void Gameplay_Init(GameState* thisx) {
GlobalContext* globalCtx = (GlobalContext*)thisx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
enableBetaQuest();
gGlobalCtx = globalCtx;
//globalCtx->state.gfxCtx = NULL;
uintptr_t zAlloc;
@ -1407,7 +1410,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
OVERLAY_DISP = sp70;
globalCtx->unk_121C7 = 2;
SREG(33) |= 1;
} else {
} else if (R_PAUSE_MENU_MODE != 3) {
Gameplay_Draw_DrawOverlayElements:
if ((HREG(80) != 10) || (HREG(89) != 0)) {
Gameplay_DrawOverlayElements(globalCtx);

View file

@ -752,18 +752,12 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
};
color = &sTemp;
if (tunic == PLAYER_TUNIC_KOKIRI && CVar_GetS32("gUseTunicsCol",0)) {
color->r = CVar_GetS32("gTunic_Kokiri_R", sTunicColors[PLAYER_TUNIC_KOKIRI].r);
color->g = CVar_GetS32("gTunic_Kokiri_G", sTunicColors[PLAYER_TUNIC_KOKIRI].g);
color->b = CVar_GetS32("gTunic_Kokiri_B", sTunicColors[PLAYER_TUNIC_KOKIRI].b);
*color = CVar_GetRGB("gTunic_Kokiri", sTunicColors[PLAYER_TUNIC_KOKIRI]);
} else if (tunic == PLAYER_TUNIC_GORON && CVar_GetS32("gUseTunicsCol",0)) {
color->r = CVar_GetS32("gTunic_Goron_R", sTunicColors[PLAYER_TUNIC_GORON].r);
color->g = CVar_GetS32("gTunic_Goron_G", sTunicColors[PLAYER_TUNIC_GORON].g);
color->b = CVar_GetS32("gTunic_Goron_B", sTunicColors[PLAYER_TUNIC_GORON].b);
*color = CVar_GetRGB("gTunic_Goron", sTunicColors[PLAYER_TUNIC_GORON]);
} else if (tunic == PLAYER_TUNIC_ZORA && CVar_GetS32("gUseTunicsCol",0)) {
color->r = CVar_GetS32("gTunic_Zora_R", sTunicColors[PLAYER_TUNIC_ZORA].r);
color->g = CVar_GetS32("gTunic_Zora_G", sTunicColors[PLAYER_TUNIC_ZORA].g);
color->b = CVar_GetS32("gTunic_Zora_B", sTunicColors[PLAYER_TUNIC_ZORA].b);
} else if (!CVar_GetS32("gUseTunicsCol",0)) {
*color = CVar_GetRGB("gTunic_Zora", sTunicColors[PLAYER_TUNIC_ZORA]);
} else if (!CVar_GetS32("gUseTunicsCol",0)){
if (tunic >= 3) {
color->r = sOriginalTunicColors[0].r;
color->g = sOriginalTunicColors[0].g;

View file

@ -217,13 +217,12 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
//#define JPEG_MARKER 0xFFD8FFE0
#define JPEG_MARKER 0xE0FFD8FF
#define JPEG_MARKER 0xFFD8FFE0
s32 func_80096238(void* data) {
OSTime time;
if (*(u32*)data == JPEG_MARKER)
if (BE32SWAP(*(u32*)data) == JPEG_MARKER)
{
char* decodedJpeg = ResourceMgr_LoadJPEG(data, 320 * 240 * 2);
//char* decodedJpeg = ResourceMgr_LoadJPEG(data, 480 * 240 * 2);

View file

@ -1697,7 +1697,10 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx);
unkMtx = &globalCtx->billboardMtxF;
// OTRTODO: This call causes the whole texture cache to be cleaned up, which causes an important slowdown on switch so we need to find a way to avoid it.
#ifndef __SWITCH__
gSPInvalidateTexCache(POLY_XLU_DISP++, 0);
#endif
for (i = 0; i < 80; i++, eff++) {
if (eff->unk_24 == 1) {

View file

@ -1540,7 +1540,34 @@ void DemoEffect_UpdateJewelAdult(DemoEffect* this, GlobalContext* globalCtx) {
this->jewel.timer++;
this->actor.shape.rot.y += 0x0400;
DemoEffect_PlayJewelSfx(this, globalCtx);
if (gSaveContext.n64ddFlag) {
switch (this->jewel.type) {
case DEMO_EFFECT_JEWEL_KOKIRI:
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) {
DemoEffect_SetJewelColor(this, 1.0f);
} else {
DemoEffect_SetJewelColor(this, 0.0f);
}
break;
case DEMO_EFFECT_JEWEL_GORON:
if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) {
DemoEffect_SetJewelColor(this, 1.0f);
} else {
DemoEffect_SetJewelColor(this, 0.0f);
}
break;
case DEMO_EFFECT_JEWEL_ZORA:
if (CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
DemoEffect_SetJewelColor(this, 1.0f);
} else {
DemoEffect_SetJewelColor(this, 0.0f);
}
break;
}
} else {
DemoEffect_SetJewelColor(this, 1.0f);
}
}
/**
@ -1604,6 +1631,34 @@ void DemoEffect_UpdateJewelChild(DemoEffect* this, GlobalContext* globalCtx) {
thisx->shape.rot.y += 0x0400;
DemoEffect_PlayJewelSfx(this, globalCtx);
this->effectFlags &= ~1;
if (gSaveContext.n64ddFlag) {
switch (this->jewel.type) {
case DEMO_EFFECT_JEWEL_KOKIRI:
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) {
DemoEffect_SetJewelColor(this, 1.0f);
} else {
DemoEffect_SetJewelColor(this, 0.0f);
}
break;
case DEMO_EFFECT_JEWEL_GORON:
if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) {
DemoEffect_SetJewelColor(this, 1.0f);
} else {
DemoEffect_SetJewelColor(this, 0.0f);
}
break;
case DEMO_EFFECT_JEWEL_ZORA:
if (CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
DemoEffect_SetJewelColor(this, 1.0f);
} else {
DemoEffect_SetJewelColor(this, 0.0f);
}
break;
}
} else {
// Contrary to it's adult conterpart Authenthic doesn't use DemoEffect_SetJewelColor(this, 1.0f); here
}
}
/**

View file

@ -1059,7 +1059,7 @@ void EnSkj_SetupPostSariasSong(EnSkj* this) {
}
void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) {
if (((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) || Randomizer_ItemIsIceTrap(RC_LW_SKULL_KID, GI_HEART_PIECE)) {
gSaveContext.itemGetInf[1] |= 0x40;
EnSkj_SetNaviId(this);
EnSkj_SetupWaitInRange(this);

View file

@ -288,14 +288,16 @@ void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) {
}
void GivePlayerRandoRewardSheikSong(EnXc* sheik, GlobalContext* globalCtx, RandomizerCheck check, int sheikType, GetItemID ogSongId) {
if (sheik->actor.parent != NULL && sheik->actor.parent->id == GET_PLAYER(globalCtx)->actor.id &&
Player* player = GET_PLAYER(globalCtx);
if (sheik->actor.parent != NULL && sheik->actor.parent->id == player->actor.id &&
!(gSaveContext.eventChkInf[5] & sheikType)) {
gSaveContext.eventChkInf[5] |= sheikType;
} else if (!(gSaveContext.eventChkInf[5] & sheikType)) {
GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, ogSongId);
if (check == RC_SHEIK_AT_TEMPLE && !Flags_GetTreasure(globalCtx, 0x1F)) {
if (func_8002F434(&sheik->actor, globalCtx, getItemId, 10000.0f, 100.0f)) {
Flags_SetTreasure(globalCtx, 0x1F);
player->pendingFlag.flagID = 0x1F;
player->pendingFlag.flagType = FLAG_SCENE_TREASURE;
}
} else if (check != RC_SHEIK_AT_TEMPLE) {
func_8002F434(&sheik->actor, globalCtx, getItemId, 10000.0f, 100.0f);

View file

@ -168,6 +168,7 @@ void func_8083CA20(GlobalContext* globalCtx, Player* this);
void func_8083CA54(GlobalContext* globalCtx, Player* this);
void func_8083CA9C(GlobalContext* globalCtx, Player* this);
s32 func_8083E0FC(Player* this, GlobalContext* globalCtx);
void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx);
s32 func_8083E5A8(Player* this, GlobalContext* globalCtx);
s32 func_8083EB44(Player* this, GlobalContext* globalCtx);
s32 func_8083F7BC(Player* this, GlobalContext* globalCtx);
@ -4649,7 +4650,11 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) {
anim = D_80853914[PLAYER_ANIMGROUP_13][this->modelAnimType];
}
func_80832264(globalCtx, this, anim);
if (CVar_GetS32("gFasterHeavyBlockLift", 0) && interactActorId == ACTOR_BG_HEAVY_BLOCK) {
LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 3.0f);
} else {
LinkAnimation_PlayOnce(globalCtx, &this->skelAnime, anim);
}
}
}
else {
@ -6233,6 +6238,30 @@ void func_8083E4C4(GlobalContext* globalCtx, Player* this, GetItemEntry* giEntry
func_80078884((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM);
}
// Sets a flag according to which type of flag is specified in player->pendingFlag.flagType
// and which flag is specified in player->pendingFlag.flagID.
void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx) {
switch (this->pendingFlag.flagType) {
case FLAG_SCENE_CLEAR:
Flags_SetClear(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_SCENE_COLLECTIBLE:
Flags_SetCollectible(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_SCENE_SWITCH:
Flags_SetSwitch(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_SCENE_TREASURE:
Flags_SetTreasure(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_NONE:
default:
break;
}
this->pendingFlag.flagType = FLAG_NONE;
this->pendingFlag.flagID = 0;
}
s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {
Actor* interactedActor;
@ -6256,6 +6285,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {
this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11);
this->actor.colChkInfo.damage = 0;
func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20);
Player_SetPendingFlag(this, globalCtx);
return;
}
@ -12688,6 +12718,8 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
Message_StartTextbox(globalCtx, giEntry->textId, &this->actor);
Item_Give(globalCtx, giEntry->itemId);
Player_SetPendingFlag(this, globalCtx);
if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) ||
((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) ||
@ -13130,7 +13162,10 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) {
if (LinkAnimation_Update(globalCtx, &this->skelAnime)) {
if (this->unk_84F != 0) {
if (this->unk_850 == 0) {
Message_StartTextbox(globalCtx, D_80854A04[this->unk_84F - 1].textId, &this->actor);
if (CVar_GetS32("gFastDrops", 0))
{ this->unk_84F = 0; }
else
{ Message_StartTextbox(globalCtx, D_80854A04[this->unk_84F - 1].textId, &this->actor); }
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
this->unk_850 = 1;
}
@ -13166,11 +13201,13 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) {
if (i < 4) {
this->unk_84F = i + 1;
this->unk_850 = 0;
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
this->interactRangeActor->parent = &this->actor;
Player_UpdateBottleHeld(globalCtx, this, catchInfo->itemId, ABS(catchInfo->actionParam));
func_808322D0(globalCtx, this, sp24->unk_04);
func_80835EA4(globalCtx, 4);
if (!CVar_GetS32("gFastDrops", 0)) {
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
func_808322D0(globalCtx, this, sp24->unk_04);
func_80835EA4(globalCtx, 4);
}
}
}
}

View file

@ -515,12 +515,49 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
(gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] ==
((void)0, gSaveContext.linkAge))) {
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
// Allow Link to remove his equipment from the equipment subscreen by toggling on/off
// Shields will be un-equipped entirely, and tunics/boots will revert to Kokiri Tunic/Kokiri Boots
// Only BGS/Giant's Knife is affected, and it will revert to Master Sword.
// If we have the feature toggled on
if (CVar_GetS32("gEquipmentCanBeRemoved", 0)) {
// If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3
&& CUR_EQUIP_VALUE(EQUIP_SWORD) == 3 && CHECK_OWNED_EQUIP(0,1)){ // And we have the Master Sword
Inventory_ChangeEquipment(EQUIP_SWORD, 2); // "Unequip" it by equipping Master Sword
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
gSaveContext.infTable[29] = 0;
goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it
}
// If we're on the "shields" section of the equipment screen AND we're on a currently-equipped shield
if (pauseCtx->cursorY[PAUSE_EQUIP] == 1 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_SHIELD)) {
Inventory_ChangeEquipment(EQUIP_SHIELD, 0); // Unequip it
goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it
}
// If we're on the "tunics" section of the equipment screen AND we're on a currently-equipped tunic
if (pauseCtx->cursorY[PAUSE_EQUIP] == 2 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_TUNIC)) {
Inventory_ChangeEquipment(EQUIP_TUNIC, 1); // "Unequip" it (by equipping Kokiri Tunic)
goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it
}
// If we're on the "boots" section of the equipment screen AND we're on currently-equipped boots
if (pauseCtx->cursorY[PAUSE_EQUIP] == 3 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_BOOTS)) {
Inventory_ChangeEquipment(EQUIP_BOOTS, 1); // "Unequip" it (by equipping Kokiri Boots)
goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it
}
}
if (CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) {
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
} else {
goto EQUIP_FAIL;
}
RESUME_EQUIPMENT:
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
gSaveContext.infTable[29] = 0;
gSaveContext.equips.buttonItems[0] = cursorItem;
@ -537,7 +574,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
}
}
RESUME_EQUIPMENT_SWORD:
Interface_LoadItemIcon1(globalCtx, 0);
}

View file

@ -2110,7 +2110,8 @@ void KaleidoScope_UpdateNamePanel(GlobalContext* globalCtx) {
sp2A += 12;
}
memcpy(pauseCtx->nameSegment, ResourceMgr_LoadTexByName(mapNameTextures[sp2A]), 0x400);
const char* textureName = mapNameTextures[sp2A];
memcpy(pauseCtx->nameSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
} else {
osSyncPrintf("zoom_name=%d\n", pauseCtx->namedItem);
@ -2123,7 +2124,8 @@ void KaleidoScope_UpdateNamePanel(GlobalContext* globalCtx) {
osSyncPrintf("J_N=%d point=%d\n", gSaveContext.language, sp2A);
memcpy(pauseCtx->nameSegment, ResourceMgr_LoadTexByName(iconNameTextures[sp2A]), 0x400);
const char* textureName = iconNameTextures[sp2A];
memcpy(pauseCtx->nameSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
}
pauseCtx->nameDisplayTimer = 0;
@ -3224,8 +3226,12 @@ void KaleidoScope_UpdateCursorSize(PauseContext* pauseCtx) {
void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
memcpy(interfaceCtx->mapSegment, ResourceMgr_LoadTexByName(sDungeonMapTexs[R_MAP_TEX_INDEX]), 0x800);
memcpy(interfaceCtx->mapSegment + 0x800, ResourceMgr_LoadTexByName(sDungeonMapTexs[R_MAP_TEX_INDEX + 1]), 0x800);
char* firstTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX];
char* secondTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX + 1];
uint32_t firstTextureSize = ResourceMgr_LoadTexSizeByName(firstTextureName);
memcpy(interfaceCtx->mapSegment, ResourceMgr_LoadTexByName(firstTextureName), ResourceMgr_LoadTexSizeByName(firstTextureName));
memcpy(interfaceCtx->mapSegment + (firstTextureSize / 2), ResourceMgr_LoadTexByName(secondTextureName), ResourceMgr_LoadTexSizeByName(secondTextureName));
}
void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx) {
@ -3403,11 +3409,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
if (((void)0, gSaveContext.worldMapArea) < 22) {
if (gSaveContext.language == LANGUAGE_ENG) {
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[36 + gSaveContext.worldMapArea]), 0xA00);
const char* textureName = mapNameTextures[36 + gSaveContext.worldMapArea];
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
} else if (gSaveContext.language == LANGUAGE_GER) {
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[58 + gSaveContext.worldMapArea]), 0xA00);
const char* textureName = mapNameTextures[58 + gSaveContext.worldMapArea];
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
} else {
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[80 + gSaveContext.worldMapArea]), 0xA00);
const char* textureName = mapNameTextures[80 + gSaveContext.worldMapArea];
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
}
}
// OTRTODO - player on pause