mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 08:54:15 +00:00
Implement/match LegoRaceMap (#1087)
* Implement/match LegoRaceMap * Fix CI, address review comments --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -43,8 +43,10 @@ LegoInputManager* InputManager()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10015750
|
||||
// FUNCTION: BETA10 0x100e48dc
|
||||
LegoControlManager* ControlManager()
|
||||
{
|
||||
assert(LegoOmni::GetInstance());
|
||||
return LegoOmni::GetInstance()->GetInputManager()->GetControlManager();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +1,143 @@
|
||||
#include "legoracemap.h"
|
||||
|
||||
#include "define.h"
|
||||
#include "legocontrolmanager.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "legoworld.h"
|
||||
#include "misc.h"
|
||||
#include "mxcontrolpresenter.h"
|
||||
#include "mxstillpresenter.h"
|
||||
#include "mxutilities.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoRaceMap, 0x1b4)
|
||||
|
||||
// FUNCTION: LEGO1 0x1005d0d0
|
||||
// FUNCTION: BETA10 0x100ca2c0
|
||||
LegoRaceMap::LegoRaceMap()
|
||||
{
|
||||
m_unk0x08 = FALSE;
|
||||
m_unk0x0c = NULL;
|
||||
m_unk0x10 = 0;
|
||||
m_stillPresenter = NULL;
|
||||
m_Map_Ctl = 0;
|
||||
ControlManager()->Register(this);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005d2b0
|
||||
// FUNCTION: LEGO1 0x1005d2b0
|
||||
// FUNCTION: BETA10 0x100ca48c
|
||||
LegoRaceMap::~LegoRaceMap()
|
||||
{
|
||||
// TODO
|
||||
ControlManager()->Unregister(this);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005d310
|
||||
// GLOBAL: LEGO1 0x1010208c
|
||||
// STRING: LEGO1 0x10101f88
|
||||
const char* g_mapLocator = "MAP_LOCATOR";
|
||||
|
||||
// GLOBAL: LEGO1 0x10102090
|
||||
// STRING: LEGO1 0x10101f78
|
||||
const char* g_mapGeometry = "MAP_GEOMETRY";
|
||||
|
||||
// FUNCTION: LEGO1 0x1005d310
|
||||
// FUNCTION: BETA10 0x100ca543
|
||||
void LegoRaceMap::ParseAction(char* p_extra)
|
||||
{
|
||||
// TODO
|
||||
char value[256];
|
||||
|
||||
if (KeyValueStringParse(value, g_mapLocator, p_extra)) {
|
||||
// variable name verified by BETA10 0x100ca5ac
|
||||
MxStillPresenter* p = (MxStillPresenter*) VideoManager()->GetPresenterByActionObjectName(value);
|
||||
|
||||
assert(p);
|
||||
p->Enable(FALSE);
|
||||
m_stillPresenter = p;
|
||||
}
|
||||
|
||||
if (KeyValueStringParse(value, g_mapGeometry, p_extra)) {
|
||||
char* token = strtok(value, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x14 = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x18 = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x1c = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x20 = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x24 = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x28 = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x2c = atof(token);
|
||||
}
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
if (token != NULL) {
|
||||
m_unk0x30 = atof(token);
|
||||
}
|
||||
}
|
||||
|
||||
LegoWorld* currentWorld = CurrentWorld();
|
||||
|
||||
if (currentWorld) {
|
||||
// STRING: LEGO1 0x100f67bc
|
||||
const char* mapCtl = "Map_Ctl";
|
||||
|
||||
m_Map_Ctl = (MxControlPresenter*) currentWorld->Find("MxControlPresenter", mapCtl);
|
||||
assert(m_Map_Ctl);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005d4b0
|
||||
// FUNCTION: BETA10 0x100ca849
|
||||
void LegoRaceMap::FUN_1005d4b0()
|
||||
{
|
||||
// TODO
|
||||
if (m_unk0x08) {
|
||||
short xPos = (GetWorldPosition()[0] - m_unk0x14) / m_unk0x18 * m_unk0x24;
|
||||
short yPos = (GetWorldPosition()[2] - m_unk0x1c) / m_unk0x20 * m_unk0x28;
|
||||
|
||||
m_stillPresenter->SetPosition(xPos + m_unk0x2c, m_unk0x30 - yPos);
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005d550
|
||||
// FUNCTION: LEGO1 0x1005d550
|
||||
// FUNCTION: BETA10 0x100ca92d
|
||||
MxLong LegoRaceMap::Notify(MxParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
if (!m_stillPresenter) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationControl &&
|
||||
m_Map_Ctl->GetAction()->GetObjectId() ==
|
||||
((LegoControlManagerNotificationParam&) p_param).GetClickedObjectId()) {
|
||||
|
||||
if (((LegoControlManagerNotificationParam&) p_param).GetUnknown0x28() == 1) {
|
||||
m_unk0x08 = TRUE;
|
||||
FUN_1005d4b0();
|
||||
m_stillPresenter->Enable(TRUE);
|
||||
}
|
||||
else {
|
||||
m_unk0x08 = FALSE;
|
||||
m_stillPresenter->Enable(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -409,6 +409,28 @@ MxPresenter* LegoVideoManager::GetPresenterAt(MxS32 p_x, MxS32 p_y)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c180
|
||||
// FUNCTION: BETA10 0x100d6df4
|
||||
MxPresenter* LegoVideoManager::GetPresenterByActionObjectName(const char* p_actionObjectName)
|
||||
{
|
||||
MxPresenterListCursor cursor(m_presenters);
|
||||
MxPresenter* presenter;
|
||||
|
||||
while (TRUE) {
|
||||
if (!cursor.Prev(presenter)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!presenter->GetAction()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmpi(presenter->GetAction()->GetObjectName(), p_actionObjectName) == 0) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c290
|
||||
MxResult LegoVideoManager::RealizePalette(MxPalette* p_pallete)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user