mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-02 12:01:15 +00:00
Some checks are pending
CI / clang-format (push) Waiting to run
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Waiting to run
CI / C++ (push) Waiting to run
CI / Release (push) Blocked by required conditions
Docker / Publish web port (push) Waiting to run
194 lines
5.0 KiB
C++
194 lines
5.0 KiB
C++
#include "jetski.h"
|
|
|
|
#include "dunebuggy.h"
|
|
#include "isle.h"
|
|
#include "isle_actions.h"
|
|
#include "jukebox_actions.h"
|
|
#include "legoanimationmanager.h"
|
|
#include "legocontrolmanager.h"
|
|
#include "legonavcontroller.h"
|
|
#include "legoutils.h"
|
|
#include "legovariables.h"
|
|
#include "legoworld.h"
|
|
#include "misc.h"
|
|
#include "mxmisc.h"
|
|
#include "mxtransitionmanager.h"
|
|
#include "mxvariabletable.h"
|
|
#include "scripts.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
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
|
|
Jetski::Jetski()
|
|
{
|
|
m_maxLinearVel = 25.0;
|
|
m_linearRotationRatio = 2.0;
|
|
m_canRotate = 1;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x1007e630
|
|
MxResult Jetski::Create(MxDSAction& p_dsAction)
|
|
{
|
|
MxResult result = IslePathActor::Create(p_dsAction);
|
|
m_world = CurrentWorld();
|
|
|
|
if (m_world) {
|
|
m_world->Add(this);
|
|
}
|
|
|
|
VariableTable()->SetVariable(g_varJETFUEL, "0.8");
|
|
return result;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x1007e680
|
|
void Jetski::Animate(float p_time)
|
|
{
|
|
IslePathActor::Animate(p_time);
|
|
|
|
char buf[200];
|
|
float speed = abs(m_worldSpeed);
|
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
|
|
|
sprintf(buf, "%g", speed / maxLinearVel);
|
|
VariableTable()->SetVariable(g_varJETSPEED, buf);
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x1007e6f0
|
|
void Jetski::Exit()
|
|
{
|
|
SpawnPlayer(LegoGameState::e_jetskiSpawn, FALSE, c_spawnBit1 | c_playMusic | c_spawnBit3);
|
|
IslePathActor::Exit();
|
|
GameState()->m_currentArea = LegoGameState::e_jetski;
|
|
RemoveFromWorld();
|
|
EnableAnimations(TRUE);
|
|
SetIsWorldActive(TRUE);
|
|
ControlManager()->Unregister(this);
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x1007e750
|
|
// FUNCTION: BETA10 0x10037621
|
|
MxLong Jetski::HandleClick()
|
|
{
|
|
#ifndef BETA10
|
|
if (!CanExit()) {
|
|
return 1;
|
|
}
|
|
|
|
Disable(TRUE, 0);
|
|
|
|
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_jetski);
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE);
|
|
|
|
if (GameState()->GetActorId() != UserActor()->GetActorId()) {
|
|
((IslePathActor*) UserActor())->Exit();
|
|
}
|
|
#endif
|
|
|
|
// 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_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_jetskiDashboardStreamId);
|
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiArms_Ctl);
|
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiInfo_Ctl);
|
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiSpeedMeter);
|
|
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_JetskiFuelMeter);
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x1007e8e0
|
|
MxLong Jetski::HandleControl(LegoControlManagerNotificationParam& p_param)
|
|
{
|
|
if (p_param.m_enabledChild == 1 && CurrentWorld()->IsA("Isle")) {
|
|
switch (p_param.m_clickedObjectId) {
|
|
case IsleScript::c_JetskiArms_Ctl:
|
|
Exit();
|
|
((IslePathActor*) UserActor())
|
|
->SpawnPlayer(LegoGameState::e_jetraceExterior, TRUE, c_spawnBit1 | c_playMusic | c_spawnBit3);
|
|
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
|
|
return 1;
|
|
case IsleScript::c_JetskiInfo_Ctl:
|
|
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
|
Exit();
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x1007e990
|
|
void Jetski::ActivateSceneActions()
|
|
{
|
|
PlayMusic(JukeboxScript::c_JetskiRace_Music);
|
|
|
|
Act1State* act1state = (Act1State*) GameState()->GetState("Act1State");
|
|
if (!act1state->m_state) {
|
|
if (act1state->m_playedExitExplanation) {
|
|
PlayCamAnim(this, FALSE, 68, TRUE);
|
|
}
|
|
else {
|
|
act1state->m_playedExitExplanation = TRUE;
|
|
|
|
LegoPathActor* user = UserActor();
|
|
if (user != NULL) {
|
|
MxMatrix mat(user->GetROI()->GetLocal2World());
|
|
mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.6, mat[2][2] * 2.5);
|
|
|
|
AnimationManager()->FUN_10060dc0(
|
|
IsleScript::c_sjs007in_RunAnim,
|
|
&mat,
|
|
TRUE,
|
|
LegoAnimationManager::e_unk0,
|
|
NULL,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|