Move some classes to LegoOmni (#417)

This commit is contained in:
Christian Semmler
2024-01-08 06:45:07 -05:00
committed by GitHub
parent c47206617d
commit 091ecd5935
27 changed files with 245 additions and 229 deletions

View File

@@ -140,15 +140,12 @@ private:
};
__declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager();
__declspec(dllexport) MxDSObject* CreateStreamObject(MxDSFile*, MxS16);
__declspec(dllexport) LegoGameState* GameState();
__declspec(dllexport) const char* GetNoCD_SourceName();
__declspec(dllexport) LegoInputManager* InputManager();
__declspec(dllexport) LegoOmni* Lego();
__declspec(dllexport) void MakeSourceName(char*, const char*);
__declspec(dllexport) LegoEntity* PickEntity(MxLong, MxLong);
__declspec(dllexport) LegoROI* PickROI(MxLong, MxLong);
__declspec(dllexport) void SetOmniUserMessage(void (*)(const char*, int));
__declspec(dllexport) LegoSoundManager* SoundManager();
__declspec(dllexport) MxResult Start(MxDSAction*);
__declspec(dllexport) MxTransitionManager* TransitionManager();
@@ -159,26 +156,12 @@ LegoBuildingManager* BuildingManager();
LegoControlManager* ControlManager();
IslePathActor* GetCurrentVehicle();
LegoPlantManager* PlantManager();
MxBool KeyValueStringParse(char*, const char*, const char*);
LegoWorld* GetCurrentWorld();
GifManager* GetGifManager();
void FUN_10015820(MxU32, MxU32);
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
MxDSAction& GetCurrentAction();
MxBool FUN_100b6e10(
MxS32 p_bitmapWidth,
MxS32 p_bitmapHeight,
MxS32 p_videoParamWidth,
MxS32 p_videoParamHeight,
MxS32* p_left,
MxS32* p_top,
MxS32* p_right,
MxS32* p_bottom,
MxS32* p_width,
MxS32* p_height
);
void PlayMusic(MxU32 p_index);
void SetIsWorldActive(MxBool p_isWorldActive);
void RegisterScripts();

View File

@@ -2,58 +2,13 @@
#define LEGOUTIL_H
#include "extra.h"
#include "legoentity.h"
#include "mxatomid.h"
#include "mxtypes.h"
#include "mxutil.h"
#include <windows.h>
template <class T>
inline T Abs(T p_t)
{
return p_t < 0 ? -p_t : p_t;
}
template <class T>
inline T Min(T p_t1, T p_t2)
{
return p_t1 < p_t2 ? p_t1 : p_t2;
}
template <class T>
inline T Max(T p_t1, T p_t2)
{
return p_t1 > p_t2 ? p_t1 : p_t2;
}
template <class T>
inline void GetScalar(MxU8** p_source, T& p_dest)
{
p_dest = *(T*) *p_source;
*p_source += sizeof(T);
}
template <class T>
inline T GetScalar(T** p_source)
{
T val = **p_source;
*p_source += 1;
return val;
}
template <class T>
inline void GetDouble(MxU8** p_source, T& p_dest)
{
p_dest = *(double*) *p_source;
*p_source += sizeof(double);
}
template <class T>
inline void GetString(MxU8** p_source, char** p_dest, T* p_obj, void (T::*p_setter)(const char*))
{
(p_obj->*p_setter)((char*) *p_source);
*p_source += strlen(*p_dest) + 1;
}
class MxAtomId;
class LegoEntity;
ExtraActionType MatchActionString(const char*);
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);

View File

@@ -0,0 +1,66 @@
#ifndef MXBACKGROUNDAUDIOMANAGER_H
#define MXBACKGROUNDAUDIOMANAGER_H
#include "mxaudiopresenter.h"
#include "mxcore.h"
#include "mxdsaction.h"
#include "mxnotificationmanager.h"
#include "mxpresenter.h"
#include "mxtypes.h"
// VTABLE: LEGO1 0x100d9fe8
// SIZE 0x150
class MxBackgroundAudioManager : public MxCore {
public:
MxBackgroundAudioManager();
virtual ~MxBackgroundAudioManager() override;
virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04
virtual MxResult Tickle() override; // vtable+0x08
// FUNCTION: LEGO1 0x1007eb70
inline virtual const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x100f7ac4
return "MxBackgroundAudioManager";
}
// FUNCTION: LEGO1 0x1007eb80
inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, MxBackgroundAudioManager::ClassName()) || MxCore::IsA(p_name);
}
void StartAction(MxParam& p_param);
void StopAction(MxParam& p_param);
MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, undefined4 p_unk0x13c);
void FUN_1007ee70();
void FUN_1007ef40();
void FadeInOrFadeOut();
__declspec(dllexport) void Enable(MxBool p_enable);
virtual MxResult Create(MxAtomId& p_script, MxU32 p_frequencyMS);
void Stop();
void LowerVolume();
void RaiseVolume();
private:
void Init();
MxResult OpenMusic(MxAtomId& p_script);
void DestroyMusic();
MxBool m_musicEnabled; // 0x8
MxDSAction m_action1; // 0xc
MxAudioPresenter* m_unk0xa0;
MxDSAction m_action2; // 0xa4
MxAudioPresenter* m_unk0x138;
MxS32 m_unk0x13c;
MxS32 m_unk0x140;
MxS32 m_targetVolume;
MxS16 m_unk0x148;
MxAtomId m_script;
};
#endif // MXBACKGROUNDAUDIOMANAGER_H

View File

@@ -0,0 +1,40 @@
#ifndef MXCOMPOSITEMEDIAPRESENTER_H
#define MXCOMPOSITEMEDIAPRESENTER_H
#include "mxcompositepresenter.h"
// VTABLE: LEGO1 0x100d96b0
// SIZE 0x50
class MxCompositeMediaPresenter : public MxCompositePresenter {
public:
MxCompositeMediaPresenter();
virtual ~MxCompositeMediaPresenter() override;
virtual MxResult Tickle() override; // vtable+0x08
// FUNCTION: LEGO1 0x10073f10
inline virtual const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x100f02d4
return "MxCompositeMediaPresenter";
}
// FUNCTION: LEGO1 0x10073f20
inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, MxCompositeMediaPresenter::ClassName()) || MxCompositePresenter::IsA(p_name);
}
virtual void StartingTickle() override; // vtable+0x1c
virtual MxResult StartAction(MxStreamController*, MxDSAction* p_action) override; // vtable+0x3c
virtual MxResult PutData() override; // vtable+0x4c
private:
MxS16 m_unk0x4c; // 0x4c
MxBool m_unk0x4e; // 0x4e
};
// SYNTHETIC: LEGO1 0x10074000
// MxCompositeMediaPresenter::`scalar deleting destructor'
#endif // MXCOMPOSITEMEDIAPRESENTER_H

View File

@@ -0,0 +1,75 @@
#ifndef MXTRANSITIONMANAGER_H
#define MXTRANSITIONMANAGER_H
#include "legoomni.h"
#include "mxcore.h"
#include "mxvideopresenter.h"
#include <ddraw.h>
// VTABLE: LEGO1 0x100d7ea0
class MxTransitionManager : public MxCore {
public:
MxTransitionManager();
virtual ~MxTransitionManager() override; // vtable+0x0
__declspec(dllexport) void SetWaitIndicator(MxVideoPresenter* p_waitIndicator);
virtual MxResult Tickle(); // vtable+0x8
// FUNCTION: LEGO1 0x1004b950
inline virtual const char* ClassName() const override // vtable+0x0c
{
return "MxTransitionManager";
}
// FUNCTION: LEGO1 0x1004b960
inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, MxTransitionManager::ClassName()) || MxCore::IsA(p_name);
}
virtual MxResult GetDDrawSurfaceFromVideoManager(); // vtable+0x14
enum TransitionType {
NOT_TRANSITIONING,
NO_ANIMATION,
DISSOLVE,
PIXELATION,
SCREEN_WIPE,
WINDOWS,
BROKEN // Unknown what this is supposed to be, it locks the game up
};
MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_doCopy, MxBool p_playMusicInAnim);
inline TransitionType GetTransitionType() { return m_transitionType; }
private:
void EndTransition(MxBool p_notifyWorld);
void TransitionNone();
void TransitionDissolve();
void TransitionPixelation();
void TransitionWipe();
void TransitionWindows();
void TransitionBroken();
void SubmitCopyRect(LPDDSURFACEDESC p_ddsc);
void SetupCopyRect(LPDDSURFACEDESC p_ddsc);
MxVideoPresenter* m_waitIndicator; // 0x08
RECT m_copyRect; // 0x0c
MxU8* m_copyBuffer; // 0x1c
FlagBitfield m_copyFlags; // 0x20
undefined4 m_unk0x24; // 0x24
FlagBitfield m_unk0x28; // 0x28
TransitionType m_transitionType; // 0x2c
LPDIRECTDRAWSURFACE m_ddSurface; // 0x30
MxU16 m_animationTimer; // 0x34
MxU16 m_columnOrder[640]; // 0x36
MxU16 m_randomShift[480]; // 0x536
MxULong m_systemTime; // 0x8f8
MxS32 m_animationSpeed; // 0x8fc
};
#endif // MXTRANSITIONMANAGER_H