From ee78eae116b86b0b7ff71e256063a9b06677d484 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:20:39 +0800 Subject: [PATCH] [saco] Implement/match `CGame::MakeRaceCheckpoint()` --- saco/game/game.cpp | 14 ++++++++++++++ saco/game/game.h | 7 ++++++- saco/game/scripting.h | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/saco/game/game.cpp b/saco/game/game.cpp index 57097fc..9b5f8a2 100644 --- a/saco/game/game.cpp +++ b/saco/game/game.cpp @@ -727,6 +727,20 @@ void CGame::SetCheckpointInformation(VECTOR *pos, VECTOR *extent) //----------------------------------------------------------- +void CGame::MakeRaceCheckpoint() +{ + DisableRaceCheckpoint(); + + ScriptCommand(&create_racing_checkpoint, (int)m_byteRaceType, + m_vecRaceCheckpointPos.X, m_vecRaceCheckpointPos.Y, m_vecRaceCheckpointPos.Z, + m_vecRaceCheckpointNext.X, m_vecRaceCheckpointNext.Y, m_vecRaceCheckpointNext.Z, + m_fRaceCheckpointSize, &m_dwRaceCheckpointHandle); + + m_bRaceCheckpointsEnabled = true; +} + +//----------------------------------------------------------- + void CGame::DisableRaceCheckpoint() { if (m_dwRaceCheckpointHandle) diff --git a/saco/game/game.h b/saco/game/game.h index 6d9a242..acaa9fa 100644 --- a/saco/game/game.h +++ b/saco/game/game.h @@ -20,7 +20,11 @@ private: CAudio *m_pGameAudio; CCamera *m_pGameCamera; CPlayerPed *m_pGamePlayer; - char gapC[29]; + + VECTOR m_vecRaceCheckpointPos; + VECTOR m_vecRaceCheckpointNext; + float m_fRaceCheckpointSize; + BYTE m_byteRaceType; BOOL m_bRaceCheckpointsEnabled; char gap2D[4]; DWORD m_dwRaceCheckpointHandle; @@ -81,6 +85,7 @@ public: void SetCheckpointInformation(VECTOR *pos, VECTOR *extent); + void MakeRaceCheckpoint(); void DisableRaceCheckpoint(); DWORD CreateRadarMarkerIcon(int iMarkerType, float fX, float fY, float fZ, DWORD dwColor, int iStyle); diff --git a/saco/game/scripting.h b/saco/game/scripting.h index 3be99b9..042513e 100644 --- a/saco/game/scripting.h +++ b/saco/game/scripting.h @@ -62,6 +62,10 @@ const SCRIPT_COMMAND has_car_sunk = { 0x02bf, "i" }; // CarID const SCRIPT_COMMAND is_car_wrecked = { 0x0119, "i" }; // CarID const SCRIPT_COMMAND get_ground_z = { 0x02ce, "fffv" }; // x, y, z, var_ground_z +const SCRIPT_COMMAND create_racing_checkpoint = { 0x06d5, "ifffffffv"}; // type, x, y, z, nx, ny. nz, size, $id (n=next checkpoint) +/* 0 = Street Checkpoint with arrow to the next checkpoint + 1 and 2 = Street Checkpoint + 3 and 4 = Flight Checkpoint (circle) */ const SCRIPT_COMMAND destroy_racing_checkpoint = { 0x06d6, "i" }; const SCRIPT_COMMAND toggle_player_controllable = { 0x01B4, "ii" };