summaryrefslogtreecommitdiffstats
path: root/src/control/Script.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/Script.h')
-rw-r--r--src/control/Script.h68
1 files changed, 32 insertions, 36 deletions
diff --git a/src/control/Script.h b/src/control/Script.h
index 2690b4ff..f35d0261 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -1,5 +1,6 @@
#pragma once
#include "common.h"
+#include "Font.h"
#include "Ped.h"
#include "PedType.h"
#include "Text.h"
@@ -20,26 +21,31 @@ extern int32 ScriptParams[32];
void FlushLog();
#define script_assert(_Expression) FlushLog(); assert(_Expression);
-#define PICKUP_PLACEMENT_OFFSET 0.5f
-#define PED_FIND_Z_OFFSET 5.0f
-#define COP_PED_FIND_Z_OFFSET 10.0f
+#define PICKUP_PLACEMENT_OFFSET (0.5f)
+#define PED_FIND_Z_OFFSET (5.0f)
+#define COP_PED_FIND_Z_OFFSET (10.0f)
-#define SPHERE_MARKER_R 252
-#define SPHERE_MARKER_G 138
-#define SPHERE_MARKER_B 242
-#define SPHERE_MARKER_A 228
+#define UPSIDEDOWN_UP_THRESHOLD (-0.97f)
+#define UPSIDEDOWN_MOVE_SPEED_THRESHOLD (0.01f)
+#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
+#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
+
+#define SPHERE_MARKER_R (252)
+#define SPHERE_MARKER_G (138)
+#define SPHERE_MARKER_B (242)
+#define SPHERE_MARKER_A (228)
#define SPHERE_MARKER_PULSE_PERIOD 2048
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
-#define METERS_IN_FOOT 0.3048f
-#define FEET_IN_METER 3.28084f
+#define METERS_IN_FOOT (0.3048f)
+#define FEET_IN_METER (3.28084f)
#else
-#define METERS_IN_FOOT 0.3f
-#define FEET_IN_METER 3.33f
+#define METERS_IN_FOOT (0.3f)
+#define FEET_IN_METER (3.33f)
#endif
-#define KEY_LENGTH_IN_SCRIPT 8
+#define KEY_LENGTH_IN_SCRIPT (8)
//#define GTA_SCRIPT_COLLECTIVE
@@ -94,12 +100,12 @@ struct intro_text_line
m_bCentered = false;
m_bBackground = false;
m_bBackgroundOnly = false;
- m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
- m_fCenterSize = 640.0f; /* --||-- */
+ m_fWrapX = 182.0f;
+ m_fCenterSize = DEFAULT_SCREEN_WIDTH;
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
m_bTextProportional = true;
m_bTextBeforeFade = false;
- m_nFont = 2; /* enum? */
+ m_nFont = FONT_STANDARD;
m_fAtX = 0.0f;
m_fAtY = 0.0f;
memset(&m_Text, 0, sizeof(m_Text));
@@ -148,10 +154,10 @@ enum {
class CMissionCleanup
{
+public:
cleanup_entity_struct m_sEntities[MAX_CLEANUP];
uint8 m_nCount;
-public:
CMissionCleanup();
void Init();
@@ -160,10 +166,9 @@ public:
void RemoveEntityFromList(int32, uint8);
void Process();
void CheckIfCollisionHasLoadedForMissionObjects();
- CPhysical* DoesThisEntityWaitForCollision(int i);
};
-struct CUpsideDownCarCheckEntry
+struct upsidedown_car_data
{
int32 m_nVehicleIndex;
uint32 m_nUpsideDownTimer;
@@ -171,11 +176,12 @@ struct CUpsideDownCarCheckEntry
class CUpsideDownCarCheck
{
- CUpsideDownCarCheckEntry m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
+ upsidedown_car_data m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
public:
void Init();
bool IsCarUpsideDown(int32);
+ bool IsCarUpsideDown(CVehicle*);
void UpdateTimers();
bool AreAnyCarsUpsideDown();
void AddCarToCheck(int32);
@@ -193,7 +199,7 @@ struct stuck_car_data
bool m_bStuck;
stuck_car_data() { }
- inline void Reset();
+ void Reset();
};
class CStuckCarCheck
@@ -259,7 +265,7 @@ enum {
enum {
MAX_NUM_SCRIPTS = 128,
- MAX_NUM_INTRO_TEXT_LINES = 2,
+ MAX_NUM_INTRO_TEXT_LINES = 48,
MAX_NUM_INTRO_RECTANGLES = 16,
MAX_NUM_SCRIPT_SRPITES = 16,
MAX_NUM_SCRIPT_SPHERES = 16,
@@ -273,6 +279,7 @@ enum {
class CTheScripts
{
+public:
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
@@ -286,7 +293,7 @@ class CTheScripts
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
static bool DbgFlag;
static uint32 OnAMissionFlag;
- static CMissionCleanup MissionCleanup;
+ static CMissionCleanup MissionCleanUp;
static CStuckCarCheck StuckCars;
static CUpsideDownCarCheck UpsideDownCars;
static int32 StoreVehicleIndex;
@@ -321,11 +328,10 @@ class CTheScripts
static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
#endif
-public:
static bool bPlayerIsInTheStatium;
static uint8 RiotIntensity;
static bool bPlayerHasMetDebbieHarry;
-public:
+
static void Init();
static void Process();
@@ -379,8 +385,6 @@ public:
return Read4BytesFromScript(&tmp);
}
-private:
-
static CRunningScript* StartNewScript(uint32);
static void CleanUpThisVehicle(CVehicle*);
@@ -438,18 +442,11 @@ public:
static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif
- friend class CRunningScript;
- friend class CHud;
- friend void CMissionCleanup::Process();
- friend class CColStore;
-#ifdef FIX_BUGS
- friend void RetryMission(int, int);
-#endif
};
enum {
- MAX_STACK_DEPTH = 6, // 4 PS2
+ MAX_STACK_DEPTH = 6,
NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2
};
@@ -476,6 +473,7 @@ class CRunningScript
ORS_8
};
+public:
CRunningScript* next;
CRunningScript* prev;
char m_abScriptName[8];
@@ -514,7 +512,6 @@ public:
static const uint32 nSaveStructSize;
-private:
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
@@ -582,7 +579,6 @@ private:
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
- friend class CTheScripts;
};
#ifdef USE_DEBUG_SCRIPT_LOADER