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
commit dca922ade8
No known key found for this signature in database
GPG key ID: 7093AE5FF7037D79
41 changed files with 8677 additions and 244 deletions

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;

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);

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

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

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

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) {

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) {