Skip to content

Commit 012ab83

Browse files
committed
Changes to Fake Teleport and Fake Fake Teleport:
- Added Blimp Strats, Make Random Stunt Jump and Teleport To Random Store to fake teleports - Tidy up the code for fake teleports - Fix CurrentEffect::OverrideEffectNameFromId
1 parent 8cdd7fc commit 012ab83

12 files changed

+254
-144
lines changed

ChaosMod/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.13)
33
project(ChaosMod)
44

55
file(GLOB ROOT_SRC ${PROJECT_SOURCE_DIR}/*.cpp)
6-
file(GLOB_RECURSE SRC ${PROJECT_SOURCE_DIR}/Components/*.cpp ${PROJECT_SOURCE_DIR}/Effects/*.cpp
6+
file(GLOB_RECURSE SRC ${PROJECT_SOURCE_DIR}/Components/*.cpp ${PROJECT_SOURCE_DIR}/Effects/*.cpp ${PROJECT_SOURCE_DIR}/Effects/*.h
77
${PROJECT_SOURCE_DIR}/Memory/*.cpp ${PROJECT_SOURCE_DIR}/Util/*.cpp)
88
file(GLOB PATTERNS_SRC ${PROJECT_SOURCE_DIR}/../vendor/Patterns/Patterns.cpp)
99
add_library(ChaosMod MODULE ${ROOT_SRC} ${SRC} ${PATTERNS_SRC} ChaosMod.rc)

ChaosMod/Components/EffectDispatchTimer.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@ void EffectDispatchTimer::ResetFakeTimerPercentage()
159159
m_FakeTimerPercentage = 0.f;
160160
}
161161

162+
bool EffectDispatchTimer::IsTimerPaused() const
163+
{
164+
return m_PauseTimer;
165+
}
166+
167+
void EffectDispatchTimer::SetTimerPaused(bool pause)
168+
{
169+
m_PauseTimer = pause;
170+
}
171+
172+
bool EffectDispatchTimer::IsUsingDistanceBasedDispatch() const
173+
{
174+
return m_DistanceChaosState.EnableDistanceBasedEffectDispatch;
175+
}
176+
162177
void EffectDispatchTimer::OnRun()
163178
{
164179
auto curTime = GetTickCount64();

ChaosMod/Components/EffectDispatchTimer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@ class EffectDispatchTimer : public Component
4949
void SetFakeTimerPercentage(float percentage);
5050
void ResetFakeTimerPercentage();
5151

52+
bool IsTimerPaused() const;
53+
void SetTimerPaused(bool pause);
54+
55+
bool IsUsingDistanceBasedDispatch() const;
56+
5257
virtual void OnRun() override;
5358
};

ChaosMod/Components/EffectDispatcher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,15 @@ void EffectDispatcher::UpdateEffects(int deltaTime)
345345
if (!effectSharedData->OverrideEffectName.empty())
346346
{
347347
activeEffect.FakeName = effectSharedData->OverrideEffectName;
348-
effectSharedData->OverrideEffectId.clear();
348+
effectSharedData->OverrideEffectName.clear();
349349
}
350350

351351
if (!effectSharedData->OverrideEffectId.empty())
352352
{
353353
if (g_EnabledEffects.contains(effectSharedData->OverrideEffectId))
354354
{
355355
auto &fakeEffect = g_EnabledEffects.at(effectSharedData->OverrideEffectId);
356-
activeEffect.FakeName = !fakeEffect.HasCustomName() ? "" : fakeEffect.CustomName;
356+
activeEffect.FakeName = !fakeEffect.HasCustomName() ? fakeEffect.Name : fakeEffect.CustomName;
357357
}
358358
else
359359
{

ChaosMod/Effects/db/Player/PlayerBlimpStrats.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66

77
#include "Memory/Hooks/ScriptThreadRunHook.h"
88

9-
static void OnStart()
9+
#include "PlayerBlimpStrats.h"
10+
11+
void OnStartBlimpStrats(bool bHandleThreadBlock)
1012
{
11-
Hooks::EnableScriptThreadBlock();
13+
if (bHandleThreadBlock)
14+
Hooks::EnableScriptThreadBlock();
15+
1216
bool cutscenePlaying = IS_CUTSCENE_PLAYING();
1317

1418
Hash blimpHash = "blimp"_hash;
@@ -61,15 +65,22 @@ static void OnStart()
6165
SET_PED_AS_NO_LONGER_NEEDED(&pedDave);
6266
}
6367

64-
Hooks::DisableScriptThreadBlock();
68+
if (bHandleThreadBlock)
69+
Hooks::DisableScriptThreadBlock();
70+
6571
SET_VEHICLE_AS_NO_LONGER_NEEDED(&veh);
6672
}
6773

74+
static void OnStart()
75+
{
76+
OnStartBlimpStrats(true);
77+
}
78+
6879
// clang-format off
6980
REGISTER_EFFECT(OnStart, nullptr, nullptr, EffectInfo
7081
{
7182
.Name = "Blimp Strats",
7283
.Id = "player_blimp_strats",
7384
.EffectGroupType = EffectGroupType::Teleport
7485
}
75-
);
86+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void OnStartBlimpStrats(bool bHandleThreadBlock);

ChaosMod/Effects/db/Player/PlayerRandomStuntJump.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "Util/Player.h"
88
#include "Util/Vehicle.h"
99

10+
#include "PlayerRandomStuntJump.h"
11+
1012
struct Location
1113
{
1214
Vector3 coordinates;
@@ -47,7 +49,7 @@ CHAOS_VAR std::vector<Location> allPossibleJumps = {
4749
{ { -958.207, -2766.583, 13.693 }, 151.829, 45.f } // 30
4850
};
4951

50-
static void OnStart()
52+
void OnStartMakeRandomStuntJump()
5153
{
5254
Ped playerPed = PLAYER_PED_ID();
5355
Vehicle veh;
@@ -76,7 +78,7 @@ static void OnStart()
7678
}
7779

7880
// clang-format off
79-
REGISTER_EFFECT(OnStart, nullptr, nullptr, EffectInfo
81+
REGISTER_EFFECT(OnStartMakeRandomStuntJump, nullptr, nullptr, EffectInfo
8082
{
8183
.Name = "Make Random Stunt Jump",
8284
.Id = "player_tp_stunt",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void OnStartMakeRandomStuntJump();

0 commit comments

Comments
 (0)