mirror of
https://github.com/zeldaret/oot
synced 2026-06-18 23:36:58 -04:00
[ntsc-1.2] Match game.c, z_play.c, z_room.c (#2117)
* Match z_room.c * Match game.c and z_play.c * Add undefined syms * Rewrite condition based on other file matches
This commit is contained in:
+83
-5
@@ -1,11 +1,12 @@
|
||||
|
||||
#include "global.h"
|
||||
#if OOT_DEBUG
|
||||
#include "fault.h"
|
||||
#endif
|
||||
#include "quake.h"
|
||||
#include "terminal.h"
|
||||
#include "versions.h"
|
||||
#if PLATFORM_N64
|
||||
#include "n64dd.h"
|
||||
#endif
|
||||
|
||||
#include "z64frame_advance.h"
|
||||
|
||||
@@ -175,7 +176,9 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
|
||||
break;
|
||||
|
||||
default:
|
||||
#if OOT_VERSION < GC_EU_MQ_DBG
|
||||
#if PLATFORM_N64
|
||||
HUNGUP_AND_CRASH("../z_play.c", 2269);
|
||||
#elif OOT_VERSION < GC_EU_MQ_DBG
|
||||
HUNGUP_AND_CRASH("../z_play.c", 2287);
|
||||
#elif OOT_VERSION < GC_JP_CE
|
||||
HUNGUP_AND_CRASH("../z_play.c", 2290);
|
||||
@@ -239,6 +242,12 @@ void Play_Destroy(GameState* thisx) {
|
||||
KaleidoManager_Destroy();
|
||||
ZeldaArena_Cleanup();
|
||||
|
||||
#if PLATFORM_N64
|
||||
if ((B_80121AF0 != NULL) && (B_80121AF0->unk_14 != NULL)) {
|
||||
B_80121AF0->unk_14(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OOT_DEBUG
|
||||
Fault_RemoveClient(&D_801614B8);
|
||||
#endif
|
||||
@@ -268,6 +277,13 @@ void Play_Init(GameState* thisx) {
|
||||
#endif
|
||||
|
||||
GameState_Realloc(&this->state, 0x1D4790);
|
||||
|
||||
#if PLATFORM_N64
|
||||
if ((B_80121AF0 != NULL) && (B_80121AF0->unk_10 != NULL)) {
|
||||
B_80121AF0->unk_10(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
KaleidoManager_Init(this);
|
||||
View_Init(&this->view, gfxCtx);
|
||||
Audio_SetExtraFilter(0);
|
||||
@@ -360,6 +376,7 @@ void Play_Init(GameState* thisx) {
|
||||
|
||||
PRINTF("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.save.entranceIndex), gSaveContext.sceneLayer);
|
||||
|
||||
#if PLATFORM_GC
|
||||
// When entering Gerudo Valley in the credits, trigger the GC emulator to play the ending movie.
|
||||
// The emulator constantly checks whether PC is 0x81000000, so this works even though it's not a valid address.
|
||||
if ((gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GERUDO_VALLEY) &&
|
||||
@@ -368,8 +385,17 @@ void Play_Init(GameState* thisx) {
|
||||
((void (*)(void))0x81000000)();
|
||||
PRINTF(T("出戻り?\n", "Return?\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PLATFORM_N64
|
||||
if ((B_80121AF0 != NULL && B_80121AF0->unk_54 != NULL && B_80121AF0->unk_54(this))) {
|
||||
} else {
|
||||
Cutscene_HandleEntranceTriggers(this);
|
||||
}
|
||||
#else
|
||||
Cutscene_HandleEntranceTriggers(this);
|
||||
#endif
|
||||
|
||||
KaleidoScopeCall_Init(this);
|
||||
Interface_Init(this);
|
||||
|
||||
@@ -1058,6 +1084,10 @@ skip:
|
||||
}
|
||||
|
||||
void Play_DrawOverlayElements(PlayState* this) {
|
||||
#if PLATFORM_N64
|
||||
s32 pad;
|
||||
#endif
|
||||
|
||||
if (IS_PAUSED(&this->pauseCtx)) {
|
||||
KaleidoScopeCall_Draw(this);
|
||||
}
|
||||
@@ -1147,7 +1177,12 @@ void Play_Draw(PlayState* this) {
|
||||
|
||||
TransitionFade_Draw(&this->transitionFadeFlash, &gfxP);
|
||||
|
||||
if (gVisMonoColor.a > 0) {
|
||||
#if PLATFORM_N64
|
||||
if (gVisMonoColor.a != 0)
|
||||
#else
|
||||
if (gVisMonoColor.a > 0)
|
||||
#endif
|
||||
{
|
||||
gPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba;
|
||||
VisMono_Draw(&gPlayVisMono, &gfxP);
|
||||
}
|
||||
@@ -1457,6 +1492,19 @@ void* Play_LoadFile(PlayState* this, RomFile* file) {
|
||||
return allocp;
|
||||
}
|
||||
|
||||
#if PLATFORM_N64
|
||||
void* Play_LoadFileFromDiskDrive(PlayState* this, RomFile* file) {
|
||||
u32 size;
|
||||
void* allocp;
|
||||
|
||||
size = file->vromEnd - file->vromStart;
|
||||
allocp = THA_AllocTailAlign16(&this->state.tha, size);
|
||||
func_801C8510_unknown(allocp, file->vromStart, size);
|
||||
|
||||
return allocp;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Play_InitEnvironment(PlayState* this, s16 skyboxId) {
|
||||
Skybox_Init(&this->state, &this->skyboxCtx, skyboxId);
|
||||
Environment_Init(this, &this->envCtx, 0);
|
||||
@@ -1485,24 +1533,52 @@ void Play_InitScene(PlayState* this, s32 spawn) {
|
||||
}
|
||||
|
||||
void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) {
|
||||
SceneTableEntry* scene = &gSceneTable[sceneId];
|
||||
SceneTableEntry* scene;
|
||||
u32 size;
|
||||
|
||||
#if PLATFORM_N64
|
||||
if ((B_80121AF0 != NULL) && (B_80121AF0->unk_48 != NULL)) {
|
||||
scene = B_80121AF0->unk_48(sceneId, gSceneTable);
|
||||
} else {
|
||||
scene = &gSceneTable[sceneId];
|
||||
scene->unk_13 = 0;
|
||||
}
|
||||
#else
|
||||
scene = &gSceneTable[sceneId];
|
||||
scene->unk_13 = 0;
|
||||
#endif
|
||||
|
||||
this->loadedScene = scene;
|
||||
this->sceneId = sceneId;
|
||||
this->sceneDrawConfig = scene->drawConfig;
|
||||
|
||||
PRINTF("\nSCENE SIZE %fK\n", (scene->sceneFile.vromEnd - scene->sceneFile.vromStart) / 1024.0f);
|
||||
|
||||
#if PLATFORM_N64
|
||||
if ((B_80121AF0 != NULL) && (scene->unk_12 > 0)) {
|
||||
this->sceneSegment = Play_LoadFileFromDiskDrive(this, &scene->sceneFile);
|
||||
scene->unk_13 = 1;
|
||||
} else {
|
||||
this->sceneSegment = Play_LoadFile(this, &scene->sceneFile);
|
||||
scene->unk_13 = 0;
|
||||
}
|
||||
#else
|
||||
this->sceneSegment = Play_LoadFile(this, &scene->sceneFile);
|
||||
scene->unk_13 = 0;
|
||||
#endif
|
||||
|
||||
ASSERT(this->sceneSegment != NULL, "this->sceneSegment != NULL", "../z_play.c", 4960);
|
||||
|
||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
|
||||
|
||||
Play_InitScene(this, spawn);
|
||||
|
||||
#if PLATFORM_N64
|
||||
if ((B_80121AF0 != NULL) && (B_80121AF0->unk_0C != NULL)) {
|
||||
B_80121AF0->unk_0C(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
size = func_80096FE8(this, &this->roomCtx);
|
||||
|
||||
PRINTF("ROOM SIZE=%fK\n", size / 1024.0f);
|
||||
@@ -1798,11 +1874,13 @@ void Play_LoadToLastEntrance(PlayState* this) {
|
||||
(this->sceneId == SCENE_INSIDE_GANONS_CASTLE_COLLAPSE) || (this->sceneId == SCENE_GANON_BOSS)) {
|
||||
this->nextEntranceIndex = ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0;
|
||||
Item_Give(this, ITEM_SWORD_MASTER);
|
||||
#if OOT_VERSION >= PAL_1_1
|
||||
} else if ((gSaveContext.save.entranceIndex == ENTR_HYRULE_FIELD_11) ||
|
||||
(gSaveContext.save.entranceIndex == ENTR_HYRULE_FIELD_12) ||
|
||||
(gSaveContext.save.entranceIndex == ENTR_HYRULE_FIELD_13) ||
|
||||
(gSaveContext.save.entranceIndex == ENTR_HYRULE_FIELD_15)) {
|
||||
this->nextEntranceIndex = ENTR_HYRULE_FIELD_6;
|
||||
#endif
|
||||
} else {
|
||||
this->nextEntranceIndex = gSaveContext.save.entranceIndex;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user