mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-29 15:44:13 -04:00
Move some classes to LegoOmni (#417)
This commit is contained in:
parent
c47206617d
commit
091ecd5935
@ -18,6 +18,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/lego/legoomni/src/audio/legocachesound.cpp
|
LEGO1/lego/legoomni/src/audio/legocachesound.cpp
|
||||||
LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp
|
LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp
|
||||||
LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp
|
LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp
|
||||||
|
LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp
|
||||||
LEGO1/lego/legoomni/src/build/buildingentity.cpp
|
LEGO1/lego/legoomni/src/build/buildingentity.cpp
|
||||||
LEGO1/lego/legoomni/src/build/dunebuggy.cpp
|
LEGO1/lego/legoomni/src/build/dunebuggy.cpp
|
||||||
LEGO1/lego/legoomni/src/build/helicopter.cpp
|
LEGO1/lego/legoomni/src/build/helicopter.cpp
|
||||||
@ -41,6 +42,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/lego/legoomni/src/common/legostream.cpp
|
LEGO1/lego/legoomni/src/common/legostream.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp
|
LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legoutil.cpp
|
LEGO1/lego/legoomni/src/common/legoutil.cpp
|
||||||
|
LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp
|
||||||
LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp
|
LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp
|
||||||
LEGO1/lego/legoomni/src/entity/legoactor.cpp
|
LEGO1/lego/legoomni/src/entity/legoactor.cpp
|
||||||
LEGO1/lego/legoomni/src/entity/legoanimactor.cpp
|
LEGO1/lego/legoomni/src/entity/legoanimactor.cpp
|
||||||
@ -114,6 +116,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp
|
LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp
|
||||||
LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp
|
LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp
|
||||||
LEGO1/lego/legoomni/src/video/legovideomanager.cpp
|
LEGO1/lego/legoomni/src/video/legovideomanager.cpp
|
||||||
|
LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp
|
||||||
LEGO1/lego/sources/3dmanager/lego3dmanager.cpp
|
LEGO1/lego/sources/3dmanager/lego3dmanager.cpp
|
||||||
LEGO1/lego/sources/3dmanager/lego3dview.cpp
|
LEGO1/lego/sources/3dmanager/lego3dview.cpp
|
||||||
LEGO1/lego/sources/3dmanager/legoview1.cpp
|
LEGO1/lego/sources/3dmanager/legoview1.cpp
|
||||||
@ -136,7 +139,6 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/omni/src/action/mxdsstreamingaction.cpp
|
LEGO1/omni/src/action/mxdsstreamingaction.cpp
|
||||||
LEGO1/omni/src/audio/mxaudiomanager.cpp
|
LEGO1/omni/src/audio/mxaudiomanager.cpp
|
||||||
LEGO1/omni/src/audio/mxaudiopresenter.cpp
|
LEGO1/omni/src/audio/mxaudiopresenter.cpp
|
||||||
LEGO1/omni/src/audio/mxbackgroundaudiomanager.cpp
|
|
||||||
LEGO1/omni/src/audio/mxloopingmidipresenter.cpp
|
LEGO1/omni/src/audio/mxloopingmidipresenter.cpp
|
||||||
LEGO1/omni/src/audio/mxmidipresenter.cpp
|
LEGO1/omni/src/audio/mxmidipresenter.cpp
|
||||||
LEGO1/omni/src/audio/mxmusicmanager.cpp
|
LEGO1/omni/src/audio/mxmusicmanager.cpp
|
||||||
@ -146,7 +148,6 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/omni/src/audio/mxwavepresenter.cpp
|
LEGO1/omni/src/audio/mxwavepresenter.cpp
|
||||||
LEGO1/omni/src/common/mxatomidcounter.cpp
|
LEGO1/omni/src/common/mxatomidcounter.cpp
|
||||||
LEGO1/omni/src/common/mxatomid.cpp
|
LEGO1/omni/src/common/mxatomid.cpp
|
||||||
LEGO1/omni/src/common/mxcompositemediapresenter.cpp
|
|
||||||
LEGO1/omni/src/common/mxcompositepresenter.cpp
|
LEGO1/omni/src/common/mxcompositepresenter.cpp
|
||||||
LEGO1/omni/src/common/mxcore.cpp
|
LEGO1/omni/src/common/mxcore.cpp
|
||||||
LEGO1/omni/src/common/mxmediamanager.cpp
|
LEGO1/omni/src/common/mxmediamanager.cpp
|
||||||
@ -156,6 +157,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/omni/src/common/mxstring.cpp
|
LEGO1/omni/src/common/mxstring.cpp
|
||||||
LEGO1/omni/src/common/mxticklemanager.cpp
|
LEGO1/omni/src/common/mxticklemanager.cpp
|
||||||
LEGO1/omni/src/common/mxtimer.cpp
|
LEGO1/omni/src/common/mxtimer.cpp
|
||||||
|
LEGO1/omni/src/common/mxutil.cpp
|
||||||
LEGO1/omni/src/common/mxvariable.cpp
|
LEGO1/omni/src/common/mxvariable.cpp
|
||||||
LEGO1/omni/src/common/mxvariabletable.cpp
|
LEGO1/omni/src/common/mxvariabletable.cpp
|
||||||
LEGO1/omni/src/control/mxcontrolpresenter.cpp
|
LEGO1/omni/src/control/mxcontrolpresenter.cpp
|
||||||
@ -201,7 +203,6 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/omni/src/video/mxsmack.cpp
|
LEGO1/omni/src/video/mxsmack.cpp
|
||||||
LEGO1/omni/src/video/mxsmkpresenter.cpp
|
LEGO1/omni/src/video/mxsmkpresenter.cpp
|
||||||
LEGO1/omni/src/video/mxstillpresenter.cpp
|
LEGO1/omni/src/video/mxstillpresenter.cpp
|
||||||
LEGO1/omni/src/video/mxtransitionmanager.cpp
|
|
||||||
LEGO1/omni/src/video/mxvideomanager.cpp
|
LEGO1/omni/src/video/mxvideomanager.cpp
|
||||||
LEGO1/omni/src/video/mxvideoparam.cpp
|
LEGO1/omni/src/video/mxvideoparam.cpp
|
||||||
LEGO1/omni/src/video/mxvideoparamflags.cpp
|
LEGO1/omni/src/video/mxvideoparamflags.cpp
|
||||||
|
@ -140,15 +140,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
__declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager();
|
__declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager();
|
||||||
__declspec(dllexport) MxDSObject* CreateStreamObject(MxDSFile*, MxS16);
|
|
||||||
__declspec(dllexport) LegoGameState* GameState();
|
__declspec(dllexport) LegoGameState* GameState();
|
||||||
__declspec(dllexport) const char* GetNoCD_SourceName();
|
__declspec(dllexport) const char* GetNoCD_SourceName();
|
||||||
__declspec(dllexport) LegoInputManager* InputManager();
|
__declspec(dllexport) LegoInputManager* InputManager();
|
||||||
__declspec(dllexport) LegoOmni* Lego();
|
__declspec(dllexport) LegoOmni* Lego();
|
||||||
__declspec(dllexport) void MakeSourceName(char*, const char*);
|
|
||||||
__declspec(dllexport) LegoEntity* PickEntity(MxLong, MxLong);
|
__declspec(dllexport) LegoEntity* PickEntity(MxLong, MxLong);
|
||||||
__declspec(dllexport) LegoROI* PickROI(MxLong, MxLong);
|
__declspec(dllexport) LegoROI* PickROI(MxLong, MxLong);
|
||||||
__declspec(dllexport) void SetOmniUserMessage(void (*)(const char*, int));
|
|
||||||
__declspec(dllexport) LegoSoundManager* SoundManager();
|
__declspec(dllexport) LegoSoundManager* SoundManager();
|
||||||
__declspec(dllexport) MxResult Start(MxDSAction*);
|
__declspec(dllexport) MxResult Start(MxDSAction*);
|
||||||
__declspec(dllexport) MxTransitionManager* TransitionManager();
|
__declspec(dllexport) MxTransitionManager* TransitionManager();
|
||||||
@ -159,26 +156,12 @@ LegoBuildingManager* BuildingManager();
|
|||||||
LegoControlManager* ControlManager();
|
LegoControlManager* ControlManager();
|
||||||
IslePathActor* GetCurrentVehicle();
|
IslePathActor* GetCurrentVehicle();
|
||||||
LegoPlantManager* PlantManager();
|
LegoPlantManager* PlantManager();
|
||||||
MxBool KeyValueStringParse(char*, const char*, const char*);
|
|
||||||
LegoWorld* GetCurrentWorld();
|
LegoWorld* GetCurrentWorld();
|
||||||
GifManager* GetGifManager();
|
GifManager* GetGifManager();
|
||||||
void FUN_10015820(MxU32, MxU32);
|
void FUN_10015820(MxU32, MxU32);
|
||||||
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
|
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
|
||||||
MxDSAction& GetCurrentAction();
|
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 PlayMusic(MxU32 p_index);
|
||||||
void SetIsWorldActive(MxBool p_isWorldActive);
|
void SetIsWorldActive(MxBool p_isWorldActive);
|
||||||
void RegisterScripts();
|
void RegisterScripts();
|
||||||
|
@ -2,58 +2,13 @@
|
|||||||
#define LEGOUTIL_H
|
#define LEGOUTIL_H
|
||||||
|
|
||||||
#include "extra.h"
|
#include "extra.h"
|
||||||
#include "legoentity.h"
|
|
||||||
#include "mxatomid.h"
|
|
||||||
#include "mxtypes.h"
|
#include "mxtypes.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
template <class T>
|
class MxAtomId;
|
||||||
inline T Abs(T p_t)
|
class LegoEntity;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtraActionType MatchActionString(const char*);
|
ExtraActionType MatchActionString(const char*);
|
||||||
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
|
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
|
||||||
|
@ -111,9 +111,6 @@ MxAtomId* g_nocdSourceName = NULL;
|
|||||||
// GLOBAL: LEGO1 0x100f6718
|
// GLOBAL: LEGO1 0x100f6718
|
||||||
const char* g_current = "current";
|
const char* g_current = "current";
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x101020e8
|
|
||||||
void (*g_omniUserMessage)(const char*, int);
|
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100f4c58
|
// GLOBAL: LEGO1 0x100f4c58
|
||||||
MxBool g_isWorldActive = TRUE;
|
MxBool g_isWorldActive = TRUE;
|
||||||
|
|
||||||
@ -694,144 +691,3 @@ MxResult Start(MxDSAction* p_dsAction)
|
|||||||
{
|
{
|
||||||
return MxOmni::GetInstance()->Start(p_dsAction);
|
return MxOmni::GetInstance()->Start(p_dsAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Probably should be somewhere else
|
|
||||||
// FUNCTION: LEGO1 0x100b6e10
|
|
||||||
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
|
|
||||||
)
|
|
||||||
{
|
|
||||||
MxPoint32 topLeft(*p_left, *p_top);
|
|
||||||
MxRect32 bitmapRect(MxPoint32(0, 0), MxSize32(p_bitmapWidth, p_bitmapHeight));
|
|
||||||
|
|
||||||
MxPoint32 bottomRight(*p_right, *p_bottom);
|
|
||||||
MxRect32 videoParamRect(MxPoint32(0, 0), MxSize32(p_videoParamWidth, p_videoParamHeight));
|
|
||||||
|
|
||||||
MxRect32 rect(0, 0, *p_width, *p_height);
|
|
||||||
rect.AddPoint(topLeft);
|
|
||||||
|
|
||||||
if (!rect.IntersectsWith(bitmapRect))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
rect.Intersect(bitmapRect);
|
|
||||||
rect.SubtractPoint(topLeft);
|
|
||||||
rect.AddPoint(bottomRight);
|
|
||||||
|
|
||||||
if (!rect.IntersectsWith(videoParamRect))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
rect.Intersect(videoParamRect);
|
|
||||||
rect.SubtractPoint(bottomRight);
|
|
||||||
|
|
||||||
*p_left += rect.GetLeft();
|
|
||||||
*p_top += rect.GetTop();
|
|
||||||
*p_right += rect.GetLeft();
|
|
||||||
*p_bottom += rect.GetTop();
|
|
||||||
*p_width = rect.GetWidth();
|
|
||||||
*p_height = rect.GetHeight();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b6ff0
|
|
||||||
void MakeSourceName(char* p_output, const char* p_input)
|
|
||||||
{
|
|
||||||
const char* cln = strchr(p_input, ':');
|
|
||||||
if (cln) {
|
|
||||||
p_input = cln + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(p_output, p_input);
|
|
||||||
|
|
||||||
strlwr(p_output);
|
|
||||||
|
|
||||||
char* extLoc = strstr(p_output, ".si");
|
|
||||||
if (extLoc) {
|
|
||||||
*extLoc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b7050
|
|
||||||
MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p_source)
|
|
||||||
{
|
|
||||||
MxBool didMatch = FALSE;
|
|
||||||
|
|
||||||
MxS16 len = strlen(p_source);
|
|
||||||
char* temp = new char[len + 1];
|
|
||||||
strcpy(temp, p_source);
|
|
||||||
|
|
||||||
char* token = strtok(temp, ", \t\r\n:");
|
|
||||||
while (token) {
|
|
||||||
len -= (strlen(token) + 1);
|
|
||||||
|
|
||||||
if (strcmpi(token, p_key) == 0) {
|
|
||||||
if (p_outputValue && len > 0) {
|
|
||||||
char* cur = &token[strlen(p_key)];
|
|
||||||
cur++;
|
|
||||||
while (*cur != ',') {
|
|
||||||
if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r')
|
|
||||||
break;
|
|
||||||
*p_outputValue++ = *cur++;
|
|
||||||
}
|
|
||||||
*p_outputValue = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
didMatch = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
token = strtok(NULL, ", \t\r\n:");
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] temp;
|
|
||||||
return didMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b7210
|
|
||||||
void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
|
|
||||||
{
|
|
||||||
g_omniUserMessage = p_userMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100c0280
|
|
||||||
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
|
|
||||||
{
|
|
||||||
MxU8* buf;
|
|
||||||
_MMCKINFO tmpChunk;
|
|
||||||
|
|
||||||
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], 0)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) {
|
|
||||||
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
|
|
||||||
|
|
||||||
buf = new MxU8[tmpChunk.cksize];
|
|
||||||
if (!buf) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_file->Read(buf, tmpChunk.cksize) != 0) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save a copy so we can clean up properly, because
|
|
||||||
// this function will alter the pointer value.
|
|
||||||
MxU8* copy = buf;
|
|
||||||
MxDSObject* obj = DeserializeDSObjectDispatch(&buf, -1);
|
|
||||||
delete[] copy;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
75
LEGO1/omni/include/mxutil.h
Normal file
75
LEGO1/omni/include/mxutil.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#ifndef MXUTIL_H
|
||||||
|
#define MXUTIL_H
|
||||||
|
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
|
class MxDSFile;
|
||||||
|
class MxDSObject;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
__declspec(dllexport) void MakeSourceName(char*, const char*);
|
||||||
|
__declspec(dllexport) void SetOmniUserMessage(void (*)(const char*, int));
|
||||||
|
__declspec(dllexport) MxDSObject* CreateStreamObject(MxDSFile*, MxS16);
|
||||||
|
|
||||||
|
MxBool KeyValueStringParse(char*, const char*, const char*);
|
||||||
|
|
||||||
|
#endif // MXUTIL_H
|
@ -1,8 +1,8 @@
|
|||||||
#include "mxdsaction.h"
|
#include "mxdsaction.h"
|
||||||
|
|
||||||
#include "legoutil.h"
|
|
||||||
#include "mxomni.h"
|
#include "mxomni.h"
|
||||||
#include "mxtimer.h"
|
#include "mxtimer.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "mxdsmediaaction.h"
|
#include "mxdsmediaaction.h"
|
||||||
|
|
||||||
#include "legoutil.h"
|
#include "mxutil.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxDSMediaAction, 0xb8)
|
DECOMP_SIZE_ASSERT(MxDSMediaAction, 0xb8)
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "mxdsobject.h"
|
#include "mxdsobject.h"
|
||||||
|
|
||||||
#include "legoutil.h"
|
|
||||||
#include "mxdsaction.h"
|
#include "mxdsaction.h"
|
||||||
#include "mxdsanim.h"
|
#include "mxdsanim.h"
|
||||||
#include "mxdsevent.h"
|
#include "mxdsevent.h"
|
||||||
@ -13,6 +12,7 @@
|
|||||||
#include "mxdssound.h"
|
#include "mxdssound.h"
|
||||||
#include "mxdsstill.h"
|
#include "mxdsstill.h"
|
||||||
#include "mxdstypes.h"
|
#include "mxdstypes.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "mxdssound.h"
|
#include "mxdssound.h"
|
||||||
|
|
||||||
#include "legoutil.h"
|
#include "mxutil.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxDSSound, 0xc0)
|
DECOMP_SIZE_ASSERT(MxDSSound, 0xc0)
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "mxmidipresenter.h"
|
#include "mxmidipresenter.h"
|
||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxautolocker.h"
|
#include "mxautolocker.h"
|
||||||
#include "mxdssound.h"
|
#include "mxdssound.h"
|
||||||
#include "mxmusicmanager.h"
|
#include "mxmusicmanager.h"
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxautolocker.h"
|
#include "mxautolocker.h"
|
||||||
#include "mxdssound.h"
|
#include "mxdssound.h"
|
||||||
#include "mxomni.h"
|
#include "mxomni.h"
|
||||||
#include "mxsoundmanager.h"
|
#include "mxsoundmanager.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxWavePresenter, 0x6c);
|
DECOMP_SIZE_ASSERT(MxWavePresenter, 0x6c);
|
||||||
DECOMP_SIZE_ASSERT(MxWavePresenter::WaveFormat, 0x1c);
|
DECOMP_SIZE_ASSERT(MxWavePresenter::WaveFormat, 0x1c);
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "legoobjectfactory.h"
|
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxactionnotificationparam.h"
|
#include "mxactionnotificationparam.h"
|
||||||
#include "mxautolocker.h"
|
#include "mxautolocker.h"
|
||||||
#include "mxcompositepresenter.h"
|
#include "mxcompositepresenter.h"
|
||||||
@ -11,8 +9,10 @@
|
|||||||
#include "mxdssound.h"
|
#include "mxdssound.h"
|
||||||
#include "mxentity.h"
|
#include "mxentity.h"
|
||||||
#include "mxnotificationmanager.h"
|
#include "mxnotificationmanager.h"
|
||||||
|
#include "mxobjectfactory.h"
|
||||||
#include "mxparam.h"
|
#include "mxparam.h"
|
||||||
#include "mxstreamer.h"
|
#include "mxstreamer.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
149
LEGO1/omni/src/common/mxutil.cpp
Normal file
149
LEGO1/omni/src/common/mxutil.cpp
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
|
#include "mxdsfile.h"
|
||||||
|
#include "mxdsobject.h"
|
||||||
|
#include "mxrect32.h"
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x101020e8
|
||||||
|
void (*g_omniUserMessage)(const char*, int);
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100b6e10
|
||||||
|
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
|
||||||
|
)
|
||||||
|
{
|
||||||
|
MxPoint32 topLeft(*p_left, *p_top);
|
||||||
|
MxRect32 bitmapRect(MxPoint32(0, 0), MxSize32(p_bitmapWidth, p_bitmapHeight));
|
||||||
|
|
||||||
|
MxPoint32 bottomRight(*p_right, *p_bottom);
|
||||||
|
MxRect32 videoParamRect(MxPoint32(0, 0), MxSize32(p_videoParamWidth, p_videoParamHeight));
|
||||||
|
|
||||||
|
MxRect32 rect(0, 0, *p_width, *p_height);
|
||||||
|
rect.AddPoint(topLeft);
|
||||||
|
|
||||||
|
if (!rect.IntersectsWith(bitmapRect))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
rect.Intersect(bitmapRect);
|
||||||
|
rect.SubtractPoint(topLeft);
|
||||||
|
rect.AddPoint(bottomRight);
|
||||||
|
|
||||||
|
if (!rect.IntersectsWith(videoParamRect))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
rect.Intersect(videoParamRect);
|
||||||
|
rect.SubtractPoint(bottomRight);
|
||||||
|
|
||||||
|
*p_left += rect.GetLeft();
|
||||||
|
*p_top += rect.GetTop();
|
||||||
|
*p_right += rect.GetLeft();
|
||||||
|
*p_bottom += rect.GetTop();
|
||||||
|
*p_width = rect.GetWidth();
|
||||||
|
*p_height = rect.GetHeight();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100b6ff0
|
||||||
|
void MakeSourceName(char* p_output, const char* p_input)
|
||||||
|
{
|
||||||
|
const char* cln = strchr(p_input, ':');
|
||||||
|
if (cln) {
|
||||||
|
p_input = cln + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(p_output, p_input);
|
||||||
|
|
||||||
|
strlwr(p_output);
|
||||||
|
|
||||||
|
char* extLoc = strstr(p_output, ".si");
|
||||||
|
if (extLoc) {
|
||||||
|
*extLoc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100b7050
|
||||||
|
MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p_source)
|
||||||
|
{
|
||||||
|
MxBool didMatch = FALSE;
|
||||||
|
|
||||||
|
MxS16 len = strlen(p_source);
|
||||||
|
char* temp = new char[len + 1];
|
||||||
|
strcpy(temp, p_source);
|
||||||
|
|
||||||
|
char* token = strtok(temp, ", \t\r\n:");
|
||||||
|
while (token) {
|
||||||
|
len -= (strlen(token) + 1);
|
||||||
|
|
||||||
|
if (strcmpi(token, p_key) == 0) {
|
||||||
|
if (p_outputValue && len > 0) {
|
||||||
|
char* cur = &token[strlen(p_key)];
|
||||||
|
cur++;
|
||||||
|
while (*cur != ',') {
|
||||||
|
if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r')
|
||||||
|
break;
|
||||||
|
*p_outputValue++ = *cur++;
|
||||||
|
}
|
||||||
|
*p_outputValue = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
didMatch = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
token = strtok(NULL, ", \t\r\n:");
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] temp;
|
||||||
|
return didMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100b7210
|
||||||
|
void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
|
||||||
|
{
|
||||||
|
g_omniUserMessage = p_userMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should probably be somewhere else
|
||||||
|
// FUNCTION: LEGO1 0x100c0280
|
||||||
|
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
|
||||||
|
{
|
||||||
|
MxU8* buf;
|
||||||
|
_MMCKINFO tmpChunk;
|
||||||
|
|
||||||
|
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) {
|
||||||
|
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
|
||||||
|
|
||||||
|
buf = new MxU8[tmpChunk.cksize];
|
||||||
|
if (!buf) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_file->Read(buf, tmpChunk.cksize) != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save a copy so we can clean up properly, because
|
||||||
|
// this function will alter the pointer value.
|
||||||
|
MxU8* copy = buf;
|
||||||
|
MxDSObject* obj = DeserializeDSObjectDispatch(&buf, -1);
|
||||||
|
delete[] copy;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
#include "mxcontrolpresenter.h"
|
#include "mxcontrolpresenter.h"
|
||||||
|
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxticklemanager.h"
|
#include "mxticklemanager.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
|
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxautolocker.h"
|
#include "mxautolocker.h"
|
||||||
|
#include "mxomni.h"
|
||||||
#include "mxparam.h"
|
#include "mxparam.h"
|
||||||
#include "mxticklemanager.h"
|
#include "mxticklemanager.h"
|
||||||
#include "mxtypes.h"
|
#include "mxtypes.h"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "mxstreamchunk.h"
|
#include "mxstreamchunk.h"
|
||||||
|
|
||||||
#include "legoutil.h"
|
|
||||||
#include "mxdsbuffer.h"
|
#include "mxdsbuffer.h"
|
||||||
#include "mxstreamlist.h"
|
#include "mxstreamlist.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100c2fe0
|
// FUNCTION: LEGO1 0x100c2fe0
|
||||||
MxStreamChunk::~MxStreamChunk()
|
MxStreamChunk::~MxStreamChunk()
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "mxstreamcontroller.h"
|
#include "mxstreamcontroller.h"
|
||||||
|
|
||||||
#include "legoomni.h"
|
|
||||||
#include "legoutil.h"
|
|
||||||
#include "mxautolocker.h"
|
#include "mxautolocker.h"
|
||||||
#include "mxdsmultiaction.h"
|
#include "mxdsmultiaction.h"
|
||||||
#include "mxdsstreamingaction.h"
|
#include "mxdsstreamingaction.h"
|
||||||
#include "mxnextactiondatastart.h"
|
#include "mxnextactiondatastart.h"
|
||||||
|
#include "mxomni.h"
|
||||||
#include "mxstl/stlcompat.h"
|
#include "mxstl/stlcompat.h"
|
||||||
#include "mxstreamchunk.h"
|
#include "mxstreamchunk.h"
|
||||||
#include "mxtimer.h"
|
#include "mxtimer.h"
|
||||||
|
#include "mxutil.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxStreamController, 0x64)
|
DECOMP_SIZE_ASSERT(MxStreamController, 0x64)
|
||||||
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "mxstreamer.h"
|
#include "mxstreamer.h"
|
||||||
|
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxdiskstreamcontroller.h"
|
#include "mxdiskstreamcontroller.h"
|
||||||
#include "mxnotificationmanager.h"
|
#include "mxnotificationmanager.h"
|
||||||
|
#include "mxomni.h"
|
||||||
#include "mxramstreamcontroller.h"
|
#include "mxramstreamcontroller.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "mxdisplaysurface.h"
|
#include "mxdisplaysurface.h"
|
||||||
|
|
||||||
#include "legoomni.h"
|
#include "mxutil.h"
|
||||||
#include "mxvideomanager.h"
|
#include "mxvideomanager.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxcompositepresenter.h"
|
#include "mxcompositepresenter.h"
|
||||||
#include "mxdsmediaaction.h"
|
#include "mxdsmediaaction.h"
|
||||||
#include "mxomni.h"
|
#include "mxomni.h"
|
||||||
|
#include "mxutil.h"
|
||||||
#include "mxvideomanager.h"
|
#include "mxvideomanager.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c);
|
DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "mxvideomanager.h"
|
#include "mxvideomanager.h"
|
||||||
|
|
||||||
#include "legoomni.h"
|
|
||||||
#include "mxautolocker.h"
|
#include "mxautolocker.h"
|
||||||
#include "mxpresenter.h"
|
#include "mxpresenter.h"
|
||||||
#include "mxticklemanager.h"
|
#include "mxticklemanager.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user