mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 23:48:12 -05:00
Implement InvokeAction (#386)
* push changes * Update legoutil.cpp * Fixes / match --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
d82d062e92
commit
a95bdcc4ad
4 changed files with 84 additions and 5 deletions
|
@ -390,7 +390,7 @@ void LegoOmni::Init()
|
|||
m_gifManager = NULL;
|
||||
m_worldList = NULL;
|
||||
m_currentWorld = NULL;
|
||||
m_unk0x80 = FALSE;
|
||||
m_exit = FALSE;
|
||||
m_currentVehicle = NULL;
|
||||
m_saveDataWriter = NULL;
|
||||
m_plantManager = NULL;
|
||||
|
|
|
@ -116,6 +116,8 @@ class LegoOmni : public MxOmni {
|
|||
MxTransitionManager* GetTransitionManager() { return m_transitionManager; }
|
||||
MxDSAction& GetCurrentAction() { return m_action; }
|
||||
|
||||
inline void SetExit(MxBool p_exit) { m_exit = p_exit; };
|
||||
|
||||
private:
|
||||
undefined4* m_unk0x68; // 0x68
|
||||
MxUnknown100dbdbc* m_renderMgr; // 0x6c
|
||||
|
@ -123,7 +125,7 @@ class LegoOmni : public MxOmni {
|
|||
GifManager* m_gifManager; // 0x74
|
||||
LegoWorldList* m_worldList; // 0x78
|
||||
LegoWorld* m_currentWorld; // 0x7c
|
||||
MxBool m_unk0x80; // 0x80
|
||||
MxBool m_exit; // 0x80
|
||||
LegoNavController* m_navController; // 0x84
|
||||
IslePathActor* m_currentVehicle; // 0x88
|
||||
LegoUnkSaveDataWriter* m_saveDataWriter; // 0x8c
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#include "legoutil.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legoworld.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxomni.h"
|
||||
#include "mxstreamer.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <process.h>
|
||||
#include <string.h>
|
||||
|
||||
// FUNCTION: LEGO1 0x1003e300
|
||||
|
@ -34,8 +39,79 @@ ExtraActionType MatchActionString(const char* p_str)
|
|||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003e430
|
||||
MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId);
|
||||
void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender);
|
||||
|
||||
// FUNCTION: LEGO1 0x1003e430
|
||||
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender)
|
||||
{
|
||||
MxDSAction action;
|
||||
action.SetAtomId(p_pAtom);
|
||||
action.SetObjectId(p_targetEntityId);
|
||||
|
||||
switch (p_actionId) {
|
||||
case ExtraActionType_opendisk:
|
||||
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
|
||||
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_DiskStream);
|
||||
Start(&action);
|
||||
}
|
||||
break;
|
||||
case ExtraActionType_openram:
|
||||
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
|
||||
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_RAMStream);
|
||||
Start(&action);
|
||||
}
|
||||
break;
|
||||
case ExtraActionType_close:
|
||||
action.SetUnknown24(-2);
|
||||
DeleteObject(action);
|
||||
Streamer()->Close(p_pAtom.GetInternal());
|
||||
break;
|
||||
case ExtraActionType_start:
|
||||
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
|
||||
Start(&action);
|
||||
}
|
||||
break;
|
||||
case ExtraActionType_stop:
|
||||
action.SetUnknown24(-2);
|
||||
if (!FUN_1003ee00(p_pAtom, p_targetEntityId)) {
|
||||
DeleteObject(action);
|
||||
}
|
||||
break;
|
||||
case ExtraActionType_run:
|
||||
_spawnl(0, "\\lego\\sources\\main\\main.exe", "\\lego\\sources\\main\\main.exe", "/script", &p_pAtom, 0);
|
||||
break;
|
||||
case ExtraActionType_exit:
|
||||
Lego()->SetExit(TRUE);
|
||||
break;
|
||||
case ExtraActionType_enable:
|
||||
CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId);
|
||||
break;
|
||||
case ExtraActionType_disable:
|
||||
CheckIfEntityExists(FALSE, p_pAtom.GetInternal(), p_targetEntityId);
|
||||
break;
|
||||
case ExtraActionType_notify:
|
||||
NotifyEntity(p_pAtom.GetInternal(), p_targetEntityId, p_sender);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003e670
|
||||
MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId)
|
||||
{
|
||||
LegoWorld* world =
|
||||
(LegoWorld*) FindEntityByAtomIdOrEntityId(MxAtomId(p_filename, LookupMode_LowerCase2), p_entityId);
|
||||
if (world) {
|
||||
world->VTable0x68(p_enable);
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003e700
|
||||
void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -108,8 +184,9 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO
|
|||
}
|
||||
|
||||
// STUB: LEGO1 0x1003ee00
|
||||
void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id)
|
||||
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003ef00
|
||||
|
|
|
@ -58,7 +58,7 @@ inline void GetString(MxU8** p_source, char** p_dest, T* p_obj, void (T::*p_sett
|
|||
ExtraActionType MatchActionString(const char*);
|
||||
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
|
||||
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
|
||||
void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
|
||||
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
|
||||
void FUN_1003ef00(MxBool);
|
||||
void SetAppCursor(WPARAM p_wparam);
|
||||
MxBool FUN_1003ef60();
|
||||
|
|
Loading…
Reference in a new issue