Merge remote-tracking branch 'isle/master' into isle-merge3

This commit is contained in:
Christian Semmler 2024-12-29 09:21:06 -07:00
commit b0a4d0e06b
22 changed files with 267 additions and 223 deletions

View file

@ -292,7 +292,7 @@ add_lego1_static_library(omni
LEGO1/omni/src/video/mxpalette.cpp
LEGO1/omni/src/video/mxregion.cpp
LEGO1/omni/src/video/mxregioncursor.cpp
LEGO1/omni/src/video/mxsmack.cpp
LEGO1/omni/src/video/mxsmk.cpp
LEGO1/omni/src/video/mxsmkpresenter.cpp
LEGO1/omni/src/video/mxstillpresenter.cpp
LEGO1/omni/src/video/mxvideomanager.cpp

View file

@ -69,9 +69,9 @@ struct InfocenterMapEntry {
// FUNCTION: LEGO1 0x1006ec80
InfocenterMapEntry() {}
MxStillPresenter* m_presenter; // 0x00
undefined4 m_unk0x04; // 0x04
MxRect32 m_area; // 0x08
MxStillPresenter* m_destCtl; // 0x00
undefined4 m_unk0x04; // 0x04
MxRect32 m_area; // 0x08
};
// VTABLE: LEGO1 0x100d9338
@ -161,9 +161,9 @@ private:
Cutscene m_currentCutscene; // 0x108
Radio m_radio; // 0x10c
MxStillPresenter* m_unk0x11c; // 0x11c
InfocenterMapEntry m_mapAreas[7]; // 0x120
InfocenterMapEntry m_glowInfo[7]; // 0x120
MxS16 m_unk0x1c8; // 0x1c8
MxStillPresenter* m_frameHotBitmap; // 0x1cc
MxStillPresenter* m_frame; // 0x1cc
MxS16 m_infoManDialogueTimer; // 0x1d0
MxS16 m_bookAnimationTimer; // 0x1d2
MxU16 m_unk0x1d4; // 0x1d4

View file

@ -1206,7 +1206,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
assert(destWorld);
m_buildState->m_animationState = LegoVehicleBuildState::e_exiting;
if (m_unk0x258->AllPartsPlaced()) {
if (!m_unk0x258->AllPartsPlaced()) {
FUN_100243a0();
}
else {
@ -1214,8 +1214,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
}
}
else {
MxNotificationParam param;
NotificationManager()->Send(this, param);
NotificationManager()->Send(this, MxNotificationParam());
}
break;
case 2:
@ -1242,9 +1241,8 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
FUN_10024ef0();
}
else {
MxNotificationParam p;
// In BETA10, NotificationManager->Send() also takes __FILE__ and __LINE__ arguments
NotificationManager()->Send(this, p);
NotificationManager()->Send(this, MxNotificationParam());
}
break;
}

View file

@ -2345,11 +2345,11 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_
{
const char** cycles = g_cycles[g_characters[p_characterId].m_unk0x16];
const char* vehicleWC;
LegoLocomotionAnimPresenter* presenter;
if (g_characters[p_characterId].m_vehicleId >= 0 && g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x04 &&
(vehicleWC = cycles[10]) != NULL) {
LegoLocomotionAnimPresenter* presenter =
(LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
if (presenter != NULL) {
presenter->FUN_1006d680(p_actor, 1.7f);
@ -2362,8 +2362,7 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_
else {
vehicleWC = cycles[p_mood];
if (vehicleWC != NULL) {
LegoLocomotionAnimPresenter* presenter =
(LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
if (presenter != NULL) {
presenter->FUN_1006d680(p_actor, 0.7f);
@ -2376,8 +2375,7 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_
vehicleWC = cycles[p_mood + 4];
if (vehicleWC != NULL) {
LegoLocomotionAnimPresenter* presenter =
(LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
if (presenter != NULL) {
presenter->FUN_1006d680(p_actor, 4.0f);
@ -2390,8 +2388,7 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_
vehicleWC = cycles[p_mood + 7];
if (vehicleWC != NULL) {
LegoLocomotionAnimPresenter* presenter =
(LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC);
if (presenter != NULL) {
presenter->FUN_1006d680(p_actor, 0.0f);
@ -2484,6 +2481,8 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn
Vector3* v1 = p_edge->CWVertex(*p_boundary);
Vector3* v2 = p_edge->CCWVertex(*p_boundary);
assert(v1 && v2);
p1 = *v2;
p1 -= *v1;
p1 *= p_destScale;
@ -2496,7 +2495,12 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn
boundingBox.Min() -= vec;
boundingBox.Max() = p1;
boundingBox.Max() += vec;
return GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE;
if (GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE) {
return TRUE;
}
return FALSE;
}
// FUNCTION: LEGO1 0x10064120

View file

@ -129,7 +129,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
if (p_roi) {
const char* name = p_roi->GetName();
for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 1; i++) {
for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 2; i++) {
if (!SDL_strcasecmp(name, g_actorNames[i])) {
m_type = e_actor;
m_actorId = i;

View file

@ -31,6 +31,11 @@
DECOMP_SIZE_ASSERT(LegoNavController, 0x70)
// MSVC 4.20 didn't define a macro for this key
#ifndef VK_OEM_MINUS
#define VK_OEM_MINUS 0xBD
#endif
//////////////////////////////////////////////////////////////////////
#ifndef M_PI
@ -110,7 +115,7 @@ char g_debugPassword[] = "OGEL";
char* g_currentInput = g_debugPassword;
// GLOBAL: LEGO1 0x100f66cc
MxS32 g_unk0x100f66cc = -1;
MxS32 g_nextCharacter = -1;
// GLOBAL: LEGO1 0x100f66d0
MxBool g_enableMusic = TRUE;
@ -581,29 +586,33 @@ MxResult LegoNavController::ProcessKeyboardInput()
m_unk0x6c = TRUE;
MxS32 hMax;
if ((keyFlags & LegoInputManager::c_leftOrRight) == LegoInputManager::c_left) {
switch (keyFlags & LegoInputManager::c_leftOrRight) {
case LegoInputManager::c_left:
hMax = 0;
}
else if ((keyFlags & LegoInputManager::c_leftOrRight) == LegoInputManager::c_right) {
break;
case LegoInputManager::c_right:
hMax = m_hMax;
}
else {
break;
default:
m_targetRotationalVel = 0.0;
m_rotationalAccel = m_maxRotationalDeccel;
bool1 = TRUE;
break;
}
MxS32 vMax;
if ((keyFlags & LegoInputManager::c_upOrDown) == LegoInputManager::c_up) {
switch (keyFlags & LegoInputManager::c_upOrDown) {
case LegoInputManager::c_up:
vMax = 0;
}
else if ((keyFlags & LegoInputManager::c_upOrDown) == LegoInputManager::c_down) {
break;
case LegoInputManager::c_down:
vMax = m_vMax;
}
else {
break;
default:
m_targetLinearVel = 0.0;
m_linearAccel = m_maxLinearDeccel;
bool2 = TRUE;
break;
}
MxFloat val = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 4.0f;
@ -692,29 +701,29 @@ MxLong LegoNavController::Notify(MxParam& p_param)
}
break;
}
case 'k':
case 'm': { // Keys need to be uppercased to trigger this code, but seems dysfunctional
if (g_unk0x100f66cc == -1) {
g_unk0x100f66cc = 0;
case VK_ADD:
case VK_SUBTRACT: { // Cycles through characters and puts them in front of you
if (g_nextCharacter == -1) {
g_nextCharacter = 0;
}
else {
CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_unk0x100f66cc));
CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_nextCharacter));
if (key == 'k') {
g_unk0x100f66cc++;
if (g_unk0x100f66cc >= CharacterManager()->GetNumActors()) {
g_unk0x100f66cc = 0;
if (key == VK_ADD) {
g_nextCharacter++;
if (g_nextCharacter >= CharacterManager()->GetNumActors()) {
g_nextCharacter = 0;
}
}
else {
g_unk0x100f66cc--;
if (g_unk0x100f66cc < 0) {
g_unk0x100f66cc = CharacterManager()->GetNumActors() - 1;
g_nextCharacter--;
if (g_nextCharacter < 0) {
g_nextCharacter = CharacterManager()->GetNumActors() - 1;
}
}
}
LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_unk0x100f66cc), TRUE);
LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_nextCharacter), TRUE);
if (roi != NULL) {
MxMatrix mat;
ViewROI* viewRoi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
@ -727,7 +736,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
}
break;
}
case '{': { // Saves the game. Can't actually be triggered
case VK_F12: { // Saves the game
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state && state->HasRegistered()) {
GameState()->Save(0);
@ -993,7 +1002,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
case 'X':
RealtimeView::SetUserMaxLOD(3.6);
break;
case 'j': {
case VK_MULTIPLY: {
MxU8 newActor = GameState()->GetActorId() + 1;
if (newActor > LegoActor::c_laura) {
@ -1003,10 +1012,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
GameState()->SetActorId(newActor);
break;
}
case 'o':
case VK_DIVIDE:
GameState()->SetActorId(LegoActor::c_brickster);
break;
case 'z':
case VK_F11:
if (GameState()->m_isDirty) {
GameState()->m_isDirty = FALSE;
}
@ -1014,7 +1023,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
GameState()->m_isDirty = TRUE;
}
break;
case 0xbd:
case VK_OEM_MINUS:
g_unk0x100f66bc = LegoAnimationManager::e_unk1;
break;
}

View file

@ -556,15 +556,15 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
MxPresenter* presenter;
while (cursor.Next(presenter)) {
MxDSAction* action = presenter->GetAction();
if (!strcmp(action->GetObjectName(), p_name)) {
if (!strcmp(presenter->GetAction()->GetObjectName(), p_name)) {
return presenter;
}
}
return NULL;
}
else if (!strcmp(p_class, "MxEntity")) {
if (!strcmp(p_class, "MxEntity")) {
LegoEntityListCursor cursor(m_entityList);
LegoEntity* entity;
@ -581,7 +581,8 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
return NULL;
}
else if (!strcmp(p_class, "LegoAnimPresenter")) {
if (!strcmp(p_class, "LegoAnimPresenter")) {
MxPresenterListCursor cursor(&m_animPresenters);
MxPresenter* presenter;
@ -593,20 +594,18 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
return NULL;
}
else {
for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
if ((*it)->IsA(p_class) && (*it)->IsA("MxPresenter")) {
MxPresenter* presenter = (MxPresenter*) *it;
MxDSAction* action = presenter->GetAction();
if (!strcmp(action->GetObjectName(), p_name)) {
return *it;
}
for (MxCoreSet::iterator i = m_set0xa8.begin(); i != m_set0xa8.end(); i++) {
if ((*i)->IsA(p_class) && (*i)->IsA("MxPresenter")) {
assert(((MxPresenter*) (*i))->GetAction());
if (!strcmp(((MxPresenter*) (*i))->GetAction()->GetObjectName(), p_name)) {
return *i;
}
}
return NULL;
}
return NULL;
}
// FUNCTION: LEGO1 0x10021790
@ -785,7 +784,7 @@ MxResult LegoWorld::Tickle()
ReadyWorld();
return TRUE;
case e_two:
if (PresentersPending()) {
if (PresentersPending() == TRUE) {
break;
}
default:

View file

@ -408,7 +408,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
p_param.SetROI(roi);
if (roi && roi->GetVisibility()) {
if (roi && roi->GetVisibility() == TRUE) {
for (OrientableROI* parent = roi->GetParentROI(); parent; parent = parent->GetParentROI()) {
roi = (LegoROI*) parent;
}

View file

@ -132,12 +132,12 @@ Infocenter::Infocenter()
m_selectedCharacter = e_noCharacter;
m_unk0x11c = NULL;
m_infocenterState = NULL;
m_frameHotBitmap = NULL;
m_frame = NULL;
m_destLocation = LegoGameState::e_undefined;
m_currentInfomainScript = InfomainScript::c_noneInfomain;
m_currentCutscene = e_noIntro;
memset(&m_mapAreas, 0, sizeof(m_mapAreas));
memset(&m_glowInfo, 0, sizeof(m_glowInfo));
m_unk0x1c8 = -1;
SetAppCursor(e_cursorBusy);
@ -612,6 +612,7 @@ void Infocenter::ReadyWorld()
}
// FUNCTION: LEGO1 0x1006f9a0
// FUNCTION: BETA10 0x1002ef2f
void Infocenter::InitializeBitmaps()
{
m_radio.Initialize(TRUE);
@ -632,56 +633,64 @@ void Infocenter::InitializeBitmaps()
((MxPresenter*) Find(m_atomId, InfomainScript::c_Laura_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Radio_Ctl))->Enable(TRUE);
m_mapAreas[0].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap");
m_mapAreas[0].m_area.SetLeft(391);
m_mapAreas[0].m_area.SetTop(182);
m_mapAreas[0].m_area.SetRight(427);
m_mapAreas[0].m_area.SetBottom(230);
m_mapAreas[0].m_unk0x04 = 3;
m_glowInfo[0].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap");
assert(m_glowInfo[0].m_destCtl);
m_glowInfo[0].m_area.SetLeft(391);
m_glowInfo[0].m_area.SetTop(182);
m_glowInfo[0].m_area.SetRight(427);
m_glowInfo[0].m_area.SetBottom(230);
m_glowInfo[0].m_unk0x04 = 3;
m_mapAreas[1].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap");
m_mapAreas[1].m_area.SetLeft(304);
m_mapAreas[1].m_area.SetTop(225);
m_mapAreas[1].m_area.SetRight(350);
m_mapAreas[1].m_area.SetBottom(268);
m_mapAreas[1].m_unk0x04 = 10;
m_glowInfo[1].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap");
assert(m_glowInfo[1].m_destCtl);
m_glowInfo[1].m_area.SetLeft(304);
m_glowInfo[1].m_area.SetTop(225);
m_glowInfo[1].m_area.SetRight(350);
m_glowInfo[1].m_area.SetBottom(268);
m_glowInfo[1].m_unk0x04 = 10;
m_mapAreas[2].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap");
m_mapAreas[2].m_area.SetLeft(301);
m_mapAreas[2].m_area.SetTop(133);
m_mapAreas[2].m_area.SetRight(347);
m_mapAreas[2].m_area.SetBottom(181);
m_mapAreas[2].m_unk0x04 = 11;
m_glowInfo[2].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap");
assert(m_glowInfo[1].m_destCtl); // DECOMP: intentional typo
m_glowInfo[2].m_area.SetLeft(301);
m_glowInfo[2].m_area.SetTop(133);
m_glowInfo[2].m_area.SetRight(347);
m_glowInfo[2].m_area.SetBottom(181);
m_glowInfo[2].m_unk0x04 = 11;
m_mapAreas[3].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap");
m_mapAreas[3].m_area.SetLeft(289);
m_mapAreas[3].m_area.SetTop(182);
m_mapAreas[3].m_area.SetRight(335);
m_mapAreas[3].m_area.SetBottom(225);
m_mapAreas[3].m_unk0x04 = 12;
m_glowInfo[3].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap");
assert(m_glowInfo[3].m_destCtl);
m_glowInfo[3].m_area.SetLeft(289);
m_glowInfo[3].m_area.SetTop(182);
m_glowInfo[3].m_area.SetRight(335);
m_glowInfo[3].m_area.SetBottom(225);
m_glowInfo[3].m_unk0x04 = 12;
m_mapAreas[4].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap");
m_mapAreas[4].m_area.SetLeft(350);
m_mapAreas[4].m_area.SetTop(161);
m_mapAreas[4].m_area.SetRight(391);
m_mapAreas[4].m_area.SetBottom(209);
m_mapAreas[4].m_unk0x04 = 13;
m_glowInfo[4].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap");
assert(m_glowInfo[4].m_destCtl);
m_glowInfo[4].m_area.SetLeft(350);
m_glowInfo[4].m_area.SetTop(161);
m_glowInfo[4].m_area.SetRight(391);
m_glowInfo[4].m_area.SetBottom(209);
m_glowInfo[4].m_unk0x04 = 13;
m_mapAreas[5].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap");
m_mapAreas[5].m_area.SetLeft(392);
m_mapAreas[5].m_area.SetTop(130);
m_mapAreas[5].m_area.SetRight(438);
m_mapAreas[5].m_area.SetBottom(176);
m_mapAreas[5].m_unk0x04 = 14;
m_glowInfo[5].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap");
assert(m_glowInfo[5].m_destCtl);
m_glowInfo[5].m_area.SetLeft(392);
m_glowInfo[5].m_area.SetTop(130);
m_glowInfo[5].m_area.SetRight(438);
m_glowInfo[5].m_area.SetBottom(176);
m_glowInfo[5].m_unk0x04 = 14;
m_mapAreas[6].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap");
m_mapAreas[6].m_area.SetLeft(396);
m_mapAreas[6].m_area.SetTop(229);
m_mapAreas[6].m_area.SetRight(442);
m_mapAreas[6].m_area.SetBottom(272);
m_mapAreas[6].m_unk0x04 = 15;
m_glowInfo[6].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap");
assert(m_glowInfo[6].m_destCtl);
m_glowInfo[6].m_area.SetLeft(396);
m_glowInfo[6].m_area.SetTop(229);
m_glowInfo[6].m_area.SetRight(442);
m_glowInfo[6].m_area.SetBottom(272);
m_glowInfo[6].m_unk0x04 = 15;
m_frameHotBitmap = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap");
m_frame = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap");
assert(m_frame);
UpdateFrameHot(TRUE);
}
@ -831,7 +840,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
if (m_unk0x1c8 != -1) {
m_infoManDialogueTimer = 0;
switch (m_mapAreas[m_unk0x1c8].m_unk0x04) {
switch (m_glowInfo[m_unk0x1c8].m_unk0x04) {
case 3:
GameState()->SetActor(m_selectedCharacter);
@ -1304,11 +1313,11 @@ MxBool Infocenter::VTable0x5c()
void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y)
{
MxS16 i;
for (i = 0; i < (MxS32) (sizeof(m_mapAreas) / sizeof(m_mapAreas[0])); i++) {
MxS32 right = m_mapAreas[i].m_area.GetRight();
MxS32 bottom = m_mapAreas[i].m_area.GetBottom();
MxS32 left = m_mapAreas[i].m_area.GetLeft();
MxS32 top = m_mapAreas[i].m_area.GetTop();
for (i = 0; i < (MxS32) (sizeof(m_glowInfo) / sizeof(m_glowInfo[0])); i++) {
MxS32 right = m_glowInfo[i].m_area.GetRight();
MxS32 bottom = m_glowInfo[i].m_area.GetBottom();
MxS32 left = m_glowInfo[i].m_area.GetLeft();
MxS32 top = m_glowInfo[i].m_area.GetTop();
if (left <= p_x && p_x <= right && top <= p_y && p_y <= bottom) {
break;
@ -1321,12 +1330,12 @@ void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y)
if (i != m_unk0x1c8) {
if (m_unk0x1c8 != -1) {
m_mapAreas[m_unk0x1c8].m_presenter->Enable(FALSE);
m_glowInfo[m_unk0x1c8].m_destCtl->Enable(FALSE);
}
m_unk0x1c8 = i;
if (i != -1) {
m_mapAreas[i].m_presenter->Enable(TRUE);
m_glowInfo[i].m_destCtl->Enable(TRUE);
}
}
}
@ -1362,18 +1371,18 @@ void Infocenter::UpdateFrameHot(MxBool p_display)
return;
}
MxS32 originalDisplayZ = m_frameHotBitmap->GetDisplayZ();
MxS32 originalDisplayZ = m_frame->GetDisplayZ();
m_frameHotBitmap->SetDisplayZ(1000);
m_frame->SetDisplayZ(1000);
VideoManager()->SortPresenterList();
m_frameHotBitmap->Enable(TRUE);
m_frameHotBitmap->SetPosition(x, y);
m_frameHotBitmap->SetDisplayZ(originalDisplayZ);
m_frame->Enable(TRUE);
m_frame->SetPosition(x, y);
m_frame->SetDisplayZ(originalDisplayZ);
}
else {
if (m_frameHotBitmap) {
m_frameHotBitmap->Enable(FALSE);
if (m_frame) {
m_frame->Enable(FALSE);
}
}
}

View file

@ -91,7 +91,7 @@ public:
// DECOMP: This could be a free function. It is static here because it has no
// reference to "this". In the beta it is called in two places:
// 1. GetBmiHeightAbs
// 2. MxSmack::LoadFrame
// 2. MxSmk::LoadFrame
// FUNCTION: BETA10 0x1002c690
static MxLong HeightAbs(MxLong p_value) { return p_value > 0 ? p_value : -p_value; }

View file

@ -97,4 +97,7 @@ private:
// TEMPLATE: BETA10 0x10150e60
// MxUtilityList<MxNextActionDataStart *>::PushBack
// TEMPLATE: BETA10 0x10150ff0
// MxUtilityList<MxDSObject *>::PushBack
#endif // MXDISKSTREAMCONTROLLER_H

View file

@ -1,5 +1,5 @@
#ifndef MXSMACK_H
#define MXSMACK_H
#ifndef MXSMK_H
#define MXSMK_H
#include "decomp.h"
#include "mxrectlist.h"
@ -10,15 +10,15 @@
struct MxBITMAPINFO;
// SIZE 0x6b8
struct MxSmack {
struct MxSmk {
smk m_smk;
static MxResult LoadHeader(MxU8* p_data, MxU32 p_length, MxSmack* p_mxSmack);
static void Destroy(MxSmack* p_mxSmack);
static MxResult LoadHeader(MxU8* p_data, MxU32 p_length, MxSmk* p_mxSmk);
static void Destroy(MxSmk* p_mxSmk);
static MxResult LoadFrame(
MxBITMAPINFO* p_bitmapInfo,
MxU8* p_bitmapData,
MxSmack* p_mxSmack,
MxSmk* p_mxSmk,
MxU8* p_chunkData,
MxBool& p_paletteChanged,
MxU32 p_currentFrame,
@ -26,4 +26,4 @@ struct MxSmack {
);
};
#endif // MXSMACK_H
#endif // MXSMK_H

View file

@ -2,7 +2,7 @@
#define MXSMKPRESENTER_H
#include "decomp.h"
#include "mxsmack.h"
#include "mxsmk.h"
#include "mxvideopresenter.h"
// VTABLE: LEGO1 0x100dc348
@ -48,7 +48,7 @@ private:
void Destroy(MxBool p_fromDestructor);
protected:
MxSmack m_mxSmack; // 0x64
MxSmk m_mxSmk; // 0x64
MxU32 m_currentFrame; // 0x71c
};

View file

@ -74,14 +74,14 @@ public:
MxStreamProvider* GetProvider() { return m_provider; }
MxDSObjectList& GetUnk0x3c() { return m_unk0x3c; }
MxDSObjectList& GetUnk0x54() { return m_unk0x54; }
MxDSSubscriberList& GetSubscriberList() { return m_subscriberList; }
MxDSSubscriberList& GetSubscriberList() { return m_subscribers; }
protected:
MxCriticalSection m_criticalSection; // 0x08
MxAtomId m_atom; // 0x24
MxStreamProvider* m_provider; // 0x28
undefined4* m_unk0x2c; // 0x2c
MxDSSubscriberList m_subscriberList; // 0x30
MxDSSubscriberList m_subscribers; // 0x30
MxDSObjectList m_unk0x3c; // 0x3c
MxNextActionDataStartList m_nextActionList; // 0x48
MxDSObjectList m_unk0x54; // 0x54

View file

@ -39,17 +39,15 @@ void MxPresenter::Init()
}
// FUNCTION: LEGO1 0x100b4d80
// FUNCTION: BETA10 0x1012e120
MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action)
{
AUTOLOCK(m_criticalSection);
this->m_action = p_action;
m_action = p_action;
m_location = MxPoint32(m_action->GetLocation()[0], m_action->GetLocation()[1]);
m_displayZ = m_action->GetLocation()[2];
const Mx3DPointFloat& location = this->m_action->GetLocation();
MxS32 previousTickleState = this->m_currentTickleState;
this->m_location = MxPoint32(this->m_action->GetLocation()[0], this->m_action->GetLocation()[1]);
this->m_displayZ = this->m_action->GetLocation()[2];
ProgressTickleState(e_ready);
return SUCCESS;
@ -58,22 +56,22 @@ MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action)
// FUNCTION: LEGO1 0x100b4e40
void MxPresenter::EndAction()
{
if (this->m_action == NULL) {
if (m_action == NULL) {
return;
}
AUTOLOCK(m_criticalSection);
if (!this->m_compositePresenter) {
if (!m_compositePresenter) {
MxOmni::GetInstance()->NotifyCurrentEntity(
MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE)
MxEndActionNotificationParam(c_notificationEndAction, NULL, m_action, TRUE)
);
}
this->m_action = NULL;
m_action = NULL;
MxS32 previousTickleState = 1 << m_currentTickleState;
this->m_previousTickleStates |= previousTickleState;
this->m_currentTickleState = e_idle;
m_previousTickleStates |= previousTickleState;
m_currentTickleState = e_idle;
}
// FUNCTION: LEGO1 0x100b4fc0
@ -127,39 +125,39 @@ MxResult MxPresenter::Tickle()
{
AUTOLOCK(m_criticalSection);
switch (this->m_currentTickleState) {
switch (m_currentTickleState) {
case e_ready:
this->ReadyTickle();
ReadyTickle();
if (m_currentTickleState != e_starting) {
break;
}
case e_starting:
this->StartingTickle();
StartingTickle();
if (m_currentTickleState != e_streaming) {
break;
}
case e_streaming:
this->StreamingTickle();
StreamingTickle();
if (m_currentTickleState != e_repeating) {
break;
}
case e_repeating:
this->RepeatingTickle();
RepeatingTickle();
if (m_currentTickleState != e_freezing) {
break;
}
case e_freezing:
this->FreezingTickle();
FreezingTickle();
if (m_currentTickleState != e_done) {
break;
}
case e_done:
this->DoneTickle();
DoneTickle();
default:
break;
}
@ -170,14 +168,14 @@ MxResult MxPresenter::Tickle()
// FUNCTION: LEGO1 0x100b52d0
void MxPresenter::Enable(MxBool p_enable)
{
if (this->m_action && this->IsEnabled() != p_enable) {
MxU32 flags = this->m_action->GetFlags();
if (m_action && IsEnabled() != p_enable) {
MxU32 flags = m_action->GetFlags();
if (p_enable) {
this->m_action->SetFlags(flags | MxDSAction::c_enabled);
m_action->SetFlags(flags | MxDSAction::c_enabled);
}
else {
this->m_action->SetFlags(flags & ~MxDSAction::c_enabled);
m_action->SetFlags(flags & ~MxDSAction::c_enabled);
}
}
}
@ -264,5 +262,5 @@ MxEntity* MxPresenter::CreateEntity(const char* p_defaultName)
// FUNCTION: BETA10 0x1012ebaf
MxBool MxPresenter::IsEnabled()
{
return this->m_action && this->m_action->GetFlags() & MxDSAction::c_enabled;
return m_action && m_action->GetFlags() & MxDSAction::c_enabled;
}

View file

@ -8,6 +8,8 @@
#include "mxomni.h"
#include "mxticklemanager.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(MxDiskStreamController, 0xc8);
// FUNCTION: LEGO1 0x100c7120
@ -17,6 +19,7 @@ MxDiskStreamController::MxDiskStreamController()
}
// FUNCTION: LEGO1 0x100c7530
// FUNCTION: BETA10 0x10153a2d
MxDiskStreamController::~MxDiskStreamController()
{
AUTOLOCK(m_criticalSection);
@ -35,6 +38,8 @@ MxDiskStreamController::~MxDiskStreamController()
#endif
}
assert(m_subscribers.size() == 0);
MxDSObject* object;
while (m_unk0x3c.PopFront(object)) {
delete object;
@ -65,28 +70,32 @@ MxDiskStreamController::~MxDiskStreamController()
}
// FUNCTION: LEGO1 0x100c7790
// FUNCTION: BETA10 0x10153ea8
MxResult MxDiskStreamController::Open(const char* p_filename)
{
AUTOLOCK(m_criticalSection);
MxResult result = MxStreamController::Open(p_filename);
if (result == SUCCESS) {
m_provider = new MxDiskStreamProvider();
if (m_provider == NULL) {
result = FAILURE;
}
else {
result = m_provider->SetResourceToGet(this);
if (result != SUCCESS) {
delete m_provider;
m_provider = NULL;
}
else {
TickleManager()->RegisterClient(this, 10);
}
}
if (result != SUCCESS) {
goto done;
}
m_provider = new MxDiskStreamProvider();
if (m_provider == NULL) {
result = FAILURE;
goto done;
}
result = m_provider->SetResourceToGet(this);
if (result != SUCCESS) {
delete m_provider;
m_provider = NULL;
goto done;
}
TickleManager()->RegisterClient(this, 10);
done:
return result;
}
@ -97,6 +106,7 @@ MxResult MxDiskStreamController::VTable0x18(undefined4, undefined4)
}
// FUNCTION: LEGO1 0x100c7890
// FUNCTION: BETA10 0x101543bb
MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action)
{
AUTOLOCK(m_criticalSection);
@ -104,7 +114,7 @@ MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action)
return FAILURE;
}
m_list0x80.push_back(p_action);
m_list0x80.PushBack(p_action);
FUN_100c7970();
return SUCCESS;
}
@ -122,6 +132,7 @@ void MxDiskStreamController::FUN_100c7970()
}
// FUNCTION: LEGO1 0x100c7980
// FUNCTION: BETA10 0x10154848
void MxDiskStreamController::FUN_100c7980()
{
MxDSBuffer* buffer;
@ -159,24 +170,33 @@ void MxDiskStreamController::FUN_100c7980()
}
// FUNCTION: LEGO1 0x100c7ac0
// FUNCTION: BETA10 0x10154abb
MxDSStreamingAction* MxDiskStreamController::VTable0x28()
{
AUTOLOCK(m_criticalSection);
MxDSObject* oldAction;
MxDSStreamingAction* result = NULL;
assert(m_provider);
MxDSStreamingAction* request = NULL;
MxU32 filesize = m_provider->GetFileSize();
if (m_unk0x3c.PopFront(oldAction)) {
result = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction);
if (result) {
MxU32 offset = result->GetBufferOffset() + filesize;
((MxDSStreamingAction*) oldAction)->SetUnknown94(offset);
((MxDSStreamingAction*) oldAction)->SetBufferOffset(offset);
m_unk0x3c.push_back(oldAction);
}
if (!m_unk0x3c.PopFront(oldAction)) {
goto done;
}
return result;
request = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction);
assert(request);
if (!request) {
goto done;
}
((MxDSStreamingAction*) oldAction)->SetUnknown94(request->GetBufferOffset() + filesize);
((MxDSStreamingAction*) oldAction)->SetBufferOffset(((MxDSStreamingAction*) oldAction)->GetUnknown94());
m_unk0x3c.PushBack(oldAction);
done:
return request;
}
// FUNCTION: LEGO1 0x100c7c00
@ -277,15 +297,17 @@ MxDSStreamingAction* MxDiskStreamController::FUN_100c7db0()
}
// FUNCTION: LEGO1 0x100c7f40
// FUNCTION: BETA10 0x101553e0
void MxDiskStreamController::FUN_100c7f40(MxDSStreamingAction* p_streamingaction)
{
AUTOLOCK(m_criticalSection);
if (p_streamingaction) {
m_list0x64.push_back(p_streamingaction);
m_list0x64.PushBack(p_streamingaction);
}
}
// FUNCTION: LEGO1 0x100c7ff0
// FUNCTION: BETA10 0x10155471
MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action)
{
AUTOLOCK(m_criticalSection);
@ -389,7 +411,7 @@ MxResult MxDiskStreamController::FUN_100c8360(MxDSStreamingAction* p_action)
action2->SetObjectId(p_action->GetObjectId());
}
m_list0x90.push_back(action2);
m_list0x90.PushBack(action2);
}
}
@ -405,6 +427,7 @@ void MxDiskStreamController::InsertToList74(MxDSBuffer* p_buffer)
}
// FUNCTION: LEGO1 0x100c8540
// FUNCTION: BETA10 0x10155a05
void MxDiskStreamController::FUN_100c8540()
{
AUTOLOCK(m_criticalSection);
@ -429,6 +452,7 @@ void MxDiskStreamController::FUN_100c8540()
}
// FUNCTION: LEGO1 0x100c8640
// FUNCTION: BETA10 0x10155ba0
MxResult MxDiskStreamController::Tickle()
{
if (m_unk0xc4) {
@ -461,7 +485,6 @@ void MxDiskStreamController::FUN_100c8720()
while (!m_list0xb8.empty()) {
action = (MxDSStreamingAction*) m_list0xb8.front();
m_list0xb8.pop_front();
FUN_100c7cb0(action);
}
}

View file

@ -201,7 +201,7 @@ MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action)
{
AUTOLOCK(m_criticalSection);
m_list.push_back(p_action);
m_list.PushBack(p_action);
}
m_unk0x35 = TRUE;

View file

@ -32,7 +32,7 @@ MxStreamController::~MxStreamController()
AUTOLOCK(m_criticalSection);
MxDSSubscriber* subscriber;
while (m_subscriberList.PopFront(subscriber)) {
while (m_subscribers.PopFront(subscriber)) {
delete subscriber;
}
@ -80,14 +80,14 @@ MxResult MxStreamController::Open(const char* p_filename)
// FUNCTION: BETA10 0x1014e730
void MxStreamController::AddSubscriber(MxDSSubscriber* p_subscriber)
{
m_subscriberList.PushBack(p_subscriber);
m_subscribers.PushBack(p_subscriber);
}
// FUNCTION: LEGO1 0x100c1620
// FUNCTION: BETA10 0x1014e7b4
void MxStreamController::RemoveSubscriber(MxDSSubscriber* p_subscriber)
{
m_subscriberList.Remove(p_subscriber);
m_subscribers.Remove(p_subscriber);
}
// FUNCTION: LEGO1 0x100c1690
@ -173,7 +173,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
}
if (newUnknown24 == -1) {
for (MxDSSubscriberList::iterator it = m_subscriberList.begin(); it != m_subscriberList.end(); it++) {
for (MxDSSubscriberList::iterator it = m_subscribers.begin(); it != m_subscribers.end(); it++) {
MxDSSubscriber* subscriber = *it;
if (subscriber->GetObjectId() == p_action->GetObjectId()) {
@ -288,7 +288,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
chunk->SetChunkFlags(DS_CHUNK_BIT3);
chunk->SetObjectId(objectId);
if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) {
if (chunk->SendChunk(m_subscribers, FALSE, p_action->GetUnknown24()) != SUCCESS) {
delete chunk;
}
@ -318,7 +318,7 @@ MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingA
// FUNCTION: BETA10 0x1014f3b5
MxBool MxStreamController::IsStoped(MxDSObject* p_obj)
{
MxDSSubscriber* subscriber = m_subscriberList.Find(p_obj);
MxDSSubscriber* subscriber = m_subscribers.Find(p_obj);
if (subscriber) {
MxTrace(

View file

@ -1,41 +1,41 @@
#include "mxsmack.h"
#include "mxsmk.h"
#include "mxbitmap.h"
#include <string.h>
DECOMP_SIZE_ASSERT(SmackTag, 0x390);
DECOMP_SIZE_ASSERT(MxSmack, 0x6b8);
DECOMP_SIZE_ASSERT(MxSmk, 0x6b8);
// FUNCTION: LEGO1 0x100c5a90
// FUNCTION: BETA10 0x10151e70
MxResult MxSmack::LoadHeader(MxU8* p_data, MxU32 p_length, MxSmack* p_mxSmack)
MxResult MxSmk::LoadHeader(MxU8* p_data, MxU32 p_length, MxSmk* p_mxSmk)
{
p_mxSmack->m_smk = smk_open_memory_stream(p_data, p_length);
p_mxSmk->m_smk = smk_open_memory_stream(p_data, p_length);
if (p_mxSmack->m_smk == NULL) {
if (p_mxSmk->m_smk == NULL) {
return FAILURE;
}
smk_enable_video(p_mxSmack->m_smk, TRUE);
smk_enable_video(p_mxSmk->m_smk, TRUE);
return SUCCESS;
}
// FUNCTION: LEGO1 0x100c5d40
// FUNCTION: BETA10 0x10152298
void MxSmack::Destroy(MxSmack* p_mxSmack)
void MxSmk::Destroy(MxSmk* p_mxSmk)
{
if (p_mxSmack->m_smk != NULL) {
smk_close(p_mxSmack->m_smk);
if (p_mxSmk->m_smk != NULL) {
smk_close(p_mxSmk->m_smk);
}
}
// FUNCTION: LEGO1 0x100c5db0
// FUNCTION: BETA10 0x10152391
MxResult MxSmack::LoadFrame(
MxResult MxSmk::LoadFrame(
MxBITMAPINFO* p_bitmapInfo,
MxU8* p_bitmapData,
MxSmack* p_mxSmack,
MxSmk* p_mxSmk,
MxU8* p_chunkData,
MxBool& p_paletteChanged,
MxU32 p_currentFrame,
@ -45,24 +45,24 @@ MxResult MxSmack::LoadFrame(
p_bitmapInfo->m_bmiHeader.biHeight = -MxBitmap::HeightAbs(p_bitmapInfo->m_bmiHeader.biHeight);
unsigned long w, h;
smk_info_video(p_mxSmack->m_smk, &w, &h, NULL);
smk_set_chunk(p_mxSmack->m_smk, p_currentFrame, p_chunkData);
smk_info_video(p_mxSmk->m_smk, &w, &h, NULL);
smk_set_chunk(p_mxSmk->m_smk, p_currentFrame, p_chunkData);
if (p_currentFrame == 0) {
smk_first(p_mxSmack->m_smk);
smk_first(p_mxSmk->m_smk);
}
else {
smk_next(p_mxSmack->m_smk);
smk_next(p_mxSmk->m_smk);
}
memcpy(p_bitmapData, smk_get_video(p_mxSmack->m_smk), w * h);
memcpy(p_bitmapData, smk_get_video(p_mxSmk->m_smk), w * h);
unsigned char frameType;
smk_info_all(p_mxSmack->m_smk, NULL, NULL, &frameType, NULL);
smk_info_all(p_mxSmk->m_smk, NULL, NULL, &frameType, NULL);
p_paletteChanged = frameType & 1;
if (p_paletteChanged) {
const unsigned char* palette = smk_get_palette(p_mxSmack->m_smk);
const unsigned char* palette = smk_get_palette(p_mxSmk->m_smk);
for (MxU32 i = 0; i < 256; i++) {
p_bitmapInfo->m_bmiColors[i].rgbBlue = palette[i * 3 + 2];

View file

@ -26,7 +26,7 @@ MxSmkPresenter::~MxSmkPresenter()
void MxSmkPresenter::Init()
{
m_currentFrame = 0;
memset(&m_mxSmack, 0, sizeof(m_mxSmack));
memset(&m_mxSmk, 0, sizeof(m_mxSmk));
SetBit1(FALSE);
SetBit2(FALSE);
}
@ -36,7 +36,7 @@ void MxSmkPresenter::Destroy(MxBool p_fromDestructor)
{
m_criticalSection.Enter();
MxSmack::Destroy(&m_mxSmack);
MxSmk::Destroy(&m_mxSmk);
Init();
m_criticalSection.Leave();
@ -49,7 +49,7 @@ void MxSmkPresenter::Destroy(MxBool p_fromDestructor)
// FUNCTION: LEGO1 0x100b3940
void MxSmkPresenter::LoadHeader(MxStreamChunk* p_chunk)
{
MxSmack::LoadHeader(p_chunk->GetData(), p_chunk->GetLength(), &m_mxSmack);
MxSmk::LoadHeader(p_chunk->GetData(), p_chunk->GetLength(), &m_mxSmk);
}
// FUNCTION: LEGO1 0x100b3960
@ -60,7 +60,7 @@ void MxSmkPresenter::CreateBitmap()
}
unsigned long w, h;
smk_info_video(m_mxSmack.m_smk, &w, &h, NULL);
smk_info_video(m_mxSmk.m_smk, &w, &h, NULL);
m_frameBitmap = new MxBitmap;
m_frameBitmap->SetSize(w, h, NULL, FALSE);
@ -78,7 +78,7 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk)
VTable0x88();
MxRectList rects(TRUE);
MxSmack::LoadFrame(bitmapInfo, bitmapData, &m_mxSmack, chunkData, paletteChanged, m_currentFrame - 1, &rects);
MxSmk::LoadFrame(bitmapInfo, bitmapData, &m_mxSmk, chunkData, paletteChanged, m_currentFrame - 1, &rects);
if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) {
RealizePalette();

View file

@ -411,7 +411,7 @@ public:
Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer);
void Destroy();
void FillRowsOfTexture(int y, int height, char* content);
Result FillRowsOfTexture(int y, int height, char* content);
Result InitializePalette(int paletteSize, PaletteEntry* pEntries);
D3DRMIMAGE m_image;

View file

@ -129,10 +129,11 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff
}
// FUNCTION: LEGO1 0x100a1510
void TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent)
Result TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent)
{
// The purpose is clearly this but I can't get the assembly to line up.
memcpy((char*) m_image.buffer1 + (y * m_image.bytes_per_line), pContent, height * m_image.bytes_per_line);
return Success;
}
// FUNCTION: LEGO1 0x100a1550