Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ VENV/
env.bak/
venv.bak/
local.properties
/build/
/build_debug/
/build*/
/legobin/
*.swp
LEGO1PROGRESS.*
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if(DOWNLOAD_DEPENDENCIES)
include(FetchContent)
FetchContent_Populate(
libweaver
URL https://github.com/isledecomp/SIEdit/archive/afd4933844b95ef739a7e77b097deb7efe4ec576.tar.gz
URL_MD5 59fd3c36f4f380f730cd9bedfc846397
URL https://github.com/isledecomp/SIEdit/archive/17c7736a6ff31413f1e74ab4e989011b545b6926.tar.gz
URL_MD5 04edbc974df8884f283d920ded10f1f6
)
add_library(libweaver STATIC
${libweaver_SOURCE_DIR}/lib/core.cpp
Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,22 @@ if (ISLE_EXTENSIONS)
extensions/src/extensions.cpp
extensions/src/siloader.cpp
extensions/src/textureloader.cpp

# Common shared code
extensions/src/common/charactertables.cpp
extensions/src/common/animutils.cpp
extensions/src/common/characteranimator.cpp
extensions/src/common/charactercloner.cpp
extensions/src/common/charactercustomizer.cpp
extensions/src/common/customizestate.cpp
extensions/src/common/pathutils.cpp

# Third person camera extension
extensions/src/thirdpersoncamera.cpp
extensions/src/thirdpersoncamera/controller.cpp
extensions/src/thirdpersoncamera/orbitcamera.cpp
extensions/src/thirdpersoncamera/inputhandler.cpp
extensions/src/thirdpersoncamera/displayactor.cpp
)
endif()

Expand Down
12 changes: 6 additions & 6 deletions ISLE/emscripten/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ void Emscripten_SetupFilesystem()
}

#ifdef EXTENSIONS
if (Extensions::TextureLoader::enabled) {
if (Extensions::TextureLoaderExt::enabled) {
MxString directory =
MxString("/LEGO") + Extensions::TextureLoader::options["texture loader:texture path"].c_str();
Extensions::TextureLoader::options["texture loader:texture path"] = directory.GetData();
MxString("/LEGO") + Extensions::TextureLoaderExt::options["texture loader:texture path"].c_str();
Extensions::TextureLoaderExt::options["texture loader:texture path"] = directory.GetData();
wasmfs_create_directory(directory.GetData(), 0644, fetchfs);

MxU32 i = 0;
Expand All @@ -102,17 +102,17 @@ void Emscripten_SetupFilesystem()
registerFile(path.GetData());

if (!preloadFile(path.GetData())) {
Extensions::TextureLoader::excludedFiles.emplace_back(file);
Extensions::TextureLoaderExt::AddExcludedFile(file);
}

Emscripten_SendExtensionProgress("HD Textures", (++i * 100) / sizeOfArray(g_textures));
}
}

if (Extensions::SiLoader::enabled) {
if (Extensions::SiLoaderExt::enabled) {
wasmfs_create_directory("/LEGO/extra", 0644, fetchfs);

for (const auto& file : Extensions::SiLoader::files) {
for (const auto& file : Extensions::SiLoaderExt::GetFiles()) {
registerFile(file.c_str());
}
}
Expand Down
6 changes: 5 additions & 1 deletion ISLE/isleapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "viewmanager/viewmanager.h"

#include <array>
#include <extensions/extensions.h>
#include <extensions/thirdpersoncamera.h>
#include <miniwin/miniwindevice.h>
#include <type_traits>
#include <vec.h>
Expand Down Expand Up @@ -875,6 +875,10 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
}
}

#ifdef EXTENSIONS
Extensions::ThirdPersonCameraExt::HandleSDLEvent(event);
#endif

return SDL_APP_CONTINUE;
}

Expand Down
3 changes: 3 additions & 0 deletions LEGO1/lego/legoomni/include/islepathactor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ISLEPATHACTOR_H
#define ISLEPATHACTOR_H

#include "extensions/fwd.h"
#include "legogamestate.h"
#include "legopathactor.h"
#include "mxtypes.h"
Expand Down Expand Up @@ -139,6 +140,8 @@ class IslePathActor : public LegoPathActor {
// IslePathActor::`scalar deleting destructor'

protected:
friend class Extensions::ThirdPersonCamera::Controller;

LegoWorld* m_world; // 0x154
LegoPathActor* m_previousActor; // 0x158
MxFloat m_previousVel; // 0x15c
Expand Down
3 changes: 3 additions & 0 deletions LEGO1/lego/legoomni/include/legocharactermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define LEGOCHARACTERMANAGER_H

#include "decomp.h"
#include "extensions/fwd.h"
#include "mxstl/stlcompat.h"
#include "mxtypes.h"
#include "mxvariable.h"
Expand Down Expand Up @@ -98,6 +99,8 @@ class LegoCharacterManager {
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }

private:
friend class Extensions::Common::CharacterCloner;

LegoROI* CreateActorROI(const char* p_key);
void RemoveROI(LegoROI* p_roi);
LegoROI* FindChildROI(LegoROI* p_roi, const char* p_name);
Expand Down
4 changes: 4 additions & 0 deletions LEGO1/lego/legoomni/include/legoinputmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define LEGOINPUTMANAGER_H

#include "decomp.h"
#include "extensions/fwd.h"
#include "lego1_export.h"
#include "legoeventnotificationparam.h"
#include "mxlist.h"
Expand Down Expand Up @@ -179,6 +180,8 @@ class LegoInputManager : public MxPresenter {
// LegoInputManager::`scalar deleting destructor'

private:
friend class Extensions::ThirdPersonCameraExt;

void InitializeHaptics();

MxCriticalSection m_criticalSection; // 0x58
Expand All @@ -204,6 +207,7 @@ class LegoInputManager : public MxPresenter {
TouchScheme m_touchScheme = e_none;
SDL_Point m_touchVirtualThumb = {0, 0};
SDL_FPoint m_touchVirtualThumbOrigin;
SDL_FingerID m_touchFinger = 0;
std::map<SDL_FingerID, MxU32> m_touchFlags;
std::map<SDL_KeyboardID, std::pair<void*, void*>> m_keyboards;
std::map<SDL_MouseID, std::pair<void*, SDL_Haptic*>> m_mice;
Expand Down
4 changes: 4 additions & 0 deletions LEGO1/lego/legoomni/include/legonavcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __LEGONAVCONTROLLER_H

#include "decomp.h"
#include "extensions/fwd.h"
#include "mxcore.h"
#include "mxtypes.h"

Expand Down Expand Up @@ -122,6 +123,9 @@ class LegoNavController : public MxCore {
// LegoNavController::`scalar deleting destructor'

protected:
friend class Extensions::ThirdPersonCamera::OrbitCamera;
friend class Extensions::ThirdPersonCamera::Controller;

float CalculateNewVel(float p_targetVel, float p_currentVel, float p_accel, float p_time);
float CalculateNewTargetVel(int p_pos, int p_center, float p_max);
float CalculateNewAccel(int p_pos, int p_center, float p_max, int p_min);
Expand Down
7 changes: 7 additions & 0 deletions LEGO1/lego/legoomni/src/actors/islepathactor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "islepathactor.h"

#include "3dmanager/lego3dmanager.h"
#include "extensions/thirdpersoncamera.h"
#include "isle_actions.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h"
Expand All @@ -16,6 +17,8 @@
#include "scripts.h"
#include "viewmanager/viewmanager.h"

using namespace Extensions;

DECOMP_SIZE_ASSERT(IslePathActor, 0x160)
DECOMP_SIZE_ASSERT(IslePathActor::SpawnLocation, 0x38)

Expand Down Expand Up @@ -95,6 +98,8 @@ void IslePathActor::Enter()
TurnAround();
TransformPointOfView();
}

Extension<ThirdPersonCameraExt>::Call(TP::HandleActorEnter, this);
}

// FUNCTION: LEGO1 0x1001a3f0
Expand Down Expand Up @@ -154,6 +159,8 @@ void IslePathActor::Exit()
TurnAround();
TransformPointOfView();
ResetViewVelocity();

Extension<ThirdPersonCameraExt>::Call(TP::HandleActorExit, this);
}

// GLOBAL: LEGO1 0x10102b28
Expand Down
5 changes: 5 additions & 0 deletions LEGO1/lego/legoomni/src/audio/lego3dsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ void Lego3DSound::FUN_10011a60(ma_sound* p_sound, const char* p_name)
}
}
else {
// Reset ownership flags before reassigning. Reset() only clears m_roi
// but not these flags, so stale values from a previous actor-backed play
// would cause an incorrect ReleaseActor call for non-actor ROIs
m_enabled = m_isActor = FALSE;

if (CharacterManager()->IsActor(p_name)) {
m_roi = CharacterManager()->GetActorROI(p_name, TRUE);
m_enabled = m_isActor = TRUE;
Expand Down
7 changes: 7 additions & 0 deletions LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "3dmanager/lego3dmanager.h"
#include "decomp.h"
#include "define.h"
#include "extensions/thirdpersoncamera.h"
#include "islepathactor.h"
#include "legoanimationmanager.h"
#include "legoanimpresenter.h"
Expand All @@ -20,6 +21,8 @@
#include "mxtimer.h"
#include "mxutilities.h"

using namespace Extensions;

DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74)

// FUNCTION: LEGO1 0x1004a8d0
Expand Down Expand Up @@ -480,6 +483,10 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
}

actor->SetActorState(LegoPathActor::c_initial);

if (m_tranInfo->m_unk0x29) {
Extension<ThirdPersonCameraExt>::Call(TP::HandleCamAnimEnd, actor);
}
}

return TRUE;
Expand Down
6 changes: 5 additions & 1 deletion LEGO1/lego/legoomni/src/common/legocharactermanager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "legocharactermanager.h"

#include "3dmanager/lego3dmanager.h"
#include "extensions/thirdpersoncamera.h"
#include "legoactors.h"
#include "legoanimactor.h"
#include "legobuildingmanager.h"
Expand All @@ -22,6 +23,8 @@
#include <stdio.h>
#include <vec.h>

using namespace Extensions;

DECOMP_SIZE_ASSERT(LegoCharacter, 0x08)
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24)
Expand Down Expand Up @@ -279,7 +282,8 @@ LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEn
}

if (character != NULL) {
if (p_createEntity && character->m_roi->GetEntity() == NULL) {
if (p_createEntity && character->m_roi->GetEntity() == NULL &&
!Extension<ThirdPersonCameraExt>::Call(TP::IsClonedCharacter, p_name).value_or(FALSE)) {
LegoExtraActor* actor = new LegoExtraActor();

actor->SetROI(character->m_roi, FALSE, FALSE);
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/common/legotextureinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text
strcpy(textureInfo->m_name, p_name);
}

if (Extension<TextureLoader>::Call(PatchTexture, textureInfo).value_or(false)) {
if (Extension<TextureLoaderExt>::Call(TL::PatchTexture, textureInfo).value_or(false)) {
return textureInfo;
}

Expand Down
9 changes: 5 additions & 4 deletions LEGO1/lego/legoomni/src/common/legoutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id)
{
LegoWorld* world = CurrentWorld();

auto result =
Extension<SiLoader>::Call(HandleRemove, SiLoader::StreamObject{p_atomId, p_id}, world).value_or(std::nullopt);
auto result = Extension<SiLoaderExt>::Call(SI::HandleRemove, SiLoaderExt::StreamObject{p_atomId, p_id}, world)
.value_or(std::nullopt);
if (result) {
return result.value();
}
Expand Down Expand Up @@ -545,8 +545,9 @@ MxBool RemoveFromWorld(
{
LegoWorld* world = FindWorld(p_worldAtom, p_worldEntityId);

auto result = Extension<SiLoader>::Call(HandleRemove, SiLoader::StreamObject{p_entityAtom, p_entityId}, world)
.value_or(std::nullopt);
auto result =
Extension<SiLoaderExt>::Call(SI::HandleRemove, SiLoaderExt::StreamObject{p_entityAtom, p_entityId}, world)
.value_or(std::nullopt);
if (result) {
return result.value();
}
Expand Down
9 changes: 9 additions & 0 deletions LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "3dmanager/lego3dmanager.h"
#include "act3.h"
#include "extensions/thirdpersoncamera.h"
#include "infocenter.h"
#include "legoanimationmanager.h"
#include "legocameracontroller.h"
Expand Down Expand Up @@ -29,6 +30,8 @@
#include <SDL3/SDL_stdinc.h>
#include <vec.h>

using namespace Extensions;

DECOMP_SIZE_ASSERT(LegoNavController, 0x70)

// MSVC 4.20 didn't define a macro for this key
Expand Down Expand Up @@ -348,6 +351,12 @@ MxBool LegoNavController::CalculateNewPosDir(
ProcessJoystickInput(rotatedY);
}

if (Extension<
ThirdPersonCameraExt>::Call(TP::HandleNavOverride, this, p_curPos, p_curDir, p_newPos, p_newDir, deltaTime)
.value_or(FALSE)) {
return TRUE;
}

if (m_useRotationalVel) {
m_rotationalVel = CalculateNewVel(m_targetRotationalVel, m_rotationalVel, m_rotationalAccel * 40.0f, deltaTime);
}
Expand Down
9 changes: 7 additions & 2 deletions LEGO1/lego/legoomni/src/entity/legoworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "anim/legoanim.h"
#include "extensions/siloader.h"
#include "extensions/thirdpersoncamera.h"
#include "legoanimationmanager.h"
#include "legoanimpresenter.h"
#include "legobuildingmanager.h"
Expand Down Expand Up @@ -639,8 +640,8 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
// FUNCTION: BETA10 0x100db3de
MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
{
auto result =
Extension<SiLoader>::Call(HandleFind, SiLoader::StreamObject{p_atom, p_entityId}, this).value_or(std::nullopt);
auto result = Extension<SiLoaderExt>::Call(SI::HandleFind, SiLoaderExt::StreamObject{p_atom, p_entityId}, this)
.value_or(std::nullopt);
if (result) {
return result.value();
}
Expand Down Expand Up @@ -753,6 +754,8 @@ void LegoWorld::Enable(MxBool p_enable)
#ifndef BETA10
SetIsWorldActive(TRUE);
#endif

Extension<ThirdPersonCameraExt>::Call(TP::HandleWorldEnable, this, TRUE);
}
else if (!p_enable && m_disabledObjects.size() == 0) {
MxPresenter* presenter;
Expand Down Expand Up @@ -815,6 +818,8 @@ void LegoWorld::Enable(MxBool p_enable)
}

GetViewManager()->RemoveAll(NULL);

Extension<ThirdPersonCameraExt>::Call(TP::HandleWorldEnable, this, FALSE);
}
}

Expand Down
Loading
Loading