mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-15 08:47:36 +00:00
Add SiLoader adjustments
This commit is contained in:
parent
9967aca509
commit
c0a85c42a3
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "act3.h"
|
#include "act3.h"
|
||||||
#include "credits_actions.h"
|
#include "credits_actions.h"
|
||||||
|
#include "extensions/siloader.h"
|
||||||
#include "helicopter.h"
|
#include "helicopter.h"
|
||||||
#include "infomain_actions.h"
|
#include "infomain_actions.h"
|
||||||
#include "intro_actions.h"
|
#include "intro_actions.h"
|
||||||
@ -36,6 +37,8 @@ DECOMP_SIZE_ASSERT(Infocenter, 0x1d8)
|
|||||||
DECOMP_SIZE_ASSERT(InfocenterMapEntry, 0x18)
|
DECOMP_SIZE_ASSERT(InfocenterMapEntry, 0x18)
|
||||||
DECOMP_SIZE_ASSERT(InfocenterState, 0x94)
|
DECOMP_SIZE_ASSERT(InfocenterState, 0x94)
|
||||||
|
|
||||||
|
using namespace Extensions;
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100f76a0
|
// GLOBAL: LEGO1 0x100f76a0
|
||||||
const char* g_object2x4red = "2x4red";
|
const char* g_object2x4red = "2x4red";
|
||||||
|
|
||||||
@ -339,7 +342,8 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
|
|||||||
|
|
||||||
MxLong result = m_radio.Notify(p_param);
|
MxLong result = m_radio.Notify(p_param);
|
||||||
|
|
||||||
if (result || (action->GetAtomId() != m_atomId && action->GetAtomId() != *g_introScript)) {
|
if (result || (action->GetAtomId() != m_atomId && action->GetAtomId() != *g_introScript &&
|
||||||
|
!Extension<SiLoader>::Call(ReplacedIn, *action, m_atomId, *g_introScript).value_or(false))) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,9 @@ class SiLoader {
|
|||||||
static std::optional<MxBool> HandleDelete(MxDSAction& p_action);
|
static std::optional<MxBool> HandleDelete(MxDSAction& p_action);
|
||||||
static MxBool HandleEndAction(MxEndActionNotificationParam& p_param);
|
static MxBool HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
static bool ReplacedIn(MxDSAction& p_action, Args... p_args);
|
||||||
|
|
||||||
static std::map<std::string, std::string> options;
|
static std::map<std::string, std::string> options;
|
||||||
static std::vector<std::string> files;
|
static std::vector<std::string> files;
|
||||||
static std::vector<std::string> directives;
|
static std::vector<std::string> directives;
|
||||||
@ -47,12 +50,30 @@ class SiLoader {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef EXTENSIONS
|
#ifdef EXTENSIONS
|
||||||
|
template <typename... Args>
|
||||||
|
bool SiLoader::ReplacedIn(MxDSAction& p_action, Args... p_args)
|
||||||
|
{
|
||||||
|
StreamObject object{p_action.GetAtomId(), p_action.GetObjectId()};
|
||||||
|
auto checkAtomId = [&p_action, &object](const auto& p_atomId) -> bool {
|
||||||
|
for (const auto& key : replace) {
|
||||||
|
if (key.second == object && key.first.first == p_atomId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (checkAtomId(p_args) || ...);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr auto Load = &SiLoader::Load;
|
constexpr auto Load = &SiLoader::Load;
|
||||||
constexpr auto HandleFind = &SiLoader::HandleFind;
|
constexpr auto HandleFind = &SiLoader::HandleFind;
|
||||||
constexpr auto HandleStart = &SiLoader::HandleStart;
|
constexpr auto HandleStart = &SiLoader::HandleStart;
|
||||||
constexpr auto HandleRemove = &SiLoader::HandleRemove;
|
constexpr auto HandleRemove = &SiLoader::HandleRemove;
|
||||||
constexpr auto HandleDelete = &SiLoader::HandleDelete;
|
constexpr auto HandleDelete = &SiLoader::HandleDelete;
|
||||||
constexpr auto HandleEndAction = &SiLoader::HandleEndAction;
|
constexpr auto HandleEndAction = &SiLoader::HandleEndAction;
|
||||||
|
constexpr auto ReplacedIn = [](auto&&... args) { return SiLoader::ReplacedIn(std::forward<decltype(args)>(args)...); };
|
||||||
#else
|
#else
|
||||||
constexpr decltype(&SiLoader::Load) Load = nullptr;
|
constexpr decltype(&SiLoader::Load) Load = nullptr;
|
||||||
constexpr decltype(&SiLoader::HandleFind) HandleFind = nullptr;
|
constexpr decltype(&SiLoader::HandleFind) HandleFind = nullptr;
|
||||||
@ -60,5 +81,9 @@ constexpr decltype(&SiLoader::HandleStart) HandleStart = nullptr;
|
|||||||
constexpr decltype(&SiLoader::HandleRemove) HandleRemove = nullptr;
|
constexpr decltype(&SiLoader::HandleRemove) HandleRemove = nullptr;
|
||||||
constexpr decltype(&SiLoader::HandleDelete) HandleDelete = nullptr;
|
constexpr decltype(&SiLoader::HandleDelete) HandleDelete = nullptr;
|
||||||
constexpr decltype(&SiLoader::HandleEndAction) HandleEndAction = nullptr;
|
constexpr decltype(&SiLoader::HandleEndAction) HandleEndAction = nullptr;
|
||||||
|
constexpr auto ReplacedIn = [](auto&&... args) {
|
||||||
|
((void) args, ...);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
}; // namespace Extensions
|
}; // namespace Extensions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user