Merge branch 'develop-zhora' of https://github.com/HarbourMasters/Shipwright into custom-messages

This commit is contained in:
Christopher Leggett
2022-07-24 18:08:10 -04:00
41 changed files with 8677 additions and 244 deletions
+8 -6
View File
@@ -1028,7 +1028,7 @@ s8 D_80131870 = 0;
u8 D_80131874 = 0;
u8 D_80131878 = 0;
u8 D_8013187C = 0;
u8 D_80131880 = 0;
u8 sOcarinaDropInputTimer = 0;
OcarinaNote sPierresSong[108] = {
{ 0xFF, 0, 0, 0, 0, 0, 0 },
@@ -1550,9 +1550,11 @@ void func_800ED458(s32 arg0) {
u32 phi_v1_2;
bool dpad = CVar_GetS32("gDpadOcarinaText", 0);
if (D_80130F3C != 0 && D_80131880 != 0) {
D_80131880--;
return;
if (D_80130F3C != 0 && sOcarinaDropInputTimer != 0) {
sOcarinaDropInputTimer--;
if (!CVar_GetS32("gDpadNoDropOcarinaInput", 0)) {
return;
}
}
if ((D_8016BA10 == 0) ||
@@ -2057,7 +2059,7 @@ void func_800EE6F4(void) {
}
if ((D_80130F3C != 0) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) {
D_80131880 = 1;
sOcarinaDropInputTimer = 1;
}
sPrevOcarinaNoteVal = sCurOcarinaBtnVal;
@@ -2110,7 +2112,7 @@ void func_800EE930(void) {
sRecordingStaff.noteIdx = OCARINA_NOTE_INVALID;
sRecordingStaff.state = 0xFF;
sRecordingStaff.pos = 0;
D_80131880 = 0;
sOcarinaDropInputTimer = 0;
}
f32 D_80131C8C = 0.0f;
+9 -6
View File
@@ -1035,15 +1035,9 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
break;
} else {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 430.0f;
this->actor.shape.shadowScale = 0.03f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
if (this->unk_15A < 0) {
if (this->unk_15A == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(globalCtx, &this->actor);
@@ -1056,7 +1050,16 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
break;
}
//Big hearts workaround
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 430.0f;
this->actor.shape.shadowScale = 6.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
EnItem00_DrawCollectible(this, globalCtx);
break;
}
case ITEM00_BOMBS_A:
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
+7 -2
View File
@@ -713,6 +713,11 @@ void Minimap_Draw(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
// If any of these CVars are enabled, disable toggling the minimap with L, unless gEnableMapToggle is set
bool enableMapToggle =
!(CVar_GetS32("gDebugEnabled", 0) || CVar_GetS32("gMoonJumpOnL", 0) || CVar_GetS32("gTurboOnL", 0)) ||
CVar_GetS32("gEnableMapToggle", 0);
if (globalCtx->pauseCtx.state < 4) {
//Minimap margins
s16 X_Margins_Minimap;
@@ -781,7 +786,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
}
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx)) {
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx) && enableMapToggle) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Gameplay_InCsMode(globalCtx));
// clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4,
@@ -948,7 +953,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
}
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx)) {
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx) && enableMapToggle) {
// clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4,
&D_801333E0, &D_801333E0, &D_801333E8); }
+11 -11
View File
@@ -520,12 +520,12 @@ void Message_DrawTextboxIcon(GlobalContext* globalCtx, Gfx** p, s16 x, s16 y) {
sIconEnvColors[1][1] = 255;
sIconEnvColors[1][2] = 130;
} else if (CVar_GetS32("gHudColors", 1) == 2) {
sIconPrimColors[0][0] = (CVar_GetS32("gCCABtnPrimR", 50)/255)*95;
sIconPrimColors[0][1] = (CVar_GetS32("gCCABtnPrimG", 255)/255)*95;
sIconPrimColors[0][2] = (CVar_GetS32("gCCABtnPrimB", 130)/255)*95;
sIconPrimColors[1][0] = CVar_GetS32("gCCABtnPrimR", 50);
sIconPrimColors[1][1] = CVar_GetS32("gCCABtnPrimG", 255);
sIconPrimColors[1][2] = CVar_GetS32("gCCABtnPrimB", 130);
sIconPrimColors[0][0] = (CVar_GetS32("gCCABtnPrimR", 0)/255)*95;
sIconPrimColors[0][1] = (CVar_GetS32("gCCABtnPrimG", 200)/255)*95;
sIconPrimColors[0][2] = (CVar_GetS32("gCCABtnPrimB", 80)/255)*95;
sIconPrimColors[1][0] = CVar_GetS32("gCCABtnPrimR", 0);
sIconPrimColors[1][1] = CVar_GetS32("gCCABtnPrimG", 200);
sIconPrimColors[1][2] = CVar_GetS32("gCCABtnPrimB", 80);
sIconEnvColors[0][0] = 0;
sIconEnvColors[0][1] = 0;
sIconEnvColors[0][2] = 0;
@@ -3257,13 +3257,13 @@ void Message_Update(GlobalContext* globalCtx) {
static s16 sTextboxXPositions[] = {
34, 34, 34, 34, 34, 34,
};
static s16 sTextboxMidYPositions[] = {
static s16 sTextboxLowerYPositions[] = {
142, 142, 142, 142, 174, 142,
};
static s16 sTextboxUpperYPositions[] = {
38, 38, 38, 38, 174, 38,
};
static s16 sTextboxLowerYPositions[] = {
static s16 sTextboxMidYPositions[] = {
90, 90, 90, 90, 174, 90,
};
static s16 sTextboxEndIconYOffset[] = {
@@ -3357,20 +3357,20 @@ void Message_Update(GlobalContext* globalCtx) {
if (!msgCtx->textBoxPos) { // variable position
if (YREG(15) != 0 || globalCtx->sceneNum == SCENE_HAIRAL_NIWA) {
if (averageY < XREG(92)) {
R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var];
R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var];
} else {
R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var];
}
} else if (globalCtx->sceneNum == SCENE_MARKET_DAY || globalCtx->sceneNum == SCENE_MARKET_NIGHT ||
globalCtx->sceneNum == SCENE_MARKET_RUINS) {
if (averageY < XREG(93)) {
R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var];
R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var];
} else {
R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var];
}
} else {
if (averageY < XREG(94)) {
R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var];
R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var];
} else {
R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var];
}
+6 -3
View File
@@ -1676,13 +1676,15 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
if (item == ITEM_SWORD_BGS) {
gSaveContext.swordHealth = 8;
if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) {
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF
||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { // In rando, when buying Giant's Knife, also check
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; // for 0xE in case we don't have Kokiri Sword
if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
Interface_LoadItemIcon1(globalCtx, 0);
}
}
} else if (item == ITEM_SWORD_MASTER) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
gSaveContext.equips.equipment &= 0xFFF0;
@@ -4796,10 +4798,11 @@ void Interface_Draw(GlobalContext* globalCtx) {
PosY_BtnA = CVar_GetS32("gABtnPosY", 0)+Y_Margins_BtnA;
rAIconY = 98.0f - PosY_BtnA;
if (CVar_GetS32("gABtnPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gABtnUseMargins", 0) != 0) {X_Margins_BtnA = Left_HUD_Margin;};
PosX_BtnA = OTRGetDimensionFromLeftEdge(CVar_GetS32("gABtnPosX", 0)+X_Margins_BtnA);
rAIconX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gABtnPosX", 0)+X_Margins_BtnA);
} else if (CVar_GetS32("gABtnPosType", 0) == 2) {//Anchor Right
X_Margins_BtnA = Right_HUD_Margin;
if (CVar_GetS32("gABtnUseMargins", 0) != 0) {X_Margins_BtnA = Right_HUD_Margin;};
PosX_BtnA = OTRGetDimensionFromRightEdge(CVar_GetS32("gABtnPosX", 0)+X_Margins_BtnA);
rAIconX= OTRGetDimensionFromRightEdge(CVar_GetS32("gABtnPosX", 0)+X_Margins_BtnA);
} else if (CVar_GetS32("gABtnPosType", 0) == 3) {//Anchor None
+2 -2
View File
@@ -1673,7 +1673,7 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime,
Vec3s* srcTable;
s32 i;
bool canswitchrnd = false;
s16 SelectedMode = CVar_GetS32("gPauseLiveLink", 1);
s16 SelectedMode = CVar_GetS32("gPauseLiveLink", 0);
MinFrameCount = CVar_GetS32("gMinFrameCount", 200);
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800);
@@ -1699,7 +1699,7 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime,
};
s16 AnimArraySize = ARRAY_COUNT(PauseMenuAnimSet);
if (CVar_GetS32("gPauseLiveLink", !0) || CVar_GetS32("gPauseTriforce", 0)) {
if (CVar_GetS32("gPauseLiveLink", 0) || CVar_GetS32("gPauseTriforce", 0)) {
uintptr_t anim = 0; // Initialise anim
if (CUR_EQUIP_VALUE(EQUIP_SWORD) >= 3) {
+6
View File
@@ -402,6 +402,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
camera = GET_ACTIVE_CAM(globalCtx);
camId = camera->camDataIdx;
if (camId == -1 && CVar_GetS32("gNoRestrictItems", 0)) {
// This prevents a crash when using items that change the
// camera (such as din's fire) on scenes with prerendered backgrounds
return NULL;
}
// jfifid
camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y;
if (camId2 >= 0) {
@@ -34,6 +34,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Draw(Actor* this, GlobalContext* globalCtx);
void BgHakaGate_Reset(void);
void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx);
@@ -62,7 +63,7 @@ const ActorInit Bg_Haka_Gate_InitVars = {
(ActorFunc)BgHakaGate_Destroy,
(ActorFunc)BgHakaGate_Update,
(ActorFunc)BgHakaGate_Draw,
NULL,
(ActorResetFunc)BgHakaGate_Reset,
};
static InitChainEntry sInitChain[] = {
@@ -378,3 +379,7 @@ void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgHakaGate_DrawFlame(this, globalCtx);
}
}
void BgHakaGate_Reset(void) {
sStatueRotY = 0;
}
@@ -228,8 +228,8 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) {
this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + sp28.x * sine + sp28.z * cosine;
}
static UNK_TYPE D_80881018 = 0;
void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) {
static UNK_TYPE D_80881018 = 0;
Player* player = GET_PLAYER(globalCtx);
if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) {
@@ -553,4 +553,5 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) {
void BgHakaTrap_Reset(void) {
D_80880F30 = 0;
D_80881014 = 0;
D_80881018 = 0;
}
@@ -227,7 +227,7 @@ void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, GlobalContext* glob
void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, GlobalContext* globalCtx) {
s32 i;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
if ((CVar_GetS32("gWaterTempleGateFix", 0) == 0 || LINK_IS_ADULT) && Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->timer = 100;
this->dyna.actor.world.pos.y += 3.0f;
this->actionFunc = BgSpot06Objects_GateWaitToOpen;
@@ -297,7 +297,7 @@ void func_808B7F74(BgSpot18Basket* this) {
shapeRotY = this->dyna.actor.shape.rot.y;
this->actionFunc = func_808B7FC0;
if ((shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19)) {
if ((shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19) || CVar_GetS32("gGoronPot", 0)) {
this->unk_218 = 2;
} else if (shapeRotY < 0x26C2) {
this->unk_218 = 1;
@@ -929,7 +929,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) {
this->actor.flags &= ~ACTOR_FLAG_0;
Math_ApproachF(&this->baseAlpha, 0.0, 1.0f, 5.0f);
for (indS1 = 0; indS1 < 40; indS1++) {
if (sMorphaTent2->tentSpawnPos) {}
if (sMorphaTent2 && sMorphaTent2->tentSpawnPos) {}
indT5 = Rand_ZeroFloat(20.9f);
indS0 = sTentSpawnIndex[indT5];
spFC.x = 0;
@@ -3604,4 +3604,4 @@ void BossMo_Reset(void) {
sBossGanonSeed1 = 0;
sBossGanonSeed2 = 0;
sBossGanonSeed3 = 0;
}
}
@@ -290,7 +290,8 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.targetMode = 6;
this->unk_1E8.unk_00 = 0;
if (!(gSaveContext.eventChkInf[1] & 0x10) || (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && !gSaveContext.n64ddFlag)) {
if (!(gSaveContext.eventChkInf[1] & 0x10) || (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && !gSaveContext.n64ddFlag) ||
(gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F))) {
this->actionFunc = func_80AA0D88;
EnMa1_ChangeAnim(this, ENMA1_ANIM_2);
} else {
@@ -5191,7 +5191,7 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) {
this->stateFlags2 |= PLAYER_STATE2_21;
}
if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && !sp28) {
if (!CHECK_BTN_ALL(sControlInput->press.button, CVar_GetS32("gNaviOnL", 0) ? BTN_L : BTN_CUP) && !sp28) {
return 0;
}
@@ -5247,7 +5247,8 @@ s32 func_8083B998(Player* this, GlobalContext* globalCtx) {
(CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_18) || (this->unk_664->naviEnemyId != 0xFF))) {
this->stateFlags2 |= PLAYER_STATE2_21;
}
else if ((this->naviTextId == 0) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) &&
else if ((this->naviTextId == 0 || CVar_GetS32("gNaviOnL", 0)) &&
!func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) &&
(YREG(15) != 0x10) && (YREG(15) != 0x20) && !func_8083B8F4(this, globalCtx)) {
func_80078884(NA_SE_SY_ERROR);
}
@@ -7138,7 +7139,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) {
if (sp34 < 4) {
if (((sp34 != 0) && (sp34 != 3)) || ((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) &&
((sp34 == 3) || Player_GetSwordHeld(this)))) {
if ((sp34 == 1) && Player_HoldsTwoHandedWeapon(this) && CVar_GetS32("gTwoHandedIdle", 1) == 1) {
if ((sp34 == 1) && Player_HoldsTwoHandedWeapon(this) && CVar_GetS32("gTwoHandedIdle", 0) == 1) {
sp34 = 4;
}
sp38 = sp34 + 9;
@@ -7846,15 +7847,35 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) {
}
s32 func_808428D8(Player* this, GlobalContext* globalCtx) {
if (!Player_IsChildWithHylianShield(this) && Player_GetSwordHeld(this) && D_80853614) {
func_80832264(globalCtx, this, &gPlayerAnim_002EC8);
this->unk_84F = 1;
this->swordAnimation = 0xC;
this->currentYaw = this->actor.shape.rot.y + this->unk_6BE;
if (Player_IsChildWithHylianShield(this) || !Player_GetSwordHeld(this) || !D_80853614) {
return 0;
}
func_80832264(globalCtx, this, &gPlayerAnim_002EC8);
this->unk_84F = 1;
this->swordAnimation = 0xC;
this->currentYaw = this->actor.shape.rot.y + this->unk_6BE;
if (!CVar_GetS32("gCrouchStabHammerFix", 0)) {
return 1;
}
return 0;
u32 swordId;
if (Player_HoldsBrokenKnife(this)) {
swordId = 1;
} else {
swordId = Player_GetSwordHeld(this) - 1;
}
if (swordId != 4 && !CVar_GetS32("gCrouchStabFix", 0)) { // 4 = Megaton Hammer
return 1;
}
u32 flags = D_80854488[swordId][0];
func_80837918(this, 0, flags);
func_80837918(this, 1, flags);
return 1;
}
s32 func_80842964(Player* this, GlobalContext* globalCtx) {
@@ -9884,8 +9905,15 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) {
this->unk_837 = 20;
}
else if (this->unk_837 != 0) {
doAction = DO_ACTION_NONE;
this->unk_837--;
if (CVar_GetS32("gInstantPutaway", 0) != 0)
{
this->unk_837 = 0;
}
else
{
doAction = DO_ACTION_NONE;
this->unk_837--;
}
}
Interface_SetDoAction(globalCtx, doAction);
+87 -86
View File
@@ -11,9 +11,9 @@
#include "textures/nintendo_rogo_static/nintendo_rogo_static.h"
#include <soh/Enhancements/bootcommands.h>
#include "GameVersions.h"
#include <soh/SaveManager.h>
const char* GetGameVersionString();
char* quote;
void Title_PrintBuildInfo(Gfx** gfxp) {
@@ -224,72 +224,6 @@ void Title_Draw(TitleContext* this) {
void Title_Main(GameState* thisx) {
TitleContext* this = (TitleContext*)thisx;
if (CVar_GetS32("gSkipLogoTitle",0)!=0) {
gSaveContext.language = CVar_GetS32("gLanguages", 0);
Sram_InitSram(&this->state);
s16 selectedfile = CVar_GetS32("gSaveFileID", 0);
if (selectedfile == 4) {
selectedfile = 0xFF;
} else if(selectedfile == 0){
gSaveContext.fileNum = selectedfile;
gSaveContext.gameMode = 0;
this->state.running = false;
SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, SelectContext);
return;
} else {
selectedfile--;
if (selectedfile < 0) {
selectedfile = 0xFF;
}
}
if (selectedfile == 0xFF) {
gSaveContext.fileNum = selectedfile;
Sram_OpenSave();
gSaveContext.gameMode = 0;
this->state.running = false;
SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext);
} else {
gSaveContext.fileNum = selectedfile;
Sram_OpenSave();
gSaveContext.gameMode = 0;
this->state.running = false;
//return;
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
}
gSaveContext.respawn[0].entranceIndex = -1;
gSaveContext.respawnFlag = 0;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = 0xFF;
gSaveContext.showTitleCard = true;
gSaveContext.dogParams = 0;
gSaveContext.timer1State = 0;
gSaveContext.timer2State = 0;
gSaveContext.eventInf[0] = 0;
gSaveContext.eventInf[1] = 0;
gSaveContext.eventInf[2] = 0;
gSaveContext.eventInf[3] = 0;
gSaveContext.unk_13EE = 0x32;
gSaveContext.nayrusLoveTimer = 0;
gSaveContext.healthAccumulator = 0;
gSaveContext.unk_13F0 = 0;
gSaveContext.unk_13F2 = 0;
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.skyboxTime = 0;
gSaveContext.nextTransition = 0xFF;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.nextDayTime = 0xFFFF;
gSaveContext.unk_13C3 = 0;
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = gSaveContext.unk_13F4 = 0;
gSaveContext.unk_13F6 = gSaveContext.magic;
gSaveContext.magic = 0;
gSaveContext.magicLevel = gSaveContext.magic;
gSaveContext.naviTimer = 0;
return;
}
OPEN_DISPS(this->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0, NULL);
@@ -330,27 +264,94 @@ void Title_Destroy(GameState* thisx) {
void Title_Init(GameState* thisx) {
//u32 size = 0;
TitleContext* this = (TitleContext*)thisx;
FileChooseContext* FileChooseCtx = (FileChooseContext*)thisx;
quote = SetQuote();
if (CVar_GetS32("gSkipLogoTitle",0)) {
bool saveloading = false;
Sram_InitSram(&this->state.init);
gSaveContext.language = CVar_GetS32("gLanguages", 0);
s32 selectedfile = CVar_GetS32("gSaveFileID", 0);
if (selectedfile == 4) {
if (CVar_GetS32("gDebugEnabled",0)) {
selectedfile = 0xFF;
} else {
selectedfile = 3;
}
}
if (selectedfile < 0) {
selectedfile = 3; //If somehow the save file number under 0 revert back to 3 to prevent boot error
}
if(selectedfile == 3){
saveloading = true;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = 0xFF;
gSaveContext.gameMode = 1;
SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext);
this->state.running = false;
return;
} else if (selectedfile == 0xFF || selectedfile > 3) {
saveloading = true;
Sram_InitDebugSave();
gSaveContext.fileNum = selectedfile;
SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext);
this->state.running = false;
return;
} else if (selectedfile >= 0 && selectedfile <= 2) {
if (Save_Exist(selectedfile) == true) { //The file exist load it
saveloading = true;
gSaveContext.fileNum = selectedfile;
Sram_OpenSave();
gSaveContext.gameMode = 0;
gSaveContext.magic = gSaveContext.magic;
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
this->state.running = false;
return;
} else {
if (CVar_GetS32("gCreateNewSave",0)) {
//File do not exist create a new save file
saveloading = true;
Sram_InitSram(&FileChooseCtx->state.init);
gSaveContext.fileNum = selectedfile;
Sram_InitSave(FileChooseCtx);
Sram_OpenSave();
gSaveContext.gameMode = 0;
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
this->state.running = false;
return;
} else {
//File do not exist but user do not wish to auto create a save file with blank name
saveloading = true;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = 0xFF;
gSaveContext.gameMode = 1;
SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext);
this->state.running = false;
return;
}
}
}
} else {
quote = SetQuote();
//this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size);
osSyncPrintf("z_title.c\n");
//ASSERT(this->staticSegment != NULL);
//this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size);
osSyncPrintf("z_title.c\n");
//ASSERT(this->staticSegment != NULL);
//ResourceMgr_CacheDirectory("nintendo_rogo_static*");
//ResourceMgr_CacheDirectory("nintendo_rogo_static*");
// Disable vismono
D_801614B0.a = 0;
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);
this->state.main = Title_Main;
this->state.destroy = Title_Destroy;
this->exit = false;
gSaveContext.fileNum = 0xFF;
this->ult = 0;
this->unk_1D4 = 0x14;
this->coverAlpha = 255;
this->addAlpha = -3;
this->visibleDuration = 0x3C;
// Disable vismono
D_801614B0.a = 0;
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);
this->state.main = Title_Main;
this->state.destroy = Title_Destroy;
this->exit = false;
gSaveContext.fileNum = 0xFF;
this->ult = 0;
this->unk_1D4 = 0x14;
this->coverAlpha = 255;
this->addAlpha = -3;
this->visibleDuration = 0x3C;
}
}
@@ -637,24 +637,23 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0);
}
}
// Draw inventory screen icons
for (k = 0, bit = rowStart, point = 4; k < 3; k++, point += 4, temp++, bit++) {
int itemId = ITEM_SWORD_KOKIRI + temp;
bool age_restricted = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
if (age_restricted) {
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
gsSPGrayscale(POLY_KAL_DISP++, true);
}
if (((u32)i == 0) && (k == 2) && (gSaveContext.bgsFlag != 0)) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point);
} else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point);
}
if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
int itemId = ITEM_SWORD_KOKIRI + temp;
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
if (not_acquired) {
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
gsSPGrayscale(POLY_KAL_DISP++, true);
}
} else if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point);
gsSPGrayscale(POLY_KAL_DISP++, false);
}
gsSPGrayscale(POLY_KAL_DISP++, false);
}
}
@@ -9,6 +9,7 @@ u8 gAmmoItems[] = {
static s16 sEquipState = 0;
static s16 sEquipAnimTimer = 0;
static s16 sEquipMoveTimer = 10;
bool gSelectingMask;
static s16 sAmmoVtxOffset[] = {
0, 2, 4, 6, 99, 99, 8, 99, 99, 10, 99, 99, 99, 99, 99, 99, 12,
@@ -108,7 +109,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
pauseCtx->nameColorSet = 0;
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
moveCursorResult = 0;
moveCursorResult = 0 || gSelectingMask;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorItem = pauseCtx->cursorItem[PAUSE_ITEM];
@@ -282,7 +283,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
if (pauseCtx->cursorSpecialPos == 0) {
if (cursorItem != PAUSE_ITEM_NONE) {
if ((ABS(pauseCtx->stickRelY) > 30) || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
moveCursorResult = 0;
moveCursorResult = 0 || gSelectingMask;
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorY = pauseCtx->cursorY[PAUSE_ITEM];
@@ -350,6 +351,40 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if (CVar_GetS32("gMaskSelect", 0) && (gSaveContext.eventChkInf[8] & 0x8000) &&
cursorSlot == SLOT_TRADE_CHILD && CHECK_BTN_ALL(input->press.button, BTN_A)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gSelectingMask = !gSelectingMask;
}
if (gSelectingMask) {
pauseCtx->cursorColorSet = 8;
if (((pauseCtx->stickRelX > 30 || pauseCtx->stickRelY > 30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT | BTN_DUP)) &&
INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_TRUTH) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
++INV_CONTENT(ITEM_TRADE_CHILD);
} else if (((pauseCtx->stickRelX < -30 || pauseCtx->stickRelY < -30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DDOWN)) &&
INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_KEATON) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
--INV_CONTENT(ITEM_TRADE_CHILD);
} else if ((pauseCtx->stickRelX < -30 || pauseCtx->stickRelX > 30 || pauseCtx->stickRelY < -30 || pauseCtx->stickRelY > 30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT)) {
INV_CONTENT(ITEM_TRADE_CHILD) ^= ITEM_MASK_KEATON ^ ITEM_MASK_TRUTH;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
for (uint16_t cSlotIndex = 0; cSlotIndex < ARRAY_COUNT(gSaveContext.equips.cButtonSlots); cSlotIndex++) {
if (gSaveContext.equips.cButtonSlots[cSlotIndex] == SLOT_TRADE_CHILD) {
if (!LINK_IS_ADULT || CVar_GetS32("gNoRestrictAge", 0)) {
gSaveContext.equips.buttonItems[cSlotIndex+1] = INV_CONTENT(ITEM_TRADE_CHILD);
} else if (INV_CONTENT(ITEM_TRADE_CHILD) != gSaveContext.equips.buttonItems[cSlotIndex+1]) {
gSaveContext.equips.cButtonSlots[cSlotIndex] = SLOT_NONE;
gSaveContext.equips.buttonItems[cSlotIndex+1] = ITEM_NONE;
}
}
}
gSelectingMask = cursorSlot == SLOT_TRADE_CHILD;
}
u16 buttonsToCheck = BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT;
if (CVar_GetS32("gDpadEquips", 0) && (!CVar_GetS32("gDpadPauseName", 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) {
buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT;
@@ -474,6 +509,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s16 animX, s16 animY) {
Input* input = &globalCtx->state.input[0];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
gSelectingMask = false;
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
pauseCtx->equipTargetCBtn = 0;
@@ -10,6 +10,7 @@ extern s16 D_8082AB2C[];
extern u8 gSlotAgeReqs[];
extern u8 gEquipAgeReqs[][4];
extern u8 gAreaGsFlags[];
extern bool gSelectingMask;
void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx);
s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point);
@@ -867,6 +867,7 @@ void KaleidoScope_SetDefaultCursor(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
s16 s;
s16 i;
gSelectingMask = false;
switch (pauseCtx->pageIndex) {
case PAUSE_ITEM:
@@ -900,6 +901,7 @@ void KaleidoScope_SetDefaultCursor(GlobalContext* globalCtx) {
void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
pauseCtx->unk_1E4 = 1;
pauseCtx->unk_1EA = 0;
gSelectingMask = false;
if (!pt) {
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;