mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-26 09:54:18 +00:00
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy
* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def
* Add initial .clang-tidy and fixes
* fix file perms
* Comment out DESCRIPTION
* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def
* Looks like clang is allergic to the libs in the directx5 SDK
* Update .clang-tidy
* Fix typo in .clang-tidy
* Attempt to generate an action error
* Revert "Attempt to generate an action error"
This reverts commit 96c4c65fed.
* cmake: test with -Wparentheses + optionally with -Werror
* ci: -k0 is a Ninja argument
* Use -Werror only for msys2 builds
* cmake: only emit warnings for specific warnings
* cmake: and don't do -Werror/-WX anymore
* Fix warnings
* Fix mingw warnings
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
committed by
GitHub
parent
97d1ba7c71
commit
9e686e2a87
@@ -47,8 +47,9 @@ MxResult MxBackgroundAudioManager::Create(MxAtomId& p_script, MxU32 p_frequencyM
|
||||
// FUNCTION: LEGO1 0x1007ed20
|
||||
MxResult MxBackgroundAudioManager::OpenMusic(MxAtomId& p_script)
|
||||
{
|
||||
if (m_script.GetInternal())
|
||||
if (m_script.GetInternal()) {
|
||||
DestroyMusic();
|
||||
}
|
||||
|
||||
MxResult result = FAILURE;
|
||||
|
||||
@@ -264,15 +265,17 @@ MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_
|
||||
// FUNCTION: LEGO1 0x1007f470
|
||||
void MxBackgroundAudioManager::Stop()
|
||||
{
|
||||
if (m_action2.GetObjectId() != -1)
|
||||
if (m_action2.GetObjectId() != -1) {
|
||||
DeleteObject(m_action2);
|
||||
}
|
||||
|
||||
m_unk0x138 = 0;
|
||||
m_action2.SetAtomId(MxAtomId());
|
||||
m_action2.SetObjectId(-1);
|
||||
|
||||
if (m_action1.GetObjectId() != -1)
|
||||
if (m_action1.GetObjectId() != -1) {
|
||||
DeleteObject(m_action1);
|
||||
}
|
||||
|
||||
m_unk0xa0 = 0;
|
||||
m_action1.SetAtomId(MxAtomId());
|
||||
|
||||
@@ -40,8 +40,9 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction)
|
||||
((Act3*) GetWorld())->SetUnkown420c(this);
|
||||
}
|
||||
world = GetWorld();
|
||||
if (world)
|
||||
if (world) {
|
||||
world->Add(this);
|
||||
}
|
||||
GetState();
|
||||
return result;
|
||||
}
|
||||
@@ -50,8 +51,9 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction)
|
||||
void Helicopter::GetState()
|
||||
{
|
||||
m_state = (HelicopterState*) GameState()->GetState("HelicopterState");
|
||||
if (!m_state)
|
||||
if (!m_state) {
|
||||
m_state = (HelicopterState*) GameState()->CreateState("HelicopterState");
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10003360
|
||||
@@ -87,10 +89,12 @@ void Helicopter::VTable0xe4()
|
||||
// FUNCTION: LEGO1 0x10003480
|
||||
MxU32 Helicopter::VTable0xcc()
|
||||
{
|
||||
if (!FUN_1003ef60())
|
||||
if (!FUN_1003ef60()) {
|
||||
return 1;
|
||||
if (!m_world)
|
||||
}
|
||||
if (!m_world) {
|
||||
m_world = GetCurrentWorld();
|
||||
}
|
||||
AnimationManager()->FUN_1005f6d0(FALSE);
|
||||
if (GetCurrentVehicle()) {
|
||||
if (GetCurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
|
||||
@@ -145,15 +149,17 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
|
||||
((Act3*) GetCurrentWorld())->SetUnkown4270(2);
|
||||
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
|
||||
}
|
||||
else if (m_state->GetUnkown8() != 0)
|
||||
else if (m_state->GetUnkown8() != 0) {
|
||||
break;
|
||||
}
|
||||
VTable0xe4();
|
||||
GameState()->SetCurrentArea(0x42);
|
||||
ret = 1;
|
||||
break;
|
||||
case 0x18: {
|
||||
if (*g_act3Script == script)
|
||||
if (*g_act3Script == script) {
|
||||
break;
|
||||
}
|
||||
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
|
||||
if (m_state->GetUnkown8() == 0) {
|
||||
state->SetUnknown18(4);
|
||||
@@ -166,8 +172,9 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
|
||||
break;
|
||||
}
|
||||
case 0x19:
|
||||
if (*g_act3Script == script)
|
||||
if (*g_act3Script == script) {
|
||||
break;
|
||||
}
|
||||
if (m_state->GetUnkown8() == 2) {
|
||||
m_state->SetUnknown8(3);
|
||||
m_world->FUN_1001fc80(this);
|
||||
@@ -177,13 +184,15 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
|
||||
ret = 1;
|
||||
break;
|
||||
case 0x1a:
|
||||
if (*g_act3Script != script)
|
||||
if (*g_act3Script != script) {
|
||||
break;
|
||||
}
|
||||
ret = 1;
|
||||
/* fall through */
|
||||
case 0x1b:
|
||||
if (*g_act3Script != script)
|
||||
if (*g_act3Script != script) {
|
||||
break;
|
||||
}
|
||||
if (m_world && m_world->GetCamera()) {
|
||||
Mx3DPointFloat loc, dir, lookat;
|
||||
loc.CopyFrom(m_world->GetCamera()->GetWorldLocation());
|
||||
@@ -196,11 +205,14 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
|
||||
v68.CopyFrom(m_world->GetCamera()->GetWorldUp());
|
||||
va4.EqualsCross(v68, dir);
|
||||
v7c.EqualsCross(va4, v90);
|
||||
if (ret)
|
||||
if (((Act3*) m_world)->FUN_100727e0(m_unk0x138, loc, dir, v7c))
|
||||
if (ret) {
|
||||
if (((Act3*) m_world)->FUN_100727e0(m_unk0x138, loc, dir, v7c)) {
|
||||
break;
|
||||
else if (((Act3*) m_world)->FUN_10072980(m_unk0x138, loc, dir, v7c))
|
||||
}
|
||||
else if (((Act3*) m_world)->FUN_10072980(m_unk0x138, loc, dir, v7c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
break;
|
||||
@@ -231,8 +243,9 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
|
||||
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4);
|
||||
VTable0xe8(0x2a, TRUE, 7);
|
||||
}
|
||||
else
|
||||
else {
|
||||
VTable0xe8(0x31, TRUE, 7);
|
||||
}
|
||||
|
||||
m_state->SetUnknown8(2);
|
||||
|
||||
@@ -267,8 +280,9 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
|
||||
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
|
||||
VTable0xe8(0x29, TRUE, 7);
|
||||
}
|
||||
else
|
||||
else {
|
||||
VTable0xe8(0x30, TRUE, 7);
|
||||
}
|
||||
|
||||
m_state->SetUnknown8(0);
|
||||
ret = 1;
|
||||
@@ -289,8 +303,9 @@ void Helicopter::VTable0x74(Matrix4& p_transform)
|
||||
else {
|
||||
m_roi->FUN_100a58f0(p_transform);
|
||||
m_roi->VTable0x14();
|
||||
if (m_cameraFlag)
|
||||
if (m_cameraFlag) {
|
||||
FUN_10010c30();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,10 +322,12 @@ void Helicopter::VTable0x70(float p_float)
|
||||
float f = m_unk0x1f0 - p_float + 3000;
|
||||
if (f >= 0) {
|
||||
float f2 = f / 3000 + 1;
|
||||
if (f2 < 0)
|
||||
if (f2 < 0) {
|
||||
f2 = 0;
|
||||
if (1.0f < f2)
|
||||
}
|
||||
if (1.0f < f2) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
Vector3 v(m_unk0x160[3]);
|
||||
MxMatrix mat;
|
||||
Vector3 v2(m_unk0x1a8[3]);
|
||||
@@ -328,10 +345,12 @@ void Helicopter::VTable0x70(float p_float)
|
||||
m_world->GetCamera()->FUN_100123e0(mat, 0);
|
||||
}
|
||||
else {
|
||||
if (state == 4)
|
||||
if (state == 4) {
|
||||
((Act3*) m_world)->FUN_10073400();
|
||||
else
|
||||
}
|
||||
else {
|
||||
((Act3*) m_world)->FUN_10073430();
|
||||
}
|
||||
m_unk0xdc = 4;
|
||||
}
|
||||
}
|
||||
@@ -380,6 +399,7 @@ MxResult HelicopterSubclass::FUN_100040a0(Vector4& p_v, float p_f)
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
else
|
||||
else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,9 @@ GifManager::~GifManager()
|
||||
// FUNCTION: LEGO1 0x10099cc0
|
||||
void GifManager::FUN_10099cc0(GifData* p_data)
|
||||
{
|
||||
if (p_data == NULL)
|
||||
if (p_data == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef COMPAT_MODE
|
||||
GifList::iterator it;
|
||||
|
||||
@@ -80,8 +80,9 @@ void LegoActionControlPresenter::ParseExtra()
|
||||
{
|
||||
MxU32 len = m_action->GetExtraLength();
|
||||
|
||||
if (len == 0)
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
len &= MAXWORD;
|
||||
|
||||
|
||||
@@ -34,8 +34,9 @@ void LegoBackgroundColor::SetValue(const char* p_colorString)
|
||||
m_value.ToLowerCase();
|
||||
|
||||
LegoVideoManager* videomanager = VideoManager();
|
||||
if (!videomanager || !p_colorString)
|
||||
if (!videomanager || !p_colorString) {
|
||||
return;
|
||||
}
|
||||
|
||||
float convertedR, convertedG, convertedB;
|
||||
char* colorStringCopy = strcpy(new char[strlen(p_colorString) + 1], p_colorString);
|
||||
@@ -43,14 +44,17 @@ void LegoBackgroundColor::SetValue(const char* p_colorString)
|
||||
|
||||
if (!strcmp(colorStringSplit, g_set)) {
|
||||
colorStringSplit = strtok(0, g_delimiter);
|
||||
if (colorStringSplit)
|
||||
if (colorStringSplit) {
|
||||
m_h = (float) (atoi(colorStringSplit) * 0.01);
|
||||
}
|
||||
colorStringSplit = strtok(0, g_delimiter);
|
||||
if (colorStringSplit)
|
||||
if (colorStringSplit) {
|
||||
m_s = (float) (atoi(colorStringSplit) * 0.01);
|
||||
}
|
||||
colorStringSplit = strtok(0, g_delimiter);
|
||||
if (colorStringSplit)
|
||||
if (colorStringSplit) {
|
||||
m_v = (float) (atoi(colorStringSplit) * 0.01);
|
||||
}
|
||||
|
||||
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
|
||||
videomanager->SetSkyColor(convertedR, convertedG, convertedB);
|
||||
|
||||
@@ -96,8 +96,9 @@ LegoGameState::~LegoGameState()
|
||||
if (m_stateCount) {
|
||||
for (MxS16 i = 0; i < m_stateCount; i++) {
|
||||
LegoState* state = m_stateArray[i];
|
||||
if (state)
|
||||
if (state) {
|
||||
delete state;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] m_stateArray;
|
||||
@@ -118,8 +119,9 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
MxResult result;
|
||||
InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
|
||||
|
||||
if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == NULL)
|
||||
if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == NULL) {
|
||||
result = SUCCESS;
|
||||
}
|
||||
else {
|
||||
result = FAILURE;
|
||||
MxVariableTable* variableTable = VariableTable();
|
||||
@@ -134,8 +136,9 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
fileStream.Write(&m_unk0x0c, 1);
|
||||
|
||||
for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) {
|
||||
if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE)
|
||||
if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (WriteVariable(&fileStream, variableTable, "backgroundcolor") != FAILURE) {
|
||||
@@ -161,15 +164,17 @@ MxResult LegoGameState::Load(MxULong)
|
||||
// FUNCTION: LEGO1 0x10039f00
|
||||
void LegoGameState::SetSavePath(char* p_savePath)
|
||||
{
|
||||
if (m_savePath != NULL)
|
||||
if (m_savePath != NULL) {
|
||||
delete[] m_savePath;
|
||||
}
|
||||
|
||||
if (p_savePath) {
|
||||
m_savePath = new char[strlen(p_savePath) + 1];
|
||||
strcpy(m_savePath, p_savePath);
|
||||
}
|
||||
else
|
||||
else {
|
||||
m_savePath = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10039f70
|
||||
@@ -183,8 +188,9 @@ MxResult LegoGameState::WriteVariable(LegoStorage* p_stream, MxVariableTable* p_
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS) {
|
||||
if (p_stream->Write(p_variableName, length) == SUCCESS) {
|
||||
length = strlen(variableValue);
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS)
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS) {
|
||||
result = p_stream->Write((char*) variableValue, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,8 +201,9 @@ MxResult LegoGameState::WriteVariable(LegoStorage* p_stream, MxVariableTable* p_
|
||||
MxResult LegoGameState::WriteEndOfVariables(LegoStorage* p_stream)
|
||||
{
|
||||
MxU8 len = strlen(g_endOfVariables);
|
||||
if (p_stream->Write(&len, 1) == SUCCESS)
|
||||
if (p_stream->Write(&len, 1) == SUCCESS) {
|
||||
return p_stream->Write(g_endOfVariables, len);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -212,9 +219,10 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to)
|
||||
char nameBuffer[256];
|
||||
if (p_stream->Read(nameBuffer, length) == SUCCESS) {
|
||||
nameBuffer[length] = '\0';
|
||||
if (strcmp(nameBuffer, g_endOfVariables) == 0)
|
||||
if (strcmp(nameBuffer, g_endOfVariables) == 0) {
|
||||
// 2 -> "This was the last entry, done reading."
|
||||
result = 2;
|
||||
}
|
||||
else {
|
||||
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
|
||||
char valueBuffer[256];
|
||||
@@ -237,8 +245,9 @@ void LegoGameState::GetFileSavePath(MxString* p_outPath, MxULong p_slotn)
|
||||
char path[1024] = "";
|
||||
|
||||
// Save path base
|
||||
if (m_savePath != NULL)
|
||||
if (m_savePath != NULL) {
|
||||
strcpy(path, m_savePath);
|
||||
}
|
||||
|
||||
// Slot: "G0", "G1", ...
|
||||
strcat(path, "\\G");
|
||||
@@ -491,9 +500,11 @@ MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen)
|
||||
// FUNCTION: LEGO1 0x1003bbb0
|
||||
LegoState* LegoGameState::GetState(const char* p_stateName)
|
||||
{
|
||||
for (MxS32 i = 0; i < m_stateCount; ++i)
|
||||
if (m_stateArray[i]->IsA(p_stateName))
|
||||
for (MxS32 i = 0; i < m_stateCount; ++i) {
|
||||
if (m_stateArray[i]->IsA(p_stateName)) {
|
||||
return m_stateArray[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -510,9 +521,11 @@ LegoState* LegoGameState::CreateState(const char* p_stateName)
|
||||
void LegoGameState::RegisterState(LegoState* p_state)
|
||||
{
|
||||
MxS32 targetIndex;
|
||||
for (targetIndex = 0; targetIndex < m_stateCount; ++targetIndex)
|
||||
if (m_stateArray[targetIndex]->IsA(p_state->ClassName()))
|
||||
for (targetIndex = 0; targetIndex < m_stateCount; ++targetIndex) {
|
||||
if (m_stateArray[targetIndex]->IsA(p_state->ClassName())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (targetIndex == m_stateCount) {
|
||||
LegoState** newBuffer = new LegoState*[m_stateCount + 1];
|
||||
@@ -527,8 +540,9 @@ void LegoGameState::RegisterState(LegoState* p_state)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_stateArray[targetIndex])
|
||||
if (m_stateArray[targetIndex]) {
|
||||
delete m_stateArray[targetIndex];
|
||||
}
|
||||
m_stateArray[targetIndex] = p_state;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,26 +19,36 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream)
|
||||
const LegoSaveDataEntry3* end = &g_saveData3[66];
|
||||
|
||||
while (TRUE) {
|
||||
if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS)
|
||||
if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS)
|
||||
}
|
||||
if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS) {
|
||||
break;
|
||||
}
|
||||
if (++entry >= end) {
|
||||
result = SUCCESS;
|
||||
break;
|
||||
|
||||
@@ -21,26 +21,36 @@ Extra::ActionType MatchActionString(const char* p_str)
|
||||
{
|
||||
Extra::ActionType result = Extra::ActionType::e_unknown;
|
||||
|
||||
if (!strcmpi("openram", p_str))
|
||||
if (!strcmpi("openram", p_str)) {
|
||||
result = Extra::ActionType::e_openram;
|
||||
else if (!strcmpi("opendisk", p_str))
|
||||
}
|
||||
else if (!strcmpi("opendisk", p_str)) {
|
||||
result = Extra::ActionType::e_opendisk;
|
||||
else if (!strcmpi("close", p_str))
|
||||
}
|
||||
else if (!strcmpi("close", p_str)) {
|
||||
result = Extra::ActionType::e_close;
|
||||
else if (!strcmpi("start", p_str))
|
||||
}
|
||||
else if (!strcmpi("start", p_str)) {
|
||||
result = Extra::ActionType::e_start;
|
||||
else if (!strcmpi("stop", p_str))
|
||||
}
|
||||
else if (!strcmpi("stop", p_str)) {
|
||||
result = Extra::ActionType::e_stop;
|
||||
else if (!strcmpi("run", p_str))
|
||||
}
|
||||
else if (!strcmpi("run", p_str)) {
|
||||
result = Extra::ActionType::e_run;
|
||||
else if (!strcmpi("exit", p_str))
|
||||
}
|
||||
else if (!strcmpi("exit", p_str)) {
|
||||
result = Extra::ActionType::e_exit;
|
||||
else if (!strcmpi("enable", p_str))
|
||||
}
|
||||
else if (!strcmpi("enable", p_str)) {
|
||||
result = Extra::ActionType::e_enable;
|
||||
else if (!strcmpi("disable", p_str))
|
||||
}
|
||||
else if (!strcmpi("disable", p_str)) {
|
||||
result = Extra::ActionType::e_disable;
|
||||
else if (!strcmpi("notify", p_str))
|
||||
}
|
||||
else if (!strcmpi("notify", p_str)) {
|
||||
result = Extra::ActionType::e_notify;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -133,10 +143,12 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO
|
||||
|
||||
double sDbl = p_s;
|
||||
|
||||
if (p_s > 0.5f)
|
||||
if (p_s > 0.5f) {
|
||||
calc = (1.0f - p_v) * p_s + p_v;
|
||||
else
|
||||
}
|
||||
else {
|
||||
calc = (p_v + 1.0) * sDbl;
|
||||
}
|
||||
if (calc <= 0.0) {
|
||||
*p_gOut = 0.0f;
|
||||
*p_bOut = 0.0f;
|
||||
|
||||
@@ -57,10 +57,12 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller
|
||||
if (presenter->StartAction(p_controller, action) == SUCCESS) {
|
||||
presenter->SetTickleState(e_idle);
|
||||
|
||||
if (presenter->IsA("MxVideoPresenter"))
|
||||
if (presenter->IsA("MxVideoPresenter")) {
|
||||
VideoManager()->UnregisterPresenter(*presenter);
|
||||
else if (presenter->IsA("MxAudioPresenter"))
|
||||
}
|
||||
else if (presenter->IsA("MxAudioPresenter")) {
|
||||
SoundManager()->UnregisterPresenter(*presenter);
|
||||
}
|
||||
|
||||
success = TRUE;
|
||||
}
|
||||
@@ -70,8 +72,9 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller
|
||||
action->SetOrigin(this);
|
||||
m_list.push_back(presenter);
|
||||
}
|
||||
else if (presenter)
|
||||
else if (presenter) {
|
||||
delete presenter;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_compositePresenter) {
|
||||
@@ -97,8 +100,9 @@ void MxCompositeMediaPresenter::StartingTickle()
|
||||
(*it)->Tickle();
|
||||
|
||||
if ((*it)->GetCurrentTickleState() == e_streaming ||
|
||||
((*it)->GetAction() && (*it)->GetAction()->GetStartTime()))
|
||||
((*it)->GetAction() && (*it)->GetAction()->GetStartTime())) {
|
||||
m_unk0x4c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,8 +111,9 @@ void MxCompositeMediaPresenter::StartingTickle()
|
||||
m_unk0x4c = 0;
|
||||
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
if (!(*it)->GetAction()->GetStartTime())
|
||||
if (!(*it)->GetAction()->GetStartTime()) {
|
||||
m_unk0x4c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,8 +150,9 @@ MxResult MxCompositeMediaPresenter::Tickle()
|
||||
case e_repeating:
|
||||
case e_unk5:
|
||||
case e_done: {
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++)
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
(*it)->Tickle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -162,8 +168,9 @@ MxResult MxCompositeMediaPresenter::PutData()
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
if (m_currentTickleState >= e_streaming && m_currentTickleState <= e_done) {
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++)
|
||||
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
(*it)->PutData();
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -43,8 +43,9 @@ void LegoControlManager::Register(MxCore* p_listener)
|
||||
void LegoControlManager::Unregister(MxCore* p_listener)
|
||||
{
|
||||
LegoNotifyListCursor cursor(&m_notifyList);
|
||||
if (cursor.Find(p_listener))
|
||||
if (cursor.Find(p_listener)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10029210
|
||||
|
||||
@@ -58,8 +58,9 @@ void MxControlPresenter::VTable0x68(MxBool p_unk0x50)
|
||||
// FUNCTION: LEGO1 0x10044110
|
||||
MxControlPresenter::~MxControlPresenter()
|
||||
{
|
||||
if (m_unk0x58)
|
||||
if (m_unk0x58) {
|
||||
delete m_unk0x58;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044180
|
||||
@@ -238,7 +239,7 @@ void MxControlPresenter::VTable0x6c(MxS16 p_val)
|
||||
|
||||
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);
|
||||
(*it)->Enable(((m_unk0x4c == 3 && m_unk0x4e == 0) || !IsEnabled()) ? FALSE : m_unk0x4e == i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -322,8 +323,9 @@ void MxControlPresenter::Enable(MxBool p_enable)
|
||||
MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState)
|
||||
{
|
||||
MxCompositePresenterList::iterator it = m_list.begin();
|
||||
for (MxS16 i = m_unk0x4e; i > 0; i--, it++)
|
||||
for (MxS16 i = m_unk0x4e; i > 0; i--, it++) {
|
||||
;
|
||||
}
|
||||
|
||||
return (*it)->HasTickleStatePassed(p_tickleState);
|
||||
}
|
||||
|
||||
@@ -64,10 +64,12 @@ void LegoCameraController::OnRButtonUp(MxPoint32 p_point)
|
||||
// FUNCTION: LEGO1 0x10012230
|
||||
void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point)
|
||||
{
|
||||
if (p_modifier & c_lButtonState)
|
||||
if (p_modifier & c_lButtonState) {
|
||||
LeftDrag(p_point.GetX(), p_point.GetY());
|
||||
else if (p_modifier & c_rButtonState)
|
||||
}
|
||||
else if (p_modifier & c_rButtonState) {
|
||||
RightDrag(p_point.GetX(), p_point.GetY());
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012260
|
||||
@@ -90,8 +92,9 @@ Mx3DPointFloat LegoCameraController::GetWorldUp()
|
||||
vec = m_lego3DView->GetPointOfView()->GetWorldUp();
|
||||
return Mx3DPointFloat(vec[0], vec[1], vec[2]);
|
||||
}
|
||||
else
|
||||
else {
|
||||
return Mx3DPointFloat(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100127f0
|
||||
@@ -102,8 +105,9 @@ Mx3DPointFloat LegoCameraController::GetWorldLocation()
|
||||
vec = m_lego3DView->GetPointOfView()->GetWorldPosition();
|
||||
return Mx3DPointFloat(vec[0], vec[1] - m_entityOffsetUp, vec[2]);
|
||||
}
|
||||
else
|
||||
else {
|
||||
return Mx3DPointFloat(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100128a0
|
||||
@@ -114,6 +118,7 @@ Mx3DPointFloat LegoCameraController::GetWorldDirection()
|
||||
vec = m_lego3DView->GetPointOfView()->GetWorldDirection();
|
||||
return Mx3DPointFloat(vec[0], vec[1], vec[2]);
|
||||
}
|
||||
else
|
||||
else {
|
||||
return Mx3DPointFloat(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,9 @@ void LegoEntity::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
if (m_roi) {
|
||||
if (m_flags & c_bit1) {
|
||||
if (m_roi->GetUnknown0x104() == this)
|
||||
if (m_roi->GetUnknown0x104() == this) {
|
||||
m_roi->SetUnknown0x104(NULL);
|
||||
}
|
||||
|
||||
GetUnkSaveDataWriter()->FUN_10083db0(m_roi);
|
||||
}
|
||||
@@ -92,8 +93,9 @@ void LegoEntity::FUN_10010c30()
|
||||
{
|
||||
LegoWorld* world = GetCurrentWorld();
|
||||
|
||||
if (m_cameraFlag && world && world->GetCamera() && m_roi)
|
||||
if (m_cameraFlag && world && world->GetCamera() && m_roi) {
|
||||
world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10010e10
|
||||
|
||||
@@ -148,8 +148,9 @@ void LegoNavController::SetDefaults(
|
||||
// FUNCTION: LEGO1 0x10054e40
|
||||
void LegoNavController::SetTargets(int p_hPos, int p_vPos, MxBool p_accel)
|
||||
{
|
||||
if (this->m_trackDefault != FALSE)
|
||||
if (this->m_trackDefault != FALSE) {
|
||||
ResetToDefault();
|
||||
}
|
||||
|
||||
if (p_accel != FALSE) {
|
||||
this->m_targetTurnSpeed = CalculateNewTargetSpeed(p_hPos, this->m_hMax / 2, this->m_turnMaxSpeed);
|
||||
@@ -178,12 +179,15 @@ float LegoNavController::CalculateNewTargetSpeed(int p_pos, int p_center, float
|
||||
float result;
|
||||
int diff = p_pos - p_center;
|
||||
|
||||
if (diff > this->m_mouseDeadzone)
|
||||
if (diff > this->m_mouseDeadzone) {
|
||||
result = (diff - m_mouseDeadzone) * p_maxSpeed / (p_center - m_mouseDeadzone);
|
||||
else if (diff < -m_mouseDeadzone)
|
||||
}
|
||||
else if (diff < -m_mouseDeadzone) {
|
||||
result = (diff + m_mouseDeadzone) * p_maxSpeed / (p_center - m_mouseDeadzone);
|
||||
else
|
||||
}
|
||||
else {
|
||||
result = 0.0f;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -196,8 +200,9 @@ float LegoNavController::CalculateNewAccel(int p_pos, int p_center, float p_maxA
|
||||
|
||||
result = Abs(diff) * p_maxAccel / p_center;
|
||||
|
||||
if (result < p_minAccel)
|
||||
if (result < p_minAccel) {
|
||||
result = (float) p_minAccel;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -214,10 +219,12 @@ float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel,
|
||||
float deltaVel = p_accel * p_time;
|
||||
newVel = p_currentVel + (deltaVel * vSign);
|
||||
|
||||
if (vSign > 0)
|
||||
if (vSign > 0) {
|
||||
newVel = Min(newVel, p_targetVel);
|
||||
else
|
||||
}
|
||||
else {
|
||||
newVel = Max(newVel, p_targetVel);
|
||||
}
|
||||
}
|
||||
|
||||
return newVel;
|
||||
|
||||
@@ -65,16 +65,19 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
|
||||
|
||||
m_entityList = new LegoEntityList(TRUE);
|
||||
|
||||
if (!m_entityList)
|
||||
if (!m_entityList) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_cacheSoundList = new LegoCacheSoundList(TRUE);
|
||||
|
||||
if (!m_cacheSoundList)
|
||||
if (!m_cacheSoundList) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!VTable0x54())
|
||||
if (!VTable0x54()) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_dsAction.GetFlags() & MxDSAction::c_enabled) {
|
||||
if (GetCurrentWorld()) {
|
||||
@@ -146,8 +149,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
|
||||
presenter->EndAction();
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
delete object;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor controlPresenterCursor(&m_controlPresenters);
|
||||
@@ -174,8 +178,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
|
||||
while (cursor.First(entity)) {
|
||||
cursor.Detach();
|
||||
|
||||
if (!(entity->GetFlags() & LegoEntity::c_bit2))
|
||||
if (!(entity->GetFlags() & LegoEntity::c_bit2)) {
|
||||
delete entity;
|
||||
}
|
||||
}
|
||||
|
||||
delete m_entityList;
|
||||
@@ -201,8 +206,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
|
||||
delete roi;
|
||||
}
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
LegoEntity::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001f5e0
|
||||
@@ -284,42 +290,48 @@ void LegoWorld::Add(MxCore* p_object)
|
||||
if (p_object->IsA("MxControlPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_controlPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object))
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_controlPresenters.Append((MxPresenter*) p_object);
|
||||
}
|
||||
else if (p_object->IsA("MxEntity")) {
|
||||
LegoEntityListCursor cursor(m_entityList);
|
||||
|
||||
if (cursor.Find((LegoEntity*) p_object))
|
||||
if (cursor.Find((LegoEntity*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_entityList->Append((LegoEntity*) p_object);
|
||||
}
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_animPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object))
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
((MxPresenter*) p_object)->SendToCompositePresenter(Lego());
|
||||
m_animPresenters.Append(((MxPresenter*) p_object));
|
||||
|
||||
if (p_object->IsA("LegoHideAnimPresenter"))
|
||||
if (p_object->IsA("LegoHideAnimPresenter")) {
|
||||
m_hideAnimPresenter = (LegoHideAnimPresenter*) p_object;
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("LegoCacheSound")) {
|
||||
LegoCacheSoundListCursor cursor(m_cacheSoundList);
|
||||
|
||||
if (cursor.Find((LegoCacheSound*) p_object))
|
||||
if (cursor.Find((LegoCacheSound*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_cacheSoundList->Append((LegoCacheSound*) p_object);
|
||||
}
|
||||
else {
|
||||
if (m_set0xa8.find(p_object) == m_set0xa8.end())
|
||||
if (m_set0xa8.find(p_object) == m_set0xa8.end()) {
|
||||
m_set0xa8.insert(p_object);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_set0xd0.empty() && p_object->IsA("MxPresenter")) {
|
||||
@@ -349,38 +361,45 @@ void LegoWorld::Remove(MxCore* p_object)
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_animPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object))
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
|
||||
if (p_object->IsA("LegoHideAnimPresenter"))
|
||||
if (p_object->IsA("LegoHideAnimPresenter")) {
|
||||
m_hideAnimPresenter = NULL;
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("MxEntity")) {
|
||||
if (p_object->IsA("LegoPathActor"))
|
||||
if (p_object->IsA("LegoPathActor")) {
|
||||
FUN_1001fc80((IslePathActor*) p_object);
|
||||
}
|
||||
|
||||
if (m_entityList) {
|
||||
LegoEntityListCursor cursor(m_entityList);
|
||||
|
||||
if (cursor.Find((LegoEntity*) p_object))
|
||||
if (cursor.Find((LegoEntity*) p_object)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("LegoCacheSound")) {
|
||||
LegoCacheSoundListCursor cursor(m_cacheSoundList);
|
||||
|
||||
if (cursor.Find((LegoCacheSound*) p_object))
|
||||
if (cursor.Find((LegoCacheSound*) p_object)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
}
|
||||
else {
|
||||
it = m_set0xa8.find(p_object);
|
||||
if (it != m_set0xa8.end())
|
||||
if (it != m_set0xa8.end()) {
|
||||
m_set0xa8.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
it = m_set0xd0.find(p_object);
|
||||
if (it != m_set0xd0.end())
|
||||
if (it != m_set0xd0.end()) {
|
||||
m_set0xd0.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,8 +412,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
|
||||
while (cursor.Next(presenter)) {
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
if (!strcmp(action->GetObjectName(), p_name))
|
||||
if (!strcmp(action->GetObjectName(), p_name)) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -404,12 +424,14 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
LegoEntity* entity;
|
||||
|
||||
while (cursor.Next(entity)) {
|
||||
if (!p_name)
|
||||
if (!p_name) {
|
||||
return entity;
|
||||
}
|
||||
|
||||
LegoROI* roi = entity->GetROI();
|
||||
if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name))
|
||||
if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -419,8 +441,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
MxPresenter* presenter;
|
||||
|
||||
while (cursor.Next(presenter)) {
|
||||
if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name))
|
||||
if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -431,8 +454,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
MxPresenter* presenter = (MxPresenter*) *it;
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (!strcmp(action->GetObjectName(), p_name))
|
||||
if (!strcmp(action->GetObjectName(), p_name)) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,8 +471,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
LegoEntity* entity;
|
||||
|
||||
while (entityCursor.Next(entity)) {
|
||||
if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId)
|
||||
if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor controlPresenterCursor(&m_controlPresenters);
|
||||
@@ -457,8 +482,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
while (controlPresenterCursor.Next(presenter)) {
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor animPresenterCursor(&m_animPresenters);
|
||||
@@ -466,8 +492,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
while (animPresenterCursor.Next(presenter)) {
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
|
||||
if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
|
||||
@@ -477,8 +504,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
MxPresenter* presenter = (MxPresenter*) *it;
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,8 +530,9 @@ MxResult LegoWorld::Tickle()
|
||||
ReadyWorld();
|
||||
return TRUE;
|
||||
case e_two:
|
||||
if (PresentersPending())
|
||||
if (PresentersPending()) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
m_startupTicks--;
|
||||
}
|
||||
@@ -519,8 +548,9 @@ MxBool LegoWorld::PresentersPending()
|
||||
MxPresenter* presenter;
|
||||
|
||||
while (controlPresenterCursor.Next(presenter)) {
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting))
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor animPresenterCursor(&m_animPresenters);
|
||||
@@ -528,12 +558,14 @@ MxBool LegoWorld::PresentersPending()
|
||||
while (animPresenterCursor.Next(presenter)) {
|
||||
if (presenter->IsEnabled()) {
|
||||
if (presenter->IsA("LegoLocomotionAnimPresenter")) {
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_ready))
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_ready)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_starting))
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_starting)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,8 +574,9 @@ MxBool LegoWorld::PresentersPending()
|
||||
if ((*it)->IsA("MxPresenter")) {
|
||||
presenter = (MxPresenter*) *it;
|
||||
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting))
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,8 +100,9 @@ MxResult LegoWorldPresenter::StartAction(MxStreamController* p_controller, MxDSA
|
||||
action->SetOrigin(this);
|
||||
m_list.push_back(presenter);
|
||||
}
|
||||
else if (presenter)
|
||||
else if (presenter) {
|
||||
delete presenter;
|
||||
}
|
||||
}
|
||||
|
||||
VideoManager()->RegisterPresenter(*this);
|
||||
|
||||
@@ -195,8 +195,9 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param)
|
||||
|
||||
MxLong result = m_radio.Notify(p_param);
|
||||
|
||||
if (result || (action->GetAtomId() != m_atom && action->GetAtomId() != *g_introScript))
|
||||
if (result || (action->GetAtomId() != m_atom && action->GetAtomId() != *g_introScript)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (action->GetObjectId() == c_returnBackGuidanceDialogue2) {
|
||||
ControlManager()->FUN_100293c0(0x10, action->GetAtomId().GetInternal(), 0);
|
||||
@@ -747,8 +748,9 @@ void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y)
|
||||
MxS32 left = m_mapAreas[i].m_area.GetLeft();
|
||||
MxS32 top = m_mapAreas[i].m_area.GetTop();
|
||||
|
||||
if (left <= p_x && p_x <= right && top <= p_y && p_y <= bottom)
|
||||
if (left <= p_x && p_x <= right && top <= p_y && p_y <= bottom) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 7) {
|
||||
|
||||
@@ -32,8 +32,9 @@ MxBool Score::VTable0x5c()
|
||||
// FUNCTION: LEGO1 0x10001200
|
||||
Score::~Score()
|
||||
{
|
||||
if (InputManager()->GetWorld() == this)
|
||||
if (InputManager()->GetWorld() == this) {
|
||||
InputManager()->ClearWorld();
|
||||
}
|
||||
InputManager()->UnRegister(this);
|
||||
ControlManager()->Unregister(this);
|
||||
NotificationManager()->Unregister(this);
|
||||
@@ -87,8 +88,9 @@ MxLong Score::Notify(MxParam& p_param)
|
||||
ret = FUN_10001510((MxEndActionNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationKeyPress:
|
||||
if (((LegoEventNotificationParam&) p_param).GetKey() == 0x20)
|
||||
if (((LegoEventNotificationParam&) p_param).GetKey() == 0x20) {
|
||||
DeleteScript(); // Shutting down
|
||||
}
|
||||
ret = 1;
|
||||
break;
|
||||
case c_notificationClick:
|
||||
@@ -96,8 +98,9 @@ MxLong Score::Notify(MxParam& p_param)
|
||||
break;
|
||||
case c_notificationTransitioned:
|
||||
DeleteObjects(g_infoscorScript, 7, 9);
|
||||
if (m_unk0xf8)
|
||||
if (m_unk0xf8) {
|
||||
GameState()->SwitchArea(m_unk0xf8);
|
||||
}
|
||||
ret = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -145,8 +148,9 @@ void Score::ReadyWorld()
|
||||
action.SetAtomId(*g_infoscorScript);
|
||||
Start(&action);
|
||||
}
|
||||
else
|
||||
else {
|
||||
PlayMusic(JukeBox::e_informationCenter);
|
||||
}
|
||||
|
||||
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
||||
}
|
||||
@@ -221,8 +225,9 @@ void Score::VTable0x68(MxBool p_add)
|
||||
InputManager()->SetWorld(this);
|
||||
SetIsWorldActive(FALSE);
|
||||
}
|
||||
else if (InputManager()->GetWorld() == this)
|
||||
else if (InputManager()->GetWorld() == this) {
|
||||
InputManager()->ClearWorld();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100019d0
|
||||
@@ -249,25 +254,30 @@ void Score::Paint()
|
||||
for (MxU8 id = 1; id <= 5; id++) {
|
||||
m_surface = (MxU8*) desc.lpSurface;
|
||||
MxU16 color = 0;
|
||||
if (l70)
|
||||
if (l70) {
|
||||
color = l70->GetColor(id);
|
||||
}
|
||||
MxU32 row = id - 1;
|
||||
FillArea(0, row, color);
|
||||
color = 0;
|
||||
if (l78)
|
||||
if (l78) {
|
||||
color = l78->GetColor(id);
|
||||
}
|
||||
FillArea(1, row, color);
|
||||
color = 0;
|
||||
if (l74)
|
||||
if (l74) {
|
||||
color = l74->GetColor(id);
|
||||
}
|
||||
FillArea(2, row, color);
|
||||
color = 0;
|
||||
if (lesi)
|
||||
if (lesi) {
|
||||
color = lesi->GetColor(id);
|
||||
}
|
||||
FillArea(3, row, color);
|
||||
color = 0;
|
||||
if (lebp)
|
||||
if (lebp) {
|
||||
color = lebp->GetColor(id);
|
||||
}
|
||||
FillArea(4, row, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,11 +64,13 @@ MxResult LegoInputManager::Create(HWND p_hwnd)
|
||||
|
||||
m_controlManager = new LegoControlManager;
|
||||
|
||||
if (!m_keyboardNotifyList)
|
||||
if (!m_keyboardNotifyList) {
|
||||
m_keyboardNotifyList = new LegoNotifyList;
|
||||
}
|
||||
|
||||
if (!m_eventQueue)
|
||||
if (!m_eventQueue) {
|
||||
m_eventQueue = new LegoEventQueue;
|
||||
}
|
||||
|
||||
CreateAndAcquireKeyboard(p_hwnd);
|
||||
GetJoystickId();
|
||||
@@ -86,16 +88,19 @@ void LegoInputManager::Destroy()
|
||||
{
|
||||
ReleaseDX();
|
||||
|
||||
if (m_keyboardNotifyList)
|
||||
if (m_keyboardNotifyList) {
|
||||
delete m_keyboardNotifyList;
|
||||
}
|
||||
m_keyboardNotifyList = NULL;
|
||||
|
||||
if (m_eventQueue)
|
||||
if (m_eventQueue) {
|
||||
delete m_eventQueue;
|
||||
}
|
||||
m_eventQueue = NULL;
|
||||
|
||||
if (m_controlManager)
|
||||
if (m_controlManager) {
|
||||
delete m_controlManager;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005c030
|
||||
@@ -183,8 +188,9 @@ MxResult LegoInputManager::GetJoystickState(
|
||||
if ((capabilities & JOYCAPS_HASPOV) != 0) {
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS;
|
||||
|
||||
if ((capabilities & JOYCAPS_POVCTS) != 0)
|
||||
if ((capabilities & JOYCAPS_POVCTS) != 0) {
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS | JOY_RETURNPOVCTS;
|
||||
}
|
||||
}
|
||||
|
||||
MMRESULT mmresult = joyGetPosEx(m_joyid, &joyinfoex);
|
||||
@@ -220,8 +226,9 @@ void LegoInputManager::Register(MxCore* p_notify)
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
LegoNotifyListCursor cursor(m_keyboardNotifyList);
|
||||
if (!cursor.Find(p_notify))
|
||||
if (!cursor.Find(p_notify)) {
|
||||
m_keyboardNotifyList->Append(p_notify);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005c5c0
|
||||
@@ -230,8 +237,9 @@ void LegoInputManager::UnRegister(MxCore* p_notify)
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
LegoNotifyListCursor cursor(m_keyboardNotifyList);
|
||||
if (cursor.Find(p_notify))
|
||||
if (cursor.Find(p_notify)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005c700
|
||||
@@ -276,8 +284,9 @@ void LegoInputManager::ProcessEvents()
|
||||
|
||||
LegoEventNotificationParam event;
|
||||
while (m_eventQueue->Dequeue(event)) {
|
||||
if (ProcessOneEvent(event))
|
||||
if (ProcessOneEvent(event)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,8 +388,9 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
|
||||
p_param.SetROI(roi);
|
||||
|
||||
if (roi && roi->GetUnk0x0c() == 1) {
|
||||
for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4())
|
||||
for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4()) {
|
||||
roi = (LegoROI*) oroi;
|
||||
}
|
||||
|
||||
LegoEntity* entity = roi->GetUnknown0x104();
|
||||
if (entity && entity->Notify(p_param) != 0) {
|
||||
@@ -415,8 +425,9 @@ void LegoInputManager::StartAutoDragTimer()
|
||||
// FUNCTION: LEGO1 0x1005cfd0
|
||||
void LegoInputManager::StopAutoDragTimer()
|
||||
{
|
||||
if (m_autoDragTimerID)
|
||||
if (m_autoDragTimerID) {
|
||||
::KillTimer(LegoOmni::GetInstance()->GetWindowHandle(), m_autoDragTimerID);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005cff0
|
||||
|
||||
@@ -20,8 +20,9 @@ MxResult IslePathActor::Create(MxDSAction& p_dsAction)
|
||||
// FUNCTION: LEGO1 0x1001a2a0
|
||||
void IslePathActor::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
LegoPathActor::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1001a2c0
|
||||
|
||||
@@ -79,8 +79,9 @@ void Radio::Stop()
|
||||
|
||||
MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtom(), 18);
|
||||
|
||||
if (presenter)
|
||||
if (presenter) {
|
||||
presenter->VTable0x6c(0);
|
||||
}
|
||||
|
||||
BackgroundAudioManager()->Stop();
|
||||
BackgroundAudioManager()->Enable(m_bgAudioPreviouslyEnabled);
|
||||
|
||||
@@ -106,9 +106,11 @@ MxU32 RadioState::FUN_1002d090()
|
||||
MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId)
|
||||
{
|
||||
if (*g_jukeboxScript == p_atom) {
|
||||
for (MxS16 i = 0; i < 3; i++)
|
||||
if (m_unk0x08[i].FUN_10014de0(p_objectId))
|
||||
for (MxS16 i = 0; i < 3; i++) {
|
||||
if (m_unk0x08[i].FUN_10014de0(p_objectId)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -257,8 +257,9 @@ void PlayMusic(MxU32 p_index)
|
||||
// FUNCTION: LEGO1 0x100159c0
|
||||
void SetIsWorldActive(MxBool p_isWorldActive)
|
||||
{
|
||||
if (!p_isWorldActive)
|
||||
if (!p_isWorldActive) {
|
||||
LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL);
|
||||
}
|
||||
g_isWorldActive = p_isWorldActive;
|
||||
}
|
||||
|
||||
@@ -523,17 +524,20 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
p_param.CreateFlags().CreateSoundManager(FALSE);
|
||||
p_param.CreateFlags().CreateTickleManager(FALSE);
|
||||
|
||||
if (!(m_tickleManager = new MxTickleManager()))
|
||||
if (!(m_tickleManager = new MxTickleManager())) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (MxOmni::Create(p_param) != SUCCESS)
|
||||
if (MxOmni::Create(p_param) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_objectFactory = new LegoObjectFactory();
|
||||
if (m_objectFactory == NULL)
|
||||
if (m_objectFactory == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (m_soundManager = new LegoSoundManager()) {
|
||||
if ((m_soundManager = new LegoSoundManager())) {
|
||||
if (m_soundManager->Create(10, 0) != SUCCESS) {
|
||||
delete m_soundManager;
|
||||
m_soundManager = NULL;
|
||||
@@ -541,14 +545,14 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_videoManager = new LegoVideoManager()) {
|
||||
if ((m_videoManager = new LegoVideoManager())) {
|
||||
if (m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) {
|
||||
delete m_videoManager;
|
||||
m_videoManager = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_inputMgr = new LegoInputManager()) {
|
||||
if ((m_inputMgr = new LegoInputManager())) {
|
||||
if (m_inputMgr->Create(p_param.GetWindowHandle()) != SUCCESS) {
|
||||
delete m_inputMgr;
|
||||
m_inputMgr = NULL;
|
||||
@@ -657,8 +661,9 @@ LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)
|
||||
|
||||
while (cursor.Next(world)) {
|
||||
if ((p_entityid == -1 || world->GetEntityId() == p_entityid) &&
|
||||
(!p_atom.GetInternal() || world->GetAtom() == p_atom))
|
||||
(!p_atom.GetInternal() || world->GetAtom() == p_atom)) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,8 +721,9 @@ MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter*
|
||||
// FUNCTION: LEGO1 0x1005b3a0
|
||||
void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param)
|
||||
{
|
||||
if (m_currentWorld)
|
||||
if (m_currentWorld) {
|
||||
NotificationManager()->Send(m_currentWorld, p_param);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005b3c0
|
||||
@@ -767,8 +773,9 @@ void LegoOmni::FUN_1005b4f0(MxBool p_disable, MxU16 p_flags)
|
||||
// FUNCTION: LEGO1 0x1005b560
|
||||
void LegoOmni::CreateBackgroundAudio()
|
||||
{
|
||||
if (m_bkgAudioManager)
|
||||
if (m_bkgAudioManager) {
|
||||
m_bkgAudioManager->Create(*g_jukeboxScript, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005b580
|
||||
|
||||
@@ -39,16 +39,18 @@ MxResult LegoPathPresenter::AddToManager()
|
||||
// FUNCTION: LEGO1 0x10044b70
|
||||
void LegoPathPresenter::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
if (VideoManager())
|
||||
if (VideoManager()) {
|
||||
VideoManager()->UnregisterPresenter(*this);
|
||||
}
|
||||
|
||||
{
|
||||
MxAutoLocker lock(&this->m_criticalSection);
|
||||
Init();
|
||||
}
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
MxMediaPresenter::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10044c10
|
||||
@@ -81,8 +83,9 @@ void LegoPathPresenter::StreamingTickle()
|
||||
// FUNCTION: LEGO1 0x10044d40
|
||||
void LegoPathPresenter::RepeatingTickle()
|
||||
{
|
||||
if (this->m_action->GetDuration() == -1)
|
||||
if (this->m_action->GetDuration() == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
EndAction();
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ MxResult PizzaMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
// FUNCTION: LEGO1 0x10039510
|
||||
PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id)
|
||||
{
|
||||
for (MxS16 i = 0; i < 5; i++)
|
||||
if (m_state[i].m_id == p_id)
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
if (m_state[i].m_id == p_id) {
|
||||
return m_state + i;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ MxResult RaceState::VTable0x1c(LegoFile* p_legoFile)
|
||||
RaceStateEntry* RaceState::GetState(MxU8 p_id)
|
||||
{
|
||||
for (MxS16 i = 0;; i++) {
|
||||
if (i >= 5)
|
||||
if (i >= 5) {
|
||||
return NULL;
|
||||
if (m_state[i].m_id == p_id)
|
||||
}
|
||||
if (m_state[i].m_id == p_id) {
|
||||
return m_state + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,15 +25,17 @@ void LegoHideAnimPresenter::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
m_criticalSection.Enter();
|
||||
|
||||
if (m_unk0xc0)
|
||||
if (m_unk0xc0) {
|
||||
delete m_unk0xc0;
|
||||
}
|
||||
Init();
|
||||
|
||||
m_criticalSection.Leave();
|
||||
|
||||
// This appears to be a bug, since it results in an endless loop
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
LegoHideAnimPresenter::Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1006dab0
|
||||
|
||||
@@ -50,8 +50,9 @@ LegoVideoManager::~LegoVideoManager()
|
||||
// FUNCTION: LEGO1 0x1007abb0
|
||||
MxResult LegoVideoManager::CreateDirect3D()
|
||||
{
|
||||
if (!m_direct3d)
|
||||
if (!m_direct3d) {
|
||||
m_direct3d = new MxDirect3D;
|
||||
}
|
||||
|
||||
return m_direct3d ? SUCCESS : FAILURE;
|
||||
}
|
||||
@@ -77,25 +78,29 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
MxPalette* palette = new MxPalette;
|
||||
p_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
paletteCreated = TRUE;
|
||||
}
|
||||
|
||||
PALETTEENTRY paletteEntries[256];
|
||||
p_videoParam.GetPalette()->GetEntries(paletteEntries);
|
||||
|
||||
if (CreateDirect3D() != SUCCESS)
|
||||
if (CreateDirect3D() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (deviceEnumerate.DoEnumerate() != SUCCESS)
|
||||
if (deviceEnumerate.DoEnumerate() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_videoParam.GetDeviceName()) {
|
||||
deviceNum = deviceEnumerate.ParseDeviceName(p_videoParam.GetDeviceName());
|
||||
if (deviceNum >= 0) {
|
||||
if ((deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device)) != SUCCESS)
|
||||
if ((deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device)) != SUCCESS) {
|
||||
deviceNum = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,10 +112,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
|
||||
m_direct3d->SetDevice(deviceEnumerate, driver, device);
|
||||
|
||||
if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2)
|
||||
if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2) {
|
||||
p_videoParam.Flags().SetF2bit0(TRUE);
|
||||
else
|
||||
}
|
||||
else {
|
||||
p_videoParam.Flags().SetF2bit0(FALSE);
|
||||
}
|
||||
|
||||
ViewROI::SetUnk101013d8(p_videoParam.Flags().GetF2bit0() == FALSE);
|
||||
|
||||
@@ -124,8 +131,9 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
bits,
|
||||
paletteEntries,
|
||||
sizeof(paletteEntries) / sizeof(paletteEntries[0])
|
||||
))
|
||||
)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (MxVideoManager::VTable0x28(
|
||||
p_videoParam,
|
||||
@@ -136,18 +144,21 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
m_direct3d->GetClipper(),
|
||||
p_frequencyMS,
|
||||
p_createThread
|
||||
) != SUCCESS)
|
||||
) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_renderer = Tgl::CreateRenderer();
|
||||
|
||||
if (!m_renderer)
|
||||
if (!m_renderer) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_3dManager = new Lego3DManager;
|
||||
|
||||
if (!m_3dManager)
|
||||
if (!m_3dManager) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
Lego3DManager::CreateStruct createStruct;
|
||||
memset(&createStruct, 0, sizeof(createStruct));
|
||||
@@ -161,13 +172,15 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
createStruct.m_direct3d = m_direct3d->GetDirect3D();
|
||||
createStruct.m_d3dDevice = m_direct3d->GetDirect3DDevice();
|
||||
|
||||
if (!m_3dManager->Create(createStruct))
|
||||
if (!m_3dManager->Create(createStruct)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
ViewLODList* pLODList;
|
||||
|
||||
if (ConfigureD3DRM() != SUCCESS)
|
||||
if (ConfigureD3DRM() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
pLODList = m_3dManager->GetViewLODListManager()->Create("CameraROI", 1);
|
||||
m_viewROI = new LegoROI(m_renderer, pLODList, Timer()->GetTime());
|
||||
@@ -219,19 +232,22 @@ void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY)
|
||||
m_cursorY = p_cursorY;
|
||||
m_drawCursor = TRUE;
|
||||
|
||||
if (623 < p_cursorX)
|
||||
if (623 < p_cursorX) {
|
||||
m_cursorX = 623;
|
||||
}
|
||||
|
||||
if (463 < p_cursorY)
|
||||
if (463 < p_cursorY) {
|
||||
m_cursorY = 463;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007b770
|
||||
MxResult LegoVideoManager::Tickle()
|
||||
{
|
||||
if (m_unk0x554 && !m_videoParam.Flags().GetFlipSurfaces() &&
|
||||
TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning)
|
||||
TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning) {
|
||||
Sleep(30);
|
||||
}
|
||||
|
||||
m_stopWatch->Stop();
|
||||
m_elapsedSeconds = m_stopWatch->ElapsedSeconds();
|
||||
@@ -245,11 +261,13 @@ MxResult LegoVideoManager::Tickle()
|
||||
MxPresenter* presenter;
|
||||
MxPresenterListCursor cursor(m_presenters);
|
||||
|
||||
while (cursor.Next(presenter))
|
||||
while (cursor.Next(presenter)) {
|
||||
presenter->Tickle();
|
||||
}
|
||||
|
||||
if (m_render3d && !m_paused)
|
||||
if (m_render3d && !m_paused) {
|
||||
m_3dManager->GetLego3DView()->GetView()->Clear();
|
||||
}
|
||||
|
||||
MxRect32 rect(0, 0, m_videoParam.GetRect().GetWidth() - 1, m_videoParam.GetRect().GetHeight() - 1);
|
||||
InvalidateRect(rect);
|
||||
@@ -257,8 +275,9 @@ MxResult LegoVideoManager::Tickle()
|
||||
if (!m_paused && (m_render3d || m_unk0xe5)) {
|
||||
cursor.Reset();
|
||||
|
||||
while (cursor.Next(presenter) && presenter->GetDisplayZ() >= 0)
|
||||
while (cursor.Next(presenter) && presenter->GetDisplayZ() >= 0) {
|
||||
presenter->PutData();
|
||||
}
|
||||
|
||||
if (!m_unk0xe5) {
|
||||
m_3dManager->Render(0.0);
|
||||
@@ -267,21 +286,25 @@ MxResult LegoVideoManager::Tickle()
|
||||
|
||||
cursor.Prev();
|
||||
|
||||
while (cursor.Next(presenter))
|
||||
while (cursor.Next(presenter)) {
|
||||
presenter->PutData();
|
||||
}
|
||||
|
||||
if (m_drawCursor)
|
||||
if (m_drawCursor) {
|
||||
DrawCursor();
|
||||
}
|
||||
|
||||
if (m_drawFPS)
|
||||
if (m_drawFPS) {
|
||||
DrawFPS();
|
||||
}
|
||||
}
|
||||
else if (m_fullScreenMovie) {
|
||||
MxPresenter* presenter;
|
||||
MxPresenterListCursor cursor(m_presenters);
|
||||
|
||||
if (cursor.Last(presenter))
|
||||
if (cursor.Last(presenter)) {
|
||||
presenter->PutData();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_paused) {
|
||||
@@ -316,8 +339,9 @@ inline void LegoVideoManager::DrawCursor()
|
||||
m_cursorRect.right = 16;
|
||||
m_cursorSurface = MxDisplaySurface::CreateCursorSurface();
|
||||
|
||||
if (!m_cursorSurface)
|
||||
if (!m_cursorSurface) {
|
||||
m_drawCursor = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ddSurface2
|
||||
@@ -467,19 +491,22 @@ MxResult LegoVideoManager::ConfigureD3DRM()
|
||||
IDirect3DRMDevice2* d3drm =
|
||||
((TglImpl::DeviceImpl*) m_3dManager->GetLego3DView()->GetDevice())->ImplementationData();
|
||||
|
||||
if (!d3drm)
|
||||
if (!d3drm) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxAssignedDevice* assignedDevice = m_direct3d->GetAssignedDevice();
|
||||
|
||||
if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::c_hardwareMode) {
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR) {
|
||||
d3drm->SetTextureQuality(D3DRMTEXTURE_LINEAR);
|
||||
}
|
||||
|
||||
d3drm->SetDither(TRUE);
|
||||
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwShadeCaps & D3DPSHADECAPS_ALPHAFLATBLEND)
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwShadeCaps & D3DPSHADECAPS_ALPHAFLATBLEND) {
|
||||
d3drm->SetRenderMode(D3DRMRENDERMODE_BLENDEDTRANSPARENCY);
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -209,11 +209,13 @@ void MxTransitionManager::TransitionDissolve()
|
||||
|
||||
for (MxS32 col = 0; col < 640; col++) {
|
||||
// Select 16 columns on each tick
|
||||
if (m_animationTimer * 16 > m_columnOrder[col])
|
||||
if (m_animationTimer * 16 > m_columnOrder[col]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_animationTimer * 16 + 15 < m_columnOrder[col])
|
||||
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.
|
||||
@@ -291,11 +293,13 @@ void MxTransitionManager::TransitionPixelation()
|
||||
|
||||
for (MxS32 col = 0; col < 64; col++) {
|
||||
// Select 4 columns on each tick
|
||||
if (m_animationTimer * 4 > m_columnOrder[col])
|
||||
if (m_animationTimer * 4 > m_columnOrder[col]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_animationTimer * 4 + 3 < m_columnOrder[col])
|
||||
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
|
||||
@@ -549,8 +553,9 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC p_ddsc)
|
||||
(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)
|
||||
if (!m_copyBuffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy into the copy buffer
|
||||
MxU8* dst = m_copyBuffer;
|
||||
|
||||
Reference in New Issue
Block a user