mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
09432ee7f4
* Initial Linux/GCC support commit * Add instructins for linux in the README * apply suggestions by @Erotemic and @Emill * Fix python 3.10 symlink line * Fix func_80041E80 type mismatch (#3) Type mismatch functions.h:664 * Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES * Makefile: find C/CXX_FILES automatically * Makefile: remove ugly conditions in find commands * cleanup _MSC_VER usage * fix Windows build * cleanup extraction scripts * fix Windows build * Fix Windows path separator issue * fix rumble support for linux * use glew-cmake in dockerfile * add pulseaudio backend * fix ZAPDTR linkage * Check for "soh.elf" in directory (#6) hide second button if `soh.exe` or `soh.elf` is present * Fix hardcoded segment addresses (#5) * fix condition * hack lus -> soh dep for ZAPDTR Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
79 lines
3.2 KiB
C++
79 lines
3.2 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, "this->sceneSegment != NULL", "../z_play.c", 4960);
|
|
//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;
|
|
} |