You've already forked Shipwright
mirror of
https://github.com/CraftyBoss/Shipwright.git
synced 2026-07-14 05:07:46 -07:00
Merge remote-tracking branch 'origin/develop' into mod/ship-rando-improvements
This commit is contained in:
@@ -1239,10 +1239,10 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei
|
||||
u16 tlutCount, f32 offsetX, f32 offsetY);
|
||||
void func_80096FD4(PlayState* play, Room* room);
|
||||
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx);
|
||||
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum);
|
||||
s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum);
|
||||
s32 func_800973FC(PlayState* play, RoomContext* roomCtx);
|
||||
void Room_Draw(PlayState* play, Room* room, u32 flags);
|
||||
void func_80097534(PlayState* play, RoomContext* roomCtx);
|
||||
void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx);
|
||||
void Sample_Destroy(GameState* thisx);
|
||||
void Sample_Init(GameState* thisx);
|
||||
void Inventory_ChangeEquipment(s16 equipment, u16 value);
|
||||
|
||||
+2
-2
@@ -1084,7 +1084,7 @@ typedef struct {
|
||||
/* 0x00 */ Room curRoom;
|
||||
/* 0x14 */ Room prevRoom;
|
||||
/* 0x28 */ void* bufPtrs[2];
|
||||
/* 0x30 */ u8 unk_30;
|
||||
/* 0x30 */ u8 activeBufPage;
|
||||
/* 0x31 */ s8 status;
|
||||
/* 0x34 */ void* unk_34;
|
||||
/* 0x38 */ DmaRequest dmaRequest;
|
||||
@@ -1477,7 +1477,7 @@ typedef struct PlayState {
|
||||
/* 0x11E14 */ u8 skyboxId;
|
||||
/* 0x11E15 */ s8 transitionTrigger; // "fade_direction"
|
||||
/* 0x11E16 */ s16 unk_11E16;
|
||||
/* 0x11E18 */ s16 unk_11E18;
|
||||
/* 0x11E18 */ s16 bgCoverAlpha;
|
||||
/* 0x11E1A */ s16 nextEntranceIndex;
|
||||
/* 0x11E1C */ char unk_11E1C[0x40];
|
||||
/* 0x11E5C */ s8 shootingGalleryStatus;
|
||||
|
||||
@@ -472,4 +472,41 @@ typedef struct {
|
||||
/* 0x24 */ char unk_24[0x4];
|
||||
} NpcInteractInfo; // size = 0x28
|
||||
|
||||
// Converts a number of bits to a bitmask, helper for params macros
|
||||
// e.g. 3 becomes 0b111 (7)
|
||||
#define NBITS_TO_MASK(n) \
|
||||
((1 << (n)) - 1)
|
||||
|
||||
// Extracts the `n`-bit value at position `s` in `p`, shifts then masks
|
||||
// Unsigned variant, no possibility of sign extension
|
||||
#define PARAMS_GET_U(p, s, n) \
|
||||
(((p) >> (s)) & NBITS_TO_MASK(n))
|
||||
|
||||
// Extracts the `n`-bit value at position `s` in `p`, masks then shifts
|
||||
// Signed variant, possibility of sign extension
|
||||
#define PARAMS_GET_S(p, s, n) \
|
||||
(((p) & (NBITS_TO_MASK(n) << (s))) >> (s))
|
||||
|
||||
// Extracts all bits past position `s` in `p`
|
||||
#define PARAMS_GET_NOMASK(p, s) \
|
||||
((p) >> (s))
|
||||
|
||||
// Extracts the `n`-bit value at position `s` in `p` without shifting it from its current position
|
||||
#define PARAMS_GET_NOSHIFT(p, s, n) \
|
||||
((p) & (NBITS_TO_MASK(n) << (s)))
|
||||
|
||||
// Moves the `n`-bit value `p` to bit position `s` for building actor parameters by OR-ing these together
|
||||
#define PARAMS_PACK(p, s, n) \
|
||||
(((p) & NBITS_TO_MASK(n)) << (s))
|
||||
|
||||
// Moves the value `p` to bit position `s` for building actor parameters by OR-ing these together.
|
||||
#define PARAMS_PACK_NOMASK(p, s) \
|
||||
((p) << (s))
|
||||
|
||||
// Generates a bitmask for bit position `s` of length `n`
|
||||
#define PARAMS_MAKE_MASK(s, n) PARAMS_GET_NOSHIFT(~0, s, n)
|
||||
|
||||
#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10
|
||||
#define GET_TRANSITION_ACTOR_INDEX(actor) PARAMS_GET_NOMASK((u16)(actor)->params, 10)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -292,7 +292,7 @@ typedef struct {
|
||||
/* 0x1354 */ s32 fileNum; // "file_no"
|
||||
/* 0x1358 */ char unk_1358[0x0004];
|
||||
/* 0x135C */ s32 gameMode;
|
||||
/* 0x1360 */ s32 sceneSetupIndex; // "counter" // Upstream TODO: sceneLayer
|
||||
/* 0x1360 */ s32 sceneLayer; // "counter"
|
||||
/* 0x1364 */ s32 respawnFlag; // "restart_flag"
|
||||
/* 0x1368 */ RespawnData respawn[RESPAWN_MODE_MAX]; // "restart_data"
|
||||
/* 0x13BC */ f32 entranceSpeed;
|
||||
@@ -423,7 +423,7 @@ typedef enum {
|
||||
/* 4 */ SCENE_LAYER_CUTSCENE_FIRST
|
||||
} SceneLayer;
|
||||
|
||||
#define IS_CUTSCENE_LAYER (gSaveContext.sceneSetupIndex >= SCENE_LAYER_CUTSCENE_FIRST)
|
||||
#define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ LINK_AGE_ADULT,
|
||||
|
||||
@@ -808,6 +808,9 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li
|
||||
Flags_SetRandomizerInf(flag);
|
||||
gSaveContext.healthAccumulator = MAX_HEALTH;
|
||||
Magic_Fill(gPlayState);
|
||||
// Also prevent the cutscene from playing, technically we could let it play in rando but we'd
|
||||
// need to VB prevent the item gives that happen during the cutscene.
|
||||
*should = false;
|
||||
} else {
|
||||
// If we're in vanilla, set the flag _if_ we were eligble, so that anchor can send the reward in
|
||||
// co-op
|
||||
|
||||
@@ -57,7 +57,7 @@ void Warp(WarpPoint& warpPoint) {
|
||||
gSaveContext.magicCapacity = 0;
|
||||
gSaveContext.magicLevel = gSaveContext.magic;
|
||||
gSaveContext.fileNum = 0xFF;
|
||||
gSaveContext.sceneSetupIndex = 0;
|
||||
gSaveContext.sceneLayer = 0;
|
||||
gSaveContext.cutsceneIndex = 0;
|
||||
gSaveContext.linkAge = 0;
|
||||
gSaveContext.nightFlag = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ void Mouse_UpdateAll() {
|
||||
}
|
||||
|
||||
void Mouse_HandleThirdPerson(f32* newCamX, f32* newCamY) {
|
||||
if (MOUSE_ENABLED) {
|
||||
if (MOUSE_ENABLED && !CVarGetInteger(CVAR_SETTING("DisableThirdPersonMouse"), 0)) {
|
||||
*newCamX -= mouseCoordRel.x * 40.0f;
|
||||
*newCamY -= mouseCoordRel.y * 40.0f;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ static s32 mouseQuickspinY[5] = {};
|
||||
static u8 quickspinCount = 0;
|
||||
|
||||
void Mouse_UpdateQuickspinCount() {
|
||||
if (MOUSE_ENABLED) {
|
||||
if (MOUSE_ENABLED && !CVarGetInteger(CVAR_SETTING("DisableThirdPersonMouse"), 0)) {
|
||||
quickspinCount = (quickspinCount + 1) % 5;
|
||||
mouseQuickspinX[quickspinCount] = mouseCoord.x;
|
||||
mouseQuickspinY[quickspinCount] = mouseCoord.y;
|
||||
@@ -97,7 +97,7 @@ bool Mouse_HandleQuickspin(bool* should, s8* iter2, s8* sp3C) {
|
||||
s8 temp1;
|
||||
s8 temp2;
|
||||
s32 i;
|
||||
if (!MOUSE_ENABLED) {
|
||||
if (!MOUSE_ENABLED || CVarGetInteger(CVAR_SETTING("DisableThirdPersonMouse"), 0)) {
|
||||
return *should = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ using namespace UIWidgets;
|
||||
static WidgetInfo freeLook;
|
||||
static WidgetInfo mouseControl;
|
||||
static WidgetInfo mouseAutoCapture;
|
||||
static WidgetInfo mouseDisableThirdPerson;
|
||||
static WidgetInfo rightStickOcarina;
|
||||
static WidgetInfo dpadOcarina;
|
||||
static WidgetInfo dpadPause;
|
||||
@@ -1377,6 +1378,10 @@ void SohInputEditorWindow::DrawCameraControlPanel() {
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
SohGui::mSohMenu->MenuDrawItem(mouseAutoCapture, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
|
||||
THEME_COLOR);
|
||||
cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
SohGui::mSohMenu->MenuDrawItem(mouseDisableThirdPerson, static_cast<uint32_t>(ImGui::GetContentRegionAvail().x),
|
||||
THEME_COLOR);
|
||||
|
||||
Ship::GuiWindow::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
|
||||
CVarCheckbox("Right Stick Aiming", CVAR_SETTING("Controls.RightStickAim"),
|
||||
@@ -1909,6 +1914,19 @@ void RegisterInputEditorWidgets() {
|
||||
"and capture mouse input when closing the menu."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ mouseAutoCapture, "Settings", "Controls", "Camera Controls" });
|
||||
|
||||
mouseDisableThirdPerson = { .name = "Disable Third-Person Mouse Controls",
|
||||
.type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
mouseDisableThirdPerson.CVar(CVAR_SETTING("DisableThirdPersonMouse"))
|
||||
.PreFunc([](WidgetInfo& info) {
|
||||
info.options->disabled = !CVarGetInteger(CVAR_SETTING("EnableMouse"), 0);
|
||||
info.options->disabledTooltip = "Forced off because Mouse Controls are disabled.";
|
||||
})
|
||||
.Options(CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Stops the mouse from moving the third-person camera and from triggering quickspins, "
|
||||
"while still allowing mouse control for first-person aiming and the shield."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ mouseDisableThirdPerson, "Settings", "Controls", "Camera Controls" });
|
||||
|
||||
rightStickOcarina = { .name = "Right Stick Ocarina Playback", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
rightStickOcarina.CVar(CVAR_SETTING("CustomOcarina.RightStick")).Options(CheckboxOptions().Color(THEME_COLOR));
|
||||
SohGui::mSohMenu->AddSearchWidget({ rightStickOcarina, "Settings", "Controls", "Ocarina Controls" });
|
||||
|
||||
@@ -2186,7 +2186,7 @@ void RandomizerOnSceneInitHandler(int16_t sceneNum) {
|
||||
// Reset room ctx back to prev room and then load the new room
|
||||
gPlayState->roomCtx.status = 0;
|
||||
gPlayState->roomCtx.curRoom = gPlayState->roomCtx.prevRoom;
|
||||
func_8009728C(gPlayState, &gPlayState->roomCtx, replacedRoom);
|
||||
Room_RequestNewRoom(gPlayState, &gPlayState->roomCtx, replacedRoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -590,7 +590,7 @@ void Entrance_OverrideWeatherState() {
|
||||
gPlayState->envCtx.gloomySkyMode = 0;
|
||||
|
||||
// Weather only applyies to adult link
|
||||
if (LINK_IS_CHILD || gSaveContext.sceneSetupIndex >= 4) {
|
||||
if (LINK_IS_CHILD || gSaveContext.sceneLayer >= 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ void SetStartingItems() {
|
||||
|
||||
uint8_t startBow = Randomizer_GetSettingValue(RSK_STARTING_BOW);
|
||||
if (startBow >= 1)
|
||||
Item_Give(NULL, ITEM_QUIVER_30);
|
||||
Item_Give(NULL, ITEM_BOW);
|
||||
if (startBow >= 2)
|
||||
Item_Give(NULL, ITEM_QUIVER_40);
|
||||
if (startBow >= 3)
|
||||
|
||||
+19
-12
@@ -1020,13 +1020,24 @@ std::unordered_map<std::string, ExtensionEntry> ExtensionCache;
|
||||
|
||||
void OTRAudio_Thread() {
|
||||
#define SAMPLES_HIGH 560
|
||||
#define SAMPLES_MID 544
|
||||
#define SAMPLES_LOW 528
|
||||
#define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1)
|
||||
#define NUM_AUDIO_CHANNELS 2
|
||||
|
||||
// Single producer routine used by both the wake-driven and pre-buffer
|
||||
// loops. Captures the per-iteration sample count from the caller.
|
||||
auto produce_and_play = [&](u32 num_audio_samples) {
|
||||
// The sequencer advances a fixed slice of musical time per engine update
|
||||
// (tempoInternalToExternal in audio_heap.c assumes 60 updates/sec), so with
|
||||
// production paced by backend buffer fill the sample count must average
|
||||
// exactly 32000/60 = 533.33 per update or tempo drifts.
|
||||
// Two thirds 528 one third 544 gives 533.33.
|
||||
int32_t sample_debt_thirds = 0;
|
||||
|
||||
// Single producer routine used by both wake-driven and pre-buffer loops.
|
||||
// Picks per-iteration sample count itself, then produces and plays it.
|
||||
auto produce_next_batch = [&]() {
|
||||
u32 num_audio_samples = sample_debt_thirds > 0 ? SAMPLES_MID : SAMPLES_LOW;
|
||||
sample_debt_thirds += (1600 - 3 * (int32_t)num_audio_samples) * AUDIO_FRAMES_PER_UPDATE;
|
||||
|
||||
const u32 total_frames = num_audio_samples * AUDIO_FRAMES_PER_UPDATE;
|
||||
const u32 total_samples = total_frames * NUM_AUDIO_CHANNELS;
|
||||
|
||||
@@ -1077,18 +1088,16 @@ void OTRAudio_Thread() {
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||
int samples_left = AudioPlayer_Buffered();
|
||||
u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
||||
|
||||
// Producer guard (banteg/Shipwright#6594): skip advancing the audio
|
||||
// engine if the backend ring cannot accept the smallest next burst.
|
||||
// engine if the backend ring cannot accept the largest next burst.
|
||||
// Generating PCM that DoPlay() would refuse creates a discontinuity
|
||||
// audible as a click. The pre-buffer loop below will catch up once
|
||||
// the backend drains enough.
|
||||
if (AudioPlayer_Buffered() + SAMPLES_LOW * AUDIO_FRAMES_PER_UPDATE > AudioPlayer_GetDesiredBuffered()) {
|
||||
if (AudioPlayer_Buffered() + SAMPLES_MID * AUDIO_FRAMES_PER_UPDATE > AudioPlayer_GetDesiredBuffered()) {
|
||||
audio.processing = false;
|
||||
} else {
|
||||
produce_and_play(num_audio_samples);
|
||||
produce_next_batch();
|
||||
audio.processing = false;
|
||||
}
|
||||
}
|
||||
@@ -1099,12 +1108,10 @@ void OTRAudio_Thread() {
|
||||
// The producer guard (same as above) prevents advancing the audio engine
|
||||
// when the backend ring is already at capacity.
|
||||
while (audio.running && AudioPlayer_Buffered() < AudioPlayer_GetDesiredBuffered()) {
|
||||
if (AudioPlayer_Buffered() + SAMPLES_LOW * AUDIO_FRAMES_PER_UPDATE > AudioPlayer_GetDesiredBuffered()) {
|
||||
if (AudioPlayer_Buffered() + SAMPLES_MID * AUDIO_FRAMES_PER_UPDATE > AudioPlayer_GetDesiredBuffered()) {
|
||||
break;
|
||||
}
|
||||
int samples_left = AudioPlayer_Buffered();
|
||||
u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
||||
produce_and_play(num_audio_samples);
|
||||
produce_next_batch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2564,7 +2564,7 @@ typedef struct {
|
||||
/* 0x1354 */ s32 fileNum; // "file_no"
|
||||
/* 0x1358 */ char unk_1358[0x0004];
|
||||
/* 0x135C */ s32 gameMode;
|
||||
/* 0x1360 */ s32 sceneSetupIndex;
|
||||
/* 0x1360 */ s32 sceneLayer;
|
||||
/* 0x1364 */ s32 respawnFlag; // "restart_flag"
|
||||
/* 0x1368 */ RespawnData_v0 respawn[3]; // "restart_data"
|
||||
/* 0x13BC */ f32 entranceSpeed;
|
||||
|
||||
@@ -338,11 +338,11 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, SOH::ISceneCommand* cmd)
|
||||
|
||||
// osSyncPrintf("\n[ZU]sceneset age =[%X]", gSaveContext.linkAge);
|
||||
// osSyncPrintf("\n[ZU]sceneset time =[%X]", gSaveContext.cutsceneIndex);
|
||||
// osSyncPrintf("\n[ZU]sceneset counter=[%X]", gSaveContext.sceneSetupIndex);
|
||||
// osSyncPrintf("\n[ZU]sceneset counter=[%X]", gSaveContext.sceneLayer);
|
||||
|
||||
if (gSaveContext.sceneSetupIndex != 0) {
|
||||
if (gSaveContext.sceneLayer != 0) {
|
||||
SOH::Scene* desiredHeader =
|
||||
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 1]).get();
|
||||
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneLayer - 1]).get();
|
||||
|
||||
if (desiredHeader != nullptr) {
|
||||
OTRScene_ExecuteCommands(play, desiredHeader);
|
||||
@@ -351,9 +351,9 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, SOH::ISceneCommand* cmd)
|
||||
// "Coughh! There is no specified dataaaaa!"
|
||||
osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!");
|
||||
|
||||
if (gSaveContext.sceneSetupIndex == 3) {
|
||||
if (gSaveContext.sceneLayer == 3) {
|
||||
SOH::Scene* desiredHeader =
|
||||
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 2]).get();
|
||||
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneLayer - 2]).get();
|
||||
|
||||
// "Using adult day data there!"
|
||||
osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!");
|
||||
@@ -487,7 +487,7 @@ extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
|
||||
extern "C" s32 OTRRoom_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
|
||||
u32 size;
|
||||
|
||||
if (roomCtx->status == 0) {
|
||||
@@ -502,8 +502,8 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN
|
||||
return 0; // UH OH
|
||||
|
||||
size = static_cast<u32>(play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart);
|
||||
roomCtx->unk_34 =
|
||||
(void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
|
||||
roomCtx->unk_34 = (void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->activeBufPage] -
|
||||
((size + 8) * roomCtx->activeBufPage + 7));
|
||||
|
||||
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
|
||||
// DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0,
|
||||
@@ -514,7 +514,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN
|
||||
roomCtx->status = 1;
|
||||
roomCtx->roomToLoad = roomData.get();
|
||||
|
||||
roomCtx->unk_30 ^= 1;
|
||||
roomCtx->activeBufPage ^= 1;
|
||||
|
||||
SPDLOG_INFO("Room Init - curRoom.num: {0:#x}", roomCtx->curRoom.num);
|
||||
|
||||
|
||||
@@ -158,14 +158,14 @@ void func_800645A0(PlayState* play, CutsceneContext* csCtx) {
|
||||
Input* input = &play->state.input[0];
|
||||
|
||||
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(input->press.button, BTN_DLEFT) &&
|
||||
(csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4)) {
|
||||
(csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneLayer >= 4)) {
|
||||
D_8015FCC8 = 0;
|
||||
gSaveContext.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
}
|
||||
|
||||
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(input->press.button, BTN_DUP) &&
|
||||
(csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4) && !gDbgCamEnabled) {
|
||||
(csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneLayer >= 4) && !gDbgCamEnabled) {
|
||||
D_8015FCC8 = 1;
|
||||
gSaveContext.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
@@ -643,7 +643,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
|
||||
gSaveContext.cutsceneIndex = 0xFFF3;
|
||||
play->transitionType = TRANS_TYPE_INSTANT;
|
||||
} else {
|
||||
if (gSaveContext.sceneSetupIndex < 4) {
|
||||
if (gSaveContext.sceneLayer < 4) {
|
||||
if (!LINK_IS_ADULT) {
|
||||
play->linkAgeOnLoad = 0;
|
||||
} else {
|
||||
@@ -1107,7 +1107,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
|
||||
gSaveContext.cutsceneIndex = 0xFFF3;
|
||||
play->transitionType = TRANS_TYPE_FADE_BLACK;
|
||||
} else {
|
||||
switch (gSaveContext.sceneSetupIndex) {
|
||||
switch (gSaveContext.sceneLayer) {
|
||||
case 8:
|
||||
play->nextEntranceIndex = ENTR_SACRED_FOREST_MEADOW_SOUTH_EXIT;
|
||||
play->transitionTrigger = TRANS_TRIGGER_START;
|
||||
|
||||
@@ -258,7 +258,7 @@ void Horse_InitPlayerHorse(PlayState* play, Player* player) {
|
||||
}
|
||||
|
||||
if (Horse_CanSpawn(play->sceneNum)) {
|
||||
if ((gSaveContext.sceneSetupIndex > 3) ||
|
||||
if ((gSaveContext.sceneLayer > 3) ||
|
||||
((gSaveContext.entranceIndex == ENTR_HYRULE_FIELD_11 ||
|
||||
gSaveContext.entranceIndex == ENTR_HYRULE_FIELD_12 ||
|
||||
gSaveContext.entranceIndex == ENTR_HYRULE_FIELD_13 ||
|
||||
|
||||
@@ -336,7 +336,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
|
||||
play->envCtx.unk_F2[0] = 0;
|
||||
|
||||
if (gSaveContext.retainWeatherMode != 0) {
|
||||
if (((void)0, gSaveContext.sceneSetupIndex) < 4) {
|
||||
if (((void)0, gSaveContext.sceneLayer) < 4) {
|
||||
switch (gWeatherMode) {
|
||||
case 1:
|
||||
envCtx->unk_17 = 1;
|
||||
@@ -936,7 +936,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
||||
}
|
||||
|
||||
//! @bug `gTimeIncrement` is unsigned, it can't be negative
|
||||
if (((((void)0, gSaveContext.sceneSetupIndex) >= 5 || gTimeIncrement != 0) &&
|
||||
if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeIncrement != 0) &&
|
||||
((void)0, gSaveContext.dayTime) > gSaveContext.skyboxTime) ||
|
||||
(((void)0, gSaveContext.dayTime) < 0xAAB || gTimeIncrement < 0)) {
|
||||
gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime);
|
||||
@@ -1321,8 +1321,7 @@ void Environment_DrawSunAndMoon(PlayState* play) {
|
||||
play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f;
|
||||
}
|
||||
|
||||
if (gSaveContext.entranceIndex != ENTR_HYRULE_FIELD_PAST_BRIDGE_SPAWN ||
|
||||
((void)0, gSaveContext.sceneSetupIndex) != 5) {
|
||||
if (gSaveContext.entranceIndex != ENTR_HYRULE_FIELD_PAST_BRIDGE_SPAWN || ((void)0, gSaveContext.sceneLayer) != 5) {
|
||||
Matrix_Translate(play->view.eye.x + play->envCtx.sunPos.x, play->view.eye.y + play->envCtx.sunPos.y,
|
||||
play->view.eye.z + play->envCtx.sunPos.z, MTXMODE_NEW);
|
||||
|
||||
|
||||
@@ -3204,7 +3204,7 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
case MAGIC_STATE_FILL:
|
||||
gSaveContext.magic += 4;
|
||||
|
||||
if (gSaveContext.gameMode == GAMEMODE_NORMAL && gSaveContext.sceneSetupIndex < 4) {
|
||||
if (gSaveContext.gameMode == GAMEMODE_NORMAL && gSaveContext.sceneLayer < 4) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_GAUGE_UP - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
@@ -6576,8 +6576,8 @@ void Interface_Update(PlayState* play) {
|
||||
}
|
||||
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
|
||||
if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) ||
|
||||
((play->sceneNum == SCENE_LON_LON_RANCH) && (gSaveContext.sceneSetupIndex == 4))) {
|
||||
if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneLayer < 4) ||
|
||||
((play->sceneNum == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == 4))) {
|
||||
if ((msgCtx->msgMode == MSGMODE_NONE) ||
|
||||
((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneNum == SCENE_BOMBCHU_BOWLING_ALLEY))) {
|
||||
if (play->gameOverCtx.state == GAMEOVER_INACTIVE) {
|
||||
|
||||
+15
-15
@@ -446,38 +446,38 @@ void Play_Init(GameState* thisx) {
|
||||
if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.cutsceneIndex >= 0xFFF0) {
|
||||
gSaveContext.nayrusLoveTimer = 0;
|
||||
Magic_Reset(play);
|
||||
gSaveContext.sceneSetupIndex = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF);
|
||||
gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF);
|
||||
} else if (!LINK_IS_ADULT && IS_DAY) {
|
||||
gSaveContext.sceneSetupIndex = SCENE_LAYER_CHILD_DAY;
|
||||
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY;
|
||||
} else if (!LINK_IS_ADULT && !IS_DAY) {
|
||||
gSaveContext.sceneSetupIndex = SCENE_LAYER_CHILD_NIGHT;
|
||||
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_NIGHT;
|
||||
} else if (LINK_IS_ADULT && IS_DAY) {
|
||||
gSaveContext.sceneSetupIndex = SCENE_LAYER_ADULT_DAY;
|
||||
gSaveContext.sceneLayer = SCENE_LAYER_ADULT_DAY;
|
||||
} else {
|
||||
gSaveContext.sceneSetupIndex = SCENE_LAYER_ADULT_NIGHT;
|
||||
gSaveContext.sceneLayer = SCENE_LAYER_ADULT_NIGHT;
|
||||
}
|
||||
|
||||
// save the base scene layer (before accounting for the special cases below) to use later for the transition type
|
||||
baseSceneLayer = gSaveContext.sceneSetupIndex;
|
||||
baseSceneLayer = gSaveContext.sceneLayer;
|
||||
|
||||
if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_HYRULE_FIELD) && !LINK_IS_ADULT &&
|
||||
!IS_CUTSCENE_LAYER) {
|
||||
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
|
||||
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
|
||||
gSaveContext.sceneSetupIndex = 1;
|
||||
gSaveContext.sceneLayer = 1;
|
||||
} else {
|
||||
gSaveContext.sceneSetupIndex = 0;
|
||||
gSaveContext.sceneLayer = 0;
|
||||
}
|
||||
} else if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_KOKIRI_FOREST) && LINK_IS_ADULT &&
|
||||
!IS_CUTSCENE_LAYER) {
|
||||
gSaveContext.sceneSetupIndex = (Flags_GetEventChkInf(EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP)) ? 3 : 2;
|
||||
gSaveContext.sceneLayer = (Flags_GetEventChkInf(EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP)) ? 3 : 2;
|
||||
}
|
||||
|
||||
Play_SpawnScene(
|
||||
play, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene,
|
||||
gEntranceTable[((void)0, gSaveContext.sceneSetupIndex) + ((void)0, gSaveContext.entranceIndex)].spawn);
|
||||
Play_SpawnScene(play,
|
||||
gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].scene,
|
||||
gEntranceTable[((void)0, gSaveContext.sceneLayer) + ((void)0, gSaveContext.entranceIndex)].spawn);
|
||||
|
||||
osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneSetupIndex);
|
||||
osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneLayer);
|
||||
|
||||
#if 0
|
||||
// When entering Gerudo Valley in the credits, trigger the GC emulator to play the ending movie.
|
||||
@@ -525,7 +525,7 @@ void Play_Init(GameState* thisx) {
|
||||
play->state.destroy = Play_Destroy;
|
||||
play->transitionTrigger = TRANS_TRIGGER_END;
|
||||
play->unk_11E16 = 0xFF;
|
||||
play->unk_11E18 = 0;
|
||||
play->bgCoverAlpha = 0;
|
||||
play->unk_11DE9 = false;
|
||||
|
||||
if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) {
|
||||
@@ -1542,7 +1542,7 @@ void Play_Draw(PlayState* play) {
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(84) != 0)) {
|
||||
Environment_FillScreen(gfxCtx, 0, 0, 0, play->unk_11E18, FILL_SCREEN_OPA);
|
||||
Environment_FillScreen(gfxCtx, 0, 0, 0, play->bgCoverAlpha, FILL_SCREEN_OPA);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(85) != 0)) {
|
||||
|
||||
@@ -34,7 +34,7 @@ Gfx D_801270B0[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum);
|
||||
s32 OTRRoom_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum);
|
||||
s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx);
|
||||
|
||||
void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = {
|
||||
@@ -570,20 +570,20 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
|
||||
// "Room buffer end pointer=%08x"
|
||||
osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]);
|
||||
osSyncPrintf(VT_RST);
|
||||
roomCtx->unk_30 = 0;
|
||||
roomCtx->activeBufPage = 0;
|
||||
roomCtx->status = 0;
|
||||
|
||||
frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex)
|
||||
: play->setupEntranceList[play->curSpawn].room;
|
||||
func_8009728C(play, roomCtx, frontRoom);
|
||||
Room_RequestNewRoom(play, roomCtx, frontRoom);
|
||||
|
||||
return maxRoomSize;
|
||||
}
|
||||
|
||||
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
|
||||
s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
|
||||
size_t size;
|
||||
|
||||
return OTRfunc_8009728C(play, roomCtx, roomNum);
|
||||
return OTRRoom_RequestNewRoom(play, roomCtx, roomNum);
|
||||
|
||||
if (roomCtx->status == 0) {
|
||||
roomCtx->prevRoom = roomCtx->curRoom;
|
||||
@@ -594,13 +594,13 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
|
||||
assert(roomNum < play->numRooms);
|
||||
|
||||
size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart;
|
||||
roomCtx->unk_34 =
|
||||
(void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
|
||||
roomCtx->unk_34 = (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->activeBufPage] -
|
||||
((size + 8) * roomCtx->activeBufPage + 7));
|
||||
|
||||
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
|
||||
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0,
|
||||
&roomCtx->loadQueue, OS_MESG_PTR(NULL), __FILE__, __LINE__);
|
||||
roomCtx->unk_30 ^= 1;
|
||||
roomCtx->activeBufPage ^= 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -638,7 +638,7 @@ void Room_Draw(PlayState* play, Room* room, u32 flags) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80097534(PlayState* play, RoomContext* roomCtx) {
|
||||
void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx) {
|
||||
roomCtx->prevRoom.num = -1;
|
||||
roomCtx->prevRoom.segment = NULL;
|
||||
func_80031B14(play, &play->actorCtx); // kills all actors without room num set to -1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user