Merge pull request #65 from foxtacles/mergeisle7

Update from isledecomp/isle
This commit is contained in:
Christian Semmler 2025-05-09 09:36:59 -07:00 committed by GitHub
commit 436936c384
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 205 additions and 184 deletions

2
.gitignore vendored
View File

@ -25,3 +25,5 @@ tools/ghidra_scripts/import.log
# These entries are kept for now since that convention has not always been around.
ISLE.EXE
LEGO1.DLL
.DS_Store

View File

@ -229,7 +229,7 @@ private:
MxResult WriteEndOfVariables(LegoStorage* p_storage);
MxS32 ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to);
void SetColors();
void SetROIHandlerFunction();
void SetROIColorOverride();
char* m_savePath; // 0x00
MxS16 m_stateCount; // 0x04
@ -256,7 +256,7 @@ public:
Area m_unk0x42c; // 0x42c
};
MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen);
MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen);
// SYNTHETIC: LEGO1 0x1003c860
// LegoGameState::ScoreItem::ScoreItem

View File

@ -79,7 +79,7 @@ public:
c_right = 0x02,
c_up = 0x04,
c_down = 0x08,
c_bit5 = 0x10,
c_ctrl = 0x10,
c_leftOrRight = c_left | c_right,
c_upOrDown = c_up | c_down

View File

@ -155,7 +155,7 @@ protected:
float m_unk0x60; // 0x60
float m_unk0x64; // 0x64
float m_unk0x68; // 0x68
MxBool m_unk0x6c; // 0x6c
MxBool m_isAccelerating; // 0x6c
// one copy of defaults (these can be set by App.)
static int g_defdeadZone;

View File

@ -222,8 +222,8 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
LegoROI* roi = m_roiMap[j];
if (roi && roi->GetName() && (SDL_strcasecmp(name, roi->GetName()) == 0)) {
roi->FUN_100a9dd0();
roi->FUN_100a9350("lego red");
roi->ClearMeshOffset();
roi->SetLodColor("lego red");
}
}
}

View File

@ -569,14 +569,14 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
if (textureInfo != NULL) {
childROI->FUN_100a9210(textureInfo);
childROI->FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F);
childROI->SetTextureInfo(textureInfo);
childROI->SetLodColor(1.0F, 1.0F, 1.0F, 0.0F);
}
}
else if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) {
LegoFloat red, green, blue, alpha;
childROI->FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
childROI->FUN_100a9170(red, green, blue, alpha);
childROI->GetRGBAColor(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
childROI->SetLodColor(red, green, blue, alpha);
}
comp->push_back(childROI);
@ -798,8 +798,8 @@ MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI)
}
LegoFloat red, green, blue, alpha;
LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
p_targetROI->FUN_100a9170(red, green, blue, alpha);
LegoROI::GetRGBAColor(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
p_targetROI->SetLodColor(red, green, blue, alpha);
return TRUE;
}
@ -834,12 +834,12 @@ MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi)
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
LegoFloat red, green, blue, alpha;
LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
LegoROI::GetRGBAColor(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
for (MxS32 i = 0; i < lodSize; i++) {
LegoLOD* lod = (LegoLOD*) (*lodList)[i];
LegoLOD* clone = lod->Clone(renderer);
clone->FUN_100aacb0(red, green, blue, alpha);
clone->SetColor(red, green, blue, alpha);
dupLodList->PushBack(clone);
}

View File

@ -147,7 +147,7 @@ const char* g_strDisable = "disable";
LegoGameState::LegoGameState()
{
SetColors();
SetROIHandlerFunction();
SetROIColorOverride();
m_stateCount = 0;
m_actorId = 0;
@ -178,7 +178,7 @@ LegoGameState::LegoGameState()
// FUNCTION: LEGO1 0x10039720
LegoGameState::~LegoGameState()
{
LegoROI::FUN_100a9d30(NULL);
LegoROI::SetColorOverride(NULL);
if (m_stateCount) {
for (MxS16 i = 0; i < m_stateCount; i++) {
@ -1062,13 +1062,13 @@ void LegoGameState::SetColors()
}
// FUNCTION: LEGO1 0x1003bac0
void LegoGameState::SetROIHandlerFunction()
void LegoGameState::SetROIColorOverride()
{
LegoROI::FUN_100a9d30(&ROIHandlerFunction);
LegoROI::SetColorOverride(&ROIColorOverride);
}
// FUNCTION: LEGO1 0x1003bad0
MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen)
MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen)
{
if (p_output != NULL && p_copyLen != 0 &&
(SDL_strncasecmp(p_input, "INDIR-F-", strlen("INDIR-F-")) == 0 ||

View File

@ -144,7 +144,7 @@ MxResult MxCompositeMediaPresenter::Tickle()
{
AUTOLOCK(m_criticalSection);
switch (m_currentTickleState) {
switch (GetCurrentTickleState()) {
case e_ready:
ProgressTickleState(e_starting);
case e_starting:

View File

@ -143,7 +143,7 @@ LegoNavController::LegoNavController()
m_rotationalAccel = 0.0f;
m_trackDefault = FALSE;
m_unk0x5d = FALSE;
m_unk0x6c = FALSE;
m_isAccelerating = FALSE;
m_unk0x64 = 0.0f;
m_unk0x68 = 0.0f;
m_unk0x60 = 0.0f;
@ -570,8 +570,8 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und)
// FUNCTION: LEGO1 0x100558b0
MxResult LegoNavController::ProcessKeyboardInput()
{
MxBool bool1 = FALSE;
MxBool bool2 = FALSE;
MxBool skipRotationVelAndAccelCalc = FALSE;
MxBool skipLinearVelAndAccelCalc = FALSE;
LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager();
MxU32 keyFlags;
@ -580,18 +580,18 @@ MxResult LegoNavController::ProcessKeyboardInput()
}
if (keyFlags == 0) {
if (m_unk0x6c) {
if (m_isAccelerating) {
m_targetRotationalVel = 0.0;
m_targetLinearVel = 0.0;
m_rotationalAccel = m_maxRotationalDeccel;
m_linearAccel = m_maxLinearDeccel;
m_unk0x6c = FALSE;
m_isAccelerating = FALSE;
}
return FAILURE;
}
m_unk0x6c = TRUE;
m_isAccelerating = TRUE;
MxS32 hMax;
switch (keyFlags & LegoInputManager::c_leftOrRight) {
@ -604,7 +604,7 @@ MxResult LegoNavController::ProcessKeyboardInput()
default:
m_targetRotationalVel = 0.0;
m_rotationalAccel = m_maxRotationalDeccel;
bool1 = TRUE;
skipRotationVelAndAccelCalc = TRUE;
break;
}
@ -619,23 +619,31 @@ MxResult LegoNavController::ProcessKeyboardInput()
default:
m_targetLinearVel = 0.0;
m_linearAccel = m_maxLinearDeccel;
bool2 = TRUE;
skipLinearVelAndAccelCalc = TRUE;
break;
}
MxFloat val = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 4.0f;
MxFloat val2 = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 2.0f;
MxFloat maxAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 4.0f;
MxFloat minAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 2.0f;
if (!bool1) {
if (!skipRotationVelAndAccelCalc) {
m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel);
m_rotationalAccel =
CalculateNewAccel(hMax, m_hMax / 2, m_maxRotationalAccel / val, (int) (m_minRotationalAccel / val2));
m_rotationalAccel = CalculateNewAccel(
hMax,
m_hMax / 2,
m_maxRotationalAccel / maxAccelDivisor,
(int) (m_minRotationalAccel / minAccelDivisor)
);
}
if (!bool2) {
if (!skipLinearVelAndAccelCalc) {
m_targetLinearVel = CalculateNewTargetVel(m_vMax - vMax, m_vMax / 2, m_maxLinearVel);
m_linearAccel =
CalculateNewAccel(m_vMax - vMax, m_vMax / 2, m_maxLinearAccel / val, (int) (m_minLinearAccel / val2));
m_linearAccel = CalculateNewAccel(
m_vMax - vMax,
m_vMax / 2,
m_maxLinearAccel / maxAccelDivisor,
(int) (m_minLinearAccel / minAccelDivisor)
);
}
return SUCCESS;

View File

@ -342,15 +342,15 @@ MxResult LegoWorldPresenter::FUN_10067360(ModelDbPart& p_part, SDL_IOStream* p_w
// FUNCTION: LEGO1 0x100674b0
MxResult LegoWorldPresenter::FUN_100674b0(ModelDbModel& p_model, SDL_IOStream* p_wdbFile, LegoWorld* p_world)
{
MxU8* buff = new MxU8[p_model.m_unk0x04];
MxU8* buff = new MxU8[p_model.m_modelDataLength];
SDL_SeekIO(p_wdbFile, p_model.m_unk0x08, SDL_IO_SEEK_SET);
if (SDL_ReadIO(p_wdbFile, buff, p_model.m_unk0x04) != p_model.m_unk0x04) {
SDL_SeekIO(p_wdbFile, p_model.m_modelDataOffset, SDL_IO_SEEK_SET);
if (SDL_ReadIO(p_wdbFile, buff, p_model.m_modelDataLength) != p_model.m_modelDataLength) {
return FAILURE;
}
MxDSChunk chunk;
chunk.SetLength(p_model.m_unk0x04);
chunk.SetLength(p_model.m_modelDataLength);
chunk.SetData(buff);
MxDSAction action;

View File

@ -133,7 +133,7 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
}
if (m_keyboardState[SDL_SCANCODE_LCTRL] || m_keyboardState[SDL_SCANCODE_RCTRL]) {
keyFlags |= c_bit5;
keyFlags |= c_ctrl;
}
p_keyFlags = keyFlags;

View File

@ -56,7 +56,7 @@ void LegoPhonemePresenter::StartingTickle()
}
head = entityROI->FindChildROI("head", entityROI);
head->GetTexture(m_textureInfo);
head->GetTextureInfo(m_textureInfo);
LegoPhonemeList* phonemeList = VideoManager()->GetPhonemeList();
LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1);

View File

@ -34,7 +34,7 @@ LegoLOD::LegoLOD(Tgl::Renderer* p_renderer) : ViewLOD(p_renderer)
m_numMeshes = 0;
m_numVertices = 0;
m_numPolys = 0;
m_unk0x1c = 0;
m_meshOffset = 0;
}
// FUNCTION: LEGO1 0x100aa450
@ -214,7 +214,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
if (textureName != NULL) {
if (mesh->GetUnknown0x21()) {
LegoROI::FUN_100a9cf0(textureName, paletteEntries, sizeOfArray(paletteEntries));
LegoROI::GetPaletteEntries(textureName, paletteEntries, sizeOfArray(paletteEntries));
}
textureInfo = p_textureContainer->Get(mesh->GetTextureName());
@ -234,7 +234,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
LegoFloat alpha = 0.0F;
if (mesh->GetUnknown0x21()) {
LegoROI::FUN_100a9bf0(materialName, red, green, blue, alpha);
LegoROI::GetRGBAColor(materialName, red, green, blue, alpha);
}
else {
red = mesh->GetColor().GetRed() / 255.0;
@ -267,7 +267,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
}
}
m_unk0x1c = meshUnd2;
m_meshOffset = meshUnd2;
if (textureVertices != NULL) {
delete[] textureVertices;
@ -321,15 +321,15 @@ LegoLOD* LegoLOD::Clone(Tgl::Renderer* p_renderer)
dupLod->m_numMeshes = m_numMeshes;
dupLod->m_numVertices = m_numVertices;
dupLod->m_numPolys = m_numPolys;
dupLod->m_unk0x1c = m_unk0x1c;
dupLod->m_meshOffset = m_meshOffset;
return dupLod;
}
// FUNCTION: LEGO1 0x100aacb0
LegoResult LegoLOD::FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
LegoResult LegoLOD::SetColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) {
if (!m_melems[i].m_unk0x04) {
m_melems[i].m_tglMesh->SetColor(p_red, p_green, p_blue, p_alpha);
}
@ -339,9 +339,9 @@ LegoResult LegoLOD::FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p
}
// FUNCTION: LEGO1 0x100aad00
LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo)
LegoResult LegoLOD::SetTextureInfo(LegoTextureInfo* p_textureInfo)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) {
if (m_melems[i].m_unk0x04) {
LegoTextureInfo::SetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo);
m_melems[i].m_tglMesh->SetColor(1.0F, 1.0F, 1.0F, 0.0F);
@ -355,7 +355,7 @@ LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo)
// FUNCTION: LEGO1 0x100aad70
LegoResult LegoLOD::FUN_100aad70(LegoTextureInfo* p_textureInfo)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) {
if (m_melems[i].m_unk0x04) {
LegoTextureInfo::SetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo);
}
@ -365,9 +365,9 @@ LegoResult LegoLOD::FUN_100aad70(LegoTextureInfo* p_textureInfo)
}
// FUNCTION: LEGO1 0x100aadc0
LegoResult LegoLOD::GetTexture(LegoTextureInfo*& p_textureInfo)
LegoResult LegoLOD::GetTextureInfo(LegoTextureInfo*& p_textureInfo)
{
for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) {
for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) {
if (m_melems[i].m_unk0x04) {
if (LegoTextureInfo::GetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo) == TRUE) {
return SUCCESS;
@ -392,9 +392,9 @@ LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name)
// FUNCTION: LEGO1 0x100aae60
// FUNCTION: BETA10 0x1018e50f
void LegoLOD::FUN_100aae60()
void LegoLOD::ClearMeshOffset()
{
m_unk0x1c = 0;
m_meshOffset = 0;
}
inline BOOL GetMeshData(IDirect3DRMMesh*& mesh, D3DRMGROUPINDEX& index, Tgl::Mesh* pMesh)

View File

@ -29,11 +29,11 @@ public:
LegoResult Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_textureContainer, LegoStorage* p_storage);
LegoLOD* Clone(Tgl::Renderer* p_renderer);
LegoResult FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo);
LegoResult SetColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult SetTextureInfo(LegoTextureInfo* p_textureInfo);
LegoResult FUN_100aad70(LegoTextureInfo* p_textureInfo);
void FUN_100aae60();
LegoResult GetTexture(LegoTextureInfo*& p_textureInfo);
void ClearMeshOffset();
LegoResult GetTextureInfo(LegoTextureInfo*& p_textureInfo);
static LegoBool FUN_100aae20(const LegoChar* p_name);
@ -45,7 +45,7 @@ protected:
LegoU32 m_numMeshes; // 0x10
LegoU32 m_numVertices; // 0x14
LegoU32 m_numPolys; // 0x18
undefined4 m_unk0x1c; // 0x1c
LegoU32 m_meshOffset; // 0x1c
};
#endif // LEGOLOD_H

View File

@ -53,10 +53,10 @@ const char* g_unk0x10101380[] = {"bike", "moto", "haus", NULL};
const char* g_unk0x10101390[] = {"rcuser", "jsuser", "dunebugy", "chtrblad", "chtrbody", "chtrshld", NULL};
// GLOBAL: LEGO1 0x101013ac
ROIHandler g_unk0x101013ac = NULL;
ColorOverride g_colorOverride = NULL;
// GLOBAL: LEGO1 0x101013b0
TextureHandler g_unk0x101013b0 = NULL;
TextureHandler g_textureHandler = NULL;
// FUNCTION: LEGO1 0x100a81b0
void LegoROI::FUN_100a81b0(const LegoChar* p_error, const LegoChar* p_name)
@ -300,16 +300,16 @@ LegoResult LegoROI::Read(
goto done;
}
FUN_100a9210(textureInfo);
FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F);
SetTextureInfo(textureInfo);
SetLodColor(1.0F, 1.0F, 1.0F, 0.0F);
}
else {
LegoFloat red = 1.0F;
LegoFloat green = 0.0F;
LegoFloat blue = 1.0F;
LegoFloat alpha = 0.0F;
FUN_100a9bf0(textureName, red, green, blue, alpha);
FUN_100a9170(red, green, blue, alpha);
GetRGBAColor(textureName, red, green, blue, alpha);
SetLodColor(red, green, blue, alpha);
}
}
@ -482,7 +482,7 @@ LegoResult LegoROI::SetFrame(LegoAnim* p_anim, LegoTime p_time)
// FUNCTION: LEGO1 0x100a9170
// FUNCTION: BETA10 0x1018ae09
LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
LegoResult LegoROI::SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
{
LegoResult result = SUCCESS;
CompoundObject::iterator it;
@ -491,14 +491,14 @@ LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p
for (LegoU32 i = 0; i < lodCount; i++) {
LegoLOD* lod = (LegoLOD*) GetLOD(i);
if (lod->FUN_100aacb0(p_red, p_green, p_blue, p_alpha) != SUCCESS) {
if (lod->SetColor(p_red, p_green, p_blue, p_alpha) != SUCCESS) {
result = FAILURE;
}
}
if (comp != NULL) {
for (it = comp->begin(); it != comp->end(); it++) {
if (((LegoROI*) *it)->FUN_100a9170(p_red, p_green, p_blue, p_alpha) != SUCCESS) {
if (((LegoROI*) *it)->SetLodColor(p_red, p_green, p_blue, p_alpha) != SUCCESS) {
result = FAILURE;
}
}
@ -508,7 +508,7 @@ LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p
}
// FUNCTION: LEGO1 0x100a9210
LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo)
LegoResult LegoROI::SetTextureInfo(LegoTextureInfo* p_textureInfo)
{
LegoResult result = SUCCESS;
CompoundObject::iterator it;
@ -517,14 +517,14 @@ LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo)
for (LegoU32 i = 0; i < lodCount; i++) {
LegoLOD* lod = (LegoLOD*) GetLOD(i);
if (lod->FUN_100aad00(p_textureInfo) != SUCCESS) {
if (lod->SetTextureInfo(p_textureInfo) != SUCCESS) {
result = FAILURE;
}
}
if (comp != NULL) {
for (it = comp->begin(); it != comp->end(); it++) {
if (((LegoROI*) *it)->FUN_100a9210(p_textureInfo) != SUCCESS) {
if (((LegoROI*) *it)->SetTextureInfo(p_textureInfo) != SUCCESS) {
result = FAILURE;
}
}
@ -535,7 +535,7 @@ LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo)
// FUNCTION: LEGO1 0x100a92a0
// FUNCTION: BETA10 0x1018b12d
LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo)
LegoResult LegoROI::GetTextureInfo(LegoTextureInfo*& p_textureInfo)
{
CompoundObject::iterator it;
@ -543,14 +543,14 @@ LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo)
for (LegoU32 i = 0; i < lodCount; i++) {
LegoLOD* lod = (LegoLOD*) GetLOD(i);
if (lod->GetTexture(p_textureInfo) == SUCCESS) {
if (lod->GetTextureInfo(p_textureInfo) == SUCCESS) {
return SUCCESS;
}
}
if (comp != NULL) {
for (it = comp->begin(); it != comp->end(); it++) {
if (((LegoROI*) *it)->GetTexture(p_textureInfo) == SUCCESS) {
if (((LegoROI*) *it)->GetTextureInfo(p_textureInfo) == SUCCESS) {
return SUCCESS;
}
}
@ -563,16 +563,16 @@ LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo)
// FUNCTION: BETA10 0x1018b22c
LegoResult LegoROI::FUN_100a9330(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
{
return FUN_100a9170(p_red, p_green, p_blue, p_alpha);
return SetLodColor(p_red, p_green, p_blue, p_alpha);
}
// FUNCTION: LEGO1 0x100a9350
// FUNCTION: BETA10 0x1018b25c
LegoResult LegoROI::FUN_100a9350(const LegoChar* p_color)
LegoResult LegoROI::SetLodColor(const LegoChar* p_name)
{
MxFloat red, green, blue, alpha;
if (ColorAliasLookup(p_color, red, green, blue, alpha)) {
return FUN_100a9170(red, green, blue, alpha);
if (ColorAliasLookup(p_name, red, green, blue, alpha)) {
return SetLodColor(red, green, blue, alpha);
}
return SUCCESS;
@ -580,10 +580,10 @@ LegoResult LegoROI::FUN_100a9350(const LegoChar* p_color)
// FUNCTION: LEGO1 0x100a93b0
// FUNCTION: BETA10 0x1018b2c0
LegoResult LegoROI::FUN_100a93b0(const LegoChar* p_color)
LegoResult LegoROI::FUN_100a93b0(const LegoChar* p_name)
{
MxFloat red, green, blue, alpha;
if (ColorAliasLookup(p_color, red, green, blue, alpha)) {
if (ColorAliasLookup(p_name, red, green, blue, alpha)) {
return FUN_100a9330(red, green, blue, alpha);
}
@ -756,20 +756,20 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time)
}
// FUNCTION: LEGO1 0x100a9bf0
LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha)
LegoBool LegoROI::GetRGBAColor(const LegoChar* p_name, float& p_red, float& p_green, float& p_blue, float& p_alpha)
{
if (p_param == NULL) {
if (p_name == NULL) {
return FALSE;
}
if (g_unk0x101013ac) {
char buf[32];
if (g_unk0x101013ac(p_param, buf, sizeof(buf))) {
p_param = buf;
char p_updatedName[32];
if (g_colorOverride) {
if (g_colorOverride(p_name, p_updatedName, sizeof(p_updatedName))) {
p_name = p_updatedName;
}
}
return ColorAliasLookup(p_param, p_red, p_green, p_blue, p_alpha);
return ColorAliasLookup(p_name, p_red, p_green, p_blue, p_alpha);
}
// FUNCTION: LEGO1 0x100a9c50
@ -790,14 +790,15 @@ LegoBool LegoROI::ColorAliasLookup(const LegoChar* p_param, float& p_red, float&
}
// FUNCTION: LEGO1 0x100a9cf0
LegoBool LegoROI::FUN_100a9cf0(const LegoChar* p_param, unsigned char* paletteEntries, LegoU32 p_numEntries)
LegoBool LegoROI::GetPaletteEntries(const LegoChar* p_name, unsigned char* paletteEntries, LegoU32 p_numEntries)
{
if (p_param == NULL) {
if (p_name == NULL) {
return FALSE;
}
if (g_unk0x101013b0 != NULL) {
return g_unk0x101013b0(p_param, paletteEntries, p_numEntries);
// Note: g_textureHandler is never set in the code base
if (g_textureHandler != NULL) {
return g_textureHandler(p_name, paletteEntries, p_numEntries);
}
paletteEntries[0] = '\0';
@ -805,9 +806,9 @@ LegoBool LegoROI::FUN_100a9cf0(const LegoChar* p_param, unsigned char* paletteEn
}
// FUNCTION: LEGO1 0x100a9d30
void LegoROI::FUN_100a9d30(ROIHandler p_func)
void LegoROI::SetColorOverride(ColorOverride p_colorOverride)
{
g_unk0x101013ac = p_func;
g_colorOverride = p_colorOverride;
}
// FUNCTION: LEGO1 0x100a9d40
@ -829,12 +830,12 @@ void LegoROI::SetName(const LegoChar* p_name)
// FUNCTION: LEGO1 0x100a9dd0
// FUNCTION: BETA10 0x1018bfdb
void LegoROI::FUN_100a9dd0()
void LegoROI::ClearMeshOffset()
{
int lodCount = GetLODCount();
for (LegoS32 i = 0; i < lodCount; i++) {
LegoLOD* lod = (LegoLOD*) GetLOD(i);
lod->FUN_100aae60();
lod->ClearMeshOffset();
}
}

View File

@ -5,7 +5,7 @@
#include "misc/legotypes.h"
#include "viewmanager/viewroi.h"
typedef unsigned char (*ROIHandler)(const char*, char*, unsigned int);
typedef unsigned char (*ColorOverride)(const char*, char*, unsigned int);
typedef unsigned char (*TextureHandler)(const char*, unsigned char*, unsigned int);
class LegoEntity;
@ -37,26 +37,26 @@ public:
static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap);
static void FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap);
LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time);
LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo);
LegoResult GetTexture(LegoTextureInfo*& p_textureInfo);
LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult SetTextureInfo(LegoTextureInfo* p_textureInfo);
LegoResult GetTextureInfo(LegoTextureInfo*& p_textureInfo);
LegoResult FUN_100a9330(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult FUN_100a9350(const LegoChar* p_color);
LegoResult FUN_100a93b0(const LegoChar* p_color);
LegoResult SetLodColor(const LegoChar* p_name);
LegoResult FUN_100a93b0(const LegoChar* p_name);
LegoU32 FUN_100a9410(Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3, LegoBool p_collideBox);
void SetName(const LegoChar* p_name);
float IntrinsicImportance() const override; // vtable+0x04
void UpdateWorldBoundingVolumes() override; // vtable+0x18
void FUN_100a9dd0();
void ClearMeshOffset();
void SetDisplayBB(int p_displayBB);
static LegoResult FUN_100a8cb0(LegoAnimNodeData* p_data, LegoTime p_time, Matrix4& p_matrix);
static void FUN_100a81b0(const LegoChar* p_error, const LegoChar* p_name);
LEGO1_EXPORT static void configureLegoROI(int p_roi);
static void FUN_100a9d30(ROIHandler p_func);
static LegoBool FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha);
static void SetColorOverride(ColorOverride p_colorOverride);
static LegoBool GetRGBAColor(const LegoChar* p_name, float& p_red, float& p_green, float& p_blue, float& p_alpha);
static LegoBool ColorAliasLookup(
const LegoChar* p_param,
float& p_red,
@ -64,7 +64,7 @@ public:
float& p_blue,
float& p_alpha
);
static LegoBool FUN_100a9cf0(const LegoChar* p_param, unsigned char* paletteEntries, LegoU32 p_numEntries);
static LegoBool GetPaletteEntries(const LegoChar* p_name, unsigned char* paletteEntries, LegoU32 p_numEntries);
// FUNCTION: BETA10 0x1000f320
const LegoChar* GetName() const { return m_name; }

View File

@ -28,10 +28,10 @@ MxResult ModelDbModel::Read(SDL_IOStream* p_file)
return FAILURE;
}
if (SDL_ReadIO(p_file, &m_unk0x04, sizeof(m_unk0x04)) != sizeof(m_unk0x04)) {
if (SDL_ReadIO(p_file, &m_modelDataLength, sizeof(m_modelDataLength)) != sizeof(m_modelDataLength)) {
return FAILURE;
}
if (SDL_ReadIO(p_file, &m_unk0x08, sizeof(m_unk0x08)) != sizeof(m_unk0x08)) {
if (SDL_ReadIO(p_file, &m_modelDataOffset, sizeof(m_modelDataOffset)) != sizeof(m_modelDataOffset)) {
return FAILURE;
}
if (SDL_ReadIO(p_file, &len, sizeof(len)) != sizeof(len)) {

View File

@ -96,8 +96,8 @@ struct ModelDbModel {
MxResult Read(SDL_IOStream* p_file);
char* m_modelName; // 0x00
undefined4 m_unk0x04; // 0x04
undefined4 m_unk0x08; // 0x08
MxU32 m_modelDataLength; // 0x04
MxU32 m_modelDataOffset; // 0x08
char* m_presenterName; // 0x0c
float m_location[3]; // 0x10
float m_direction[3]; // 0x1c

View File

@ -201,13 +201,13 @@ int LegoDeviceEnumerate::FUN_1009d0d0()
// FUNCTION: BETA10 0x1011cf54
int LegoDeviceEnumerate::SupportsMMX()
{
if (!SupportsCPUID()) {
return 0;
}
int supports_mmx;
int supports_mmx = SupportsCPUID();
if (supports_mmx) {
#ifdef _MSC_VER
#if defined(_M_IX86)
__asm {
push ebx
mov eax, 0x0 ; EAX=0: Highest Function Parameter and Manufacturer ID
#if _MSC_VER > 1100
cpuid ; Run CPUID
@ -225,6 +225,7 @@ int LegoDeviceEnumerate::SupportsMMX()
xor eax, eax ; Zero EAX register
bt edx, 0x17 ; Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF)
adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF
pop ebx
mov supports_mmx, eax ; Save eax into C variable
}
#elif defined(_M_IX64)
@ -243,6 +244,8 @@ int LegoDeviceEnumerate::SupportsMMX()
: "=a"(supports_mmx) // supports_mmx == EAX
);
#endif
}
return supports_mmx;
}

View File

@ -16,7 +16,7 @@ public:
// Note: Comes before virtual destructor
virtual MxResult Run();
MxResult Start(MxS32 p_stack, MxS32 p_flag);
MxResult Start(MxS32 p_stackSize, MxS32 p_flag);
void Terminate();
void Sleep(MxS32 p_milliseconds);

View File

@ -256,9 +256,9 @@ void MxDSAction::AppendExtra(MxU16 p_extraLength, const char* p_extraData)
// FUNCTION: LEGO1 0x100adf70
// FUNCTION: BETA10 0x1012ba6a
void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_flags)
{
MxDSObject::Deserialize(p_source, p_unk0x24);
MxDSObject::Deserialize(p_source, p_flags);
// clang-format off
m_flags = *( MxU32*) p_source; p_source += sizeof(m_flags);

View File

@ -129,9 +129,9 @@ MxU32 MxDSMediaAction::GetSizeOnDisk()
// FUNCTION: LEGO1 0x100c8f60
// FUNCTION: BETA10 0x1015cc93
void MxDSMediaAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
void MxDSMediaAction::Deserialize(MxU8*& p_source, MxS16 p_flags)
{
MxDSAction::Deserialize(p_source, p_unk0x24);
MxDSAction::Deserialize(p_source, p_flags);
CopyMediaSrcPath((char*) p_source);
p_source += strlen(m_mediaSrcPath) + 1;

View File

@ -149,9 +149,9 @@ MxU32 MxDSMultiAction::GetSizeOnDisk()
// FUNCTION: LEGO1 0x100ca7b0
// FUNCTION: BETA10 0x10159b79
void MxDSMultiAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
void MxDSMultiAction::Deserialize(MxU8*& p_source, MxS16 p_flags)
{
MxDSAction::Deserialize(p_source, p_unk0x24);
MxDSAction::Deserialize(p_source, p_flags);
MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1;
p_source += 12;
@ -164,7 +164,7 @@ void MxDSMultiAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1;
p_source += 8;
MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk0x24);
MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_flags);
p_source += extraFlag;
m_actionList->Append(action);

View File

@ -156,7 +156,7 @@ MxU32 MxDSObject::GetSizeOnDisk()
// FUNCTION: LEGO1 0x100bfa20
// FUNCTION: BETA10 0x10147d73
void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_flags)
{
SetSourceName((char*) p_source);
p_source += strlen(m_sourceName) + 1;
@ -170,7 +170,7 @@ void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
m_objectId = *(MxU32*) p_source;
p_source += sizeof(m_objectId);
m_unk0x24 = p_unk0x24;
m_unk0x24 = p_flags;
}
// FUNCTION: LEGO1 0x100bfa80

View File

@ -94,11 +94,11 @@ MxU32 MxDSSelectAction::GetSizeOnDisk()
// FUNCTION: LEGO1 0x100cbf60
// FUNCTION: BETA10 0x1015aa30
void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_flags)
{
MxDSAction* action = NULL;
MxString string;
MxDSAction::Deserialize(p_source, p_unk0x24);
MxDSAction::Deserialize(p_source, p_flags);
MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1;
p_source += 12;
@ -140,7 +140,7 @@ void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1;
p_source += 8;
action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk0x24);
action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_flags);
if (index == i) {
m_actionList->Append(action);

View File

@ -58,9 +58,9 @@ MxDSAction* MxDSSound::Clone()
// FUNCTION: LEGO1 0x100c95a0
// FUNCTION: BETA10 0x1015d272
void MxDSSound::Deserialize(MxU8*& p_source, MxS16 p_unk0x24)
void MxDSSound::Deserialize(MxU8*& p_source, MxS16 p_flags)
{
MxDSMediaAction::Deserialize(p_source, p_unk0x24);
MxDSMediaAction::Deserialize(p_source, p_flags);
m_volume = *(MxS32*) p_source;
p_source += sizeof(m_volume);
}

View File

@ -22,7 +22,7 @@ MxThread::~MxThread()
}
// FUNCTION: LEGO1 0x100bf610
MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag)
MxResult MxThread::Start(MxS32 p_stackSize, MxS32 p_flag)
{
MxResult result = FAILURE;
@ -30,7 +30,7 @@ MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag)
const SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc);
SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this);
SDL_SetNumberProperty(props, SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, p_stack << 2);
SDL_SetNumberProperty(props, SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, p_stackSize * 4);
if ((m_thread = SDL_CreateThreadWithProperties(props))) {
result = SUCCESS;

View File

@ -86,6 +86,7 @@ void MxDisplaySurface::ClearScreen()
}
// FUNCTION: LEGO1 0x100ba750
// FUNCTION: BETA10 0x1013f6df
MxU8 MxDisplaySurface::CountTotalBitsSetTo1(MxU32 p_param)
{
MxU8 count = 0;
@ -98,6 +99,7 @@ MxU8 MxDisplaySurface::CountTotalBitsSetTo1(MxU32 p_param)
}
// FUNCTION: LEGO1 0x100ba770
// FUNCTION: BETA10 0x1013f724
MxU8 MxDisplaySurface::CountContiguousBitsSetTo1(MxU32 p_param)
{
MxU8 count = 0;
@ -293,24 +295,21 @@ void MxDisplaySurface::Destroy()
}
// FUNCTION: LEGO1 0x100baae0
// FUNCTION: BETA10 0x1013fe15
void MxDisplaySurface::SetPalette(MxPalette* p_palette)
{
if (m_surfaceDesc.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
m_ddSurface1->SetPalette(p_palette->CreateNativePalette());
m_ddSurface2->SetPalette(p_palette->CreateNativePalette());
if ((m_videoParam.Flags().GetFullScreen() & 1) == 0) {
if (!m_videoParam.Flags().GetFullScreen()) {
struct {
WORD m_palVersion;
WORD m_palNumEntries;
PALETTEENTRY m_palPalEntry[256];
} lpal;
} lpal = {0x300, 256};
lpal.m_palVersion = 0x300;
lpal.m_palNumEntries = 256;
memset(lpal.m_palPalEntry, 0, sizeof(lpal.m_palPalEntry));
p_palette->GetEntries(lpal.m_palPalEntry);
p_palette->GetEntries((LPPALETTEENTRY) lpal.m_palPalEntry);
HPALETTE hpal = CreatePalette((LPLOGPALETTE) &lpal);
HDC hdc = ::GetDC(0);
@ -321,7 +320,10 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette)
}
}
if (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount == 16) {
switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
case 8:
break;
case 16: {
if (!m_16bitPal) {
m_16bitPal = new MxU16[256];
}
@ -337,10 +339,15 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette)
MxU8 totalBitsBlue = CountTotalBitsSetTo1(m_surfaceDesc.ddpfPixelFormat.dwBBitMask);
for (MxS32 i = 0; i < 256; i++) {
m_16bitPal[i] = (((palette[i].peRed >> ((8 - totalBitsRed) & 0x1f)) << (contiguousBitsRed & 0x1f))) |
(((palette[i].peGreen >> ((8 - totalBitsGreen) & 0x1f)) << (contiguousBitsGreen & 0x1f))) |
(((palette[i].peBlue >> ((8 - totalBitsBlue) & 0x1f)) << (contiguousBitsBlue & 0x1f)));
m_16bitPal[i] = ((palette[i].peRed >> (8 - totalBitsRed)) << contiguousBitsRed) |
((palette[i].peGreen >> (8 - totalBitsGreen)) << contiguousBitsGreen) |
((palette[i].peBlue >> (8 - totalBitsBlue)) << contiguousBitsBlue);
}
break;
}
default:
break;
}
}

View File

@ -1,6 +1,6 @@
# LEGO Island, portable
[Development Vlog](https://www.youtube.com/playlist?list=PLbpl-gZkNl2COf_bB6cfgTapD5WduAfPz) | [Contributing](/CONTRIBUTING.md) | [Matrix](https://matrix.to/#/#isledecomp:matrix.org) | [Forums](https://forum.mattkc.com/viewforum.php?f=1) | [Patreon](https://www.patreon.com/mattkc)
[Development Vlog](https://www.youtube.com/playlist?list=PLbpl-gZkNl2Db4xcAsT_xOfOwRk-2DPHL) | [Contributing](/CONTRIBUTING.md) | [Matrix](https://matrix.to/#/#isledecomp:matrix.org) | [Forums](https://forum.mattkc.com/viewforum.php?f=1) | [Patreon](https://www.patreon.com/mattkc)
This initiative is a **work-in-progress** portable version of LEGO Island (Version 1.1, English) based on the [decompilation project](https://github.com/isledecomp/isle). Our primary goal is to transform the codebase to achieve platform independence, thereby enhancing compatibility across various systems while preserving the original game's experience as faithfully as possible.