1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 09:20:02 +00:00
This commit is contained in:
Nikolay Korolev 2021-01-24 13:42:45 +03:00
parent bdb216bf7c
commit ee89c485fc
82 changed files with 2088 additions and 576 deletions

View file

@ -242,6 +242,7 @@ project "reLCS"
files { addSrcFiles("src/control") } files { addSrcFiles("src/control") }
files { addSrcFiles("src/core") } files { addSrcFiles("src/core") }
files { addSrcFiles("src/entities") } files { addSrcFiles("src/entities") }
files { addSrcFiles("src/leeds") }
files { addSrcFiles("src/leeds/base") } files { addSrcFiles("src/leeds/base") }
files { addSrcFiles("src/math") } files { addSrcFiles("src/math") }
files { addSrcFiles("src/modelinfo") } files { addSrcFiles("src/modelinfo") }
@ -267,6 +268,7 @@ project "reLCS"
includedirs { "src/control" } includedirs { "src/control" }
includedirs { "src/core" } includedirs { "src/core" }
includedirs { "src/entities" } includedirs { "src/entities" }
includedirs { "src/leeds" }
includedirs { "src/leeds/base" } includedirs { "src/leeds/base" }
includedirs { "src/math" } includedirs { "src/math" }
includedirs { "src/modelinfo" } includedirs { "src/modelinfo" }

View file

@ -41,7 +41,7 @@
#include "WindModifiers.h" #include "WindModifiers.h"
#include "Fluff.h" #include "Fluff.h"
#include "Script.h" #include "Script.h"
#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
@ -9311,7 +9311,8 @@ cAudioManager::ProcessBridge()
void void
cAudioManager::ProcessBridgeWarning() 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); m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nCounter = 0;
@ -9332,7 +9333,7 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }
} }*/
} }
void void

View file

@ -544,8 +544,8 @@ public:
#endif #endif
}; };
#ifdef AUDIO_MSS //#ifdef AUDIO_MSS
static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); //static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
#endif //#endif
extern cAudioManager AudioManager; extern cAudioManager AudioManager;

View file

@ -13,6 +13,7 @@
#include "World.h" #include "World.h"
#include "Zones.h" #include "Zones.h"
#include "sampman.h" #include "sampman.h"
#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Wanted.h" #include "Crime.h"
struct cAMCrime { struct cAMCrime {
int32 type; int32 type;

View file

@ -1,5 +1,4 @@
#pragma once #pragma once
#include "common.h"
#include "AudioSamples.h" #include "AudioSamples.h"
#define MAX_VOLUME 127 #define MAX_VOLUME 127

View file

@ -1,8 +1,5 @@
#include "common.h"
#ifdef AUDIO_MSS #ifdef AUDIO_MSS
#include <windows.h> #include <shlobj.h>
#include <shobjidl.h>
#include <shlguid.h> #include <shlguid.h>
#include <time.h> #include <time.h>
@ -11,6 +8,7 @@
#include "eax-util.h" #include "eax-util.h"
#include "mss.h" #include "mss.h"
#include "common.h"
#include "sampman.h" #include "sampman.h"
#include "AudioManager.h" #include "AudioManager.h"
#include "MusicManager.h" #include "MusicManager.h"

View file

@ -1,17 +1,11 @@
//#define JUICY_OAL //#define JUICY_OAL
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#include "sampman.h"
#include <time.h> #include <time.h>
#include "eax.h" #include "eax.h"
#include "eax-util.h" #include "eax-util.h"
#define WITHWINDOWS
#include "common.h"
#include "crossplatform.h"
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> #include <io.h>
#include <AL/al.h> #include <AL/al.h>
@ -19,8 +13,24 @@
#include <AL/alext.h> #include <AL/alext.h>
#include <AL/efx.h> #include <AL/efx.h>
#include <AL/efx-presets.h> #include <AL/efx-presets.h>
// for user MP3s
#include <direct.h>
#include <shlobj.h>
#include <shlguid.h>
#else
#define _getcwd getcwd
#endif #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/oal_utils.h"
#include "oal/aldlist.h" #include "oal/aldlist.h"
#include "oal/channel.h" #include "oal/channel.h"
@ -38,19 +48,6 @@
//TODO: max channels //TODO: max channels
//TODO: loop count //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; cSampleManager SampleManager;
bool _bSampmanInitialised = false; bool _bSampmanInitialised = false;

View file

@ -1,5 +1,7 @@
#include "common.h" #include "common.h"
#include "main.h"
#include "smallHeap.h"
#include "templates.h" #include "templates.h"
#include "General.h" #include "General.h"
#include "ModelInfo.h" #include "ModelInfo.h"
@ -8,6 +10,9 @@
#include "Script.h" #include "Script.h"
#include "Timer.h" #include "Timer.h"
#include "Camera.h" #include "Camera.h"
#include "World.h"
#include "Zones.h"
#include "Garages.h"
#include "Frontend.h" #include "Frontend.h"
#include "Physical.h" #include "Physical.h"
#include "ColStore.h" #include "ColStore.h"
@ -15,16 +20,55 @@
#include "Pools.h" #include "Pools.h"
CPool<ColDef,ColDef> *CColStore::ms_pColPool; CPool<ColDef,ColDef> *CColStore::ms_pColPool;
bool CColStore::m_onlyBB;
#ifndef MASTER #ifndef MASTER
bool bDispColInMem; bool bDispColInMem;
#endif #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 void
CColStore::Initialise(void) CColStore::Initialise(void)
{ {
if(ms_pColPool == nil) if(ms_pColPool == nil){
ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles"); ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles");
AddColSlot("generic"); // slot 0. not streamed AddColSlot("generic"); // slot 0. not streamed
}
#ifndef MASTER #ifndef MASTER
VarConsole.Add("Display collision in memory", &bDispColInMem, true); VarConsole.Add("Display collision in memory", &bDispColInMem, true);
#endif #endif
@ -38,7 +82,9 @@ CColStore::Shutdown(void)
RemoveColSlot(i); RemoveColSlot(i);
if(ms_pColPool) if(ms_pColPool)
delete ms_pColPool; delete ms_pColPool;
#ifdef FIX_BUGS
ms_pColPool = nil; ms_pColPool = nil;
#endif
} }
int int
@ -119,11 +165,34 @@ CColStore::LoadCol(int32 slot, uint8 *buffer, int32 bufsize)
return success; 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 void
CColStore::RemoveCol(int32 slot) CColStore::RemoveCol(int32 slot)
{ {
int id; int id;
GetSlot(slot)->isLoaded = false; ColDef *def = GetSlot(slot);
def->isLoaded = false;
for(id = 0; id < MODELINFOSIZE; id++){ for(id = 0; id < MODELINFOSIZE; id++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(id); CBaseModelInfo *mi = CModelInfo::GetModelInfo(id);
if(mi){ if(mi){
@ -132,6 +201,23 @@ CColStore::RemoveCol(int32 slot)
col->RemoveCollisionVolumes(); 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 void
@ -156,29 +242,49 @@ CColStore::RemoveAllCollision(void)
} }
static bool bLoadAtSecondPosition; static bool bLoadAtSecondPosition;
static CVector2D secondPosition; static CVector secondPosition;
void void
CColStore::AddCollisionNeededAtPosn(const CVector2D &pos) CColStore::AddCollisionNeededAtPosn(const CVector &pos)
{ {
bLoadAtSecondPosition = true; bLoadAtSecondPosition = true;
secondPosition = pos; secondPosition = pos;
} }
void void
CColStore::LoadCollision(const CVector2D &pos) CColStore::LoadCollision(const CVector &pos, eLevelName level)
{ {
int i; int i;
if(CStreaming::ms_disableStreaming) if(CStreaming::ms_disableStreaming)
return; 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++){ for(i = 1; i < COLSTORESIZE; i++){
if(GetSlot(i) == nil) if(GetSlot(i) == nil || !DoScriptsWantThisIn(i))
continue; continue;
bool wantThisOne = false; 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) || if(GetBoundingBox(i).IsPointInside(pos) ||
bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) || bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) ||
strcmp(GetColName(i), "yacht") == 0){ strcmp(GetColName(i), "yacht") == 0){
@ -203,28 +309,38 @@ CColStore::LoadCollision(const CVector2D &pos)
} }
} }
} }
*/
if(wantThisOne) if(wantThisOne){
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY); CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
else requestedSomething = true;
}else
CStreaming::RemoveCol(i); 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; bLoadAtSecondPosition = false;
} }
void void
CColStore::RequestCollision(const CVector2D &pos) CColStore::RequestCollision(const CVector &pos)
{ {
int i; int i;
for(i = 1; i < COLSTORESIZE; 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); CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
} }
void void
CColStore::EnsureCollisionIsInMemory(const CVector2D &pos) CColStore::EnsureCollisionIsInMemory(const CVector &pos)
{ {
/* // LCS: removed
int i; int i;
if(CStreaming::ms_disableStreaming) if(CStreaming::ms_disableStreaming)
@ -240,16 +356,48 @@ CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
CTimer::Resume(); CTimer::Resume();
} }
*/
} }
bool 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; int i;
const CVector &pos = LevelPos(level);
for(i = 1; i < COLSTORESIZE; i++) 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) !GetSlot(i)->isLoaded)
return false; return false;
return true; 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;
}

View file

@ -9,11 +9,13 @@ struct ColDef { // made up name
char name[20]; char name[20];
int16 minIndex; int16 minIndex;
int16 maxIndex; int16 maxIndex;
void *chunk;
}; };
class CColStore class CColStore
{ {
static CPool<ColDef,ColDef> *ms_pColPool; static CPool<ColDef,ColDef> *ms_pColPool;
static bool m_onlyBB;
public: public:
static void Initialise(void); static void Initialise(void);
@ -25,15 +27,18 @@ public:
static CRect &GetBoundingBox(int32 slot); static CRect &GetBoundingBox(int32 slot);
static void IncludeModelIndex(int32 slot, int32 modelIndex); static void IncludeModelIndex(int32 slot, int32 modelIndex);
static bool LoadCol(int32 storeID, uint8 *buffer, int32 bufsize); 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 RemoveCol(int32 slot);
static void AddCollisionNeededAtPosn(const CVector2D &pos); static void AddCollisionNeededAtPosn(const CVector &pos);
static void LoadAllCollision(void); static void LoadAllCollision(void);
static void RemoveAllCollision(void); static void RemoveAllCollision(void);
static void LoadCollision(const CVector2D &pos); static void LoadCollision(const CVector &pos, eLevelName level = LEVEL_GENERIC);
static void RequestCollision(const CVector2D &pos); static void RequestCollision(const CVector &pos);
static void EnsureCollisionIsInMemory(const CVector2D &pos); static void EnsureCollisionIsInMemory(const CVector &pos);
static bool HasCollisionLoaded(const CVector2D &pos); static bool DoScriptsWantThisIn(int32 slot);
static bool HasCollisionLoaded(eLevelName level) { return true; }; // TODO static bool HasCollisionLoaded(eLevelName level);
static bool HasCollisionLoaded(const CVector &pos);
static void Load(bool, CPool<ColDef> *pool);
static ColDef *GetSlot(int slot) { static ColDef *GetSlot(int slot) {
assert(slot >= 0); assert(slot >= 0);

View file

@ -1,6 +1,7 @@
#include "common.h" #include "common.h"
#include "TempColModels.h" #include "TempColModels.h"
#include "Game.h"
CColModel CTempColModels::ms_colModelPed1; CColModel CTempColModels::ms_colModelPed1;
CColModel CTempColModels::ms_colModelPed2; CColModel CTempColModels::ms_colModelPed2;

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Collision.h" #include "ColModel.h"
class CTempColModels class CTempColModels
{ {

View file

@ -161,3 +161,23 @@ bool CBridge::ThisIsABridgeObjectMovingUp(int index)
return false; return false;
#endif #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
}

View file

@ -26,4 +26,5 @@ public:
static bool ShouldLightsBeFlashing(); static bool ShouldLightsBeFlashing();
static void FindBridgeEntities(); static void FindBridgeEntities();
static bool ThisIsABridgeObjectMovingUp(int); static bool ThisIsABridgeObjectMovingUp(int);
static void ForceBridgeState(uint8 state);
}; };

View file

@ -1,11 +1,10 @@
#pragma once #pragma once
#include "Automobile.h"
#include "audio_enums.h" #include "audio_enums.h"
#include "Camera.h" #include "Camera.h"
#include "config.h" #include "config.h"
#include "Lists.h"
class CVehicle; class CVehicle;
class CCamera;
enum eGarageState enum eGarageState
{ {
@ -183,6 +182,10 @@ public:
void FindDoorsEntities(); void FindDoorsEntities();
void FindDoorsEntitiesSectorList(CPtrList&, bool); void FindDoorsEntitiesSectorList(CPtrList&, bool);
void PlayerArrestedOrDied(); void PlayerArrestedOrDied();
bool Does60SecondsNeedThisCarAtAll(int mi);
bool Does60SecondsNeedThisCar(int mi);
void MarkThisCarAsCollectedFor60Seconds(int mi);
bool IsPlayerEntirelyInsideGarage();
bool IsPointInsideGarage(CVector); bool IsPointInsideGarage(CVector);
bool IsPointInsideGarage(CVector, float); bool IsPointInsideGarage(CVector, float);
@ -255,6 +258,7 @@ public:
static bool IsModelIndexADoor(uint32 id); static bool IsModelIndexADoor(uint32 id);
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; } static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
static void SetFreeResprays(bool bValue) { RespraysAreFree = 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 void SetMaxNumStoredCarsForGarage(int16 garage, uint8 num) { aGarages[garage].m_nMaxStoredCars = num; }
static bool IsCarSprayable(CVehicle*); static bool IsCarSprayable(CVehicle*);
@ -293,4 +297,6 @@ public:
} }
static bool IsThisGarageTypeSafehouse(uint8 type) { return FindSafeHouseIndexForGarageType(type) >= 0; } static bool IsThisGarageTypeSafehouse(uint8 type) { return FindSafeHouseIndexForGarageType(type) >= 0; }
static void SetupAnyGaragesForThisIsland(void) {} // TODO(LCS)
}; };

View file

@ -338,17 +338,17 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x,
InfoForTileCars[i].x = x/16.0f; InfoForTileCars[i].x = x/16.0f;
InfoForTileCars[i].y = y/16.0f; InfoForTileCars[i].y = y/16.0f;
InfoForTileCars[i].z = z/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].numLeftLanes = numLeft;
InfoForTileCars[i].numRightLanes = numRight; InfoForTileCars[i].numRightLanes = numRight;
InfoForTilePeds[i].crossing = false; InfoForTileCars[i].crossing = false;
InfoForTilePeds[i].speedLimit = 0; InfoForTileCars[i].speedLimit = 0;
InfoForTilePeds[i].roadBlock = false; InfoForTileCars[i].roadBlock = false;
InfoForTilePeds[i].disabled = false; InfoForTileCars[i].disabled = false;
InfoForTilePeds[i].waterPath = false; InfoForTileCars[i].waterPath = false;
InfoForTilePeds[i].onlySmallBoats = false; InfoForTileCars[i].onlySmallBoats = false;
InfoForTilePeds[i].betweenLevels = false; InfoForTileCars[i].betweenLevels = false;
InfoForTilePeds[i].spawnRate = Min(spawnRate, 15); InfoForTileCars[i].spawnRate = Min(spawnRate, 15);
if(node == 11) if(node == 11)
InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound(); InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound();
@ -1763,18 +1763,18 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
float dist; float dist;
if(type == PATH_CAR) 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 else
DoPathSearch(type, start, -1, target, nil, &DummyResult2, 0, nil, &dist, 50.0f, -1); DoPathSearch(type, start, -1, target, nil, &DummyResult2, 0, nil, &dist, 50.0f, -1);
#ifdef FIX_BUGS #ifdef FIX_BUGS
// dist has GenerationDistMultiplier as a factor, so our reference dist should have it too // dist has GenerationDistMultiplier as a factor, so our reference dist should have it too
if(type == PATH_CAR) if(type == PATH_CAR)
return dist < 150.0f*TheCamera.GenerationDistMultiplier; return dist < 180.0f*TheCamera.GenerationDistMultiplier;
else else
return dist < 100.0f*TheCamera.GenerationDistMultiplier; return dist < 100.0f*TheCamera.GenerationDistMultiplier;
#else #else
if(type == PATH_CAR) if(type == PATH_CAR)
return dist < 150.0f; return dist < 180.0f;
else else
return dist < 100.0f; return dist < 100.0f;
#endif #endif

View file

@ -9,7 +9,7 @@
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "Vehicle.h" #include "Vehicle.h"
void CVehicle*
CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model) CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model)
{ {
CAutomobile *car = new CAutomobile(model, MISSION_VEHICLE); 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); TheCamera.SetZoomValueCamStringScript(0);
} else } else
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT); TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT);
return car;
} }
void void

View file

@ -3,6 +3,6 @@
class CRemote class CRemote
{ {
public: public:
static void GivePlayerRemoteControlledCar(float, float, float, float, uint16); static CVehicle* GivePlayerRemoteControlledCar(float, float, float, float, uint16);
static void TakeRemoteControlledCarFromPlayer(bool blowUp = true); static void TakeRemoteControlledCarFromPlayer(bool blowUp = true);
}; };

View file

@ -11,6 +11,7 @@
#include "CivilianPed.h" #include "CivilianPed.h"
#include "Clock.h" #include "Clock.h"
#include "CopPed.h" #include "CopPed.h"
#include "Coronas.h"
#include "Debug.h" #include "Debug.h"
#include "DMAudio.h" #include "DMAudio.h"
#include "EmergencyPed.h" #include "EmergencyPed.h"
@ -49,7 +50,7 @@
#include "Timecycle.h" #include "Timecycle.h"
#include "TxdStore.h" #include "TxdStore.h"
#include "Bike.h" #include "Bike.h"
#include "memoryManager.h" #include "smallHeap.h"
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#include <stdarg.h> #include <stdarg.h>
#endif #endif
@ -98,7 +99,7 @@ uint16 CTheScripts::NumberOfExclusiveMissionScripts;
bool CTheScripts::bPlayerHasMetDebbieHarry; bool CTheScripts::bPlayerHasMetDebbieHarry;
bool CTheScripts::bPlayerIsInTheStatium; bool CTheScripts::bPlayerIsInTheStatium;
int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS]; int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS];
bool CTheScripts::FSDestroyedFlag; int CTheScripts::FSDestroyedFlag;
short* CTheScripts::SavedVarIndices; short* CTheScripts::SavedVarIndices;
int CTheScripts::NumSaveVars; int CTheScripts::NumSaveVars;
int gScriptsFile = -1; int gScriptsFile = -1;
@ -107,6 +108,9 @@ bool CTheScripts::InTheScripts;
CRunningScript* pCurrent; CRunningScript* pCurrent;
uint16 CTheScripts::NumTrueGlobals; uint16 CTheScripts::NumTrueGlobals;
uint16 CTheScripts::MostGlobals; uint16 CTheScripts::MostGlobals;
CVector gVectorSetInLua;
int CTheScripts::NextScriptCoronaID;
base::cSList<script_corona> CTheScripts::mCoronas;
#ifdef MISSION_REPLAY #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_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_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_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, 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_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, ""), 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: default:
break; break;
} }
m_sEntities[i].id = 0; RemoveEntityFromList(m_sEntities[i].id, m_sEntities[i].type);
m_sEntities[i].type = CLEANUP_UNUSED;
m_nCount--;
} }
for (int i = 1; i < NUMSTREAMINFO; i++) { for (int i = 1; i < NUMSTREAMINFO; i++) {
if (CStreaming::IsScriptOwnedModel(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)]; return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)];
} }
script_assert(false && "wrong type for variable"); 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) 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)); memset(&UsedObjectArray[i].name, 0, sizeof(UsedObjectArray[i].name));
UsedObjectArray[i].index = 0; 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; NumberOfUsedObjects = 0;
if (ScriptSpace) if (ScriptSpace)
Shutdown(); Shutdown();
@ -2632,7 +2642,8 @@ bool CTheScripts::Init(bool loaddata)
CFileMgr::Read(mainf, (char*)&MainScriptSize, sizeof(MainScriptSize)); CFileMgr::Read(mainf, (char*)&MainScriptSize, sizeof(MainScriptSize));
int nLargestMissionSize = 0; int nLargestMissionSize = 0;
CFileMgr::Read(mainf, (char*)&nLargestMissionSize, sizeof(nLargestMissionSize)); 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); ScriptSpace = (uint8*)base::cMainMemoryManager::Instance()->Allocate(MainScriptSize + nLargestMissionSize);
memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize); memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize);
CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize); CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize);
@ -2772,8 +2783,6 @@ void CTheScripts::Process()
UseTextCommands = 0; UseTextCommands = 0;
} }
// TODO: mCoronas
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
static uint32 TimeToWaitTill; static uint32 TimeToWaitTill;
switch (AllowMissionReplay) { switch (AllowMissionReplay) {
@ -2833,6 +2842,11 @@ void CTheScripts::Process()
if (script && !script->m_bIsActive) if (script && !script->m_bIsActive)
script = nil; 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; DbgFlag = false;
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted); PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted);
@ -2896,7 +2910,9 @@ int8 CRunningScript::ProcessOneCommand()
uint8 nLocalsOffset; uint8 nLocalsOffset;
if (command < ARRAY_SIZE(commands)) { if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command); 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); 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) if (m_bNotFlag)
strcat(commandInfo, "NOT "); strcat(commandInfo, "NOT ");
if (commands[command].position == -1) if (commands[command].position == -1)
@ -4918,7 +4934,9 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CVector pos = GET_VECTOR_PARAM(1); CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); 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; return 0;
} }
case COMMAND_ALTER_WANTED_LEVEL: case COMMAND_ALTER_WANTED_LEVEL:

View file

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "common.h"
#include "Font.h" #include "Font.h"
#include "Ped.h" #include "Ped.h"
#include "PedType.h" #include "PedType.h"
#include "Text.h" #include "Text.h"
#include "sList.h"
#include "Sprite2d.h" #include "Sprite2d.h"
class CEntity; class CEntity;
@ -38,9 +38,11 @@ void FlushLog();
#define SPHERE_MARKER_PULSE_FRACTION 0.1f #define SPHERE_MARKER_PULSE_FRACTION 0.1f
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION #ifdef USE_PRECISE_MEASUREMENT_CONVERTION
#define MILES_IN_METER (0.000621371192f)
#define METERS_IN_FOOT (0.3048f) #define METERS_IN_FOOT (0.3048f)
#define FEET_IN_METER (3.28084f) #define FEET_IN_METER (3.28084f)
#else #else
#define MILES_IN_METER (1 / 1670.f)
#define METERS_IN_FOOT (0.3f) #define METERS_IN_FOOT (0.3f)
#define FEET_IN_METER (3.33f) #define FEET_IN_METER (3.33f)
#endif #endif
@ -273,6 +275,20 @@ struct tBuildingSwap
int32 m_nOldModel; 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 { enum {
VAR_LOCAL = 1, VAR_LOCAL = 1,
@ -343,12 +359,14 @@ public:
static int AllowedCollision[MAX_ALLOWED_COLLISIONS]; static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
static short* SavedVarIndices; static short* SavedVarIndices;
static int NumSaveVars; static int NumSaveVars;
static bool FSDestroyedFlag; static int FSDestroyedFlag;
static int NextProcessId; static int NextProcessId;
static bool InTheScripts; static bool InTheScripts;
static CRunningScript* pCurrent; static CRunningScript* pCurrent;
static uint16 NumTrueGlobals; static uint16 NumTrueGlobals;
static uint16 MostGlobals; static uint16 MostGlobals;
static base::cSList<script_corona> mCoronas;
static int NextScriptCoronaID;
static bool Init(bool loaddata = false); static bool Init(bool loaddata = false);
static void Process(); static void Process();
@ -468,6 +486,8 @@ public:
static void SetObjectiveForAllPedsInCollective(int, eObjective); static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif #endif
static bool IsFortStauntonDestroyed() { return FSDestroyedFlag && *(int32*)&ScriptSpace[FSDestroyedFlag] == 1; }
}; };
extern int ScriptParams[32]; extern int ScriptParams[32];
@ -665,4 +685,5 @@ extern int scriptToLoad;
#endif #endif
extern int gScriptsFile; extern int gScriptsFile;
extern CVector gVectorSetInLua;

View file

@ -74,7 +74,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
case COMMAND_ADD_ARROW_3D_MARKER: case COMMAND_ADD_ARROW_3D_MARKER:
{ {
uint32 ip = m_nIp; uint32 ip = m_nIp;
uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0);
CollectParameters(&m_nIp, 10); CollectParameters(&m_nIp, 10);
CVector pos = GET_VECTOR_PARAM(0); CVector pos = GET_VECTOR_PARAM(0);
CVector dir = GET_VECTOR_PARAM(3); CVector dir = GET_VECTOR_PARAM(3);
@ -213,7 +213,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF: case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF:
{ {
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); 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 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; return 0;
} }
@ -321,6 +321,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
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 CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
return 0;
} }
case COMMAND_GET_PLAYER_STORED_WEAPON: case COMMAND_GET_PLAYER_STORED_WEAPON:
{ {

View file

@ -35,6 +35,7 @@
#include "Zones.h" #include "Zones.h"
#include "GameLogic.h" #include "GameLogic.h"
#include "Bike.h" #include "Bike.h"
#include "Wanted.h"
// LCS: file done except TODOs // LCS: file done except TODOs

View file

@ -39,6 +39,7 @@
#include "World.h" #include "World.h"
#include "Zones.h" #include "Zones.h"
#include "Bike.h" #include "Bike.h"
#include "Wanted.h"
// LCS: file done except TODOs // LCS: file done except TODOs
@ -477,7 +478,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
float fx = pObject->GetForward().x; float fx = pObject->GetForward().x;
float fy = pObject->GetForward().y; float fy = pObject->GetForward().y;
float heading = LimitAngleOnCircle( 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); float headingTarget = GET_FLOAT_PARAM(1);
#ifdef FIX_BUGS #ifdef FIX_BUGS
float rotateBy = GET_FLOAT_PARAM(2) * CTimer::GetTimeStepFix(); float rotateBy = GET_FLOAT_PARAM(2) * CTimer::GetTimeStepFix();
@ -935,6 +936,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
script_assert(pVehicle); script_assert(pVehicle);
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
pPed->WarpPedIntoCar(pVehicle); pPed->WarpPedIntoCar(pVehicle);
pPed->RestorePreviousObjective();
return 0; return 0;
} }
case COMMAND_WARP_CHAR_INTO_CAR: case COMMAND_WARP_CHAR_INTO_CAR:

View file

@ -423,9 +423,10 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_REQUEST_COLLISION: case COMMAND_REQUEST_COLLISION:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVector2D pos; CVector pos;
pos.x = GET_FLOAT_PARAM(0); pos.x = GET_FLOAT_PARAM(0);
pos.y = GET_FLOAT_PARAM(1); pos.y = GET_FLOAT_PARAM(1);
pos.z = 0.0f;
CColStore::RequestCollision(pos); CColStore::RequestCollision(pos);
return 0; return 0;
} }

View file

@ -601,19 +601,36 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_CREATE_SCRIPT_CORONA: case COMMAND_CREATE_SCRIPT_CORONA:
{ {
CollectParameters(&m_nIp, 9); CollectParameters(&m_nIp, 9);
static bool bShowed = false; base::cSList<script_corona>::tSItem* pCorona = new base::cSList<script_corona>::tSItem();
if (!bShowed) { pCorona->item.x = GET_FLOAT_PARAM(0);
debug("CREATE_SCRIPT_CORONA not implemented"); pCorona->item.y = GET_FLOAT_PARAM(1);
bShowed = true; pCorona->item.z = GET_FLOAT_PARAM(2);
} pCorona->item.id = CTheScripts::NextScriptCoronaID++;
SET_INTEGER_PARAM(0, -1); 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); StoreParameters(&m_nIp, 1);
return 0; return 0;
} }
case COMMAND_REMOVE_SCRIPT_CORONA: case COMMAND_REMOVE_SCRIPT_CORONA:
{
CollectParameters(&m_nIp, 1); 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; return 0;
}
case COMMAND_IS_BOAT_IN_WATER: case COMMAND_IS_BOAT_IN_WATER:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);

View file

@ -636,7 +636,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
case COMMAND_ADD_POINT_3D_MARKER: case COMMAND_ADD_POINT_3D_MARKER:
{ {
uint32 ip = m_nIp; uint32 ip = m_nIp;
uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0);
static CVector vPreviousLocation; static CVector vPreviousLocation;
CollectParameters(&m_nIp, 7); CollectParameters(&m_nIp, 7);
CVector pos = GET_VECTOR_PARAM(0); CVector pos = GET_VECTOR_PARAM(0);
@ -651,7 +651,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
return 0; return 0;
} }
case COMMAND_GET_VECTOR_FROM_MULTIPLAYER: case COMMAND_GET_VECTOR_FROM_MULTIPLAYER:
// SET_VECTOR_PARAM(0, gVectorSetInLua); SET_VECTOR_PARAM(0, gVectorSetInLua);
StoreParameters(&m_nIp, 3); StoreParameters(&m_nIp, 3);
return 0; return 0;
case COMMAND_PRINT_HELP_ALWAYS: case COMMAND_PRINT_HELP_ALWAYS:
@ -737,10 +737,10 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
} }
case COMMAND_SET_CHAR_ATTACKS_PLAYER_WITH_COPS: 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)); CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed); script_assert(pPed);
pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(0) != 0); pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(1) != 0);
return 0; return 0;
} }
case COMMAND_REGISTER_FACE_PLANT_DISTANCE: case COMMAND_REGISTER_FACE_PLANT_DISTANCE:

View file

@ -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(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); 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) { else if (MI_TRAFFICLIGHTS_VERTICAL == m) {
CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex()); CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex());

View file

@ -1,11 +1,7 @@
#if defined RW_D3D9 || defined RWLIBS #define WITHDINPUT
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#endif
#include "common.h" #include "common.h"
#include "platform.h" #include "platform.h"
#include "crossplatform.h" // for Windows version #include "crossplatform.h"
#include "ControllerConfig.h" #include "ControllerConfig.h"
#include "Pad.h" #include "Pad.h"
#include "FileMgr.h" #include "FileMgr.h"
@ -35,6 +31,9 @@ CControllerConfigManager::CControllerConfigManager()
void CControllerConfigManager::MakeControllerActionsBlank() void CControllerConfigManager::MakeControllerActionsBlank()
{ {
#ifdef LOAD_INI_SETTINGS
ms_padButtonsInited = 0;
#endif
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++) for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
{ {
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++) 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) void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
{ {
m_bFirstCapture = true; m_bFirstCapture = true;
@ -329,6 +332,22 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
if (buttons > 16) if (buttons > 16)
btn = 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 // Now we use SDL Game Controller DB
#if defined RW_D3D9 || defined RWLIBS #if defined RW_D3D9 || defined RWLIBS
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427 if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
@ -341,50 +360,50 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
switch (btn) switch (btn)
{ {
case 16: IF_BTN_IN_RANGE(16)
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
case 15: IF_BTN_IN_RANGE(15)
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
case 14: IF_BTN_IN_RANGE(14)
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
case 13: IF_BTN_IN_RANGE(13)
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
case 12: IF_BTN_IN_RANGE(12)
case 11: IF_BTN_IN_RANGE(11)
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK); SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10: IF_BTN_IN_RANGE(10)
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
case 9: IF_BTN_IN_RANGE(9)
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK); SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8: IF_BTN_IN_RANGE(8)
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7: IF_BTN_IN_RANGE(7)
SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6: IF_BTN_IN_RANGE(6)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
case 5: IF_BTN_IN_RANGE(5)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
/*******************************************************************************************/ /*******************************************************************************************/
case 4: IF_BTN_IN_RANGE(4)
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK);
case 3: IF_BTN_IN_RANGE(3)
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
case 2: IF_BTN_IN_RANGE(2)
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
#ifdef BIND_VEHICLE_FIREWEAPON #ifdef BIND_VEHICLE_FIREWEAPON
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
#endif #endif
case 1: IF_BTN_IN_RANGE(1)
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
/*******************************************************************************************/ /*******************************************************************************************/
} }
@ -393,47 +412,47 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
{ {
switch (btn) switch (btn)
{ {
case 16: IF_BTN_IN_RANGE(16)
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
case 15: IF_BTN_IN_RANGE(15)
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
case 14: IF_BTN_IN_RANGE(14)
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
case 13: IF_BTN_IN_RANGE(13)
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK); SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
case 12: IF_BTN_IN_RANGE(12)
case 11: IF_BTN_IN_RANGE(11)
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK); SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10: IF_BTN_IN_RANGE(10)
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
case 9: IF_BTN_IN_RANGE(9)
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK); SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8: IF_BTN_IN_RANGE(8)
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7: IF_BTN_IN_RANGE(7)
SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6: IF_BTN_IN_RANGE(6)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
case 5: IF_BTN_IN_RANGE(5)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
/*******************************************************************************************/ /*******************************************************************************************/
case 4: IF_BTN_IN_RANGE(4)
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK);
case 3: IF_BTN_IN_RANGE(3)
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK);
case 2: IF_BTN_IN_RANGE(2)
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
case 1: IF_BTN_IN_RANGE(1)
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
#ifdef BIND_VEHICLE_FIREWEAPON #ifdef BIND_VEHICLE_FIREWEAPON
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK);
@ -2772,7 +2791,7 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++) for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
{ {
int32 setorder = m_aSettings[action][k].m_ContSetOrder; int32 setorder = m_aSettings[action][k].m_ContSetOrder;
if (setorder > i && setorder != KEYBOARD) if (setorder > i && setorder != 0)
{ {
if (init) if (init)
{ {

View file

@ -145,6 +145,10 @@ public:
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES]; bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
bool m_bMouseAssociated; bool m_bMouseAssociated;
#ifdef LOAD_INI_SETTINGS
static uint32 ms_padButtonsInited;
#endif
CControllerConfigManager(); CControllerConfigManager();
void MakeControllerActionsBlank(); void MakeControllerActionsBlank();

View file

@ -1,10 +1,6 @@
#if defined RW_D3D9 || defined RWLIBS
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#endif
#define FORCE_PC_SCALING #define FORCE_PC_SCALING
#define WITHWINDOWS #define WITHWINDOWS
#define WITHDINPUT
#include "common.h" #include "common.h"
#ifndef PS2_MENU #ifndef PS2_MENU
#include "crossplatform.h" #include "crossplatform.h"
@ -581,13 +577,21 @@ CMenuManager::Initialise(void)
DMAudio.Service(); DMAudio.Service();
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); 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(); m_PrefsRadioStation = DMAudio.GetRadioInCar();
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume); DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
if (DMAudio.IsMP3RadioChannelAvailable()) { if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK) 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) } else if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > WAVE)
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9; m_PrefsRadioStation = CGeneral::GetRandomNumber() % (WAVE + 1);
CFileMgr::SetDir(""); CFileMgr::SetDir("");
//CFileMgr::SetDir(""); //CFileMgr::SetDir("");
@ -671,7 +675,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl)
m_bWaitingForNewKeyBind = false; m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1; m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false; m_bStartWaitingForKeyBind = false;
#ifdef LOAD_INI_SETTINGS
SaveINIControllerSettings();
#else
SaveSettings(); SaveSettings();
#endif
} }
} }
@ -3053,6 +3061,16 @@ CMenuManager::LoadSettings()
CFileMgr::CloseFile(fileHandle); CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir(""); CFileMgr::SetDir("");
#ifdef LOAD_INI_SETTINGS
if (LoadINISettings()) {
LoadINIControllerSettings();
} else {
// no re3.ini, create it
SaveINISettings();
SaveINIControllerSettings();
}
#endif
#ifdef FIX_BUGS #ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#endif #endif
@ -3098,15 +3116,12 @@ CMenuManager::LoadSettings()
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME); strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
strcpy(m_aSkinName, DEFAULT_SKIN_NAME); strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
} }
#ifdef LOAD_INI_SETTINGS
LoadINISettings(); // needs frontend options to be loaded
#endif
} }
void void
CMenuManager::SaveSettings() CMenuManager::SaveSettings()
{ {
#ifndef LOAD_INI_SETTINGS
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc"; static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
static int SomeVersion = 3; static int SomeVersion = 3;
@ -3165,7 +3180,8 @@ CMenuManager::SaveSettings()
CFileMgr::CloseFile(fileHandle); CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir(""); CFileMgr::SetDir("");
#ifdef LOAD_INI_SETTINGS #else
m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex;
SaveINISettings(); SaveINISettings();
#endif #endif
} }
@ -4445,19 +4461,19 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
MouseButtonJustClicked = false; MouseButtonJustClicked = false;
if (CPad::GetPad(0)->GetLeftMouseJustDown()) if (CPad::GetPad(0)->GetLeftMouseJustDown())
MouseButtonJustClicked = 1; MouseButtonJustClicked = rsMOUSELEFTBUTTON;
else if (CPad::GetPad(0)->GetRightMouseJustUp()) else if (CPad::GetPad(0)->GetRightMouseJustUp())
MouseButtonJustClicked = 3; MouseButtonJustClicked = rsMOUSERIGHTBUTTON;
else if (CPad::GetPad(0)->GetMiddleMouseJustUp()) else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
MouseButtonJustClicked = 2; MouseButtonJustClicked = rsMOUSMIDDLEBUTTON;
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp()) else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
MouseButtonJustClicked = 4; MouseButtonJustClicked = rsMOUSEWHEELUPBUTTON;
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp()) else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
MouseButtonJustClicked = 5; MouseButtonJustClicked = rsMOUSEWHEELDOWNBUTTON;
else if (CPad::GetPad(0)->GetMouseX1JustUp()) else if (CPad::GetPad(0)->GetMouseX1JustUp())
MouseButtonJustClicked = 6; MouseButtonJustClicked = rsMOUSEX1BUTTON;
else if (CPad::GetPad(0)->GetMouseX2JustUp()) else if (CPad::GetPad(0)->GetMouseX2JustUp())
MouseButtonJustClicked = 7; MouseButtonJustClicked = rsMOUSEX2BUTTON;
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
@ -4818,6 +4834,9 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
TheCamera.m_bUseMouse3rdPerson = false; TheCamera.m_bUseMouse3rdPerson = false;
#endif #endif
SaveSettings(); SaveSettings();
#ifdef LOAD_INI_SETTINGS
SaveINIControllerSettings();
#endif
} }
SetHelperText(2); SetHelperText(2);
break; 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; *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(); SaveSettings();
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc) 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; *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(); SaveSettings();
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc) if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
@ -5446,6 +5467,9 @@ CMenuManager::SwitchMenuOnAndOff()
ThingsToDoBeforeLeavingPage(); ThingsToDoBeforeLeavingPage();
#endif #endif
SaveSettings(); SaveSettings();
#ifdef LOAD_INI_SETTINGS
SaveINIControllerSettings();
#endif
pControlEdit = nil; pControlEdit = nil;
pEditString = nil; pEditString = nil;
DisplayComboButtonErrMsg = false; DisplayComboButtonErrMsg = false;

View file

@ -392,6 +392,7 @@ struct CCustomScreenLayout {
struct CCFO struct CCFO
{ {
int8 *value; int8 *value;
const char *saveCat;
const char *save; const char *save;
}; };
@ -406,11 +407,12 @@ struct CCFOSelect : CCFO
bool disableIfGameLoaded; bool disableIfGameLoaded;
CCFOSelect() {}; 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; this->value = value;
if (value) if (value)
this->lastSavedValue = this->displayedValue = *value; this->lastSavedValue = this->displayedValue = *value;
this->saveCat = saveCat;
this->save = save; this->save = save;
this->rightTexts = (char**)rightTexts; this->rightTexts = (char**)rightTexts;
this->numRightTexts = numRightTexts; this->numRightTexts = numRightTexts;
@ -426,8 +428,9 @@ struct CCFODynamic : CCFO
ButtonPressFunc buttonPressFunc; ButtonPressFunc buttonPressFunc;
CCFODynamic() {}; 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->value = value;
this->saveCat = saveCat;
this->save = save; this->save = save;
this->drawFunc = drawFunc; this->drawFunc = drawFunc;
this->buttonPressFunc = buttonPressFunc; this->buttonPressFunc = buttonPressFunc;
@ -581,7 +584,7 @@ public:
int8 m_bLanguageLoaded; int8 m_bLanguageLoaded;
uint8 m_PrefsAllowNastyGame; uint8 m_PrefsAllowNastyGame;
int8 m_PrefsMP3BoostVolume; int8 m_PrefsMP3BoostVolume;
uint8 m_ControlMethod; int8 m_ControlMethod;
int32 m_nPrefsVideoMode; int32 m_nPrefsVideoMode;
int32 m_nDisplayVideoMode; int32 m_nDisplayVideoMode;
int32 m_nMouseTempPosX; int32 m_nMouseTempPosX;

View file

@ -1,6 +1,3 @@
#pragma warning( push )
#pragma warning( disable : 4005)
#pragma warning( pop )
#include "common.h" #include "common.h"
#include "platform.h" #include "platform.h"
@ -10,7 +7,6 @@
#include "Accident.h" #include "Accident.h"
#include "Antennas.h" #include "Antennas.h"
#include "Bridge.h" #include "Bridge.h"
#include "Camera.h"
#include "CarCtrl.h" #include "CarCtrl.h"
#include "CarGen.h" #include "CarGen.h"
#include "CdStream.h" #include "CdStream.h"
@ -69,7 +65,6 @@
#include "Skidmarks.h" #include "Skidmarks.h"
#include "SetPieces.h" #include "SetPieces.h"
#include "SpecialFX.h" #include "SpecialFX.h"
#include "Sprite2d.h"
#include "Stats.h" #include "Stats.h"
#include "Streaming.h" #include "Streaming.h"
#include "SurfaceTable.h" #include "SurfaceTable.h"
@ -856,9 +851,9 @@ void CGame::Process(void)
gameProcessPirateCheck = 2; gameProcessPirateCheck = 2;
} }
#endif #endif
uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); //uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update(); CStreaming::Update();
uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; //uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
CWindModifiers::Number = 0; CWindModifiers::Number = 0;
if (!CTimer::GetIsPaused()) if (!CTimer::GetIsPaused())
{ {
@ -897,13 +892,13 @@ void CGame::Process(void)
CEventList::Update(); CEventList::Update();
CParticle::Update(); CParticle::Update();
gFireManager.Update(); gFireManager.Update();
if (processTime >= 2) { //if (processTime >= 2) {
CPopulation::Update(false); // CPopulation::Update(false);
} else { //} else {
uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); // uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CPopulation::Update(true); CPopulation::Update(true);
processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; // processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
} //}
CWeapon::UpdateWeapons(); CWeapon::UpdateWeapons();
if (!CCutsceneMgr::IsRunning()) if (!CCutsceneMgr::IsRunning())
CTheCarGenerators::Process(); CTheCarGenerators::Process();
@ -941,7 +936,7 @@ void CGame::Process(void)
if (!CReplay::IsPlayingBack()) if (!CReplay::IsPlayingBack())
{ {
PUSH_MEMID(MEMID_CARS); PUSH_MEMID(MEMID_CARS);
if (processTime < 2) //if (processTime < 2)
CCarCtrl::GenerateRandomCars(); CCarCtrl::GenerateRandomCars();
CRoadBlocks::GenerateRoadBlocks(); CRoadBlocks::GenerateRoadBlocks();
CCarCtrl::RemoveDistantCars(); CCarCtrl::RemoveDistantCars();

View file

@ -1,7 +1,5 @@
#pragma once #pragma once
#include "common.h"
class CPtrNode class CPtrNode
{ {
public: public:

View file

@ -16,6 +16,7 @@
#include "Collision.h" #include "Collision.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "Pad.h" #include "Pad.h"
#include "ControllerConfig.h"
// Menu screens array is at the bottom of the file. // Menu screens array is at the bottom of the file.
@ -24,51 +25,51 @@
#ifdef CUSTOM_FRONTEND_OPTIONS #ifdef CUSTOM_FRONTEND_OPTIONS
#ifdef IMPROVED_VIDEOMODE #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 #else
#define VIDEOMODE_SELECTOR #define VIDEOMODE_SELECTOR
#endif #endif
#ifdef MULTISAMPLING #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 #else
#define MULTISAMPLING_SELECTOR #define MULTISAMPLING_SELECTOR
#endif #endif
#ifdef CUTSCENE_BORDERS_SWITCH #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 #else
#define CUTSCENE_BORDERS_TOGGLE #define CUTSCENE_BORDERS_TOGGLE
#endif #endif
#ifdef FREE_CAM #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 #else
#define FREE_CAM_TOGGLE #define FREE_CAM_TOGGLE
#endif #endif
#ifdef PS2_ALPHA_TEST #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 #else
#define DUALPASS_SELECTOR #define DUALPASS_SELECTOR
#endif #endif
#ifdef NO_ISLAND_LOADING #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 #else
#define ISLAND_LOADING_SELECTOR #define ISLAND_LOADING_SELECTOR
#endif #endif
#ifdef EXTENDED_COLOURFILTER #ifdef EXTENDED_COLOURFILTER
#define POSTFX_SELECTORS \ #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_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, "MotionBlur", off_on, 2, 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 #else
#define POSTFX_SELECTORS #define POSTFX_SELECTORS
#endif #endif
#ifdef INVERT_LOOK_FOR_PAD #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 #else
#define INVERT_PAD_SELECTOR #define INVERT_PAD_SELECTOR
#endif #endif
@ -278,6 +279,7 @@ void ScreenModeAfterChange(int8 before, int8 after)
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
wchar selectedJoystickUnicode[128]; wchar selectedJoystickUnicode[128];
int cachedButtonNum = -1;
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) { wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
int numButtons; int numButtons;
@ -306,6 +308,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
strcpy(gSelectedJoystickName, joyname); strcpy(gSelectedJoystickName, joyname);
PSGLOBAL(joy1id) = found; PSGLOBAL(joy1id) = found;
cachedButtonNum = numButtons;
} }
} }
if (PSGLOBAL(joy1id) == -1) if (PSGLOBAL(joy1id) == -1)
@ -315,6 +318,18 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
return selectedJoystickUnicode; 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 #endif
CMenuScreenCustom aScreens[] = { CMenuScreenCustom aScreens[] = {
@ -388,7 +403,7 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_RADARMODE, "FED_RDR", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT, 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_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_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, MENUACTION_GOBACK, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER,
}, },
#endif #endif
@ -401,9 +416,9 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_LANG_ITA, "FEL_ITA", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER, 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, MENUACTION_LANG_SPA, "FEL_SPA", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, LangPolSelect) }, 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, LangRusSelect) }, 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, LangJapSelect) }, 0, 0, MENUALIGN_CENTER, MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, nil, LangJapSelect) }, 0, 0, MENUALIGN_CENTER,
#endif #endif
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 0, 0, MENUALIGN_CENTER, 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, MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT,
#endif #endif
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined // 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, MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 0, MENUALIGN_CENTER,
}, },
#endif #endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// MENUPAGE_DETECT_JOYSTICK // 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_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, MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 225, MENUALIGN_CENTER,
}, },
#endif #endif

View file

@ -1,11 +1,4 @@
#pragma warning( push ) #define WITHDINPUT
#pragma warning( disable : 4005)
#if defined RW_D3D9 || defined RWLIBS
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#endif
#pragma warning( pop )
#include "common.h" #include "common.h"
#include "crossplatform.h" #include "crossplatform.h"
#include "platform.h" #include "platform.h"
@ -68,7 +61,7 @@ bool CPad::bOldDisplayNoControllerMessage;
bool CPad::m_bMapPadOneToPadTwo; bool CPad::m_bMapPadOneToPadTwo;
bool CPad::m_bDebugCamPCOn; bool CPad::m_bDebugCamPCOn;
bool CPad::bHasPlayerCheated; bool CPad::bHasPlayerCheated;
bool CPad::bInvertLook4Pad = true; bool CPad::bInvertLook4Pad;
#ifdef GTA_PS2 #ifdef GTA_PS2
unsigned char act_direct[6]; unsigned char act_direct[6];
unsigned char act_align[6]; unsigned char act_align[6];

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Collision.h" #include "ColModel.h"
enum eWastedBustedState enum eWastedBustedState
{ {

View file

@ -3150,6 +3150,46 @@ CStreaming::LoadSceneCollision(const CVector &pos)
CStreaming::LoadAllRequestedModels(false); 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 void
CStreaming::MemoryCardSave(uint8 *buf, uint32 *size) CStreaming::MemoryCardSave(uint8 *buf, uint32 *size)
{ {

View file

@ -20,6 +20,7 @@ enum StreamFlags
STREAMFLAGS_40 = 0x40, // TODO(LCS): what's this STREAMFLAGS_40 = 0x40, // TODO(LCS): what's this
STREAMFLAGS_AMBIENT_SCRIPT_OWNED = 0x80, 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_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED,
STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY, STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY,
}; };
@ -209,6 +210,17 @@ public:
static void LoadScene(const CVector &pos); static void LoadScene(const CVector &pos);
static void LoadSceneCollision(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 MemoryCardSave(uint8 *buffer, uint32 *length);
static void MemoryCardLoad(uint8 *buffer, uint32 length); static void MemoryCardLoad(uint8 *buffer, uint32 length);

View file

@ -4,7 +4,6 @@
#include "CopPed.h" #include "CopPed.h"
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "DMAudio.h" #include "DMAudio.h"
#include "Entity.h"
#include "EventList.h" #include "EventList.h"
#include "Explosion.h" #include "Explosion.h"
#include "Fire.h" #include "Fire.h"
@ -12,11 +11,8 @@
#include "Glass.h" #include "Glass.h"
#include "Messages.h" #include "Messages.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "Object.h"
#include "ParticleObject.h" #include "ParticleObject.h"
#include "Ped.h"
#include "Pickups.h" #include "Pickups.h"
#include "PlayerPed.h"
#include "Population.h" #include "Population.h"
#include "ProjectileInfo.h" #include "ProjectileInfo.h"
#include "Record.h" #include "Record.h"
@ -25,7 +21,6 @@
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
#include "Shadows.h" #include "Shadows.h"
#include "TempColModels.h" #include "TempColModels.h"
#include "Vehicle.h"
#include "WaterLevel.h" #include "WaterLevel.h"
#include "World.h" #include "World.h"
@ -1793,56 +1788,35 @@ void
CWorld::RepositionOneObject(CEntity *pEntity) CWorld::RepositionOneObject(CEntity *pEntity)
{ {
int16 modelId = pEntity->GetModelIndex(); int16 modelId = pEntity->GetModelIndex();
if (modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || if (IsLightThatNeedsRepositioning(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
modelId == MI_PHONESIGN || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
modelId == MI_PARKTABLE || modelId == MI_PARKINGMETER2 || modelId == MI_TELPOLE02 || modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 ||
modelId == MI_PARKBENCH || modelId == MI_BARRIER1 || IsTreeModel(modelId) 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(); CVector& position = pEntity->GetMatrix().GetPosition();
CColModel* pColModel = pEntity->GetColModel(); float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
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;
position.z = FindGroundZFor3DCoord(position.x, position.y, position.z = FindGroundZFor3DCoord(position.x, position.y,
position.z + fHeight, nil) - position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
fBoundingBoxMinZ; fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW(); pEntity->m_matrix.UpdateRW();
pEntity->UpdateRwFrame(); pEntity->UpdateRwFrame();
} else if(IsLightThatNeedsRepositioning(modelId)) { } else if(modelId == MI_BUOY) {
CVector position = pEntity->GetMatrix().GetPosition(); float fWaterLevel = 0.0f;
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) {
bool bFound = true; bool bFound = true;
const CVector &position = pEntity->GetPosition(); const CVector &position = pEntity->GetPosition();
float fGroundZ = FindGroundZFor3DCoord(position.x, position.y, float fGroundZ = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound);
if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z,
&fWaterLevel)) {
if(!bFound || fWaterLevel > fGroundZ) {
CColModel *pColModel = pEntity->GetColModel(); CColModel *pColModel = pEntity->GetColModel();
float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + 6.0f - 0.5f * fHeight; pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
}
}
} }
} }

View file

@ -3,6 +3,7 @@
#include "Game.h" #include "Game.h"
#include "Lists.h" #include "Lists.h"
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "Collision.h"
/* Sectors span from -2000 to 2000 in x and y. /* Sectors span from -2000 to 2000 in x and y.
* With 100x100 sectors, each is 40x40 units. */ * With 100x100 sectors, each is 40x40 units. */
@ -48,11 +49,6 @@ public:
VALIDATE_SIZE(CSector, 0x28); VALIDATE_SIZE(CSector, 0x28);
class CEntity;
struct CColPoint;
struct CColLine;
struct CStoredCollPoly;
class CWorld class CWorld
{ {
static CPtrList ms_bigBuildingsList[NUM_LEVELS]; static CPtrList ms_bigBuildingsList[NUM_LEVELS];

View file

@ -103,8 +103,8 @@ public:
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity); static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup); static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
static int16 FindAudioZone(CVector *pos); static int16 FindAudioZone(CVector *pos);
static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &NavigationZoneArray[i]; } static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &NavigationZoneArray[i]; }
static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; } static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; }
static void AddZoneToAudioZoneArray(CZone *zone); static void AddZoneToAudioZoneArray(CZone *zone);
static void InitialiseAudioZoneArray(void); static void InitialiseAudioZoneArray(void);
static void SaveAllZones(uint8 *buffer, uint32 *length); static void SaveAllZones(uint8 *buffer, uint32 *length);

View file

@ -11,18 +11,35 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if defined _WIN32 && defined WITHWINDOWS #if !defined RW_D3D9 && defined LIBRW
#undef WITHD3D
#undef WITHDINPUT
#endif
#if (defined WITHD3D && !defined LIBRW)
#define WITHWINDOWS
#endif
#if defined _WIN32 && defined WITHWINDOWS && !defined _INC_WINDOWS
#include <windows.h> #include <windows.h>
#endif #endif
#if defined _WIN32 && defined WITHD3D #ifdef WITHD3D
#include <windows.h> #ifdef LIBRW
#define WITH_D3D // librw includes d3d9 itself via this right now
#else
#ifndef USE_D3D9 #ifndef USE_D3D9
#include <d3d8types.h> #include <d3d8types.h>
#else #else
#include <d3d9types.h> #include <d3d9types.h>
#endif #endif
#endif #endif
#endif
#ifdef WITHDINPUT
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#endif
#include <rwcore.h> #include <rwcore.h>
#include <rpworld.h> #include <rpworld.h>
@ -52,14 +69,6 @@
#define rwVENDORID_ROCKSTAR 0x0253F2 #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 Max(a,b) ((a) > (b) ? (a) : (b))
#define Min(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) #define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
#endif #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 "maths.h"
#include "Vector.h" #include "Vector.h"
#include "Vector2D.h" #include "Vector2D.h"

View file

@ -198,7 +198,7 @@ enum Config {
//#define ANIM_COMPRESSION // only keep most recently used anims uncompressed //#define ANIM_COMPRESSION // only keep most recently used anims uncompressed
#define GTA_TRAIN #define GTA_TRAIN
//#define GTA_BRIDGE #define GTA_BRIDGE
#if defined GTA_PS2 #if defined GTA_PS2
# define GTA_PS2_STUFF # define GTA_PS2_STUFF

View file

@ -49,8 +49,10 @@ void TheModelViewer(void);
#endif #endif
#ifdef LOAD_INI_SETTINGS #ifdef LOAD_INI_SETTINGS
void LoadINISettings(); bool LoadINISettings();
void SaveINISettings(); void SaveINISettings();
void LoadINIControllerSettings();
void SaveINIControllerSettings();
#endif #endif
#ifdef NEW_RENDERER #ifdef NEW_RENDERER

View file

@ -1,7 +1,6 @@
#include <csignal> #include <csignal>
#define WITHWINDOWS #define WITHWINDOWS
#include "common.h" #include "common.h"
#include "crossplatform.h"
#include "Renderer.h" #include "Renderer.h"
#include "Occlusion.h" #include "Occlusion.h"
#include "Credits.h" #include "Credits.h"
@ -34,9 +33,12 @@
#include "custompipes.h" #include "custompipes.h"
#include "MemoryHeap.h" #include "MemoryHeap.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "Camera.h"
#include "MBlur.h"
#include "ControllerConfig.h"
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#include "ControllerConfig.h" #include "crossplatform.h"
#endif #endif
#ifndef _WIN32 #ifndef _WIN32
@ -95,16 +97,14 @@ CustomFrontendOptionsPopulate(void)
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false); 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_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_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, "Graphics", "NeoLightMaps");
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, "Graphics", "NeoRoadGloss");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#else #else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false); 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_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_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, "Graphics", "NeoLightMaps");
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, "Graphics", "NeoRoadGloss");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#endif #endif
CFileMgr::CloseFile(fd); CFileMgr::CloseFile(fd);
} }
@ -117,82 +117,308 @@ CustomFrontendOptionsPopulate(void)
#include "ini_parser.hpp" #include "ini_parser.hpp"
linb::ini cfg; 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, ""); std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str(); const char *value = strval.c_str();
if (value && value[0] != '\0') char *endPtr;
return atoi(value); if (value && value[0] != '\xBA') {
*out = strtoul(value, &endPtr, 0);
return original; return true;
}
return false;
} }
float CheckAndReadIniFloat(const char *cat, const char *key, float original) bool ReadIniIfExists(const char *cat, const char *key, bool *out)
{ {
std::string strval = cfg.get(cat, key, ""); std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str(); const char *value = strval.c_str();
if (value && value[0] != '\0') char *endPtr;
return atof(value); if (value && value[0] != '\xBA') {
*out = strtoul(value, &endPtr, 0);
return original; return true;
}
return false;
} }
void CheckAndSaveIniInt(const char *cat, const char *key, int val, bool &changed) bool ReadIniIfExists(const char *cat, const char *key, int32 *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;
}
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;
}
bool ReadIniIfExists(const char *cat, const char *key, float *out)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
if (value && value[0] != '\xBA') {
*out = atof(value);
return true;
}
return false;
}
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 StoreIni(const char *cat, const char *key, uint32 val)
{ {
char temp[10]; 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); sprintf(temp, "%u", val);
cfg.set(cat, key, temp); 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];
sprintf(temp, "%u", (uint32)val);
cfg.set(cat, key, temp);
}
void StoreIni(const char *cat, const char *key, int32 val)
{
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]; 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); sprintf(temp, "%f", val);
cfg.set(cat, key, temp); cfg.set(cat, key, temp);
} }
}
void LoadINISettings() void StoreIni(const char *cat, const char *key, char *val, int size)
{ {
cfg.load_file("reLCS.ini"); 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 #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// Written by assuming the codes below will run after _InputInitialiseJoys(). ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str()); #endif
// force to default GTA behaviour (never overwrite bindings on joy change/initialization) if user init'ed/set bindings before we introduced that
if(gSelectedJoystickName[0] != '\0') { if (!ReadIniIfExists("Controller", "PadButtonsInited", &ControlsManager.ms_padButtonsInited)) {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) { ControlsManager.ms_padButtonsInited = cfg.category_size("Bindings") != 0 ? 16 : 0;
if (glfwJoystickPresent(i) && strncmp(gSelectedJoystickName, glfwGetJoystickName(i), strlen(gSelectedJoystickName)) == 0) {
if (PSGLOBAL(joy1id) != -1) {
PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
} }
PSGLOBAL(joy1id) = i;
int count;
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
// We need to init and reload bindings, because; for (int32 i = 0; i < MAX_CONTROLLERACTIONS; i++) {
// 1-joypad button number may differ with saved/prvly connected one char value[128];
// 2-bindings are not init'ed if there is no joypad at the start if (ReadIniIfExists("Bindings", iniControllerActions[i], value, 128)) {
ControlsManager.InitDefaultControlConfigJoyPad(count); for (int32 j = 0; j < MAX_CONTROLLERTYPES; j++){
CFileMgr::SetDirMyDocuments(); ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)i, (eControllerType)j);
int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
if (gta3set) {
ControlsManager.LoadSettings(gta3set);
CFileMgr::CloseFile(gta3set);
} }
CFileMgr::SetDir("");
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;
}
}
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; break;
} }
} }
} }
} else if (contType == MOUSE) {
for (int32 k = 0; k < ARRAY_SIZE(iniMouseButtons); k++) {
if(strcmp(binding, iniMouseButtons[k]) == 0) {
contKey = 1 + k;
break;
}
}
}
ControlsManager.SetControllerKeyAssociatedWithAction((e_ControllerAction)i, contKey, (eControllerType)contType);
}
}
}
}
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
ReadIniIfExists("CustomPipesValues", "PostFXIntensity", &CPostFX::Intensity);
#endif
#ifdef EXTENDED_PIPELINES
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
#ifdef PROPER_SCALING
ReadIniIfExists("Draw", "ProperScaling", &CDraw::ms_bProperScaling);
#endif
#ifdef FIX_RADAR
ReadIniIfExists("Draw", "FixRadar", &CDraw::ms_bFixRadar);
#endif
#ifdef FIX_SPRITES
ReadIniIfExists("Draw", "FixSprites", &CDraw::ms_bFixSprites);
#endif #endif
#ifdef CUSTOM_FRONTEND_OPTIONS #ifdef CUSTOM_FRONTEND_OPTIONS
bool migrate = cfg.category_size("FrontendOptions") != 0;
for (int i = 0; i < MENUPAGES; i++) { for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) { for (int j = 0; j < NUM_MENUROWS; j++) {
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j]; CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
@ -202,7 +428,13 @@ void LoadINISettings()
// CFO check // CFO check
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) { if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
// CFO only supports saving uint8 right now // CFO only supports saving uint8 right now
*option.m_CFO->value = CheckAndReadIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value);
// 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) { if (option.m_Action == MENUACTION_CFO_SELECT) {
option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value; option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
} }
@ -211,38 +443,67 @@ void LoadINISettings()
} }
#endif #endif
#ifdef EXTENDED_COLOURFILTER return true;
CPostFX::Intensity = CheckAndReadIniFloat("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);
#endif
gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling);
#ifdef PROPER_SCALING
CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling);
#endif
#ifdef FIX_RADAR
CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar);
#endif
#ifdef FIX_SPRITES
CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites);
#endif
} }
void SaveINISettings() void SaveINISettings()
{ {
bool changed = false; #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 DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef EXTENDED_COLOURFILTER
if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) { StoreIni("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
changed = true; #endif
cfg.set("DetectJoystick", "JoystickName", gSelectedJoystickName); #ifdef EXTENDED_PIPELINES
} 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
StoreIni("Rendering", "BackfaceCulling", gBackfaceCulling);
#ifdef PROPER_SCALING
StoreIni("Draw", "ProperScaling", CDraw::ms_bProperScaling);
#endif
#ifdef FIX_RADAR
StoreIni("Draw", "FixRadar", CDraw::ms_bFixRadar);
#endif
#ifdef FIX_SPRITES
StoreIni("Draw", "FixSprites", CDraw::ms_bFixSprites);
#endif #endif
#ifdef CUSTOM_FRONTEND_OPTIONS #ifdef CUSTOM_FRONTEND_OPTIONS
for (int i = 0; i < MENUPAGES; i++) { for (int i = 0; i < MENUPAGES; i++) {
@ -253,35 +514,12 @@ void SaveINISettings()
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) { if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
// Beware: CFO only supports saving uint8 right now // Beware: CFO only supports saving uint8 right now
CheckAndSaveIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value, changed); StoreIni(option.m_CFO->saveCat, option.m_CFO->save, *option.m_CFO->value);
} }
} }
} }
#endif #endif
#ifdef EXTENDED_COLOURFILTER
CheckAndSaveIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity, changed);
#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);
#endif
CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed);
#ifdef PROPER_SCALING
CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed);
#endif
#ifdef FIX_RADAR
CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed);
#endif
#ifdef FIX_SPRITES
CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed);
#endif
if (changed)
cfg.write_file("reLCS.ini"); cfg.write_file("reLCS.ini");
} }
@ -767,7 +1005,7 @@ extern bool gbRenderDebugEnvMap;
"A Date with Death (Toshiko Kasen)", "Cash in Kazuki's Chips (Toshiko Kasen)" "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); DebugMenuEntrySetWrap(missionEntry, true);
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission); DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
#endif #endif

View file

@ -1,4 +1,4 @@
#define WITH_D3D #define WITHD3D
#include "common.h" #include "common.h"
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES

View file

@ -1,4 +1,4 @@
#define WITH_D3D #define WITHD3D
#include "common.h" #include "common.h"
#ifdef RW_D3D9 #ifdef RW_D3D9

View file

@ -111,7 +111,7 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint
option.m_TargetMenu = targetMenu; 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(); 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->displayedValue = *var;
option.m_CFOSelect->lastSavedValue = *var; option.m_CFOSelect->lastSavedValue = *var;
} }
option.m_CFOSelect->saveCat = saveCat;
option.m_CFOSelect->save = saveName; option.m_CFOSelect->save = saveName;
option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter; option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter;
option.m_CFOSelect->changeFunc = changeFunc; option.m_CFOSelect->changeFunc = changeFunc;
option.m_CFOSelect->disableIfGameLoaded = disableIfGameLoaded; 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(); 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->drawFunc = drawFunc;
option.m_CFODynamic->buttonPressFunc = buttonPressFunc; option.m_CFODynamic->buttonPressFunc = buttonPressFunc;
option.m_CFODynamic->value = var; option.m_CFODynamic->value = var;
option.m_CFODynamic->saveCat = saveCat;
option.m_CFODynamic->save = saveName; option.m_CFODynamic->save = saveName;
} }

View file

@ -76,10 +76,10 @@ uint8 GetNumberOfMenuOptions(int screen);
void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false); 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 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 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* saveName = nil); 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 // lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT
uint8 FrontendScreenAdd(const char* gxtKey, int prevPage, int lineHeight, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil); uint8 FrontendScreenAdd(const char* gxtKey, int prevPage, int lineHeight, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil);

View file

@ -158,6 +158,25 @@ namespace linb
/* Too lazy to continue this container... If you need more methods, just add it */ /* 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 #if 1
bool read_file(const char_type* filename) bool read_file(const char_type* filename)

View file

@ -1,5 +1,4 @@
#define WITHWINDOWS #define WITHD3D
#define WITH_D3D
#include "common.h" #include "common.h"
#ifdef EXTENDED_COLOURFILTER #ifdef EXTENDED_COLOURFILTER

View file

@ -1,4 +1,4 @@
#define WITH_D3D #define WITHD3D
#include "common.h" #include "common.h"
#ifdef SCREEN_DROPLETS #ifdef SCREEN_DROPLETS

View file

@ -1,5 +1,5 @@
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#define WITH_D3D #define WITH_D3D // not WITHD3D, so it's librw define
#include <rwcore.h> #include <rwcore.h>
#include <rpworld.h> #include <rpworld.h>
#include <rpmatfx.h> #include <rpmatfx.h>

35
src/leeds/base/sList.h Normal file
View file

@ -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;
}
};
}

20
src/leeds/smallHeap.cpp Normal file
View file

@ -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
}

17
src/leeds/smallHeap.h Normal file
View file

@ -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;
};

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Collision.h" struct CColModel;
#define MAX_MODEL_NAME (21) #define MAX_MODEL_NAME (21)
@ -29,7 +29,9 @@ protected:
uint8 m_type; uint8 m_type;
uint8 m_num2dEffects; uint8 m_num2dEffects;
bool m_bOwnsColModel; bool m_bOwnsColModel;
public: // need this in colstore
CColModel *m_colModel; CColModel *m_colModel;
protected:
int16 m_2dEffectsID; int16 m_2dEffectsID;
int16 m_objectId; int16 m_objectId;
uint16 m_refCount; uint16 m_refCount;

View file

@ -2,17 +2,25 @@
#include "General.h" #include "General.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "main.h"
#define X(name, var) int16 var = -1; CModelIndices *gpModelIndices;
/*#define X(name, var) int16 var = -1;
MODELINDICES MODELINDICES
#undef X #undef X*/
void void
InitModelIndices(void) InitModelIndices(void)
{ {
#define X(name, var) var = -1; /*#define X(name, var) var = -1;
MODELINDICES MODELINDICES
#undef X #undef X*/
if (gMakeResources)
{
gpModelIndices = new CModelIndices;
memset(gpModelIndices, -1, sizeof(CModelIndices));
}
} }
void void

View file

@ -2,8 +2,591 @@
#include "ModelInfo.h" #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 \ #define MODELINDICES \
X("fire_hydrant", MI_FIRE_HYDRANT) \ 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("phonesign", MI_PHONESIGN) \
X("noparkingsign1", MI_NOPARKINGSIGN1) \ X("noparkingsign1", MI_NOPARKINGSIGN1) \
X("bussign1", MI_BUSSIGN1) \ X("bussign1", MI_BUSSIGN1) \
@ -16,12 +599,17 @@
X("wastebin", MI_WASTEBIN) \ X("wastebin", MI_WASTEBIN) \
X("phonebooth1", MI_PHONEBOOTH1) \ X("phonebooth1", MI_PHONEBOOTH1) \
X("parkingmeter", MI_PARKINGMETER) \ 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("parkingmeterg", MI_PARKINGMETER2) \
X("mall_fans", MI_MALLFAN) \ X("mall_fans", MI_MALLFAN) \
X("htl_fan_rotate_nt", MI_HOTELFAN_NIGHT) \ X("htl_fan_rotate_nt", MI_HOTELFAN_NIGHT) \
X("htl_fan_rotate_dy", MI_HOTELFAN_DAY) \ X("htl_fan_rotate_dy", MI_HOTELFAN_DAY) \
X("hotroomfan", MI_HOTROOMFAN) \ X("hotroomfan", MI_HOTROOMFAN) \
X("trafficlight1", MI_TRAFFICLIGHTS) \ X("trafficlight1", MI_TRAFFICLIGHTS) /* BUG: second time */ \
X("MTraffic4", MI_TRAFFICLIGHTS_VERTICAL) \ X("MTraffic4", MI_TRAFFICLIGHTS_VERTICAL) \
X("MTraffic1", MI_TRAFFICLIGHTS_MIAMI) \ X("MTraffic1", MI_TRAFFICLIGHTS_MIAMI) \
X("MTraffic2", MI_TRAFFICLIGHTS_TWOVERTICAL) \ X("MTraffic2", MI_TRAFFICLIGHTS_TWOVERTICAL) \
@ -31,47 +619,110 @@
X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \ X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \
X("Streetlamp1", MI_STREETLAMP1) \ X("Streetlamp1", MI_STREETLAMP1) \
X("Streetlamp2", MI_STREETLAMP2) \ 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_tree3", MI_TREE2) \
X("veg_treea1", MI_TREE3) \ X("veg_treea1", MI_TREE3) \
X("veg_treenew01", MI_TREE4) \
X("veg_treenew05", MI_TREE5) \
X("veg_treeb1", MI_TREE6) \ X("veg_treeb1", MI_TREE6) \
X("veg_treenew10", MI_TREE7) \
X("veg_treea3", MI_TREE8) \ X("veg_treea3", MI_TREE8) \
X("doc_crane_cab0", MODELID_CRANE_1) \ X("veg_treenew09", MI_TREE9) \
X("doc_crane_cab01", MODELID_CRANE_2) \ X("veg_treenew08", MI_TREE10) \
X("doc_crane_cab02", MODELID_CRANE_3) \ X("veg_treenew03", MI_TREE11) \
X("doc_crane_cab03", MODELID_CRANE_4) \ X("veg_treenew16", MI_TREE12) \
X("boatcranelg0", MODELID_CRANE_5) \ X("veg_treenew17", MI_TREE13) \
X("LODnetopa0", MODELID_CRANE_6) \ X("veg_treenew06", MI_TREE14) \
X("crusher_crane", MODELID_CRANE_1) \
X("package1", MI_COLLECTABLE1) \ X("package1", MI_COLLECTABLE1) \
X("Money", MI_MONEY) \ X("Money", MI_MONEY) \
X("barrel1", MI_CARMINE) \ X("barrel1", MI_CARMINE) \
X("dk_paynspraydoor", MI_GARAGEDOOR2) \ X("oddjgaragdoor", MI_GARAGEDOOR1) \
X("dk_waretankdoor1", MI_GARAGEDOOR3) \ X("bombdoor", MI_GARAGEDOOR2) \
X("hav_garagedoor1", MI_GARAGEDOOR4) \ X("door_bombshop", MI_GARAGEDOOR3) \
X("hav_garagedoor02", MI_GARAGEDOOR5) \ X("vheistlocdoor", MI_GARAGEDOOR4) \
X("hav_garagedoor03", MI_GARAGEDOOR6) \ X("door2_garage", MI_GARAGEDOOR5) \
X("hav_garagedoor04", MI_GARAGEDOOR7) \ X("ind_slidedoor", MI_GARAGEDOOR6) \
X("lh_showdoor03", MI_GARAGEDOOR9) \ X("bankjobdoor", MI_GARAGEDOOR7) \
X("lh_showdoor1", MI_GARAGEDOOR10) \ X("door_jmsgrage", MI_GARAGEDOOR9) \
X("lhtankdoor", MI_GARAGEDOOR11) \ X("jamesgrge_kb", MI_GARAGEDOOR10) \
X("nbtgardoor", MI_GARAGEDOOR12) \ X("door_sfehousegrge", MI_GARAGEDOOR11) \
X("dk_camjonesdoor", MI_GARAGEDOOR13) \ X("shedgaragedoor", MI_GARAGEDOOR12) \
X("nbtgardoor02", MI_GARAGEDOOR14) \ X("door4_garage", MI_GARAGEDOOR13) \
X("dt_savedra", MI_GARAGEDOOR15) \ X("door_col_compnd_01", MI_GARAGEDOOR14) \
X("dt_savedrb", MI_GARAGEDOOR16) \ X("door_col_compnd_02", MI_GARAGEDOOR15) \
X("dk_bombdoor", MI_GARAGEDOOR18) \ X("door_col_compnd_03", MI_GARAGEDOOR16) \
X("haiwshpnsdoor", MI_GARAGEDOOR19) \ X("door_col_compnd_04", MI_GARAGEDOOR17) \
X("wshpnsdoor", MI_GARAGEDOOR20) \ X("door_col_compnd_05", MI_GARAGEDOOR18) \
X("nbecpnsdoor", MI_GARAGEDOOR21) \ X("impex_door", MI_GARAGEDOOR19) \
X("nbtgardoor03", MI_GARAGEDOOR22) \ X("SalvGarage", MI_GARAGEDOOR20) \
X("dt_savedrc", MI_GARAGEDOOR23) \ X("door3_garage", MI_GARAGEDOOR21) \
X("dt_savedrd", MI_GARAGEDOOR24) \ X("leveldoor2", MI_GARAGEDOOR22) \
X("man_frntstepGD", MI_GARAGEDOOR25) \ X("double_garage_dr", MI_GARAGEDOOR23) \
X("svegrgedoor", MI_GARAGEDOOR26) \ 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("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("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("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("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("adrenaline", MI_PICKUP_ADRENALINE) \
X("bodyarmour", MI_PICKUP_BODYARMOUR) \ X("bodyarmour", MI_PICKUP_BODYARMOUR) \
X("info", MI_PICKUP_INFO) \ X("info", MI_PICKUP_INFO) \
@ -82,16 +733,57 @@
X("camerapickup", MI_PICKUP_CAMERA) \ X("camerapickup", MI_PICKUP_CAMERA) \
X("bigdollar", MI_PICKUP_REVENUE) \ X("bigdollar", MI_PICKUP_REVENUE) \
X("pickupsave", MI_PICKUP_SAVEGAME) \ X("pickupsave", MI_PICKUP_SAVEGAME) \
X("clothesp", MI_PICKUP_CLOTHES) \
X("property_locked", MI_PICKUP_PROPERTY) \ X("property_locked", MI_PICKUP_PROPERTY) \
X("property_fsale", MI_PICKUP_PROPERTY_FORSALE) \ X("property_fsale", MI_PICKUP_PROPERTY_FORSALE) \
X("clothesp", MI_PICKUP_CLOTHES) \
X("bollardlight", MI_BOLLARDLIGHT) \ 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_barrier10", MI_FENCE) \
X("bar_barrier12", MI_FENCE2) \ X("bar_barrier12", MI_FENCE2) \
X("petrolpump", MI_PETROLPUMP) \ X("petrolpump", MI_PETROLPUMP) \
X("washgaspump", MI_PETROLPUMP2) \ 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("bouy", MI_BUOY) \
X("parktable1", MI_PARKTABLE) \ 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("lamppost1", MI_LAMPPOST1) \
X("veg_palm04", MI_VEG_PALM01) \ X("veg_palm04", MI_VEG_PALM01) \
X("veg_palwee02", MI_VEG_PALM02) \ X("veg_palwee02", MI_VEG_PALM02) \
@ -107,10 +799,12 @@
X("telgrphpole02", MI_TELPOLE02) \ X("telgrphpole02", MI_TELPOLE02) \
X("trafficlight1", MI_TRAFFICLIGHT01) \ X("trafficlight1", MI_TRAFFICLIGHT01) \
X("parkbench1", MI_PARKBENCH) \ X("parkbench1", MI_PARKBENCH) \
X("Money", MI_MONEY) \
X("plc_stinger", MI_PLC_STINGER) \ X("plc_stinger", MI_PLC_STINGER) \
X("od_lightbeam", MI_LIGHTBEAM) \ X("od_lightbeam", MI_LIGHTBEAM) \
X("ap_radar1_01", MI_AIRPORTRADAR) \ X("ap_radar1_01", MI_AIRPORTRADAR) \
X("rcbomb", MI_RCBOMB) \ X("rcbomb", MI_RCBOMB) \
X("jm_salradio", MI_JM_SALRADIO) \
X("beachball", MI_BEACHBALL) \ X("beachball", MI_BEACHBALL) \
X("sandcastle1", MI_SANDCASTLE1) \ X("sandcastle1", MI_SANDCASTLE1) \
X("sandcastle2", MI_SANDCASTLE2) \ X("sandcastle2", MI_SANDCASTLE2) \
@ -138,54 +832,42 @@
X("blimp_night", MI_BLIMP_NIGHT) \ X("blimp_night", MI_BLIMP_NIGHT) \
X("blimp_day", MI_BLIMP_DAY) \ X("blimp_day", MI_BLIMP_DAY) \
X("yt_main_body", MI_YT_MAIN_BODY) \ X("yt_main_body", MI_YT_MAIN_BODY) \
X("yt_main_body2", MI_YT_MAIN_BODY2) \ X("pt_barrier", MI_PT_BARRIER) \
X("oddjgaragdoor", MI_LCS_GARAGEDOOR01) \ X("subwaygate", MI_SUBWAYGATE) \
X("bombdoor", MI_LCS_GARAGEDOOR02) \ X("in_PMbridramp3", MI_IN_PMBRIDRAMP3) \
X("door_bombshop", MI_LCS_GARAGEDOOR03) \ X("in_PMbridg2_upgs", MI_IN_PMBRIDG2_UPGS) \
X("vheistlocdoor", MI_LCS_GARAGEDOOR04) \ X("in_PMbridge2", MI_IN_PMBRIDGE2) \
X("door2_garage", MI_LCS_GARAGEDOOR05) \ X("in_PMbridg1_upgs", MI_IN_PMBRIDG1_UPGS) \
X("ind_slidedoor", MI_LCS_GARAGEDOOR06) \ X("pm_lightrig3", MI_PM_LIGHTRIG3) \
X("bankjobdoor", MI_LCS_GARAGEDOOR07) \ X("pm_lightrig1", MI_PM_LIGHTRIG1) \
X("door_jmsgrage", MI_LCS_GARAGEDOOR08) \ X("in_pmSCAFF_UPS", MI_IN_PMSCAFF_UPS) \
X("ind_safeh_gdoor", MI_LCS_GARAGEDOOR09) \ X("in_pm_concblok2", MI_IN_PM_CONCBLOK2) \
X("door_sfehousegrge", MI_LCS_GARAGEDOOR10) \ X("in_pmSCAFFH_ns", MI_IN_PMSCAFFH_NS) \
X("shedgaragedoor", MI_LCS_GARAGEDOOR11) \ X("in_pm_gravl_jmp", MI_IN_PM_GRAVL_JMP) \
X("door4_garage", MI_LCS_GARAGEDOOR12) \ X("in_pm_scaffcovr", MI_IN_PM_SCAFFCOVR) \
X("door_col_compnd_01", MI_LCS_GARAGEDOOR13) \ X("in_pm_girder2", MI_IN_PM_GIRDER2) \
X("door_col_compnd_02", MI_LCS_GARAGEDOOR14) \ X("in_pm_scaffH_we", MI_IN_PM_SCAFFH_WE) \
X("door_col_compnd_03", MI_LCS_GARAGEDOOR15) \ X("in_pm_sixconc2", MI_IN_PM_SIXCONC2) \
X("door_col_compnd_04", MI_LCS_GARAGEDOOR16) \ X("in_BMbridramp3", MI_IN_BMBRIDRAMP3) \
X("door_col_compnd_05", MI_LCS_GARAGEDOOR17) \ X("in_BMbridg2_upgs", MI_IN_BMBRIDG2_UPGS) \
X("impex_door", MI_LCS_GARAGEDOOR18) \ X("in_BMbridge2", MI_IN_BMBRIDGE2) \
X("SalvGarage", MI_LCS_GARAGEDOOR19) \ X("in_BMbridg1_upgs", MI_IN_BMBRIDG1_UPGS) \
X("door3_garage", MI_LCS_GARAGEDOOR20) \ X("Bm_lightrig3", MI_BM_LIGHTRIG3) \
X("leveldoor2", MI_LCS_GARAGEDOOR21) \ X("bm_lightrig1", MI_BM_LIGHTRIG1) \
X("double_garage_dr", MI_LCS_GARAGEDOOR22) \ X("in_BmSCAFF_UPS", MI_IN_BMSCAFF_UPS) \
X("amcogaragedoor", MI_LCS_GARAGEDOOR23) \ X("in_Bm_concblok2", MI_IN_BM_CONCBLOK2) \
X("towergaragedoor1", MI_LCS_GARAGEDOOR24) \ X("in_BmSCAFFH_ns", MI_IN_BMSCAFFH_NS) \
X("towergaragedoor2", MI_LCS_GARAGEDOOR25) \ X("in_Bm_gravl_jmp", MI_IN_BM_GRAVL_JMP) \
X("towergaragedoor3", MI_LCS_GARAGEDOOR26) \ X("in_Bm_scaffcovr", MI_IN_BM_SCAFFCOVR) \
X("plysve_gragedoor", MI_LCS_GARAGEDOOR27) \ X("in_Bm_girder2", MI_IN_BM_GIRDER2) \
X("impexpsubgrgdoor", MI_LCS_GARAGEDOOR28) \ X("in_Bm_scaffH_we", MI_IN_BM_SCAFFH_WE) \
X("Sub_sprayshopdoor", MI_LCS_GARAGEDOOR29) \ X("in_Bm_sixconc2", MI_IN_BM_SIXCONC2)
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 /*X("yt_main_body2", MI_YT_MAIN_BODY2) \*/
#define X(name, var) extern int16 var; //#define X(name, var) extern int16 var;
MODELINDICES // MODELINDICES
#undef X //#undef X
// and some hardcoded ones // and some hardcoded ones
// expand as needed // expand as needed
@ -576,11 +1258,7 @@ IsLightThatNeedsRepositioning(int16 id)
return id == MI_SINGLESTREETLIGHTS1 || return id == MI_SINGLESTREETLIGHTS1 ||
id == MI_SINGLESTREETLIGHTS2 || id == MI_SINGLESTREETLIGHTS2 ||
id == MI_SINGLESTREETLIGHTS3 || id == MI_SINGLESTREETLIGHTS3 ||
id == MI_TRAFFICLIGHTS_MIAMI || id == MI_DOUBLESTREETLIGHTS;
id == MI_TRAFFICLIGHTS_TWOVERTICAL ||
id == MI_MLAMPPOST ||
id == MI_STREETLAMP1 ||
id == MI_STREETLAMP2;
} }
inline bool inline bool
@ -592,7 +1270,9 @@ IsLightObject(int16 id)
id == MI_SINGLESTREETLIGHTS2 || id == MI_SINGLESTREETLIGHTS2 ||
id == MI_SINGLESTREETLIGHTS3 || id == MI_SINGLESTREETLIGHTS3 ||
id == MI_DOUBLESTREETLIGHTS || id == MI_DOUBLESTREETLIGHTS ||
id == MI_TRAFFICLIGHTS_TWOVERTICAL; id == MI_TRAFFICLIGHTS_TWOVERTICAL ||
id == MI_TRAFFICLIGHTS ||
id == MI_FENCE;
} }
inline bool inline bool
@ -624,24 +1304,26 @@ IsPedModel(int16 id)
inline bool inline bool
IsPalmTreeModel(int16 id) IsPalmTreeModel(int16 id)
{ {
return id == MI_VEG_PALM01 || return false;
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;
} }
inline bool inline bool
IsTreeModel(int16 id) IsTreeModel(int16 id)
{ {
return id == MI_TREE2 || return id == MI_TREE1 ||
id == MI_TREE2 ||
id == MI_TREE3 || id == MI_TREE3 ||
id == MI_TREE4 ||
id == MI_TREE5 ||
id == MI_TREE6 || id == MI_TREE6 ||
id == MI_TREE7 ||
id == MI_TREE8 || 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 inline bool

View file

@ -1,14 +1,13 @@
#pragma once #pragma once
#include "2dEffect.h" #include "2dEffect.h"
#include "BaseModelInfo.h"
#include "SimpleModelInfo.h" #include "SimpleModelInfo.h"
#include "TimeModelInfo.h" #include "TimeModelInfo.h"
#include "WeaponModelInfo.h" #include "WeaponModelInfo.h"
#include "ClumpModelInfo.h" #include "ClumpModelInfo.h"
#include "PedModelInfo.h" #include "PedModelInfo.h"
#include "VehicleModelInfo.h" #include "VehicleModelInfo.h"
#include "Instance.h" #include "templates.h"
class CModelInfo class CModelInfo
{ {

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "ClumpModelInfo.h" #include "ClumpModelInfo.h"
#include "ColModel.h"
#include "PedType.h" #include "PedType.h"
enum PedNode { enum PedNode {

View file

@ -38,6 +38,7 @@
#include "WindModifiers.h" #include "WindModifiers.h"
#include "CutsceneShadow.h" #include "CutsceneShadow.h"
#include "Clock.h" #include "Clock.h"
#include "Wanted.h"
CPed *gapTempPedList[50]; CPed *gapTempPedList[50];
uint16 gnNumTempPedList; uint16 gnNumTempPedList;

View file

@ -9,8 +9,8 @@
#include "Physical.h" #include "Physical.h"
#include "Weapon.h" #include "Weapon.h"
#include "WeaponInfo.h" #include "WeaponInfo.h"
#include "AnimationId.h"
#include "PathFind.h" #include "PathFind.h"
#include "Collision.h"
#define FEET_OFFSET 1.04f #define FEET_OFFSET 1.04f
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f #define CHECK_NEARBY_THINGS_MAX_DIST 15.0f

View file

@ -45,8 +45,8 @@ CRGBA ARMOUR_COLOR(185, 185, 185, 255);
CRGBA NOTWANTED_COLOR(27, 89, 130, 255); CRGBA NOTWANTED_COLOR(27, 89, 130, 255);
CRGBA WANTED_COLOR_FLASH(62, 141, 181, 255); CRGBA WANTED_COLOR_FLASH(62, 141, 181, 255);
CRGBA WANTED_COLOR(97, 194, 247, 255); CRGBA WANTED_COLOR(97, 194, 247, 255);
CRGBA ZONE_COLOR(45, 155, 90, 255); CRGBA ZONE_COLOR(255, 255, 255, 255);
CRGBA VEHICLE_COLOR(97, 194, 247, 255); CRGBA VEHICLE_COLOR(255, 255, 255, 255);
CRGBA CLOCK_COLOR(97, 194, 247, 255); CRGBA CLOCK_COLOR(97, 194, 247, 255);
CRGBA TIMER_COLOR(97, 194, 247, 255); CRGBA TIMER_COLOR(97, 194, 247, 255);
CRGBA COUNTER_COLOR(97, 194, 247, 255); CRGBA COUNTER_COLOR(97, 194, 247, 255);
@ -785,14 +785,14 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH) if (FrontEndMenuManager.m_PrefsUseWideScreen)
CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.8f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(PSP_SCREEN_SCALE_X(0.42768f), PSP_SCREEN_SCALE_Y(0.88f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.7f), 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(128.0f));
CFont::SetSlant(0.15f);
//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::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
@ -802,9 +802,9 @@ void CHud::Draw()
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
if (!CTheScripts::bPlayerIsInTheStatium) 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 { } else {
m_ZoneState = 3; m_ZoneState = 3;
} }
@ -885,13 +885,14 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_SPANISH) if (FrontEndMenuManager.m_PrefsUseWideScreen)
CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(PSP_SCREEN_SCALE_X(0.42768f), PSP_SCREEN_SCALE_Y(0.88f));
else 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::SetWrapx(SCREEN_WIDTH);
CFont::SetSlant(0.15f); CFont::SetSlantRefPoint(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(35.6f));
CFont::SetSlant(0.f);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f); 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::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha));
CFont::SetDropColor(CRGBA(0, 0, 0, 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); CFont::SetSlant(0.f);
} }

View file

@ -1,4 +1,3 @@
#define WITHWINDOWS
#ifndef LIBRW #ifndef LIBRW
#define WITHD3D #define WITHD3D
#endif #endif

View file

@ -1,4 +1,4 @@
#define WITH_D3D #define WITHD3D
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"

View file

@ -877,7 +877,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
pMarker->m_Matrix.GetPosition() = pos; pMarker->m_Matrix.GetPosition() = pos;
if (pMarker->m_bFindZOnNextPlacement) { 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); float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
if (z != 0.0f) if (z != 0.0f)
pMarker->m_Matrix.GetPosition().z = z - 0.05f * size; 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); pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate);
if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) { 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); float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
if (z != 0.0f) if (z != 0.0f)
pos.z = z - 0.05f * size; pos.z = z - 0.05f * size;

View file

@ -1,11 +1,12 @@
#include "common.h"
#include "WaterCreatures.h" #include "WaterCreatures.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "World.h" #include "World.h"
#include "WaterLevel.h" #include "WaterLevel.h"
#include "Camera.h" #include "Camera.h"
#include "PlayerPed.h" #include "PlayerPed.h"
#include "config.h"
#include "General.h" #include "General.h"
#include "Object.h"
/* /*
int CWaterCreatures::nNumActiveSeaLifeForms; int CWaterCreatures::nNumActiveSeaLifeForms;

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "Object.h"
class CObject;
/* /*
enum eFishSlotState { enum eFishSlotState {

View file

@ -1,6 +1,4 @@
#if defined RW_D3D9 || defined RWLIBS
#define WITHD3D #define WITHD3D
#endif
#include "common.h" #include "common.h"
#include "Timecycle.h" #include "Timecycle.h"

View file

@ -1,5 +1,7 @@
#include "common.h" #include "common.h"
#include "main.h"
#include "smallHeap.h"
#include "templates.h" #include "templates.h"
#include "General.h" #include "General.h"
#include "Streaming.h" #include "Streaming.h"
@ -9,13 +11,19 @@
CPool<TxdDef,TxdDef> *CTxdStore::ms_pTxdPool; CPool<TxdDef,TxdDef> *CTxdStore::ms_pTxdPool;
RwTexDictionary *CTxdStore::ms_pStoredTxd; RwTexDictionary *CTxdStore::ms_pStoredTxd;
// LCS: file done except unused:
// CTexListStore::RemoveTexListChunk(int)
// CTexListStore::validateRefs(void)
// CTexListStore::Write(base::cRelocatableChunkWriter &)
void void
CTxdStore::Initialise(void) CTxdStore::Initialise(void)
{ {
if(ms_pTxdPool == nil) if(gMakeResources && ms_pTxdPool == nil)
ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE, "TexDictionary"); ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE, "TexDictionary");
} }
// removed in LCS but we should probably keep it
void void
CTxdStore::Shutdown(void) CTxdStore::Shutdown(void)
{ {
@ -23,6 +31,7 @@ CTxdStore::Shutdown(void)
delete ms_pTxdPool; delete ms_pTxdPool;
} }
// removed in LCS but we should probably keep it
void void
CTxdStore::GameShutdown(void) CTxdStore::GameShutdown(void)
{ {
@ -42,6 +51,7 @@ CTxdStore::AddTxdSlot(const char *name)
assert(def); assert(def);
def->texDict = nil; def->texDict = nil;
def->refCount = 0; def->refCount = 0;
def->refCountGu = 0;
strcpy(def->name, name); strcpy(def->name, name);
return ms_pTxdPool->GetJustIndex(def); return ms_pTxdPool->GetJustIndex(def);
} }
@ -95,7 +105,11 @@ CTxdStore::SetCurrentTxd(int slot)
void void
CTxdStore::Create(int slot) 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 int
@ -110,6 +124,20 @@ CTxdStore::AddRef(int slot)
GetSlot(slot)->refCount++; GetSlot(slot)->refCount++;
} }
void
CTxdStore::AddRefEvenIfNotInMemory(int slot)
{
GetSlot(slot)->refCount++;
}
void
CTxdStore::AddRefGu(int slot)
{
TxdDef *def = GetSlot(slot);
def->refCount++;
def->refCountGu++;
}
void void
CTxdStore::RemoveRef(int slot) CTxdStore::RemoveRef(int slot)
{ {
@ -117,6 +145,15 @@ CTxdStore::RemoveRef(int slot)
CStreaming::RemoveTxd(slot); CStreaming::RemoveTxd(slot);
} }
void
CTxdStore::RemoveRefGu(int slot)
{
TxdDef *def = GetSlot(slot);
def->refCount--;
if(gUseChunkFiles)
def->refCountGu--;
}
void void
CTxdStore::RemoveRefWithoutDelete(int slot) CTxdStore::RemoveRefWithoutDelete(int slot)
{ {
@ -128,14 +165,31 @@ CTxdStore::LoadTxd(int slot, RwStream *stream)
{ {
TxdDef *def = GetSlot(slot); TxdDef *def = GetSlot(slot);
if(stream){
if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){ if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
def->texDict = RwTexDictionaryGtaStreamRead(stream); def->texDict = RwTexDictionaryGtaStreamRead(stream);
return def->texDict != nil; return def->texDict != nil;
} }
}else{
// TODO(LCS)? fall back reading from file
}
printf("Failed to load TXD\n"); printf("Failed to load TXD\n");
return false; 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 bool
CTxdStore::LoadTxd(int slot, const char *filename) CTxdStore::LoadTxd(int slot, const char *filename)
{ {
@ -152,6 +206,7 @@ CTxdStore::LoadTxd(int slot, const char *filename)
return ret; return ret;
} }
// removed in LCS but we should probably keep it
bool bool
CTxdStore::StartLoadTxd(int slot, RwStream *stream) 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 bool
CTxdStore::FinishLoadTxd(int slot, RwStream *stream) CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
{ {
@ -174,10 +230,31 @@ CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
} }
void void
CTxdStore::RemoveTxd(int slot) CTxdStore::RemoveTxd(int slot, bool notChunk)
{ {
TxdDef *def = GetSlot(slot); TxdDef *def = GetSlot(slot);
if(def->texDict) if(def->texDict){
if(!gUseChunkFiles || notChunk)
RwTexDictionaryDestroy(def->texDict); RwTexDictionaryDestroy(def->texDict);
def->texDict = nil; 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;
}
} }

View file

@ -4,7 +4,8 @@
struct TxdDef { struct TxdDef {
RwTexDictionary *texDict; RwTexDictionary *texDict;
int refCount; int16 refCount;
int16 refCountGu;
char name[20]; char name[20];
}; };
@ -26,13 +27,19 @@ public:
static void Create(int slot); static void Create(int slot);
static int GetNumRefs(int slot); static int GetNumRefs(int slot);
static void AddRef(int slot); static void AddRef(int slot);
static void AddRefEvenIfNotInMemory(int slot);
static void AddRefGu(int slot);
static void RemoveRef(int slot); static void RemoveRef(int slot);
static void RemoveRefGu(int slot);
static void RemoveRefWithoutDelete(int slot); static void RemoveRefWithoutDelete(int slot);
static bool LoadTxd(int slot, RwStream *stream); 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 LoadTxd(int slot, const char *filename);
static bool StartLoadTxd(int slot, RwStream *stream); static bool StartLoadTxd(int slot, RwStream *stream);
static bool FinishLoadTxd(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) { static TxdDef *GetSlot(int slot) {
assert(slot >= 0); assert(slot >= 0);

View file

@ -345,7 +345,11 @@ GenericLoad()
#endif #endif
ReadDataFromBufferPointer(buf, CGame::currArea); ReadDataFromBufferPointer(buf, CGame::currArea);
ReadDataFromBufferPointer(buf, CVehicle::bAllTaxisHaveNitro); ReadDataFromBufferPointer(buf, CVehicle::bAllTaxisHaveNitro);
#ifdef LOAD_INI_SETTINGS
buf += align4bytes(sizeof(CPad::bInvertLook4Pad)); buf += align4bytes(sizeof(CPad::bInvertLook4Pad));
#else
ReadDataFromBufferPointer(buf, CPad::bInvertLook4Pad);
#endif
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour); ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour);
ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn); ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn);
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter); ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter);

View file

@ -1,6 +1,7 @@
#define WITHWINDOWS #define WITHWINDOWS
#include "common.h" #include "common.h"
#ifdef PS2_MENU #ifdef PS2_MENU
#include "crossplatform.h"
#include "MemoryCard.h" #include "MemoryCard.h"
#include "main.h" #include "main.h"
#include "DMAudio.h" #include "DMAudio.h"

View file

@ -1,22 +1,30 @@
#if defined RW_GL3 && !defined LIBRW_SDL2 #if defined RW_GL3 && !defined LIBRW_SDL2
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <shlobj.h>
#include <basetsd.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <regstr.h>
#include <shellapi.h> #include <shellapi.h>
#include <windowsx.h> #include <windowsx.h>
#include <basetsd.h>
#include <regstr.h> DWORD _dwOperatingSystemVersion;
#include <shlobj.h> #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 #endif
#define WITHWINDOWS
#include "common.h" #include "common.h"
#pragma warning( push )
#pragma warning( disable : 4005)
#pragma warning( pop )
#if (defined(_MSC_VER)) #if (defined(_MSC_VER))
#include <tchar.h> #include <tchar.h>
#endif /* (defined(_MSC_VER)) */ #endif /* (defined(_MSC_VER)) */
@ -72,23 +80,6 @@ static psGlobalType PsGlobal;
size_t _dwMemAvailPhys; size_t _dwMemAvailPhys;
RwUInt32 gGameState; 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 #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
char gSelectedJoystickName[128] = ""; char gSelectedJoystickName[128] = "";
#endif #endif
@ -1646,6 +1637,13 @@ main(int argc, char *argv[])
{ {
CFileMgr::SetDirMyDocuments(); 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"); int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r");
if ( gta3set ) if ( gta3set )
@ -1655,6 +1653,14 @@ main(int argc, char *argv[])
} }
CFileMgr::SetDir(""); CFileMgr::SetDir("");
#ifdef LOAD_INI_SETTINGS
LoadINIControllerSettings();
if (connectedPadButtons != 0) {
ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons);
SaveINIControllerSettings();
}
#endif
} }
#ifdef _WIN32 #ifdef _WIN32
@ -2167,6 +2173,12 @@ void joysChangeCB(int jid, int event)
PSGLOBAL(joy1id) = jid; PSGLOBAL(joy1id) = jid;
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
strcpy(gSelectedJoystickName, glfwGetJoystickName(jid)); 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 #endif
} else if (PSGLOBAL(joy2id) == -1) } else if (PSGLOBAL(joy2id) == -1)
PSGLOBAL(joy2id) = jid; PSGLOBAL(joy2id) = jid;

View file

@ -2,7 +2,6 @@
#define _WIN32_WINDOWS 0x0500 #define _WIN32_WINDOWS 0x0500
#define WINVER 0x0500 #define WINVER 0x0500
#define DIRECTINPUT_VERSION 0x0800
#include <winerror.h> #include <winerror.h>
#include <windows.h> #include <windows.h>
@ -20,13 +19,7 @@
#pragma warning( push ) #pragma warning( push )
#pragma warning( disable : 4005) #pragma warning( disable : 4005)
#ifdef USE_D3D9
#include <d3d9.h>
#else
#include <d3d8.h>
#endif
#include <ddraw.h> #include <ddraw.h>
#include <dinput.h>
#include <DShow.h> #include <DShow.h>
#pragma warning( pop ) #pragma warning( pop )
@ -41,6 +34,9 @@
#pragma comment( lib, "strmiids.lib" ) #pragma comment( lib, "strmiids.lib" )
#pragma comment( lib, "dinput8.lib" ) #pragma comment( lib, "dinput8.lib" )
#define WITHD3D
#define WITHDINPUT
#include "common.h"
#if (defined(_MSC_VER)) #if (defined(_MSC_VER))
#include <tchar.h> #include <tchar.h>
#endif /* (defined(_MSC_VER)) */ #endif /* (defined(_MSC_VER)) */
@ -81,7 +77,6 @@ static psGlobalType PsGlobal;
#define JIF(x) if (FAILED(hr=(x))) \ #define JIF(x) if (FAILED(hr=(x))) \
{debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;} {debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;}
#include "common.h"
#include "main.h" #include "main.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "Text.h" #include "Text.h"
@ -92,12 +87,14 @@ static psGlobalType PsGlobal;
#include "Frontend.h" #include "Frontend.h"
#include "Game.h" #include "Game.h"
#include "PCSave.h" #include "PCSave.h"
#include "MemoryCard.h"
#include "Sprite2d.h"
#include "AnimViewer.h" #include "AnimViewer.h"
#include "Font.h"
#include "MemoryMgr.h" #include "MemoryMgr.h"
#ifdef PS2_MENU
#include "MemoryCard.h"
#include "Font.h"
#endif
VALIDATE_SIZE(psGlobalType, 0x28); VALIDATE_SIZE(psGlobalType, 0x28);
// DirectShow interfaces // DirectShow interfaces
@ -2148,6 +2145,13 @@ WinMain(HINSTANCE instance,
{ {
CFileMgr::SetDirMyDocuments(); 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"); int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r");
if ( gta3set ) if ( gta3set )
@ -2157,6 +2161,14 @@ WinMain(HINSTANCE instance,
} }
CFileMgr::SetDir(""); CFileMgr::SetDir("");
#ifdef LOAD_INI_SETTINGS
LoadINIControllerSettings();
if (connectedPadButtons != 0) {
ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons);
SaveINIControllerSettings();
}
#endif
} }
SetErrorMode(SEM_FAILCRITICALERRORS); SetErrorMode(SEM_FAILCRITICALERRORS);

View file

@ -49,6 +49,7 @@
#include "Object.h" #include "Object.h"
#include "Automobile.h" #include "Automobile.h"
#include "Bike.h" #include "Bike.h"
#include "Wanted.h"
bool bAllCarCheat; bool bAllCarCheat;

View file

@ -79,6 +79,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; m_bikeAnimType = ASSOCGRP_BIKE_STANDARD;
break; break;
case MI_SANCHEZ: case MI_SANCHEZ:
case MI_SANCHEZ2:
m_bikeAnimType = ASSOCGRP_BIKE_DIRT; m_bikeAnimType = ASSOCGRP_BIKE_DIRT;
break; break;
default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO

View file

@ -2,6 +2,7 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "Skidmarks.h" #include "Skidmarks.h"
#include "AnimManager.h"
enum eBikeNodes { enum eBikeNodes {
BIKE_NODE_NONE, BIKE_NODE_NONE,

View file

@ -27,6 +27,7 @@
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
#include "Record.h" #include "Record.h"
#include "Shadows.h" #include "Shadows.h"
#include "Wanted.h"
#define INVALID_ORIENTATION (-9999.99f) #define INVALID_ORIENTATION (-9999.99f)

View file

@ -50,7 +50,12 @@ void CCranes::InitCranes(void)
for (int j = 0; j < NUMSECTORS_Y; j++) { for (int j = 0; j < NUMSECTORS_Y; j++) {
for (CPtrNode* pNode = CWorld::GetSector(i, j)->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { for (CPtrNode* pNode = CWorld::GetSector(i, j)->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item; 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); AddThisOneCrane(pEntity);
} }
} }
@ -58,7 +63,12 @@ void CCranes::InitCranes(void)
// TODO(LCS) // TODO(LCS)
for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_INDUSTRIAL).first; pNode; pNode = pNode->next) { for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_INDUSTRIAL).first; pNode; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item; 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); AddThisOneCrane(pEntity);
} }

View file

@ -3,15 +3,15 @@
#include "Physical.h" #include "Physical.h"
#include "AutoPilot.h" #include "AutoPilot.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "AnimManager.h" #include "AnimationId.h"
#include "Weapon.h" #include "WeaponType.h"
#include "Collision.h"
#include "HandlingMgr.h" #include "HandlingMgr.h"
class CPed; class CPed;
class CPlayerPed; class CPlayerPed;
class CCopPed; class CCopPed;
class CFire; class CFire;
struct tHandlingData;
enum { enum {
RANDOM_VEHICLE = 1, RANDOM_VEHICLE = 1,