implement Infocenter::HandleKeyPress

This commit is contained in:
Misha 2024-01-16 19:33:43 -05:00
parent b277b76abf
commit 526318a057
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
2 changed files with 44 additions and 7 deletions

View File

@ -48,7 +48,7 @@ class Infocenter : public LegoWorld {
// notifications
MxLong HandleMouseMove(MxS32 p_x, MxS32 p_y);
MxU8 HandleKeyPress(char p_key);
MxU32 HandleKeyPress(char p_key);
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
MxU8 HandleNotification17(MxParam&);
MxLong HandleEndAction(MxParam&);
@ -61,7 +61,7 @@ class Infocenter : public LegoWorld {
void PlayCutScene(MxU32 p_entityId, MxBool p_scale);
void StopCutScene();
void StartCredits();
static void DeleteCredits();
static void StopCredits();
void PlayDialogue(MxS32 p_objectId);
void StopCurrentDialogue();
static void PlayBookAnimation();

View File

@ -84,7 +84,7 @@ MxLong Infocenter::Notify(MxParam& p_param)
case c_notificationEndAction:
return HandleEndAction(p_param);
case c_notificationKeyPress:
return HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey());
return (MxU8)HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey());
case c_notificationButtonUp:
return HandleButtonUp(
((LegoEventNotificationParam&) p_param).GetX(),
@ -344,10 +344,47 @@ MxLong Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
return 1;
}
// STUB: LEGO1 0x1006fda0
MxU8 Infocenter::HandleKeyPress(char p_key)
// FUNCTION: LEGO1 0x1006fda0
MxU32 Infocenter::HandleKeyPress(char p_key)
{
return 1;
MxU32 result = 0;
if (p_key == ' ' && m_worldStarted) {
switch (m_infocenterState->GetUnknown0x74()) {
case 0:
StopCutScene();
m_infocenterState->SetUnknown0x74(1);
if (m_infocenterState->GetInfocenterBufferElement(0) == 0) {
m_unk0x1d2 = 1;
return 1;
}
break;
case 1:
case 4:
break;
default:
result = m_unk0xf8;
StopCurrentDialogue();
switch (m_infocenterState->GetUnknown0x74()) {
case 5:
case 12:
m_unk0xf8 = result;
return 1;
default:
m_infocenterState->SetUnknown0x74(2);
return 1;
case 8:
case 11:
break;
}
case 13:
StopCredits();
break;
}
result = 1;
}
return result;
}
// STUB: LEGO1 0x1006feb0
@ -452,7 +489,7 @@ void Infocenter::StartCredits()
}
// FUNCTION: LEGO1 0x10071250
void DeleteCredits()
void Infocenter::StopCredits()
{
MxDSAction action;
action.SetObjectId(499);