Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match Jetski::HandleClick #1380

Merged
merged 4 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/include/jetski.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Jetski : public IslePathActor {

void ActivateSceneActions();

MxS16 GetUnknown0x160() { return m_unk0x160; }
MxS16 GetUnknown0x160() { return m_jetskiDashboardStreamId; }

// SYNTHETIC: LEGO1 0x1007e5c0
// Jetski::`scalar deleting destructor'

private:
void RemoveFromWorld();

MxS16 m_unk0x160; // 0x160
MxS16 m_jetskiDashboardStreamId; // 0x160
};

#endif // JETSKI_H
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/include/legoactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class LegoActor : public LegoEntity {
virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c

// FUNCTION: LEGO1 0x10002d00
// FUNCTION: BETA10 0x1000f4a0
virtual MxU8 GetActorId() { return m_actorId; } // vtable+0x60

// FUNCTION: LEGO1 0x10002d10
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/include/legogamestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class LegoGameState {
void SwitchArea(Area p_area);
void Init();

// FUNCTION: BETA10 0x10083ff5
MxU8 GetActorId() { return m_actorId; }

// FUNCTION: BETA10 0x1004a2d0
Expand Down
37 changes: 20 additions & 17 deletions LEGO1/lego/legoomni/src/actors/dunebuggy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,30 @@ MxLong DuneBuggy::HandlePathStruct(LegoPathStructNotificationParam& p_param)
}

// FUNCTION: LEGO1 0x10068290
// FUNCTION: BETA10 0x1002765d
MxS32 DuneBuggy::GetColorOffset(const char* p_variable)
{
MxS32 offset = 1;
const char* colorName = VariableTable()->GetVariable(p_variable);
const char* color = VariableTable()->GetVariable(p_variable);
assert(color);

if (strcmpi(colorName, "lego green")) {
if (!strcmpi(colorName, "lego red")) {
offset = 2;
}
else if (!strcmpi(colorName, "lego yellow")) {
offset = 3;
}
else if (!strcmpi(colorName, "lego black")) {
offset = 4;
}
else if (!strcmpi(colorName, "lego blue")) {
offset = 5;
}
else if (!strcmpi(colorName, "lego white")) {
offset = 6;
}
if (!strcmpi(color, "lego green")) {
offset = 1;
}
else if (!strcmpi(color, "lego red")) {
offset = 2;
}
else if (!strcmpi(color, "lego yellow")) {
offset = 3;
}
else if (!strcmpi(color, "lego black")) {
offset = 4;
}
else if (!strcmpi(color, "lego blue")) {
offset = 5;
}
else if (!strcmpi(color, "lego white")) {
offset = 6;
}

return offset;
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/src/actors/islepathactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ MxLong IslePathActor::Notify(MxParam& p_param)
}

// FUNCTION: LEGO1 0x1001a350
// FUNCTION: BETA10 0x100365ad
void IslePathActor::Enter()
{
m_roi->SetVisibility(FALSE);
Expand Down
29 changes: 24 additions & 5 deletions LEGO1/lego/legoomni/src/actors/jetski.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

DECOMP_SIZE_ASSERT(Jetski, 0x164)

// These two have been changed between BETA10 and LEGO1
// GLOBAL: LEGO1 0x100f7ab8
// STRING: LEGO1 0x100f3ce0
// GLOBAL: BETA10 0x101e0be4
const char* g_varJSFRNTY5 = "c_jsfrnty5";

// GLOBAL: LEGO1 0x100f7abc
// STRING: LEGO1 0x100f3ca4
// GLOBAL: BETA10 0x101e0be0
const char* g_varJSWNSHY5 = "c_jswnshy5";

// FUNCTION: LEGO1 0x1007e3b0
Expand Down Expand Up @@ -77,6 +80,7 @@ void Jetski::Exit()
// FUNCTION: BETA10 0x10037621
MxLong Jetski::HandleClick()
{
#ifndef BETA10
if (!FUN_1003ef60()) {
return 1;
}
Expand All @@ -89,26 +93,41 @@ MxLong Jetski::HandleClick()
if (GameState()->GetActorId() != UserActor()->GetActorId()) {
((IslePathActor*) UserActor())->Exit();
}
#endif

// TODO: Match
m_unk0x160 = ((DuneBuggy::GetColorOffset(g_varJSWNSHY5) * 5 + 15) * 2);
m_unk0x160 += DuneBuggy::GetColorOffset(g_varJSFRNTY5);
// Selects the windshield from `IsleScript::c_JetskiDashboard11_Bitmap` (=41)
// to `IsleScript::c_JetskiDashboard66_Bitmap` based on the user's color selection
MxS32 colorOffset = DuneBuggy::GetColorOffset(g_varJSWNSHY5);
m_jetskiDashboardStreamId = 10 * (colorOffset + 3);
colorOffset = DuneBuggy::GetColorOffset(g_varJSFRNTY5);
m_jetskiDashboardStreamId += colorOffset;

InvokeAction(Extra::ActionType::e_start, *g_isleScript, m_unk0x160, NULL);
InvokeAction(Extra::ActionType::e_start, *g_isleScript, m_jetskiDashboardStreamId, NULL);
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_JetskiDashboard, NULL);

#ifdef BETA10
if (UserActor()->GetActorId() != GameState()->GetActorId()) {
((IslePathActor*) UserActor())->Exit();
}
Enter();
ControlManager()->Register(this);
PlayCamAnim(this, FALSE, 0x44, TRUE);
#else
GetCurrentAction().SetObjectId(-1);

AnimationManager()->FUN_1005f6d0(FALSE);
AnimationManager()->FUN_10064670(NULL);
Enter();
ControlManager()->Register(this);
#endif

return 1;
}

// FUNCTION: LEGO1 0x1007e880
void Jetski::RemoveFromWorld()
{
RemoveFromCurrentWorld(*g_isleScript, m_unk0x160);
RemoveFromCurrentWorld(*g_isleScript, m_jetskiDashboardStreamId);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiArms_Ctl);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiInfo_Ctl);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiSpeedMeter);
Expand Down