mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 09:24:17 +00:00
Refactor files based on beta debug build (#645)
* Rename LegoUnkSaveDataWriter -> LegoCharacterManager * Refactor mxomni into mxomni/mxmisc * Refactor legoomni into legoomni/misc * Resolve deps * Refactor atom * Refactor mxutil * Refactor mxio * Rename/relocate files * Fix format
This commit is contained in:
committed by
GitHub
parent
c62469fef4
commit
8069923651
@@ -3,10 +3,10 @@
|
||||
#include "define.h"
|
||||
#include "extra.h"
|
||||
#include "legoomni.h"
|
||||
#include "legoutil.h"
|
||||
#include "legoutils.h"
|
||||
#include "mxcompositepresenter.h"
|
||||
#include "mxmediapresenter.h"
|
||||
#include "mxomni.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxstreamchunk.h"
|
||||
#include "mxticklemanager.h"
|
||||
|
||||
|
||||
87
LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
Normal file
87
LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "legoanimationmanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f74f8
|
||||
int g_legoAnimationManagerConfig = 1;
|
||||
|
||||
// FUNCTION: LEGO1 0x1005eb50
|
||||
void LegoAnimationManager::configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig)
|
||||
{
|
||||
g_legoAnimationManagerConfig = p_legoAnimationManagerConfig;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005eb60
|
||||
LegoAnimationManager::LegoAnimationManager()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005ed30
|
||||
LegoAnimationManager::~LegoAnimationManager()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005ee80
|
||||
void LegoAnimationManager::FUN_1005ee80(MxBool)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005ef10
|
||||
void LegoAnimationManager::FUN_1005ef10()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005f0b0
|
||||
void LegoAnimationManager::FUN_1005f0b0()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005f130
|
||||
void LegoAnimationManager::Init()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005f6d0
|
||||
void LegoAnimationManager::FUN_1005f6d0(MxBool)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005f720
|
||||
void LegoAnimationManager::FUN_1005f720(MxS32 p_scriptIndex)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10061010
|
||||
void LegoAnimationManager::FUN_10061010(undefined4)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100619f0
|
||||
MxLong LegoAnimationManager::Notify(MxParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10061cc0
|
||||
MxResult LegoAnimationManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10064670
|
||||
void LegoAnimationManager::FUN_10064670(MxBool)
|
||||
{
|
||||
}
|
||||
76
LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp
Normal file
76
LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "legoanimmmpresenter.h"
|
||||
|
||||
// STUB: LEGO1 0x1004a8d0
|
||||
LegoAnimMMPresenter::LegoAnimMMPresenter()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004aaf0
|
||||
MxResult LegoAnimMMPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004aec0
|
||||
void LegoAnimMMPresenter::EndAction()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b140
|
||||
void LegoAnimMMPresenter::ReadyTickle()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b1c0
|
||||
void LegoAnimMMPresenter::StartingTickle()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b220
|
||||
void LegoAnimMMPresenter::StreamingTickle()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b250
|
||||
void LegoAnimMMPresenter::RepeatingTickle()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b2c0
|
||||
void LegoAnimMMPresenter::DoneTickle()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b2d0
|
||||
MxLong LegoAnimMMPresenter::Notify(MxParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b360
|
||||
void LegoAnimMMPresenter::VTable0x60(MxPresenter* p_presenter)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b390
|
||||
void LegoAnimMMPresenter::ParseExtra()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1004b8b0
|
||||
MxBool LegoAnimMMPresenter::FUN_1004b8b0()
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "legobackgroundcolor.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "legoomni.h"
|
||||
#include "legoutil.h"
|
||||
#include "legoutils.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "misc.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoBackgroundColor, 0x30)
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#include "legounksavedatawriter.h"
|
||||
#include "legocharactermanager.h"
|
||||
|
||||
#include "legogamestate.h"
|
||||
#include "legoomni.h"
|
||||
#include "mxmisc.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoUnkSaveDataWriter, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f80c0
|
||||
LegoSaveDataEntry3 g_saveDataInit[66]; // TODO: add data
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc4e4
|
||||
char* LegoUnkSaveDataWriter::g_customizeAnimFile = NULL;
|
||||
char* LegoCharacterManager::g_customizeAnimFile = NULL;
|
||||
|
||||
// GLOBAL: LEGO1 0x10104f20
|
||||
LegoSaveDataEntry3 g_saveData3[66];
|
||||
|
||||
// FUNCTION: LEGO1 0x10082a20
|
||||
LegoUnkSaveDataWriter::LegoUnkSaveDataWriter()
|
||||
LegoCharacterManager::LegoCharacterManager()
|
||||
{
|
||||
m_map = new LegoUnkSaveDataMap();
|
||||
InitSaveData();
|
||||
@@ -27,7 +27,7 @@ LegoUnkSaveDataWriter::LegoUnkSaveDataWriter()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10083270
|
||||
void LegoUnkSaveDataWriter::InitSaveData()
|
||||
void LegoCharacterManager::InitSaveData()
|
||||
{
|
||||
for (MxS32 i = 0; i < 66; i++) {
|
||||
g_saveData3[i] = g_saveDataInit[i];
|
||||
@@ -35,13 +35,13 @@ void LegoUnkSaveDataWriter::InitSaveData()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100832a0
|
||||
void LegoUnkSaveDataWriter::FUN_100832a0()
|
||||
void LegoCharacterManager::FUN_100832a0()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10083310
|
||||
MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_storage)
|
||||
MxResult LegoCharacterManager::WriteSaveData3(LegoStorage* p_storage)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
|
||||
@@ -91,13 +91,13 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_storage)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100833f0
|
||||
MxResult LegoUnkSaveDataWriter::ReadSaveData3(LegoStorage* p_storage)
|
||||
MxResult LegoCharacterManager::ReadSaveData3(LegoStorage* p_storage)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10083500
|
||||
LegoROI* LegoUnkSaveDataWriter::FUN_10083500(const char* p_key, MxBool p_option)
|
||||
LegoROI* LegoCharacterManager::FUN_10083500(const char* p_key, MxBool p_option)
|
||||
{
|
||||
// TODO
|
||||
// involves an STL map with a _Nil node at 0x100fc508
|
||||
@@ -105,33 +105,33 @@ LegoROI* LegoUnkSaveDataWriter::FUN_10083500(const char* p_key, MxBool p_option)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10083db0
|
||||
void LegoUnkSaveDataWriter::FUN_10083db0(LegoROI* p_roi)
|
||||
void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10083f10
|
||||
void LegoUnkSaveDataWriter::FUN_10083f10(LegoROI* p_roi)
|
||||
void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10084c00
|
||||
MxBool LegoUnkSaveDataWriter::FUN_10084c00(const LegoChar*)
|
||||
MxBool LegoCharacterManager::FUN_10084c00(const LegoChar*)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10085140
|
||||
MxU32 LegoUnkSaveDataWriter::FUN_10085140(LegoROI*, MxBool)
|
||||
MxU32 LegoCharacterManager::FUN_10085140(LegoROI*, MxBool)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100851a0
|
||||
void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value)
|
||||
void LegoCharacterManager::SetCustomizeAnimFile(const char* p_value)
|
||||
{
|
||||
if (g_customizeAnimFile != NULL) {
|
||||
delete[] g_customizeAnimFile;
|
||||
@@ -150,13 +150,13 @@ void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10085210
|
||||
LegoROI* LegoUnkSaveDataWriter::FUN_10085210(const LegoChar*, LegoChar*, undefined)
|
||||
LegoROI* LegoCharacterManager::FUN_10085210(const LegoChar*, LegoChar*, undefined)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10085a80
|
||||
LegoROI* LegoUnkSaveDataWriter::FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3)
|
||||
LegoROI* LegoCharacterManager::FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3)
|
||||
{
|
||||
return FUN_10085210(p_und1, p_und2, p_und3);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "legofullscreenmovie.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "legoomni.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "misc.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24)
|
||||
|
||||
@@ -10,15 +10,17 @@
|
||||
#include "jetski.h"
|
||||
#include "legoanimationmanager.h"
|
||||
#include "legobuildingmanager.h"
|
||||
#include "legocharactermanager.h"
|
||||
#include "legonavcontroller.h"
|
||||
#include "legoomni.h"
|
||||
#include "legoplantmanager.h"
|
||||
#include "legostate.h"
|
||||
#include "legounksavedatawriter.h"
|
||||
#include "legoutil.h"
|
||||
#include "legoutils.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "legoworld.h"
|
||||
#include "misc.h"
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxobjectfactory.h"
|
||||
#include "mxstring.h"
|
||||
#include "mxvariabletable.h"
|
||||
@@ -144,7 +146,7 @@ void LegoGameState::SetActor(MxU8 p_actorId)
|
||||
|
||||
IslePathActor* newActor = new IslePathActor();
|
||||
const char* actorName = LegoActor::GetActorName(m_actorId);
|
||||
LegoROI* roi = UnkSaveDataWriter()->FUN_10083500(actorName, FALSE);
|
||||
LegoROI* roi = CharacterManager()->FUN_10083500(actorName, FALSE);
|
||||
MxDSAction action;
|
||||
|
||||
action.SetAtomId(*g_isleScript);
|
||||
@@ -232,7 +234,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
}
|
||||
|
||||
WriteEndOfVariables(&fileStorage);
|
||||
UnkSaveDataWriter()->WriteSaveData3(&fileStorage);
|
||||
CharacterManager()->WriteSaveData3(&fileStorage);
|
||||
PlantManager()->Save(&fileStorage);
|
||||
result = BuildingManager()->Save(&fileStorage);
|
||||
|
||||
@@ -331,7 +333,7 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
SetLightPosition(atoi(lightPosition));
|
||||
}
|
||||
|
||||
if (UnkSaveDataWriter()->ReadSaveData3(&fileStorage) == FAILURE) {
|
||||
if (CharacterManager()->ReadSaveData3(&fileStorage) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (PlantManager()->Load(&fileStorage) == FAILURE) {
|
||||
@@ -1048,7 +1050,7 @@ void LegoGameState::Init()
|
||||
SetLightPosition(2);
|
||||
PlantManager()->Init();
|
||||
BuildingManager()->Init();
|
||||
UnkSaveDataWriter()->InitSaveData();
|
||||
CharacterManager()->InitSaveData();
|
||||
AnimationManager()->FUN_1005ee80(TRUE);
|
||||
SetColors();
|
||||
RemoveActor();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "legotextureinfo.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "misc.h"
|
||||
#include "misc/legoimage.h"
|
||||
#include "misc/legotexture.h"
|
||||
#include "tgl/d3drm/impl.h"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#include "legoutil.h"
|
||||
#include "legoutils.h"
|
||||
|
||||
#include "legoinputmanager.h"
|
||||
#include "legonamedtexture.h"
|
||||
#include "legoomni.h"
|
||||
#include "legoworld.h"
|
||||
#include "legoworldlist.h"
|
||||
#include "misc.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxnotificationmanager.h"
|
||||
#include "mxomni.h"
|
||||
#include "mxstreamer.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "legovariables.h"
|
||||
|
||||
#include "legobuildingmanager.h"
|
||||
#include "legoomni.h"
|
||||
#include "legocharactermanager.h"
|
||||
#include "legoplantmanager.h"
|
||||
#include "legounksavedatawriter.h"
|
||||
#include "misc.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(VisibilityVariable, 0x24)
|
||||
DECOMP_SIZE_ASSERT(CameraLocationVariable, 0x24)
|
||||
@@ -62,7 +62,7 @@ void CustomizeAnimFileVariable::SetValue(const char* p_value)
|
||||
{
|
||||
// STRING: LEGO1 0x100fc4f4
|
||||
if (strcmp(m_key.GetData(), "CUSTOMIZE_ANIM_FILE") == 0) {
|
||||
UnkSaveDataWriter()->SetCustomizeAnimFile(p_value);
|
||||
CharacterManager()->SetCustomizeAnimFile(p_value);
|
||||
PlantManager()->SetCustomizeAnimFile(p_value);
|
||||
BuildingManager()->SetCustomizeAnimFile(p_value);
|
||||
}
|
||||
|
||||
198
LEGO1/lego/legoomni/src/common/misc.cpp
Normal file
198
LEGO1/lego/legoomni/src/common/misc.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
#include "misc.h"
|
||||
|
||||
#include "legoinputmanager.h"
|
||||
#include "legoomni.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
#include "mxmisc.h"
|
||||
|
||||
// GLOBAL: LEGO1 0x100f4c58
|
||||
MxBool g_isWorldActive = TRUE;
|
||||
|
||||
// FUNCTION: LEGO1 0x10015700
|
||||
LegoOmni* Lego()
|
||||
{
|
||||
return LegoOmni::GetInstance();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015710
|
||||
LegoSoundManager* SoundManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetSoundManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015720
|
||||
LegoVideoManager* VideoManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetVideoManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015730
|
||||
MxBackgroundAudioManager* BackgroundAudioManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetBackgroundAudioManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015740
|
||||
LegoInputManager* InputManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetInputManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015750
|
||||
LegoControlManager* ControlManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetInputManager()->GetControlManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015760
|
||||
LegoGameState* GameState()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetGameState();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015770
|
||||
LegoAnimationManager* AnimationManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetAnimationManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015780
|
||||
LegoNavController* NavController()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetNavController();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015790
|
||||
IslePathActor* CurrentActor()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetCurrentActor();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100157a0
|
||||
LegoWorld* CurrentWorld()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetCurrentWorld();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100157b0
|
||||
LegoCharacterManager* CharacterManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetCharacterManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100157c0
|
||||
ViewManager* GetViewManager()
|
||||
{
|
||||
return VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100157e0
|
||||
LegoPlantManager* PlantManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetLegoPlantManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100157f0
|
||||
LegoBuildingManager* BuildingManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetLegoBuildingManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015800
|
||||
LegoTextureContainer* TextureContainer()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetTextureContainer();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015810
|
||||
ViewLODListManager* GetViewLODListManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetViewLODListManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015820
|
||||
void FUN_10015820(MxBool p_disable, MxU16 p_flags)
|
||||
{
|
||||
LegoOmni::GetInstance()->FUN_1005b4f0(p_disable, p_flags);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015840
|
||||
LegoROI* FindROI(const char* p_name)
|
||||
{
|
||||
return LegoOmni::GetInstance()->FindROI(p_name);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015860
|
||||
void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c)
|
||||
{
|
||||
LegoROI* roi = FindROI(p_name);
|
||||
|
||||
if (roi) {
|
||||
roi->SetUnknown0x0c(p_unk0x0c);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015880
|
||||
void SetCurrentActor(IslePathActor* p_currentActor)
|
||||
{
|
||||
LegoOmni::GetInstance()->SetCurrentActor(p_currentActor);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100158c0
|
||||
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)
|
||||
{
|
||||
return LegoOmni::GetInstance()->FindWorld(p_atom, p_entityid);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100158e0
|
||||
MxDSAction& GetCurrentAction()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetCurrentAction();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100158f0
|
||||
void SetCurrentWorld(LegoWorld* p_world)
|
||||
{
|
||||
LegoOmni::GetInstance()->SetCurrentWorld(p_world);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015900
|
||||
MxTransitionManager* TransitionManager()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetTransitionManager();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015910
|
||||
void PlayMusic(MxU32 p_index)
|
||||
{
|
||||
// index is the entityid of the music in jukebox.si
|
||||
MxDSAction action;
|
||||
action.SetAtomId(*g_jukeboxScript);
|
||||
action.SetObjectId(p_index);
|
||||
|
||||
LegoOmni::GetInstance()->GetBackgroundAudioManager()->PlayMusic(action, 5, 4);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100159c0
|
||||
void SetIsWorldActive(MxBool p_isWorldActive)
|
||||
{
|
||||
if (!p_isWorldActive) {
|
||||
LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL);
|
||||
}
|
||||
g_isWorldActive = p_isWorldActive;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100159e0
|
||||
void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last)
|
||||
{
|
||||
MxDSAction action;
|
||||
|
||||
action.SetAtomId(*p_id);
|
||||
action.SetUnknown24(-2);
|
||||
|
||||
for (MxS32 first = p_first, last = p_last; first <= last; first++) {
|
||||
action.SetObjectId(first);
|
||||
DeleteObject(action);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "mxcompositemediapresenter.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legosoundmanager.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "misc.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxdsmultiaction.h"
|
||||
#include "mxmediapresenter.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxobjectfactory.h"
|
||||
#include "mxtimer.h"
|
||||
|
||||
|
||||
338
LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp
Normal file
338
LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp
Normal file
@@ -0,0 +1,338 @@
|
||||
#include "mxcontrolpresenter.h"
|
||||
|
||||
#include "define.h"
|
||||
#include "legocontrolmanager.h"
|
||||
#include "mxdsmultiaction.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxtimer.h"
|
||||
#include "mxutilities.h"
|
||||
#include "mxvideopresenter.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
|
||||
|
||||
// GLOBAL: LEGO1 0x10102064
|
||||
// STRING: LEGO1 0x10101fec
|
||||
const char* g_style = "STYLE";
|
||||
|
||||
// GLOBAL: LEGO1 0x10102068
|
||||
// STRING: LEGO1 0x10101fe4
|
||||
const char* g_grid = "GRID";
|
||||
|
||||
// GLOBAL: LEGO1 0x1010206c
|
||||
// STRING: LEGO1 0x10101fe0
|
||||
const char* g_map = "MAP";
|
||||
|
||||
// GLOBAL: LEGO1 0x10102074
|
||||
// STRING: LEGO1 0x10101fd0
|
||||
const char* g_toggle = "TOGGLE";
|
||||
|
||||
// FUNCTION: LEGO1 0x10043f50
|
||||
MxControlPresenter::MxControlPresenter()
|
||||
{
|
||||
this->m_unk0x4c = 0;
|
||||
this->m_unk0x4e = -1;
|
||||
this->m_unk0x50 = FALSE;
|
||||
this->m_unk0x52 = 0;
|
||||
this->m_unk0x58 = 0;
|
||||
this->m_unk0x54 = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10043fd0
|
||||
void MxControlPresenter::RepeatingTickle()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10043fe0
|
||||
MxBool MxControlPresenter::VTable0x64(undefined4 p_undefined)
|
||||
{
|
||||
return m_unk0x50;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10043ff0
|
||||
void MxControlPresenter::VTable0x68(MxBool p_unk0x50)
|
||||
{
|
||||
m_unk0x50 = p_unk0x50;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044110
|
||||
MxControlPresenter::~MxControlPresenter()
|
||||
{
|
||||
if (m_unk0x58) {
|
||||
delete m_unk0x58;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044180
|
||||
MxResult MxControlPresenter::AddToManager()
|
||||
{
|
||||
m_unk0x4e = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044190
|
||||
MxResult MxControlPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
|
||||
{
|
||||
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
|
||||
|
||||
FUN_100b7220(m_action, MxDSAction::c_world | MxDSAction::c_looping, TRUE);
|
||||
ParseExtra();
|
||||
|
||||
MxS16 i = 0;
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
(*it)->Enable((m_unk0x4c != 3 || m_unk0x4e) && IsEnabled() ? m_unk0x4e == i : FALSE);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (m_unk0x4c == 3) {
|
||||
MxDSAction* action = (*m_list.begin())->GetAction();
|
||||
action->SetFlags(action->GetFlags() | MxDSAction::c_bit11);
|
||||
}
|
||||
|
||||
TickleManager()->RegisterClient(this, 200);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044260
|
||||
void MxControlPresenter::EndAction()
|
||||
{
|
||||
if (m_action) {
|
||||
m_unk0x50 = TRUE;
|
||||
MxCompositePresenter::EndAction();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044270
|
||||
MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter)
|
||||
{
|
||||
if (m_unk0x4c == 3) {
|
||||
MxVideoPresenter* frontPresenter = (MxVideoPresenter*) m_list.front();
|
||||
|
||||
if (p_presenter == frontPresenter || frontPresenter->GetDisplayZ() < p_presenter->GetDisplayZ()) {
|
||||
if (p_presenter->VTable0x7c()) {
|
||||
MxS32 height = frontPresenter->GetHeight();
|
||||
MxS32 width = frontPresenter->GetWidth();
|
||||
|
||||
if (frontPresenter->GetLocation().GetX() <= p_x &&
|
||||
p_x < width - 1 + frontPresenter->GetLocation().GetX() &&
|
||||
frontPresenter->GetLocation().GetY() <= p_y &&
|
||||
p_y < height - 1 + frontPresenter->GetLocation().GetY()) {
|
||||
MxU8* start;
|
||||
|
||||
if (frontPresenter->GetAlphaMask() == NULL) {
|
||||
start = frontPresenter->GetBitmap()->GetStart(
|
||||
p_x - frontPresenter->GetLocation().GetX(),
|
||||
p_y - frontPresenter->GetLocation().GetY()
|
||||
);
|
||||
}
|
||||
else {
|
||||
start = NULL;
|
||||
}
|
||||
|
||||
m_unk0x56 = 0;
|
||||
if (m_unk0x58 == NULL) {
|
||||
if (*start != 0) {
|
||||
m_unk0x56 = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (MxS16 i = 1; i <= *m_unk0x58; i++) {
|
||||
if (m_unk0x58[i] == *start) {
|
||||
m_unk0x56 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_unk0x56) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ContainsPresenter(m_list, p_presenter)) {
|
||||
if (m_unk0x4c == 2) {
|
||||
MxS32 width = p_presenter->GetWidth();
|
||||
MxS32 height = p_presenter->GetHeight();
|
||||
|
||||
if (m_unk0x52 == 2 && m_unk0x54 == 2) {
|
||||
MxS16 val;
|
||||
if (p_x < p_presenter->GetLocation().GetX() + width / 2) {
|
||||
val = 3;
|
||||
if (p_y < p_presenter->GetLocation().GetY() + height / 2) {
|
||||
val = 1;
|
||||
}
|
||||
m_unk0x56 = val;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
val = 4;
|
||||
if (p_y < p_presenter->GetLocation().GetY() + height / 2) {
|
||||
val = 2;
|
||||
}
|
||||
|
||||
m_unk0x56 = val;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_unk0x56 = -1;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044480
|
||||
MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter)
|
||||
{
|
||||
if (IsEnabled()) {
|
||||
switch (p_event->GetType()) {
|
||||
case c_notificationButtonUp:
|
||||
if (m_unk0x4c == 0 || m_unk0x4c == 2 || m_unk0x4c == 3) {
|
||||
p_event->SetClickedObjectId(m_action->GetObjectId());
|
||||
p_event->SetClickedAtom(m_action->GetAtomId().GetInternal());
|
||||
VTable0x6c(0);
|
||||
p_event->SetType(c_notificationClick);
|
||||
p_event->SetUnknown0x28(m_unk0x4e);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case c_notificationButtonDown:
|
||||
if (FUN_10044270(p_event->GetX(), p_event->GetY(), (MxVideoPresenter*) p_presenter)) {
|
||||
p_event->SetClickedObjectId(m_action->GetObjectId());
|
||||
p_event->SetClickedAtom(m_action->GetAtomId().GetInternal());
|
||||
VTable0x6c(m_unk0x56);
|
||||
p_event->SetType(c_notificationClick);
|
||||
p_event->SetUnknown0x28(m_unk0x4e);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044540
|
||||
void MxControlPresenter::VTable0x6c(MxS16 p_val)
|
||||
{
|
||||
if (p_val == -1) {
|
||||
if ((MxS16) ((MxDSMultiAction*) m_action)->GetActionList()->GetCount() - m_unk0x4e == 1) {
|
||||
m_unk0x4e = 0;
|
||||
}
|
||||
else {
|
||||
m_unk0x4e++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_unk0x4e = p_val;
|
||||
}
|
||||
|
||||
m_action->SetUnknown90(Timer()->GetTime());
|
||||
|
||||
MxS16 i = 0;
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
(*it)->Enable(((m_unk0x4c == 3 && m_unk0x4e == 0) || !IsEnabled()) ? FALSE : m_unk0x4e == i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044610
|
||||
void MxControlPresenter::ReadyTickle()
|
||||
{
|
||||
MxPresenter::ParseExtra();
|
||||
TickleManager()->UnregisterClient(this);
|
||||
ProgressTickleState(e_repeating);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044640
|
||||
void MxControlPresenter::ParseExtra()
|
||||
{
|
||||
MxU16 extraLength;
|
||||
char* extraData;
|
||||
m_action->GetExtra(extraLength, extraData);
|
||||
|
||||
if (extraLength & MAXWORD) {
|
||||
char extraCopy[256];
|
||||
memcpy(extraCopy, extraData, extraLength & MAXWORD);
|
||||
extraCopy[extraLength & MAXWORD] = '\0';
|
||||
|
||||
char output[256];
|
||||
if (KeyValueStringParse(output, g_style, extraCopy)) {
|
||||
char* str = strtok(output, g_parseExtraTokens);
|
||||
|
||||
if (!strcmpi(str, g_toggle)) {
|
||||
m_unk0x4c = 1;
|
||||
}
|
||||
else if (!strcmpi(str, g_grid)) {
|
||||
m_unk0x4c = 2;
|
||||
m_unk0x52 = atoi(strtok(NULL, g_parseExtraTokens));
|
||||
m_unk0x54 = atoi(strtok(NULL, g_parseExtraTokens));
|
||||
}
|
||||
else if (!strcmpi(str, g_map)) {
|
||||
m_unk0x4c = 3;
|
||||
str = strtok(NULL, g_parseExtraTokens);
|
||||
|
||||
if (str) {
|
||||
MxS16 count = atoi(str);
|
||||
m_unk0x58 = new MxS16[count + 1];
|
||||
*m_unk0x58 = count;
|
||||
|
||||
for (MxS16 i = 1; i <= count; i++) {
|
||||
m_unk0x58[i] = atoi(strtok(NULL, g_parseExtraTokens));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_unk0x4c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (KeyValueStringParse(output, g_strVISIBILITY, extraCopy)) {
|
||||
if (!strcmpi(output, "FALSE")) {
|
||||
Enable(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044820
|
||||
void MxControlPresenter::Enable(MxBool p_enable)
|
||||
{
|
||||
if (MxPresenter::IsEnabled() != p_enable) {
|
||||
MxPresenter::Enable(p_enable);
|
||||
|
||||
MxS16 i = 0;
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
if (i == m_unk0x4e) {
|
||||
(*it)->Enable((m_unk0x4c != 3 || i != 0) ? p_enable : 0);
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!p_enable) {
|
||||
m_unk0x4e = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100448a0
|
||||
MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState)
|
||||
{
|
||||
MxCompositePresenterList::iterator it = m_list.begin();
|
||||
for (MxS16 i = m_unk0x4e; i > 0; i--, it++) {
|
||||
;
|
||||
}
|
||||
|
||||
return (*it)->HasTickleStatePassed(p_tickleState);
|
||||
}
|
||||
602
LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp
Normal file
602
LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp
Normal file
@@ -0,0 +1,602 @@
|
||||
#include "mxtransitionmanager.h"
|
||||
|
||||
#include "legoinputmanager.h"
|
||||
#include "legoutils.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "legoworld.h"
|
||||
#include "misc.h"
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxparam.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxvideopresenter.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900);
|
||||
|
||||
// GLOBAL: LEGO1 0x100f4378
|
||||
RECT g_fullScreenRect = {0, 0, 640, 480};
|
||||
|
||||
// FUNCTION: LEGO1 0x1004b8d0
|
||||
MxTransitionManager::MxTransitionManager()
|
||||
{
|
||||
m_animationTimer = 0;
|
||||
m_transitionType = e_notTransitioning;
|
||||
m_ddSurface = NULL;
|
||||
m_waitIndicator = NULL;
|
||||
m_copyBuffer = NULL;
|
||||
m_copyFlags.m_bit0 = FALSE;
|
||||
m_unk0x28.m_bit0 = FALSE;
|
||||
m_unk0x24 = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004ba00
|
||||
MxTransitionManager::~MxTransitionManager()
|
||||
{
|
||||
delete[] m_copyBuffer;
|
||||
|
||||
if (m_waitIndicator != NULL) {
|
||||
delete m_waitIndicator->GetAction();
|
||||
delete m_waitIndicator;
|
||||
}
|
||||
|
||||
TickleManager()->UnregisterClient(this);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004baa0
|
||||
MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
||||
{
|
||||
LegoVideoManager* videoManager = VideoManager();
|
||||
this->m_ddSurface = videoManager->GetDisplaySurface()->GetDirectDrawSurface2();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004bac0
|
||||
MxResult MxTransitionManager::Tickle()
|
||||
{
|
||||
if (this->m_animationSpeed + this->m_systemTime > timeGetTime()) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
this->m_systemTime = timeGetTime();
|
||||
|
||||
switch (this->m_transitionType) {
|
||||
case e_noAnimation:
|
||||
TransitionNone();
|
||||
break;
|
||||
case e_dissolve:
|
||||
TransitionDissolve();
|
||||
break;
|
||||
case e_pixelation:
|
||||
TransitionPixelation();
|
||||
break;
|
||||
case e_screenWipe:
|
||||
TransitionWipe();
|
||||
break;
|
||||
case e_windows:
|
||||
TransitionWindows();
|
||||
break;
|
||||
case e_broken:
|
||||
TransitionBroken();
|
||||
break;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004bb70
|
||||
MxResult MxTransitionManager::StartTransition(
|
||||
TransitionType p_animationType,
|
||||
MxS32 p_speed,
|
||||
MxBool p_doCopy,
|
||||
MxBool p_playMusicInAnim
|
||||
)
|
||||
{
|
||||
if (this->m_transitionType == e_notTransitioning) {
|
||||
if (!p_playMusicInAnim) {
|
||||
MxBackgroundAudioManager* backgroundAudioManager = BackgroundAudioManager();
|
||||
backgroundAudioManager->Stop();
|
||||
}
|
||||
|
||||
this->m_transitionType = p_animationType;
|
||||
|
||||
m_copyFlags.m_bit0 = p_doCopy;
|
||||
|
||||
if (m_copyFlags.m_bit0 && m_waitIndicator != NULL) {
|
||||
m_waitIndicator->Enable(TRUE);
|
||||
|
||||
MxDSAction* action = m_waitIndicator->GetAction();
|
||||
action->SetLoopCount(10000);
|
||||
action->SetFlags(action->GetFlags() | MxDSAction::c_bit10);
|
||||
}
|
||||
|
||||
MxU32 time = timeGetTime();
|
||||
this->m_systemTime = time;
|
||||
|
||||
this->m_animationSpeed = p_speed;
|
||||
|
||||
MxTickleManager* tickleManager = TickleManager();
|
||||
tickleManager->RegisterClient(this, p_speed);
|
||||
|
||||
LegoInputManager* inputManager = InputManager();
|
||||
inputManager->SetUnknown88(TRUE);
|
||||
inputManager->SetUnknown336(FALSE);
|
||||
|
||||
LegoVideoManager* videoManager = VideoManager();
|
||||
videoManager->SetRender3D(FALSE);
|
||||
|
||||
SetAppCursor(1);
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004bc30
|
||||
void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
|
||||
{
|
||||
if (m_transitionType != e_notTransitioning) {
|
||||
m_transitionType = e_notTransitioning;
|
||||
|
||||
m_copyFlags.m_bit0 = FALSE;
|
||||
|
||||
TickleManager()->UnregisterClient(this);
|
||||
|
||||
if (p_notifyWorld) {
|
||||
LegoWorld* world = CurrentWorld();
|
||||
|
||||
if (world) {
|
||||
#ifdef COMPAT_MODE
|
||||
{
|
||||
MxNotificationParam param(c_notificationTransitioned, this);
|
||||
world->Notify(param);
|
||||
}
|
||||
#else
|
||||
world->Notify(MxNotificationParam(c_notificationTransitioned, this));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004bcf0
|
||||
void MxTransitionManager::TransitionNone()
|
||||
{
|
||||
LegoVideoManager* videoManager = VideoManager();
|
||||
videoManager->GetDisplaySurface()->ClearScreen();
|
||||
EndTransition(TRUE);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004bd10
|
||||
void MxTransitionManager::TransitionDissolve()
|
||||
{
|
||||
// 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...
|
||||
MxS32 i;
|
||||
for (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, DDLOCK_WAIT, NULL);
|
||||
if (res == DDERR_SURFACELOST) {
|
||||
m_ddSurface->Restore();
|
||||
res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
}
|
||||
|
||||
if (res == DD_OK) {
|
||||
SubmitCopyRect(&ddsd);
|
||||
|
||||
for (MxS32 col = 0; col < 640; col++) {
|
||||
// Select 16 columns on each tick
|
||||
if (m_animationTimer * 16 > m_columnOrder[col]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_animationTimer * 16 + 15 < m_columnOrder[col]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (MxS32 row = 0; row < 480; row++) {
|
||||
// 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 xShift = (m_randomShift[row] + col) % 640;
|
||||
|
||||
// Set the chosen pixel to black
|
||||
if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) {
|
||||
MxU8* surf = (MxU8*) ddsd.lpSurface + ddsd.lPitch * row + xShift;
|
||||
*surf = 0;
|
||||
}
|
||||
else {
|
||||
MxU8* surf = (MxU8*) ddsd.lpSurface + ddsd.lPitch * row + xShift * 2;
|
||||
*(MxU16*) surf = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetupCopyRect(&ddsd);
|
||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||
|
||||
if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) {
|
||||
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
|
||||
surf->BltFast(0, 0, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
|
||||
}
|
||||
|
||||
m_animationTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004bed0
|
||||
void MxTransitionManager::TransitionPixelation()
|
||||
{
|
||||
if (m_animationTimer == 16) {
|
||||
m_animationTimer = 0;
|
||||
EndTransition(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_animationTimer == 0) {
|
||||
// Same init/shuffle steps as the dissolve transition, except that
|
||||
// we are using big blocky pixels and only need 64 columns.
|
||||
MxS32 i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
m_columnOrder[i] = i;
|
||||
}
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
MxS32 swap = rand() % 64;
|
||||
MxU16 t = m_columnOrder[i];
|
||||
m_columnOrder[i] = m_columnOrder[swap];
|
||||
m_columnOrder[swap] = t;
|
||||
}
|
||||
|
||||
// The same is true here. We only need 48 rows.
|
||||
for (i = 0; i < 48; i++) {
|
||||
m_randomShift[i] = rand() % 64;
|
||||
}
|
||||
}
|
||||
|
||||
// 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 col = 0; col < 64; col++) {
|
||||
// Select 4 columns on each tick
|
||||
if (m_animationTimer * 4 > m_columnOrder[col]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_animationTimer * 4 + 3 < m_columnOrder[col]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (MxS32 row = 0; row < 48; row++) {
|
||||
// To do the pixelation, we subdivide the 640x480 surface into
|
||||
// 10x10 pixel blocks. At the chosen block, we sample the top-leftmost
|
||||
// color and set the other 99 pixels to that value.
|
||||
|
||||
// First, get the offset of the 10x10 block that we will sample for this row.
|
||||
MxS32 xShift = 10 * ((m_randomShift[row] + col) % 64);
|
||||
|
||||
// Combine xShift with this value to target the correct location in the buffer.
|
||||
MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
|
||||
// Seek to the sample position.
|
||||
MxU8* source = (MxU8*) ddsd.lpSurface + 10 * row * ddsd.lPitch + bytesPerPixel * xShift;
|
||||
|
||||
// Sample byte or word depending on display mode.
|
||||
MxU32 sample = bytesPerPixel == 1 ? *source : *(MxU16*) source;
|
||||
|
||||
// For each of the 10 rows in the 10x10 square:
|
||||
for (MxS32 k = 10 * row; k < 10 * row + 10; k++) {
|
||||
if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) {
|
||||
MxU8* pos = (MxU8*) ddsd.lpSurface + k * ddsd.lPitch + xShift;
|
||||
|
||||
for (MxS32 tt = 0; tt < 10; tt++) {
|
||||
pos[tt] = sample;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Need to double xShift because it measures pixels not bytes
|
||||
MxU16* pos = (MxU16*) ((MxU8*) ddsd.lpSurface + k * ddsd.lPitch + 2 * xShift);
|
||||
|
||||
for (MxS32 tt = 0; tt < 10; tt++) {
|
||||
pos[tt] = sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetupCopyRect(&ddsd);
|
||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||
|
||||
if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) {
|
||||
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
|
||||
surf->BltFast(0, 0, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
|
||||
}
|
||||
|
||||
m_animationTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004c170
|
||||
void MxTransitionManager::TransitionWipe()
|
||||
{
|
||||
// If the animation is finished
|
||||
if (m_animationTimer == 240) {
|
||||
m_animationTimer = 0;
|
||||
EndTransition(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
HRESULT res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
if (res == DDERR_SURFACELOST) {
|
||||
m_ddSurface->Restore();
|
||||
res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
}
|
||||
|
||||
if (res == DD_OK) {
|
||||
SubmitCopyRect(&ddsd);
|
||||
|
||||
// For each of the 240 animation ticks, blank out two scanlines
|
||||
// starting at the top of the screen.
|
||||
// (dwRGBBitCount / 8) will tell how many bytes are used per pixel.
|
||||
MxU8* line = (MxU8*) ddsd.lpSurface + 2 * ddsd.lPitch * m_animationTimer;
|
||||
memset(line, 0, 640 * ddsd.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
|
||||
line += ddsd.lPitch;
|
||||
memset(line, 0, 640 * ddsd.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
|
||||
SetupCopyRect(&ddsd);
|
||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||
|
||||
m_animationTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004c270
|
||||
void MxTransitionManager::TransitionWindows()
|
||||
{
|
||||
if (m_animationTimer == 240) {
|
||||
m_animationTimer = 0;
|
||||
EndTransition(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
HRESULT res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
if (res == DDERR_SURFACELOST) {
|
||||
m_ddSurface->Restore();
|
||||
res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
}
|
||||
|
||||
if (res == DD_OK) {
|
||||
SubmitCopyRect(&ddsd);
|
||||
|
||||
MxU8* line = (MxU8*) ddsd.lpSurface + m_animationTimer * ddsd.lPitch;
|
||||
|
||||
MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
MxS32 bytesPerLine = bytesPerPixel * 640;
|
||||
|
||||
memset(line, 0, bytesPerLine);
|
||||
|
||||
for (MxS32 i = m_animationTimer + 1; i < 480 - m_animationTimer; i++) {
|
||||
line += ddsd.lPitch;
|
||||
|
||||
memset(line + m_animationTimer * bytesPerPixel, 0, bytesPerPixel);
|
||||
memset(line + 640 + (-1 - m_animationTimer) * bytesPerPixel, 0, bytesPerPixel);
|
||||
}
|
||||
|
||||
line += ddsd.lPitch;
|
||||
memset(line, 0, bytesPerLine);
|
||||
|
||||
SetupCopyRect(&ddsd);
|
||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||
|
||||
m_animationTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004c3e0
|
||||
void MxTransitionManager::TransitionBroken()
|
||||
{
|
||||
// This function has no actual animation logic.
|
||||
// It also never calls EndTransition to
|
||||
// properly terminate the transition, so
|
||||
// the game just hangs forever.
|
||||
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
HRESULT res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
if (res == DDERR_SURFACELOST) {
|
||||
m_ddSurface->Restore();
|
||||
res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
||||
}
|
||||
|
||||
if (res == DD_OK) {
|
||||
SubmitCopyRect(&ddsd);
|
||||
SetupCopyRect(&ddsd);
|
||||
m_ddSurface->Unlock(ddsd.lpSurface);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004c470
|
||||
void MxTransitionManager::SetWaitIndicator(MxVideoPresenter* p_waitIndicator)
|
||||
{
|
||||
// End current wait indicator
|
||||
if (m_waitIndicator != NULL) {
|
||||
m_waitIndicator->GetAction()->SetFlags(m_waitIndicator->GetAction()->GetFlags() & ~MxDSAction::c_world);
|
||||
m_waitIndicator->EndAction();
|
||||
m_waitIndicator = NULL;
|
||||
}
|
||||
|
||||
// Check if we were given a new wait indicator
|
||||
if (p_waitIndicator != NULL) {
|
||||
// Setup the new wait indicator
|
||||
m_waitIndicator = p_waitIndicator;
|
||||
|
||||
LegoVideoManager* videoManager = VideoManager();
|
||||
videoManager->UnregisterPresenter(*m_waitIndicator);
|
||||
|
||||
if (m_waitIndicator->GetCurrentTickleState() < MxPresenter::e_streaming) {
|
||||
m_waitIndicator->Tickle();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Disable copy rect
|
||||
m_copyFlags.m_bit0 = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004c4d0
|
||||
void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC p_ddsc)
|
||||
{
|
||||
// Check if the copy rect is setup
|
||||
if (m_copyFlags.m_bit0 == FALSE || m_waitIndicator == NULL || m_copyBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy the copy rect onto the surface
|
||||
MxU8* dst;
|
||||
|
||||
MxU32 bytesPerPixel = p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
|
||||
const MxU8* src = (const MxU8*) m_copyBuffer;
|
||||
|
||||
MxS32 copyPitch;
|
||||
copyPitch = ((m_copyRect.right - m_copyRect.left) + 1) * bytesPerPixel;
|
||||
|
||||
MxS32 y;
|
||||
dst = (MxU8*) p_ddsc->lpSurface + (p_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 += p_ddsc->lPitch;
|
||||
}
|
||||
|
||||
// Free the copy buffer
|
||||
delete[] m_copyBuffer;
|
||||
m_copyBuffer = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004c580
|
||||
void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC p_ddsc)
|
||||
{
|
||||
// Check if the copy rect is setup
|
||||
if (m_copyFlags.m_bit0 == FALSE || m_waitIndicator == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Tickle wait indicator
|
||||
m_waitIndicator->Tickle();
|
||||
|
||||
// Check if wait indicator has started
|
||||
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::e_streaming) {
|
||||
// Setup the copy rect
|
||||
MxU32 copyPitch = (p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8) *
|
||||
(m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
|
||||
MxU32 bytesPerPixel = p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
|
||||
m_copyRect.left = m_waitIndicator->GetLocation().GetX();
|
||||
m_copyRect.top = m_waitIndicator->GetLocation().GetY();
|
||||
|
||||
MxS32 height = m_waitIndicator->GetHeight();
|
||||
MxS32 width = m_waitIndicator->GetWidth();
|
||||
|
||||
m_copyRect.right = m_copyRect.left + width - 1;
|
||||
m_copyRect.bottom = m_copyRect.top + height - 1;
|
||||
|
||||
// Allocate the copy buffer
|
||||
const MxU8* src =
|
||||
(const MxU8*) p_ddsc->lpSurface + m_copyRect.top * p_ddsc->lPitch + bytesPerPixel * m_copyRect.left;
|
||||
|
||||
m_copyBuffer = new MxU8[bytesPerPixel * width * height];
|
||||
if (!m_copyBuffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy into the copy buffer
|
||||
MxU8* dst = m_copyBuffer;
|
||||
|
||||
for (MxS32 i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++) {
|
||||
memcpy(dst, src, copyPitch);
|
||||
src += p_ddsc->lPitch;
|
||||
dst += copyPitch;
|
||||
}
|
||||
}
|
||||
|
||||
// Setup display surface
|
||||
if ((m_waitIndicator->GetAction()->GetFlags() & MxDSAction::c_bit5) != 0) {
|
||||
MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface();
|
||||
MxBool und = FALSE;
|
||||
displaySurface->VTable0x2c(
|
||||
p_ddsc,
|
||||
m_waitIndicator->GetBitmap(),
|
||||
0,
|
||||
0,
|
||||
m_waitIndicator->GetLocation().GetX(),
|
||||
m_waitIndicator->GetLocation().GetY(),
|
||||
m_waitIndicator->GetWidth(),
|
||||
m_waitIndicator->GetHeight(),
|
||||
und
|
||||
);
|
||||
}
|
||||
else {
|
||||
MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface();
|
||||
displaySurface->VTable0x24(
|
||||
p_ddsc,
|
||||
m_waitIndicator->GetBitmap(),
|
||||
0,
|
||||
0,
|
||||
m_waitIndicator->GetLocation().GetX(),
|
||||
m_waitIndicator->GetLocation().GetY(),
|
||||
m_waitIndicator->GetWidth(),
|
||||
m_waitIndicator->GetHeight()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user