1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-06-18 19:13:12 +00:00

Merge branch 'lcs' into lcs

This commit is contained in:
Fire_Head 2021-01-26 01:01:32 +03:00 committed by GitHub
commit 0ae6d1fecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
239 changed files with 5305 additions and 2213 deletions

6
.gitignore vendored
View file

@ -353,4 +353,8 @@ vendor/glew-2.1.0/
vendor/glfw-3.3.2.bin.WIN32/ vendor/glfw-3.3.2.bin.WIN32/
vendor/glfw-3.3.2.bin.WIN64/ vendor/glfw-3.3.2.bin.WIN64/
sdk/ sdk/
codewarrior/reVC_Data/
codewarrior/Release/
codewarrior/Debug/

View file

View file

BIN
codewarrior/reVC.mcp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -147,7 +147,6 @@ workspace "reLCS"
filter { "platforms:macosx-amd64-*" } filter { "platforms:macosx-amd64-*" }
buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" } buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" }
filter { "platforms:*librw_d3d9*" } filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" } defines { "RW_D3D9" }
if(not _OPTIONS["with-librw"]) then if(not _OPTIONS["with-librw"]) then
@ -232,7 +231,6 @@ project "reLCS"
kind "WindowedApp" kind "WindowedApp"
targetname "reLCS" targetname "reLCS"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
defines { "MIAMI" }
files { addSrcFiles("src") } files { addSrcFiles("src") }
files { addSrcFiles("src/animation") } files { addSrcFiles("src/animation") }
@ -244,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") }
@ -269,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

@ -79,6 +79,21 @@ endif()
target_compile_definitions(${EXECUTABLE} PRIVATE ) target_compile_definitions(${EXECUTABLE} PRIVATE )
option(${PROJECT}_WITH_SANITIZERS "Use UB sanitizers (better crash log)" OFF)
option(${PROJECT}_WITH_ASAN "Use Address sanitizer (better crash log)" OFF)
if(${PROJECT}_WITH_SANITIZERS)
target_compile_options(${EXECUTABLE} PUBLIC
-fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability
-g3 -fno-omit-frame-pointer)
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability)
endif()
if(${PROJECT}_WITH_ASAN)
target_compile_options(${EXECUTABLE} PUBLIC -fsanitize=address -g3 -fno-omit-frame-pointer)
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=address)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(${EXECUTABLE} target_compile_options(${EXECUTABLE}
PRIVATE PRIVATE

View file

@ -1,7 +1,11 @@
#include "common.h" #include "common.h"
#if defined _WIN32 && !defined __MINGW32__ #if defined _WIN32 && !defined __MINGW32__
#if defined __MWERKS__
#include <wctype.h>
#else
#include "ctype.h" #include "ctype.h"
#endif
#else #else
#include <cwctype> #include <cwctype>
#endif #endif
@ -16,8 +20,6 @@
#include "AnimBlendAssocGroup.h" #include "AnimBlendAssocGroup.h"
#include "KeyGen.h" #include "KeyGen.h"
//--MIAMI: file done
CAnimBlendAssocGroup::CAnimBlendAssocGroup(void) CAnimBlendAssocGroup::CAnimBlendAssocGroup(void)
{ {
animBlock = nil; animBlock = nil;
@ -91,18 +93,18 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
if(c1) s1++; if(c1) s1++;
if(c2) s2++; if(c2) s2++;
if(c1 == '\0' && c2 == '\0') return true; if(c1 == '\0' && c2 == '\0') return true;
#if defined _WIN32 && !defined __MINGW32__ #ifndef ASCII_STRCMP
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#else
if(iswdigit(c1) && iswdigit(c2)) if(iswdigit(c1) && iswdigit(c2))
#else
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#endif #endif
continue; continue;
#if defined _WIN32 && !defined __MINGW32__ #ifndef ASCII_STRCMP
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#else
c1 = toupper(c1); c1 = toupper(c1);
c2 = toupper(c2); c2 = toupper(c2);
#else
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#endif #endif
if(c1 && c2 && c1 != c2) if(c1 && c2 && c1 != c2)

View file

@ -7,8 +7,6 @@
#include "AnimBlendAssociation.h" #include "AnimBlendAssociation.h"
#include "MemoryMgr.h" #include "MemoryMgr.h"
//--MIAMI: file done
CAnimBlendAssociation::CAnimBlendAssociation(void) CAnimBlendAssociation::CAnimBlendAssociation(void)
{ {
groupId = -1; groupId = -1;

View file

@ -3,8 +3,6 @@
#include "AnimBlendClumpData.h" #include "AnimBlendClumpData.h"
#include "MemoryMgr.h" #include "MemoryMgr.h"
//--MIAMI: file done
CAnimBlendClumpData::CAnimBlendClumpData(void) CAnimBlendClumpData::CAnimBlendClumpData(void)
{ {
numFrames = 0; numFrames = 0;

View file

@ -4,8 +4,6 @@
#include "AnimBlendHierarchy.h" #include "AnimBlendHierarchy.h"
#include "AnimManager.h" #include "AnimManager.h"
//--MIAMI: file done
CAnimBlendHierarchy::CAnimBlendHierarchy(void) CAnimBlendHierarchy::CAnimBlendHierarchy(void)
{ {
sequences = nil; sequences = nil;

View file

@ -3,8 +3,6 @@
#include "AnimBlendAssociation.h" #include "AnimBlendAssociation.h"
#include "AnimBlendNode.h" #include "AnimBlendNode.h"
//--MIAMI: file done
void void
CAnimBlendNode::Init(void) CAnimBlendNode::Init(void)
{ {

View file

@ -3,8 +3,6 @@
#include "AnimBlendSequence.h" #include "AnimBlendSequence.h"
#include "MemoryHeap.h" #include "MemoryHeap.h"
//--MIAMI: file done
CAnimBlendSequence::CAnimBlendSequence(void) CAnimBlendSequence::CAnimBlendSequence(void)
{ {
type = 0; type = 0;

View file

@ -12,8 +12,6 @@
#include "AnimManager.h" #include "AnimManager.h"
#include "Streaming.h" #include "Streaming.h"
//--MIAMI: file done
CAnimBlock CAnimManager::ms_aAnimBlocks[NUMANIMBLOCKS]; CAnimBlock CAnimManager::ms_aAnimBlocks[NUMANIMBLOCKS];
CAnimBlendHierarchy CAnimManager::ms_aAnimations[NUMANIMATIONS]; CAnimBlendHierarchy CAnimManager::ms_aAnimations[NUMANIMATIONS];
int32 CAnimManager::ms_numAnimBlocks; int32 CAnimManager::ms_numAnimBlocks;
@ -1477,7 +1475,6 @@ CAnimManager::LoadAnimFile(const char *filename)
RwStreamClose(stream, nil); RwStreamClose(stream, nil);
} }
//--MIAMI: done
void void
CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedAnims)[32]) CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedAnims)[32])
{ {

View file

@ -24,8 +24,6 @@
#include "Pools.h" #include "Pools.h"
#include "crossplatform.h" #include "crossplatform.h"
//--MIAMI: file done
static bool bModelsRemovedForCutscene; static bool bModelsRemovedForCutscene;
static int32 NumberOfSavedWeapons; static int32 NumberOfSavedWeapons;
static eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS]; static eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];

View file

@ -6,8 +6,6 @@
#include "AnimBlendAssociation.h" #include "AnimBlendAssociation.h"
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
//--MIAMI: file done
CAnimBlendClumpData *gpAnimBlendClump; CAnimBlendClumpData *gpAnimBlendClump;
// PS2 names without "NonSkinned" // PS2 names without "NonSkinned"

View file

@ -12,8 +12,6 @@
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
#include "PedModelInfo.h" #include "PedModelInfo.h"
//--MIAMI: file done
RwInt32 ClumpOffset; RwInt32 ClumpOffset;
enum enum

View file

@ -1,4 +1,4 @@
#include "common.h" #include "common.h"
#include "AudioManager.h" #include "AudioManager.h"
#include "audio_enums.h" #include "audio_enums.h"
@ -41,9 +41,9 @@
#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(AudioManager.m_asActiveSamples);
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
const int allChannels = channels + 2; const int allChannels = channels + 2;
@ -305,11 +305,11 @@ cAudioManager::ProcessPlayerMood()
playerPed = FindPlayerPed(); playerPed = FindPlayerPed();
if (playerPed != nil) { if (playerPed != nil) {
if (playerPed->m_pWanted->m_nWantedLevel > 3) { if (playerPed->m_pWanted->GetWantedLevel() > 3) {
m_nPlayerMood = PLAYER_MOOD_ANGRY; m_nPlayerMood = PLAYER_MOOD_ANGRY;
return; return;
} }
if (playerPed->m_pWanted->m_nWantedLevel > 1) { if (playerPed->m_pWanted->GetWantedLevel() > 1) {
m_nPlayerMood = PLAYER_MOOD_PISSED_OFF; m_nPlayerMood = PLAYER_MOOD_PISSED_OFF;
return; return;
} }
@ -5684,7 +5684,7 @@ cAudioManager::GetCopTalkSfx(CPed *ped, int16 sound)
case SOUND_PED_ATTACK: GetPhrase(sfx, ped->m_lastComment, 8494, 4); break; case SOUND_PED_ATTACK: GetPhrase(sfx, ped->m_lastComment, 8494, 4); break;
case SOUND_PED_EVADE: GetPhrase(sfx, ped->m_lastComment, 8491, 3); break; case SOUND_PED_EVADE: GetPhrase(sfx, ped->m_lastComment, 8491, 3); break;
case SOUND_PED_PED_COLLISION: case SOUND_PED_PED_COLLISION:
if(FindPlayerPed()->m_pWanted->m_nWantedLevel <= 0) return NO_SAMPLE; if(FindPlayerPed()->m_pWanted->GetWantedLevel() <= 0) return NO_SAMPLE;
GetPhrase(sfx, ped->m_lastComment, 8476, 5); GetPhrase(sfx, ped->m_lastComment, 8476, 5);
break; break;
default: return GetGenericMaleTalkSfx(ped, sound); default: return GetGenericMaleTalkSfx(ped, sound);
@ -8115,7 +8115,7 @@ cAudioManager::ProcessWaterCannon(int32)
} }
//positon of arcade machines //positon of arcade machines
CVector aVecExtraSoundPosition[] = { {-1042.546f, 88.794f, 11.324f}, {-1004.476f, 181.697f, 11.324f} }; CVector aVecExtraSoundPosition[] = { CVector(-1042.546f, 88.794f, 11.324f), CVector(-1004.476f, 181.697f, 11.324f) };
void void
cAudioManager::ProcessExtraSounds() cAudioManager::ProcessExtraSounds()
@ -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

@ -14,7 +14,7 @@
cAudioManager AudioManager; cAudioManager AudioManager;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
const int allChannels = channels + 2; const int allChannels = channels + 2;

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "audio_enums.h" #include "audio_enums.h"
#include "AudioCollision.h" #include "AudioCollision.h"
@ -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

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "common.h" #include "common.h"

View file

@ -1237,11 +1237,12 @@ cMusicManager::DisplayRadioStationName()
case RADIO_ESPANTOSO: string = TheText.Get("FEA_FM6"); break; case RADIO_ESPANTOSO: string = TheText.Get("FEA_FM6"); break;
case EMOTION: string = TheText.Get("FEA_FM7"); break; case EMOTION: string = TheText.Get("FEA_FM7"); break;
case WAVE: string = TheText.Get("FEA_FM8"); break; case WAVE: string = TheText.Get("FEA_FM8"); break;
case USERTRACK: case 9: string = TheText.Get("FEA_FM9"); break;
case 10:
if (!SampleManager.IsMP3RadioChannelAvailable()) if (!SampleManager.IsMP3RadioChannelAvailable())
return; return;
string = TheText.Get("FEA_MP3"); break; string = TheText.Get("FEA_MP3"); break;
default: return; default: string = TheText.Get("FEA_NON"); break;
}; };
if (pCurrentStation != string) { if (pCurrentStation != string) {
@ -1255,21 +1256,22 @@ cMusicManager::DisplayRadioStationName()
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetDropShadowPosition(2);
CFont::SetScale(PSP_SCREEN_SCALE_X(0.5f), PSP_SCREEN_SCALE_Y(0.88f));
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetFontStyle(FONT_STANDARD); CFont::SetFontStyle(FONT_BANK);
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); CFont::SetCentreSize(PSP_SCREEN_SCALE_X(260.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation);
if (gNumRetunePresses) if (gNumRetunePresses)
CFont::SetColor(CRGBA(102, 133, 143, 255)); CFont::SetColor(CRGBA(77, 155, 210, 255));
else else
CFont::SetColor(CRGBA(147, 196, 211, 255)); CFont::SetColor(CRGBA(77, 155, 210, 255));
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_Y(22.0f), pCurrentStation); CFont::PrintString(SCREEN_WIDTH / 2, PSP_SCREEN_SCALE_Y(7.0f), pCurrentStation);
CFont::DrawFonts(); CFont::DrawFonts();
CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
} }
} }
} }

View file

@ -13,8 +13,9 @@
#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(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
struct tPoliceRadioZone { struct tPoliceRadioZone {
@ -136,7 +137,7 @@ cAudioManager::ServicePoliceRadio()
#endif #endif
CPlayerPed *playerPed = FindPlayerPed(); CPlayerPed *playerPed = FindPlayerPed();
if (playerPed) { if (playerPed) {
wantedLevel = playerPed->m_pWanted->m_nWantedLevel; wantedLevel = playerPed->m_pWanted->GetWantedLevel();
if (!crimeReport) { if (!crimeReport) {
if (wantedLevel != 0) { if (wantedLevel != 0) {
if (nLastSeen != 0) if (nLastSeen != 0)
@ -652,7 +653,7 @@ void
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos) cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
{ {
int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes); int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes);
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) { (type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) { for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE) { if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE) {

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,7 @@
#include "common.h" #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>
@ -20,8 +19,6 @@
#pragma comment( lib, "mss32.lib" ) #pragma comment( lib, "mss32.lib" )
// --MIAMI: file done
cSampleManager SampleManager; cSampleManager SampleManager;
uint32 BankStartOffset[MAX_SFX_BANKS]; uint32 BankStartOffset[MAX_SFX_BANKS];
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////

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,4 +1,4 @@
#pragma once #pragma once
enum eSound enum eSound
{ {

View file

@ -7,6 +7,8 @@
CColModel::CColModel(void) CColModel::CColModel(void)
{ {
boundingSphere.Set(0.0001f, CVector(0.0f, 0.0f, 0.0f));
boundingBox.Set(CVector(0.0f, 0.0f, 0.0f), CVector(0.0f, 0.0f, 0.0f));
numSpheres = 0; numSpheres = 0;
spheres = nil; spheres = nil;
numLines = 0; numLines = 0;
@ -18,7 +20,7 @@ CColModel::CColModel(void)
triangles = nil; triangles = nil;
trianglePlanes = nil; trianglePlanes = nil;
level = LEVEL_GENERIC; // generic col slot level = LEVEL_GENERIC; // generic col slot
ownsCollisionVolumes = true; // ownsCollisionVolumes = true;
} }
CColModel::~CColModel(void) CColModel::~CColModel(void)
@ -204,3 +206,10 @@ CColModel::operator=(const CColModel &other)
} }
return *this; return *this;
} }
bool
CColModel::Write(base::cRelocatableChunkWriter &writer, bool allocSpace)
{
assert(0 && "TODO(LCS)");
return 1;
}

View file

@ -36,4 +36,6 @@ struct CColModel
void *operator new(size_t); void *operator new(size_t);
void operator delete(void *p, size_t); void operator delete(void *p, size_t);
CColModel& operator=(const CColModel& other); CColModel& operator=(const CColModel& other);
bool Write(base::cRelocatableChunkWriter &writer, bool allocSpace);
}; };

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

@ -24,8 +24,6 @@
#include "Camera.h" #include "Camera.h"
#include "ColStore.h" #include "ColStore.h"
//--MIAMI: file done
#ifdef VU_COLLISION #ifdef VU_COLLISION
#include "VuCollision.h" #include "VuCollision.h"
@ -93,7 +91,7 @@ CCollision::Update(void)
{ {
} }
//--MIAMI: unused // unused
eLevelName eLevelName
GetCollisionInSectorList(CPtrList &list) GetCollisionInSectorList(CPtrList &list)
{ {
@ -110,7 +108,7 @@ GetCollisionInSectorList(CPtrList &list)
return LEVEL_GENERIC; return LEVEL_GENERIC;
} }
//--MIAMI: unused // unused
// Get a level this sector is in based on collision models // Get a level this sector is in based on collision models
eLevelName eLevelName
GetCollisionInSector(CSector &sect) GetCollisionInSector(CSector &sect)
@ -880,7 +878,7 @@ CCollision::ProcessLineSphere(const CColLine &line, const CColSphere &sphere, CC
return true; return true;
} }
//--MIAMI: unused // unused
bool bool
CCollision::ProcessVerticalLineTriangle(const CColLine &line, CCollision::ProcessVerticalLineTriangle(const CColLine &line,
const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
@ -2101,12 +2099,12 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
float dot = DotProduct(*point - *l0, *l1 - *l0); float dot = DotProduct(*point - *l0, *l1 - *l0);
// Between 0 and len we're above the line. // Between 0 and len we're above the line.
// if not, calculate distance to endpoint // if not, calculate distance to endpoint
if(dot <= 0.0f) if(dot <= 0.0f) return (*point - *l0).Magnitude();
return (*point - *l0).Magnitude(); if(dot >= lensq) return (*point - *l1).Magnitude();
if(dot >= lensq)
return (*point - *l1).Magnitude();
// distance to line // distance to line
return Sqrt((*point - *l0).MagnitudeSqr() - dot*dot/lensq); float distSqr = (*point - *l0).MagnitudeSqr() - dot * dot / lensq;
if(distSqr <= 0.f) return 0.f;
return Sqrt(distSqr);
} }
// same as above but also return the point on the line // same as above but also return the point on the line
@ -2573,4 +2571,4 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
} }

View file

@ -1,10 +1,12 @@
#include "common.h" #include "common.h"
#include "main.h"
#include "TempColModels.h" #include "TempColModels.h"
#include "Game.h"
// LCS: haven't yet checked the numbers but they probably haven't changed
CColModel CTempColModels::ms_colModelPed1;
CColModel CTempColModels::ms_colModelPed2; CColModel CTempColModels::ms_colModelPed2;
CColModel CTempColModels::ms_colModelBBox;
CColModel CTempColModels::ms_colModelBumper1; CColModel CTempColModels::ms_colModelBumper1;
CColModel CTempColModels::ms_colModelWheel1; CColModel CTempColModels::ms_colModelWheel1;
CColModel CTempColModels::ms_colModelPanel1; CColModel CTempColModels::ms_colModelPanel1;
@ -15,7 +17,9 @@ CColModel CTempColModels::ms_colModelPedGroundHit;
CColModel CTempColModels::ms_colModelBoot1; CColModel CTempColModels::ms_colModelBoot1;
CColModel CTempColModels::ms_colModelDoor1; CColModel CTempColModels::ms_colModelDoor1;
CColModel CTempColModels::ms_colModelBonnet1; CColModel CTempColModels::ms_colModelBonnet1;
CColModel CTempColModels::ms_colModelWeapon; CColModel CTempColModels::ms_colModelFerryDocked;
CTempColModels *gpTempColModels;
CColSphere s_aPedSpheres[3]; CColSphere s_aPedSpheres[3];
@ -33,6 +37,7 @@ CColSphere s_aBootSpheres[4];
CColSphere s_aWheelSpheres[2]; CColSphere s_aWheelSpheres[2];
CColSphere s_aBodyPartSpheres1[2]; CColSphere s_aBodyPartSpheres1[2];
CColSphere s_aBodyPartSpheres2[2]; CColSphere s_aBodyPartSpheres2[2];
CColBox S_aFerryDockedBoxes[1];
void void
CTempColModels::Initialise(void) CTempColModels::Initialise(void)
@ -43,11 +48,26 @@ CTempColModels::Initialise(void)
colmodel.level = LEVEL_GENERIC;\ colmodel.level = LEVEL_GENERIC;\
colmodel.ownsCollisionVolumes = false; colmodel.ownsCollisionVolumes = false;
int i; if(gMakeResources){
if(gpTempColModels == nil){
gpTempColModels = new CTempColModels;
gpTempColModels->Initialise();
return;
}
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f)); ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
ms_colModelBBox.level = LEVEL_GENERIC; ms_colModelBBox.level = LEVEL_GENERIC;
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f));
SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
ms_colModelWeapon.boundingSphere.Set(0.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelWeapon.boundingBox.Set(CVector(-0.25f, -0.25f, -0.25f), CVector(0.25f, 0.25f, 0.25f));
}
int i;
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) { for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) {
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
@ -73,10 +93,6 @@ CTempColModels::Initialise(void)
s_aPedSpheres[i].piece = 0; s_aPedSpheres[i].piece = 0;
} }
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f));
SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
// Ped 2 Spheres // Ped 2 Spheres
s_aPed2Spheres[0].radius = 0.3f; s_aPed2Spheres[0].radius = 0.3f;
@ -293,13 +309,47 @@ CTempColModels::Initialise(void)
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2); SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
ms_colModelWeapon.boundingSphere.radius = 0.25f; // Ferry Docked
ms_colModelWeapon.boundingBox.min.x = -0.25f;
ms_colModelWeapon.boundingBox.min.y = -0.25f; S_aFerryDockedBoxes[0].Set(CVector(-6.3f, -22.78f, -2.0f), CVector(6.3f, 22.78f, 2.8f), SURFACE_THICK_METAL_PLATE, SURFACE_DEFAULT);
ms_colModelWeapon.boundingBox.min.z = -0.25f;
ms_colModelWeapon.boundingBox.max.x = 0.25f; ms_colModelFerryDocked.boundingSphere.Set(35.0f, CVector(0.0f, -0.0f, 0.0f));
ms_colModelWeapon.boundingBox.max.y = 0.25f; ms_colModelFerryDocked.boundingBox.Set(S_aFerryDockedBoxes[0].min, S_aFerryDockedBoxes[0].max);
ms_colModelWeapon.boundingBox.max.z = 0.25f; ms_colModelFerryDocked.spheres = nil;
ms_colModelFerryDocked.numSpheres = 0;
ms_colModelFerryDocked.boxes = S_aFerryDockedBoxes;
ms_colModelFerryDocked.numBoxes = ARRAY_SIZE(S_aFerryDockedBoxes);
ms_colModelFerryDocked.level = LEVEL_GENERIC;
#undef SET_COLMODEL_SPHERES #undef SET_COLMODEL_SPHERES
} }
void
CTempColModels::Write(base::cRelocatableChunkWriter &writer)
{
writer.AllocateRaw(this, sizeof(*this), 0x10, false, true);
ms_colModelBBox.Write(writer, false);
writer.AddPatch(&ms_colModelBBox);
ms_colModelPed1.Write(writer, false);
writer.AddPatch(&ms_colModelPed1);
ms_colModelWeapon.Write(writer, false);
writer.AddPatch(&ms_colModelWeapon);
for(int i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++)
ms_colModelCutObj[i].Write(writer, true);
ms_colModelPed2.Write(writer, true);
ms_colModelPedGroundHit.Write(writer, true);
ms_colModelDoor1.Write(writer, true);
ms_colModelBumper1.Write(writer, true);
ms_colModelPanel1.Write(writer, true);
ms_colModelBonnet1.Write(writer, true);
ms_colModelBoot1.Write(writer, true);
ms_colModelWheel1.Write(writer, true);
ms_colModelBodyPart1.Write(writer, true);
ms_colModelBodyPart2.Write(writer, true);
ms_colModelFerryDocked.Write(writer, true);
}

View file

@ -1,13 +1,15 @@
#pragma once #pragma once
#include "Collision.h" #include "ColModel.h"
class CTempColModels class CTempColModels
{ {
public: public:
static CColModel ms_colModelPed1; CColModel ms_colModelPed1;
CColModel ms_colModelBBox;
CColModel ms_colModelWeapon;
static CColModel ms_colModelPed2; static CColModel ms_colModelPed2;
static CColModel ms_colModelBBox;
static CColModel ms_colModelBumper1; static CColModel ms_colModelBumper1;
static CColModel ms_colModelWheel1; static CColModel ms_colModelWheel1;
static CColModel ms_colModelPanel1; static CColModel ms_colModelPanel1;
@ -18,7 +20,10 @@ public:
static CColModel ms_colModelBoot1; static CColModel ms_colModelBoot1;
static CColModel ms_colModelDoor1; static CColModel ms_colModelDoor1;
static CColModel ms_colModelBonnet1; static CColModel ms_colModelBonnet1;
static CColModel ms_colModelWeapon; static CColModel ms_colModelFerryDocked;
static void Initialise(void); void Initialise(void);
void Write(base::cRelocatableChunkWriter &writer);
}; };
extern CTempColModels *gpTempColModels;

View file

@ -6,8 +6,6 @@
#include "Curves.h" #include "Curves.h"
#include "PathFind.h" #include "PathFind.h"
//--MIAMI: file done
void CAutoPilot::ModifySpeed(float speed) void CAutoPilot::ModifySpeed(float speed)
{ {
m_fMaxTrafficSpeed = Max(0.01f, speed); m_fMaxTrafficSpeed = Max(0.01f, speed);

View file

@ -6,8 +6,6 @@
#include "PathFind.h" #include "PathFind.h"
#include "Stats.h" #include "Stats.h"
//--MIAMI: file done
CEntity *CBridge::pLiftRoad; CEntity *CBridge::pLiftRoad;
CEntity *CBridge::pLiftPart; CEntity *CBridge::pLiftPart;
CEntity *CBridge::pWeight; CEntity *CBridge::pWeight;
@ -163,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

@ -23,8 +23,6 @@
#define DISTANCE_TO_SWITCH_DISTANCE_GOTO 20.0f #define DISTANCE_TO_SWITCH_DISTANCE_GOTO 20.0f
//--MIAMI: file done
float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle) float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle)
{ {
return pVehicle->AutoPilot.m_nSwitchDistance; return pVehicle->AutoPilot.m_nSwitchDistance;
@ -45,7 +43,7 @@ float CCarAI::FindSwitchDistanceFar(CVehicle* pVehicle)
void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle) void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle)
{ {
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer && if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) { (FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
CCarCtrl::JoinCarWithRoadSystem(pVehicle); CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE; pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS; pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
@ -131,7 +129,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
TellOccupantsToLeaveCar(pVehicle); TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1) if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
pVehicle->m_bSirenOrAlarm = false; pVehicle->m_bSirenOrAlarm = false;
} }
} }
@ -173,7 +171,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
TellOccupantsToLeaveCar(pVehicle); TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1) if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
pVehicle->m_bSirenOrAlarm = false; pVehicle->m_bSirenOrAlarm = false;
} }
} }
@ -346,7 +344,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nCarMission = MISSION_STOP_FOREVER; pVehicle->AutoPilot.m_nCarMission = MISSION_STOP_FOREVER;
} }
if (distance > 70.0f || FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || if (distance > 70.0f || FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone ||
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) { (FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
TellOccupantsToLeaveCar(pVehicle); TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_STOP_FOREVER; pVehicle->AutoPilot.m_nCarMission = MISSION_STOP_FOREVER;
@ -363,7 +361,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
break; break;
} }
default: default:
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && !CCullZones::NoPolice()){ if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 && !CCullZones::NoPolice()){
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f || if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){ ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle); pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
@ -377,7 +375,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
TellOccupantsToLeaveCar(pVehicle); TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1) if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
pVehicle->m_bSirenOrAlarm = false; pVehicle->m_bSirenOrAlarm = false;
} }
} }
@ -390,7 +388,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
break; break;
} }
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel >= 1 && CCullZones::PoliceAbandonCars()) { if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->GetWantedLevel() >= 1 && CCullZones::PoliceAbandonCars()) {
TellOccupantsToLeaveCar(pVehicle); TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
@ -498,7 +496,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
else else
pVehicle->AutoPilot.m_fCruiseSpeedMultiplier += change; pVehicle->AutoPilot.m_fCruiseSpeedMultiplier += change;
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0) { if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0) {
if (!FindPlayerVehicle() || if (!FindPlayerVehicle() ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR || FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) { FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
@ -563,7 +561,7 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
case MI_RHINO: case MI_RHINO:
case MI_BARRACKS: case MI_BARRACKS:
pVehicle->SetUpDriver(); pVehicle->SetUpDriver();
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 1) if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 1)
pVehicle->SetupPassenger(0); pVehicle->SetupPassenger(0);
return; return;
case MI_PREDATOR: case MI_PREDATOR:
@ -649,7 +647,7 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
uint8 CCarAI::FindPoliceCarMissionForWantedLevel() uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
{ {
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel){ switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()){
case 0: case 0:
case 1: return MISSION_BLOCKPLAYER_FARAWAY; case 1: return MISSION_BLOCKPLAYER_FARAWAY;
case 2: return (CGeneral::GetRandomNumber() & 3) >= 3 ? MISSION_RAMPLAYER_FARAWAY : MISSION_BLOCKPLAYER_FARAWAY; case 2: return (CGeneral::GetRandomNumber() & 3) >= 3 ? MISSION_RAMPLAYER_FARAWAY : MISSION_BLOCKPLAYER_FARAWAY;
@ -663,7 +661,7 @@ uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
uint8 CCarAI::FindPoliceBoatMissionForWantedLevel() uint8 CCarAI::FindPoliceBoatMissionForWantedLevel()
{ {
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) { switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()) {
case 0: case 0:
case 1: return MISSION_BLOCKPLAYER_FARAWAY; case 1: return MISSION_BLOCKPLAYER_FARAWAY;
case 2: case 2:
@ -677,7 +675,7 @@ uint8 CCarAI::FindPoliceBoatMissionForWantedLevel()
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle) int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
{ {
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) { switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()) {
case 0: return CGeneral::GetRandomNumberInRange(12, 16); case 0: return CGeneral::GetRandomNumberInRange(12, 16);
case 1: return 25; case 1: return 25;
case 2: return 34; case 2: return 34;
@ -691,7 +689,7 @@ int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle) void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
{ {
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 1){ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() == 1){
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude(); float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
if (FindPlayerVehicle()){ if (FindPlayerVehicle()){
if (distanceToPlayer < 10.0f) if (distanceToPlayer < 10.0f)
@ -708,7 +706,7 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
else else
pVehicle->AutoPilot.m_nCruiseSpeed = 25; pVehicle->AutoPilot.m_nCruiseSpeed = 25;
} }
}else if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 2){ }else if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() == 2){
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude(); float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
if (FindPlayerVehicle()) { if (FindPlayerVehicle()) {
if (distanceToPlayer < 10.0f) if (distanceToPlayer < 10.0f)
@ -735,7 +733,7 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle) void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle)
{ {
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) { switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()) {
case 0: pVehicle->AutoPilot.m_nCruiseSpeed = 8; break; case 0: pVehicle->AutoPilot.m_nCruiseSpeed = 8; break;
case 1: pVehicle->AutoPilot.m_nCruiseSpeed = 10; break; case 1: pVehicle->AutoPilot.m_nCruiseSpeed = 10; break;
case 2: pVehicle->AutoPilot.m_nCruiseSpeed = 15; break; case 2: pVehicle->AutoPilot.m_nCruiseSpeed = 15; break;

View file

@ -85,8 +85,6 @@
#define MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN (40.0f) #define MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN (40.0f)
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f) #define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
//--MIAMI: file done
bool CCarCtrl::bMadDriversCheat; bool CCarCtrl::bMadDriversCheat;
int CCarCtrl::NumLawEnforcerCars; int CCarCtrl::NumLawEnforcerCars;
int CCarCtrl::NumAmbulancesOnDuty; int CCarCtrl::NumAmbulancesOnDuty;
@ -115,8 +113,6 @@ uint32 aCarsToKeepTime[MAX_CARS_TO_KEEP];
bool gbEmergencyVehiclesEnabled = true; bool gbEmergencyVehiclesEnabled = true;
//--MIAMI: done except heli/plane functions
void void
CCarCtrl::GenerateRandomCars() CCarCtrl::GenerateRandomCars()
{ {
@ -156,12 +152,12 @@ CCarCtrl::GenerateOneRandomCar()
CWanted* pWanted = pPlayer->m_pPed->m_pWanted; CWanted* pWanted = pPlayer->m_pPed->m_pWanted;
int carClass; int carClass;
int carModel; int carModel;
if (pWanted->m_nWantedLevel > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles && if (pWanted->GetWantedLevel() > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
pWanted->m_CurrentCops < pWanted->m_MaxCops && !CGame::IsInInterior() && ( pWanted->m_CurrentCops < pWanted->m_MaxCops && !CGame::IsInInterior() && (
pWanted->m_nWantedLevel > 3 || pWanted->GetWantedLevel() > 3 ||
pWanted->m_nWantedLevel > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 || pWanted->GetWantedLevel() > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
pWanted->m_nWantedLevel > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) { pWanted->GetWantedLevel() > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
/* Last pWanted->m_nWantedLevel > 1 is unnecessary but I added it for better readability. */ /* Last pWanted->GetWantedLevel() > 1 is unnecessary but I added it for better readability. */
/* Wouldn't be surprised it was there originally but was optimized out. */ /* Wouldn't be surprised it was there originally but was optimized out. */
carClass = COPS; carClass = COPS;
carModel = ChoosePoliceCarModel(); carModel = ChoosePoliceCarModel();
@ -170,7 +166,7 @@ CCarCtrl::GenerateOneRandomCar()
carModel = ChooseModel(&zone, &carClass); carModel = ChooseModel(&zone, &carClass);
if (carModel == -1) if (carModel == -1)
return; return;
if (!(carClass == COPS && pWanted->m_nWantedLevel >= 1)) if (!(carClass == COPS && pWanted->GetWantedLevel() >= 1))
/* All cop spawns with wanted level are handled by condition above. */ /* All cop spawns with wanted level are handled by condition above. */
/* In particular it means that cop cars never spawn if player has wanted level of 1. */ /* In particular it means that cop cars never spawn if player has wanted level of 1. */
break; break;
@ -318,7 +314,7 @@ CCarCtrl::GenerateOneRandomCar()
} }
if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY, if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId, preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1)) &positionBetweenNodes, carClass == COPS && pWanted->GetWantedLevel() >= 1))
return; return;
CPathNode* pCurNode = &ThePaths.m_pathNodes[curNodeId]; CPathNode* pCurNode = &ThePaths.m_pathNodes[curNodeId];
CPathNode* pNextNode = &ThePaths.m_pathNodes[nextNodeId]; CPathNode* pNextNode = &ThePaths.m_pathNodes[nextNodeId];
@ -384,7 +380,7 @@ CCarCtrl::GenerateOneRandomCar()
switch (carClass) { switch (carClass) {
case COPS: case COPS:
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE; pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel != 0){ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() != 0){
pVehicle->AutoPilot.m_nCruiseSpeed = CCarAI::FindPoliceCarSpeedForWantedLevel(pVehicle); pVehicle->AutoPilot.m_nCruiseSpeed = CCarAI::FindPoliceCarSpeedForWantedLevel(pVehicle);
pVehicle->AutoPilot.m_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed / 2; pVehicle->AutoPilot.m_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed / 2;
pVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel(); pVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel();
@ -3199,7 +3195,7 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
void CCarCtrl::GenerateEmergencyServicesCar(void) void CCarCtrl::GenerateEmergencyServicesCar(void)
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 3) if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 3)
return; return;
if (CGame::IsInInterior()) if (CGame::IsInInterior())
return; return;

View file

@ -2,8 +2,6 @@
#include "Curves.h" #include "Curves.h"
//--MIAMI: file done
float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y) float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y)
{ {
CVector2D dir1(dir1X, dir1Y); CVector2D dir1(dir1X, dir1Y);

View file

@ -16,8 +16,6 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "GameLogic.h" #include "GameLogic.h"
//--MIAMI: file done
#define FRENZY_ANY_PED -1 #define FRENZY_ANY_PED -1
#define FRENZY_ANY_CAR -2 #define FRENZY_ANY_CAR -2

View file

@ -47,8 +47,6 @@ float CGameLogic::ShortCutDropOffOrientationForMission;
bool CGameLogic::MissionDropOffReadyToBeUsed; bool CGameLogic::MissionDropOffReadyToBeUsed;
char CGameLogic::mStoredPlayerOutfit[8] = "plr3"; char CGameLogic::mStoredPlayerOutfit[8] = "plr3";
//--MIAMI: file done
#define SHORTCUT_TAXI_COST (9) #define SHORTCUT_TAXI_COST (9)
#define TOTAL_BUSTED_AUDIO (28) #define TOTAL_BUSTED_AUDIO (28)
@ -223,7 +221,7 @@ CGameLogic::Update()
pPlayerInfo.m_WBState = WBSTATE_PLAYING; pPlayerInfo.m_WBState = WBSTATE_PLAYING;
int takeMoney; int takeMoney;
switch (pPlayerInfo.m_pPed->m_pWanted->m_nWantedLevel) { switch (pPlayerInfo.m_pPed->m_pWanted->GetWantedLevel()) {
case 0: case 0:
case 1: case 1:
takeMoney = 100; takeMoney = 100;

View file

@ -25,8 +25,6 @@
#include "World.h" #include "World.h"
#include "VarConsole.h" #include "VarConsole.h"
//--MIAMI: file done
#define CRUSHER_GARAGE_X1 (1135.5f) #define CRUSHER_GARAGE_X1 (1135.5f)
#define CRUSHER_GARAGE_Y1 (57.0f) #define CRUSHER_GARAGE_Y1 (57.0f)
#define CRUSHER_GARAGE_Z1 (-1.0f) #define CRUSHER_GARAGE_Z1 (-1.0f)
@ -108,7 +106,7 @@ const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLL
{ MI_VOODOO, MI_CUBAN, MI_CADDY, MI_BAGGAGE, MI_MRWHOOP, MI_PIZZABOY } { MI_VOODOO, MI_CUBAN, MI_CADDY, MI_BAGGAGE, MI_MRWHOOP, MI_PIZZABOY }
}; };
const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }; // what is this? const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO };
int32 CGarages::BankVansCollected; int32 CGarages::BankVansCollected;
bool CGarages::BombsAreFree; bool CGarages::BombsAreFree;
@ -452,7 +450,7 @@ void CGarage::Update()
m_eGarageState = GS_OPENING; m_eGarageState = GS_OPENING;
DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1); DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1);
bool bTakeMoney = false; bool bTakeMoney = false;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel != 0) { if (FindPlayerPed()->m_pWanted->GetWantedLevel() != 0) {
bTakeMoney = true; bTakeMoney = true;
FindPlayerPed()->m_pWanted->Suspend(); FindPlayerPed()->m_pWanted->Suspend();
} }
@ -504,7 +502,7 @@ void CGarage::Update()
pos.x = CGeneral::GetRandomNumberInRange(m_fInfX + 0.5f, m_fSupX - 0.5f); pos.x = CGeneral::GetRandomNumberInRange(m_fInfX + 0.5f, m_fSupX - 0.5f);
pos.y = CGeneral::GetRandomNumberInRange(m_fInfY + 0.5f, m_fSupY - 0.5f); pos.y = CGeneral::GetRandomNumberInRange(m_fInfY + 0.5f, m_fSupY - 0.5f);
pos.z = CGeneral::GetRandomNumberInRange(m_fDoor1Z - 3.0f, m_fDoor1Z + 1.0f); pos.z = CGeneral::GetRandomNumberInRange(m_fDoor1Z - 3.0f, m_fDoor1Z + 1.0f);
CParticle::AddParticle(PARTICLE_GARAGEPAINT_SPRAY, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, CVehicleModelInfo::ms_vehicleColourTable[colour1]); CParticle::AddParticle(PARTICLE_GARAGEPAINT_SPRAY, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, CVehicleModelInfo::mspInfo->ms_vehicleColourTable[colour1]);
} }
} }
} }
@ -1827,7 +1825,7 @@ void CGarage::FindDoorsEntities()
} }
} }
if (m_pDoor1 && m_pDoor2) { if (m_pDoor1 && m_pDoor2) {
if (m_pDoor1->GetModelIndex() != MI_LCS_GARAGEDOOR39 && m_pDoor1->GetModelIndex() != MI_LCS_GARAGEDOOR40) { if (m_pDoor1->GetModelIndex() != MI_CRUSHERBODY && m_pDoor1->GetModelIndex() != MI_CRUSHERLID) {
CVector2D vecDoor1ToGarage(m_pDoor1->GetPosition().x - GetGarageCenterX(), m_pDoor1->GetPosition().y - GetGarageCenterY()); CVector2D vecDoor1ToGarage(m_pDoor1->GetPosition().x - GetGarageCenterX(), m_pDoor1->GetPosition().y - GetGarageCenterY());
CVector2D vecDoor2ToGarage(m_pDoor2->GetPosition().x - GetGarageCenterX(), m_pDoor2->GetPosition().y - GetGarageCenterY()); CVector2D vecDoor2ToGarage(m_pDoor2->GetPosition().x - GetGarageCenterX(), m_pDoor2->GetPosition().y - GetGarageCenterY());
if (DotProduct2D(vecDoor1ToGarage, vecDoor2ToGarage) > 0.0f) { if (DotProduct2D(vecDoor1ToGarage, vecDoor2ToGarage) > 0.0f) {
@ -2411,44 +2409,83 @@ void CGarages::Load(uint8* buf, uint32 size)
bool bool
CGarages::IsModelIndexADoor(uint32 id) CGarages::IsModelIndexADoor(uint32 id)
{ {
return id == MI_LCS_GARAGEDOOR01 || return id == MI_GARAGEDOOR1 ||
id == MI_LCS_GARAGEDOOR02 || id == MI_GARAGEDOOR17 ||
id == MI_LCS_GARAGEDOOR03 || id == MI_GARAGEDOOR27 ||
id == MI_LCS_GARAGEDOOR04 || id == MI_GARAGEDOOR28 ||
id == MI_LCS_GARAGEDOOR05 || id == MI_GARAGEDOOR29 ||
id == MI_LCS_GARAGEDOOR06 || id == MI_GARAGEDOOR30 ||
id == MI_LCS_GARAGEDOOR07 || id == MI_GARAGEDOOR31 ||
id == MI_LCS_GARAGEDOOR08 || id == MI_GARAGEDOOR32 ||
id == MI_LCS_GARAGEDOOR09 || id == MI_GARAGEDOOR33 ||
id == MI_LCS_GARAGEDOOR10 || id == MI_GARAGEDOOR34 ||
id == MI_LCS_GARAGEDOOR11 || id == MI_GARAGEDOOR35 ||
id == MI_LCS_GARAGEDOOR12 || id == MI_GARAGEDOOR36 ||
id == MI_LCS_GARAGEDOOR13 || id == MI_GARAGEDOOR37 ||
id == MI_LCS_GARAGEDOOR14 || id == MI_GARAGEDOOR38 ||
id == MI_LCS_GARAGEDOOR15 || id == MI_GARAGEDOOR39 ||
id == MI_LCS_GARAGEDOOR16 || id == MI_CRUSHERBODY ||
id == MI_LCS_GARAGEDOOR17 || id == MI_CRUSHERLID ||
id == MI_LCS_GARAGEDOOR18 || id == MI_GARAGEDOOR2 ||
id == MI_LCS_GARAGEDOOR19 || id == MI_GARAGEDOOR3 ||
id == MI_LCS_GARAGEDOOR20 || id == MI_GARAGEDOOR4 ||
id == MI_LCS_GARAGEDOOR21 || id == MI_GARAGEDOOR5 ||
id == MI_LCS_GARAGEDOOR22 || id == MI_GARAGEDOOR6 ||
id == MI_LCS_GARAGEDOOR23 || id == MI_GARAGEDOOR7 ||
id == MI_LCS_GARAGEDOOR24 || id == MI_GARAGEDOOR9 ||
id == MI_LCS_GARAGEDOOR25 || id == MI_GARAGEDOOR10 ||
id == MI_LCS_GARAGEDOOR26 || id == MI_GARAGEDOOR11 ||
id == MI_LCS_GARAGEDOOR27 || id == MI_GARAGEDOOR12 ||
id == MI_LCS_GARAGEDOOR28 || id == MI_GARAGEDOOR13 ||
id == MI_LCS_GARAGEDOOR29 || id == MI_GARAGEDOOR14 ||
id == MI_LCS_GARAGEDOOR30 || id == MI_GARAGEDOOR15 ||
id == MI_LCS_GARAGEDOOR31 || id == MI_GARAGEDOOR16 ||
id == MI_LCS_GARAGEDOOR32 || id == MI_GARAGEDOOR18 ||
id == MI_LCS_GARAGEDOOR33 || id == MI_GARAGEDOOR19 ||
id == MI_LCS_GARAGEDOOR34 || id == MI_GARAGEDOOR20 ||
id == MI_LCS_GARAGEDOOR35 || id == MI_GARAGEDOOR21 ||
id == MI_LCS_GARAGEDOOR36 || id == MI_GARAGEDOOR22 ||
id == MI_LCS_GARAGEDOOR37 || id == MI_GARAGEDOOR23 ||
id == MI_LCS_GARAGEDOOR38 || id == MI_GARAGEDOOR24 ||
id == MI_LCS_GARAGEDOOR39 || id == MI_GARAGEDOOR25 ||
id == MI_LCS_GARAGEDOOR40; id == MI_GARAGEDOOR26 ||
id == MI_DOOR2_SJL;
}
void CGarages::StopCarFromBlowingUp(CAutomobile* pCar)
{
pCar->m_fFireBlowUpTimer = 0.0f;
pCar->m_fHealth = Max(pCar->m_fHealth, 300.0f);
pCar->Damage.SetEngineStatus(Max(pCar->Damage.GetEngineStatus(), 275));
}
bool CGarage::Does60SecondsNeedThisCarAtAll(int mi)
{
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
if (gaCarsToCollectIn60Seconds[i] == mi)
return true;
}
return false;
}
bool CGarage::Does60SecondsNeedThisCar(int mi)
{
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
if (gaCarsToCollectIn60Seconds[i] == mi)
return m_bCollectedCarsState & BIT(i);
}
return false;
}
void CGarage::MarkThisCarAsCollectedFor60Seconds(int mi)
{
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
if (gaCarsToCollectIn60Seconds[i] == mi)
m_bCollectedCarsState |= BIT(i);
}
}
bool CGarage::IsPlayerEntirelyInsideGarage()
{
return IsEntityEntirelyInside3D(FindPlayerVehicle() ? (CEntity*)FindPlayerVehicle() : (CEntity*)FindPlayerPed(), 0.0f);
} }

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

@ -9,14 +9,12 @@
#include "OnscreenTimer.h" #include "OnscreenTimer.h"
#include "Camera.h" #include "Camera.h"
// --MIAMI: file done
void COnscreenTimer::Init() { void COnscreenTimer::Init() {
m_bDisabled = false; m_bDisabled = false;
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) { for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
m_sCounters[i].m_nCounterOffset = 0; m_sCounters[i].m_nCounterOffset = 0;
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText); j++) { for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) {
m_sCounters[i].m_aCounterText[j] = 0; m_sCounters[i].m_aCounterText[j] = 0;
} }
@ -26,7 +24,7 @@ void COnscreenTimer::Init() {
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
m_sClocks[i].m_nClockOffset = 0; m_sClocks[i].m_nClockOffset = 0;
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenTimerEntry::m_aClockText); j++) { for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) {
m_sClocks[i].m_aClockText[j] = 0; m_sClocks[i].m_aClockText[j] = 0;
} }
@ -94,7 +92,7 @@ void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 p
m_sCounters[pos].m_nCounterOffset = offset; m_sCounters[pos].m_nCounterOffset = offset;
if(text) { if(text) {
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText)); strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText));
} else { } else {
m_sCounters[pos].m_aCounterText[0] = 0; m_sCounters[pos].m_aCounterText[0] = 0;
} }
@ -116,7 +114,7 @@ void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
m_sClocks[i].m_nClockOffset = offset; m_sClocks[i].m_nClockOffset = offset;
m_sClocks[i].m_bClockGoingDown = bGoingDown; m_sClocks[i].m_bClockGoingDown = bGoingDown;
if(text) { if(text) {
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(COnscreenTimerEntry::m_aClockText)); strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
} else { } else {
m_sClocks[i].m_aClockText[0] = 0; m_sClocks[i].m_aClockText[0] = 0;
} }

View file

@ -8,8 +8,6 @@
#include "Lines.h" // for debug #include "Lines.h" // for debug
#include "PathFind.h" #include "PathFind.h"
//--MIAMI: file done except mobile unused function
bool gbShowPedPaths; bool gbShowPedPaths;
bool gbShowCarPaths; bool gbShowCarPaths;
bool gbShowCarPathsLinks; bool gbShowCarPathsLinks;
@ -340,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();
@ -1765,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

@ -17,8 +17,6 @@
#include "Replay.h" #include "Replay.h"
#endif #endif
// --MIAMI: file done
CPhoneInfo gPhoneInfo; CPhoneInfo gPhoneInfo;
bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up

View file

@ -34,8 +34,6 @@
#include "Messages.h" #include "Messages.h"
#include "Streaming.h" #include "Streaming.h"
// --MIAMI: file done
CPickup CPickups::aPickUps[NUMPICKUPS]; CPickup CPickups::aPickUps[NUMPICKUPS];
int16 CPickups::NumMessages; int16 CPickups::NumMessages;
int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS]; int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];
@ -278,7 +276,7 @@ CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
bool cannotBePickedUp = bool cannotBePickedUp =
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f) (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f) || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->m_nWantedLevel == 0) || (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->GetWantedLevel() == 0)
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame)); || (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
return !cannotBePickedUp; return !cannotBePickedUp;
} }
@ -784,7 +782,7 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0); DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
return true; return true;
} else if (modelIndex == MI_PICKUP_BRIBE) { } else if (modelIndex == MI_PICKUP_BRIBE) {
int32 level = Max(FindPlayerPed()->m_pWanted->m_nWantedLevel - 1, 0); int32 level = Max(FindPlayerPed()->m_pWanted->GetWantedLevel() - 1, 0);
player->SetWantedLevel(level); player->SetWantedLevel(level);
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0); DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
return true; return true;
@ -1578,7 +1576,6 @@ CPacManPickups::ResetPowerPillsCarriedByPlayer()
{ {
} }
// --MIAMI: Done
void void
CPed::CreateDeadPedMoney(void) CPed::CreateDeadPedMoney(void)
{ {
@ -1599,7 +1596,6 @@ CPed::CreateDeadPedMoney(void)
m_nPedMoney = 0; m_nPedMoney = 0;
} }
// --MIAMI: Done
void void
CPed::CreateDeadPedWeaponPickups(void) CPed::CreateDeadPedWeaponPickups(void)
{ {
@ -1625,7 +1621,6 @@ CPed::CreateDeadPedWeaponPickups(void)
ClearWeapons(); ClearWeapons();
} }
// --MIAMI: Done
void void
CPed::CreateDeadPedPickupCoors(float *x, float *y, float *z) CPed::CreateDeadPedPickupCoors(float *x, float *y, float *z)
{ {

View file

@ -147,7 +147,7 @@ public:
class CPacManPickups class CPacManPickups
{ {
friend CPacManPickup; friend class CPacManPickup;
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS]; static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
static CVector LastPickUpCoors; static CVector LastPickUpCoors;

View file

@ -10,8 +10,6 @@
#include "VehicleModelInfo.h" #include "VehicleModelInfo.h"
#include "World.h" #include "World.h"
//--MIAMI: file done
uint16 CRecordDataForGame::RecordingState; uint16 CRecordDataForGame::RecordingState;
void CRecordDataForGame::Init(void) void CRecordDataForGame::Init(void)

View file

@ -9,9 +9,7 @@
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "Vehicle.h" #include "Vehicle.h"
//--MIAMI: file done CVehicle*
void
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);
@ -42,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

@ -53,8 +53,6 @@
#include "Fluff.h" #include "Fluff.h"
#include "WaterCreatures.h" #include "WaterCreatures.h"
//--MIAMI: file done
uint8 CReplay::Mode; uint8 CReplay::Mode;
CAddressInReplayBuffer CReplay::Record; CAddressInReplayBuffer CReplay::Record;
CAddressInReplayBuffer CReplay::Playback; CAddressInReplayBuffer CReplay::Playback;

View file

@ -4,8 +4,6 @@
#include "Zones.h" #include "Zones.h"
#include "PathFind.h" #include "PathFind.h"
//--MIAMI: file done
uint8 CRestart::OverrideHospitalLevel; uint8 CRestart::OverrideHospitalLevel;
uint8 CRestart::OverridePoliceStationLevel; uint8 CRestart::OverridePoliceStationLevel;
bool CRestart::bFadeInAfterNextArrest; bool CRestart::bFadeInAfterNextArrest;

View file

@ -16,8 +16,6 @@
#include "General.h" #include "General.h"
#include "Object.h" #include "Object.h"
//--MIAMI: file done
#define ROADBLOCKDIST (90.0f) #define ROADBLOCKDIST (90.0f)
#define ROADBLOCK_OBJECT_WIDTH (4.0f) #define ROADBLOCK_OBJECT_WIDTH (4.0f)
@ -57,8 +55,8 @@ CRoadBlocks::Init(void)
void void
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType) CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType)
{ {
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f}, static const CVector vecRoadBlockOffets[6] = { CVector(-1.5, 1.8f, 0.0f), CVector(-1.5f, -1.8f, 0.0f), CVector(1.5f, 1.8f, 0.0f),
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} }; CVector(1.5f, -1.8f, 0.0f), CVector(-1.5f, 0.0f, 0.0f), CVector(1.5, 0.0, 0.0) };
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle(); CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
if (!pEntityToAttack) if (!pEntityToAttack)
pEntityToAttack = (CEntity*)FindPlayerPed(); pEntityToAttack = (CEntity*)FindPlayerPed();

View file

@ -20,8 +20,6 @@
#include "WeaponInfo.h" #include "WeaponInfo.h"
#include "World.h" #include "World.h"
//--MIAMI: file done
bool CSceneEdit::m_bEditOn; bool CSceneEdit::m_bEditOn;
int32 CSceneEdit::m_bCameraFollowActor; int32 CSceneEdit::m_bCameraFollowActor;
bool CSceneEdit::m_bRecording; bool CSceneEdit::m_bRecording;

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,13 +50,12 @@
#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
//--LCS: file done except TODOs and command table //--LCS: file done except TODOs and command table
uint8* CTheScripts::ScriptSpace; uint8* CTheScripts::ScriptSpace;
CRunningScript CTheScripts::ScriptsArray[MAX_NUM_SCRIPTS]; CRunningScript CTheScripts::ScriptsArray[MAX_NUM_SCRIPTS];
intro_text_line CTheScripts::IntroTextLines[MAX_NUM_INTRO_TEXT_LINES]; intro_text_line CTheScripts::IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
@ -99,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;
@ -108,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
@ -423,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, ""),
@ -2137,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))
@ -2514,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)
@ -2621,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();
@ -2633,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);
@ -2773,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) {
@ -2834,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);
@ -2897,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)
@ -4919,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:
@ -4932,7 +4949,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return 0; return 0;
case COMMAND_IS_WANTED_LEVEL_GREATER: case COMMAND_IS_WANTED_LEVEL_GREATER:
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pWanted->m_nWantedLevel > GET_INTEGER_PARAM(1)); UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pWanted->GetWantedLevel() > GET_INTEGER_PARAM(1));
return 0; return 0;
case COMMAND_CLEAR_WANTED_LEVEL: case COMMAND_CLEAR_WANTED_LEVEL:
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);

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,207 +275,20 @@ struct tBuildingSwap
int32 m_nOldModel; int32 m_nOldModel;
}; };
struct script_corona
enum {
VAR_LOCAL = 1,
VAR_GLOBAL = 2,
};
enum {
MAX_NUM_SCRIPTS = 128,
MAX_NUM_INTRO_TEXT_LINES = 48,
MAX_NUM_INTRO_RECTANGLES = 16,
MAX_NUM_SCRIPT_SRPITES = 16,
MAX_NUM_SCRIPT_SPHERES = 16,
MAX_NUM_COLLECTIVES = 32,
MAX_NUM_USED_OBJECTS = 305,
MAX_NUM_MISSION_SCRIPTS = 150,
MAX_NUM_BUILDING_SWAPS = 80,
MAX_NUM_INVISIBILITY_SETTINGS = 52,
MAX_NUM_STORED_LINES = 1024,
MAX_ALLOWED_COLLISIONS = 2
};
class CTheScripts
{ {
public: int id;
static uint8* ScriptSpace; float x;
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS]; float y;
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES]; float z;
static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES]; float size;
static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES]; uint8 r;
static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES]; uint8 g;
static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES]; uint8 b;
static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS]; int type;
static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS]; int flareType;
static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
static CEntity* InvisibilitySettingArray[MAX_NUM_INVISIBILITY_SETTINGS];
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
static bool DbgFlag;
static uint32 OnAMissionFlag;
static CMissionCleanup MissionCleanUp;
static CStuckCarCheck StuckCars;
static CUpsideDownCarCheck UpsideDownCars;
static int32 StoreVehicleIndex;
static bool StoreVehicleWasRandom;
static CRunningScript *pIdleScripts;
static CRunningScript *pActiveScripts;
static int32 NextFreeCollectiveIndex;
static int32 LastRandomPedId;
static uint16 NumberOfUsedObjects;
static bool bAlreadyRunningAMissionScript;
static bool bUsingAMultiScriptFile;
static uint16 NumberOfMissionScripts;
static uint32 LargestMissionScriptSize;
static uint32 MainScriptSize;
static uint8 FailCurrentMission;
static uint16 NumScriptDebugLines;
static uint16 NumberOfIntroRectanglesThisFrame;
static uint16 NumberOfIntroTextLinesThisFrame;
static uint8 UseTextCommands;
static uint16 CommandsExecuted;
static uint16 ScriptsUpdated;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
static bool bPlayerIsInTheStatium;
static uint8 RiotIntensity;
static bool bPlayerHasMetDebbieHarry;
static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
static short* SavedVarIndices;
static int NumSaveVars;
static bool FSDestroyedFlag;
static int NextProcessId;
static bool InTheScripts;
static CRunningScript* pCurrent;
static uint16 NumTrueGlobals;
static uint16 MostGlobals;
static bool Init(bool loaddata = false);
static void Process();
static CRunningScript* StartTestScript();
static bool IsPlayerOnAMission();
static void ClearSpaceForMissionEntity(const CVector&, CEntity*);
static void UndoBuildingSwaps();
static void UndoEntityInvisibilitySettings();
/*
static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, uint32 col, uint32 col2);
static void RenderTheScriptDebugLines();
*/
static void SaveAllScripts(uint8*, uint32*);
static bool LoadAllScripts(uint8*, uint32);
static bool IsDebugOn() { return DbgFlag; };
static void InvertDebugFlag() { DbgFlag = !DbgFlag; }
static int32* GetPointerToScriptVariable(int32 offset) { assert(offset >= 8 && offset < CTheScripts::GetSizeOfVariableSpace()); return (int32*)&ScriptSpace[offset]; }
static int32 Read4BytesFromScript(uint32* pIp) {
int32 retval = ScriptSpace[*pIp + 3] << 24 | ScriptSpace[*pIp + 2] << 16 | ScriptSpace[*pIp + 1] << 8 | ScriptSpace[*pIp];
*pIp += 4;
return retval;
}
static int16 Read2BytesFromScript(uint32* pIp) {
int16 retval = ScriptSpace[*pIp + 1] << 8 | ScriptSpace[*pIp];
*pIp += 2;
return retval;
}
static int8 Read1ByteFromScript(uint32* pIp) {
int8 retval = ScriptSpace[*pIp];
*pIp += 1;
return retval;
}
static float ReadFloatFromScript(uint32* pIp) {
return Read2BytesFromScript(pIp) / 16.0f;
}
static void ReadTextLabelFromScript(uint32* pIp, char* buf) {
strncpy(buf, (const char*)&CTheScripts::ScriptSpace[*pIp], KEY_LENGTH_IN_SCRIPT);
}
static wchar* GetTextByKeyFromScript(uint32* pIp) {
wchar* text = TheText.Get((const char*)&CTheScripts::ScriptSpace[*pIp]);
*pIp += KEY_LENGTH_IN_SCRIPT;
return text;
}
static int32 GetSizeOfVariableSpace()
{
uint32 tmp = 3;
return Read4BytesFromScript(&tmp);
}
static CRunningScript* StartNewScript(uint32);
static void CleanUpThisVehicle(CVehicle*);
static void CleanUpThisPed(CPed*);
static void CleanUpThisObject(CObject*);
static bool IsPedStopped(CPed*);
static bool IsPlayerStopped(CPlayerInfo*);
static bool IsVehicleStopped(CVehicle*);
static void PrintListSizes();
static void ReadObjectNamesFromScript();
static void UpdateObjectIndices();
static void ReadMultiScriptFileOffsetsFromScript();
static void DrawScriptSpheres();
static void HighlightImportantArea(uint32, float, float, float, float, float);
static void HighlightImportantAngledArea(uint32, float, float, float, float, float, float, float, float, float);
/*
static void DrawDebugSquare(float, float, float, float);
static void DrawDebugAngledSquare(float, float, float, float, float, float, float, float);
static void DrawDebugCube(float, float, float, float, float, float);
static void DrawDebugAngledCube(float, float, float, float, float, float, float, float, float, float);
*/
static void AddToInvisibilitySwapArray(CEntity*, bool);
static void AddToBuildingSwapArray(CBuilding*, int32, int32);
static int32 GetActualScriptSphereIndex(int32 index);
static int32 AddScriptSphere(int32 id, CVector pos, float radius);
static int32 GetNewUniqueScriptSphereIndex(int32 index);
static void RemoveScriptSphere(int32 index);
//static void RemoveScriptTextureDictionary();
public:
static void RemoveThisPed(CPed* pPed);
static uint32& GetLastMissionPassedTime() { return LastMissionPassedTime; }
#ifdef MISSION_SWITCHER
static void SwitchToMission(int32 mission);
#endif
static int GetSaveVarIndex(int);
static void Shutdown(void);
static void SwapNearestBuildingModel(float, float, float, float, int, int);
#ifdef GTA_SCRIPT_COLLECTIVE
static void AdvanceCollectiveIndex()
{
if (NextFreeCollectiveIndex == INT32_MAX)
NextFreeCollectiveIndex = 0;
else
NextFreeCollectiveIndex++;
}
static int AddPedsInVehicleToCollective(int);
static int AddPedsInAreaToCollective(float, float, float, float);
static int FindFreeSlotInCollectiveArray();
static void SetObjectiveForAllPedsInCollective(int, eObjective, int16, int16);
static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector, float);
static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector);
static void SetObjectiveForAllPedsInCollective(int, eObjective, void*);
static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif
}; };
extern int ScriptParams[32];
VALIDATE_SIZE(uStackReturnValue, 4);
class CRunningScript class CRunningScript
{ {
enum { enum {
@ -641,6 +456,211 @@ public:
}; };
enum {
VAR_LOCAL = 1,
VAR_GLOBAL = 2,
};
enum {
MAX_NUM_SCRIPTS = 128,
MAX_NUM_INTRO_TEXT_LINES = 48,
MAX_NUM_INTRO_RECTANGLES = 16,
MAX_NUM_SCRIPT_SRPITES = 16,
MAX_NUM_SCRIPT_SPHERES = 16,
MAX_NUM_COLLECTIVES = 32,
MAX_NUM_USED_OBJECTS = 305,
MAX_NUM_MISSION_SCRIPTS = 150,
MAX_NUM_BUILDING_SWAPS = 80,
MAX_NUM_INVISIBILITY_SETTINGS = 52,
MAX_NUM_STORED_LINES = 1024,
MAX_ALLOWED_COLLISIONS = 2
};
class CTheScripts
{
public:
static uint8* ScriptSpace;
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES];
static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS];
static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
static CEntity* InvisibilitySettingArray[MAX_NUM_INVISIBILITY_SETTINGS];
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
static bool DbgFlag;
static uint32 OnAMissionFlag;
static CMissionCleanup MissionCleanUp;
static CStuckCarCheck StuckCars;
static CUpsideDownCarCheck UpsideDownCars;
static int32 StoreVehicleIndex;
static bool StoreVehicleWasRandom;
static CRunningScript *pIdleScripts;
static CRunningScript *pActiveScripts;
static int32 NextFreeCollectiveIndex;
static int32 LastRandomPedId;
static uint16 NumberOfUsedObjects;
static bool bAlreadyRunningAMissionScript;
static bool bUsingAMultiScriptFile;
static uint16 NumberOfMissionScripts;
static uint32 LargestMissionScriptSize;
static uint32 MainScriptSize;
static uint8 FailCurrentMission;
static uint16 NumScriptDebugLines;
static uint16 NumberOfIntroRectanglesThisFrame;
static uint16 NumberOfIntroTextLinesThisFrame;
static uint8 UseTextCommands;
static uint16 CommandsExecuted;
static uint16 ScriptsUpdated;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
static bool bPlayerIsInTheStatium;
static uint8 RiotIntensity;
static bool bPlayerHasMetDebbieHarry;
static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
static short* SavedVarIndices;
static int NumSaveVars;
static int FSDestroyedFlag;
static int NextProcessId;
static bool InTheScripts;
static CRunningScript* pCurrent;
static uint16 NumTrueGlobals;
static uint16 MostGlobals;
static base::cSList<script_corona> mCoronas;
static int NextScriptCoronaID;
static bool Init(bool loaddata = false);
static void Process();
static CRunningScript* StartTestScript();
static bool IsPlayerOnAMission();
static void ClearSpaceForMissionEntity(const CVector&, CEntity*);
static void UndoBuildingSwaps();
static void UndoEntityInvisibilitySettings();
/*
static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, uint32 col, uint32 col2);
static void RenderTheScriptDebugLines();
*/
static void SaveAllScripts(uint8*, uint32*);
static bool LoadAllScripts(uint8*, uint32);
static bool IsDebugOn() { return DbgFlag; };
static void InvertDebugFlag() { DbgFlag = !DbgFlag; }
static int32* GetPointerToScriptVariable(int32 offset) { assert(offset >= 8 && offset < CTheScripts::GetSizeOfVariableSpace()); return (int32*)&ScriptSpace[offset]; }
static int32 Read4BytesFromScript(uint32* pIp) {
int32 retval = ScriptSpace[*pIp + 3] << 24 | ScriptSpace[*pIp + 2] << 16 | ScriptSpace[*pIp + 1] << 8 | ScriptSpace[*pIp];
*pIp += 4;
return retval;
}
static int16 Read2BytesFromScript(uint32* pIp) {
int16 retval = ScriptSpace[*pIp + 1] << 8 | ScriptSpace[*pIp];
*pIp += 2;
return retval;
}
static int8 Read1ByteFromScript(uint32* pIp) {
int8 retval = ScriptSpace[*pIp];
*pIp += 1;
return retval;
}
static float ReadFloatFromScript(uint32* pIp) {
return Read2BytesFromScript(pIp) / 16.0f;
}
static void ReadTextLabelFromScript(uint32* pIp, char* buf) {
strncpy(buf, (const char*)&CTheScripts::ScriptSpace[*pIp], KEY_LENGTH_IN_SCRIPT);
}
static wchar* GetTextByKeyFromScript(uint32* pIp) {
wchar* text = TheText.Get((const char*)&CTheScripts::ScriptSpace[*pIp]);
*pIp += KEY_LENGTH_IN_SCRIPT;
return text;
}
static int32 GetSizeOfVariableSpace()
{
uint32 tmp = 3;
return Read4BytesFromScript(&tmp);
}
static CRunningScript* StartNewScript(uint32);
static void CleanUpThisVehicle(CVehicle*);
static void CleanUpThisPed(CPed*);
static void CleanUpThisObject(CObject*);
static bool IsPedStopped(CPed*);
static bool IsPlayerStopped(CPlayerInfo*);
static bool IsVehicleStopped(CVehicle*);
static void PrintListSizes();
static void ReadObjectNamesFromScript();
static void UpdateObjectIndices();
static void ReadMultiScriptFileOffsetsFromScript();
static void DrawScriptSpheres();
static void HighlightImportantArea(uint32, float, float, float, float, float);
static void HighlightImportantAngledArea(uint32, float, float, float, float, float, float, float, float, float);
/*
static void DrawDebugSquare(float, float, float, float);
static void DrawDebugAngledSquare(float, float, float, float, float, float, float, float);
static void DrawDebugCube(float, float, float, float, float, float);
static void DrawDebugAngledCube(float, float, float, float, float, float, float, float, float, float);
*/
static void AddToInvisibilitySwapArray(CEntity*, bool);
static void AddToBuildingSwapArray(CBuilding*, int32, int32);
static int32 GetActualScriptSphereIndex(int32 index);
static int32 AddScriptSphere(int32 id, CVector pos, float radius);
static int32 GetNewUniqueScriptSphereIndex(int32 index);
static void RemoveScriptSphere(int32 index);
//static void RemoveScriptTextureDictionary();
public:
static void RemoveThisPed(CPed* pPed);
static uint32& GetLastMissionPassedTime() { return LastMissionPassedTime; }
#ifdef MISSION_SWITCHER
static void SwitchToMission(int32 mission);
#endif
static int GetSaveVarIndex(int);
static void Shutdown(void);
static void SwapNearestBuildingModel(float, float, float, float, int, int);
#ifdef GTA_SCRIPT_COLLECTIVE
static void AdvanceCollectiveIndex()
{
if (NextFreeCollectiveIndex == INT32_MAX)
NextFreeCollectiveIndex = 0;
else
NextFreeCollectiveIndex++;
}
static int AddPedsInVehicleToCollective(int);
static int AddPedsInAreaToCollective(float, float, float, float);
static int FindFreeSlotInCollectiveArray();
static void SetObjectiveForAllPedsInCollective(int, eObjective, int16, int16);
static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector, float);
static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector);
static void SetObjectiveForAllPedsInCollective(int, eObjective, void*);
static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif
static bool IsFortStauntonDestroyed() { return FSDestroyedFlag && *(int32*)&ScriptSpace[FSDestroyedFlag] == 1; }
};
extern int ScriptParams[32];
VALIDATE_SIZE(uStackReturnValue, 4);
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER
extern int scriptToLoad; extern int scriptToLoad;
#endif #endif
@ -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

@ -1080,7 +1080,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed); script_assert(pPed);
SET_INTEGER_PARAM(0, pPed->m_pWanted->m_nWantedLevel); SET_INTEGER_PARAM(0, pPed->m_pWanted->GetWantedLevel());
StoreParameters(&m_nIp, 1); StoreParameters(&m_nIp, 1);
return 0; return 0;
} }

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

@ -2665,7 +2665,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
{ {
if (pPed->InVehicle()) if (pPed->InVehicle())
return IsVehicleStopped(pPed->m_pMyVehicle); return IsVehicleStopped(pPed->m_pMyVehicle);
return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) && return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
} }
@ -2679,7 +2679,7 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) || RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE)) RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
return false; return false;
return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) && return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
} }

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

@ -65,7 +65,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_WANTED_STARS_ARE_FLASHING: case COMMAND_WANTED_STARS_ARE_FLASHING:
{ {
CWanted* pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted; CWanted* pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted;
UpdateCompareFlag(pWanted->m_nMinWantedLevel - pWanted->m_nWantedLevel > 0); UpdateCompareFlag(pWanted->m_nMinWantedLevel - pWanted->GetWantedLevel() > 0);
return 0; return 0;
} }
case COMMAND_SET_ALLOW_HURRICANES: case COMMAND_SET_ALLOW_HURRICANES:
@ -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

@ -359,6 +359,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
return 0; return 0;
case COMMAND_HAS_OBJECT_BEEN_DAMAGED_BY_WEAPON: case COMMAND_HAS_OBJECT_BEEN_DAMAGED_BY_WEAPON:
{ {
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
bool result = false; bool result = false;
if (!pObject) { if (!pObject) {
@ -635,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);
@ -650,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:
@ -736,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

@ -14,8 +14,6 @@
#define TIME_BETWEEN_SETPIECE_SPAWNS 20000 #define TIME_BETWEEN_SETPIECE_SPAWNS 20000
//--MIAMI: file done
bool CSetPieces::bDebug; bool CSetPieces::bDebug;
uint32 CSetPieces::NumSetPieces; uint32 CSetPieces::NumSetPieces;
CSetPiece CSetPieces::aSetPieces[NUM_SETPIECES]; CSetPiece CSetPieces::aSetPieces[NUM_SETPIECES];
@ -86,7 +84,7 @@ void CSetPiece::Update(void)
switch (m_nType) { switch (m_nType) {
case SETPIECE_TWOCOPCARSINALLEY: case SETPIECE_TWOCOPCARSINALLEY:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 1 || FindPlayerVehicle()) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 1 || FindPlayerVehicle())
return; return;
CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1); CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1);
if (!pVehicle1) if (!pVehicle1)
@ -120,7 +118,7 @@ void CSetPiece::Update(void)
} }
case SETPIECE_CARBLOCKINGPLAYERFROMSIDE: case SETPIECE_CARBLOCKINGPLAYERFROMSIDE:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 2)
return; return;
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())
return; return;
@ -143,7 +141,7 @@ void CSetPiece::Update(void)
} }
case SETPIECE_CARRAMMINGPLAYERFROMSIDE: case SETPIECE_CARRAMMINGPLAYERFROMSIDE:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 2)
return; return;
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())
return; return;
@ -166,7 +164,7 @@ void CSetPiece::Update(void)
} }
case SETPIECE_CREATECOPPERONFOOT: case SETPIECE_CREATECOPPERONFOOT:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 1 || FindPlayerVehicle()) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 1 || FindPlayerVehicle())
return; return;
CCopPed* pCop = TryToGenerateCopPed(m_vSpawn1); CCopPed* pCop = TryToGenerateCopPed(m_vSpawn1);
if (!pCop) if (!pCop)
@ -180,7 +178,7 @@ void CSetPiece::Update(void)
} }
case SETPIECE_CREATETWOCOPPERSONFOOT: case SETPIECE_CREATETWOCOPPERSONFOOT:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 1 || FindPlayerVehicle()) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 1 || FindPlayerVehicle())
return; return;
CCopPed* pCop = TryToGenerateCopPed(m_vSpawn1); CCopPed* pCop = TryToGenerateCopPed(m_vSpawn1);
if (!pCop) if (!pCop)
@ -204,7 +202,7 @@ void CSetPiece::Update(void)
} }
case SETPIECE_TWOCARSBLOCKINGPLAYERFROMSIDE: case SETPIECE_TWOCARSBLOCKINGPLAYERFROMSIDE:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 2)
return; return;
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())
return; return;
@ -242,7 +240,7 @@ void CSetPiece::Update(void)
} }
case SETPIECE_TWOCARSRAMMINGPLAYERFROMSIDE: case SETPIECE_TWOCARSRAMMINGPLAYERFROMSIDE:
{ {
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2) if (FindPlayerPed()->m_pWanted->GetWantedLevel() < 2)
return; return;
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())
return; return;

View file

@ -15,8 +15,6 @@
#include "Weather.h" #include "Weather.h"
#include "World.h" #include "World.h"
//--MIAMI: file done
bool CTrafficLights::bGreenLightsCheat; bool CTrafficLights::bGreenLightsCheat;
void void
@ -116,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

@ -6,8 +6,6 @@
#include "Pools.h" #include "Pools.h"
#include "World.h" #include "World.h"
// --MIAMI: File done
CAccidentManager gAccidentManager; CAccidentManager gAccidentManager;
CAccident* CAccident*

View file

@ -81,7 +81,7 @@ CAnimViewer::Initialise(void) {
CCollision::Init(); CCollision::Init();
CWorld::Initialise(); CWorld::Initialise();
mod_HandlingManager.Initialise(); mod_HandlingManager.Initialise();
CTempColModels::Initialise(); gpTempColModels->Initialise();
CAnimManager::Initialise(); CAnimManager::Initialise();
CModelInfo::Initialise(); CModelInfo::Initialise();
CParticle::Initialise(); CParticle::Initialise();

View file

@ -30,8 +30,6 @@
#include "Bike.h" #include "Bike.h"
#include "Pickups.h" #include "Pickups.h"
//--MIAMI: file done
bool PrintDebugCode = false; bool PrintDebugCode = false;
int16 DebugCamMode; int16 DebugCamMode;
@ -953,7 +951,7 @@ CVector
CCam::DoAverageOnVector(const CVector &vec) CCam::DoAverageOnVector(const CVector &vec)
{ {
int i; int i;
CVector Average = { 0.0f, 0.0f, 0.0f }; CVector Average = CVector(0.0f, 0.0f, 0.0f);
if(ResetStatics){ if(ResetStatics){
m_iRunningVectorArrayPos = 0; m_iRunningVectorArrayPos = 0;
@ -4035,7 +4033,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn) if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source, CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
12.0f, 0.0f, 0.0f, -12.0f, 12.0f, 0.0f, 0.0f, -12.0f,
128, 128, 128, 128, 1000.0f, false, 1.0f); 128, 128, 128, 128, 1000.0f, false, 1.0f, nil, 1.0f);
if(CHud::m_Wants_To_Draw_Hud){ if(CHud::m_Wants_To_Draw_Hud){
char str[256]; char str[256];

View file

@ -2955,7 +2955,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
if (CReplay::IsPlayingBack()) if (CReplay::IsPlayingBack())
return false; return false;
#endif #endif
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1) if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
return false; return false;
if(FindPlayerVehicle() == nil) if(FindPlayerVehicle() == nil)
return false; return false;
@ -2983,7 +2983,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
if (CReplay::IsPlayingBack()) if (CReplay::IsPlayingBack())
return false; return false;
#endif #endif
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1) if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
return false; return false;
if(FindPlayerVehicle() == nil) if(FindPlayerVehicle() == nil)
return false; return false;

View file

@ -7,9 +7,6 @@
#include "RwHelper.h" #include "RwHelper.h"
#include "MemoryMgr.h" #include "MemoryMgr.h"
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
struct CdReadInfo struct CdReadInfo
{ {
uint32 nSectorOffset; uint32 nSectorOffset;
@ -60,7 +57,7 @@ CdStreamInitThread(void)
if ( gpReadInfo[i].hSemaphore == nil ) if ( gpReadInfo[i].hSemaphore == nil )
{ {
CDTRACE("failed to create sync semaphore"); printf("%s: failed to create sync semaphore\n", "cdvd_stream");
ASSERT(0); ASSERT(0);
return; return;
} }
@ -81,7 +78,7 @@ CdStreamInitThread(void)
if ( gCdStreamSema == nil ) if ( gCdStreamSema == nil )
{ {
CDTRACE("failed to create stream semaphore"); printf("%s: failed to create stream semaphore\n", "cdvd_stream");
ASSERT(0); ASSERT(0);
return; return;
} }
@ -90,7 +87,7 @@ CdStreamInitThread(void)
if ( _gCdStreamThread == nil ) if ( _gCdStreamThread == nil )
{ {
CDTRACE("failed to create streaming thread"); printf("%s: failed to create streaming thread\n", "cdvd_stream");
ASSERT(0); ASSERT(0);
return; return;
} }
@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels); gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
ASSERT( gpReadInfo != nil ); ASSERT( gpReadInfo != nil );
CDDEBUG("read info %p", gpReadInfo); debug("%s: read info %p\n", "cdvd_stream", gpReadInfo);
CdStreamAddImage("MODELS\\GTA3.IMG"); CdStreamAddImage("MODELS\\GTA3.IMG");

View file

@ -6,8 +6,6 @@
#include "Stats.h" #include "Stats.h"
#include "VarConsole.h" #include "VarConsole.h"
// --MIAMI: File done
_TODO("gbFastTime"); _TODO("gbFastTime");
bool gbFastTime; bool gbFastTime;

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"
@ -21,8 +17,6 @@
#include "Camera.h" #include "Camera.h"
#include "GenericGameStorage.h" #include "GenericGameStorage.h"
// --MIAMI: file done
CControllerConfigManager ControlsManager; CControllerConfigManager ControlsManager;
CControllerConfigManager::CControllerConfigManager() CControllerConfigManager::CControllerConfigManager()
@ -37,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++)
@ -323,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;
@ -331,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
@ -343,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);
/*******************************************************************************************/ /*******************************************************************************************/
} }
@ -395,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);
@ -524,7 +541,7 @@ void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown(int32 button, i
break; break;
case 12: case 12:
#ifndef REGISTER_START_BUTTON #ifndef REGISTER_START_BUTTON
if (padNumber == 1) if (padnumber == 1)
#endif #endif
pad->PCTempJoyState.Start = 255; pad->PCTempJoyState.Start = 255;
break; break;
@ -2738,9 +2755,10 @@ wchar *CControllerConfigManager::GetButtonComboText(e_ControllerAction action)
void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type) void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type)
{ {
ResetSettingOrder(action); ResetSettingOrder(action);
int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][type].m_Key = key; m_aSettings[action][type].m_Key = key;
m_aSettings[action][type].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1; m_aSettings[action][type].m_ContSetOrder = numOfSettings + 1;
} }
int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action) int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action)
@ -2750,8 +2768,10 @@ int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerA
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button) void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
{ {
int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][MOUSE].m_Key = button; m_aSettings[action][MOUSE].m_Key = button;
m_aSettings[action][MOUSE].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1; m_aSettings[action][MOUSE].m_ContSetOrder = numOfSettings + 1;
} }
void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action) void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
@ -2774,7 +2794,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

@ -144,6 +144,10 @@ public:
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES]; tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
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();

View file

@ -10,8 +10,6 @@
#include "main.h" #include "main.h"
#include "Accident.h" #include "Accident.h"
// --MIAMI: file done
int32 CEventList::ms_nFirstFreeSlotIndex; int32 CEventList::ms_nFirstFreeSlotIndex;
CEvent gaEvent[NUMEVENTS]; CEvent gaEvent[NUMEVENTS];
@ -220,7 +218,7 @@ CEventList::ReportCrimeForEvent(eEventType type, intptr crimeId, bool copsDontCa
default: crime = CRIME_NONE; break; default: crime = CRIME_NONE; break;
} }
if (crime == CRIME_HIT_PED && IsPedPointerValid((CPed*)crimeId) && FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 && ((CPed*)crimeId)->bBeingChasedByPolice) { if (crime == CRIME_HIT_PED && IsPedPointerValid((CPed*)crimeId) && FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 && ((CPed*)crimeId)->bBeingChasedByPolice) {
if (!((CPed*)crimeId)->DyingOrDead()) { if (!((CPed*)crimeId)->DyingOrDead()) {
CMessages::AddBigMessage(TheText.Get("GOODBOY"), 5000, 0); CMessages::AddBigMessage(TheText.Get("GOODBOY"), 5000, 0);
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 50; CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 50;

View file

@ -30,8 +30,6 @@
#include "ColStore.h" #include "ColStore.h"
#include "Occlusion.h" #include "Occlusion.h"
//--MIAMI: file done
char CFileLoader::ms_line[256]; char CFileLoader::ms_line[256];
const char* const char*
@ -609,11 +607,14 @@ CFileLoader::LoadObjectTypes(const char *filename)
int section; int section;
int pathIndex; int pathIndex;
int id, pathType; int id, pathType;
int minID, maxID; //int minID, maxID;
for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
m_sTempIdeData[i].id = -1;
section = NONE; section = NONE;
minID = INT32_MAX; //minID = INT32_MAX;
maxID = -1; //maxID = -1;
pathIndex = -1; pathIndex = -1;
debug("Loading object types from %s...\n", filename); debug("Loading object types from %s...\n", filename);
@ -637,13 +638,13 @@ CFileLoader::LoadObjectTypes(const char *filename)
}else switch(section){ }else switch(section){
case OBJS: case OBJS:
id = LoadObject(line); id = LoadObject(line);
if(id > maxID) maxID = id; //if(id > maxID) maxID = id;
if(id < minID) minID = id; //if(id < minID) minID = id;
break; break;
case TOBJ: case TOBJ:
id = LoadTimeObject(line); id = LoadTimeObject(line);
if(id > maxID) maxID = id; //if(id > maxID) maxID = id;
if(id < minID) minID = id; //if(id < minID) minID = id;
break; break;
case WEAP: case WEAP:
LoadWeaponObject(line); LoadWeaponObject(line);
@ -680,10 +681,10 @@ CFileLoader::LoadObjectTypes(const char *filename)
} }
CFileMgr::CloseFile(fd); CFileMgr::CloseFile(fd);
for(id = minID; id <= maxID; id++){ for(id = 0; id < MODELINFOSIZE; id++){
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id); CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
if(mi && mi->IsBuilding()) if(mi && mi->IsBuilding())
mi->SetupBigBuilding(minID, maxID); mi->SetupBigBuilding();
} }
} }
@ -716,6 +717,13 @@ CFileLoader::LoadObject(const char *line)
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4) if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return 0; // game returns return value return 0; // game returns return value
for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
if(m_sTempIdeData[i].id == -1){
m_sTempIdeData[i].id = id;
strcpy(m_sTempIdeData[i].name, model);
break;
}
switch(numObjs){ switch(numObjs){
case 1: case 1:
sscanf(line, "%d %s %s %d %f %d", sscanf(line, "%d %s %s %d %f %d",
@ -764,6 +772,13 @@ CFileLoader::LoadTimeObject(const char *line)
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4) if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return 0; // game returns return value return 0; // game returns return value
for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
if(m_sTempIdeData[i].id < 0){
m_sTempIdeData[i].id = id;
strcpy(m_sTempIdeData[i].name, model);
break;
}
switch(numObjs){ switch(numObjs){
case 1: case 1:
sscanf(line, "%d %s %s %d %f %d %d %d", sscanf(line, "%d %s %s %d %f %d %d %d",
@ -794,7 +809,7 @@ CFileLoader::LoadTimeObject(const char *line)
mi->m_firstDamaged = damaged; mi->m_firstDamaged = damaged;
mi->SetTimes(timeOn, timeOff); mi->SetTimes(timeOn, timeOff);
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
other = mi->FindOtherTimeModel(); other = mi->FindOtherTimeModel(model);
if(other) if(other)
other->SetOtherTimeModel(id); other->SetOtherTimeModel(id);
MatchModelString(model, id); MatchModelString(model, id);
@ -818,7 +833,7 @@ CFileLoader::LoadWeaponObject(const char *line)
mi->m_lodDistances[0] = dist; mi->m_lodDistances[0] = dist;
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile); mi->SetAnimFile(animFile);
mi->SetColModel(&CTempColModels::ms_colModelWeapon); mi->SetColModel(&gpTempColModels->ms_colModelWeapon);
MatchModelString(model, id); MatchModelString(model, id);
return id; return id;
} }
@ -834,7 +849,7 @@ CFileLoader::LoadClumpObject(const char *line)
mi = CModelInfo::AddClumpModel(id); mi = CModelInfo::AddClumpModel(id);
mi->SetModelName(model); mi->SetModelName(model);
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
mi->SetColModel(&CTempColModels::ms_colModelBBox); mi->SetColModel(&gpTempColModels->ms_colModelBBox);
} }
} }
@ -941,7 +956,7 @@ CFileLoader::LoadPedObject(const char *line)
mi->SetModelName(model); mi->SetModelName(model);
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile); mi->SetAnimFile(animFile);
mi->SetColModel(&CTempColModels::ms_colModelPed1); mi->SetColModel(&gpTempColModels->ms_colModelPed1);
mi->m_pedType = CPedType::FindPedType(pedType); mi->m_pedType = CPedType::FindPedType(pedType);
mi->m_pedStatType = CPedStats::GetPedStatType(pedStats); mi->m_pedStatType = CPedStats::GetPedStatType(pedStats);
for(animGroupId = 0; animGroupId < NUM_ANIM_ASSOC_GROUPS; animGroupId++) for(animGroupId = 0; animGroupId < NUM_ANIM_ASSOC_GROUPS; animGroupId++)
@ -1312,7 +1327,7 @@ CFileLoader::LoadOcclusionVolume(const char *line)
} }
//--MIAMI: unused // unused
void void
CFileLoader::ReloadPaths(const char *filename) CFileLoader::ReloadPaths(const char *filename)
{ {

View file

@ -18,8 +18,6 @@
#include "GameLogic.h" #include "GameLogic.h"
#include "CarAI.h" #include "CarAI.h"
// --MIAMI: file done
CFireManager gFireManager; CFireManager gFireManager;
CFire::CFire() CFire::CFire()

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"
@ -41,7 +37,6 @@
#include "sampman.h" #include "sampman.h"
// --LCS: changed a bit to have lcs feel, needs more work // --LCS: changed a bit to have lcs feel, needs more work
// Similar story to Hud.cpp: // Similar story to Hud.cpp:
// Game has colors inlined in code. // Game has colors inlined in code.
// For easier modification we collect them here: // For easier modification we collect them here:
@ -50,7 +45,7 @@ const CRGBA SELECTIONBORDER_COLOR(25, 130, 70, 255);
const CRGBA MENUOPTION_COLOR = LABEL_COLOR; const CRGBA MENUOPTION_COLOR = LABEL_COLOR;
const CRGBA SELECTEDMENUOPTION_COLOR(255, 255, 255, 255); const CRGBA SELECTEDMENUOPTION_COLOR(255, 255, 255, 255);
const CRGBA HEADER_COLOR(197, 0, 0, 255); const CRGBA HEADER_COLOR(197, 0, 0, 255);
const CRGBA DARKMENUOPTION_COLOR(195, 90, 165, 255); const CRGBA DARKMENUOPTION_COLOR(115/2, 173/2, 216 / 2, 255);
const CRGBA SLIDERON_COLOR(97, 194, 247, 255); const CRGBA SLIDERON_COLOR(97, 194, 247, 255);
const CRGBA SLIDEROFF_COLOR(27, 89, 130, 255); const CRGBA SLIDEROFF_COLOR(27, 89, 130, 255);
const CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 130); const CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 130);
@ -582,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("");
@ -672,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
} }
} }
@ -909,14 +916,14 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
#endif #endif
switch (m_nCurrScreen) { switch (m_nCurrScreen) {
case MENUPAGE_CHOOSE_LOAD_SLOT: /*case MENUPAGE_CHOOSE_LOAD_SLOT:
case MENUPAGE_CHOOSE_DELETE_SLOT: case MENUPAGE_CHOOSE_DELETE_SLOT:
case MENUPAGE_CHOOSE_SAVE_SLOT: case MENUPAGE_CHOOSE_SAVE_SLOT:
CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(38.0f), MENU_Y(85.0f), CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(38.0f), MENU_Y(85.0f),
MENU_X_LEFT_ALIGNED(615.0f), MENU_Y(75.0f), MENU_X_LEFT_ALIGNED(615.0f), MENU_Y(75.0f),
MENU_X_LEFT_ALIGNED(30.0f), MENU_Y(320.0f), MENU_X_LEFT_ALIGNED(30.0f), MENU_Y(320.0f),
MENU_X_LEFT_ALIGNED(605.0f), MENU_Y(330.0f), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a))); MENU_X_LEFT_ALIGNED(605.0f), MENU_Y(330.0f), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a)));
break; break;*/
case MENUPAGE_SOUND_SETTINGS: case MENUPAGE_SOUND_SETTINGS:
PrintRadioSelector(); PrintRadioSelector();
break; break;
@ -993,7 +1000,9 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
} }
wchar unicodeTemp[64]; wchar unicodeTemp[64];
#ifdef ASPECT_RATIO_SCALE
char asciiTemp[32]; char asciiTemp[32];
#endif
bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL; bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL;
uint8 section = 0; // 0: highlight trapezoid 1: texts uint8 section = 0; // 0: highlight trapezoid 1: texts
@ -1010,12 +1019,12 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
#endif #endif
wchar* rightText = nil; wchar* rightText = nil;
wchar* leftText; wchar* leftText;
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) { /*if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE)); CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
CFont::SetDropShadowPosition(0); CFont::SetDropShadowPosition(0);
} else { } else {*/
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetDropShadowPosition(2); CFont::SetDropShadowPosition(2);
@ -1024,7 +1033,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255))); CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255)));
else else
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255))); CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
} //}
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Align == MENUALIGN_LEFT) { if (aScreens[m_nCurrScreen].m_aEntries[i].m_Align == MENUALIGN_LEFT) {
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
@ -3054,6 +3063,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
@ -3099,15 +3118,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;
@ -3166,7 +3182,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
} }
@ -3222,7 +3239,7 @@ CMenuManager::SmallMessageScreen(const char* text)
void void
CMenuManager::PrintBriefs() CMenuManager::PrintBriefs()
{ {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE)); CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
@ -4446,19 +4463,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();
@ -4687,7 +4704,8 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
break; break;
case MENUACTION_CANCELGAME: case MENUACTION_CANCELGAME:
DMAudio.Service(); DMAudio.Service();
SwitchToNewScreen(MENUPAGE_OUTRO); RsEventHandler(rsQUITAPP, nil);
//SwitchToNewScreen(MENUPAGE_OUTRO);
break; break;
case MENUACTION_RESUME: case MENUACTION_RESUME:
#ifdef LEGACY_MENU_OPTIONS #ifdef LEGACY_MENU_OPTIONS
@ -4818,6 +4836,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 +4869,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 +5026,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 +5469,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"
@ -125,8 +120,6 @@ int gameTxdSlot;
uint8 gameProcessPirateCheck = 0; uint8 gameProcessPirateCheck = 0;
#endif #endif
// --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void); void DoRWStuffEndOfFrame(void);
#ifdef PS2_MENU #ifdef PS2_MENU
@ -323,7 +316,7 @@ bool CGame::InitialiseOnceAfterRW(void)
{ {
TheText.Load(); TheText.Load();
CTimer::Initialise(); CTimer::Initialise();
CTempColModels::Initialise(); gpTempColModels->Initialise();
mod_HandlingManager.Initialise(); mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT"); CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise(); CPedStats::Initialise();
@ -373,6 +366,9 @@ bool CGame::Initialise(const char* datFile)
CPools::Initialise(); CPools::Initialise();
if(gMakeResources)
CVehicleModelInfo::Load(nil);
#ifndef GTA_PS2 #ifndef GTA_PS2
CIniFile::LoadIniFile(); CIniFile::LoadIniFile();
#endif #endif
@ -858,9 +854,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())
{ {
@ -899,13 +895,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();
@ -943,7 +939,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

@ -2,8 +2,6 @@
#include <ctype.h> #include <ctype.h>
// --MIAMI: file done
class CGeneral class CGeneral
{ {
public: public:
@ -135,7 +133,7 @@ public:
static bool faststricmp(const char *str1, const char *str2) static bool faststricmp(const char *str1, const char *str2)
{ {
for (; *str1; str1++, str2++) { for (; *str1; str1++, str2++) {
#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__ #ifndef ASCII_STRCMP
if (toupper(*str1) != toupper(*str2)) if (toupper(*str1) != toupper(*str2))
#else #else
if (__ascii_toupper(*str1) != __ascii_toupper(*str2)) if (__ascii_toupper(*str1) != __ascii_toupper(*str2))

View file

@ -7,8 +7,6 @@
#include "main.h" #include "main.h"
#include "Population.h" #include "Population.h"
// --MIAMI: file done
float CIniFile::PedNumberMultiplier = 0.6f; float CIniFile::PedNumberMultiplier = 0.6f;
float CIniFile::CarNumberMultiplier = 0.8f; float CIniFile::CarNumberMultiplier = 0.8f;

14
src/core/Leeds.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "common.h"
#include "Leeds.h"
void LoadResource(RpAtomic *atomic) {}
void LoadResource(RpClump *clump) {}
void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer) {}
void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer) {}

36
src/core/Leeds.h Normal file
View file

@ -0,0 +1,36 @@
#pragma once
/*
PatchElementModelInfo(RslElement *,void *)
ChunkName(char const*)
DestroyAndFreeResourceImage(void)
WriteOrder(char const*)
UnpatchTextures(void)
IsChunked(int)
SaveResourceImage(void)
LoadResourceImage(void)
SaveResource(RslNode *,base::cRelocatableChunkWriter &)
SaveResource(RslTAnimTree *,base::cRelocatableChunkWriter &)
SaveResource(RslSkin *,base::cRelocatableChunkWriter &)
SaveResource(CAnimBlendTree *,base::cRelocatableChunkWriter &)
PatchElementTextures(RslElement *)
PatchElementGroupTextures(RslElementGroup *)
*/
void LoadResource(RpAtomic *atomic);
void LoadResource(RpClump *clump);
/*
cRelocatableChunkWriterGTA::Save(char const*,uint,uint,bool)
cRelocatableChunkGTA::cRelocatableChunkGTA(char const*,uint,uint,bool)
SaveAnimBlock(int)
SaveModel(int,bool)
*/
void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer);
void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer);
void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer);
void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer);
void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer);
void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer);
void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer);

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"
@ -54,8 +47,6 @@
#include "libpad.h" #include "libpad.h"
#endif #endif
// --MIAMI: file done except Mobile(see TODOs) and PS2 stuff
CPad Pads[MAX_PADS]; CPad Pads[MAX_PADS];
#ifdef GTA_PS2 #ifdef GTA_PS2
u_long128 pad_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64))); u_long128 pad_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
@ -459,7 +450,7 @@ void ArmourCheat()
void WantedLevelUpCheat() void WantedLevelUpCheat()
{ {
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true); CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
FindPlayerPed()->m_pWanted->CheatWantedLevel(Min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6)); FindPlayerPed()->m_pWanted->CheatWantedLevel(Min(FindPlayerPed()->m_pWanted->GetWantedLevel() + 2, 6));
} }
void WantedLevelDownCheat() void WantedLevelDownCheat()

View file

@ -4,7 +4,7 @@ class CPlaceable
{ {
public: public:
// disable allocation // disable allocation
static void *operator new(size_t) = delete; static void *operator new(size_t);
CMatrix m_matrix; CMatrix m_matrix;

View file

@ -35,8 +35,6 @@
#include "Automobile.h" #include "Automobile.h"
#include "GameLogic.h" #include "GameLogic.h"
// --MIAMI: File done
CVector lastPlayerPos; CVector lastPlayerPos;
void void
@ -483,7 +481,7 @@ CPlayerInfo::Process(void)
CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled; CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled;
} }
if (m_pPed->m_pWanted->m_nWantedLevel && !CTheScripts::IsPlayerOnAMission()) { if (m_pPed->m_pWanted->GetWantedLevel() && !CTheScripts::IsPlayerOnAMission()) {
float maxDelta = 0.0f; float maxDelta = 0.0f;
static bool movedSignificantly = true; static bool movedSignificantly = true;
static bool thereIsACarPathNear = true; static bool thereIsACarPathNear = true;
@ -495,7 +493,7 @@ CPlayerInfo::Process(void)
lastPlayerPos = FindPlayerCoors(); lastPlayerPos = FindPlayerCoors();
thereIsACarPathNear = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 60.0f, true, false, false, false) != 0; thereIsACarPathNear = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 60.0f, true, false, false, false) != 0;
} }
switch (m_pPed->m_pWanted->m_nWantedLevel) { switch (m_pPed->m_pWanted->GetWantedLevel()) {
case 1: case 1:
maxDelta = 31.f; maxDelta = 31.f;
break; break;

View file

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

View file

@ -15,8 +15,6 @@
#include "World.h" #include "World.h"
#include "MemoryHeap.h" #include "MemoryHeap.h"
//--MIAMI: file done
CCPtrNodePool *CPools::ms_pPtrNodePool; CCPtrNodePool *CPools::ms_pPtrNodePool;
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool; CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
CPedPool *CPools::ms_pPedPool; CPedPool *CPools::ms_pPedPool;

View file

@ -1,3 +1,6 @@
#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
#define WITHD3D
#endif
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
@ -17,8 +20,6 @@
#include "SpecialFX.h" #include "SpecialFX.h"
#include "Font.h" #include "Font.h"
// --MIAMI: file done
float CRadar::m_radarRange; float CRadar::m_radarRange;
sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS]; sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS];
CVector2D vec2DRadarOrigin; CVector2D vec2DRadarOrigin;
@ -54,7 +55,7 @@ CSprite2d CRadar::SpraySprite;
CSprite2d CRadar::TShirtSprite; CSprite2d CRadar::TShirtSprite;
CSprite2d CRadar::TommySprite; CSprite2d CRadar::TommySprite;
CSprite2d CRadar::PhoneSprite; CSprite2d CRadar::PhoneSprite;
CSprite2d CRadar::RadioWildstyleSprite; /*CSprite2d CRadar::RadioWildstyleSprite;
CSprite2d CRadar::RadioFlashSprite; CSprite2d CRadar::RadioFlashSprite;
CSprite2d CRadar::RadioKChatSprite; CSprite2d CRadar::RadioKChatSprite;
CSprite2d CRadar::RadioFeverSprite; CSprite2d CRadar::RadioFeverSprite;
@ -62,7 +63,39 @@ CSprite2d CRadar::RadioVRockSprite;
CSprite2d CRadar::RadioVCPRSprite; CSprite2d CRadar::RadioVCPRSprite;
CSprite2d CRadar::RadioEspantosoSprite; CSprite2d CRadar::RadioEspantosoSprite;
CSprite2d CRadar::RadioEmotionSprite; CSprite2d CRadar::RadioEmotionSprite;
CSprite2d CRadar::RadioWaveSprite; CSprite2d CRadar::RadioWaveSprite;*/
CSprite2d CRadar::EightBallSprite;
CSprite2d CRadar::BurnerSprite;
CSprite2d CRadar::CiprianiSprite;
CSprite2d CRadar::DonaldSprite;
CSprite2d CRadar::JosephSprite;
CSprite2d CRadar::LeoneSprite;
CSprite2d CRadar::MariaSprite;
CSprite2d CRadar::McraySprite;
CSprite2d CRadar::ToshikoSprite;
CSprite2d CRadar::VincenzoSprite;
CSprite2d CRadar::BombSprite;
CSprite2d CRadar::ClothesShopSprite;
CSprite2d CRadar::PropertyRedSprite;
CSprite2d CRadar::PhilCassidySprite;
CSprite2d CRadar::PowerupSprite;
CSprite2d CRadar::MPBase;
CSprite2d CRadar::MPCheckPoint;
CSprite2d CRadar::MPPlayer;
CSprite2d CRadar::MPObjective;
CSprite2d CRadar::MPCar;
CSprite2d CRadar::MPTank;
CSprite2d CRadar::MPCarLockup;
CSprite2d CRadar::MPTargetPlayer;
CSprite2d CRadar::MapHereSprite0;
CSprite2d CRadar::MapHereSprite1;
CSprite2d CRadar::MapHereSprite2;
CSprite2d CRadar::MapHereSprite3;
CSprite2d CRadar::MapHereSprite4;
CSprite2d CRadar::MapHereSprite5;
CSprite2d CRadar::MapHereSprite6;
CSprite2d CRadar::MapHereSprite7;
CSprite2d CRadar::MapWayPoint;
CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
nil, nil,
@ -96,20 +129,38 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
&TShirtSprite, &TShirtSprite,
&TommySprite, &TommySprite,
&PhoneSprite, &PhoneSprite,
&RadioWildstyleSprite, &EightBallSprite,
&RadioFlashSprite, &BurnerSprite,
&RadioKChatSprite, &CiprianiSprite,
&RadioFeverSprite, &DonaldSprite,
&RadioVRockSprite, &JosephSprite,
&RadioVCPRSprite, &LeoneSprite,
&RadioEspantosoSprite, &MariaSprite,
&RadioEmotionSprite, &McraySprite,
&RadioWaveSprite, // tmp hack &ToshikoSprite,
&RadioWaveSprite, &VincenzoSprite,
&RadioWaveSprite, &BombSprite,
&RadioWaveSprite, &ClothesShopSprite,
&RadioWaveSprite, &PropertyRedSprite,
&RadioWaveSprite &PhilCassidySprite,
&PowerupSprite,
&MPBase,
&MPCheckPoint,
&MPPlayer,
&MPObjective,
&MPCar,
&MPTank,
&MPCarLockup,
&MPTargetPlayer,
&MapHereSprite0,
&MapHereSprite1,
&MapHereSprite2,
&MapHereSprite3,
&MapHereSprite4,
&MapHereSprite5,
&MapHereSprite6,
&MapHereSprite7,
&MapWayPoint,
}; };
// Why this doesn't coincide with world coordinates i don't know // Why this doesn't coincide with world coordinates i don't know
@ -339,10 +390,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{ {
CVector2D corners[4] = { CVector2D corners[4] = {
{ 1.0f, -1.0f }, // top right CVector2D( 1.0f, -1.0f ), // top right
{ 1.0f, 1.0f }, // bottom right CVector2D( 1.0f, 1.0f ), // bottom right
{ -1.0f, 1.0f }, // bottom left CVector2D( -1.0f, 1.0f ), // bottom left
{ -1.0f, -1.0f }, // top left CVector2D( -1.0f, -1.0f ), // top left
}; };
CVector2D tmp; CVector2D tmp;
int i, j, n; int i, j, n;
@ -1025,7 +1076,7 @@ CRadar::LoadTextures()
TShirtSprite.SetTexture("tshirt"); TShirtSprite.SetTexture("tshirt");
TommySprite.SetTexture("tommy"); TommySprite.SetTexture("tommy");
PhoneSprite.SetTexture("phone"); PhoneSprite.SetTexture("phone");
RadioWildstyleSprite.SetTexture("RWildstyle"); /*RadioWildstyleSprite.SetTexture("RWildstyle");
RadioFlashSprite.SetTexture("RFlash"); RadioFlashSprite.SetTexture("RFlash");
RadioKChatSprite.SetTexture("RKchat"); RadioKChatSprite.SetTexture("RKchat");
RadioFeverSprite.SetTexture("RFever"); RadioFeverSprite.SetTexture("RFever");
@ -1033,7 +1084,39 @@ CRadar::LoadTextures()
RadioVCPRSprite.SetTexture("RVCPR"); RadioVCPRSprite.SetTexture("RVCPR");
RadioEspantosoSprite.SetTexture("REspantoso"); RadioEspantosoSprite.SetTexture("REspantoso");
RadioEmotionSprite.SetTexture("REmotion"); RadioEmotionSprite.SetTexture("REmotion");
RadioWaveSprite.SetTexture("RWave"); RadioWaveSprite.SetTexture("RWave");*/
EightBallSprite.SetTexture("radar_8Ball");
BurnerSprite.SetTexture("radar_Burner");
CiprianiSprite.SetTexture("radar_Cipriani");
DonaldSprite.SetTexture("radar_Donald");
JosephSprite.SetTexture("radar_Joseph");
LeoneSprite.SetTexture("radar_Leone");
MariaSprite.SetTexture("radar_Maria");
McraySprite.SetTexture("radar_McRay");
ToshikoSprite.SetTexture("radar_Toshiko");
VincenzoSprite.SetTexture("radar_Vincenzo");
BombSprite.SetTexture("radar_Bomb");
ClothesShopSprite.SetTexture("radar_cShop");
PropertyRedSprite.SetTexture("radar_propertyR");
PhilCassidySprite.SetTexture("radar_flag");
PowerupSprite.SetTexture("radar_powerup");
MPBase.SetTexture("mp_base");
MPCheckPoint.SetTexture("radar_mp_checkpoint");
MPPlayer.SetTexture("mp_player");
MPObjective.SetTexture("mp_objective");
MPCar.SetTexture("mp_car");
MPTank.SetTexture("mp_tank");
MPCarLockup.SetTexture("mp_carlockup");
MPTargetPlayer.SetTexture("mp_targetplayer");
MapHereSprite0.SetTexture("radar_arrow");
MapHereSprite1.SetTexture("radar_arrow_01");
MapHereSprite2.SetTexture("radar_arrow_02");
MapHereSprite3.SetTexture("radar_arrow_03");
MapHereSprite4.SetTexture("radar_arrow_04");
MapHereSprite5.SetTexture("radar_arrow_05");
MapHereSprite6.SetTexture("radar_arrow_06");
MapHereSprite7.SetTexture("radar_arrow_07");
MapWayPoint.SetTexture("radar_player_target");
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
@ -1221,7 +1304,39 @@ void CRadar::Shutdown()
TShirtSprite.Delete(); TShirtSprite.Delete();
TommySprite.Delete(); TommySprite.Delete();
PhoneSprite.Delete(); PhoneSprite.Delete();
RadioWildstyleSprite.Delete(); EightBallSprite.Delete();
BurnerSprite.Delete();
CiprianiSprite.Delete();
DonaldSprite.Delete();
JosephSprite.Delete();
LeoneSprite.Delete();
MariaSprite.Delete();
McraySprite.Delete();
ToshikoSprite.Delete();
VincenzoSprite.Delete();
BombSprite.Delete();
ClothesShopSprite.Delete();
PropertyRedSprite.Delete();
PhilCassidySprite.Delete();
PowerupSprite.Delete();
MPBase.Delete();
MPCheckPoint.Delete();
MPPlayer.Delete();
MPObjective.Delete();
MPCar.Delete();
MPTank.Delete();
MPCarLockup.Delete();
MPTargetPlayer.Delete();
MapHereSprite0.Delete();
MapHereSprite1.Delete();
MapHereSprite2.Delete();
MapHereSprite3.Delete();
MapHereSprite4.Delete();
MapHereSprite5.Delete();
MapHereSprite6.Delete();
MapHereSprite7.Delete();
MapWayPoint.Delete();
/*RadioWildstyleSprite.Delete();
RadioFlashSprite.Delete(); RadioFlashSprite.Delete();
RadioKChatSprite.Delete(); RadioKChatSprite.Delete();
RadioFeverSprite.Delete(); RadioFeverSprite.Delete();
@ -1229,7 +1344,7 @@ void CRadar::Shutdown()
RadioVCPRSprite.Delete(); RadioVCPRSprite.Delete();
RadioEspantosoSprite.Delete(); RadioEspantosoSprite.Delete();
RadioEmotionSprite.Delete(); RadioEmotionSprite.Delete();
RadioWaveSprite.Delete(); RadioWaveSprite.Delete();*/
RemoveRadarSections(); RemoveRadarSections();
} }
@ -1672,7 +1787,7 @@ CRadar::DrawLegend(int32 x, int32 y, int32 sprite)
case RADAR_SPRITE_PHONE: case RADAR_SPRITE_PHONE:
text = TheText.Get("LG_25"); text = TheText.Get("LG_25");
break; break;
case RADAR_SPRITE_RADIO_WILDSTYLE: /*case RADAR_SPRITE_RADIO_WILDSTYLE:
text = TheText.Get("LG_26"); text = TheText.Get("LG_26");
break; break;
case RADAR_SPRITE_RADIO_FLASH: case RADAR_SPRITE_RADIO_FLASH:
@ -1698,7 +1813,7 @@ CRadar::DrawLegend(int32 x, int32 y, int32 sprite)
break; break;
case RADAR_SPRITE_RADIO_WAVE: case RADAR_SPRITE_RADIO_WAVE:
text = TheText.Get("LG_34"); text = TheText.Get("LG_34");
break; break;*/
default: default:
text = TheText.Get("LG_34"); // tmp hack text = TheText.Get("LG_34"); // tmp hack
break; break;

View file

@ -83,20 +83,38 @@ enum eRadarSprite
RADAR_SPRITE_TSHIRT, RADAR_SPRITE_TSHIRT,
RADAR_SPRITE_TOMMY, RADAR_SPRITE_TOMMY,
RADAR_SPRITE_PHONE, RADAR_SPRITE_PHONE,
RADAR_SPRITE_RADIO_WILDSTYLE, RADAR_SPRITE_EIGHTBALL,
RADAR_SPRITE_RADIO_FLASH, RADAR_SPRITE_BURNER,
RADAR_SPRITE_RADIO_KCHAT, RADAR_SPRITE_CIPRIANI,
RADAR_SPRITE_RADIO_FEVER, RADAR_SPRITE_DONALD,
RADAR_SPRITE_RADIO_VROCK, RADAR_SPRITE_JOSEPH,
RADAR_SPRITE_RADIO_VCPR, RADAR_SPRITE_LEONE,
RADAR_SPRITE_RADIO_ESPANTOSO, RADAR_SPRITE_MARIA,
RADAR_SPRITE_RADIO_EMOTION, RADAR_SPRITE_MCRAY,
RADAR_SPRITE_RADIO_WAVE, RADAR_SPRITE_TOSHIKO,
RADAR_SPRITE_40, // tmp RADAR_SPRITE_VINCENZO, // tmp
RADAR_SPRITE_41, RADAR_SPRITE_BOMB,
RADAR_SPRITE_42, RADAR_SPRITE_CLOTHES,
RADAR_SPRITE_43, RADAR_SPRITE_PROPERTY_RED,
RADAR_SPRITE_44, RADAR_SPRITE_PHIL_CASSIDY,
RADAR_SPRITE_POWERUP,
RADAR_SPRITE_MPBASE,
RADAR_SPRITE_MPCHECKPOINT,
RADAR_SPRITE_MPPLAYER,
RADAR_SPRITE_MPOBJECTIVE,
RADAR_SPRITE_MPCAR,
RADAR_SPRITE_MPTANK,
RADAR_SPRITE_MPCARLOCKUP,
RADAR_SPRITE_MPTARGETPLAYER,
RADAR_SPRITE_MAPHERE0,
RADAR_SPRITE_MAPHERE1,
RADAR_SPRITE_MAPHERE2,
RADAR_SPRITE_MAPHERE3,
RADAR_SPRITE_MAPHERE4,
RADAR_SPRITE_MAPHERE5,
RADAR_SPRITE_MAPHERE6,
RADAR_SPRITE_MAPHERE7,
RADAR_SPRITE_MAPWAYPOINT,
RADAR_SPRITE_COUNT RADAR_SPRITE_COUNT
}; };
@ -219,7 +237,7 @@ public:
static CSprite2d TShirtSprite; static CSprite2d TShirtSprite;
static CSprite2d TommySprite; static CSprite2d TommySprite;
static CSprite2d PhoneSprite; static CSprite2d PhoneSprite;
static CSprite2d RadioWildstyleSprite; /* static CSprite2d RadioWildstyleSprite;
static CSprite2d RadioFlashSprite; static CSprite2d RadioFlashSprite;
static CSprite2d RadioKChatSprite; static CSprite2d RadioKChatSprite;
static CSprite2d RadioFeverSprite; static CSprite2d RadioFeverSprite;
@ -227,7 +245,39 @@ public:
static CSprite2d RadioVCPRSprite; static CSprite2d RadioVCPRSprite;
static CSprite2d RadioEspantosoSprite; static CSprite2d RadioEspantosoSprite;
static CSprite2d RadioEmotionSprite; static CSprite2d RadioEmotionSprite;
static CSprite2d RadioWaveSprite; static CSprite2d RadioWaveSprite;*/
static CSprite2d EightBallSprite;
static CSprite2d BurnerSprite;
static CSprite2d CiprianiSprite;
static CSprite2d DonaldSprite;
static CSprite2d JosephSprite;
static CSprite2d LeoneSprite;
static CSprite2d MariaSprite;
static CSprite2d McraySprite;
static CSprite2d ToshikoSprite;
static CSprite2d VincenzoSprite;
static CSprite2d BombSprite;
static CSprite2d ClothesShopSprite;
static CSprite2d PropertyRedSprite;
static CSprite2d PhilCassidySprite;
static CSprite2d PowerupSprite;
static CSprite2d MPBase;
static CSprite2d MPCheckPoint;
static CSprite2d MPPlayer;
static CSprite2d MPObjective;
static CSprite2d MPCar;
static CSprite2d MPTank;
static CSprite2d MPCarLockup;
static CSprite2d MPTargetPlayer;
static CSprite2d MapHereSprite0;
static CSprite2d MapHereSprite1;
static CSprite2d MapHereSprite2;
static CSprite2d MapHereSprite3;
static CSprite2d MapHereSprite4;
static CSprite2d MapHereSprite5;
static CSprite2d MapHereSprite6;
static CSprite2d MapHereSprite7;
static CSprite2d MapWayPoint;
static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT]; static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT];
static float cachedCos; static float cachedCos;
static float cachedSin; static float cachedSin;

View file

@ -116,7 +116,7 @@ CRopes::RegisterRope(uintptr id, CVector pos, bool setUpdateTimer)
aRopes[i].m_unk = false; aRopes[i].m_unk = false;
aRopes[i].m_bWasRegistered = true; aRopes[i].m_bWasRegistered = true;
aRopes[i].m_updateTimer = setUpdateTimer ? CTimer::GetTimeInMilliseconds() + 20000 : 0; aRopes[i].m_updateTimer = setUpdateTimer ? CTimer::GetTimeInMilliseconds() + 20000 : 0;
for(j = 1; j < ARRAY_SIZE(CRope::m_pos); j++){ for(j = 1; j < ARRAY_SIZE(aRopes[0].m_pos); j++){
if(j & 1) if(j & 1)
aRopes[i].m_pos[j] = aRopes[i].m_pos[j-1] + CVector(0.0f, 0.0f, 0.625f); aRopes[i].m_pos[j] = aRopes[i].m_pos[j-1] + CVector(0.0f, 0.0f, 0.625f);
else else
@ -147,7 +147,7 @@ CRopes::FindCoorsAlongRope(uintptr id, float t, CVector *coors)
float f; float f;
for(i = 0; i < ARRAY_SIZE(aRopes); i++) for(i = 0; i < ARRAY_SIZE(aRopes); i++)
if(aRopes[i].m_bActive && aRopes[i].m_id == id){ if(aRopes[i].m_bActive && aRopes[i].m_id == id){
t = (ARRAY_SIZE(CRope::m_pos)-1)*clamp(t, 0.0f, 0.999f); t = (ARRAY_SIZE(aRopes[0].m_pos)-1)*clamp(t, 0.0f, 0.999f);
j = t; j = t;
f = t - j; f = t - j;
*coors = (1.0f-f)*aRopes[i].m_pos[j] + f*aRopes[i].m_pos[j+1]; *coors = (1.0f-f)*aRopes[i].m_pos[j] + f*aRopes[i].m_pos[j+1];

View file

@ -115,8 +115,6 @@ float CStats::LongestWheelieDist;
float CStats::LongestStoppieDist; float CStats::LongestStoppieDist;
float CStats::Longest2WheelDist; float CStats::Longest2WheelDist;
// --MIAMI: functions below are done, but there are some to be moved from Frontend
void CStats::Init() void CStats::Init()
{ {
PeopleKilledByOthers = 0; PeopleKilledByOthers = 0;

View file

@ -21,7 +21,7 @@ public:
static int32 NumberKillFrenziesPassed; static int32 NumberKillFrenziesPassed;
static int32 PeopleKilledByOthers; static int32 PeopleKilledByOthers;
static int32 HelisDestroyed; static int32 HelisDestroyed;
static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES]; static int32 PedsKilledOfThisType[NUM_PEDTYPES];
static int32 TimesDied; static int32 TimesDied;
static int32 TimesArrested; static int32 TimesArrested;
static int32 KillsSinceLastCheckpoint; static int32 KillsSinceLastCheckpoint;

Some files were not shown because too many files have changed in this diff Show more