Skip to content

Commit

Permalink
Merge pull request #50 from foxtacles/isle-merge3
Browse files Browse the repository at this point in the history
Merge from isledecomp/isle
  • Loading branch information
foxtacles authored Dec 29, 2024
2 parents 05cfe4e + b0a4d0e commit 34bfa1b
Show file tree
Hide file tree
Showing 22 changed files with 274 additions and 230 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions LEGO1/lego/legoomni/include/infocenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -161,9 +161,9 @@ class Infocenter : public LegoWorld {
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
Expand Down
8 changes: 3 additions & 5 deletions LEGO1/lego/legoomni/src/build/legocarbuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,16 +1206,15 @@ 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 {
FUN_10025720(5);
}
}
else {
MxNotificationParam param;
NotificationManager()->Send(this, param);
NotificationManager()->Send(this, MxNotificationParam());
}
break;
case 2:
Expand All @@ -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;
}
Expand Down
22 changes: 13 additions & 9 deletions LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/entity/legoactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
67 changes: 38 additions & 29 deletions LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -1003,18 +1012,18 @@ 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;
}
else {
GameState()->m_isDirty = TRUE;
}
break;
case 0xbd:
case VK_OEM_MINUS:
g_unk0x100f66bc = LegoAnimationManager::e_unk1;
break;
}
Expand Down
29 changes: 14 additions & 15 deletions LEGO1/lego/legoomni/src/entity/legoworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -785,7 +784,7 @@ MxResult LegoWorld::Tickle()
ReadyWorld();
return TRUE;
case e_two:
if (PresentersPending()) {
if (PresentersPending() == TRUE) {
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/input/legoinputmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 34bfa1b

Please sign in to comment.