Shipwright/soh/soh/z_play_otr.cpp
Baoulettes a5df9dddf0
Use Macro for __FILE__ & __LINE__ when possible (#559)
* First batch some overlay

* Almost all overlay

* effect & gamestate

* kaleido stuffs

* more overlay

* more left over from code folder

* remaining hardcoded line and file

* Open & Close _DISP __FILE__ & __LINE__ clean up

* Some if (1) {} remove

* LOG_xxxx __FILE__ , __LINE__ cleaned

* ASSERT macro __FILE__ __LINE__

* mtx without line/file in functions

* " if (1) {} " & "if (0) {}" and tab/white place

* LogUtils as macro

* GameState_, GameAlloc_, SystemArena_ & ZeldaArena_

* Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_"

This reverts commit 0d85caaf7e.

* Like last commit but as macro

* Fix matrix not using macros

* use function not macro

* DebugArena_* functions
GameAlloc_MallocDebug
BgCheck_PosErrorCheck as macros
removed issues with ; in macro file
2022-07-05 19:29:34 -04:00

79 lines
3.1 KiB
C++

#include "OTRGlobals.h"
#include "ResourceMgr.h"
#include "Scene.h"
#include "Utils/StringHelper.h"
#include "global.h"
#include "vt.h"
#include "Vertex.h"
extern "C" void Gameplay_InitScene(GlobalContext * globalCtx, s32 spawn);
extern "C" void Gameplay_InitEnvironment(GlobalContext * globalCtx, s16 skyboxId);
void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn);
s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* sceneCmd);
//Ship::OTRResource* OTRGameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
Ship::Resource* OTRGameplay_LoadFile(GlobalContext* globalCtx, const char* fileName)
{
auto res = OTRGlobals::Instance->context->GetResourceManager()->LoadResource(fileName);
return res.get();
}
extern "C" void OTRGameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) {
SceneTableEntry* scene = &gSceneTable[sceneNum];
scene->unk_13 = 0;
globalCtx->loadedScene = scene;
globalCtx->sceneNum = sceneNum;
globalCtx->sceneConfig = scene->config;
//osSyncPrintf("\nSCENE SIZE %fK\n", (scene->sceneFile.vromEnd - scene->sceneFile.vromStart) / 1024.0f);
std::string scenePath = StringHelper::Sprintf("scenes/%s/%s", scene->sceneFile.fileName, scene->sceneFile.fileName);
globalCtx->sceneSegment = (Ship::Scene*)OTRGameplay_LoadFile(globalCtx, scenePath.c_str());
// Failed to load scene... default to doodongs cavern
if (globalCtx->sceneSegment == nullptr)
{
lusprintf(__FILE__, __LINE__, 2, "Unable to load scene %s... Defaulting to Doodong's Cavern!\n",
scenePath.c_str());
OTRGameplay_SpawnScene(globalCtx, 0x01, 0);
return;
}
scene->unk_13 = 0;
//ASSERT(globalCtx->sceneSegment != NULL);
//gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment);
OTRGameplay_InitScene(globalCtx, spawn);
osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(globalCtx, &globalCtx->roomCtx) / 1024.0f);
}
void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn) {
globalCtx->curSpawn = spawn;
globalCtx->linkActorEntry = nullptr;
globalCtx->unk_11DFC = nullptr;
globalCtx->setupEntranceList = nullptr;
globalCtx->setupExitList = nullptr;
globalCtx->cUpElfMsgs = nullptr;
globalCtx->setupPathList = nullptr;
globalCtx->numSetupActors = 0;
Object_InitBank(globalCtx, &globalCtx->objectCtx);
LightContext_Init(globalCtx, &globalCtx->lightCtx);
TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx);
func_80096FD4(globalCtx, &globalCtx->roomCtx.curRoom);
YREG(15) = 0;
gSaveContext.worldMapArea = 0;
OTRScene_ExecuteCommands(globalCtx, globalCtx->sceneSegment);
Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId);
/* auto data = static_cast<Ship::Vertex*>(Ship::GlobalCtx2::GetInstance()
->GetResourceManager()
->LoadResource("object_link_child\\object_link_childVtx_01FE08")
.get());
auto data2 = ResourceMgr_LoadVtxByCRC(0x68d4ea06044e228f);*/
volatile int a = 0;
}