mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
Merge branch 'develop-zhora' of https://github.com/HarbourMasters/Shipwright into custom-messages
This commit is contained in:
commit
59baf24dc6
190 changed files with 7592 additions and 10422 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "global.h"
|
||||
#include "Hooks.h"
|
||||
#include <string.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
void func_800C3C80(AudioMgr* audioMgr) {
|
||||
AudioTask* task;
|
||||
|
@ -108,7 +108,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
|
|||
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
|
||||
Audio_InitSound();
|
||||
osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK);
|
||||
ModInternal_ExecuteAudioInitHooks();
|
||||
Hooks_ExecuteAudioInit();
|
||||
// Removed due to crash
|
||||
//IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74);
|
||||
hasInitialized = true;
|
||||
|
|
|
@ -481,22 +481,6 @@ static void RunFrame()
|
|||
uint64_t ticksA, ticksB;
|
||||
ticksA = GetPerfCounter();
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#define SAMPLES_HIGH 752
|
||||
#define SAMPLES_LOW 720
|
||||
|
||||
#define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1 )
|
||||
#define NUM_AUDIO_CHANNELS 2
|
||||
int samples_left = AudioPlayer_Buffered();
|
||||
u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
||||
|
||||
s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3];
|
||||
for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) {
|
||||
AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples);
|
||||
}
|
||||
|
||||
AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
|
||||
#endif
|
||||
Graph_StartFrame();
|
||||
|
||||
// TODO: Workaround for rumble being too long. Implement os thread functions.
|
||||
|
|
|
@ -36,12 +36,14 @@ void Main_LogSystemHeap(void) {
|
|||
osSyncPrintf(VT_RST);
|
||||
}
|
||||
|
||||
void main(int argc, char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GameConsole_Init();
|
||||
InitOTR();
|
||||
BootCommands_Init();
|
||||
Main(0);
|
||||
DeinitOTR();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Main(void* arg) {
|
||||
|
|
|
@ -55,13 +55,13 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
|
|||
uly = this->y;
|
||||
lry = this->y + 2;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
/*! @bug if gIrqMgrRetraceTime is 0, CLOSE_DISPS will never be reached */
|
||||
if (gIrqMgrRetraceTime == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
|
||||
for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
|
||||
temp = ((f64) * (sSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0;
|
||||
|
|
|
@ -3957,6 +3957,8 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
|
|||
f32 chainsTranslateX;
|
||||
f32 chainsTranslateY;
|
||||
f32 rotZStep;
|
||||
static s32 epoch = 0;
|
||||
epoch++;
|
||||
|
||||
entry = &sDoorLocksInfo[type];
|
||||
chainRotZ = entry->chainsRotZInit;
|
||||
|
@ -3970,6 +3972,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
|
|||
chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
FrameInterpolation_RecordOpenChild(entry, epoch + i * 25);
|
||||
Matrix_Put(&baseMtxF);
|
||||
Matrix_RotateZ(chainRotZ, MTXMODE_APPLY);
|
||||
Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
|
||||
|
@ -3989,6 +3992,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
|
|||
}
|
||||
|
||||
chainRotZ += rotZStep;
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
Matrix_Put(&baseMtxF);
|
||||
|
|
|
@ -47,6 +47,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) {
|
|||
elem->endXChange = elem->initialSpeed;
|
||||
elem->yaw = Rand_ZeroOne() * 65534.0f;
|
||||
elem->pitch = Rand_ZeroOne() * 65534.0f;
|
||||
elem->epoch++;
|
||||
}
|
||||
|
||||
this->lightDecay = initParams->lightDecay;
|
||||
|
@ -156,7 +157,6 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
Color_RGBA8 primColor;
|
||||
Color_RGBA8 envColor;
|
||||
|
||||
FrameInterpolation_RecordOpenChild(this, 0);
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
if (this != NULL) {
|
||||
|
@ -182,6 +182,8 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
|
||||
for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) {
|
||||
FrameInterpolation_RecordOpenChild(elem, elem->epoch);
|
||||
|
||||
Mtx* mtx;
|
||||
MtxF sp104;
|
||||
MtxF spC4;
|
||||
|
@ -212,9 +214,10 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPVertex(POLY_XLU_DISP++, sVertices, 4, 0);
|
||||
gSP2Triangles(POLY_XLU_DISP++, 0, 1, 2, 0, 0, 3, 1, 0);
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ void EffectSpark_Init(void* thisx, void* initParamsx) {
|
|||
elem->unkPosition.x = Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkPosition.y = Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkPosition.z = Rand_ZeroOne() * 65534.0f;
|
||||
elem->epoch++;
|
||||
}
|
||||
|
||||
this->timer = 0;
|
||||
|
@ -210,6 +211,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
Mtx* mtx;
|
||||
f32 temp;
|
||||
|
||||
FrameInterpolation_RecordOpenChild(elem, elem->epoch);
|
||||
|
||||
SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z);
|
||||
temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f;
|
||||
SkinMatrix_SetScale(&spAC, temp, temp, 1.0f);
|
||||
|
@ -264,6 +267,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
|
||||
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C);
|
||||
if (mtx == NULL) {
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -273,6 +277,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
}
|
||||
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "vt.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ LENS_FLARE_CIRCLE0,
|
||||
|
@ -950,7 +951,6 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li
|
|||
Gfx* prevDisplayList;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
prevDisplayList = POLY_OPA_DISP;
|
||||
displayList = Graph_GfxPlusOne(POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, displayList);
|
||||
|
@ -1459,6 +1459,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
|
|||
LENS_FLARE_RING, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1,
|
||||
LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1,
|
||||
};
|
||||
static s32 epoch = 0;
|
||||
epoch++;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
|
@ -1502,9 +1504,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
|
|||
unk88Target = cosAngle;
|
||||
}
|
||||
|
||||
if (cosAngle < 0.0f) {
|
||||
|
||||
} else {
|
||||
if (!(cosAngle < 0.0f)) {
|
||||
if (arg9) {
|
||||
u32 shrink = ShrinkWindow_GetCurrentVal();
|
||||
func_800C016C(globalCtx, &pos, &screenPos);
|
||||
|
@ -1517,6 +1517,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
|
|||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(lensFlareTypes); i++) {
|
||||
FrameInterpolation_RecordOpenChild("Lens Flare", epoch + i * 25);
|
||||
|
||||
Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW);
|
||||
|
||||
if (arg9) {
|
||||
|
@ -1573,6 +1575,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
|
|||
gSPDisplayList(POLY_XLU_DISP++, gLensFlareRingDL);
|
||||
break;
|
||||
}
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
alphaScale = cosAngle - (1.5f - cosAngle);
|
||||
|
@ -1638,6 +1642,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
|
|||
Vec3f unused = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f windDirection = { 0.0f, 0.0f, 0.0f };
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
static s32 epoch = 0;
|
||||
epoch++;
|
||||
|
||||
if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.unk_EE[2] == 0)) {
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
@ -1667,6 +1673,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
|
|||
|
||||
// draw rain drops
|
||||
for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) {
|
||||
FrameInterpolation_RecordOpenChild("Rain Drop", epoch + i * 25);
|
||||
|
||||
temp2 = Rand_ZeroOne();
|
||||
temp1 = Rand_ZeroOne();
|
||||
temp3 = Rand_ZeroOne();
|
||||
|
@ -1692,6 +1700,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
|
|||
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gRaindropDL);
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
// draw droplet rings on the ground
|
||||
|
@ -1699,6 +1709,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
|
|||
u8 firstDone = false;
|
||||
|
||||
for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) {
|
||||
FrameInterpolation_RecordOpenChild("Droplet Ring", epoch + i * 25);
|
||||
|
||||
if (!firstDone) {
|
||||
func_80093D84(gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0);
|
||||
|
@ -1719,6 +1731,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
|
|||
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffShockwaveDL);
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1911,10 +1925,14 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) {
|
|||
s32 pad[2];
|
||||
Vec3f unused1 = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f unused2 = { 0.0f, 0.0f, 0.0f };
|
||||
static s32 epoch = 0;
|
||||
epoch++;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) {
|
||||
FrameInterpolation_RecordOpenChild("Lightning Bolt", epoch + i * 25);
|
||||
|
||||
switch (sLightningBolts[i].state) {
|
||||
case LIGHTNING_BOLT_START:
|
||||
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
|
@ -1969,6 +1987,8 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) {
|
|||
gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL);
|
||||
}
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "global.h"
|
||||
#include "textures/parameter_static/parameter_static.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
s16 Top_LM_Margin = 0;
|
||||
s16 Left_LM_Margin = 0;
|
||||
|
@ -412,6 +413,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
|||
s32 curCombineModeSet = 0;
|
||||
u8* curBgImgLoaded = NULL;
|
||||
s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1;
|
||||
static s32 epoch = 0;
|
||||
epoch++;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
|
@ -449,6 +452,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
for (i = 0; i < totalHeartCount; i++) {
|
||||
FrameInterpolation_RecordOpenChild("HealthMeter Heart", epoch + i * 25);
|
||||
|
||||
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
||||
if (i < fullHeartCount) {
|
||||
if (curColorSet != 0) {
|
||||
|
@ -624,6 +629,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
|||
offsetX = PosX_original;
|
||||
}
|
||||
}
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
|
|
|
@ -2675,7 +2675,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) {
|
|||
if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS &&
|
||||
(msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET ||
|
||||
msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) {
|
||||
if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) {
|
||||
if (msgCtx->disableWarpSongs || (interfaceCtx->restrictions.warpSongs == 3 && !gSaveContext.n64ddFlag)) {
|
||||
Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!"
|
||||
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
} else if ((gSaveContext.eventInf[0] & 0xF) != 1) {
|
||||
|
|
|
@ -1384,6 +1384,12 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
u16 temp;
|
||||
|
||||
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||
// When becoming adult, remove swordless flag since we'll get master sword
|
||||
// Only in rando to keep swordless link bugs in vanilla
|
||||
if (gSaveContext.n64ddFlag) {
|
||||
gSaveContext.infTable[29] &= ~1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||
if (i != 0) {
|
||||
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
||||
|
@ -1444,6 +1450,12 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment;
|
||||
}
|
||||
} else {
|
||||
// When becoming child, set swordless flag if player doesn't have kokiri sword
|
||||
// Only in rando to keep swordless link bugs in vanilla
|
||||
if (gSaveContext.n64ddFlag && (1 << 0 & gSaveContext.inventory.equipment) == 0) {
|
||||
gSaveContext.infTable[29] |= 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||
gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
||||
|
||||
|
@ -2176,6 +2188,52 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp);
|
||||
INV_CONTENT(item) = item;
|
||||
|
||||
// Autosave after getting items by default (cvars are not shown in the UI)
|
||||
if (CVar_GetS32("gAutosave", 0)) {
|
||||
if (CVar_GetS32("gAutosaveAllItems", 1)) {
|
||||
Gameplay_PerformSave(globalCtx);
|
||||
}
|
||||
else if (CVar_GetS32("gAutosaveMajorItems", 1)) {
|
||||
switch (item) {
|
||||
case ITEM_STICK:
|
||||
case ITEM_NUT:
|
||||
case ITEM_BOMB:
|
||||
case ITEM_BOW:
|
||||
case ITEM_SEEDS:
|
||||
case ITEM_FISHING_POLE:
|
||||
case ITEM_MAGIC_SMALL:
|
||||
case ITEM_MAGIC_LARGE:
|
||||
case ITEM_INVALID_4:
|
||||
case ITEM_INVALID_5:
|
||||
case ITEM_INVALID_6:
|
||||
case ITEM_INVALID_7:
|
||||
case ITEM_HEART:
|
||||
case ITEM_RUPEE_GREEN:
|
||||
case ITEM_RUPEE_BLUE:
|
||||
case ITEM_RUPEE_RED:
|
||||
case ITEM_RUPEE_PURPLE:
|
||||
case ITEM_RUPEE_GOLD:
|
||||
case ITEM_INVALID_8:
|
||||
case ITEM_STICKS_5:
|
||||
case ITEM_STICKS_10:
|
||||
case ITEM_NUTS_5:
|
||||
case ITEM_NUTS_10:
|
||||
case ITEM_BOMBS_5:
|
||||
case ITEM_BOMBS_10:
|
||||
case ITEM_BOMBS_20:
|
||||
case ITEM_BOMBS_30:
|
||||
case ITEM_ARROWS_SMALL:
|
||||
case ITEM_ARROWS_MEDIUM:
|
||||
case ITEM_ARROWS_LARGE:
|
||||
case ITEM_SEEDS_30:
|
||||
break;
|
||||
default:
|
||||
Gameplay_PerformSave(globalCtx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
@ -3352,8 +3410,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
|||
const s16 C_Right_BTN_Pos_ori[] = { C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR };
|
||||
const s16 C_Up_BTN_Pos_ori[] = { C_UP_BUTTON_X+X_Margins_CU, C_UP_BUTTON_Y+Y_Margins_CU };
|
||||
const s16 C_Down_BTN_Pos_ori[] = { C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD };
|
||||
s16 LabelX_Navi=8;
|
||||
s16 LabelY_Navi=4 - !!CVar_GetS32("gNaviTextFix", 0);
|
||||
s16 LabelX_Navi=7 + !!CVar_GetS32("gNaviTextFix", 0);
|
||||
s16 LabelY_Navi=4;
|
||||
s16 C_Left_BTN_Pos[2]; //(X,Y)
|
||||
s16 C_Right_BTN_Pos[2];
|
||||
s16 C_Up_BTN_Pos[2];
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "../libultraship/ImGuiImpl.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
void* D_8012D1F0 = NULL;
|
||||
//UNK_TYPE D_8012D1F4 = 0; // unused
|
||||
Input* D_8012D1F8 = NULL;
|
||||
|
@ -201,7 +203,8 @@ void GivePlayerRandoRewardSongOfTime(GlobalContext* globalCtx, RandomizerCheck c
|
|||
!Flags_GetTreasure(globalCtx, 0x1F) && gSaveContext.nextTransition == 0xFF) {
|
||||
GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_SONG_OF_TIME);
|
||||
GiveItemWithoutActor(globalCtx, getItemId);
|
||||
Flags_SetTreasure(globalCtx, 0x1F);
|
||||
player->pendingFlag.flagID = 0x1F;
|
||||
player->pendingFlag.flagType = FLAG_SCENE_TREASURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -695,6 +698,11 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
|||
gTrnsnUnkState = 0;
|
||||
R_UPDATE_RATE = 3;
|
||||
}
|
||||
|
||||
// Don't autosave in grottos or cutscenes
|
||||
if (CVar_GetS32("gAutosave", 0) && (globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (globalCtx->sceneNum != SCENE_KAKUSIANA) && (gSaveContext.cutsceneIndex == 0)) {
|
||||
Gameplay_PerformSave(globalCtx);
|
||||
}
|
||||
}
|
||||
globalCtx->sceneLoadFlag = 0;
|
||||
} else {
|
||||
|
@ -1444,6 +1452,18 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
time_t Gameplay_GetRealTime() {
|
||||
time_t t1, t2;
|
||||
struct tm* tms;
|
||||
time(&t1);
|
||||
tms = localtime(&t1);
|
||||
tms->tm_hour = 0;
|
||||
tms->tm_min = 0;
|
||||
tms->tm_sec = 0;
|
||||
t2 = mktime(tms);
|
||||
return t1 - t2;
|
||||
}
|
||||
|
||||
void Gameplay_Main(GameState* thisx) {
|
||||
GlobalContext* globalCtx = (GlobalContext*)thisx;
|
||||
|
||||
|
@ -1487,6 +1507,20 @@ void Gameplay_Main(GameState* thisx) {
|
|||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1);
|
||||
}
|
||||
|
||||
if (CVar_GetS32("gTimeSync", 0)) {
|
||||
const int maxRealDaySeconds = 86400;
|
||||
const int maxInGameDayTicks = 65536;
|
||||
|
||||
int secs = (int)Gameplay_GetRealTime();
|
||||
float percent = (float)secs / (float)maxRealDaySeconds;
|
||||
|
||||
int newIngameTime = maxInGameDayTicks * percent;
|
||||
|
||||
gSaveContext.dayTime = newIngameTime;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// original name: "Game_play_demo_mode_check"
|
||||
|
@ -1943,3 +1977,19 @@ s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Gameplay_PerformSave(GlobalContext* globalCtx) {
|
||||
Gameplay_SaveSceneFlags(globalCtx);
|
||||
gSaveContext.savedSceneNum = globalCtx->sceneNum;
|
||||
if (gSaveContext.temporaryWeapon) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_NONE;
|
||||
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE);
|
||||
Save_SaveFile();
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
|
||||
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_SWORD_KOKIRI;
|
||||
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI);
|
||||
} else {
|
||||
Save_SaveFile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -442,62 +442,65 @@ void Sram_OpenSave() {
|
|||
|
||||
Save_LoadFile();
|
||||
|
||||
switch (gSaveContext.savedSceneNum) {
|
||||
case SCENE_YDAN:
|
||||
case SCENE_DDAN:
|
||||
case SCENE_BDAN:
|
||||
case SCENE_BMORI1:
|
||||
case SCENE_HIDAN:
|
||||
case SCENE_MIZUSIN:
|
||||
case SCENE_JYASINZOU:
|
||||
case SCENE_HAKADAN:
|
||||
case SCENE_HAKADANCH:
|
||||
case SCENE_ICE_DOUKUTO:
|
||||
case SCENE_GANON:
|
||||
case SCENE_MEN:
|
||||
case SCENE_GERUDOWAY:
|
||||
case SCENE_GANONTIKA:
|
||||
gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum];
|
||||
break;
|
||||
case SCENE_YDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 0;
|
||||
break;
|
||||
case SCENE_DDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 4;
|
||||
break;
|
||||
case SCENE_BDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 0x28;
|
||||
break;
|
||||
case SCENE_MORIBOSSROOM:
|
||||
gSaveContext.entranceIndex = 0x169;
|
||||
break;
|
||||
case SCENE_FIRE_BS:
|
||||
gSaveContext.entranceIndex = 0x165;
|
||||
break;
|
||||
case SCENE_MIZUSIN_BS:
|
||||
gSaveContext.entranceIndex = 0x10;
|
||||
break;
|
||||
case SCENE_JYASINBOSS:
|
||||
gSaveContext.entranceIndex = 0x82;
|
||||
break;
|
||||
case SCENE_HAKADAN_BS:
|
||||
gSaveContext.entranceIndex = 0x37;
|
||||
break;
|
||||
case SCENE_GANON_SONOGO:
|
||||
case SCENE_GANONTIKA_SONOGO:
|
||||
case SCENE_GANON_BOSS:
|
||||
case SCENE_GANON_FINAL:
|
||||
case SCENE_GANON_DEMO:
|
||||
gSaveContext.entranceIndex = 0x41B;
|
||||
break;
|
||||
if (!CVar_GetS32("gRememberSaveLocation", 0) || gSaveContext.savedSceneNum == SCENE_YOUSEI_IZUMI_TATE ||
|
||||
gSaveContext.savedSceneNum == SCENE_KAKUSIANA) {
|
||||
switch (gSaveContext.savedSceneNum) {
|
||||
case SCENE_YDAN:
|
||||
case SCENE_DDAN:
|
||||
case SCENE_BDAN:
|
||||
case SCENE_BMORI1:
|
||||
case SCENE_HIDAN:
|
||||
case SCENE_MIZUSIN:
|
||||
case SCENE_JYASINZOU:
|
||||
case SCENE_HAKADAN:
|
||||
case SCENE_HAKADANCH:
|
||||
case SCENE_ICE_DOUKUTO:
|
||||
case SCENE_GANON:
|
||||
case SCENE_MEN:
|
||||
case SCENE_GERUDOWAY:
|
||||
case SCENE_GANONTIKA:
|
||||
gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum];
|
||||
break;
|
||||
case SCENE_YDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 0;
|
||||
break;
|
||||
case SCENE_DDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 4;
|
||||
break;
|
||||
case SCENE_BDAN_BOSS:
|
||||
gSaveContext.entranceIndex = 0x28;
|
||||
break;
|
||||
case SCENE_MORIBOSSROOM:
|
||||
gSaveContext.entranceIndex = 0x169;
|
||||
break;
|
||||
case SCENE_FIRE_BS:
|
||||
gSaveContext.entranceIndex = 0x165;
|
||||
break;
|
||||
case SCENE_MIZUSIN_BS:
|
||||
gSaveContext.entranceIndex = 0x10;
|
||||
break;
|
||||
case SCENE_JYASINBOSS:
|
||||
gSaveContext.entranceIndex = 0x82;
|
||||
break;
|
||||
case SCENE_HAKADAN_BS:
|
||||
gSaveContext.entranceIndex = 0x37;
|
||||
break;
|
||||
case SCENE_GANON_SONOGO:
|
||||
case SCENE_GANONTIKA_SONOGO:
|
||||
case SCENE_GANON_BOSS:
|
||||
case SCENE_GANON_FINAL:
|
||||
case SCENE_GANON_DEMO:
|
||||
gSaveContext.entranceIndex = 0x41B;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) {
|
||||
gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4;
|
||||
} else {
|
||||
gSaveContext.entranceIndex = 0xBB;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) {
|
||||
gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4;
|
||||
} else {
|
||||
gSaveContext.entranceIndex = 0xBB;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue