Clear unknowns in legoutils.h (#1610)

This commit is contained in:
Fabian Neundorf 2025-07-08 16:26:32 +02:00 committed by GitHub
parent c7fda26cf4
commit 5d3b6884e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 61 additions and 61 deletions

View File

@ -45,28 +45,28 @@ LegoROI* PickROI(MxLong p_x, MxLong p_y);
LegoROI* PickRootROI(MxLong p_x, MxLong p_y);
void RotateY(LegoROI* p_roi, MxFloat p_angle);
MxBool SpheresIntersect(const BoundingSphere& p_sphere1, const BoundingSphere& p_sphere2);
MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3]);
MxBool CalculateRayOriginDirection(MxFloat p_coordinates[2], MxFloat p_direction[3], MxFloat p_origin[3]);
MxBool TransformWorldToScreen(const MxFloat p_world[3], MxFloat p_screen[4]);
MxS16 CountTotalTreeNodes(LegoTreeNode* p_node);
LegoTreeNode* GetTreeNode(LegoTreeNode* p_node, MxU32 p_index);
void FUN_1003e050(LegoAnimPresenter* p_presenter);
void CalculateViewFromAnimation(LegoAnimPresenter* p_presenter);
Extra::ActionType MatchActionString(const char*);
void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p_streamId, LegoEntity* p_sender);
void SetCameraControllerFromIsle();
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool);
void FUN_1003eda0();
void ResetViewVelocity();
MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id);
void EnableAnimations(MxBool p_enable);
void SetAppCursor(Cursor p_cursor);
MxBool FUN_1003ef60();
MxBool CanExit();
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId);
MxS32 UpdateLightPosition(MxS32 p_increase);
void SetLightPosition(MxS32 p_index);
LegoNamedTexture* ReadNamedTexture(LegoStorage* p_storage);
void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name);
void WriteNamedTexture(LegoStorage* p_storage, LegoNamedTexture* p_namedTexture);
void FUN_1003f930(LegoNamedTexture* p_namedTexture);
void LoadFromNamedTexture(LegoNamedTexture* p_namedTexture);
// FUNCTION: BETA10 0x100260a0
inline void StartIsleAction(IsleScript::Script p_objectId)

View File

@ -52,7 +52,7 @@ void Bike::Exit()
// FUNCTION: LEGO1 0x100769a0
MxLong Bike::HandleClick()
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
FUN_10015820(TRUE, 0);

View File

@ -80,7 +80,7 @@ MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x100151d0
MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (state->GetUnknown18() != 8) {
@ -104,7 +104,7 @@ MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x10015270
MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
if (act1State->GetUnknown18() != 10) {
@ -128,7 +128,7 @@ MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x10015310
MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (state->GetUnknown18() != 10) {
@ -152,7 +152,7 @@ MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x100153b0
MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
state->SetUnknown18(0);
@ -173,7 +173,7 @@ MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x10015450
MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
state->SetUnknown18(0);
@ -195,7 +195,7 @@ MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: BETA10 0x100256e8
MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
PlayCamAnim(UserActor(), FALSE, 18, TRUE);
}

View File

@ -88,7 +88,7 @@ void DuneBuggy::Exit()
// FUNCTION: LEGO1 0x10068060
MxLong DuneBuggy::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -121,7 +121,7 @@ void Helicopter::Exit()
// FUNCTION: BETA10 0x1002a3db
MxLong Helicopter::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -153,7 +153,7 @@ void IslePathActor::Exit()
FUN_1001b660();
FUN_10010c30();
FUN_1003eda0();
ResetViewVelocity();
}
// GLOBAL: LEGO1 0x10102b28
@ -598,7 +598,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8
}
if (m_cameraFlag) {
FUN_1003eda0();
ResetViewVelocity();
}
if (p_flags & c_playMusic && g_spawnLocations[i].m_music != JukeboxScript::c_noneJukebox) {
@ -632,7 +632,7 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar
m_roi->SetLocal2World(p_transform);
if (m_cameraFlag) {
FUN_1003eda0();
ResetViewVelocity();
FUN_10010c30();
}
}

View File

@ -81,7 +81,7 @@ void Jetski::Exit()
MxLong Jetski::HandleClick()
{
#ifndef BETA10
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -36,7 +36,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param)
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -84,7 +84,7 @@ void Motocycle::Exit()
// FUNCTION: LEGO1 0x10035c50
MxLong Motocycle::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -69,7 +69,7 @@ void Pizzeria::CreateState()
// FUNCTION: BETA10 0x100efc91
MxLong Pizzeria::HandleClick()
{
if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) {
if (CanExit() && m_pizzaMissionState->m_unk0x0c == 0) {
if (UserActor()->GetActorId() != GameState()->GetActorId()) {
if (!UserActor()->IsA("SkateBoard")) {
((IslePathActor*) UserActor())->Exit();

View File

@ -40,7 +40,7 @@ MxResult RaceCar::Create(MxDSAction& p_dsAction)
// FUNCTION: LEGO1 0x100284d0
MxLong RaceCar::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -75,7 +75,7 @@ MxLong SkateBoard::HandleClick()
{
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (!FUN_1003ef60() && state->m_unk0x018 != 3) {
if (!CanExit() && state->m_unk0x018 != 3) {
return 1;
}

View File

@ -371,7 +371,7 @@ void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y)
pfVar3[0] = p_x;
pfVar3[1] = p_y;
if (FUN_1003ded0(pfVar3, local30, local84)) {
if (CalculateRayOriginDirection(pfVar3, local30, local84)) {
MxFloat local18[3];
MxFloat local8c[2];
@ -421,7 +421,7 @@ void LegoCarBuild::VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3])
MxFloat local20[3];
MxFloat local14[3];
FUN_1003ded0(p_param1, local14, local20);
CalculateRayOriginDirection(p_param1, local14, local20);
fVar1 = (m_unk0x2a4[2] - local20[2]) / local14[2];
p_param2[0] = (fVar1 * local14[0] + local20[0]) - m_unk0x2a4[0];
@ -437,7 +437,7 @@ void LegoCarBuild::VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3])
MxFloat local18[3];
MxFloat localc[3];
FUN_1003ded0(p_param1, local18, localc);
CalculateRayOriginDirection(p_param1, local18, localc);
p_param2[2] = m_unk0x2a4[2] +
(m_unk0x2bc[2] - m_unk0x2a4[2]) * ((p_param1[1] - m_unk0x290[1]) / (m_unk0x298[1] - m_unk0x290[1]));
@ -453,7 +453,7 @@ void LegoCarBuild::VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3])
{
MxFloat local18[3];
MxFloat localc[3];
FUN_1003ded0(p_param1, local18, localc);
CalculateRayOriginDirection(p_param1, local18, localc);
MxFloat fVar1 = (m_unk0x2bc[1] - localc[1]) / local18[1];
p_param2[0] = fVar1 * local18[0] - m_unk0x2a4[0] + localc[0];
@ -1249,7 +1249,7 @@ undefined4 LegoCarBuild::FUN_10024c20(MxNotificationParam* p_param)
// FUNCTION: LEGO1 0x10024ef0
void LegoCarBuild::FUN_10024ef0()
{
FUN_1003eda0();
ResetViewVelocity();
m_buildState->m_animationState = LegoVehicleBuildState::e_cutscene;
FUN_10025720(FUN_10025d70());
m_buildState->m_unk0x4c += 1;

View File

@ -99,29 +99,29 @@ MxBool SpheresIntersect(const BoundingSphere& p_sphere1, const BoundingSphere& p
// FUNCTION: LEGO1 0x1003ded0
// FUNCTION: BETA10 0x100d3802
MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3])
MxBool CalculateRayOriginDirection(MxFloat p_coordinates[2], MxFloat p_direction[3], MxFloat p_origin[3])
{
MxFloat local1c[4];
MxFloat local10[3];
MxFloat screenPoint[4];
MxFloat farPoint[3];
Tgl::View* view = VideoManager()->Get3DManager()->GetLego3DView()->GetView();
local1c[0] = p_param1[0];
local1c[1] = p_param1[1];
local1c[2] = 1.0f;
local1c[3] = 1.0f;
screenPoint[0] = p_coordinates[0];
screenPoint[1] = p_coordinates[1];
screenPoint[2] = 1.0f;
screenPoint[3] = 1.0f;
view->TransformScreenToWorld(local1c, p_param3);
view->TransformScreenToWorld(screenPoint, p_origin);
local1c[0] *= 2.0;
local1c[1] *= 2.0;
local1c[3] = 2.0;
screenPoint[0] *= 2.0;
screenPoint[1] *= 2.0;
screenPoint[3] = 2.0;
view->TransformScreenToWorld(local1c, local10);
view->TransformScreenToWorld(screenPoint, farPoint);
p_param2[0] = local10[0] - p_param3[0];
p_param2[1] = local10[1] - p_param3[1];
p_param2[2] = local10[2] - p_param3[2];
p_direction[0] = farPoint[0] - p_origin[0];
p_direction[1] = farPoint[1] - p_origin[1];
p_direction[2] = farPoint[2] - p_origin[2];
return TRUE;
}
@ -173,7 +173,7 @@ LegoTreeNode* GetTreeNode(LegoTreeNode* p_node, MxU32 p_index)
// FUNCTION: LEGO1 0x1003e050
// FUNCTION: BETA10 0x100d3abc
void FUN_1003e050(LegoAnimPresenter* p_presenter)
void CalculateViewFromAnimation(LegoAnimPresenter* p_presenter)
{
MxMatrix viewMatrix;
LegoTreeNode* rootNode = p_presenter->GetAnimation()->GetRoot();
@ -181,7 +181,7 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
LegoAnimNodeData* targetData = NULL;
MxS16 nodesCount = CountTotalTreeNodes(rootNode);
MxFloat cam;
MxFloat fov;
for (MxS16 i = 0; i < nodesCount; i++) {
if (camData && targetData) {
break;
@ -191,7 +191,7 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
if (!strnicmp(data->GetName(), "CAM", strlen("CAM"))) {
camData = data;
cam = atof(&data->GetName()[strlen(data->GetName()) - 2]);
fov = atof(&data->GetName()[strlen(data->GetName()) - 2]);
}
else if (!strcmpi(data->GetName(), "TARGET")) {
targetData = data;
@ -220,8 +220,8 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
roi->WrappedSetLocal2WorldWithWorldDataUpdate(viewMatrix);
view->Moved(*roi);
FUN_1003eda0();
video->Get3DManager()->SetFrustrum(cam, 0.1, 250.0);
ResetViewVelocity();
video->Get3DManager()->SetFrustrum(fov, 0.1, 250.0);
}
// FUNCTION: LEGO1 0x1003e300
@ -473,7 +473,7 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo
// FUNCTION: LEGO1 0x1003eda0
// FUNCTION: BETA10 0x100d4bf4
void FUN_1003eda0()
void ResetViewVelocity()
{
Mx3DPointFloat vec;
vec.Clear();
@ -569,7 +569,7 @@ void SetAppCursor(Cursor p_cursor)
}
// FUNCTION: LEGO1 0x1003ef60
MxBool FUN_1003ef60()
MxBool CanExit()
{
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
@ -765,7 +765,7 @@ void WriteNamedTexture(LegoStorage* p_storage, LegoNamedTexture* p_namedTexture)
}
// FUNCTION: LEGO1 0x1003f930
void FUN_1003f930(LegoNamedTexture* p_namedTexture)
void LoadFromNamedTexture(LegoNamedTexture* p_namedTexture)
{
LegoTextureInfo* textureInfo = TextureContainer()->Get(p_namedTexture->GetName()->GetData());

View File

@ -424,7 +424,7 @@ void LegoWorld::Add(MxCore* p_object)
#ifndef BETA10
if (p_object->IsA("LegoAnimPresenter")) {
if (!strcmpi(((LegoAnimPresenter*) p_object)->GetAction()->GetObjectName(), "ConfigAnimation")) {
FUN_1003e050((LegoAnimPresenter*) p_object);
CalculateViewFromAnimation((LegoAnimPresenter*) p_object);
((LegoAnimPresenter*) p_object)
->GetAction()
->SetDuration(((LegoAnimPresenter*) p_object)->GetAnimation()->GetDuration());

View File

@ -1653,19 +1653,19 @@ void Act1State::PlaceActors()
m_helicopter = NULL;
if (m_helicopterWindshield != NULL) {
FUN_1003f930(m_helicopterWindshield);
LoadFromNamedTexture(m_helicopterWindshield);
delete m_helicopterWindshield;
m_helicopterWindshield = NULL;
}
if (m_helicopterJetLeft != NULL) {
FUN_1003f930(m_helicopterJetLeft);
LoadFromNamedTexture(m_helicopterJetLeft);
delete m_helicopterJetLeft;
m_helicopterJetLeft = NULL;
}
if (m_helicopterJetRight != NULL) {
FUN_1003f930(m_helicopterJetRight);
LoadFromNamedTexture(m_helicopterJetRight);
delete m_helicopterJetRight;
m_helicopterJetRight = NULL;
}
@ -1689,13 +1689,13 @@ void Act1State::PlaceActors()
m_jetski = NULL;
if (m_jetskiFront != NULL) {
FUN_1003f930(m_jetskiFront);
LoadFromNamedTexture(m_jetskiFront);
delete m_jetskiFront;
m_jetskiFront = NULL;
}
if (m_jetskiWindshield != NULL) {
FUN_1003f930(m_jetskiWindshield);
LoadFromNamedTexture(m_jetskiWindshield);
delete m_jetskiWindshield;
m_jetskiWindshield = NULL;
}
@ -1723,7 +1723,7 @@ void Act1State::PlaceActors()
m_dunebuggy = NULL;
if (m_dunebuggyFront != NULL) {
FUN_1003f930(m_dunebuggyFront);
LoadFromNamedTexture(m_dunebuggyFront);
delete m_dunebuggyFront;
m_dunebuggyFront = NULL;
}
@ -1751,19 +1751,19 @@ void Act1State::PlaceActors()
m_racecar = NULL;
if (m_racecarFront != NULL) {
FUN_1003f930(m_racecarFront);
LoadFromNamedTexture(m_racecarFront);
delete m_racecarFront;
m_racecarFront = NULL;
}
if (m_racecarBack != NULL) {
FUN_1003f930(m_racecarBack);
LoadFromNamedTexture(m_racecarBack);
delete m_racecarBack;
m_racecarBack = NULL;
}
if (m_racecarTail != NULL) {
FUN_1003f930(m_racecarTail);
LoadFromNamedTexture(m_racecarTail);
delete m_racecarTail;
m_racecarTail = NULL;
}