summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioLogic.cpp7
-rw-r--r--src/audio/AudioManager.h6
-rw-r--r--src/audio/PoliceRadio.cpp1
-rw-r--r--src/audio/PoliceRadio.h2
-rw-r--r--src/audio/sampman.h1
-rw-r--r--src/audio/sampman_miles.cpp6
-rw-r--r--src/audio/sampman_oal.cpp35
-rw-r--r--src/collision/ColStore.cpp176
-rw-r--r--src/collision/ColStore.h17
-rw-r--r--src/collision/TempColModels.cpp1
-rw-r--r--src/collision/TempColModels.h2
-rw-r--r--src/control/Bridge.cpp20
-rw-r--r--src/control/Bridge.h1
-rw-r--r--src/control/Garages.h10
-rw-r--r--src/control/PathFind.cpp24
-rw-r--r--src/control/Remote.cpp3
-rw-r--r--src/control/Remote.h2
-rw-r--r--src/control/Script.cpp40
-rw-r--r--src/control/Script.h27
-rw-r--r--src/control/Script10.cpp5
-rw-r--r--src/control/Script3.cpp1
-rw-r--r--src/control/Script4.cpp4
-rw-r--r--src/control/Script7.cpp3
-rw-r--r--src/control/Script8.cpp31
-rw-r--r--src/control/Script9.cpp8
-rw-r--r--src/control/TrafficLights.cpp26
-rw-r--r--src/core/ControllerConfig.cpp97
-rw-r--r--src/core/ControllerConfig.h4
-rw-r--r--src/core/Frontend.cpp66
-rw-r--r--src/core/Frontend.h9
-rw-r--r--src/core/Game.cpp23
-rw-r--r--src/core/Lists.h2
-rw-r--r--src/core/MenuScreensCustom.cpp48
-rw-r--r--src/core/Pad.cpp11
-rw-r--r--src/core/PlayerInfo.h2
-rw-r--r--src/core/Streaming.cpp40
-rw-r--r--src/core/Streaming.h12
-rw-r--r--src/core/World.cpp68
-rw-r--r--src/core/World.h6
-rw-r--r--src/core/Zones.h4
-rw-r--r--src/core/common.h51
-rw-r--r--src/core/config.h2
-rw-r--r--src/core/main.h4
-rw-r--r--src/core/re3.cpp450
-rw-r--r--src/extras/custompipes.cpp2
-rw-r--r--src/extras/custompipes_d3d9.cpp2
-rw-r--r--src/extras/frontendoption.cpp6
-rw-r--r--src/extras/frontendoption.h6
-rw-r--r--src/extras/ini_parser.hpp19
-rw-r--r--src/extras/postfx.cpp3
-rw-r--r--src/extras/screendroplets.cpp2
-rw-r--r--src/fakerw/fake.cpp2
-rw-r--r--src/leeds/base/sList.h35
-rw-r--r--src/leeds/smallHeap.cpp20
-rw-r--r--src/leeds/smallHeap.h17
-rw-r--r--src/modelinfo/BaseModelInfo.h4
-rw-r--r--src/modelinfo/ModelIndices.cpp16
-rw-r--r--src/modelinfo/ModelIndices.h874
-rw-r--r--src/modelinfo/ModelInfo.h3
-rw-r--r--src/modelinfo/PedModelInfo.h1
-rw-r--r--src/peds/Ped.cpp1
-rw-r--r--src/peds/Ped.h2
-rw-r--r--src/render/Hud.cpp33
-rw-r--r--src/render/MBlur.cpp1
-rw-r--r--src/render/Renderer.cpp2
-rw-r--r--src/render/SpecialFX.cpp4
-rw-r--r--src/render/WaterCreatures.cpp3
-rw-r--r--src/render/WaterCreatures.h3
-rw-r--r--src/rw/RwHelper.cpp2
-rw-r--r--src/rw/TxdStore.cpp93
-rw-r--r--src/rw/TxdStore.h11
-rw-r--r--src/save/GenericGameStorage.cpp4
-rw-r--r--src/save/MemoryCard.cpp1
-rw-r--r--src/skel/glfw/glfw.cpp66
-rw-r--r--src/skel/win/win.cpp36
-rw-r--r--src/vehicles/Automobile.cpp1
-rw-r--r--src/vehicles/Bike.cpp1
-rw-r--r--src/vehicles/Bike.h1
-rw-r--r--src/vehicles/Boat.cpp1
-rw-r--r--src/vehicles/Cranes.cpp14
-rw-r--r--src/vehicles/Vehicle.h6
81 files changed, 2083 insertions, 573 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index c2050f59..36b9eb11 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -41,7 +41,7 @@
#include "WindModifiers.h"
#include "Fluff.h"
#include "Script.h"
-
+#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1;
@@ -9311,7 +9311,8 @@ cAudioManager::ProcessBridge()
void
cAudioManager::ProcessBridgeWarning()
{
- if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
+ // TODO: LCS
+/* if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 0;
@@ -9332,7 +9333,7 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
- }
+ }*/
}
void
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index b5e9b499..f715fb45 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -544,8 +544,8 @@ public:
#endif
};
-#ifdef AUDIO_MSS
-static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
-#endif
+//#ifdef AUDIO_MSS
+//static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
+//#endif
extern cAudioManager AudioManager;
diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp
index a2a765ed..edfb8a7c 100644
--- a/src/audio/PoliceRadio.cpp
+++ b/src/audio/PoliceRadio.cpp
@@ -13,6 +13,7 @@
#include "World.h"
#include "Zones.h"
#include "sampman.h"
+#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1;
diff --git a/src/audio/PoliceRadio.h b/src/audio/PoliceRadio.h
index e9a0fde0..d7c928e2 100644
--- a/src/audio/PoliceRadio.h
+++ b/src/audio/PoliceRadio.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Wanted.h"
+#include "Crime.h"
struct cAMCrime {
int32 type;
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index 7597eafb..697a7aa8 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -1,5 +1,4 @@
#pragma once
-#include "common.h"
#include "AudioSamples.h"
#define MAX_VOLUME 127
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 44be3b1c..d78c6d84 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1,8 +1,5 @@
-#include "common.h"
-
#ifdef AUDIO_MSS
-#include <windows.h>
-#include <shobjidl.h>
+#include <shlobj.h>
#include <shlguid.h>
#include <time.h>
@@ -11,6 +8,7 @@
#include "eax-util.h"
#include "mss.h"
+#include "common.h"
#include "sampman.h"
#include "AudioManager.h"
#include "MusicManager.h"
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index ec85fc43..7da871a5 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -1,17 +1,11 @@
//#define JUICY_OAL
#ifdef AUDIO_OAL
-#include "sampman.h"
-
#include <time.h>
#include "eax.h"
#include "eax-util.h"
-#define WITHWINDOWS
-#include "common.h"
-#include "crossplatform.h"
-
#ifdef _WIN32
#include <io.h>
#include <AL/al.h>
@@ -19,8 +13,24 @@
#include <AL/alext.h>
#include <AL/efx.h>
#include <AL/efx-presets.h>
+
+// for user MP3s
+#include <direct.h>
+#include <shlobj.h>
+#include <shlguid.h>
+#else
+#define _getcwd getcwd
+#endif
+
+#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
+#pragma comment( lib, "OpenAL32.lib" )
#endif
+#include "common.h"
+#include "crossplatform.h"
+
+#include "sampman.h"
+
#include "oal/oal_utils.h"
#include "oal/aldlist.h"
#include "oal/channel.h"
@@ -38,19 +48,6 @@
//TODO: max channels
//TODO: loop count
-#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
-#pragma comment( lib, "OpenAL32.lib" )
-#endif
-
-// for user MP3s
-#ifdef _WIN32
-#include <direct.h>
-#include <shobjidl.h>
-#include <shlguid.h>
-#else
-#define _getcwd getcwd
-#endif
-
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
diff --git a/src/collision/ColStore.cpp b/src/collision/ColStore.cpp
index f1e695fe..90a29bc2 100644
--- a/src/collision/ColStore.cpp
+++ b/src/collision/ColStore.cpp
@@ -1,5 +1,7 @@
#include "common.h"
+#include "main.h"
+#include "smallHeap.h"
#include "templates.h"
#include "General.h"
#include "ModelInfo.h"
@@ -8,6 +10,9 @@
#include "Script.h"
#include "Timer.h"
#include "Camera.h"
+#include "World.h"
+#include "Zones.h"
+#include "Garages.h"
#include "Frontend.h"
#include "Physical.h"
#include "ColStore.h"
@@ -15,16 +20,55 @@
#include "Pools.h"
CPool<ColDef,ColDef> *CColStore::ms_pColPool;
+bool CColStore::m_onlyBB;
#ifndef MASTER
bool bDispColInMem;
#endif
+// LCS: file done except unused:
+// CColStore::LoadCol(int,char const*)
+// CColStore::LoadAllBoundingBoxes(void)
+// CColStore::Write(base::cRelocatableChunkWriter &)
+
+const CVector&
+LevelPos(eLevelName level)
+{
+ static CVector pos[4] = {
+ CVector(1060.0f, -800.0f, 0.0f),
+ CVector(1060.0f, -800.0f, 0.0f),
+ CVector(350.0f, -624.0f, 0.0f),
+ CVector(-670.0f, -511.0f, 0.0f)
+ };
+ return pos[level];
+};
+
+static eLevelName
+PosLevel(const CVector &pos)
+{
+ static eLevelName lastPlayerLevel = LEVEL_INDUSTRIAL;
+ static eLevelName lastOtherLevel = LEVEL_INDUSTRIAL;
+
+ if(Abs(FindPlayerCoors().x - pos.x) < 5.0f &&
+ Abs(FindPlayerCoors().y - pos.y) < 5.0f &&
+ Abs(FindPlayerCoors().z - pos.z) < 5.0f){
+ if(CGame::currLevel != LEVEL_GENERIC)
+ lastPlayerLevel = CGame::currLevel;
+ return lastPlayerLevel;
+ }else{
+ eLevelName lvl = CTheZones::GetLevelFromPosition(&pos);
+ if(lvl != LEVEL_GENERIC)
+ lastOtherLevel = lvl;
+ return lastOtherLevel;
+ }
+}
+
void
CColStore::Initialise(void)
{
- if(ms_pColPool == nil)
+ if(ms_pColPool == nil){
ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles");
- AddColSlot("generic"); // slot 0. not streamed
+ AddColSlot("generic"); // slot 0. not streamed
+ }
#ifndef MASTER
VarConsole.Add("Display collision in memory", &bDispColInMem, true);
#endif
@@ -38,7 +82,9 @@ CColStore::Shutdown(void)
RemoveColSlot(i);
if(ms_pColPool)
delete ms_pColPool;
+#ifdef FIX_BUGS
ms_pColPool = nil;
+#endif
}
int
@@ -119,11 +165,34 @@ CColStore::LoadCol(int32 slot, uint8 *buffer, int32 bufsize)
return success;
}
+struct ColChunkEntry
+{
+ int32 modelId; // -1 marks end
+ CColModel *colModel;
+};
+
+void
+CColStore::LoadColCHK(int32 slot, void *data, void *chunk)
+{
+ ColDef *def = GetSlot(slot);
+ def->chunk = chunk;
+ CStreaming::RegisterPointer(&def->chunk, 1, true);
+ for(ColChunkEntry *entry = (ColChunkEntry*)data; entry->modelId != -1; entry++){
+ CBaseModelInfo *mi = CModelInfo::GetModelInfo(entry->modelId);
+ mi->SetColModel(entry->colModel, true); // we own this? can that work?
+ CStreaming::RegisterPointer(&mi->m_colModel, 1, true);
+ }
+ def->isLoaded = true;
+}
+
+CColModel nullCollision;
+
void
CColStore::RemoveCol(int32 slot)
{
int id;
- GetSlot(slot)->isLoaded = false;
+ ColDef *def = GetSlot(slot);
+ def->isLoaded = false;
for(id = 0; id < MODELINFOSIZE; id++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(id);
if(mi){
@@ -132,6 +201,23 @@ CColStore::RemoveCol(int32 slot)
col->RemoveCollisionVolumes();
}
}
+ if(gUseChunkFiles){
+ for(id = 0; id < MODELINFOSIZE; id++){
+ CBaseModelInfo *mi = CModelInfo::GetModelInfo(id);
+ if(mi){
+ CColModel *col = mi->GetColModel();
+ if(col && col->level == slot){
+ mi->SetColModel(&nullCollision);
+ CStreaming::UnregisterPointer(&mi->m_colModel, 1);
+ }
+ }
+ }
+ if(def->chunk){
+ CStreaming::UnregisterPointer(&def->chunk, 1);
+ cSmallHeap::msInstance.Free(def->chunk);
+ def->chunk = nil;
+ }
+ }
}
void
@@ -156,29 +242,49 @@ CColStore::RemoveAllCollision(void)
}
static bool bLoadAtSecondPosition;
-static CVector2D secondPosition;
+static CVector secondPosition;
void
-CColStore::AddCollisionNeededAtPosn(const CVector2D &pos)
+CColStore::AddCollisionNeededAtPosn(const CVector &pos)
{
bLoadAtSecondPosition = true;
secondPosition = pos;
}
void
-CColStore::LoadCollision(const CVector2D &pos)
+CColStore::LoadCollision(const CVector &pos, eLevelName level)
{
int i;
if(CStreaming::ms_disableStreaming)
return;
+ if(level == LEVEL_GENERIC)
+ level = PosLevel(pos);
+
+ eLevelName allowedLevel = (eLevelName)CTheScripts::AllowedCollision[0];
+ if(allowedLevel == LEVEL_GENERIC)
+ allowedLevel = (eLevelName)CTheScripts::AllowedCollision[1];
+
+ bool requestedSomething = false;
+
for(i = 1; i < COLSTORESIZE; i++){
- if(GetSlot(i) == nil)
+ if(GetSlot(i) == nil || !DoScriptsWantThisIn(i))
continue;
bool wantThisOne = false;
+ if(strcmp(GetColName(i), "indust") == 0){
+ if(allowedLevel != LEVEL_GENERIC && level != LEVEL_INDUSTRIAL)
+ wantThisOne = allowedLevel == LEVEL_INDUSTRIAL;
+ else
+ wantThisOne = level == LEVEL_INDUSTRIAL;
+ }else if(GetBoundingBox(i).IsPointInside(LevelPos(level)))
+ wantThisOne = true;
+ else if(allowedLevel != LEVEL_GENERIC && GetBoundingBox(i).IsPointInside(LevelPos(allowedLevel)))
+ wantThisOne = true;
+
+/* // LCS: removed
if(GetBoundingBox(i).IsPointInside(pos) ||
bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) ||
strcmp(GetColName(i), "yacht") == 0){
@@ -203,28 +309,38 @@ CColStore::LoadCollision(const CVector2D &pos)
}
}
}
+*/
- if(wantThisOne)
+ if(wantThisOne){
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
- else
+ requestedSomething = true;
+ }else
CStreaming::RemoveCol(i);
}
+ if(requestedSomething){
+ CTimer::Suspend();
+ // BUG? request was done with priority but now loading non-priority?
+ CStreaming::LoadAllRequestedModels(false);
+ CGarages::SetupAnyGaragesForThisIsland();
+ CTimer::Resume();
+ }
bLoadAtSecondPosition = false;
}
void
-CColStore::RequestCollision(const CVector2D &pos)
+CColStore::RequestCollision(const CVector &pos)
{
int i;
for(i = 1; i < COLSTORESIZE; i++)
- if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f))
+ if(GetSlot(i) && DoScriptsWantThisIn(i) && GetBoundingBox(i).IsPointInside(LevelPos(PosLevel(pos)), -115.0f))
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
}
void
-CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
+CColStore::EnsureCollisionIsInMemory(const CVector &pos)
{
+/* // LCS: removed
int i;
if(CStreaming::ms_disableStreaming)
@@ -240,16 +356,48 @@ CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
CStreaming::LoadAllRequestedModels(false);
CTimer::Resume();
}
+*/
}
bool
-CColStore::HasCollisionLoaded(const CVector2D &pos)
+CColStore::DoScriptsWantThisIn(int32 slot)
+{
+ if(slot == 0)
+ return false;
+ ColDef *coldef = GetSlot(slot);
+ if(coldef == nil)
+ return false;
+ if(strcmp(coldef->name, "fortstaunton") == 0)
+ return !CTheScripts::IsFortStauntonDestroyed();
+ if(strcmp(coldef->name, "fortdestroyed") == 0)
+ return CTheScripts::IsFortStauntonDestroyed();
+ return true;
+}
+
+bool
+CColStore::HasCollisionLoaded(eLevelName level)
{
int i;
+ const CVector &pos = LevelPos(level);
for(i = 1; i < COLSTORESIZE; i++)
- if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f) &&
+ if(GetSlot(i) && DoScriptsWantThisIn(i) &&
+ (!CGeneral::faststricmp(GetColName(i), "indust") && level == LEVEL_INDUSTRIAL ||
+ GetBoundingBox(i).IsPointInside(pos)) &&
!GetSlot(i)->isLoaded)
return false;
return true;
}
+
+bool
+CColStore::HasCollisionLoaded(const CVector &pos)
+{
+ return HasCollisionLoaded(PosLevel(pos));
+}
+
+void
+CColStore::Load(bool onlyBB, CPool<ColDef> *pool)
+{
+ ms_pColPool = pool;
+ m_onlyBB = onlyBB;
+}
diff --git a/src/collision/ColStore.h b/src/collision/ColStore.h
index e0da92ca..d09bbf8f 100644
--- a/src/collision/ColStore.h
+++ b/src/collision/ColStore.h
@@ -9,11 +9,13 @@ struct ColDef { // made up name
char name[20];
int16 minIndex;
int16 maxIndex;
+ void *chunk;
};
class CColStore
{
static CPool<ColDef,ColDef> *ms_pColPool;
+ static bool m_onlyBB;
public:
static void Initialise(void);
@@ -25,15 +27,18 @@ public:
static CRect &GetBoundingBox(int32 slot);
static void IncludeModelIndex(int32 slot, int32 modelIndex);
static bool LoadCol(int32 storeID, uint8 *buffer, int32 bufsize);
+ static void LoadColCHK(int32 slot, void *data, void *chunk);
static void RemoveCol(int32 slot);
- static void AddCollisionNeededAtPosn(const CVector2D &pos);
+ static void AddCollisionNeededAtPosn(const CVector &pos);
static void LoadAllCollision(void);
static void RemoveAllCollision(void);
- static void LoadCollision(const CVector2D &pos);
- static void RequestCollision(const CVector2D &pos);
- static void EnsureCollisionIsInMemory(const CVector2D &pos);
- static bool HasCollisionLoaded(const CVector2D &pos);
- static bool HasCollisionLoaded(eLevelName level) { return true; }; // TODO
+ static void LoadCollision(const CVector &pos, eLevelName level = LEVEL_GENERIC);
+ static void RequestCollision(const CVector &pos);
+ static void EnsureCollisionIsInMemory(const CVector &pos);
+ static bool DoScriptsWantThisIn(int32 slot);
+ static bool HasCollisionLoaded(eLevelName level);
+ static bool HasCollisionLoaded(const CVector &pos);
+ static void Load(bool, CPool<ColDef> *pool);
static ColDef *GetSlot(int slot) {
assert(slot >= 0);
diff --git a/src/collision/TempColModels.cpp b/src/collision/TempColModels.cpp
index 55058bde..32f2285c 100644
--- a/src/collision/TempColModels.cpp
+++ b/src/collision/TempColModels.cpp
@@ -1,6 +1,7 @@
#include "common.h"
#include "TempColModels.h"
+#include "Game.h"
CColModel CTempColModels::ms_colModelPed1;
CColModel CTempColModels::ms_colModelPed2;
diff --git a/src/collision/TempColModels.h b/src/collision/TempColModels.h
index 457315b6..e8a39695 100644
--- a/src/collision/TempColModels.h
+++ b/src/collision/TempColModels.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Collision.h"
+#include "ColModel.h"
class CTempColModels
{
diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp
index 1e63cf30..e7c76a9c 100644
--- a/src/control/Bridge.cpp
+++ b/src/control/Bridge.cpp
@@ -161,3 +161,23 @@ bool CBridge::ThisIsABridgeObjectMovingUp(int index)
return false;
#endif
}
+
+void CBridge::ForceBridgeState(uint8 state)
+{
+#ifdef GTA_BRIDGE
+ State = state;
+ switch (state)
+ {
+ case STATE_BRIDGE_LOCKED:
+ case STATE_LIFT_PART_MOVING_DOWN:
+ case STATE_LIFT_PART_ABOUT_TO_MOVE_UP:
+ ThePaths.SetLinksBridgeLights(-330.0f, -230.0f, -700.0f, -588.0f, true);
+ break;
+ case STATE_BRIDGE_ALWAYS_UNLOCKED:
+ ThePaths.SetLinksBridgeLights(-330.0f, -230.0f, -700.0f, -588.0f, false);
+ break;
+ default:
+ break;
+ }
+#endif
+} \ No newline at end of file
diff --git a/src/control/Bridge.h b/src/control/Bridge.h
index dd781a9a..e639d4c1 100644
--- a/src/control/Bridge.h
+++ b/src/control/Bridge.h
@@ -26,4 +26,5 @@ public:
static bool ShouldLightsBeFlashing();
static void FindBridgeEntities();
static bool ThisIsABridgeObjectMovingUp(int);
+ static void ForceBridgeState(uint8 state);
};
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 3d12d4a2..c3542d27 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -1,11 +1,10 @@
#pragma once
-#include "Automobile.h"
#include "audio_enums.h"
#include "Camera.h"
#include "config.h"
+#include "Lists.h"
class CVehicle;
-class CCamera;
enum eGarageState
{
@@ -183,6 +182,10 @@ public:
void FindDoorsEntities();
void FindDoorsEntitiesSectorList(CPtrList&, bool);
void PlayerArrestedOrDied();
+ bool Does60SecondsNeedThisCarAtAll(int mi);
+ bool Does60SecondsNeedThisCar(int mi);
+ void MarkThisCarAsCollectedFor60Seconds(int mi);
+ bool IsPlayerEntirelyInsideGarage();
bool IsPointInsideGarage(CVector);
bool IsPointInsideGarage(CVector, float);
@@ -255,6 +258,7 @@ public:
static bool IsModelIndexADoor(uint32 id);
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
+ static void StopCarFromBlowingUp(CAutomobile*);
static void SetMaxNumStoredCarsForGarage(int16 garage, uint8 num) { aGarages[garage].m_nMaxStoredCars = num; }
static bool IsCarSprayable(CVehicle*);
@@ -293,4 +297,6 @@ public:
}
static bool IsThisGarageTypeSafehouse(uint8 type) { return FindSafeHouseIndexForGarageType(type) >= 0; }
+ static void SetupAnyGaragesForThisIsland(void) {} // TODO(LCS)
+
};
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index cbc29db4..bc9af2e9 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -338,17 +338,17 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x,
InfoForTileCars[i].x = x/16.0f;
InfoForTileCars[i].y = y/16.0f;
InfoForTileCars[i].z = z/16.0f;
- InfoForTilePeds[i].width = 8.0f*Min(width, 15.0f);
+ InfoForTileCars[i].width = 8.0f*Min(width, 15.0f);
InfoForTileCars[i].numLeftLanes = numLeft;
InfoForTileCars[i].numRightLanes = numRight;
- InfoForTilePeds[i].crossing = false;
- InfoForTilePeds[i].speedLimit = 0;
- InfoForTilePeds[i].roadBlock = false;
- InfoForTilePeds[i].disabled = false;
- InfoForTilePeds[i].waterPath = false;
- InfoForTilePeds[i].onlySmallBoats = false;
- InfoForTilePeds[i].betweenLevels = false;
- InfoForTilePeds[i].spawnRate = Min(spawnRate, 15);
+ InfoForTileCars[i].crossing = false;
+ InfoForTileCars[i].speedLimit = 0;
+ InfoForTileCars[i].roadBlock = false;
+ InfoForTileCars[i].disabled = false;
+ InfoForTileCars[i].waterPath = false;
+ InfoForTileCars[i].onlySmallBoats = false;
+ InfoForTileCars[i].betweenLevels = false;
+ InfoForTileCars[i].spawnRate = Min(spawnRate, 15);
if(node == 11)
InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound();
@@ -1763,18 +1763,18 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
float dist;
if(type == PATH_CAR)
- DoPathSearch(type, start, -1, target, pNodeList, &DummyResult, 32, nil, &dist, 999999.88f, -1);
+ DoPathSearch(type, start, -1, target, pNodeList, &DummyResult, 32, nil, &dist, 170.0f, -1);
else
DoPathSearch(type, start, -1, target, nil, &DummyResult2, 0, nil, &dist, 50.0f, -1);
#ifdef FIX_BUGS
// dist has GenerationDistMultiplier as a factor, so our reference dist should have it too
if(type == PATH_CAR)
- return dist < 150.0f*TheCamera.GenerationDistMultiplier;
+ return dist < 180.0f*TheCamera.GenerationDistMultiplier;
else
return dist < 100.0f*TheCamera.GenerationDistMultiplier;
#else
if(type == PATH_CAR)
- return dist < 150.0f;
+ return dist < 180.0f;
else
return dist < 100.0f;
#endif
diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp
index 047b19f3..dc025549 100644
--- a/src/control/Remote.cpp
+++ b/src/control/Remote.cpp
@@ -9,7 +9,7 @@
#include "PlayerInfo.h"
#include "Vehicle.h"
-void
+CVehicle*
CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model)
{
CAutomobile *car = new CAutomobile(model, MISSION_VEHICLE);
@@ -40,6 +40,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin
TheCamera.SetZoomValueCamStringScript(0);
} else
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT);
+ return car;
}
void
diff --git a/src/control/Remote.h b/src/control/Remote.h
index 72cabb7c..4c40dd96 100644
--- a/src/control/Remote.h
+++ b/src/control/Remote.h
@@ -3,6 +3,6 @@
class CRemote
{
public:
- static void GivePlayerRemoteControlledCar(float, float, float, float, uint16);
+ static CVehicle* GivePlayerRemoteControlledCar(float, float, float, float, uint16);
static void TakeRemoteControlledCarFromPlayer(bool blowUp = true);
};
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index a9df5799..1b1b9045 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11,6 +11,7 @@
#include "CivilianPed.h"
#include "Clock.h"
#include "CopPed.h"
+#include "Coronas.h"
#include "Debug.h"
#include "DMAudio.h"
#include "EmergencyPed.h"
@@ -49,7 +50,7 @@
#include "Timecycle.h"
#include "TxdStore.h"
#include "Bike.h"
-#include "memoryManager.h"
+#include "smallHeap.h"
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#include <stdarg.h>
#endif
@@ -98,7 +99,7 @@ uint16 CTheScripts::NumberOfExclusiveMissionScripts;
bool CTheScripts::bPlayerHasMetDebbieHarry;
bool CTheScripts::bPlayerIsInTheStatium;
int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS];
-bool CTheScripts::FSDestroyedFlag;
+int CTheScripts::FSDestroyedFlag;
short* CTheScripts::SavedVarIndices;
int CTheScripts::NumSaveVars;
int gScriptsFile = -1;
@@ -107,6 +108,9 @@ bool CTheScripts::InTheScripts;
CRunningScript* pCurrent;
uint16 CTheScripts::NumTrueGlobals;
uint16 CTheScripts::MostGlobals;
+CVector gVectorSetInLua;
+int CTheScripts::NextScriptCoronaID;
+base::cSList<script_corona> CTheScripts::mCoronas;
#ifdef MISSION_REPLAY
@@ -422,7 +426,7 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_ADD_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_SCORE_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
REGISTER_COMMAND(COMMAND_STORE_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL_NO_DROP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_WANTED_LEVEL_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
@@ -2136,9 +2140,7 @@ void CMissionCleanup::Process()
default:
break;
}
- m_sEntities[i].id = 0;
- m_sEntities[i].type = CLEANUP_UNUSED;
- m_nCount--;
+ RemoveEntityFromList(m_sEntities[i].id, m_sEntities[i].type);
}
for (int i = 1; i < NUMSTREAMINFO; i++) {
if (CStreaming::IsScriptOwnedModel(i))
@@ -2513,7 +2515,7 @@ int32* GetPointerToScriptVariable(CRunningScript* pScript, uint32* pIp)
return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)];
}
script_assert(false && "wrong type for variable");
- return nil;
+ return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL)];
}
int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type)
@@ -2620,6 +2622,14 @@ bool CTheScripts::Init(bool loaddata)
memset(&UsedObjectArray[i].name, 0, sizeof(UsedObjectArray[i].name));
UsedObjectArray[i].index = 0;
}
+#if defined FIX_BUGS || (!defined GTA_PS2 && !defined GTA_PSP)
+ for (base::cSList<script_corona>::tSItem* i = CTheScripts::mCoronas.first; i;) {
+ base::cSList<script_corona>::tSItem* next = i->next;
+ delete i;
+ i = next;
+ }
+ CTheScripts::mCoronas.first = nil;
+#endif
NumberOfUsedObjects = 0;
if (ScriptSpace)
Shutdown();
@@ -2632,7 +2642,8 @@ bool CTheScripts::Init(bool loaddata)
CFileMgr::Read(mainf, (char*)&MainScriptSize, sizeof(MainScriptSize));
int nLargestMissionSize = 0;
CFileMgr::Read(mainf, (char*)&nLargestMissionSize, sizeof(nLargestMissionSize));
- // some cSmallHeap shit - TODO
+ if (!cSmallHeap::msInstance.IsLocked())
+ cSmallHeap::msInstance.Lock();
ScriptSpace = (uint8*)base::cMainMemoryManager::Instance()->Allocate(MainScriptSize + nLargestMissionSize);
memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize);
CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize);
@@ -2772,8 +2783,6 @@ void CTheScripts::Process()
UseTextCommands = 0;
}
- // TODO: mCoronas
-
#ifdef MISSION_REPLAY
static uint32 TimeToWaitTill;
switch (AllowMissionReplay) {
@@ -2833,6 +2842,11 @@ void CTheScripts::Process()
if (script && !script->m_bIsActive)
script = nil;
}
+ InTheScripts = false;
+ for (base::cSList<script_corona>::tSItem* i = CTheScripts::mCoronas.first; i; i = i->next) {
+ CCoronas::RegisterCorona((uint32)(uintptr)i, i->item.r, i->item.g, i->item.b, 255, CVector(i->item.x, i->item.y, i->item.z),
+ -i->item.size, 450.0f, i->item.type, i->item.flareType, 1, 0, 0, 0.0f);
+ }
DbgFlag = false;
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted);
@@ -2896,7 +2910,9 @@ int8 CRunningScript::ProcessOneCommand()
uint8 nLocalsOffset;
if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command);
+ m_nIp -= 2;
sprintf(commandInfo, m_nIp >= CTheScripts::MainScriptSize ? "M<%5d> " : "<%6d> ", m_nIp >= CTheScripts::MainScriptSize ? m_nIp - CTheScripts::MainScriptSize : m_nIp);
+ m_nIp += 2;
if (m_bNotFlag)
strcat(commandInfo, "NOT ");
if (commands[command].position == -1)
@@ -4918,7 +4934,9 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(GET_FLOAT_PARAM(4)), MI_RCBANDIT);
+ CVehicle* pVehicle = CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(GET_FLOAT_PARAM(4)), MI_RCBANDIT);
+ SET_INTEGER_PARAM(0, CPools::GetVehiclePool()->GetIndex(pVehicle));
+ StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ALTER_WANTED_LEVEL:
diff --git a/src/control/Script.h b/src/control/Script.h
index 780440dd..11c1b185 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -1,9 +1,9 @@
#pragma once
-#include "common.h"
-#include "Font.h"
+#include "Font.h"
#include "Ped.h"
#include "PedType.h"
#include "Text.h"
+#include "sList.h"
#include "Sprite2d.h"
class CEntity;
@@ -38,9 +38,11 @@ void FlushLog();
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
+#define MILES_IN_METER (0.000621371192f)
#define METERS_IN_FOOT (0.3048f)
#define FEET_IN_METER (3.28084f)
#else
+#define MILES_IN_METER (1 / 1670.f)
#define METERS_IN_FOOT (0.3f)
#define FEET_IN_METER (3.33f)
#endif
@@ -273,6 +275,20 @@ struct tBuildingSwap
int32 m_nOldModel;
};
+struct script_corona
+{
+ int id;
+ float x;
+ float y;
+ float z;
+ float size;
+ uint8 r;
+ uint8 g;
+ uint8 b;
+ int type;
+ int flareType;
+};
+
enum {
VAR_LOCAL = 1,
@@ -343,12 +359,14 @@ public:
static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
static short* SavedVarIndices;
static int NumSaveVars;
- static bool FSDestroyedFlag;
+ static int FSDestroyedFlag;
static int NextProcessId;
static bool InTheScripts;
static CRunningScript* pCurrent;
static uint16 NumTrueGlobals;
static uint16 MostGlobals;
+ static base::cSList<script_corona> mCoronas;
+ static int NextScriptCoronaID;
static bool Init(bool loaddata = false);
static void Process();
@@ -468,6 +486,8 @@ public:
static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif
+ static bool IsFortStauntonDestroyed() { return FSDestroyedFlag && *(int32*)&ScriptSpace[FSDestroyedFlag] == 1; }
+
};
extern int ScriptParams[32];
@@ -665,4 +685,5 @@ extern int scriptToLoad;
#endif
extern int gScriptsFile;
+extern CVector gVectorSetInLua;
diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp
index 536701b3..fef33848 100644
--- a/src/control/Script10.cpp
+++ b/src/control/Script10.cpp
@@ -74,7 +74,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
case COMMAND_ADD_ARROW_3D_MARKER:
{
uint32 ip = m_nIp;
- uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0);
+ uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0);
CollectParameters(&m_nIp, 10);
CVector pos = GET_VECTOR_PARAM(0);
CVector dir = GET_VECTOR_PARAM(3);
@@ -213,7 +213,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
- CollectParameters(&m_nIp, 3);
+ CollectParameters(&m_nIp, 4);
CMessages::AddMessageJumpQWithNumber(key, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); // 0
return 0;
}
@@ -321,6 +321,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
+ return 0;
}
case COMMAND_GET_PLAYER_STORED_WEAPON:
{
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 1e4d5b6f..7acfdfc8 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -35,6 +35,7 @@
#include "Zones.h"
#include "GameLogic.h"
#include "Bike.h"
+#include "Wanted.h"
// LCS: file done except TODOs
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 20e041da..d1dba350 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -39,6 +39,7 @@
#include "World.h"
#include "Zones.h"
#include "Bike.h"
+#include "Wanted.h"
// LCS: file done except TODOs
@@ -477,7 +478,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
float fx = pObject->GetForward().x;
float fy = pObject->GetForward().y;
float heading = LimitAngleOnCircle(
- RADTODEG(CGeneral::GetATanOfXY(pObject->GetForward().x, pObject->GetForward().y)));
+ RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y)));
float headingTarget = GET_FLOAT_PARAM(1);
#ifdef FIX_BUGS
float rotateBy = GET_FLOAT_PARAM(2) * CTimer::GetTimeStepFix();
@@ -935,6 +936,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
script_assert(pVehicle);
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
pPed->WarpPedIntoCar(pVehicle);
+ pPed->RestorePreviousObjective();
return 0;
}
case COMMAND_WARP_CHAR_INTO_CAR:
diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp
index 601a979d..c50f0dea 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -423,9 +423,10 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_REQUEST_COLLISION:
{
CollectParameters(&m_nIp, 2);
- CVector2D pos;
+ CVector pos;
pos.x = GET_FLOAT_PARAM(0);
pos.y = GET_FLOAT_PARAM(1);
+ pos.z = 0.0f;
CColStore::RequestCollision(pos);
return 0;
}
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 55a56b2f..53e39b68 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -601,19 +601,36 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_CREATE_SCRIPT_CORONA:
{
CollectParameters(&m_nIp, 9);
- static bool bShowed = false;
- if (!bShowed) {
- debug("CREATE_SCRIPT_CORONA not implemented");
- bShowed = true;
- }
- SET_INTEGER_PARAM(0, -1);
+ base::cSList<script_corona>::tSItem* pCorona = new base::cSList<script_corona>::tSItem();
+ pCorona->item.x = GET_FLOAT_PARAM(0);
+ pCorona->item.y = GET_FLOAT_PARAM(1);
+ pCorona->item.z = GET_FLOAT_PARAM(2);
+ pCorona->item.id = CTheScripts::NextScriptCoronaID++;
+ if (pCorona->item.z <= MAP_Z_LOW_LIMIT)
+ pCorona->item.z = CWorld::FindGroundZForCoord(pCorona->item.x, pCorona->item.y);
+ pCorona->item.size = GET_FLOAT_PARAM(3);
+ pCorona->item.r = GET_INTEGER_PARAM(6);
+ pCorona->item.g = GET_INTEGER_PARAM(7);
+ pCorona->item.b = GET_INTEGER_PARAM(8);
+ pCorona->item.type = GET_INTEGER_PARAM(4);
+ pCorona->item.flareType = GET_INTEGER_PARAM(5);
+ SET_INTEGER_PARAM(0, pCorona->item.id);
+ CTheScripts::mCoronas.Insert(pCorona);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_REMOVE_SCRIPT_CORONA:
+ {
CollectParameters(&m_nIp, 1);
- // TODO
+ for (base::cSList<script_corona>::tSItem* i = CTheScripts::mCoronas.first; i; i = i->next) {
+ if (i->item.id == GET_INTEGER_PARAM(0)) {
+ CTheScripts::mCoronas.Remove(i);
+ delete i;
+ break;
+ }
+ }
return 0;
+ }
case COMMAND_IS_BOAT_IN_WATER:
{
CollectParameters(&m_nIp, 1);
diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp
index c936e68f..020221c4 100644
--- a/src/control/Script9.cpp
+++ b/src/control/Script9.cpp
@@ -636,7 +636,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
case COMMAND_ADD_POINT_3D_MARKER:
{
uint32 ip = m_nIp;
- uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0);
+ uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0);
static CVector vPreviousLocation;
CollectParameters(&m_nIp, 7);
CVector pos = GET_VECTOR_PARAM(0);
@@ -651,7 +651,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
return 0;
}
case COMMAND_GET_VECTOR_FROM_MULTIPLAYER:
- // SET_VECTOR_PARAM(0, gVectorSetInLua);
+ SET_VECTOR_PARAM(0, gVectorSetInLua);
StoreParameters(&m_nIp, 3);
return 0;
case COMMAND_PRINT_HELP_ALWAYS:
@@ -737,10 +737,10 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
}
case COMMAND_SET_CHAR_ATTACKS_PLAYER_WITH_COPS:
{
- CollectParameters(&m_nIp, 1);
+ CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(0) != 0);
+ pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_REGISTER_FACE_PLANT_DISTANCE:
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index df0761ab..d8f211d0 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -114,6 +114,32 @@ CTrafficLights::DisplayActualLight(CEntity *ent)
CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
+
+ // TODO(LCS): check coordinates
+ static const float top = -0.127f;
+ static const float bot = -0.539f;
+ static const float mid = bot + (top - bot) / 3.0f;
+ static const float left = 1.256f;
+ static const float right = 0.706f;
+ phase = CTrafficLights::LightForPeds();
+ if (phase == PED_LIGHTS_DONT_WALK) {
+ CVector p0(2.7f, right, top);
+ CVector p1(2.7f, left, top);
+ CVector p2(2.7f, right, mid);
+ CVector p3(2.7f, left, mid);
+ CShinyTexts::RegisterOne(ent->GetMatrix() * p0, ent->GetMatrix() * p1, ent->GetMatrix() * p2, ent->GetMatrix() * p3,
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
+ SHINYTEXT_WALK, 255, 0, 0, 60.0f);
+ }
+ else if (phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100) {
+ CVector p0(2.7f, right, mid);
+ CVector p1(2.7f, left, mid);
+ CVector p2(2.7f, right, bot);
+ CVector p3(2.7f, left, bot);
+ CShinyTexts::RegisterOne(ent->GetMatrix() * p0, ent->GetMatrix() * p1, ent->GetMatrix() * p2, ent->GetMatrix() * p3,
+ 1.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f,
+ SHINYTEXT_WALK, 255, 255, 255, 60.0f);
+ }
}
else if (MI_TRAFFICLIGHTS_VERTICAL == m) {
CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index eea1f6f0..fcc4503a 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -1,11 +1,7 @@
-#if defined RW_D3D9 || defined RWLIBS
-#define DIRECTINPUT_VERSION 0x0800
-#include <dinput.h>
-#endif
-
+#define WITHDINPUT
#include "common.h"
#include "platform.h"
-#include "crossplatform.h" // for Windows version
+#include "crossplatform.h"
#include "ControllerConfig.h"
#include "Pad.h"
#include "FileMgr.h"
@@ -35,6 +31,9 @@ CControllerConfigManager::CControllerConfigManager()
void CControllerConfigManager::MakeControllerActionsBlank()
{
+#ifdef LOAD_INI_SETTINGS
+ ms_padButtonsInited = 0;
+#endif
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
{
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++)
@@ -321,6 +320,10 @@ void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerSta
}
}
+#ifdef LOAD_INI_SETTINGS
+uint32 CControllerConfigManager::ms_padButtonsInited = 0;
+#endif
+
void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
{
m_bFirstCapture = true;
@@ -329,6 +332,22 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
if (buttons > 16)
btn = 16;
+#ifdef LOAD_INI_SETTINGS
+ uint32 buttonMin = ms_padButtonsInited;
+ if (buttonMin >= btn)
+ return;
+
+ ms_padButtonsInited = btn;
+
+ #define IF_BTN_IN_RANGE(n) \
+ case n: \
+ if (n <= buttonMin) \
+ return;
+#else
+ #define IF_BTN_IN_RANGE(n) \
+ case n:
+#endif
+
// Now we use SDL Game Controller DB
#if defined RW_D3D9 || defined RWLIBS
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
@@ -341,50 +360,50 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
switch (btn)
{
- case 16:
+ IF_BTN_IN_RANGE(16)
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
- case 15:
+ IF_BTN_IN_RANGE(15)
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
- case 14:
+ IF_BTN_IN_RANGE(14)
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
- case 13:
+ IF_BTN_IN_RANGE(13)
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
- case 12:
- case 11:
+ IF_BTN_IN_RANGE(12)
+ IF_BTN_IN_RANGE(11)
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
- case 10:
+ IF_BTN_IN_RANGE(10)
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
- case 9:
+ IF_BTN_IN_RANGE(9)
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
- case 8:
+ IF_BTN_IN_RANGE(8)
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
- case 7:
+ IF_BTN_IN_RANGE(7)
SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
- case 6:
+ IF_BTN_IN_RANGE(6)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
- case 5:
+ IF_BTN_IN_RANGE(5)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
/*******************************************************************************************/
- case 4:
+ IF_BTN_IN_RANGE(4)
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK);
- case 3:
+ IF_BTN_IN_RANGE(3)
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
- case 2:
+ IF_BTN_IN_RANGE(2)
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
#ifdef BIND_VEHICLE_FIREWEAPON
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
#endif
- case 1:
+ IF_BTN_IN_RANGE(1)
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
/*******************************************************************************************/
}
@@ -393,47 +412,47 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
{
switch (btn)
{
- case 16:
+ IF_BTN_IN_RANGE(16)
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
- case 15:
+ IF_BTN_IN_RANGE(15)
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
- case 14:
+ IF_BTN_IN_RANGE(14)
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
- case 13:
+ IF_BTN_IN_RANGE(13)
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
- case 12:
- case 11:
+ IF_BTN_IN_RANGE(12)
+ IF_BTN_IN_RANGE(11)
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
- case 10:
+ IF_BTN_IN_RANGE(10)
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
- case 9:
+ IF_BTN_IN_RANGE(9)
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
- case 8:
+ IF_BTN_IN_RANGE(8)
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
- case 7:
+ IF_BTN_IN_RANGE(7)
SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
- case 6:
+ IF_BTN_IN_RANGE(6)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
- case 5:
+ IF_BTN_IN_RANGE(5)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
/*******************************************************************************************/
- case 4:
+ IF_BTN_IN_RANGE(4)
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK);
- case 3:
+ IF_BTN_IN_RANGE(3)
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK);
- case 2:
+ IF_BTN_IN_RANGE(2)
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
- case 1:
+ IF_BTN_IN_RANGE(1)
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
#ifdef BIND_VEHICLE_FIREWEAPON
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK);
@@ -2772,7 +2791,7 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
{
int32 setorder = m_aSettings[action][k].m_ContSetOrder;
- if (setorder > i && setorder != KEYBOARD)
+ if (setorder > i && setorder != 0)
{
if (init)
{
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index eb66937a..604fb5cc 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -144,6 +144,10 @@ public:
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
bool m_bMouseAssociated;
+
+#ifdef LOAD_INI_SETTINGS
+ static uint32 ms_padButtonsInited;
+#endif
CControllerConfigManager();
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 36db8107..3a2d3b59 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -1,10 +1,6 @@
-#if defined RW_D3D9 || defined RWLIBS
-#define DIRECTINPUT_VERSION 0x0800
-#include <dinput.h>
-#endif
-
#define FORCE_PC_SCALING
#define WITHWINDOWS
+#define WITHDINPUT
#include "common.h"
#ifndef PS2_MENU
#include "crossplatform.h"
@@ -581,13 +577,21 @@ CMenuManager::Initialise(void)
DMAudio.Service();
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
+#ifdef FIX_BUGS
+ static bool firstTime = true;
+ if (firstTime) {
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ firstTime = false;
+ } else
+#endif
m_PrefsRadioStation = DMAudio.GetRadioInCar();
+
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK)
- m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % (USERTRACK + 1);
} else if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > WAVE)
- m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % (WAVE + 1);
CFileMgr::SetDir("");
//CFileMgr::SetDir("");
@@ -671,7 +675,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl)
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
+#ifdef LOAD_INI_SETTINGS
+ SaveINIControllerSettings();
+#else
SaveSettings();
+#endif
}
}
@@ -3053,6 +3061,16 @@ CMenuManager::LoadSettings()
CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir("");
+#ifdef LOAD_INI_SETTINGS
+ if (LoadINISettings()) {
+ LoadINIControllerSettings();
+ } else {
+ // no re3.ini, create it
+ SaveINISettings();
+ SaveINIControllerSettings();
+ }
+#endif
+
#ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#endif
@@ -3098,15 +3116,12 @@ CMenuManager::LoadSettings()
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
}
-
-#ifdef LOAD_INI_SETTINGS
- LoadINISettings(); // needs frontend options to be loaded
-#endif
}
void
CMenuManager::SaveSettings()
{
+#ifndef LOAD_INI_SETTINGS
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
static int SomeVersion = 3;
@@ -3165,7 +3180,8 @@ CMenuManager::SaveSettings()
CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir("");
-#ifdef LOAD_INI_SETTINGS
+#else
+ m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex;
SaveINISettings();
#endif
}
@@ -4445,19 +4461,19 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
MouseButtonJustClicked = false;
if (CPad::GetPad(0)->GetLeftMouseJustDown())
- MouseButtonJustClicked = 1;
+ MouseButtonJustClicked = rsMOUSELEFTBUTTON;
else if (CPad::GetPad(0)->GetRightMouseJustUp())
- MouseButtonJustClicked = 3;
+ MouseButtonJustClicked = rsMOUSERIGHTBUTTON;
else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
- MouseButtonJustClicked = 2;
+ MouseButtonJustClicked = rsMOUSMIDDLEBUTTON;
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
- MouseButtonJustClicked = 4;
+ MouseButtonJustClicked = rsMOUSEWHEELUPBUTTON;
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
- MouseButtonJustClicked = 5;
+ MouseButtonJustClicked = rsMOUSEWHEELDOWNBUTTON;
else if (CPad::GetPad(0)->GetMouseX1JustUp())
- MouseButtonJustClicked = 6;
+ MouseButtonJustClicked = rsMOUSEX1BUTTON;
else if (CPad::GetPad(0)->GetMouseX2JustUp())
- MouseButtonJustClicked = 7;
+ MouseButtonJustClicked = rsMOUSEX2BUTTON;
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
@@ -4818,6 +4834,9 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
TheCamera.m_bUseMouse3rdPerson = false;
#endif
SaveSettings();
+#ifdef LOAD_INI_SETTINGS
+ SaveINIControllerSettings();
+#endif
}
SetHelperText(2);
break;
@@ -4848,7 +4867,8 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
- if (option.m_CFOSelect->save)
+ // Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO
+ // if (option.m_CFOSelect->save)
SaveSettings();
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
@@ -5004,7 +5024,8 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
- if (option.m_CFOSelect->save)
+ // Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO
+ // if (option.m_CFOSelect->save)
SaveSettings();
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
@@ -5446,6 +5467,9 @@ CMenuManager::SwitchMenuOnAndOff()
ThingsToDoBeforeLeavingPage();
#endif
SaveSettings();
+#ifdef LOAD_INI_SETTINGS
+ SaveINIControllerSettings();
+#endif
pControlEdit = nil;
pEditString = nil;
DisplayComboButtonErrMsg = false;
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 4a812b05..c1c3983e 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -392,6 +392,7 @@ struct CCustomScreenLayout {
struct CCFO
{
int8 *value;
+ const char *saveCat;
const char *save;
};
@@ -406,11 +407,12 @@ struct CCFOSelect : CCFO
bool disableIfGameLoaded;
CCFOSelect() {};
- CCFOSelect(int8* value, const char* save, const char** rightTexts, int8 numRightTexts, bool onlyApplyOnEnter, ChangeFunc changeFunc = nil, bool disableIfGameLoaded = false){
+ CCFOSelect(int8* value, const char* saveCat, const char* save, const char** rightTexts, int8 numRightTexts, bool onlyApplyOnEnter, ChangeFunc changeFunc = nil, bool disableIfGameLoaded = false){
this->value = value;
if (value)
this->lastSavedValue = this->displayedValue = *value;
+ this->saveCat = saveCat;
this->save = save;
this->rightTexts = (char**)rightTexts;
this->numRightTexts = numRightTexts;
@@ -426,8 +428,9 @@ struct CCFODynamic : CCFO
ButtonPressFunc buttonPressFunc;
CCFODynamic() {};
- CCFODynamic(int8* value, const char* save, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc){
+ CCFODynamic(int8* value, const char* saveCat, const char* save, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc){
this->value = value;
+ this->saveCat = saveCat;
this->save = save;
this->drawFunc = drawFunc;
this->buttonPressFunc = buttonPressFunc;
@@ -581,7 +584,7 @@ public:
int8 m_bLanguageLoaded;
uint8 m_PrefsAllowNastyGame;
int8 m_PrefsMP3BoostVolume;
- uint8 m_ControlMethod;
+ int8 m_ControlMethod;
int32 m_nPrefsVideoMode;
int32 m_nDisplayVideoMode;
int32 m_nMouseTempPosX;
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 3f34617f..e0becc43 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -1,6 +1,3 @@
-#pragma warning( push )
-#pragma warning( disable : 4005)
-#pragma warning( pop )
#include "common.h"
#include "platform.h"
@@ -10,7 +7,6 @@
#include "Accident.h"
#include "Antennas.h"
#include "Bridge.h"
-#include "Camera.h"
#include "CarCtrl.h"
#include "CarGen.h"
#include "CdStream.h"
@@ -69,7 +65,6 @@
#include "Skidmarks.h"
#include "SetPieces.h"
#include "SpecialFX.h"
-#include "Sprite2d.h"
#include "Stats.h"
#include "Streaming.h"
#include "SurfaceTable.h"
@@ -856,9 +851,9 @@ void CGame::Process(void)
gameProcessPirateCheck = 2;
}
#endif
- uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
+ //uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update();
- uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
+ //uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
CWindModifiers::Number = 0;
if (!CTimer::GetIsPaused())
{
@@ -897,13 +892,13 @@ void CGame::Process(void)
CEventList::Update();
CParticle::Update();
gFireManager.Update();
- if (processTime >= 2) {
- CPopulation::Update(false);
- } else {
- uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
+ //if (processTime >= 2) {
+ // CPopulation::Update(false);
+ //} else {
+ // uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CPopulation::Update(true);
- processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
- }
+ // processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
+ //}
CWeapon::UpdateWeapons();
if (!CCutsceneMgr::IsRunning())
CTheCarGenerators::Process();
@@ -941,7 +936,7 @@ void CGame::Process(void)
if (!CReplay::IsPlayingBack())
{
PUSH_MEMID(MEMID_CARS);
- if (processTime < 2)
+ //if (processTime < 2)
CCarCtrl::GenerateRandomCars();
CRoadBlocks::GenerateRoadBlocks();
CCarCtrl::RemoveDistantCars();
diff --git a/src/core/Lists.h b/src/core/Lists.h
index ecf24740..7572e882 100644
--- a/src/core/Lists.h
+++ b/src/core/Lists.h
@@ -1,7 +1,5 @@
#pragma once
-#include "common.h"
-
class CPtrNode
{
public:
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 70c92ce8..770e8ec1 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -16,6 +16,7 @@
#include "Collision.h"
#include "ModelInfo.h"
#include "Pad.h"
+#include "ControllerConfig.h"
// Menu screens array is at the bottom of the file.
@@ -24,51 +25,51 @@
#ifdef CUSTOM_FRONTEND_OPTIONS
#ifdef IMPROVED_VIDEOMODE
- #define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, nil, screenModes, 2, true, ScreenModeAfterChange, true) }, 0, 0, MENUALIGN_LEFT,
+ #define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, "VideoMode", "Windowed", screenModes, 2, true, ScreenModeAfterChange, true) }, 0, 0, MENUALIGN_LEFT,
#else
#define VIDEOMODE_SELECTOR
#endif
#ifdef MULTISAMPLING
- #define MULTISAMPLING_SELECTOR MENUACTION_CFO_DYNAMIC, "FED_AAS", { new CCFODynamic((int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, "MultiSampling", MultiSamplingDraw, MultiSamplingButtonPress) }, 0, 0, MENUALIGN_LEFT,
+ #define MULTISAMPLING_SELECTOR MENUACTION_CFO_DYNAMIC, "FED_AAS", { new CCFODynamic((int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, "Graphics", "MultiSampling", MultiSamplingDraw, MultiSamplingButtonPress) }, 0, 0, MENUALIGN_LEFT,
#else
#define MULTISAMPLING_SELECTOR
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
- #define CUTSCENE_BORDERS_TOGGLE MENUACTION_CFO_SELECT, "FEM_CSB", { new CCFOSelect((int8 *)&FrontEndMenuManager.m_PrefsCutsceneBorders, "CutsceneBorders", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
+ #define CUTSCENE_BORDERS_TOGGLE MENUACTION_CFO_SELECT, "FEM_CSB", { new CCFOSelect((int8 *)&FrontEndMenuManager.m_PrefsCutsceneBorders, "Display", "CutsceneBorders", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
#else
#define CUTSCENE_BORDERS_TOGGLE
#endif
#ifdef FREE_CAM
- #define FREE_CAM_TOGGLE MENUACTION_CFO_SELECT, "FEC_FRC", { new CCFOSelect((int8*)&TheCamera.bFreeCam, "FreeCam", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
+ #define FREE_CAM_TOGGLE MENUACTION_CFO_SELECT, "FEC_FRC", { new CCFOSelect((int8*)&TheCamera.bFreeCam, "Display", "FreeCam", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
#else
#define FREE_CAM_TOGGLE
#endif
#ifdef PS2_ALPHA_TEST
- #define DUALPASS_SELECTOR MENUACTION_CFO_SELECT, "FEM_2PR", { new CCFOSelect((int8*)&gPS2alphaTest, "PS2AlphaTest", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
+ #define DUALPASS_SELECTOR MENUACTION_CFO_SELECT, "FEM_2PR", { new CCFOSelect((int8*)&gPS2alphaTest, "Graphics", "PS2AlphaTest", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
#else
#define DUALPASS_SELECTOR
#endif
#ifdef NO_ISLAND_LOADING
- #define ISLAND_LOADING_SELECTOR MENUACTION_CFO_SELECT, "FEM_ISL", { new CCFOSelect((int8*)&FrontEndMenuManager.m_PrefsIslandLoading, "IslandLoading", islandLoadingOpts, ARRAY_SIZE(islandLoadingOpts), true, IslandLoadingAfterChange) }, 0, 0, MENUALIGN_LEFT,
+ #define ISLAND_LOADING_SELECTOR MENUACTION_CFO_SELECT, "FEM_ISL", { new CCFOSelect((int8*)&FrontEndMenuManager.m_PrefsIslandLoading, "Graphics", "IslandLoading", islandLoadingOpts, ARRAY_SIZE(islandLoadingOpts), true, IslandLoadingAfterChange) }, 0, 0, MENUALIGN_LEFT,
#else
#define ISLAND_LOADING_SELECTOR
#endif
#ifdef EXTENDED_COLOURFILTER
#define POSTFX_SELECTORS \
- MENUACTION_CFO_SELECT, "FED_CLF", { new CCFOSelect((int8*)&CPostFX::EffectSwitch, "ColourFilter", filterNames, ARRAY_SIZE(filterNames), false) }, 0, 0, MENUALIGN_LEFT, \
- MENUACTION_CFO_SELECT, "FED_MBL", { new CCFOSelect((int8*)&CPostFX::MotionBlurOn, "MotionBlur", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
+ MENUACTION_CFO_SELECT, "FED_CLF", { new CCFOSelect((int8*)&CPostFX::EffectSwitch, "Graphics", "ColourFilter", filterNames, ARRAY_SIZE(filterNames), false) }, 0, 0, MENUALIGN_LEFT, \
+ MENUACTION_CFO_SELECT, "FED_MBL", { new CCFOSelect((int8*)&CPostFX::MotionBlurOn, "Graphics", "MotionBlur", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
#else
#define POSTFX_SELECTORS
#endif
#ifdef INVERT_LOOK_FOR_PAD
- #define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_ILU", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, nil, off_on, 2, false) }, 150, 0, MENUALIGN_LEFT,
+ #define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_ILU", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "Controller", "InvertPad", off_on, 2, false) }, 150, 0, MENUALIGN_LEFT,
#else
#define INVERT_PAD_SELECTOR
#endif
@@ -278,6 +279,7 @@ void ScreenModeAfterChange(int8 before, int8 after)
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
wchar selectedJoystickUnicode[128];
+int cachedButtonNum = -1;
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
int numButtons;
@@ -306,6 +308,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
strcpy(gSelectedJoystickName, joyname);
PSGLOBAL(joy1id) = found;
+ cachedButtonNum = numButtons;
}
}
if (PSGLOBAL(joy1id) == -1)
@@ -315,6 +318,18 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
return selectedJoystickUnicode;
}
+
+void DetectJoystickGoBack() {
+ if (cachedButtonNum != -1) {
+#ifdef LOAD_INI_SETTINGS
+ ControlsManager.InitDefaultControlConfigJoyPad(cachedButtonNum);
+ SaveINIControllerSettings();
+#else
+ // Otherwise no way to save gSelectedJoystickName or ms_padButtonsInited anyway :shrug: Why do you even use this config.??
+#endif
+ cachedButtonNum = -1;
+ }
+}
#endif
CMenuScreenCustom aScreens[] = {
@@ -388,7 +403,7 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_RADARMODE, "FED_RDR", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
MENUACTION_HUD, "FED_HUD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
MENUACTION_SUBTITLES, "FED_SUB", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
- MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefDisplay) }, 320, 0, MENUALIGN_CENTER,
+ MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, nil, RestoreDefDisplay) }, 320, 0, MENUALIGN_CENTER,
MENUACTION_GOBACK, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER,
},
#endif
@@ -401,9 +416,9 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_LANG_ITA, "FEL_ITA", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
MENUACTION_LANG_SPA, "FEL_SPA", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
#ifdef MORE_LANGUAGES
- MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, LangPolSelect) }, 0, 0, MENUALIGN_CENTER,
- MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, LangRusSelect) }, 0, 0, MENUALIGN_CENTER
- MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, LangJapSelect) }, 0, 0, MENUALIGN_CENTER,
+ MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, nil, LangPolSelect) }, 0, 0, MENUALIGN_CENTER,
+ MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, nil, LangRusSelect) }, 0, 0, MENUALIGN_CENTER
+ MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, nil, LangJapSelect) }, 0, 0, MENUALIGN_CENTER,
#endif
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 0, 0, MENUALIGN_CENTER,
},
@@ -695,17 +710,16 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT,
#endif
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
- MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) }, 320, 0, MENUALIGN_CENTER,
+ MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, nil, RestoreDefGraphics) }, 320, 0, MENUALIGN_CENTER,
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER,
},
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// MENUPAGE_DETECT_JOYSTICK
- { "FEC_JOD", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({0, 0, 0, false, false, 30}), nil,
-
+ { "FEC_JOD", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({0, 0, 0, false, false, 30}), DetectJoystickGoBack,
MENUACTION_LABEL, "FEC_JPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, 0, 0, 0,
- MENUACTION_CFO_DYNAMIC, "FEC_JDE", { new CCFODynamic(nil, nil, DetectJoystickDraw, nil) }, 80, 200, MENUALIGN_LEFT,
+ MENUACTION_CFO_DYNAMIC, "FEC_JDE", { new CCFODynamic(nil, nil, nil, DetectJoystickDraw, nil) }, 80, 200, MENUALIGN_LEFT,
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 225, MENUALIGN_CENTER,
},
#endif
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index d099a9d3..5c4ffbf8 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -1,11 +1,4 @@
-#pragma warning( push )
-#pragma warning( disable : 4005)
-#if defined RW_D3D9 || defined RWLIBS
-#define DIRECTINPUT_VERSION 0x0800
-#include <dinput.h>
-#endif
-#pragma warning( pop )
-
+#define WITHDINPUT
#include "common.h"
#include "crossplatform.h"
#include "platform.h"
@@ -68,7 +61,7 @@ bool CPad::bOldDisplayNoControllerMessage;
bool CPad::m_bMapPadOneToPadTwo;
bool CPad::m_bDebugCamPCOn;
bool CPad::bHasPlayerCheated;
-bool CPad::bInvertLook4Pad = true;
+bool CPad::bInvertLook4Pad;
#ifdef GTA_PS2
unsigned char act_direct[6];
unsigned char act_align[6];
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index a3896ebb..a24185f0 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Collision.h"
+#include "ColModel.h"
enum eWastedBustedState
{
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 19339fb6..8cdc3a66 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -3150,6 +3150,46 @@ CStreaming::LoadSceneCollision(const CVector &pos)
CStreaming::LoadAllRequestedModels(false);
}
+//--LCS: TODO PSP and PS2
+// some things commented out that might be Rsl3D dependent
+void CStreaming::RegisterPointer(void *ptr, int, bool) {}
+RpAtomic *CStreaming::RegisterAtomic(RpAtomic *atomic, void *)
+{
+ return atomic;
+}
+void CStreaming::RegisterClump(RpClump *clump)
+{
+ RpClumpForAllAtomics(clump, RegisterAtomic, nil);
+}
+RpAtomic *CStreaming::RegisterInstance(RpAtomic *atomic, void *)
+{
+// RegisterPointer(&atomic->geometry, 2, true);
+ return atomic;
+}
+void CStreaming::RegisterInstance(RpClump *clump)
+{
+ RpClumpForAllAtomics(clump, RegisterInstance, nil);
+}
+
+void CStreaming::UnregisterPointer(void *ptr, int) {}
+RpAtomic *CStreaming::UnregisterAtomic(RpAtomic *atomic, void *)
+{
+ return atomic;
+}
+void CStreaming::UnregisterClump(RpClump *clump)
+{
+ RpClumpForAllAtomics(clump, UnregisterAtomic, nil);
+}
+RpAtomic *CStreaming::UnregisterInstance(RpAtomic *atomic, void *)
+{
+// UnregisterPointer(&atomic->geometry, 2);
+ return atomic;
+}
+void CStreaming::UnregisterInstance(RpClump *clump)
+{
+ RpClumpForAllAtomics(clump, UnregisterInstance, nil);
+}
+
void
CStreaming::MemoryCardSave(uint8 *buf, uint32 *size)
{
diff --git a/src/core/Streaming.h b/src/core/Streaming.h
index 66262721..4b9502e9 100644
--- a/src/core/Streaming.h
+++ b/src/core/Streaming.h
@@ -20,6 +20,7 @@ enum StreamFlags
STREAMFLAGS_40 = 0x40, // TODO(LCS): what's this
STREAMFLAGS_AMBIENT_SCRIPT_OWNED = 0x80,
+ // TODO(LCS): STREAMFLAGS_AMBIENT_SCRIPT_OWNED in STREAMFLAGS_CANT_REMOVE? check CColStore
STREAMFLAGS_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED,
STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY,
};
@@ -209,6 +210,17 @@ public:
static void LoadScene(const CVector &pos);
static void LoadSceneCollision(const CVector &pos);
+ static void RegisterPointer(void *ptr, int, bool);
+ static RpAtomic *RegisterAtomic(RpAtomic *atomic, void *);
+ static void RegisterClump(RpClump *clump);
+ static RpAtomic *RegisterInstance(RpAtomic *atomic, void *);
+ static void RegisterInstance(RpClump *clump);
+ static void UnregisterPointer(void *ptr, int);
+ static RpAtomic *UnregisterAtomic(RpAtomic *atomic, void *);
+ static void UnregisterClump(RpClump *clump);
+ static RpAtomic *UnregisterInstance(RpAtomic *atomic, void *);
+ static void UnregisterInstance(RpClump *clump);
+
static void MemoryCardSave(uint8 *buffer, uint32 *length);
static void MemoryCardLoad(uint8 *buffer, uint32 length);
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 14624f97..eccbcd89 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -4,7 +4,6 @@
#include "CopPed.h"
#include "CutsceneMgr.h"
#include "DMAudio.h"
-#include "Entity.h"
#include "EventList.h"
#include "Explosion.h"
#include "Fire.h"
@@ -12,11 +11,8 @@
#include "Glass.h"
#include "Messages.h"
#include "ModelIndices.h"
-#include "Object.h"
#include "ParticleObject.h"
-#include "Ped.h"
#include "Pickups.h"
-#include "PlayerPed.h"
#include "Population.h"
#include "ProjectileInfo.h"
#include "Record.h"
@@ -25,7 +21,6 @@
#include "RpAnimBlend.h"
#include "Shadows.h"
#include "TempColModels.h"
-#include "Vehicle.h"
#include "WaterLevel.h"
#include "World.h"
@@ -1793,56 +1788,35 @@ void
CWorld::RepositionOneObject(CEntity *pEntity)
{
int16 modelId = pEntity->GetModelIndex();
- if (modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN ||
- modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE ||
- modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
- modelId == MI_PHONESIGN || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
- modelId == MI_PARKTABLE || modelId == MI_PARKINGMETER2 || modelId == MI_TELPOLE02 ||
- modelId == MI_PARKBENCH || modelId == MI_BARRIER1 || IsTreeModel(modelId)
- ) {
+ if (IsLightThatNeedsRepositioning(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
+ modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
+ modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
+ modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
+ modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 ||
+ modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 ||
+ modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
+ modelId == MI_PARKTABLE) {
CVector& position = pEntity->GetMatrix().GetPosition();
- CColModel* pColModel = pEntity->GetColModel();
- float fBoundingBoxMinZ = pColModel->boundingBox.min.z;
- float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
- if (fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z;
+ float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
position.z = FindGroundZFor3DCoord(position.x, position.y,
- position.z + fHeight, nil) -
- fBoundingBoxMinZ;
+ position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
+ fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW();
pEntity->UpdateRwFrame();
- } else if(IsLightThatNeedsRepositioning(modelId)) {
- CVector position = pEntity->GetMatrix().GetPosition();
- CColModel* pColModel = pEntity->GetColModel();
- float fBoundingBoxMinZ = pColModel->boundingBox.min.z;
- float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
- if (fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z;
- if (pColModel->numBoxes == 1)
- position = pEntity->GetMatrix() * CVector(
- (pColModel->boxes[0].min.x + pColModel->boxes[0].max.x) / 2,
- (pColModel->boxes[0].min.y + pColModel->boxes[0].max.y) / 2,
- pColModel->boxes[0].min.z);
- else if (pColModel->numSpheres > 0) {
- position.z = 1000.0f;
- for (int i = 0; i < pColModel->numSpheres; i++) {
- if (pColModel->spheres[i].center.z < position.z)
- position = pColModel->spheres[i].center;
- }
- if (position.z < 1000.0f)
- position = pEntity->GetMatrix() * position;
- }
- pEntity->GetMatrix().GetPosition().z = FindGroundZFor3DCoord(position.x, position.y, pEntity->GetMatrix().GetPosition().z + fHeight, nil) - fBoundingBoxMinZ;
- pEntity->GetMatrix().UpdateRW();
- pEntity->UpdateRwFrame();
-
- }
- if(modelId == MI_BUOY) {
+ } else if(modelId == MI_BUOY) {
+ float fWaterLevel = 0.0f;
bool bFound = true;
const CVector &position = pEntity->GetPosition();
float fGroundZ = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound);
- CColModel *pColModel = pEntity->GetColModel();
- float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
- pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + 6.0f - 0.5f * fHeight;
+ if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z,
+ &fWaterLevel)) {
+ if(!bFound || fWaterLevel > fGroundZ) {
+ CColModel *pColModel = pEntity->GetColModel();
+ float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
+ pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
+ }
+ }
}
}
diff --git a/src/core/World.h b/src/core/World.h
index 4cc9398e..b75b6a6c 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -3,6 +3,7 @@
#include "Game.h"
#include "Lists.h"
#include "PlayerInfo.h"
+#include "Collision.h"
/* Sectors span from -2000 to 2000 in x and y.
* With 100x100 sectors, each is 40x40 units. */
@@ -48,11 +49,6 @@ public:
VALIDATE_SIZE(CSector, 0x28);
-class CEntity;
-struct CColPoint;
-struct CColLine;
-struct CStoredCollPoly;
-
class CWorld
{
static CPtrList ms_bigBuildingsList[NUM_LEVELS];
diff --git a/src/core/Zones.h b/src/core/Zones.h
index 5306d9f1..b987f009 100644
--- a/src/core/Zones.h
+++ b/src/core/Zones.h
@@ -103,8 +103,8 @@ public:
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
static int16 FindAudioZone(CVector *pos);
- static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &NavigationZoneArray[i]; }
- static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; }
+ static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &NavigationZoneArray[i]; }
+ static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; }
static void AddZoneToAudioZoneArray(CZone *zone);
static void InitialiseAudioZoneArray(void);
static void SaveAllZones(uint8 *buffer, uint32 *length);
diff --git a/src/core/common.h b/src/core/common.h
index ace15ee1..e1d64523 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -11,17 +11,34 @@
#include <string.h>
#include <math.h>
-#if defined _WIN32 && defined WITHWINDOWS
-#include <windows.h>
+#if !defined RW_D3D9 && defined LIBRW
+#undef WITHD3D
+#undef WITHDINPUT
+#endif
+
+#if (defined WITHD3D && !defined LIBRW)
+#define WITHWINDOWS
#endif
-#if defined _WIN32 && defined WITHD3D
+#if defined _WIN32 && defined WITHWINDOWS && !defined _INC_WINDOWS
#include <windows.h>
-#ifndef USE_D3D9
-#include <d3d8types.h>
-#else
-#include <d3d9types.h>
#endif
+
+#ifdef WITHD3D
+ #ifdef LIBRW
+ #define WITH_D3D // librw includes d3d9 itself via this right now
+ #else
+ #ifndef USE_D3D9
+ #include <d3d8types.h>
+ #else
+ #include <d3d9types.h>
+ #endif
+ #endif
+#endif
+
+#ifdef WITHDINPUT
+#define DIRECTINPUT_VERSION 0x0800
+#include <dinput.h>
#endif
#include <rwcore.h>
@@ -52,14 +69,6 @@
#define rwVENDORID_ROCKSTAR 0x0253F2
-// Get rid of bullshit windows definitions, we're not running on an 8086
-#ifdef far
-#undef far
-#endif
-#ifdef near
-#undef near
-#endif
-
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define Min(a,b) ((a) < (b) ? (a) : (b))
@@ -191,6 +200,18 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
#endif
+// these are temp marcos while we don't implement all PSP UI coordinates
+#define PSP_DEFAULT_SCREEN_WIDTH (480)
+#define PSP_DEFAULT_SCREEN_HEIGHT (272)
+
+#define PSP_SCALE_TO_PS2_X(a) (a * ((float)DEFAULT_SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH))
+#define PSP_SCALE_TO_PS2_Y(a) (a * ((float)DEFAULT_SCREEN_HEIGHT / PSP_DEFAULT_SCREEN_HEIGHT))
+
+#define PSP_SCREEN_SCALE_X(a) SCREEN_STRETCH_X(PSP_SCALE_TO_PS2_X(a))
+#define PSP_SCREEN_SCALE_Y(a) SCREEN_STRETCH_Y(PSP_SCALE_TO_PS2_Y(a))
+#define PSP_SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - PSP_SCREEN_SCALE_X(a))
+#define PSP_SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - PSP_SCREEN_SCALE_Y(a))
+
#include "maths.h"
#include "Vector.h"
#include "Vector2D.h"
diff --git a/src/core/config.h b/src/core/config.h
index 07773543..2685c687 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -198,7 +198,7 @@ enum Config {
//#define ANIM_COMPRESSION // only keep most recently used anims uncompressed
#define GTA_TRAIN
-//#define GTA_BRIDGE
+#define GTA_BRIDGE
#if defined GTA_PS2
# define GTA_PS2_STUFF
diff --git a/src/core/main.h b/src/core/main.h
index 0f9ceb08..38dce115 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -49,8 +49,10 @@ void TheModelViewer(void);
#endif
#ifdef LOAD_INI_SETTINGS
-void LoadINISettings();
+bool LoadINISettings();
void SaveINISettings();
+void LoadINIControllerSettings();
+void SaveINIControllerSettings();
#endif
#ifdef NEW_RENDERER
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index cc3e93cb..ace15502 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -1,7 +1,6 @@
#include <csignal>
#define WITHWINDOWS
#include "common.h"
-#include "crossplatform.h"
#include "Renderer.h"
#include "Occlusion.h"
#include "Credits.h"
@@ -34,9 +33,12 @@
#include "custompipes.h"
#include "MemoryHeap.h"
#include "FileMgr.h"
+#include "Camera.h"
+#include "MBlur.h"
+#include "ControllerConfig.h"
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
-#include "ControllerConfig.h"
+#include "crossplatform.h"
#endif
#ifndef _WIN32
@@ -95,16 +97,14 @@ CustomFrontendOptionsPopulate(void)
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
- FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
- FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
- FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
+ FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
+ FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
#else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
- FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
- FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
- FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
+ FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
+ FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
#endif
CFileMgr::CloseFile(fd);
}
@@ -117,172 +117,410 @@ CustomFrontendOptionsPopulate(void)
#include "ini_parser.hpp"
linb::ini cfg;
-int CheckAndReadIniInt(const char *cat, const char *key, int original)
+bool ReadIniIfExists(const char *cat, const char *key, uint32 *out)
+{
+ std::string strval = cfg.get(cat, key, "\xBA");
+ const char *value = strval.c_str();
+ char *endPtr;
+ if (value && value[0] != '\xBA') {
+ *out = strtoul(value, &endPtr, 0);
+ return true;
+ }
+ return false;
+}
+
+bool ReadIniIfExists(const char *cat, const char *key, bool *out)
+{
+ std::string strval = cfg.get(cat, key, "\xBA");
+ const char *value = strval.c_str();
+ char *endPtr;
+ if (value && value[0] != '\xBA') {
+ *out = strtoul(value, &endPtr, 0);
+ return true;
+ }
+ return false;
+}
+
+bool ReadIniIfExists(const char *cat, const char *key, int32 *out)
{
- std::string strval = cfg.get(cat, key, "");
+ std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
- if (value && value[0] != '\0')
- return atoi(value);
+ char *endPtr;
+ if (value && value[0] != '\xBA') {
+ *out = strtol(value, &endPtr, 0);
+ return true;
+ }
+ return false;
+}
- return original;
+bool ReadIniIfExists(const char *cat, const char *key, int8 *out)
+{
+ std::string strval = cfg.get(cat, key, "\xBA");
+ const char *value = strval.c_str();
+ char *endPtr;
+ if (value && value[0] != '\xBA') {
+ *out = strtol(value, &endPtr, 0);
+ return true;
+ }
+ return false;
}
-float CheckAndReadIniFloat(const char *cat, const char *key, float original)
+bool ReadIniIfExists(const char *cat, const char *key, float *out)
{
- std::string strval = cfg.get(cat, key, "");
+ std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
- if (value && value[0] != '\0')
- return atof(value);
+ if (value && value[0] != '\xBA') {
+ *out = atof(value);
+ return true;
+ }
+ return false;
+}
- return original;
+bool ReadIniIfExists(const char *cat, const char *key, char *out, int size)
+{
+ std::string strval = cfg.get(cat, key, "\xBA");
+ const char *value = strval.c_str();
+ if (value && value[0] != '\xBA') {
+ strncpy(out, value, size);
+ return true;
+ }
+ return false;
}
-void CheckAndSaveIniInt(const char *cat, const char *key, int val, bool &changed)
+void StoreIni(const char *cat, const char *key, uint32 val)
{
char temp[10];
- if (atoi(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
- changed = true;
- sprintf(temp, "%u", val);
- cfg.set(cat, key, temp);
- }
+sprintf(temp, "%u", val);
+ cfg.set(cat, key, temp);
}
-void CheckAndSaveIniFloat(const char *cat, const char *key, float val, bool &changed)
+void StoreIni(const char *cat, const char *key, uint8 val)
{
char temp[10];
- if (atof(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
- changed = true;
- sprintf(temp, "%f", val);
- cfg.set(cat, key, temp);
- }
+ sprintf(temp, "%u", (uint32)val);
+ cfg.set(cat, key, temp);
}
-void LoadINISettings()
+void StoreIni(const char *cat, const char *key, int32 val)
{
- cfg.load_file("reLCS.ini");
+ char temp[10];
+ sprintf(temp, "%d", val);
+ cfg.set(cat, key, temp);
+}
+void StoreIni(const char *cat, const char *key, int8 val)
+{
+ char temp[10];
+ sprintf(temp, "%d", (int32)val);
+ cfg.set(cat, key, temp);
+}
+
+void StoreIni(const char *cat, const char *key, float val)
+{
+ char temp[10];
+ sprintf(temp, "%f", val);
+ cfg.set(cat, key, temp);
+}
+
+void StoreIni(const char *cat, const char *key, char *val, int size)
+{
+ cfg.set(cat, key, val);
+}
+
+const char *iniControllerActions[] = { "PED_FIREWEAPON", "PED_CYCLE_WEAPON_RIGHT", "PED_CYCLE_WEAPON_LEFT", "GO_FORWARD", "GO_BACK", "GO_LEFT", "GO_RIGHT", "PED_SNIPER_ZOOM_IN",
+ "PED_SNIPER_ZOOM_OUT", "VEHICLE_ENTER_EXIT", "CAMERA_CHANGE_VIEW_ALL_SITUATIONS", "PED_JUMPING", "PED_SPRINT", "PED_LOOKBEHIND", "PED_DUCK", "PED_ANSWER_PHONE",
+#ifdef BIND_VEHICLE_FIREWEAPON
+ "VEHICLE_FIREWEAPON",
+#endif
+ "VEHICLE_ACCELERATE", "VEHICLE_BRAKE", "VEHICLE_CHANGE_RADIO_STATION", "VEHICLE_HORN", "TOGGLE_SUBMISSIONS", "VEHICLE_HANDBRAKE", "PED_1RST_PERSON_LOOK_LEFT",
+ "PED_1RST_PERSON_LOOK_RIGHT", "VEHICLE_LOOKLEFT", "VEHICLE_LOOKRIGHT", "VEHICLE_LOOKBEHIND", "VEHICLE_TURRETLEFT", "VEHICLE_TURRETRIGHT", "VEHICLE_TURRETUP", "VEHICLE_TURRETDOWN",
+ "PED_CYCLE_TARGET_LEFT", "PED_CYCLE_TARGET_RIGHT", "PED_CENTER_CAMERA_BEHIND_PLAYER", "PED_LOCK_TARGET", "NETWORK_TALK", "PED_1RST_PERSON_LOOK_UP", "PED_1RST_PERSON_LOOK_DOWN",
+ "_CONTROLLERACTION_36", "TOGGLE_DPAD", "SWITCH_DEBUG_CAM_ON", "TAKE_SCREEN_SHOT", "SHOW_MOUSE_POINTER_TOGGLE", "UNKNOWN_ACTION" };
+
+const char *iniControllerTypes[] = { "kbd:", "2ndKbd:", "mouse:", "joy:" };
+
+const char *iniMouseButtons[] = {"LEFT","MIDDLE","RIGHT","WHLUP","WHLDOWN","X1","X2"};
+
+const char *iniKeyboardButtons[] = {"ESC","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12",
+ "INS","DEL","HOME","END","PGUP","PGDN","UP","DOWN","LEFT","RIGHT","DIVIDE","TIMES","PLUS","MINUS","PADDEL",
+ "PADEND","PADDOWN","PADPGDN","PADLEFT","PAD5","NUMLOCK","PADRIGHT","PADHOME","PADUP","PADPGUP","PADINS",
+ "PADENTER", "SCROLL","PAUSE","BACKSP","TAB","CAPSLK","ENTER","LSHIFT","RSHIFT","SHIFT","LCTRL","RCTRL","LALT",
+ "RALT", "LWIN", "RWIN", "APPS", "NULL"};
+
+void LoadINIControllerSettings()
+{
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
- // Written by assuming the codes below will run after _InputInitialiseJoys().
- strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str());
-
- if(gSelectedJoystickName[0] != '\0') {
- for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
- if (glfwJoystickPresent(i) && strncmp(gSelectedJoystickName, glfwGetJoystickName(i), strlen(gSelectedJoystickName)) == 0) {
- if (PSGLOBAL(joy1id) != -1) {
- PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
+ ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
+#endif
+ // force to default GTA behaviour (never overwrite bindings on joy change/initialization) if user init'ed/set bindings before we introduced that
+ if (!ReadIniIfExists("Controller", "PadButtonsInited", &ControlsManager.ms_padButtonsInited)) {
+ ControlsManager.ms_padButtonsInited = cfg.category_size("Bindings") != 0 ? 16 : 0;
+ }
+
+ for (int32 i = 0; i < MAX_CONTROLLERACTIONS; i++) {
+ char value[128];
+ if (ReadIniIfExists("Bindings", iniControllerActions[i], value, 128)) {
+ for (int32 j = 0; j < MAX_CONTROLLERTYPES; j++){
+ ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)i, (eControllerType)j);
+ }
+
+ for (char *binding = strtok(value,", "); binding != nil; binding = strtok(nil, ", ")) {
+ int contType = -1;
+ for (int32 k = 0; k < ARRAY_SIZE(iniControllerTypes); k++) {
+ int len = strlen(iniControllerTypes[k]);
+ if (strncmp(binding, iniControllerTypes[k], len) == 0) {
+ contType = k;
+ binding += len;
+ break;
+ }
}
- PSGLOBAL(joy1id) = i;
- int count;
- glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
-
- // We need to init and reload bindings, because;
- // 1-joypad button number may differ with saved/prvly connected one
- // 2-bindings are not init'ed if there is no joypad at the start
- ControlsManager.InitDefaultControlConfigJoyPad(count);
- CFileMgr::SetDirMyDocuments();
- int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
- if (gta3set) {
- ControlsManager.LoadSettings(gta3set);
- CFileMgr::CloseFile(gta3set);
+ if (contType == -1)
+ continue;
+
+ int contKey;
+ if (contType == JOYSTICK) {
+ char *temp;
+ contKey = strtol(binding, &temp, 0);
+
+ } else if (contType == KEYBOARD || contType == OPTIONAL_EXTRA) {
+ if (strlen(binding) == 1) {
+ contKey = binding[0];
+ } else if(strcmp(binding, "SPC") == 0) {
+ contKey = ' ';
+ } else {
+ for (int32 k = 0; k < ARRAY_SIZE(iniKeyboardButtons); k++) {
+ if(strcmp(binding, iniKeyboardButtons[k]) == 0) {
+ contKey = 1000 + k;
+ break;
+ }
+ }
+ }
+ } else if (contType == MOUSE) {
+ for (int32 k = 0; k < ARRAY_SIZE(iniMouseButtons); k++) {
+ if(strcmp(binding, iniMouseButtons[k]) == 0) {
+ contKey = 1 + k;
+ break;
+ }
+ }
}
- CFileMgr::SetDir("");
- break;
+
+ ControlsManager.SetControllerKeyAssociatedWithAction((e_ControllerAction)i, contKey, (eControllerType)contType);
}
}
}
-#endif
+}
-#ifdef CUSTOM_FRONTEND_OPTIONS
- for (int i = 0; i < MENUPAGES; i++) {
- for (int j = 0; j < NUM_MENUROWS; j++) {
- CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
- if (option.m_Action == MENUACTION_NOTHING)
- break;
-
- // CFO check
- if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
- // CFO only supports saving uint8 right now
- *option.m_CFO->value = CheckAndReadIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value);
- if (option.m_Action == MENUACTION_CFO_SELECT) {
- option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
+void SaveINIControllerSettings()
+{
+ for (int32 i = 0; i < MAX_CONTROLLERACTIONS; i++) {
+ char value[128] = { '\0' };
+
+ // upper limit should've been GetNumOfSettingsForAction(i), but sadly even R* doesn't use it's own system correctly, and there are gaps between orders.
+ for (int32 j = SETORDER_1; j < MAX_SETORDERS; j++){
+
+ // We respect the m_ContSetOrder, and join/implode/order the bindings according to that; using comma as seperator.
+ for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++){
+ if (ControlsManager.m_aSettings[i][k].m_ContSetOrder == j) {
+ char next[32];
+ if (k == JOYSTICK) {
+ snprintf(next, 32, "%s%d,", iniControllerTypes[k], ControlsManager.m_aSettings[i][k].m_Key);
+
+ } else if (k == KEYBOARD || k == OPTIONAL_EXTRA) {
+ if (ControlsManager.m_aSettings[i][k].m_Key == ' ')
+ snprintf(next, 32, "%sSPC,", iniControllerTypes[k]);
+ else if (ControlsManager.m_aSettings[i][k].m_Key < 256)
+ snprintf(next, 32, "%s%c,", iniControllerTypes[k], ControlsManager.m_aSettings[i][k].m_Key);
+ else
+ snprintf(next, 32, "%s%s,", iniControllerTypes[k], iniKeyboardButtons[ControlsManager.m_aSettings[i][k].m_Key - 1000]);
+
+ } else if (k == MOUSE) {
+ snprintf(next, 32, "%s%s,", iniControllerTypes[k], iniMouseButtons[ControlsManager.m_aSettings[i][k].m_Key - 1]);
+ }
+ strcat(value, next);
+ break;
}
}
}
+ int len = strlen(value);
+ if (len > 0)
+ value[len - 1] = '\0'; // to remove comma
+
+ StoreIni("Bindings", iniControllerActions[i], value, 128);
}
+
+#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
+ StoreIni("Controller", "JoystickName", gSelectedJoystickName, 128);
#endif
+ StoreIni("Controller", "PadButtonsInited", ControlsManager.ms_padButtonsInited);
+ cfg.write_file("reLCS.ini");
+}
+
+bool LoadINISettings()
+{
+ if (!cfg.load_file("reLCS.ini"))
+ return false;
+
+#ifdef IMPROVED_VIDEOMODE
+ ReadIniIfExists("VideoMode", "Width", &FrontEndMenuManager.m_nPrefsWidth);
+ ReadIniIfExists("VideoMode", "Height", &FrontEndMenuManager.m_nPrefsHeight);
+ ReadIniIfExists("VideoMode", "Depth", &FrontEndMenuManager.m_nPrefsDepth);
+ ReadIniIfExists("VideoMode", "Subsystem", &FrontEndMenuManager.m_nPrefsSubsystem);
+ // Windowed mode is loaded below in CUSTOM_FRONTEND_OPTIONS section
+#else
+ ReadIniIfExists("Graphics", "VideoMode", &FrontEndMenuManager.m_nDisplayVideoMode);
+#endif
+ ReadIniIfExists("Controller", "HeadBob1stPerson", &TheCamera.m_bHeadBob);
+ ReadIniIfExists("Controller", "HorizantalMouseSens", &TheCamera.m_fMouseAccelHorzntl);
+ ReadIniIfExists("Controller", "InvertMouseVertically", &MousePointerStateHelper.bInvertVertically);
+ ReadIniIfExists("Controller", "DisableMouseSteering", &CVehicle::m_bDisableMouseSteering);
+ ReadIniIfExists("Audio", "SfxVolume", &FrontEndMenuManager.m_PrefsSfxVolume);
+ ReadIniIfExists("Audio", "MusicVolume", &FrontEndMenuManager.m_PrefsMusicVolume);
+ ReadIniIfExists("Audio", "MP3BoostVolume", &FrontEndMenuManager.m_PrefsMP3BoostVolume);
+ ReadIniIfExists("Audio", "Radio", &FrontEndMenuManager.m_PrefsRadioStation);
+ ReadIniIfExists("Audio", "SpeakerType", &FrontEndMenuManager.m_PrefsSpeakers);
+ ReadIniIfExists("Audio", "Provider", &FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
+ ReadIniIfExists("Audio", "DynamicAcoustics", &FrontEndMenuManager.m_PrefsDMA);
+ ReadIniIfExists("Display", "Brightness", &FrontEndMenuManager.m_PrefsBrightness);
+ ReadIniIfExists("Display", "DrawDistance", &FrontEndMenuManager.m_PrefsLOD);
+ ReadIniIfExists("Display", "Subtitles", &FrontEndMenuManager.m_PrefsShowSubtitles);
+ ReadIniIfExists("Graphics", "AspectRatio", &FrontEndMenuManager.m_PrefsUseWideScreen);
+ ReadIniIfExists("Graphics", "FrameLimiter", &FrontEndMenuManager.m_PrefsFrameLimiter);
+#ifdef LEGACY_MENU_OPTIONS
+ ReadIniIfExists("Graphics", "VSync", &FrontEndMenuManager.m_PrefsVsyncDisp);
+ ReadIniIfExists("Graphics", "Trails", &CMBlur::BlurOn);
+#endif
+ ReadIniIfExists("General", "SkinFile", FrontEndMenuManager.m_PrefsSkinFile, 256);
+ ReadIniIfExists("Controller", "Method", &FrontEndMenuManager.m_ControlMethod);
+ ReadIniIfExists("General", "Language", &FrontEndMenuManager.m_PrefsLanguage);
+ ReadIniIfExists("Display", "ShowHud", &FrontEndMenuManager.m_PrefsShowHud);
+ ReadIniIfExists("Display", "RadarMode", &FrontEndMenuManager.m_PrefsRadarMode);
+ ReadIniIfExists("Display", "ShowLegends", &FrontEndMenuManager.m_PrefsShowLegends);
#ifdef EXTENDED_COLOURFILTER
- CPostFX::Intensity = CheckAndReadIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
+ ReadIniIfExists("CustomPipesValues", "PostFXIntensity", &CPostFX::Intensity);
#endif
#ifdef EXTENDED_PIPELINES
- CustomPipes::VehicleShininess = CheckAndReadIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess);
- CustomPipes::VehicleSpecularity = CheckAndReadIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity);
- CustomPipes::RimlightMult = CheckAndReadIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult);
- CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
- CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
+ ReadIniIfExists("CustomPipesValues", "NeoVehicleShininess", &CustomPipes::VehicleShininess);
+ ReadIniIfExists("CustomPipesValues", "NeoVehicleSpecularity", &CustomPipes::VehicleSpecularity);
+ ReadIniIfExists("CustomPipesValues", "RimlightMult", &CustomPipes::RimlightMult);
+ ReadIniIfExists("CustomPipesValues", "LightmapMult", &CustomPipes::LightmapMult);
+ ReadIniIfExists("CustomPipesValues", "GlossMult", &CustomPipes::GlossMult);
#endif
- gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling);
-
+
#ifdef PROPER_SCALING
- CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling);
+ ReadIniIfExists("Draw", "ProperScaling", &CDraw::ms_bProperScaling);
#endif
#ifdef FIX_RADAR
- CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar);
+ ReadIniIfExists("Draw", "FixRadar", &CDraw::ms_bFixRadar);
#endif
#ifdef FIX_SPRITES
- CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites);
+ ReadIniIfExists("Draw", "FixSprites", &CDraw::ms_bFixSprites);
#endif
-}
-
-void SaveINISettings()
-{
- bool changed = false;
-#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
- if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) {
- changed = true;
- cfg.set("DetectJoystick", "JoystickName", gSelectedJoystickName);
- }
-#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
+ bool migrate = cfg.category_size("FrontendOptions") != 0;
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
if (option.m_Action == MENUACTION_NOTHING)
break;
+ // CFO check
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
- // Beware: CFO only supports saving uint8 right now
- CheckAndSaveIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value, changed);
+ // CFO only supports saving uint8 right now
+
+ // Migrate from old .ini to new .ini
+ if (migrate && ReadIniIfExists("FrontendOptions", option.m_CFO->save, option.m_CFO->value))
+ cfg.remove("FrontendOptions", option.m_CFO->save);
+ else
+ ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, option.m_CFO->value);
+
+ if (option.m_Action == MENUACTION_CFO_SELECT) {
+ option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
+ }
}
}
}
#endif
+ return true;
+}
+
+void SaveINISettings()
+{
+#ifdef IMPROVED_VIDEOMODE
+ StoreIni("VideoMode", "Width", FrontEndMenuManager.m_nPrefsWidth);
+ StoreIni("VideoMode", "Height", FrontEndMenuManager.m_nPrefsHeight);
+ StoreIni("VideoMode", "Depth", FrontEndMenuManager.m_nPrefsDepth);
+ StoreIni("VideoMode", "Subsystem", FrontEndMenuManager.m_nPrefsSubsystem);
+ // Windowed mode is loaded below in CUSTOM_FRONTEND_OPTIONS section
+#else
+ StoreIni("Graphics", "VideoMode", FrontEndMenuManager.m_nDisplayVideoMode);
+#endif
+ StoreIni("Controller", "HeadBob1stPerson", TheCamera.m_bHeadBob);
+ StoreIni("Controller", "HorizantalMouseSens", TheCamera.m_fMouseAccelHorzntl);
+ StoreIni("Controller", "InvertMouseVertically", MousePointerStateHelper.bInvertVertically);
+ StoreIni("Controller", "DisableMouseSteering", CVehicle::m_bDisableMouseSteering);
+ StoreIni("Audio", "SfxVolume", FrontEndMenuManager.m_PrefsSfxVolume);
+ StoreIni("Audio", "MusicVolume", FrontEndMenuManager.m_PrefsMusicVolume);
+ StoreIni("Audio", "MP3BoostVolume", FrontEndMenuManager.m_PrefsMP3BoostVolume);
+ StoreIni("Audio", "Radio", FrontEndMenuManager.m_PrefsRadioStation);
+ StoreIni("Audio", "SpeakerType", FrontEndMenuManager.m_PrefsSpeakers);
+ StoreIni("Audio", "Provider", FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
+ StoreIni("Audio", "DynamicAcoustics", FrontEndMenuManager.m_PrefsDMA);
+ StoreIni("Display", "Brightness", FrontEndMenuManager.m_PrefsBrightness);
+ StoreIni("Display", "DrawDistance", FrontEndMenuManager.m_PrefsLOD);
+ StoreIni("Display", "Subtitles", FrontEndMenuManager.m_PrefsShowSubtitles);
+ StoreIni("Graphics", "AspectRatio", FrontEndMenuManager.m_PrefsUseWideScreen);
+#ifdef LEGACY_MENU_OPTIONS
+ StoreIni("Graphics", "VSync", FrontEndMenuManager.m_PrefsVsyncDisp);
+ StoreIni("Graphics", "Trails", CMBlur::BlurOn);
+#endif
+ StoreIni("Graphics", "FrameLimiter", FrontEndMenuManager.m_PrefsFrameLimiter);
+ StoreIni("General", "SkinFile", FrontEndMenuManager.m_PrefsSkinFile, 256);
+ StoreIni("Controller", "Method", FrontEndMenuManager.m_ControlMethod);
+ StoreIni("General", "Language", FrontEndMenuManager.m_PrefsLanguage);
+ StoreIni("Display", "ShowHud", FrontEndMenuManager.m_PrefsShowHud);
+ StoreIni("Display", "RadarMode", FrontEndMenuManager.m_PrefsRadarMode);
+ StoreIni("Display", "ShowLegends", FrontEndMenuManager.m_PrefsShowLegends);
+
#ifdef EXTENDED_COLOURFILTER
- CheckAndSaveIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity, changed);
+ StoreIni("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
#endif
#ifdef EXTENDED_PIPELINES
- CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess, changed);
- CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity, changed);
- CheckAndSaveIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult, changed);
- CheckAndSaveIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult, changed);
- CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed);
+ StoreIni("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess);
+ StoreIni("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity);
+ StoreIni("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult);
+ StoreIni("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
+ StoreIni("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
#endif
- CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed);
+ StoreIni("Rendering", "BackfaceCulling", gBackfaceCulling);
#ifdef PROPER_SCALING
- CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed);
+ StoreIni("Draw", "ProperScaling", CDraw::ms_bProperScaling);
#endif
#ifdef FIX_RADAR
- CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed);
+ StoreIni("Draw", "FixRadar", CDraw::ms_bFixRadar);
#endif
#ifdef FIX_SPRITES
- CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed);
+ StoreIni("Draw", "FixSprites", CDraw::ms_bFixSprites);
+#endif
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ for (int i = 0; i < MENUPAGES; i++) {
+ for (int j = 0; j < NUM_MENUROWS; j++) {
+ CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
+ if (option.m_Action == MENUACTION_NOTHING)
+ break;
+
+ if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
+ // Beware: CFO only supports saving uint8 right now
+ StoreIni(option.m_CFO->saveCat, option.m_CFO->save, *option.m_CFO->value);
+ }
+ }
+ }
#endif
- if (changed)
- cfg.write_file("reLCS.ini");
+ cfg.write_file("reLCS.ini");
}
#endif
@@ -767,7 +1005,7 @@ extern bool gbRenderDebugEnvMap;
"A Date with Death (Toshiko Kasen)", "Cash in Kazuki's Chips (Toshiko Kasen)"
};
- missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, 96, missions);
+ missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions);
DebugMenuEntrySetWrap(missionEntry, true);
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
#endif
diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp
index 247aa4b1..390ec475 100644
--- a/src/extras/custompipes.cpp
+++ b/src/extras/custompipes.cpp
@@ -1,4 +1,4 @@
-#define WITH_D3D
+#define WITHD3D
#include "common.h"
#ifdef EXTENDED_PIPELINES
diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp
index 551d1a74..68337fb6 100644
--- a/src/extras/custompipes_d3d9.cpp
+++ b/src/extras/custompipes_d3d9.cpp
@@ -1,4 +1,4 @@
-#define WITH_D3D
+#define WITHD3D
#include "common.h"
#ifdef RW_D3D9
diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp
index 8a95a49a..2660e75e 100644
--- a/src/extras/frontendoption.cpp
+++ b/src/extras/frontendoption.cpp
@@ -111,7 +111,7 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint
option.m_TargetMenu = targetMenu;
}
-void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName, bool disableIfGameLoaded)
+void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveCat, const char* saveName, bool disableIfGameLoaded)
{
int8 screenOptionOrder = RegisterNewOption();
@@ -130,13 +130,14 @@ void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align
option.m_CFOSelect->displayedValue = *var;
option.m_CFOSelect->lastSavedValue = *var;
}
+ option.m_CFOSelect->saveCat = saveCat;
option.m_CFOSelect->save = saveName;
option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter;
option.m_CFOSelect->changeFunc = changeFunc;
option.m_CFOSelect->disableIfGameLoaded = disableIfGameLoaded;
}
-void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName)
+void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat, const char* saveName)
{
int8 screenOptionOrder = RegisterNewOption();
@@ -150,6 +151,7 @@ void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 alig
option.m_CFODynamic->drawFunc = drawFunc;
option.m_CFODynamic->buttonPressFunc = buttonPressFunc;
option.m_CFODynamic->value = var;
+ option.m_CFODynamic->saveCat = saveCat;
option.m_CFODynamic->save = saveName;
}
diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h
index 2719f076..05cd5fa0 100644
--- a/src/extras/frontendoption.h
+++ b/src/extras/frontendoption.h
@@ -76,10 +76,10 @@ uint8 GetNumberOfMenuOptions(int screen);
void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false);
-// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0
+// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveCat and saveKey param. obv), otherwise pass nil/0
void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint8 align, int action, int targetMenu = MENUPAGE_NONE, int saveSlot = SAVESLOT_NONE);
-void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName = nil, bool disableIfGameLoaded = false);
-void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName = nil);
+void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveCat = nil, const char* saveKey = nil, bool disableIfGameLoaded = false);
+void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat = nil, const char* saveKey = nil);
// lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT
uint8 FrontendScreenAdd(const char* gxtKey, int prevPage, int lineHeight, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil);
diff --git a/src/extras/ini_parser.hpp b/src/extras/ini_parser.hpp
index 8e88bc29..7bea024c 100644
--- a/src/extras/ini_parser.hpp
+++ b/src/extras/ini_parser.hpp
@@ -158,6 +158,25 @@ namespace linb
/* Too lazy to continue this container... If you need more methods, just add it */
+ // re3
+ void remove(const string_type& sect, const key_type& key)
+ {
+ auto it = this->find(sect);
+ if(it != this->end())
+ {
+ it->second.erase(key);
+ }
+ }
+
+ int category_size(const string_type& sect)
+ {
+ auto it = this->find(sect);
+ if(it != this->end())
+ {
+ return it->second.size();
+ }
+ return 0;
+ }
#if 1
bool read_file(const char_type* filename)
diff --git a/src/extras/postfx.cpp b/src/extras/postfx.cpp
index a9e0604b..1ccd8ac5 100644
--- a/src/extras/postfx.cpp
+++ b/src/extras/postfx.cpp
@@ -1,5 +1,4 @@
-#define WITHWINDOWS
-#define WITH_D3D
+#define WITHD3D
#include "common.h"
#ifdef EXTENDED_COLOURFILTER
diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp
index 963b7624..1412141e 100644
--- a/src/extras/screendroplets.cpp
+++ b/src/extras/screendroplets.cpp
@@ -1,4 +1,4 @@
-#define WITH_D3D
+#define WITHD3D
#include "common.h"
#ifdef SCREEN_DROPLETS
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 768c11f4..3d513bbd 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -1,5 +1,5 @@
#define _CRT_SECURE_NO_WARNINGS
-#define WITH_D3D
+#define WITH_D3D // not WITHD3D, so it's librw define
#include <rwcore.h>
#include <rpworld.h>
#include <rpmatfx.h>
diff --git a/src/leeds/base/sList.h b/src/leeds/base/sList.h
new file mode 100644
index 00000000..378d8e31
--- /dev/null
+++ b/src/leeds/base/sList.h
@@ -0,0 +1,35 @@
+#pragma once
+
+namespace base
+{
+
+template<typename T>
+class cSList
+{
+public:
+ struct tSItem
+ {
+ tSItem* next;
+ T item;
+ };
+ // extra field on PS2
+ tSItem* first;
+
+ cSList() { first = nil; }
+ void Insert(tSItem* item) { tSItem* n = first; first = item; item->next = n; }
+ void Remove(tSItem* item) {
+ if (first == item) {
+ first = item->next;
+ return;
+ }
+ tSItem* i = first;
+ while (i && i->next != item)
+ i = i->next;
+ assert(i);
+ i->next = item->next;
+
+ }
+
+};
+
+} \ No newline at end of file
diff --git a/src/leeds/smallHeap.cpp b/src/leeds/smallHeap.cpp
new file mode 100644
index 00000000..262113af
--- /dev/null
+++ b/src/leeds/smallHeap.cpp
@@ -0,0 +1,20 @@
+#include "common.h"
+#include "smallHeap.h"
+
+cSmallHeap cSmallHeap::msInstance;
+
+cSmallHeap::cSmallHeap()
+{
+ bLocked = false;
+ bUnk = false;
+}
+
+void cSmallHeap::Lock()
+{
+ // TODO: PS2 code
+}
+
+void cSmallHeap::Unlock()
+{
+ // TODO: PS2 code
+} \ No newline at end of file
diff --git a/src/leeds/smallHeap.h b/src/leeds/smallHeap.h
new file mode 100644
index 00000000..f2897688
--- /dev/null
+++ b/src/leeds/smallHeap.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "memoryManager.h"
+
+class cSmallHeap : public base::cMemoryManager
+{
+ bool bLocked;
+ bool bUnk;
+public:
+ cSmallHeap();
+ void Lock();
+ void Unlock();
+
+ bool IsLocked() const { return bLocked; }
+
+ static cSmallHeap msInstance;
+}; \ No newline at end of file
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index a93040b1..f3fddf20 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -1,6 +1,6 @@
#pragma once
-#include "Collision.h"
+struct CColModel;
#define MAX_MODEL_NAME (21)
@@ -29,7 +29,9 @@ protected:
uint8 m_type;
uint8 m_num2dEffects;
bool m_bOwnsColModel;
+public: // need this in colstore
CColModel *m_colModel;
+protected:
int16 m_2dEffectsID;
int16 m_objectId;
uint16 m_refCount;
diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp
index 98c7fb38..83539404 100644
--- a/src/modelinfo/ModelIndices.cpp
+++ b/src/modelinfo/ModelIndices.cpp
@@ -2,17 +2,25 @@
#include "General.h"
#include "ModelIndices.h"
+#include "main.h"
-#define X(name, var) int16 var = -1;
+CModelIndices *gpModelIndices;
+
+/*#define X(name, var) int16 var = -1;
MODELINDICES
-#undef X
+#undef X*/
void
InitModelIndices(void)
{
-#define X(name, var) var = -1;
+/*#define X(name, var) var = -1;
MODELINDICES
-#undef X
+#undef X*/
+ if (gMakeResources)
+ {
+ gpModelIndices = new CModelIndices;
+ memset(gpModelIndices, -1, sizeof(CModelIndices));
+ }
}
void
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index 476a2273..cbc4ede8 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -2,8 +2,591 @@
#include "ModelInfo.h"
+struct CModelIndices
+{
+ int16 TRAFFICLIGHTS;
+ int16 TLIGHT_POST;
+ int16 TLIGHT_WALK;
+ int16 TLIGHT_BOX1;
+ int16 TLIGHT_BOX2;
+ int16 TRAFFICLIGHTS_VERTICAL;
+ int16 TRAFFICLIGHTS_MIAMI;
+ int16 TRAFFICLIGHTS_TWOVERTICAL;
+ int16 SINGLESTREETLIGHTS1;
+ int16 SINGLESTREETLIGHTS2;
+ int16 SINGLESTREETLIGHTS3;
+ int16 DOUBLESTREETLIGHTS;
+ int16 STREETLAMP1;
+ int16 STREETLAMP2;
+ int16 ROADSFORROADBLOCKSSTART;
+ int16 ROADSFORROADBLOCKSEND;
+ int16 TREE2;
+ int16 TREE3;
+ int16 TREE6;
+ int16 TREE8;
+ int16 TREE1;
+ int16 TREE4;
+ int16 TREE5;
+ int16 TREE7;
+ int16 TREE9;
+ int16 TREE10;
+ int16 TREE11;
+ int16 TREE12;
+ int16 TREE13;
+ int16 TREE14;
+ int16 CRANE_1;
+ int16 CRANE_2;
+ int16 CRANE_3;
+ int16 CRANE_4;
+ int16 CRANE_5;
+ int16 CRANE_6;
+ int16 PARKINGMETER;
+ int16 PARKINGMETER2;
+ int16 MALLFAN;
+ int16 HOTELFAN_NIGHT;
+ int16 HOTELFAN_DAY;
+ int16 HOTROOMFAN;
+ int16 PHONEBOOTH1;
+ int16 WASTEBIN;
+ int16 BIN;
+ int16 POSTBOX1;
+ int16 NEWSSTAND;
+ int16 TRAFFICCONE;
+ int16 DUMP1;
+ int16 ROADWORKBARRIER1;
+ int16 BUSSIGN1;
+ int16 NOPARKINGSIGN1;
+ int16 PHONESIGN;
+ int16 TAXISIGN;
+ int16 FISHSTALL01;
+ int16 FISHSTALL02;
+ int16 FISHSTALL03;
+ int16 FISHSTALL04;
+ int16 BAGELSTAND2;
+ int16 FIRE_HYDRANT;
+ int16 COLLECTABLE1;
+ int16 MONEY;
+ int16 CARMINE;
+ int16 GARAGEDOOR1;
+ int16 GARAGEDOOR2;
+ int16 GARAGEDOOR3;
+ int16 GARAGEDOOR4;
+ int16 GARAGEDOOR5;
+ int16 GARAGEDOOR6;
+ int16 GARAGEDOOR7;
+ int16 GARAGEDOOR9;
+ int16 GARAGEDOOR10;
+ int16 GARAGEDOOR11;
+ int16 GARAGEDOOR12;
+ int16 GARAGEDOOR13;
+ int16 GARAGEDOOR14;
+ int16 GARAGEDOOR15;
+ int16 GARAGEDOOR16;
+ int16 GARAGEDOOR17;
+ int16 GARAGEDOOR18;
+ int16 GARAGEDOOR19;
+ int16 GARAGEDOOR20;
+ int16 GARAGEDOOR21;
+ int16 GARAGEDOOR22;
+ int16 GARAGEDOOR23;
+ int16 GARAGEDOOR24;
+ int16 GARAGEDOOR25;
+ int16 GARAGEDOOR26;
+ int16 GARAGEDOOR27;
+ int16 GARAGEDOOR28;
+ int16 GARAGEDOOR29;
+ int16 GARAGEDOOR30;
+ int16 GARAGEDOOR31;
+ int16 GARAGEDOOR32;
+ int16 GARAGEDOOR33;
+ int16 GARAGEDOOR34;
+ int16 GARAGEDOOR35;
+ int16 GARAGEDOOR36;
+ int16 GARAGEDOOR37;
+ int16 GARAGEDOOR38;
+ int16 GARAGEDOOR39;
+ int16 TESTRAMP1; // UNUSED
+ int16 TESTRAMP2;
+ int16 NAUTICALMINE;
+ int16 CRUSHERBODY;
+ int16 CRUSHERLID;
+ int16 DONKEYMAG;
+ int16 BULLION;
+ int16 FLOATPACKAGE1;
+ int16 BRIEFCASE;
+ int16 CHINABANNER1;
+ int16 CHINABANNER2;
+ int16 CHINABANNER3;
+ int16 CHINABANNER4;
+ int16 CHINABANNER5;
+ int16 CHINABANNER6;
+ int16 CHINABANNER7;
+ int16 CHINABANNER8;
+ int16 CHINABANNER9;
+ int16 CHINABANNER10;
+ int16 CHINABANNER11;
+ int16 CHINABANNER12;
+ int16 CHINALANTERN;
+ int16 GLASS1;
+ int16 GLASS2;
+ int16 GLASS3;
+ int16 GLASS4;
+ int16 GLASS5;
+ int16 GLASS6;
+ int16 GLASS7;
+ int16 GLASS8;
+ int16 BRIDGELIFT;
+ int16 BRIDGEWEIGHT;
+ int16 BRIDGEROADSEGMENT;
+ int16 EXPLODINGBARREL;
+ int16 ITALYBANNER1;
+ int16 MEGADAMAGE;
+ int16 REGENERATOR;
+ int16 INVISIBLE;
+ int16 GOOD_CAR;
+ int16 BAD_CAR;
+ int16 PICKUP_ADRENALINE;
+ int16 PICKUP_BODYARMOUR;
+ int16 PICKUP_INFO;
+ int16 PICKUP_HEALTH;
+ int16 PICKUP_BONUS;
+ int16 PICKUP_BRIBE;
+ int16 PICKUP_KILLFRENZY;
+ int16 PICKUP_CAMERA;
+ int16 PICKUP_REVENUE;
+ int16 PICKUP_SAVEGAME;
+ int16 PICKUP_PROPERTY;
+ int16 PICKUP_PROPERTY_FORSALE;
+ int16 PICKUP_CLOTHES;
+ int16 BOLLARDLIGHT;
+ int16 CA_SP1;
+ int16 CA_SP2;
+ int16 CA_SP3;
+ int16 CA_SP4;
+ int16 PACKAGE1IZZY;
+ int16 MAGNET;
+ int16 RAILTRACKS;
+ int16 FENCE;
+ int16 FENCE2;
+ int16 PETROLPUMP;
+ int16 PETROLPUMP2;
+ int16 BODYCAST;
+ int16 IZZY_CONFDOOR;
+ int16 SHIPDOOR;
+ int16 IZZY_JDDOOR;
+ int16 IZZY_JDDOOR_SLIDER;
+ int16 LITEHOUSE_GATE;
+ int16 COFFEE;
+ int16 BUOY;
+ int16 PARKTABLE;
+ int16 SUBWAY1;
+ int16 SUBWAY2;
+ int16 SUBWAY3;
+ int16 SUBWAY4;
+ int16 SUBWAY5;
+ int16 SUBWAY6;
+ int16 SUBWAY7;
+ int16 SUBWAY8;
+ int16 SUBWAY9;
+ int16 SUBWAY10;
+ int16 SUBWAY11;
+ int16 SUBWAY12;
+ int16 SUBWAY13;
+ int16 SUBWAY14;
+ int16 SUBWAY15;
+ int16 SUBWAY16;
+ int16 SUBWAY17;
+ int16 SUBWAY18;
+ int16 SUBPLATFORM_IND;
+ int16 SUBPLATFORM_COMS;
+ int16 SUBPLATFORM_COMS2;
+ int16 SUBPLATFORM_COMN;
+ int16 SUBPLATFORM_SUB;
+ int16 SUBPLATFORM_SUB2;
+ int16 FILES;
+ int16 LAMPPOST1;
+ int16 VEG_PALM01;
+ int16 VEG_PALM02;
+ int16 VEG_PALM03;
+ int16 VEG_PALM04;
+ int16 VEG_PALM05;
+ int16 VEG_PALM06;
+ int16 VEG_PALM07;
+ int16 VEG_PALM08;
+ int16 MLAMPPOST;
+ int16 BARRIER1;
+ int16 LITTLEHA_POLICE;
+ int16 TELPOLE02;
+ int16 TRAFFICLIGHT01;
+ int16 PARKBENCH;
+ int16 PLC_STINGER;
+ int16 LIGHTBEAM;
+ int16 AIRPORTRADAR;
+ int16 RCBOMB;
+ int16 JM_SALRADIO;
+ int16 BEACHBALL;
+ int16 SANDCASTLE1;
+ int16 SANDCASTLE2;
+ int16 JELLYFISH;
+ int16 JELLYFISH01;
+ int16 FISH1SINGLE;
+ int16 FISH1S;
+ int16 FISH2SINGLE;
+ int16 FISH2S;
+ int16 FISH3SINGLE;
+ int16 FISH3S;
+ int16 TURTLE;
+ int16 DOLPHIN;
+ int16 SHARK;
+ int16 SUBMARINE;
+ int16 ESCALATORSTEP;
+ int16 LOUNGE_WOOD_UP;
+ int16 LOUNGE_TOWEL_UP;
+ int16 LOUNGE_WOOD_DN;
+ int16 LOTION;
+ int16 BEACHTOWEL01;
+ int16 BEACHTOWEL02;
+ int16 BEACHTOWEL03;
+ int16 BEACHTOWEL04;
+ int16 BLIMP_NIGHT;
+ int16 BLIMP_DAY;
+ int16 YT_MAIN_BODY;
+ int16 YT_MAIN_BODY2;
+ int16 SMALL_HELIX;
+ int16 PT_BARRIER;
+ int16 SUBWAYGATE;
+ int16 IN_PMBRIDRAMP3;
+ int16 IN_PMBRIDG2_UPGS;
+ int16 IN_PMBRIDGE2;
+ int16 IN_PMBRIDG1_UPGS;
+ int16 PM_LIGHTRIG3;
+ int16 PM_LIGHTRIG1;
+ int16 IN_PMSCAFF_UPS;
+ int16 IN_PM_CONCBLOK2;
+ int16 IN_PMSCAFFH_NS;
+ int16 IN_PM_GRAVL_JMP;
+ int16 IN_PM_SCAFFCOVR;
+ int16 IN_PM_GIRDER2;
+ int16 IN_PM_SCAFFH_WE;
+ int16 IN_PM_SIXCONC2;
+ int16 IN_BMBRIDRAMP3;
+ int16 IN_BMBRIDG2_UPGS;
+ int16 IN_BMBRIDGE2;
+ int16 IN_BMBRIDG1_UPGS;
+ int16 BM_LIGHTRIG3;
+ int16 BM_LIGHTRIG1;
+ int16 IN_BMSCAFF_UPS;
+ int16 IN_BM_CONCBLOK2;
+ int16 IN_BMSCAFFH_NS;
+ int16 IN_BM_GRAVL_JMP;
+ int16 IN_BM_SCAFFCOVR;
+ int16 IN_BM_GIRDER2;
+ int16 IN_BM_SCAFFH_WE;
+ int16 IN_BM_SIXCONC2;
+ int16 CRATE_SJL;
+ int16 DOOR1_SJL;
+ int16 DOOR2_SJL;
+ int16 SJL_PORTACABIN;
+ int16 SJL_PORTACABINRED;
+ int16 advert_test; // txd
+};
+
+extern CModelIndices *gpModelIndices;
+
+#define MI_TRAFFICLIGHTS gpModelIndices->TRAFFICLIGHTS
+#define MI_TLIGHT_POST gpModelIndices->TLIGHT_POST
+#define MI_TLIGHT_WALK gpModelIndices->TLIGHT_WALK
+#define MI_TLIGHT_BOX1 gpModelIndices->TLIGHT_BOX1
+#define MI_TLIGHT_BOX2 gpModelIndices->TLIGHT_BOX2
+#define MI_TRAFFICLIGHTS_VERTICAL gpModelIndices->TRAFFICLIGHTS_VERTICAL
+#define MI_TRAFFICLIGHTS_MIAMI gpModelIndices->TRAFFICLIGHTS_MIAMI
+#define MI_TRAFFICLIGHTS_TWOVERTICAL gpModelIndices->TRAFFICLIGHTS_TWOVERTICAL
+#define MI_SINGLESTREETLIGHTS1 gpModelIndices->SINGLESTREETLIGHTS1
+#define MI_SINGLESTREETLIGHTS2 gpModelIndices->SINGLESTREETLIGHTS2
+#define MI_SINGLESTREETLIGHTS3 gpModelIndices->SINGLESTREETLIGHTS3
+#define MI_DOUBLESTREETLIGHTS gpModelIndices->DOUBLESTREETLIGHTS
+#define MI_STREETLAMP1 gpModelIndices->STREETLAMP1
+#define MI_STREETLAMP2 gpModelIndices->STREETLAMP2
+#define MI_ROADSFORROADBLOCKSSTART gpModelIndices->ROADSFORROADBLOCKSSTART
+#define MI_ROADSFORROADBLOCKSEND gpModelIndices->ROADSFORROADBLOCKSEND
+#define MI_TREE2 gpModelIndices->TREE2
+#define MI_TREE3 gpModelIndices->TREE3
+#define MI_TREE6 gpModelIndices->TREE6
+#define MI_TREE8 gpModelIndices->TREE8
+#define MI_TREE1 gpModelIndices->TREE1
+#define MI_TREE4 gpModelIndices->TREE4
+#define MI_TREE5 gpModelIndices->TREE5
+#define MI_TREE7 gpModelIndices->TREE7
+#define MI_TREE9 gpModelIndices->TREE9
+#define MI_TREE10 gpModelIndices->TREE10
+#define MI_TREE11 gpModelIndices->TREE11
+#define MI_TREE12 gpModelIndices->TREE12
+#define MI_TREE13 gpModelIndices->TREE13
+#define MI_TREE14 gpModelIndices->TREE14
+#define MODELID_CRANE_1 gpModelIndices->CRANE_1
+#define MODELID_CRANE_2 gpModelIndices->CRANE_2
+#define MODELID_CRANE_3 gpModelIndices->CRANE_3
+#define MODELID_CRANE_4 gpModelIndices->CRANE_4
+#define MODELID_CRANE_5 gpModelIndices->CRANE_5
+#define MODELID_CRANE_6 gpModelIndices->CRANE_6
+#define MI_PARKINGMETER gpModelIndices->PARKINGMETER
+#define MI_PARKINGMETER2 gpModelIndices->PARKINGMETER2
+#define MI_MALLFAN gpModelIndices->MALLFAN
+#define MI_HOTELFAN_NIGHT gpModelIndices->HOTELFAN_NIGHT
+#define MI_HOTELFAN_DAY gpModelIndices->HOTELFAN_DAY
+#define MI_HOTROOMFAN gpModelIndices->HOTROOMFAN
+#define MI_PHONEBOOTH1 gpModelIndices->PHONEBOOTH1
+#define MI_WASTEBIN gpModelIndices->WASTEBIN
+#define MI_BIN gpModelIndices->BIN
+#define MI_POSTBOX1 gpModelIndices->POSTBOX1
+#define MI_NEWSSTAND gpModelIndices->NEWSSTAND
+#define MI_TRAFFICCONE gpModelIndices->TRAFFICCONE
+#define MI_DUMP1 gpModelIndices->DUMP1
+#define MI_ROADWORKBARRIER1 gpModelIndices->ROADWORKBARRIER1
+#define MI_BUSSIGN1 gpModelIndices->BUSSIGN1
+#define MI_NOPARKINGSIGN1 gpModelIndices->NOPARKINGSIGN1
+#define MI_PHONESIGN gpModelIndices->PHONESIGN
+#define MI_TAXISIGN gpModelIndices->TAXISIGN
+#define MI_FISHSTALL01 gpModelIndices->FISHSTALL01
+#define MI_FISHSTALL02 gpModelIndices->FISHSTALL02
+#define MI_FISHSTALL03 gpModelIndices->FISHSTALL03
+#define MI_FISHSTALL04 gpModelIndices->FISHSTALL04
+#define MI_BAGELSTAND2 gpModelIndices->BAGELSTAND2
+#define MI_FIRE_HYDRANT gpModelIndices->FIRE_HYDRANT
+#define MI_COLLECTABLE1 gpModelIndices->COLLECTABLE1
+#define MI_MONEY gpModelIndices->MONEY
+#define MI_CARMINE gpModelIndices->CARMINE
+#define MI_GARAGEDOOR1 gpModelIndices->GARAGEDOOR1
+#define MI_GARAGEDOOR2 gpModelIndices->GARAGEDOOR2
+#define MI_GARAGEDOOR3 gpModelIndices->GARAGEDOOR3
+#define MI_GARAGEDOOR4 gpModelIndices->GARAGEDOOR4
+#define MI_GARAGEDOOR5 gpModelIndices->GARAGEDOOR5
+#define MI_GARAGEDOOR6 gpModelIndices->GARAGEDOOR6
+#define MI_GARAGEDOOR7 gpModelIndices->GARAGEDOOR7
+#define MI_GARAGEDOOR9 gpModelIndices->GARAGEDOOR9
+#define MI_GARAGEDOOR10 gpModelIndices->GARAGEDOOR10
+#define MI_GARAGEDOOR11 gpModelIndices->GARAGEDOOR11
+#define MI_GARAGEDOOR12 gpModelIndices->GARAGEDOOR12
+#define MI_GARAGEDOOR13 gpModelIndices->GARAGEDOOR13
+#define MI_GARAGEDOOR14 gpModelIndices->GARAGEDOOR14
+#define MI_GARAGEDOOR15 gpModelIndices->GARAGEDOOR15
+#define MI_GARAGEDOOR16 gpModelIndices->GARAGEDOOR16
+#define MI_GARAGEDOOR17 gpModelIndices->GARAGEDOOR17
+#define MI_GARAGEDOOR18 gpModelIndices->GARAGEDOOR18
+#define MI_GARAGEDOOR19 gpModelIndices->GARAGEDOOR19
+#define MI_GARAGEDOOR20 gpModelIndices->GARAGEDOOR20
+#define MI_GARAGEDOOR21 gpModelIndices->GARAGEDOOR21
+#define MI_GARAGEDOOR22 gpModelIndices->GARAGEDOOR22
+#define MI_GARAGEDOOR23 gpModelIndices->GARAGEDOOR23
+#define MI_GARAGEDOOR24 gpModelIndices->GARAGEDOOR24
+#define MI_GARAGEDOOR25 gpModelIndices->GARAGEDOOR25
+#define MI_GARAGEDOOR26 gpModelIndices->GARAGEDOOR26
+#define MI_GARAGEDOOR27 gpModelIndices->GARAGEDOOR27
+#define MI_GARAGEDOOR28 gpModelIndices->GARAGEDOOR28
+#define MI_GARAGEDOOR29 gpModelIndices->GARAGEDOOR29
+#define MI_GARAGEDOOR30 gpModelIndices->GARAGEDOOR30
+#define MI_GARAGEDOOR31 gpModelIndices->GARAGEDOOR31
+#define MI_GARAGEDOOR32 gpModelIndices->GARAGEDOOR32
+#define MI_GARAGEDOOR33 gpModelIndices->GARAGEDOOR33
+#define MI_GARAGEDOOR34 gpModelIndices->GARAGEDOOR34
+#define MI_GARAGEDOOR35 gpModelIndices->GARAGEDOOR35
+#define MI_GARAGEDOOR36 gpModelIndices->GARAGEDOOR36
+#define MI_GARAGEDOOR37 gpModelIndices->GARAGEDOOR37
+#define MI_GARAGEDOOR38 gpModelIndices->GARAGEDOOR38
+#define MI_GARAGEDOOR39 gpModelIndices->GARAGEDOOR39
+#define MI_TESTRAMP1 gpModelIndices->TESTRAMP1 // UNUSED
+#define MI_TESTRAMP2 gpModelIndices->TESTRAMP2
+#define MI_NAUTICALMINE gpModelIndices->NAUTICALMINE
+#define MI_CRUSHERBODY gpModelIndices->CRUSHERBODY
+#define MI_CRUSHERLID gpModelIndices->CRUSHERLID
+#define MI_DONKEYMAG gpModelIndices->DONKEYMAG
+#define MI_BULLION gpModelIndices->BULLION
+#define MI_FLOATPACKAGE1 gpModelIndices->FLOATPACKAGE1
+#define MI_BRIEFCASE gpModelIndices->BRIEFCASE
+#define MI_CHINABANNER1 gpModelIndices->CHINABANNER1
+#define MI_CHINABANNER2 gpModelIndices->CHINABANNER2
+#define MI_CHINABANNER3 gpModelIndices->CHINABANNER3
+#define MI_CHINABANNER4 gpModelIndices->CHINABANNER4
+#define MI_CHINABANNER5 gpModelIndices->CHINABANNER5
+#define MI_CHINABANNER6 gpModelIndices->CHINABANNER6
+#define MI_CHINABANNER7 gpModelIndices->CHINABANNER7
+#define MI_CHINABANNER8 gpModelIndices->CHINABANNER8
+#define MI_CHINABANNER9 gpModelIndices->CHINABANNER9
+#define MI_CHINABANNER10 gpModelIndices->CHINABANNER10
+#define MI_CHINABANNER11 gpModelIndices->CHINABANNER11
+#define MI_CHINABANNER12 gpModelIndices->CHINABANNER12
+#define MI_CHINALANTERN gpModelIndices->CHINALANTERN
+#define MI_GLASS1 gpModelIndices->GLASS1
+#define MI_GLASS2 gpModelIndices->GLASS2
+#define MI_GLASS3 gpModelIndices->GLASS3
+#define MI_GLASS4 gpModelIndices->GLASS4
+#define MI_GLASS5 gpModelIndices->GLASS5
+#define MI_GLASS6 gpModelIndices->GLASS6
+#define MI_GLASS7 gpModelIndices->GLASS7
+#define MI_GLASS8 gpModelIndices->GLASS8
+#define MI_BRIDGELIFT gpModelIndices->BRIDGELIFT
+#define MI_BRIDGEWEIGHT gpModelIndices->BRIDGEWEIGHT
+#define MI_BRIDGEROADSEGMENT gpModelIndices->BRIDGEROADSEGMENT
+#define MI_EXPLODINGBARREL gpModelIndices->EXPLODINGBARREL
+#define MI_ITALYBANNER1 gpModelIndices->ITALYBANNER1
+#define MI_MEGADAMAGE gpModelIndices->MEGADAMAGE
+#define MI_REGENERATOR gpModelIndices->REGENERATOR
+#define MI_INVISIBLE gpModelIndices->INVISIBLE
+#define MI_GOOD_CAR gpModelIndices->GOOD_CAR
+#define MI_BAD_CAR gpModelIndices->BAD_CAR
+#define MI_PICKUP_ADRENALINE gpModelIndices->PICKUP_ADRENALINE
+#define MI_PICKUP_BODYARMOUR gpModelIndices->PICKUP_BODYARMOUR
+#define MI_PICKUP_INFO gpModelIndices->PICKUP_INFO
+#define MI_PICKUP_HEALTH gpModelIndices->PICKUP_HEALTH
+#define MI_PICKUP_BONUS gpModelIndices->PICKUP_BONUS
+#define MI_PICKUP_BRIBE gpModelIndices->PICKUP_BRIBE
+#define MI_PICKUP_KILLFRENZY gpModelIndices->PICKUP_KILLFRENZY
+#define MI_PICKUP_CAMERA gpModelIndices->PICKUP_CAMERA
+#define MI_PICKUP_REVENUE gpModelIndices->PICKUP_REVENUE
+#define MI_PICKUP_SAVEGAME gpModelIndices->PICKUP_SAVEGAME
+#define MI_PICKUP_PROPERTY gpModelIndices->PICKUP_PROPERTY
+#define MI_PICKUP_PROPERTY_FORSALE gpModelIndices->PICKUP_PROPERTY_FORSALE
+#define MI_PICKUP_CLOTHES gpModelIndices->PICKUP_CLOTHES
+#define MI_BOLLARDLIGHT gpModelIndices->BOLLARDLIGHT
+#define MI_CA_SP1 gpModelIndices->CA_SP1
+#define MI_CA_SP2 gpModelIndices->CA_SP2
+#define MI_CA_SP3 gpModelIndices->CA_SP3
+#define MI_CA_SP4 gpModelIndices->CA_SP4
+#define MI_PACKAGE1IZZY gpModelIndices->PACKAGE1IZZY
+#define MI_MAGNET gpModelIndices->MAGNET
+#define MI_RAILTRACKS gpModelIndices->RAILTRACKS
+#define MI_FENCE gpModelIndices->FENCE
+#define MI_FENCE2 gpModelIndices->FENCE2
+#define MI_PETROLPUMP gpModelIndices->PETROLPUMP
+#define MI_PETROLPUMP2 gpModelIndices->PETROLPUMP2
+#define MI_BODYCAST gpModelIndices->BODYCAST
+#define MI_IZZY_CONFDOOR gpModelIndices->IZZY_CONFDOOR
+#define MI_SHIPDOOR gpModelIndices->SHIPDOOR
+#define MI_IZZY_JDDOOR gpModelIndices->IZZY_JDDOOR
+#define MI_IZZY_JDDOOR_SLIDER gpModelIndices->IZZY_JDDOOR_SLIDER
+#define MI_LITEHOUSE_GATE gpModelIndices->LITEHOUSE_GATE
+#define MI_COFFEE gpModelIndices->COFFEE
+#define MI_BUOY gpModelIndices->BUOY
+#define MI_PARKTABLE gpModelIndices->PARKTABLE
+#define MI_SUBWAY1 gpModelIndices->SUBWAY1
+#define MI_SUBWAY2 gpModelIndices->SUBWAY2
+#define MI_SUBWAY3 gpModelIndices->SUBWAY3
+#define MI_SUBWAY4 gpModelIndices->SUBWAY4
+#define MI_SUBWAY5 gpModelIndices->SUBWAY5
+#define MI_SUBWAY6 gpModelIndices->SUBWAY6
+#define MI_SUBWAY7 gpModelIndices->SUBWAY7
+#define MI_SUBWAY8 gpModelIndices->SUBWAY8
+#define MI_SUBWAY9 gpModelIndices->SUBWAY9
+#define MI_SUBWAY10 gpModelIndices->SUBWAY10
+#define MI_SUBWAY11 gpModelIndices->SUBWAY11
+#define MI_SUBWAY12 gpModelIndices->SUBWAY12
+#define MI_SUBWAY13 gpModelIndices->SUBWAY13
+#define MI_SUBWAY14 gpModelIndices->SUBWAY14
+#define MI_SUBWAY15 gpModelIndices->SUBWAY15
+#define MI_SUBWAY16 gpModelIndices->SUBWAY16
+#define MI_SUBWAY17 gpModelIndices->SUBWAY17
+#define MI_SUBWAY18 gpModelIndices->SUBWAY18
+#define MI_SUBPLATFORM_IND gpModelIndices->SUBPLATFORM_IND
+#define MI_SUBPLATFORM_COMS gpModelIndices->SUBPLATFORM_COMS
+#define MI_SUBPLATFORM_COMS2 gpModelIndices->SUBPLATFORM_COMS2
+#define MI_SUBPLATFORM_COMN gpModelIndices->SUBPLATFORM_COMN
+#define MI_SUBPLATFORM_SUB gpModelIndices->SUBPLATFORM_SUB
+#define MI_SUBPLATFORM_SUB2 gpModelIndices->SUBPLATFORM_SUB2
+#define MI_FILES gpModelIndices->FILES
+#define MI_LAMPPOST1 gpModelIndices->LAMPPOST1
+#define MI_VEG_PALM01 gpModelIndices->VEG_PALM01
+#define MI_VEG_PALM02 gpModelIndices->VEG_PALM02
+#define MI_VEG_PALM03 gpModelIndices->VEG_PALM03
+#define MI_VEG_PALM04 gpModelIndices->VEG_PALM04
+#define MI_VEG_PALM05 gpModelIndices->VEG_PALM05
+#define MI_VEG_PALM06 gpModelIndices->VEG_PALM06
+#define MI_VEG_PALM07 gpModelIndices->VEG_PALM07
+#define MI_VEG_PALM08 gpModelIndices->VEG_PALM08
+#define MI_MLAMPPOST gpModelIndices->MLAMPPOST
+#define MI_BARRIER1 gpModelIndices->BARRIER1
+#define MI_LITTLEHA_POLICE gpModelIndices->LITTLEHA_POLICE
+#define MI_TELPOLE02 gpModelIndices->TELPOLE02
+#define MI_TRAFFICLIGHT01 gpModelIndices->TRAFFICLIGHT01
+#define MI_PARKBENCH gpModelIndices->PARKBENCH
+#define MI_PLC_STINGER gpModelIndices->PLC_STINGER
+#define MI_LIGHTBEAM gpModelIndices->LIGHTBEAM
+#define MI_AIRPORTRADAR gpModelIndices->AIRPORTRADAR
+#define MI_RCBOMB gpModelIndices->RCBOMB
+#define MI_JM_SALRADIO gpModelIndices->JM_SALRADIO
+#define MI_BEACHBALL gpModelIndices->BEACHBALL
+#define MI_SANDCASTLE1 gpModelIndices->SANDCASTLE1
+#define MI_SANDCASTLE2 gpModelIndices->SANDCASTLE2
+#define MI_JELLYFISH gpModelIndices->JELLYFISH
+#define MI_JELLYFISH01 gpModelIndices->JELLYFISH01
+#define MI_FISH1SINGLE gpModelIndices->FISH1SINGLE
+#define MI_FISH1S gpModelIndices->FISH1S
+#define MI_FISH2SINGLE gpModelIndices->FISH2SINGLE
+#define MI_FISH2S gpModelIndices->FISH2S
+#define MI_FISH3SINGLE gpModelIndices->FISH3SINGLE
+#define MI_FISH3S gpModelIndices->FISH3S
+#define MI_TURTLE gpModelIndices->TURTLE
+#define MI_DOLPHIN gpModelIndices->DOLPHIN
+#define MI_SHARK gpModelIndices->SHARK
+#define MI_SUBMARINE gpModelIndices->SUBMARINE
+#define MI_ESCALATORSTEP gpModelIndices->ESCALATORSTEP
+#define MI_LOUNGE_WOOD_UP gpModelIndices->LOUNGE_WOOD_UP
+#define MI_LOUNGE_TOWEL_UP gpModelIndices->LOUNGE_TOWEL_UP
+#define MI_LOUNGE_WOOD_DN gpModelIndices->LOUNGE_WOOD_DN
+#define MI_LOTION gpModelIndices->LOTION
+#define MI_BEACHTOWEL01 gpModelIndices->BEACHTOWEL01
+#define MI_BEACHTOWEL02 gpModelIndices->BEACHTOWEL02
+#define MI_BEACHTOWEL03 gpModelIndices->BEACHTOWEL03
+#define MI_BEACHTOWEL04 gpModelIndices->BEACHTOWEL04
+#define MI_BLIMP_NIGHT gpModelIndices->BLIMP_NIGHT
+#define MI_BLIMP_DAY gpModelIndices->BLIMP_DAY
+#define MI_YT_MAIN_BODY gpModelIndices->YT_MAIN_BODY
+#define MI_YT_MAIN_BODY2 gpModelIndices->YT_MAIN_BODY2
+#define MI_SMALL_HELIX gpModelIndices->SMALL_HELIX
+#define MI_PT_BARRIER gpModelIndices->PT_BARRIER
+#define MI_SUBWAYGATE gpModelIndices->SUBWAYGATE
+#define MI_IN_PMBRIDRAMP3 gpModelIndices->IN_PMBRIDRAMP3
+#define MI_IN_PMBRIDG2_UPGS gpModelIndices->IN_PMBRIDG2_UPGS
+#define MI_IN_PMBRIDGE2 gpModelIndices->IN_PMBRIDGE2
+#define MI_IN_PMBRIDG1_UPGS gpModelIndices->IN_PMBRIDG1_UPGS
+#define MI_PM_LIGHTRIG3 gpModelIndices->PM_LIGHTRIG3
+#define MI_PM_LIGHTRIG1 gpModelIndices->PM_LIGHTRIG1
+#define MI_IN_PMSCAFF_UPS gpModelIndices->IN_PMSCAFF_UPS
+#define MI_IN_PM_CONCBLOK2 gpModelIndices->IN_PM_CONCBLOK2
+#define MI_IN_PMSCAFFH_NS gpModelIndices->IN_PMSCAFFH_NS
+#define MI_IN_PM_GRAVL_JMP gpModelIndices->IN_PM_GRAVL_JMP
+#define MI_IN_PM_SCAFFCOVR gpModelIndices->IN_PM_SCAFFCOVR
+#define MI_IN_PM_GIRDER2 gpModelIndices->IN_PM_GIRDER2
+#define MI_IN_PM_SCAFFH_WE gpModelIndices->IN_PM_SCAFFH_WE
+#define MI_IN_PM_SIXCONC2 gpModelIndices->IN_PM_SIXCONC2
+#define MI_IN_BMBRIDRAMP3 gpModelIndices->IN_BMBRIDRAMP3
+#define MI_IN_BMBRIDG2_UPGS gpModelIndices->IN_BMBRIDG2_UPGS
+#define MI_IN_BMBRIDGE2 gpModelIndices->IN_BMBRIDGE2
+#define MI_IN_BMBRIDG1_UPGS gpModelIndices->IN_BMBRIDG1_UPGS
+#define MI_BM_LIGHTRIG3 gpModelIndices->BM_LIGHTRIG3
+#define MI_BM_LIGHTRIG1 gpModelIndices->BM_LIGHTRIG1
+#define MI_IN_BMSCAFF_UPS gpModelIndices->IN_BMSCAFF_UPS
+#define MI_IN_BM_CONCBLOK2 gpModelIndices->IN_BM_CONCBLOK2
+#define MI_IN_BMSCAFFH_NS gpModelIndices->IN_BMSCAFFH_NS
+#define MI_IN_BM_GRAVL_JMP gpModelIndices->IN_BM_GRAVL_JMP
+#define MI_IN_BM_SCAFFCOVR gpModelIndices->IN_BM_SCAFFCOVR
+#define MI_IN_BM_GIRDER2 gpModelIndices->IN_BM_GIRDER2
+#define MI_IN_BM_SCAFFH_WE gpModelIndices->IN_BM_SCAFFH_WE
+#define MI_IN_BM_SIXCONC2 gpModelIndices->IN_BM_SIXCONC2
+#define MI_CRATE_SJL gpModelIndices->CRATE_SJL
+#define MI_DOOR1_SJL gpModelIndices->DOOR1_SJL
+#define MI_DOOR2_SJL gpModelIndices->DOOR2_SJL
+#define MI_SJL_PORTACABIN gpModelIndices->SJL_PORTACABIN
+#define MI_SJL_PORTACABINRED gpModelIndices->SJL_PORTACABINRED
+
#define MODELINDICES \
X("fire_hydrant", MI_FIRE_HYDRANT) \
+ X("fire_hydrant", MI_FIRE_HYDRANT) /* BUG: second time */ \
+ X("bagelstnd02", MI_BAGELSTAND2) \
+ X("fish01", MI_FISHSTALL01) \
+ X("fishstall02", MI_FISHSTALL02) \
+ X("fishstall03", MI_FISHSTALL03) \
+ X("fishstall04", MI_FISHSTALL04) \
+ X("taxisign", MI_TAXISIGN) \
X("phonesign", MI_PHONESIGN) \
X("noparkingsign1", MI_NOPARKINGSIGN1) \
X("bussign1", MI_BUSSIGN1) \
@@ -16,12 +599,17 @@
X("wastebin", MI_WASTEBIN) \
X("phonebooth1", MI_PHONEBOOTH1) \
X("parkingmeter", MI_PARKINGMETER) \
+ X("trafficlight1", MI_TRAFFICLIGHTS) \
+ X("tlight_post", MI_TLIGHT_POST) \
+ X("tlight_walk", MI_TLIGHT_WALK) \
+ X("tlight_box1", MI_TLIGHT_BOX1) \
+ X("tlight_box2", MI_TLIGHT_BOX2) \
X("parkingmeterg", MI_PARKINGMETER2) \
X("mall_fans", MI_MALLFAN) \
X("htl_fan_rotate_nt", MI_HOTELFAN_NIGHT) \
X("htl_fan_rotate_dy", MI_HOTELFAN_DAY) \
X("hotroomfan", MI_HOTROOMFAN) \
- X("trafficlight1", MI_TRAFFICLIGHTS) \
+ X("trafficlight1", MI_TRAFFICLIGHTS) /* BUG: second time */ \
X("MTraffic4", MI_TRAFFICLIGHTS_VERTICAL) \
X("MTraffic1", MI_TRAFFICLIGHTS_MIAMI) \
X("MTraffic2", MI_TRAFFICLIGHTS_TWOVERTICAL) \
@@ -31,47 +619,110 @@
X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \
X("Streetlamp1", MI_STREETLAMP1) \
X("Streetlamp2", MI_STREETLAMP2) \
+ X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART) \
+ X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND) \
+ X("veg_tree1", MI_TREE1) \
X("veg_tree3", MI_TREE2) \
X("veg_treea1", MI_TREE3) \
+ X("veg_treenew01", MI_TREE4) \
+ X("veg_treenew05", MI_TREE5) \
X("veg_treeb1", MI_TREE6) \
+ X("veg_treenew10", MI_TREE7) \
X("veg_treea3", MI_TREE8) \
- X("doc_crane_cab0", MODELID_CRANE_1) \
- X("doc_crane_cab01", MODELID_CRANE_2) \
- X("doc_crane_cab02", MODELID_CRANE_3) \
- X("doc_crane_cab03", MODELID_CRANE_4) \
- X("boatcranelg0", MODELID_CRANE_5) \
- X("LODnetopa0", MODELID_CRANE_6) \
+ X("veg_treenew09", MI_TREE9) \
+ X("veg_treenew08", MI_TREE10) \
+ X("veg_treenew03", MI_TREE11) \
+ X("veg_treenew16", MI_TREE12) \
+ X("veg_treenew17", MI_TREE13) \
+ X("veg_treenew06", MI_TREE14) \
+ X("crusher_crane", MODELID_CRANE_1) \
X("package1", MI_COLLECTABLE1) \
X("Money", MI_MONEY) \
X("barrel1", MI_CARMINE) \
- X("dk_paynspraydoor", MI_GARAGEDOOR2) \
- X("dk_waretankdoor1", MI_GARAGEDOOR3) \
- X("hav_garagedoor1", MI_GARAGEDOOR4) \
- X("hav_garagedoor02", MI_GARAGEDOOR5) \
- X("hav_garagedoor03", MI_GARAGEDOOR6) \
- X("hav_garagedoor04", MI_GARAGEDOOR7) \
- X("lh_showdoor03", MI_GARAGEDOOR9) \
- X("lh_showdoor1", MI_GARAGEDOOR10) \
- X("lhtankdoor", MI_GARAGEDOOR11) \
- X("nbtgardoor", MI_GARAGEDOOR12) \
- X("dk_camjonesdoor", MI_GARAGEDOOR13) \
- X("nbtgardoor02", MI_GARAGEDOOR14) \
- X("dt_savedra", MI_GARAGEDOOR15) \
- X("dt_savedrb", MI_GARAGEDOOR16) \
- X("dk_bombdoor", MI_GARAGEDOOR18) \
- X("haiwshpnsdoor", MI_GARAGEDOOR19) \
- X("wshpnsdoor", MI_GARAGEDOOR20) \
- X("nbecpnsdoor", MI_GARAGEDOOR21) \
- X("nbtgardoor03", MI_GARAGEDOOR22) \
- X("dt_savedrc", MI_GARAGEDOOR23) \
- X("dt_savedrd", MI_GARAGEDOOR24) \
- X("man_frntstepGD", MI_GARAGEDOOR25) \
- X("svegrgedoor", MI_GARAGEDOOR26) \
+ X("oddjgaragdoor", MI_GARAGEDOOR1) \
+ X("bombdoor", MI_GARAGEDOOR2) \
+ X("door_bombshop", MI_GARAGEDOOR3) \
+ X("vheistlocdoor", MI_GARAGEDOOR4) \
+ X("door2_garage", MI_GARAGEDOOR5) \
+ X("ind_slidedoor", MI_GARAGEDOOR6) \
+ X("bankjobdoor", MI_GARAGEDOOR7) \
+ X("door_jmsgrage", MI_GARAGEDOOR9) \
+ X("jamesgrge_kb", MI_GARAGEDOOR10) \
+ X("door_sfehousegrge", MI_GARAGEDOOR11) \
+ X("shedgaragedoor", MI_GARAGEDOOR12) \
+ X("door4_garage", MI_GARAGEDOOR13) \
+ X("door_col_compnd_01", MI_GARAGEDOOR14) \
+ X("door_col_compnd_02", MI_GARAGEDOOR15) \
+ X("door_col_compnd_03", MI_GARAGEDOOR16) \
+ X("door_col_compnd_04", MI_GARAGEDOOR17) \
+ X("door_col_compnd_05", MI_GARAGEDOOR18) \
+ X("impex_door", MI_GARAGEDOOR19) \
+ X("SalvGarage", MI_GARAGEDOOR20) \
+ X("door3_garage", MI_GARAGEDOOR21) \
+ X("leveldoor2", MI_GARAGEDOOR22) \
+ X("double_garage_dr", MI_GARAGEDOOR23) \
+ X("amcogaragedoor", MI_GARAGEDOOR24) \
+ X("towergaragedoor1", MI_GARAGEDOOR25) \
+ X("towergaragedoor2", MI_GARAGEDOOR26) \
+ X("towergaragedoor3", MI_GARAGEDOOR27) \
+ X("plysve_gragedoor", MI_GARAGEDOOR28) \
+ X("impexpsubgrgdoor", MI_GARAGEDOOR29) \
+ X("Sub_sprayshopdoor", MI_GARAGEDOOR30) \
+ X("ind_plyrwoor", MI_GARAGEDOOR31) \
+ X("8ballsuburbandoor", MI_GARAGEDOOR32) \
+ X("door_nthgrage", MI_GARAGEDOOR33) \
+ X("hangardoor1", MI_GARAGEDOOR34) \
+ X("hangardoor2", MI_GARAGEDOOR35) \
+ X("neds_door", MI_GARAGEDOOR36) \
+ X("fs_wrhsedoor", MI_GARAGEDOOR37) \
+ X("jm_ContraGarage", MI_GARAGEDOOR38) \
+ X("jm_imp_SalvGarage", MI_GARAGEDOOR39) \
+ X("Testramp1", MI_TESTRAMP1) /* BUG: LCS used MI_TESTRAMP2 here */ \
+ X("Testramp2", MI_TESTRAMP2) \
X("barrel2", MI_NAUTICALMINE) \
+ X("crushercrush", MI_CRUSHERBODY) \
+ X("crushertop", MI_CRUSHERLID) \
+ X("donkeymag", MI_DONKEYMAG) \
+ X("bullion", MI_BULLION) \
+ X("floatpackge1", MI_FLOATPACKAGE1) \
X("briefcase", MI_BRIEFCASE) \
- X("wglasssmash", MI_GLASS1) \
+ X("chinabanner1", MI_CHINABANNER1) \
+ X("chinabanner2", MI_CHINABANNER2) \
+ X("chinabanner3", MI_CHINABANNER3) \
+ X("chinabanner4", MI_CHINABANNER4) \
+ X("iten_chinatown5", MI_CHINABANNER5) \
+ X("iten_chinatown7", MI_CHINABANNER6) \
+ X("iten_chinatown3", MI_CHINABANNER7) \
+ X("iten_chinatown2", MI_CHINABANNER8) \
+ X("iten_chinatown4", MI_CHINABANNER9) \
+ X("iten_washline01", MI_CHINABANNER10) \
+ X("iten_washline02", MI_CHINABANNER11) \
+ X("iten_washline03", MI_CHINABANNER12) \
+ X("chinalanterns", MI_CHINALANTERN) \
+ X("glassfx1", MI_GLASS1) \
+ X("glassfx2", MI_GLASS2) \
+ X("glassfx3", MI_GLASS3) \
+ X("glassfx4", MI_GLASS4) \
+ X("glassfx55", MI_GLASS5) \
+ X("glassfxsub1", MI_GLASS6) \
+ X("glassfxsub2", MI_GLASS7) \
X("glassfx_composh", MI_GLASS8) \
+ X("bridge_liftsec", MI_BRIDGELIFT) \
+ X("bridge_liftweight", MI_BRIDGEWEIGHT) \
+ X("subbridge_lift", MI_BRIDGEROADSEGMENT) \
+ X("flagsitaly", MI_ITALYBANNER1) \
+ X("small_helix", MI_SMALL_HELIX) \
X("barrel4", MI_EXPLODINGBARREL) \
+ X("Crate_sjl", MI_CRATE_SJL) \
+ X("Door1_sjl", MI_DOOR1_SJL) \
+ X("Door2_sjl", MI_DOOR2_SJL) \
+ X("SJL_PortaCabin", MI_SJL_PORTACABIN) \
+ X("SJL_PortaCabinred", MI_SJL_PORTACABINRED) \
+ X("megaDamage", MI_MEGADAMAGE) \
+ X("regenerator", MI_REGENERATOR) \
+ X("invisible", MI_INVISIBLE) \
+ X("good_car", MI_GOOD_CAR) \
+ X("bad_car", MI_BAD_CAR) \
X("adrenaline", MI_PICKUP_ADRENALINE) \
X("bodyarmour", MI_PICKUP_BODYARMOUR) \
X("info", MI_PICKUP_INFO) \
@@ -82,16 +733,57 @@
X("camerapickup", MI_PICKUP_CAMERA) \
X("bigdollar", MI_PICKUP_REVENUE) \
X("pickupsave", MI_PICKUP_SAVEGAME) \
+ X("clothesp", MI_PICKUP_CLOTHES) \
X("property_locked", MI_PICKUP_PROPERTY) \
X("property_fsale", MI_PICKUP_PROPERTY_FORSALE) \
- X("clothesp", MI_PICKUP_CLOTHES) \
X("bollardlight", MI_BOLLARDLIGHT) \
+ X("ca_sp1", MI_CA_SP1) \
+ X("ca_sp2", MI_CA_SP2) \
+ X("ca_sp3", MI_CA_SP3) \
+ X("ca_sp4", MI_CA_SP4) \
+ X("package1izzy", MI_PACKAGE1IZZY) \
+ X("magnet", MI_MAGNET) \
+ X("streetlamp1", MI_STREETLAMP1) \
+ X("streetlamp2", MI_STREETLAMP2) \
+ X("railtrax_lo4b", MI_RAILTRACKS) \
X("bar_barrier10", MI_FENCE) \
X("bar_barrier12", MI_FENCE2) \
X("petrolpump", MI_PETROLPUMP) \
X("washgaspump", MI_PETROLPUMP2) \
+ X("bodycast", MI_BODYCAST) \
+ X("izzy_confDoor", MI_IZZY_CONFDOOR) \
+ X("shipdoor", MI_SHIPDOOR) \
+ X("izzy_jdDoor", MI_IZZY_JDDOOR) \
+ X("izzy_jdDoor_slider", MI_IZZY_JDDOOR_SLIDER) \
+ X("litehouse_gate", MI_LITEHOUSE_GATE) \
+ X("coffee", MI_COFFEE) \
X("bouy", MI_BUOY) \
X("parktable1", MI_PARKTABLE) \
+ X("sbwy_tunl_start", MI_SUBWAY1) \
+ X("sbwy_tunl_bit", MI_SUBWAY2) \
+ X("sbwy_tunl_bend", MI_SUBWAY3) \
+ X("sbwy_tunl_cstm6", MI_SUBWAY4) \
+ X("sbwy_tunl_cstm7", MI_SUBWAY5) \
+ X("sbwy_tunl_cstm8", MI_SUBWAY6) \
+ X("sbwy_tunl_cstm10", MI_SUBWAY7) \
+ X("sbwy_tunl_cstm9", MI_SUBWAY8) \
+ X("sbwy_tunl_cstm11", MI_SUBWAY9) \
+ X("sbwy_tunl_cstm1", MI_SUBWAY10) \
+ X("sbwy_tunl_cstm2", MI_SUBWAY11) \
+ X("sbwy_tunl_cstm4", MI_SUBWAY12) \
+ X("sbwy_tunl_cstm3", MI_SUBWAY13) \
+ X("sbwy_tunl_cstm5", MI_SUBWAY14) \
+ X("subplatform_n2", MI_SUBWAY15) \
+ X("suby_tunl_start", MI_SUBWAY16) \
+ X("sbwy_tunl_start2", MI_SUBWAY17) \
+ X("indy_tunl_start", MI_SUBWAY18) \
+ X("indsubway03", MI_SUBPLATFORM_IND) \
+ X("comerside_subway", MI_SUBPLATFORM_COMS) \
+ X("subplatform", MI_SUBPLATFORM_COMS2) \
+ X("subplatform_n", MI_SUBPLATFORM_COMN) \
+ X("Otherside_subway", MI_SUBPLATFORM_SUB) \
+ X("subplatform_sub", MI_SUBPLATFORM_SUB2) \
+ X("files", MI_FILES) \
X("lamppost1", MI_LAMPPOST1) \
X("veg_palm04", MI_VEG_PALM01) \
X("veg_palwee02", MI_VEG_PALM02) \
@@ -107,10 +799,12 @@
X("telgrphpole02", MI_TELPOLE02) \
X("trafficlight1", MI_TRAFFICLIGHT01) \
X("parkbench1", MI_PARKBENCH) \
+ X("Money", MI_MONEY) \
X("plc_stinger", MI_PLC_STINGER) \
X("od_lightbeam", MI_LIGHTBEAM) \
X("ap_radar1_01", MI_AIRPORTRADAR) \
X("rcbomb", MI_RCBOMB) \
+ X("jm_salradio", MI_JM_SALRADIO) \
X("beachball", MI_BEACHBALL) \
X("sandcastle1", MI_SANDCASTLE1) \
X("sandcastle2", MI_SANDCASTLE2) \
@@ -138,54 +832,42 @@
X("blimp_night", MI_BLIMP_NIGHT) \
X("blimp_day", MI_BLIMP_DAY) \
X("yt_main_body", MI_YT_MAIN_BODY) \
- X("yt_main_body2", MI_YT_MAIN_BODY2) \
- X("oddjgaragdoor", MI_LCS_GARAGEDOOR01) \
- X("bombdoor", MI_LCS_GARAGEDOOR02) \
- X("door_bombshop", MI_LCS_GARAGEDOOR03) \
- X("vheistlocdoor", MI_LCS_GARAGEDOOR04) \
- X("door2_garage", MI_LCS_GARAGEDOOR05) \
- X("ind_slidedoor", MI_LCS_GARAGEDOOR06) \
- X("bankjobdoor", MI_LCS_GARAGEDOOR07) \
- X("door_jmsgrage", MI_LCS_GARAGEDOOR08) \
- X("ind_safeh_gdoor", MI_LCS_GARAGEDOOR09) \
- X("door_sfehousegrge", MI_LCS_GARAGEDOOR10) \
- X("shedgaragedoor", MI_LCS_GARAGEDOOR11) \
- X("door4_garage", MI_LCS_GARAGEDOOR12) \
- X("door_col_compnd_01", MI_LCS_GARAGEDOOR13) \
- X("door_col_compnd_02", MI_LCS_GARAGEDOOR14) \
- X("door_col_compnd_03", MI_LCS_GARAGEDOOR15) \
- X("door_col_compnd_04", MI_LCS_GARAGEDOOR16) \
- X("door_col_compnd_05", MI_LCS_GARAGEDOOR17) \
- X("impex_door", MI_LCS_GARAGEDOOR18) \
- X("SalvGarage", MI_LCS_GARAGEDOOR19) \
- X("door3_garage", MI_LCS_GARAGEDOOR20) \
- X("leveldoor2", MI_LCS_GARAGEDOOR21) \
- X("double_garage_dr", MI_LCS_GARAGEDOOR22) \
- X("amcogaragedoor", MI_LCS_GARAGEDOOR23) \
- X("towergaragedoor1", MI_LCS_GARAGEDOOR24) \
- X("towergaragedoor2", MI_LCS_GARAGEDOOR25) \
- X("towergaragedoor3", MI_LCS_GARAGEDOOR26) \
- X("plysve_gragedoor", MI_LCS_GARAGEDOOR27) \
- X("impexpsubgrgdoor", MI_LCS_GARAGEDOOR28) \
- X("Sub_sprayshopdoor", MI_LCS_GARAGEDOOR29) \
- X("ind_plyrwoor", MI_LCS_GARAGEDOOR30) \
- X("8ballsuburbandoor", MI_LCS_GARAGEDOOR31) \
- X("door_nthgrage", MI_LCS_GARAGEDOOR32) \
- X("hangardoor1", MI_LCS_GARAGEDOOR33) \
- X("hangardoor2", MI_LCS_GARAGEDOOR34) \
- X("neds_door", MI_LCS_GARAGEDOOR35) \
- X("fs_wrhsedoor", MI_LCS_GARAGEDOOR36) \
- X("jm_ContraGarage", MI_LCS_GARAGEDOOR37) \
- X("jm_imp_SalvGarage", MI_LCS_GARAGEDOOR38) \
- X("crushercrush", MI_LCS_GARAGEDOOR39) \
- X("crushertop", MI_LCS_GARAGEDOOR40) \
- X("crusher_crane", MI_LCS_CRANE01) \
-
-// NB: MI_LCS_ <- temporary stuff so that garages started somewhat working
-
-#define X(name, var) extern int16 var;
- MODELINDICES
-#undef X
+ X("pt_barrier", MI_PT_BARRIER) \
+ X("subwaygate", MI_SUBWAYGATE) \
+ X("in_PMbridramp3", MI_IN_PMBRIDRAMP3) \
+ X("in_PMbridg2_upgs", MI_IN_PMBRIDG2_UPGS) \
+ X("in_PMbridge2", MI_IN_PMBRIDGE2) \
+ X("in_PMbridg1_upgs", MI_IN_PMBRIDG1_UPGS) \
+ X("pm_lightrig3", MI_PM_LIGHTRIG3) \
+ X("pm_lightrig1", MI_PM_LIGHTRIG1) \
+ X("in_pmSCAFF_UPS", MI_IN_PMSCAFF_UPS) \
+ X("in_pm_concblok2", MI_IN_PM_CONCBLOK2) \
+ X("in_pmSCAFFH_ns", MI_IN_PMSCAFFH_NS) \
+ X("in_pm_gravl_jmp", MI_IN_PM_GRAVL_JMP) \
+ X("in_pm_scaffcovr", MI_IN_PM_SCAFFCOVR) \
+ X("in_pm_girder2", MI_IN_PM_GIRDER2) \
+ X("in_pm_scaffH_we", MI_IN_PM_SCAFFH_WE) \
+ X("in_pm_sixconc2", MI_IN_PM_SIXCONC2) \
+ X("in_BMbridramp3", MI_IN_BMBRIDRAMP3) \
+ X("in_BMbridg2_upgs", MI_IN_BMBRIDG2_UPGS) \
+ X("in_BMbridge2", MI_IN_BMBRIDGE2) \
+ X("in_BMbridg1_upgs", MI_IN_BMBRIDG1_UPGS) \
+ X("Bm_lightrig3", MI_BM_LIGHTRIG3) \
+ X("bm_lightrig1", MI_BM_LIGHTRIG1) \
+ X("in_BmSCAFF_UPS", MI_IN_BMSCAFF_UPS) \
+ X("in_Bm_concblok2", MI_IN_BM_CONCBLOK2) \
+ X("in_BmSCAFFH_ns", MI_IN_BMSCAFFH_NS) \
+ X("in_Bm_gravl_jmp", MI_IN_BM_GRAVL_JMP) \
+ X("in_Bm_scaffcovr", MI_IN_BM_SCAFFCOVR) \
+ X("in_Bm_girder2", MI_IN_BM_GIRDER2) \
+ X("in_Bm_scaffH_we", MI_IN_BM_SCAFFH_WE) \
+ X("in_Bm_sixconc2", MI_IN_BM_SIXCONC2)
+
+ /*X("yt_main_body2", MI_YT_MAIN_BODY2) \*/
+
+//#define X(name, var) extern int16 var;
+// MODELINDICES
+//#undef X
// and some hardcoded ones
// expand as needed
@@ -576,11 +1258,7 @@ IsLightThatNeedsRepositioning(int16 id)
return id == MI_SINGLESTREETLIGHTS1 ||
id == MI_SINGLESTREETLIGHTS2 ||
id == MI_SINGLESTREETLIGHTS3 ||
- id == MI_TRAFFICLIGHTS_MIAMI ||
- id == MI_TRAFFICLIGHTS_TWOVERTICAL ||
- id == MI_MLAMPPOST ||
- id == MI_STREETLAMP1 ||
- id == MI_STREETLAMP2;
+ id == MI_DOUBLESTREETLIGHTS;
}
inline bool
@@ -592,7 +1270,9 @@ IsLightObject(int16 id)
id == MI_SINGLESTREETLIGHTS2 ||
id == MI_SINGLESTREETLIGHTS3 ||
id == MI_DOUBLESTREETLIGHTS ||
- id == MI_TRAFFICLIGHTS_TWOVERTICAL;
+ id == MI_TRAFFICLIGHTS_TWOVERTICAL ||
+ id == MI_TRAFFICLIGHTS ||
+ id == MI_FENCE;
}
inline bool
@@ -624,24 +1304,26 @@ IsPedModel(int16 id)
inline bool
IsPalmTreeModel(int16 id)
{
- return id == MI_VEG_PALM01 ||
- id == MI_VEG_PALM02 ||
- id == MI_VEG_PALM03 ||
- id == MI_VEG_PALM04 ||
- id == MI_VEG_PALM05 ||
- id == MI_VEG_PALM06 ||
- id == MI_VEG_PALM07 ||
- id == MI_VEG_PALM08;
+ return false;
}
inline bool
IsTreeModel(int16 id)
{
- return id == MI_TREE2 ||
+ return id == MI_TREE1 ||
+ id == MI_TREE2 ||
id == MI_TREE3 ||
+ id == MI_TREE4 ||
+ id == MI_TREE5 ||
id == MI_TREE6 ||
+ id == MI_TREE7 ||
id == MI_TREE8 ||
- IsPalmTreeModel(id);
+ id == MI_TREE9 ||
+ id == MI_TREE10 ||
+ id == MI_TREE11 ||
+ id == MI_TREE12 ||
+ id == MI_TREE13 ||
+ id == MI_TREE14;
}
inline bool
diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h
index 1ac7b0bb..30f4c015 100644
--- a/src/modelinfo/ModelInfo.h
+++ b/src/modelinfo/ModelInfo.h
@@ -1,14 +1,13 @@
#pragma once
#include "2dEffect.h"
-#include "BaseModelInfo.h"
#include "SimpleModelInfo.h"
#include "TimeModelInfo.h"
#include "WeaponModelInfo.h"
#include "ClumpModelInfo.h"
#include "PedModelInfo.h"
#include "VehicleModelInfo.h"
-#include "Instance.h"
+#include "templates.h"
class CModelInfo
{
diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h
index 86e6b74a..79bd7eaa 100644
--- a/src/modelinfo/PedModelInfo.h
+++ b/src/modelinfo/PedModelInfo.h
@@ -1,6 +1,7 @@
#pragma once
#include "ClumpModelInfo.h"
+#include "ColModel.h"
#include "PedType.h"
enum PedNode {
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 354bda88..1009a9b4 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -38,6 +38,7 @@
#include "WindModifiers.h"
#include "CutsceneShadow.h"
#include "Clock.h"
+#include "Wanted.h"
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 1acd571b..f3271861 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -9,8 +9,8 @@
#include "Physical.h"
#include "Weapon.h"
#include "WeaponInfo.h"
-#include "AnimationId.h"
#include "PathFind.h"
+#include "Collision.h"
#define FEET_OFFSET 1.04f
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 38c09e33..69e340e3 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -45,8 +45,8 @@ CRGBA ARMOUR_COLOR(185, 185, 185, 255);
CRGBA NOTWANTED_COLOR(27, 89, 130, 255);
CRGBA WANTED_COLOR_FLASH(62, 141, 181, 255);
CRGBA WANTED_COLOR(97, 194, 247, 255);
-CRGBA ZONE_COLOR(45, 155, 90, 255);
-CRGBA VEHICLE_COLOR(97, 194, 247, 255);
+CRGBA ZONE_COLOR(255, 255, 255, 255);
+CRGBA VEHICLE_COLOR(255, 255, 255, 255);
CRGBA CLOCK_COLOR(97, 194, 247, 255);
CRGBA TIMER_COLOR(97, 194, 247, 255);
CRGBA COUNTER_COLOR(97, 194, 247, 255);
@@ -785,14 +785,14 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetBackgroundOff();
- if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH)
- CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.8f), SCREEN_SCALE_Y(1.8f));
+ if (FrontEndMenuManager.m_PrefsUseWideScreen)
+ CFont::SetScale(PSP_SCREEN_SCALE_X(0.42768f), PSP_SCREEN_SCALE_Y(0.88f));
else
- CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f));
-
- CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f));
- CFont::SetSlant(0.15f);
+ CFont::SetScale(PSP_SCREEN_SCALE_X(0.4752f), PSP_SCREEN_SCALE_Y(0.88f));
+ //CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f));
+ //CFont::SetSlant(0.15f);
+ CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
@@ -802,9 +802,9 @@ void CHud::Draw()
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
if (!CTheScripts::bPlayerIsInTheStatium)
- CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
+ CFont::PrintStringFromBottom(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(16.0f), m_ZoneToPrint);
- CFont::SetSlant(0.f);
+ //CFont::SetSlant(0.f);
} else {
m_ZoneState = 3;
}
@@ -885,13 +885,14 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetBackgroundOff();
- if (FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_SPANISH)
- CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f));
+ if (FrontEndMenuManager.m_PrefsUseWideScreen)
+ CFont::SetScale(PSP_SCREEN_SCALE_X(0.42768f), PSP_SCREEN_SCALE_Y(0.88f));
else
- CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.85f), SCREEN_SCALE_Y(1.8f));
+ CFont::SetScale(PSP_SCREEN_SCALE_X(0.4752f), PSP_SCREEN_SCALE_Y(0.88f));
- CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f));
- CFont::SetSlant(0.15f);
+ CFont::SetWrapx(SCREEN_WIDTH);
+ CFont::SetSlantRefPoint(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(35.6f));
+ CFont::SetSlant(0.f);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
@@ -901,7 +902,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha));
CFont::SetDropColor(CRGBA(0, 0, 0, fVehicleAlpha));
- CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f), m_pVehicleNameToPrint);
+ CFont::PrintStringFromBottom(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(35.6f), m_pVehicleNameToPrint);
CFont::SetSlant(0.f);
}
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index 5abc94b9..ab77bf9b 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -1,4 +1,3 @@
-#define WITHWINDOWS
#ifndef LIBRW
#define WITHD3D
#endif
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index bada38b7..90b54ab7 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1,4 +1,4 @@
-#define WITH_D3D
+#define WITHD3D
#include "common.h"
#include "main.h"
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp
index 35b0b2fc..3387cb2e 100644
--- a/src/render/SpecialFX.cpp
+++ b/src/render/SpecialFX.cpp
@@ -877,7 +877,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
pMarker->m_Matrix.GetPosition() = pos;
if (pMarker->m_bFindZOnNextPlacement) {
- if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(CVector2D(pos))) {
+ if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(pos)) {
float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
if (z != 0.0f)
pMarker->m_Matrix.GetPosition().z = z - 0.05f * size;
@@ -893,7 +893,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate);
if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) {
- if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(CVector2D(pos))) {
+ if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(pos)) {
float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
if (z != 0.0f)
pos.z = z - 0.05f * size;
diff --git a/src/render/WaterCreatures.cpp b/src/render/WaterCreatures.cpp
index b44f987c..4c6c92a6 100644
--- a/src/render/WaterCreatures.cpp
+++ b/src/render/WaterCreatures.cpp
@@ -1,11 +1,12 @@
+#include "common.h"
#include "WaterCreatures.h"
#include "ModelIndices.h"
#include "World.h"
#include "WaterLevel.h"
#include "Camera.h"
#include "PlayerPed.h"
-#include "config.h"
#include "General.h"
+#include "Object.h"
/*
int CWaterCreatures::nNumActiveSeaLifeForms;
diff --git a/src/render/WaterCreatures.h b/src/render/WaterCreatures.h
index 0b8d2376..099cc1a4 100644
--- a/src/render/WaterCreatures.h
+++ b/src/render/WaterCreatures.h
@@ -1,5 +1,6 @@
#pragma once
-#include "Object.h"
+
+class CObject;
/*
enum eFishSlotState {
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index d80a3904..186ed870 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -1,6 +1,4 @@
-#if defined RW_D3D9 || defined RWLIBS
#define WITHD3D
-#endif
#include "common.h"
#include "Timecycle.h"
diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp
index 0bd29718..b7936bcf 100644
--- a/src/rw/TxdStore.cpp
+++ b/src/rw/TxdStore.cpp
@@ -1,5 +1,7 @@
#include "common.h"
+#include "main.h"
+#include "smallHeap.h"
#include "templates.h"
#include "General.h"
#include "Streaming.h"
@@ -9,13 +11,19 @@
CPool<TxdDef,TxdDef> *CTxdStore::ms_pTxdPool;
RwTexDictionary *CTxdStore::ms_pStoredTxd;
+// LCS: file done except unused:
+// CTexListStore::RemoveTexListChunk(int)
+// CTexListStore::validateRefs(void)
+// CTexListStore::Write(base::cRelocatableChunkWriter &)
+
void
CTxdStore::Initialise(void)
{
- if(ms_pTxdPool == nil)
+ if(gMakeResources && ms_pTxdPool == nil)
ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE, "TexDictionary");
}
+// removed in LCS but we should probably keep it
void
CTxdStore::Shutdown(void)
{
@@ -23,6 +31,7 @@ CTxdStore::Shutdown(void)
delete ms_pTxdPool;
}
+// removed in LCS but we should probably keep it
void
CTxdStore::GameShutdown(void)
{
@@ -42,6 +51,7 @@ CTxdStore::AddTxdSlot(const char *name)
assert(def);
def->texDict = nil;
def->refCount = 0;
+ def->refCountGu = 0;
strcpy(def->name, name);
return ms_pTxdPool->GetJustIndex(def);
}
@@ -95,7 +105,11 @@ CTxdStore::SetCurrentTxd(int slot)
void
CTxdStore::Create(int slot)
{
- GetSlot(slot)->texDict = RwTexDictionaryCreate();
+ TxdDef *def = GetSlot(slot);
+ def->texDict = RwTexDictionaryCreate();
+ // LCS: mobile sets the txd name here, but txds don't really have names
+ def->refCount = 0;
+ def->refCountGu = 0;
}
int
@@ -111,6 +125,20 @@ CTxdStore::AddRef(int slot)
}
void
+CTxdStore::AddRefEvenIfNotInMemory(int slot)
+{
+ GetSlot(slot)->refCount++;
+}
+
+void
+CTxdStore::AddRefGu(int slot)
+{
+ TxdDef *def = GetSlot(slot);
+ def->refCount++;
+ def->refCountGu++;
+}
+
+void
CTxdStore::RemoveRef(int slot)
{
if(--GetSlot(slot)->refCount <= 0)
@@ -118,6 +146,15 @@ CTxdStore::RemoveRef(int slot)
}
void
+CTxdStore::RemoveRefGu(int slot)
+{
+ TxdDef *def = GetSlot(slot);
+ def->refCount--;
+ if(gUseChunkFiles)
+ def->refCountGu--;
+}
+
+void
CTxdStore::RemoveRefWithoutDelete(int slot)
{
GetSlot(slot)->refCount--;
@@ -128,15 +165,32 @@ CTxdStore::LoadTxd(int slot, RwStream *stream)
{
TxdDef *def = GetSlot(slot);
- if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
- def->texDict = RwTexDictionaryGtaStreamRead(stream);
- return def->texDict != nil;
+ if(stream){
+ if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
+ def->texDict = RwTexDictionaryGtaStreamRead(stream);
+ return def->texDict != nil;
+ }
+ }else{
+ // TODO(LCS)? fall back reading from file
}
printf("Failed to load TXD\n");
return false;
}
bool
+CTxdStore::LoadTxd(int slot, void *data, void *chunk)
+{
+ TxdDef *def = GetSlot(slot);
+ def->texDict = (RwTexDictionary*)data;
+ if(strncasecmp(def->name, "radar", 5) == 0){
+ def->refCount = 0;
+ def->refCountGu = 0;
+ }
+ CStreaming::RegisterPointer(&def->texDict, 3, true);
+ return def->texDict != nil;
+}
+
+bool
CTxdStore::LoadTxd(int slot, const char *filename)
{
RwStream *stream;
@@ -152,6 +206,7 @@ CTxdStore::LoadTxd(int slot, const char *filename)
return ret;
}
+// removed in LCS but we should probably keep it
bool
CTxdStore::StartLoadTxd(int slot, RwStream *stream)
{
@@ -165,6 +220,7 @@ CTxdStore::StartLoadTxd(int slot, RwStream *stream)
}
}
+// removed in LCS but we should probably keep it
bool
CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
{
@@ -174,10 +230,31 @@ CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
}
void
-CTxdStore::RemoveTxd(int slot)
+CTxdStore::RemoveTxd(int slot, bool notChunk)
{
TxdDef *def = GetSlot(slot);
- if(def->texDict)
- RwTexDictionaryDestroy(def->texDict);
+ if(def->texDict){
+ if(!gUseChunkFiles || notChunk)
+ RwTexDictionaryDestroy(def->texDict);
+ else{
+ // TODO? Rsl3D specific: RslTextureDestroyDispList for all textures
+ CStreaming::UnregisterPointer(&def->texDict, 3);
+ cSmallHeap::msInstance.Free(def->texDict);
+ }
+ }
def->texDict = nil;
+ def->refCount = 0;
+ def->refCountGu = 0;
+}
+
+void
+CTxdStore::Load(RwTexDictionary *stored, CPool<TxdDef> *pool)
+{
+ ms_pTxdPool = pool;
+ ms_pStoredTxd = stored;
+ for(int i = 0; i < TXDSTORESIZE; i++){
+ TxdDef *def = GetSlot(i);
+ if(def)
+ def->refCount = def->texDict != nil;
+ }
}
diff --git a/src/rw/TxdStore.h b/src/rw/TxdStore.h
index 937fd1b7..31fcf87f 100644
--- a/src/rw/TxdStore.h
+++ b/src/rw/TxdStore.h
@@ -4,7 +4,8 @@
struct TxdDef {
RwTexDictionary *texDict;
- int refCount;
+ int16 refCount;
+ int16 refCountGu;
char name[20];
};
@@ -26,13 +27,19 @@ public:
static void Create(int slot);
static int GetNumRefs(int slot);
static void AddRef(int slot);
+ static void AddRefEvenIfNotInMemory(int slot);
+ static void AddRefGu(int slot);
static void RemoveRef(int slot);
+ static void RemoveRefGu(int slot);
static void RemoveRefWithoutDelete(int slot);
static bool LoadTxd(int slot, RwStream *stream);
+ static bool LoadTxd(int slot, void *data, void *chunk);
static bool LoadTxd(int slot, const char *filename);
static bool StartLoadTxd(int slot, RwStream *stream);
static bool FinishLoadTxd(int slot, RwStream *stream);
- static void RemoveTxd(int slot);
+ static void RemoveTxd(int slot, bool notChunk = false);
+
+ static void Load(RwTexDictionary *stored, CPool<TxdDef> *pool);
static TxdDef *GetSlot(int slot) {
assert(slot >= 0);
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 44aace43..e0a989de 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -345,7 +345,11 @@ GenericLoad()
#endif
ReadDataFromBufferPointer(buf, CGame::currArea);
ReadDataFromBufferPointer(buf, CVehicle::bAllTaxisHaveNitro);
+#ifdef LOAD_INI_SETTINGS
buf += align4bytes(sizeof(CPad::bInvertLook4Pad));
+#else
+ ReadDataFromBufferPointer(buf, CPad::bInvertLook4Pad);
+#endif
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour);
ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn);
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter);
diff --git a/src/save/MemoryCard.cpp b/src/save/MemoryCard.cpp
index c8ebcd86..d6e95d33 100644
--- a/src/save/MemoryCard.cpp
+++ b/src/save/MemoryCard.cpp
@@ -1,6 +1,7 @@
#define WITHWINDOWS
#include "common.h"
#ifdef PS2_MENU
+#include "crossplatform.h"
#include "MemoryCard.h"
#include "main.h"
#include "DMAudio.h"
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index d0818d6d..3e7ba0ab 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -1,22 +1,30 @@
#if defined RW_GL3 && !defined LIBRW_SDL2
#ifdef _WIN32
-#include <windows.h>
+#include <shlobj.h>
+#include <basetsd.h>
#include <mmsystem.h>
+#include <regstr.h>
#include <shellapi.h>
#include <windowsx.h>
-#include <basetsd.h>
-#include <regstr.h>
-#include <shlobj.h>
+
+DWORD _dwOperatingSystemVersion;
+#include "resource.h"
+#else
+long _dwOperatingSystemVersion;
+#ifndef __APPLE__
+#include <sys/sysinfo.h>
+#else
+#include <mach/mach_host.h>
+#include <sys/sysctl.h>
+#endif
+#include <errno.h>
+#include <locale.h>
+#include <signal.h>
+#include <stddef.h>
#endif
-#define WITHWINDOWS
#include "common.h"
-
-#pragma warning( push )
-#pragma warning( disable : 4005)
-#pragma warning( pop )
-
#if (defined(_MSC_VER))
#include <tchar.h>
#endif /* (defined(_MSC_VER)) */
@@ -72,23 +80,6 @@ static psGlobalType PsGlobal;
size_t _dwMemAvailPhys;
RwUInt32 gGameState;
-#ifdef _WIN32
-DWORD _dwOperatingSystemVersion;
-#include "resource.h"
-#else
-long _dwOperatingSystemVersion;
-#ifndef __APPLE__
-#include <sys/sysinfo.h>
-#else
-#include <mach/mach_host.h>
-#include <sys/sysctl.h>
-#endif
-#include <stddef.h>
-#include <locale.h>
-#include <signal.h>
-#include <errno.h>
-#endif
-
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
char gSelectedJoystickName[128] = "";
#endif
@@ -1646,6 +1637,13 @@ main(int argc, char *argv[])
{
CFileMgr::SetDirMyDocuments();
+#ifdef LOAD_INI_SETTINGS
+ // At this point InitDefaultControlConfigJoyPad must have set all bindings to default and ms_padButtonsInited to number of detected buttons.
+ // We will load stored bindings below, but let's cache ms_padButtonsInited before LoadINIControllerSettings and LoadSettings clears it,
+ // so we can add new joy bindings **on top of** stored bindings.
+ int connectedPadButtons = ControlsManager.ms_padButtonsInited;
+#endif
+
int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r");
if ( gta3set )
@@ -1655,6 +1653,14 @@ main(int argc, char *argv[])
}
CFileMgr::SetDir("");
+
+#ifdef LOAD_INI_SETTINGS
+ LoadINIControllerSettings();
+ if (connectedPadButtons != 0) {
+ ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons);
+ SaveINIControllerSettings();
+ }
+#endif
}
#ifdef _WIN32
@@ -2168,6 +2174,12 @@ void joysChangeCB(int jid, int event)
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
strcpy(gSelectedJoystickName, glfwGetJoystickName(jid));
#endif
+ // This is behind LOAD_INI_SETTINGS, because otherwise the Init call below will destroy/overwrite your bindings.
+#ifdef LOAD_INI_SETTINGS
+ int count;
+ glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
+ ControlsManager.InitDefaultControlConfigJoyPad(count);
+#endif
} else if (PSGLOBAL(joy2id) == -1)
PSGLOBAL(joy2id) = jid;
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index db6215f0..87c3846a 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -2,7 +2,6 @@
#define _WIN32_WINDOWS 0x0500
#define WINVER 0x0500
-#define DIRECTINPUT_VERSION 0x0800
#include <winerror.h>
#include <windows.h>
@@ -20,13 +19,7 @@
#pragma warning( push )
#pragma warning( disable : 4005)
-#ifdef USE_D3D9
-#include <d3d9.h>
-#else
-#include <d3d8.h>
-#endif
#include <ddraw.h>
-#include <dinput.h>
#include <DShow.h>
#pragma warning( pop )
@@ -41,6 +34,9 @@
#pragma comment( lib, "strmiids.lib" )
#pragma comment( lib, "dinput8.lib" )
+#define WITHD3D
+#define WITHDINPUT
+#include "common.h"
#if (defined(_MSC_VER))
#include <tchar.h>
#endif /* (defined(_MSC_VER)) */
@@ -81,7 +77,6 @@ static psGlobalType PsGlobal;
#define JIF(x) if (FAILED(hr=(x))) \
{debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;}
-#include "common.h"
#include "main.h"
#include "FileMgr.h"
#include "Text.h"
@@ -92,12 +87,14 @@ static psGlobalType PsGlobal;
#include "Frontend.h"
#include "Game.h"
#include "PCSave.h"
-#include "MemoryCard.h"
-#include "Sprite2d.h"
#include "AnimViewer.h"
-#include "Font.h"
#include "MemoryMgr.h"
+#ifdef PS2_MENU
+#include "MemoryCard.h"
+#include "Font.h"
+#endif
+
VALIDATE_SIZE(psGlobalType, 0x28);
// DirectShow interfaces
@@ -2148,8 +2145,15 @@ WinMain(HINSTANCE instance,
{
CFileMgr::SetDirMyDocuments();
+#ifdef LOAD_INI_SETTINGS
+ // At this point InitDefaultControlConfigJoyPad must have set all bindings to default and ms_padButtonsInited to number of detected buttons.
+ // We will load stored bindings below, but let's cache ms_padButtonsInited before LoadINIControllerSettings and LoadSettings clears it,
+ // so we can add new joy bindings **on top of** stored bindings.
+ int connectedPadButtons = ControlsManager.ms_padButtonsInited;
+#endif
+
int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r");
-
+
if ( gta3set )
{
ControlsManager.LoadSettings(gta3set);
@@ -2157,6 +2161,14 @@ WinMain(HINSTANCE instance,
}
CFileMgr::SetDir("");
+
+#ifdef LOAD_INI_SETTINGS
+ LoadINIControllerSettings();
+ if (connectedPadButtons != 0) {
+ ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons);
+ SaveINIControllerSettings();
+ }
+#endif
}
SetErrorMode(SEM_FAILCRITICALERRORS);
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 13291d33..a4d9e5c3 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -49,6 +49,7 @@
#include "Object.h"
#include "Automobile.h"
#include "Bike.h"
+#include "Wanted.h"
bool bAllCarCheat;
diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp
index 7b6787c7..6ad59769 100644
--- a/src/vehicles/Bike.cpp
+++ b/src/vehicles/Bike.cpp
@@ -79,6 +79,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
m_bikeAnimType = ASSOCGRP_BIKE_STANDARD;
break;
case MI_SANCHEZ:
+ case MI_SANCHEZ2:
m_bikeAnimType = ASSOCGRP_BIKE_DIRT;
break;
default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO
diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h
index 3fcf66a2..219d8872 100644
--- a/src/vehicles/Bike.h
+++ b/src/vehicles/Bike.h
@@ -2,6 +2,7 @@
#include "Vehicle.h"
#include "Skidmarks.h"
+#include "AnimManager.h"
enum eBikeNodes {
BIKE_NODE_NONE,
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 6a15d53d..381d13d8 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -27,6 +27,7 @@
#include "RpAnimBlend.h"
#include "Record.h"
#include "Shadows.h"
+#include "Wanted.h"
#define INVALID_ORIENTATION (-9999.99f)
diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp
index c84b6732..a675fe4e 100644
--- a/src/vehicles/Cranes.cpp
+++ b/src/vehicles/Cranes.cpp
@@ -50,7 +50,12 @@ void CCranes::InitCranes(void)
for (int j = 0; j < NUMSECTORS_Y; j++) {
for (CPtrNode* pNode = CWorld::GetSector(i, j)->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
- if (MI_LCS_CRANE01 == pEntity->GetModelIndex())
+ if (MODELID_CRANE_1 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_2 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_3 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_4 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_5 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_6 == pEntity->GetModelIndex())
AddThisOneCrane(pEntity);
}
}
@@ -58,7 +63,12 @@ void CCranes::InitCranes(void)
// TODO(LCS)
for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_INDUSTRIAL).first; pNode; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
- if (MI_LCS_CRANE01 == pEntity->GetModelIndex())
+ if (MODELID_CRANE_1 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_2 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_3 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_4 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_5 == pEntity->GetModelIndex() ||
+ MODELID_CRANE_6 == pEntity->GetModelIndex())
AddThisOneCrane(pEntity);
}
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index e5cd3f62..cebafd77 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -3,15 +3,15 @@
#include "Physical.h"
#include "AutoPilot.h"
#include "ModelIndices.h"
-#include "AnimManager.h"
-#include "Weapon.h"
+#include "AnimationId.h"
+#include "WeaponType.h"
+#include "Collision.h"
#include "HandlingMgr.h"
class CPed;
class CPlayerPed;
class CCopPed;
class CFire;
-struct tHandlingData;
enum {
RANDOM_VEHICLE = 1,