mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 23:48:12 -05:00
Implement MxTransitionManager::SubmitCopyRect (#160)
* Implement MxTransitionManager::SubmitCopyRect * MxTransitionManager::SubmitCopyRect Amendments * Fix MxTransitionManager::EndTransition * Fix MxDSAction::SetLoopCount
This commit is contained in:
parent
6da912e932
commit
7c7311ea5e
4 changed files with 77 additions and 95 deletions
|
@ -18,6 +18,7 @@ class MxDSAction : public MxDSObject
|
||||||
Flag_Bit3 = 0x04,
|
Flag_Bit3 = 0x04,
|
||||||
Flag_Enabled = 0x20,
|
Flag_Enabled = 0x20,
|
||||||
Flag_Parsed = 0x80,
|
Flag_Parsed = 0x80,
|
||||||
|
Flag_Bit9 = 0x200,
|
||||||
};
|
};
|
||||||
|
|
||||||
__declspec(dllexport) MxDSAction();
|
__declspec(dllexport) MxDSAction();
|
||||||
|
@ -52,16 +53,18 @@ class MxDSAction : public MxDSObject
|
||||||
|
|
||||||
void AppendData(MxU16 p_extraLength, const char *p_extraData);
|
void AppendData(MxU16 p_extraLength, const char *p_extraData);
|
||||||
|
|
||||||
inline MxU32 GetFlags() { return this->m_flags; }
|
inline MxU32 GetFlags() { return m_flags; }
|
||||||
inline void SetFlags(MxU32 m_flags) { this->m_flags = m_flags; }
|
inline void SetFlags(MxU32 p_flags) { m_flags = p_flags; }
|
||||||
inline char *GetExtraData() { return m_extraData; }
|
inline char *GetExtraData() { return m_extraData; }
|
||||||
inline MxU16 GetExtraLength() const { return m_extraLength; }
|
inline MxU16 GetExtraLength() const { return m_extraLength; }
|
||||||
inline MxLong GetStartTime() const { return m_startTime; }
|
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 const MxVector3Data &GetLocation() const { return m_location; }
|
||||||
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
|
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
|
||||||
|
|
||||||
inline MxBool IsLooping() const { return this->m_flags & Flag_Looping; }
|
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }
|
||||||
inline MxBool IsBit3() const { return this->m_flags & Flag_Bit3; }
|
inline MxBool IsBit3() const { return m_flags & Flag_Bit3; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxU32 m_sizeOnDisk;
|
MxU32 m_sizeOnDisk;
|
||||||
|
|
|
@ -69,6 +69,7 @@ class MxPresenter : public MxCore
|
||||||
MxBool IsEnabled();
|
MxBool IsEnabled();
|
||||||
|
|
||||||
inline MxS32 GetDisplayZ() { return this->m_displayZ; }
|
inline MxS32 GetDisplayZ() { return this->m_displayZ; }
|
||||||
|
inline MxDSAction *GetAction() { return this->m_action; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
__declspec(dllexport) void Init();
|
__declspec(dllexport) void Init();
|
||||||
|
|
|
@ -13,9 +13,9 @@ MxTransitionManager::MxTransitionManager()
|
||||||
m_animationTimer = 0;
|
m_animationTimer = 0;
|
||||||
m_transitionType = NOT_TRANSITIONING;
|
m_transitionType = NOT_TRANSITIONING;
|
||||||
m_ddSurface = NULL;
|
m_ddSurface = NULL;
|
||||||
m_unk08 = 0;
|
m_waitIndicator = NULL;
|
||||||
m_unk1c = 0;
|
m_copyBuffer = NULL;
|
||||||
m_unk20.bit0 = FALSE;
|
m_copyFlags.bit0 = FALSE;
|
||||||
m_unk28.bit0 = FALSE;
|
m_unk28.bit0 = FALSE;
|
||||||
m_unk24 = 0;
|
m_unk24 = 0;
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@ MxTransitionManager::MxTransitionManager()
|
||||||
// OFFSET: LEGO1 0x1004ba00
|
// OFFSET: LEGO1 0x1004ba00
|
||||||
MxTransitionManager::~MxTransitionManager()
|
MxTransitionManager::~MxTransitionManager()
|
||||||
{
|
{
|
||||||
free(m_unk1c);
|
free(m_copyBuffer);
|
||||||
|
|
||||||
if (m_unk08 != NULL) {
|
if (m_waitIndicator != NULL) {
|
||||||
delete m_unk08->m_unk1c;
|
delete m_waitIndicator->GetAction();
|
||||||
delete m_unk08;
|
delete m_waitIndicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
TickleManager()->UnregisterClient(this);
|
TickleManager()->UnregisterClient(this);
|
||||||
|
@ -47,7 +47,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
|
||||||
if (m_transitionType != NOT_TRANSITIONING) {
|
if (m_transitionType != NOT_TRANSITIONING) {
|
||||||
m_transitionType = NOT_TRANSITIONING;
|
m_transitionType = NOT_TRANSITIONING;
|
||||||
|
|
||||||
m_unk20.bit0 = FALSE;
|
m_copyFlags.bit0 = FALSE;
|
||||||
|
|
||||||
TickleManager()->UnregisterClient(this);
|
TickleManager()->UnregisterClient(this);
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ void MxTransitionManager::Transition_Dissolve()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == DD_OK) {
|
if (res == DD_OK) {
|
||||||
FUN_1004c4d0(ddsd);
|
SubmitCopyRect(ddsd);
|
||||||
|
|
||||||
for (MxS32 i = 0; i < 640; i++) {
|
for (MxS32 i = 0; i < 640; i++) {
|
||||||
// Select 16 columns on each tick
|
// Select 16 columns on each tick
|
||||||
|
@ -129,7 +129,7 @@ void MxTransitionManager::Transition_Dissolve()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FUN_1004c580(ddsd);
|
SetupCopyRect(ddsd);
|
||||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||||
|
|
||||||
if (VideoManager()->GetVideoParam().flags().GetFlipSurfaces()) {
|
if (VideoManager()->GetVideoParam().flags().GetFlipSurfaces()) {
|
||||||
|
@ -141,24 +141,6 @@ void MxTransitionManager::Transition_Dissolve()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1004c470 STUB
|
|
||||||
void MxTransitionManager::SetWaitIndicator(MxVideoPresenter *videoPresenter)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1004c4d0 STUB
|
|
||||||
void MxTransitionManager::FUN_1004c4d0(DDSURFACEDESC &ddsc)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1004c580 STUB
|
|
||||||
void MxTransitionManager::FUN_1004c580(DDSURFACEDESC &ddsc)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1004baa0
|
// OFFSET: LEGO1 0x1004baa0
|
||||||
MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
||||||
{
|
{
|
||||||
|
@ -169,7 +151,7 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1004bb70
|
// OFFSET: LEGO1 0x1004bb70
|
||||||
MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, MxS32 p_speed,
|
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 (this->m_transitionType == NOT_TRANSITIONING) {
|
||||||
if (!p_playMusicInAnim) {
|
if (!p_playMusicInAnim) {
|
||||||
|
@ -179,14 +161,14 @@ MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, Mx
|
||||||
|
|
||||||
this->m_transitionType = p_animationType;
|
this->m_transitionType = p_animationType;
|
||||||
|
|
||||||
m_unk20.bit0 = p_unk;
|
m_copyFlags.bit0 = p_doCopy;
|
||||||
|
|
||||||
if (m_unk20.bit0 && m_unk08 != NULL) {
|
if (m_copyFlags.bit0 && m_waitIndicator != NULL) {
|
||||||
m_unk08->vtable54(1);
|
m_waitIndicator->Enable(TRUE);
|
||||||
|
|
||||||
MxTransitionManagerUnknownSubclass2 *iVar2 = m_unk08->m_unk1c;
|
MxDSAction *action = m_waitIndicator->GetAction();
|
||||||
iVar2->m_unk3c = 10000;
|
action->SetLoopCount(10000);
|
||||||
iVar2->m_unk30 |= 0x200;
|
action->SetFlags(action->GetFlags() | MxDSAction::Flag_Bit9);
|
||||||
}
|
}
|
||||||
|
|
||||||
MxU32 time = timeGetTime();
|
MxU32 time = timeGetTime();
|
||||||
|
@ -209,3 +191,47 @@ MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, Mx
|
||||||
}
|
}
|
||||||
return FAILURE;
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -5,52 +5,6 @@
|
||||||
#include "mxvideopresenter.h"
|
#include "mxvideopresenter.h"
|
||||||
#include "legoomni.h"
|
#include "legoomni.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
|
// VTABLE 0x100d7ea0
|
||||||
class MxTransitionManager : public MxCore
|
class MxTransitionManager : public MxCore
|
||||||
{
|
{
|
||||||
|
@ -86,21 +40,19 @@ class MxTransitionManager : public MxCore
|
||||||
BROKEN // Unknown what this is supposed to be, it locks the game up
|
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:
|
private:
|
||||||
void EndTransition(MxBool p_notifyWorld);
|
void EndTransition(MxBool p_notifyWorld);
|
||||||
void Transition_Dissolve();
|
void Transition_Dissolve();
|
||||||
void FUN_1004c4d0(DDSURFACEDESC &);
|
void SubmitCopyRect(DDSURFACEDESC &);
|
||||||
void FUN_1004c580(DDSURFACEDESC &);
|
void SetupCopyRect(DDSURFACEDESC &);
|
||||||
|
|
||||||
MxTransitionManagerUnknownSubclass1 *m_unk08;
|
MxVideoPresenter *m_waitIndicator;
|
||||||
undefined4 m_unk0c;
|
RECT m_copyRect;
|
||||||
undefined4 m_unk10;
|
void *m_copyBuffer;
|
||||||
undefined4 m_unk14;
|
|
||||||
undefined4 m_unk18;
|
flag_bitfield m_copyFlags;
|
||||||
void *m_unk1c;
|
|
||||||
flag_bitfield m_unk20;
|
|
||||||
undefined4 m_unk24;
|
undefined4 m_unk24;
|
||||||
flag_bitfield m_unk28;
|
flag_bitfield m_unk28;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue