mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-23 08:11:16 +00:00
Merge branch 'master' into omniheaders
This commit is contained in:
commit
ed7ed76773
@ -213,7 +213,7 @@ if (ISLE_USE_DX5)
|
||||
endif()
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(lego1 PRIVATE ddraw dsound dxguid winmm)
|
||||
target_link_libraries(lego1 PRIVATE ddraw dsound dxguid dinput winmm)
|
||||
|
||||
# Make sure filenames are ALL CAPS
|
||||
set_property(TARGET lego1 PROPERTY OUTPUT_NAME LEGO1)
|
||||
@ -272,4 +272,4 @@ if (MSVC)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/incremental:no")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/incremental:no /debug")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "/incremental:no")
|
||||
endif()
|
||||
endif()
|
||||
@ -1,25 +1,175 @@
|
||||
#include "legoinputmanager.h"
|
||||
#include "legocontrolmanager.h"
|
||||
#include "legoomni.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxautolocker.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338); // 0x10059085
|
||||
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338);
|
||||
|
||||
// OFFSET: LEGO1 0x1005b790 STUB
|
||||
// OFFSET: LEGO1 0x1005b790
|
||||
LegoInputManager::LegoInputManager()
|
||||
{
|
||||
// TODO
|
||||
m_unk0x5c = NULL;
|
||||
m_unk0x64 = 0;
|
||||
m_unk0x60 = 0;
|
||||
m_unk0x68 = NULL;
|
||||
m_unk0x80 = 0;
|
||||
m_timer = 0;
|
||||
m_unk0x6c = 0;
|
||||
m_unk0x70 = 0;
|
||||
m_controlManager = NULL;
|
||||
m_unk0x81 = 0;
|
||||
m_unk0x88 = FALSE;
|
||||
m_directInput = NULL;
|
||||
m_directInputDevice = NULL;
|
||||
m_unk0x94 = 0;
|
||||
m_unk0x195 = 0;
|
||||
m_joyid = -1;
|
||||
m_joystickIndex = -1;
|
||||
m_useJoystick = FALSE;
|
||||
m_unk0x335 = FALSE;
|
||||
m_unk0x336 = FALSE;
|
||||
m_unk0x74 = 0x19;
|
||||
m_timeout = 1000;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b8f0 STUB
|
||||
// OFFSET: LEGO1 0x1005b8b0 STUB
|
||||
MxResult LegoInputManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b8f0
|
||||
LegoInputManager::~LegoInputManager()
|
||||
{
|
||||
// TODO
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c740 STUB
|
||||
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
|
||||
// OFFSET: LEGO1 0x1005bfe0
|
||||
void LegoInputManager::Destroy()
|
||||
{
|
||||
// TODO
|
||||
ReleaseDX();
|
||||
|
||||
if (m_unk0x5c)
|
||||
delete m_unk0x5c;
|
||||
m_unk0x5c = NULL;
|
||||
|
||||
if (m_unk0x68)
|
||||
delete m_unk0x68;
|
||||
m_unk0x68 = NULL;
|
||||
|
||||
if (m_controlManager)
|
||||
delete m_controlManager;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c030
|
||||
void LegoInputManager::CreateAndAcquireKeyboard(HWND hwnd)
|
||||
{
|
||||
HINSTANCE hinstance = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE);
|
||||
HRESULT hresult = DirectInputCreate(hinstance, 0x500, &m_directInput, NULL); // 0x500 for DX5
|
||||
|
||||
if (hresult == DI_OK) {
|
||||
HRESULT createdeviceresult = m_directInput->CreateDevice(GUID_SysKeyboard, &m_directInputDevice, NULL);
|
||||
if (createdeviceresult == DI_OK) {
|
||||
m_directInputDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
|
||||
m_directInputDevice->SetDataFormat(&c_dfDIKeyboard);
|
||||
m_directInputDevice->Acquire();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c0a0
|
||||
void LegoInputManager::ReleaseDX()
|
||||
{
|
||||
if (m_directInputDevice != NULL) {
|
||||
m_directInputDevice->Unacquire();
|
||||
m_directInputDevice->Release();
|
||||
m_directInputDevice = NULL;
|
||||
}
|
||||
|
||||
if (m_directInput != NULL) {
|
||||
m_directInput->Release();
|
||||
m_directInput = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c240
|
||||
MxResult LegoInputManager::GetJoystickId()
|
||||
{
|
||||
JOYINFOEX joyinfoex;
|
||||
|
||||
if (m_useJoystick != FALSE) {
|
||||
MxS32 joyid = m_joystickIndex;
|
||||
if (joyid >= 0) {
|
||||
joyinfoex.dwSize = 0x34;
|
||||
joyinfoex.dwFlags = 0xFF;
|
||||
|
||||
if (joyGetPosEx(joyid, &joyinfoex) == JOYERR_NOERROR && joyGetDevCaps(joyid, &m_joyCaps, 0x194) == JOYERR_NOERROR) {
|
||||
m_joyid = joyid;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
for (joyid = JOYSTICKID1; joyid < 16; joyid++) {
|
||||
joyinfoex.dwSize = 0x34;
|
||||
joyinfoex.dwFlags = 0xFF;
|
||||
if (joyGetPosEx(joyid, &joyinfoex) == JOYERR_NOERROR && joyGetDevCaps(joyid, &m_joyCaps, 0x194) == JOYERR_NOERROR) {
|
||||
m_joyid = joyid;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c320
|
||||
MxResult LegoInputManager::GetJoystickState(MxU32 *joystick_x, MxU32 *joystick_y, DWORD *buttons_state, MxU32 *pov_position)
|
||||
{
|
||||
if (m_useJoystick != FALSE) {
|
||||
if (m_joyid < 0 && GetJoystickId() == -1) {
|
||||
m_useJoystick = FALSE;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
JOYINFOEX joyinfoex;
|
||||
joyinfoex.dwSize = 0x34;
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNBUTTONS;
|
||||
MxU32 capabilities = m_joyCaps.wCaps;
|
||||
|
||||
if ((capabilities & JOYCAPS_HASPOV) != 0) {
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS;
|
||||
|
||||
if ((capabilities & JOYCAPS_POVCTS) != 0)
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS | JOY_RETURNPOVCTS;
|
||||
}
|
||||
|
||||
MMRESULT mmresult = joyGetPosEx(m_joyid, &joyinfoex);
|
||||
|
||||
if (mmresult == MMSYSERR_NOERROR) {
|
||||
*buttons_state = joyinfoex.dwButtons;
|
||||
MxU32 xmin = m_joyCaps.wXmin;
|
||||
MxU32 ymax = m_joyCaps.wYmax;
|
||||
MxU32 ymin = m_joyCaps.wYmin;
|
||||
MxS32 ydiff = ymax - ymin;
|
||||
*joystick_x = ((joyinfoex.dwXpos - xmin) * 100) / (m_joyCaps.wXmax - xmin);
|
||||
*joystick_y = ((joyinfoex.dwYpos - m_joyCaps.wYmin) * 100) / ydiff;
|
||||
if ((m_joyCaps.wCaps & (JOYCAPS_POV4DIR | JOYCAPS_POVCTS)) != 0) {
|
||||
if (joyinfoex.dwPOV == JOY_POVCENTERED) {
|
||||
*pov_position = (MxU32) -1;
|
||||
return SUCCESS;
|
||||
}
|
||||
*pov_position = joyinfoex.dwPOV / 100;
|
||||
return SUCCESS;
|
||||
}
|
||||
else {
|
||||
*pov_position = (MxU32) -1;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c470 STUB
|
||||
@ -34,11 +184,25 @@ void LegoInputManager::UnRegister(MxCore *)
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b8b0 STUB
|
||||
MxResult LegoInputManager::Tickle()
|
||||
// OFFSET: LEGO1 0x1005c740 STUB
|
||||
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005cfb0
|
||||
void LegoInputManager::SetTimer()
|
||||
{
|
||||
LegoOmni* omni = LegoOmni::GetInstance();
|
||||
UINT timer = ::SetTimer(omni->GetWindowHandle(), 1, m_timeout, NULL);
|
||||
m_timer = timer;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005cfd0
|
||||
void LegoInputManager::KillTimer()
|
||||
{
|
||||
if (m_timer != 0) {
|
||||
LegoOmni* omni = LegoOmni::GetInstance();
|
||||
::KillTimer(omni->GetWindowHandle(), m_timer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxpresenter.h"
|
||||
#include "mxlist.h"
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
enum NotificationId
|
||||
{
|
||||
@ -14,6 +17,8 @@ enum NotificationId
|
||||
TIMER = 15
|
||||
};
|
||||
|
||||
class LegoControlManager;
|
||||
|
||||
// VTABLE 0x100d8760
|
||||
// SIZE 0x338
|
||||
class LegoInputManager : public MxPresenter
|
||||
@ -28,22 +33,42 @@ class LegoInputManager : public MxPresenter
|
||||
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
undefined m_pad40[0x48];
|
||||
void Destroy();
|
||||
void CreateAndAcquireKeyboard(HWND hwnd);
|
||||
void ReleaseDX();
|
||||
MxResult GetJoystickId();
|
||||
MxResult GetJoystickState(MxU32 *joystick_x, MxU32 *joystick_y, DWORD *buttons_state, MxU32 *pov_position);
|
||||
void SetTimer();
|
||||
void KillTimer();
|
||||
|
||||
MxBool m_unk88;
|
||||
undefined m_unk89[0x113];
|
||||
|
||||
// 0x19C
|
||||
int m_joystickIndex;
|
||||
|
||||
undefined m_pad1a0[0x194];
|
||||
|
||||
// 0x334
|
||||
//private:
|
||||
MxCriticalSection m_criticalSection;
|
||||
MxList<undefined4> *m_unk0x5c; // list or hash table
|
||||
undefined4 m_unk0x60;
|
||||
undefined4 m_unk0x64;
|
||||
MxList<undefined4> *m_unk0x68; // list or hash table
|
||||
undefined4 m_unk0x6c;
|
||||
undefined4 m_unk0x70;
|
||||
undefined4 m_unk0x74;
|
||||
UINT m_timer;
|
||||
UINT m_timeout;
|
||||
undefined m_unk0x80;
|
||||
undefined m_unk0x81;
|
||||
LegoControlManager* m_controlManager;
|
||||
MxBool m_unk0x88;
|
||||
IDirectInput *m_directInput;
|
||||
IDirectInputDevice *m_directInputDevice;
|
||||
undefined m_unk0x94;
|
||||
undefined4 m_unk0x98;
|
||||
undefined m_unk0x9c[0xF8];
|
||||
undefined m_unk0x194;
|
||||
MxBool m_unk0x195;
|
||||
MxS32 m_joyid;
|
||||
MxS32 m_joystickIndex;
|
||||
JOYCAPS m_joyCaps;
|
||||
MxBool m_useJoystick;
|
||||
|
||||
undefined m_unk335;
|
||||
MxBool m_unk336;
|
||||
undefined m_unk337;
|
||||
MxBool m_unk0x335;
|
||||
MxBool m_unk0x336;
|
||||
};
|
||||
|
||||
#endif // LEGOINPUTMANAGER_H
|
||||
|
||||
@ -312,3 +312,9 @@ MxBool LegoOmni::vtable40()
|
||||
// FIXME: Stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100157a0
|
||||
LegoWorld *GetCurrentWorld()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetCurrentWorld();
|
||||
}
|
||||
|
||||
@ -73,12 +73,16 @@ class LegoOmni : public MxOmni
|
||||
LegoGameState *GetGameState() { return m_gameState; }
|
||||
LegoNavController *GetNavController() { return m_navController; }
|
||||
MxTransitionManager *GetTransitionManager() { return m_transitionManager; }
|
||||
LegoWorld *GetCurrentWorld() { return m_currentWorld; }
|
||||
|
||||
private:
|
||||
int m_unk68;
|
||||
int m_unk6c;
|
||||
LegoInputManager *m_inputMgr; // 0x70
|
||||
char m_unk74[0x10];
|
||||
undefined4 m_unk74;
|
||||
undefined4 m_unk78;
|
||||
LegoWorld *m_currentWorld;
|
||||
undefined4 m_unk80;
|
||||
LegoNavController *m_navController; // 0x84
|
||||
Isle* m_isle; // 0x88
|
||||
char m_unk8c[0x4];
|
||||
@ -113,5 +117,6 @@ LegoBuildingManager* BuildingManager();
|
||||
Isle* GetIsle();
|
||||
LegoPlantManager* PlantManager();
|
||||
MxBool KeyValueStringParse(char *, const char *, const char *);
|
||||
LegoWorld *GetCurrentWorld();
|
||||
|
||||
#endif // LEGOOMNI_H
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
#include "motorcycle.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100357b0 STUB
|
||||
DECOMP_SIZE_ASSERT(Motorcycle, 0x16c);
|
||||
|
||||
// OFFSET: LEGO1 0x100357b0
|
||||
Motorcycle::Motorcycle()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk13c = 40.0;
|
||||
this->m_unk150 = 1.75;
|
||||
this->m_unk148 = 1;
|
||||
this->m_unk164 = 1.0;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef MOTORCYCLE_H
|
||||
#define MOTORCYCLE_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "islepathactor.h"
|
||||
|
||||
// VTABLE 0x100d7090
|
||||
@ -22,7 +23,10 @@ class Motorcycle : public IslePathActor
|
||||
{
|
||||
return !strcmp(name, Motorcycle::ClassName()) || IslePathActor::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
undefined m_unk160[4];
|
||||
MxFloat m_unk164;
|
||||
undefined m_unk168[4];
|
||||
};
|
||||
|
||||
#endif // MOTORCYCLE_H
|
||||
|
||||
@ -33,6 +33,7 @@ class MxDisplaySurface : public MxCore
|
||||
virtual void ReleaseDC(HDC p_hdc);
|
||||
virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4);
|
||||
|
||||
inline LPDIRECTDRAWSURFACE GetDirectDrawSurface1() { return this->m_ddSurface1; }
|
||||
inline LPDIRECTDRAWSURFACE GetDirectDrawSurface2() { return this->m_ddSurface2; }
|
||||
|
||||
private:
|
||||
|
||||
@ -18,6 +18,7 @@ class MxDSAction : public MxDSObject
|
||||
Flag_Bit3 = 0x04,
|
||||
Flag_Enabled = 0x20,
|
||||
Flag_Parsed = 0x80,
|
||||
Flag_Bit9 = 0x200,
|
||||
};
|
||||
|
||||
__declspec(dllexport) MxDSAction();
|
||||
@ -52,16 +53,18 @@ class MxDSAction : public MxDSObject
|
||||
|
||||
void AppendData(MxU16 p_extraLength, const char *p_extraData);
|
||||
|
||||
inline MxU32 GetFlags() { return this->m_flags; }
|
||||
inline void SetFlags(MxU32 m_flags) { this->m_flags = m_flags; }
|
||||
inline MxU32 GetFlags() { return m_flags; }
|
||||
inline void SetFlags(MxU32 p_flags) { m_flags = p_flags; }
|
||||
inline char *GetExtraData() { return m_extraData; }
|
||||
inline MxU16 GetExtraLength() const { return m_extraLength; }
|
||||
inline MxLong GetStartTime() const { return m_startTime; }
|
||||
inline MxS32 GetLoopCount() { return m_loopCount; }
|
||||
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
|
||||
inline const MxVector3Data &GetLocation() const { return m_location; }
|
||||
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
|
||||
|
||||
inline MxBool IsLooping() const { return this->m_flags & Flag_Looping; }
|
||||
inline MxBool IsBit3() const { return this->m_flags & Flag_Bit3; }
|
||||
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }
|
||||
inline MxBool IsBit3() const { return m_flags & Flag_Bit3; }
|
||||
|
||||
private:
|
||||
MxU32 m_sizeOnDisk;
|
||||
|
||||
@ -4,20 +4,28 @@
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxLoopingFlcPresenter, 0x6c);
|
||||
|
||||
// OFFSET: LEGO1 0x100b4310 STUB
|
||||
// OFFSET: LEGO1 0x100b4310
|
||||
MxLoopingFlcPresenter::MxLoopingFlcPresenter()
|
||||
{
|
||||
// TODO
|
||||
Init();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b43b0 STUB
|
||||
MxLoopingFlcPresenter::~MxLoopingFlcPresenter()
|
||||
{
|
||||
// TODO
|
||||
Destroy(TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b4410 STUB
|
||||
// OFFSET: LEGO1 0x100b4410
|
||||
void MxLoopingFlcPresenter::Init()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk68 = 0;
|
||||
this->m_flags &= 0xfd;
|
||||
this->m_flags &= 0xfb;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b4432 STUB
|
||||
void MxLoopingFlcPresenter::Destroy(MxBool p_param)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ class MxLoopingFlcPresenter : public MxFlcPresenter
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void Destroy(MxBool);
|
||||
|
||||
undefined4 m_unk68;
|
||||
};
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ class MxPresenter : public MxCore
|
||||
MxBool IsEnabled();
|
||||
|
||||
inline MxS32 GetDisplayZ() { return this->m_displayZ; }
|
||||
inline MxDSAction *GetAction() { return this->m_action; }
|
||||
|
||||
protected:
|
||||
__declspec(dllexport) void Init();
|
||||
|
||||
@ -8,15 +8,18 @@
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900);
|
||||
|
||||
// 0x100f4378
|
||||
RECT g_fullScreenRect = {0, 0, 640, 480};
|
||||
|
||||
// OFFSET: LEGO1 0x1004b8d0
|
||||
MxTransitionManager::MxTransitionManager()
|
||||
{
|
||||
m_animationTimer = 0;
|
||||
m_transitionType = NOT_TRANSITIONING;
|
||||
m_ddSurface = NULL;
|
||||
m_unk08 = 0;
|
||||
m_unk1c = 0;
|
||||
m_unk20.bit0 = FALSE;
|
||||
m_waitIndicator = NULL;
|
||||
m_copyBuffer = NULL;
|
||||
m_copyFlags.bit0 = FALSE;
|
||||
m_unk28.bit0 = FALSE;
|
||||
m_unk24 = 0;
|
||||
}
|
||||
@ -24,11 +27,11 @@ MxTransitionManager::MxTransitionManager()
|
||||
// OFFSET: LEGO1 0x1004ba00
|
||||
MxTransitionManager::~MxTransitionManager()
|
||||
{
|
||||
free(m_unk1c);
|
||||
free(m_copyBuffer);
|
||||
|
||||
if (m_unk08 != NULL) {
|
||||
delete m_unk08->m_unk1c;
|
||||
delete m_unk08;
|
||||
if (m_waitIndicator != NULL) {
|
||||
delete m_waitIndicator->GetAction();
|
||||
delete m_waitIndicator;
|
||||
}
|
||||
|
||||
TickleManager()->UnregisterClient(this);
|
||||
@ -42,10 +45,104 @@ MxResult MxTransitionManager::Tickle()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1004c470 STUB
|
||||
void MxTransitionManager::SetWaitIndicator(MxVideoPresenter *videoPresenter)
|
||||
// OFFSET: LEGO1 0x1004bc30
|
||||
void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
|
||||
{
|
||||
// TODO
|
||||
if (m_transitionType != NOT_TRANSITIONING) {
|
||||
m_transitionType = NOT_TRANSITIONING;
|
||||
|
||||
m_copyFlags.bit0 = FALSE;
|
||||
|
||||
TickleManager()->UnregisterClient(this);
|
||||
|
||||
if (p_notifyWorld) {
|
||||
LegoWorld *world = GetCurrentWorld();
|
||||
|
||||
if (world) {
|
||||
world->Notify(MxParam(0x18, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1004bd10
|
||||
void MxTransitionManager::Transition_Dissolve()
|
||||
{
|
||||
// If the animation is finished
|
||||
if (m_animationTimer == 40) {
|
||||
m_animationTimer = 0;
|
||||
EndTransition(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are starting the animation
|
||||
if (m_animationTimer == 0) {
|
||||
// Generate the list of columns in order...
|
||||
for (MxS32 i = 0; i < 640; i++) {
|
||||
m_columnOrder[i] = i;
|
||||
}
|
||||
|
||||
// ...then shuffle the list (to ensure that we hit each column once)
|
||||
for (i = 0; i < 640; i++) {
|
||||
MxS32 swap = rand() % 640;
|
||||
MxU16 t = m_columnOrder[i];
|
||||
m_columnOrder[i] = m_columnOrder[swap];
|
||||
m_columnOrder[swap] = t;
|
||||
}
|
||||
|
||||
// For each scanline, pick a random X offset
|
||||
for (i = 0; i < 480; i++) {
|
||||
m_randomShift[i] = rand() % 640;
|
||||
}
|
||||
}
|
||||
|
||||
// Run one tick of the animation
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
HRESULT res = m_ddSurface->Lock(NULL, &ddsd, 1, NULL);
|
||||
if (res == DDERR_SURFACELOST) {
|
||||
m_ddSurface->Restore();
|
||||
res = m_ddSurface->Lock(NULL, &ddsd, 1, NULL);
|
||||
}
|
||||
|
||||
if (res == DD_OK) {
|
||||
SubmitCopyRect(ddsd);
|
||||
|
||||
for (MxS32 i = 0; i < 640; i++) {
|
||||
// Select 16 columns on each tick
|
||||
if (m_animationTimer * 16 > m_columnOrder[i])
|
||||
continue;
|
||||
|
||||
if (m_animationTimer * 16 + 15 < m_columnOrder[i])
|
||||
continue;
|
||||
|
||||
for (MxS32 j = 0; j < 480; j++) {
|
||||
// Shift the chosen column a different amount at each scanline.
|
||||
// We use the same shift for that scanline each time.
|
||||
// By the end, every pixel gets hit.
|
||||
MxS32 ofs = (m_randomShift[j] + i) % 640;
|
||||
|
||||
// Set the chosen pixel to black
|
||||
if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) {
|
||||
((MxU8*)ddsd.lpSurface)[j * ddsd.lPitch + ofs] = 0;
|
||||
} else {
|
||||
((MxU16*)ddsd.lpSurface)[j * ddsd.lPitch + ofs] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetupCopyRect(ddsd);
|
||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||
|
||||
if (VideoManager()->GetVideoParam().flags().GetFlipSurfaces()) {
|
||||
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
|
||||
surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, 0x10);
|
||||
}
|
||||
|
||||
m_animationTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1004baa0
|
||||
@ -58,7 +155,7 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
||||
|
||||
// OFFSET: LEGO1 0x1004bb70
|
||||
MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, MxS32 p_speed,
|
||||
MxBool p_unk, MxBool p_playMusicInAnim)
|
||||
MxBool p_doCopy, MxBool p_playMusicInAnim)
|
||||
{
|
||||
if (this->m_transitionType == NOT_TRANSITIONING) {
|
||||
if (!p_playMusicInAnim) {
|
||||
@ -68,14 +165,14 @@ MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, Mx
|
||||
|
||||
this->m_transitionType = p_animationType;
|
||||
|
||||
m_unk20.bit0 = p_unk;
|
||||
m_copyFlags.bit0 = p_doCopy;
|
||||
|
||||
if (m_unk20.bit0 && m_unk08 != NULL) {
|
||||
m_unk08->vtable54(1);
|
||||
if (m_copyFlags.bit0 && m_waitIndicator != NULL) {
|
||||
m_waitIndicator->Enable(TRUE);
|
||||
|
||||
MxTransitionManagerUnknownSubclass2 *iVar2 = m_unk08->m_unk1c;
|
||||
iVar2->m_unk3c = 10000;
|
||||
iVar2->m_unk30 |= 0x200;
|
||||
MxDSAction *action = m_waitIndicator->GetAction();
|
||||
action->SetLoopCount(10000);
|
||||
action->SetFlags(action->GetFlags() | MxDSAction::Flag_Bit9);
|
||||
}
|
||||
|
||||
MxU32 time = timeGetTime();
|
||||
@ -87,8 +184,8 @@ MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, Mx
|
||||
tickleManager->RegisterClient(this, p_speed);
|
||||
|
||||
LegoInputManager *inputManager = InputManager();
|
||||
inputManager->m_unk88 = TRUE;
|
||||
inputManager->m_unk336 = FALSE;
|
||||
inputManager->m_unk0x88 = TRUE;
|
||||
inputManager->m_unk0x336 = FALSE;
|
||||
|
||||
LegoVideoManager *videoManager = VideoManager();
|
||||
videoManager->SetUnkE4(FALSE);
|
||||
@ -98,3 +195,47 @@ MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, Mx
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1004c470 STUB
|
||||
void MxTransitionManager::SetWaitIndicator(MxVideoPresenter *videoPresenter)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1004c4d0
|
||||
void MxTransitionManager::SubmitCopyRect(DDSURFACEDESC &ddsc)
|
||||
{
|
||||
// Check if the copy rect is setup
|
||||
if (m_copyFlags.bit0 == FALSE || m_waitIndicator == NULL || m_copyBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy the copy rect onto the surface
|
||||
char *dst;
|
||||
|
||||
DWORD bytesPerPixel = ddsc.ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
|
||||
const char *src = (const char *)m_copyBuffer;
|
||||
|
||||
LONG copyPitch;
|
||||
copyPitch = ((m_copyRect.right - m_copyRect.left) + 1) * bytesPerPixel;
|
||||
|
||||
LONG y;
|
||||
dst = (char *)ddsc.lpSurface + (ddsc.lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left);
|
||||
|
||||
for (y = 0; y < m_copyRect.bottom - m_copyRect.top + 1; ++y) {
|
||||
memcpy(dst, src, copyPitch);
|
||||
src += copyPitch;
|
||||
dst += ddsc.lPitch;
|
||||
}
|
||||
|
||||
// Free the copy buffer
|
||||
free(m_copyBuffer);
|
||||
m_copyBuffer = NULL;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1004c580 STUB
|
||||
void MxTransitionManager::SetupCopyRect(DDSURFACEDESC &ddsc)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -7,52 +7,6 @@
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
class MxTransitionManagerUnknownSubclass2
|
||||
{
|
||||
public:
|
||||
virtual ~MxTransitionManagerUnknownSubclass2(){}
|
||||
|
||||
undefined m_unk04[0x2c];
|
||||
undefined4 m_unk30;
|
||||
undefined4 m_unk34;
|
||||
undefined4 m_unk38;
|
||||
undefined4 m_unk3c;
|
||||
|
||||
};
|
||||
|
||||
// TODO: Don't know what this is yet
|
||||
class MxTransitionManagerUnknownSubclass1
|
||||
{
|
||||
public:
|
||||
virtual ~MxTransitionManagerUnknownSubclass1(){}
|
||||
|
||||
virtual void vtable04();
|
||||
virtual void vtable08();
|
||||
virtual void vtable0c();
|
||||
virtual void vtable10();
|
||||
virtual void vtable14();
|
||||
virtual void vtable18();
|
||||
virtual void vtable1c();
|
||||
virtual void vtable20();
|
||||
virtual void vtable24();
|
||||
virtual void vtable28();
|
||||
virtual void vtable2c();
|
||||
virtual void vtable30();
|
||||
virtual void vtable34();
|
||||
virtual void vtable38();
|
||||
virtual void vtable3c();
|
||||
virtual void vtable40();
|
||||
virtual void vtable44();
|
||||
virtual void vtable48();
|
||||
virtual void vtable4c();
|
||||
virtual void vtable50();
|
||||
virtual void vtable54(undefined4 p_unk1);
|
||||
|
||||
undefined m_unk04[0x18];
|
||||
MxTransitionManagerUnknownSubclass2 *m_unk1c;
|
||||
|
||||
};
|
||||
|
||||
// VTABLE 0x100d7ea0
|
||||
class MxTransitionManager : public MxCore
|
||||
{
|
||||
@ -88,25 +42,29 @@ class MxTransitionManager : public MxCore
|
||||
BROKEN // Unknown what this is supposed to be, it locks the game up
|
||||
};
|
||||
|
||||
MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_unk, MxBool p_playMusicInAnim);
|
||||
MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_doCopy, MxBool p_playMusicInAnim);
|
||||
|
||||
private:
|
||||
MxTransitionManagerUnknownSubclass1 *m_unk08;
|
||||
undefined4 m_unk0c;
|
||||
undefined4 m_unk10;
|
||||
undefined4 m_unk14;
|
||||
undefined4 m_unk18;
|
||||
void *m_unk1c;
|
||||
flag_bitfield m_unk20;
|
||||
void EndTransition(MxBool p_notifyWorld);
|
||||
void Transition_Dissolve();
|
||||
void SubmitCopyRect(DDSURFACEDESC &);
|
||||
void SetupCopyRect(DDSURFACEDESC &);
|
||||
|
||||
MxVideoPresenter *m_waitIndicator;
|
||||
RECT m_copyRect;
|
||||
void *m_copyBuffer;
|
||||
|
||||
flag_bitfield m_copyFlags;
|
||||
undefined4 m_unk24;
|
||||
flag_bitfield m_unk28;
|
||||
|
||||
TransitionType m_transitionType;
|
||||
LPDIRECTDRAWSURFACE m_ddSurface;
|
||||
MxU16 m_animationTimer;
|
||||
undefined m_pad36[0x8c2];
|
||||
MxULong m_systemTime;
|
||||
MxS32 m_animationSpeed;
|
||||
MxU16 m_columnOrder[640]; // 0x36
|
||||
MxU16 m_randomShift[480]; // 0x536
|
||||
MxULong m_systemTime; // 0x8f8
|
||||
MxS32 m_animationSpeed; // 0x8fc
|
||||
};
|
||||
|
||||
#endif // MXTRANSITIONMANAGER_H
|
||||
|
||||
Loading…
Reference in New Issue
Block a user