summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorRoman Masanin <36927roma@gmail.com>2020-10-24 13:20:08 +0200
committerRoman Masanin <36927roma@gmail.com>2020-10-24 13:20:08 +0200
commit39b7075502b91172e557ec17932dfd68c7da96a1 (patch)
tree681194f8c652968c3e525d7c10c25d35e04d499b /src/core
parentpeds (diff)
parentmore ScriptSounds (diff)
downloadre3-39b7075502b91172e557ec17932dfd68c7da96a1.tar
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.gz
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.bz2
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.lz
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.xz
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.zst
re3-39b7075502b91172e557ec17932dfd68c7da96a1.zip
Diffstat (limited to '')
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/CdStreamPosix.cpp17
-rw-r--r--src/core/Fire.cpp4
-rw-r--r--src/core/Frontend.cpp148
-rw-r--r--src/core/Pad.h4
-rw-r--r--src/core/Pools.cpp61
-rw-r--r--src/core/Radar.cpp758
-rw-r--r--src/core/Radar.h48
-rw-r--r--src/core/Streaming.cpp2
-rw-r--r--src/core/TempColModels.cpp18
-rw-r--r--src/core/Timer.cpp7
-rw-r--r--src/core/World.cpp18
-rw-r--r--src/core/Zones.cpp7
-rw-r--r--src/core/Zones.h2
-rw-r--r--src/core/config.h4
-rw-r--r--src/core/main.cpp106
16 files changed, 776 insertions, 430 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index b996e77f..7af652ad 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -4247,7 +4247,7 @@ CCam::GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, C
CWorld::FindObjectsInRange(TargetCoors, 30.0f, true, &NumObjects, 15, Objects, false, false, false, true, true);
float NearestDist = 10000.0f;
for(i = 0; i < NumObjects; i++){
- if(Objects[i]->IsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
+ if(Objects[i]->GetIsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
float Dist = (Objects[i]->GetPosition() - TargetCoors).Magnitude2D();
if(Abs(ARRESTCAM_LAMP_BEST_DIST - Dist) < NearestDist){
CVector TestStart = Objects[i]->GetColModel()->boundingBox.max;
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index a6ab62bc..fdc63a05 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -240,9 +240,8 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != nil );
-
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
- if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
+ if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
return STREAM_SUCCESS;
flushStream[channel] = 1;
@@ -293,7 +292,6 @@ CdStreamGetStatus(int32 channel)
if ( pChannel->nStatus != STREAM_NONE )
{
int32 status = pChannel->nStatus;
-
pChannel->nStatus = STREAM_NONE;
return status;
@@ -322,15 +320,16 @@ CdStreamSync(int32 channel)
pthread_kill(pChannel->pChannelThread, SIGUSR1);
if (pChannel->bReading) {
pChannel->bLocked = true;
- sem_wait(pChannel->pDoneSemaphore);
+ while (pChannel->bLocked)
+ sem_wait(pChannel->pDoneSemaphore);
}
#else
pChannel->nSectorsToRead = 0;
if (pChannel->bReading) {
pChannel->bLocked = true;
pthread_kill(_gCdStreamThread, SIGUSR1);
- sem_wait(pChannel->pDoneSemaphore);
-
+ while (pChannel->bLocked)
+ sem_wait(pChannel->pDoneSemaphore);
}
#endif
pChannel->bReading = false;
@@ -341,8 +340,8 @@ CdStreamSync(int32 channel)
if ( pChannel->nSectorsToRead != 0 )
{
pChannel->bLocked = true;
-
- sem_wait(pChannel->pDoneSemaphore);
+ while (pChannel->bLocked)
+ sem_wait(pChannel->pDoneSemaphore);
}
pChannel->bReading = false;
@@ -443,9 +442,9 @@ void *CdStreamThread(void *param)
#endif
pChannel->nSectorsToRead = 0;
-
if ( pChannel->bLocked )
{
+ pChannel->bLocked = 0;
sem_post(pChannel->pDoneSemaphore);
}
pChannel->bReading = false;
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index 5b57cb73..a47ca3cf 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -406,8 +406,8 @@ CFireManager::ExtinguishPointWithWater(CVector point, float range)
CFire *fireToExtinguish = &m_aFires[fireI];
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
CVector steamPos = fireToExtinguish->m_vecPos +
- CVector((CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
- (CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
+ CVector((CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
+ (CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
CGeneral::GetRandomNumber() / 200.f);
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, steamPos, CVector(0.f, 0.f, 0.2f), nil, 0.5f);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 59649e93..4eda2301 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -37,6 +37,7 @@
#include "Messages.h"
#include "FileLoader.h"
#include "User.h"
+#include "sampman.h"
// TODO(Miami): Remove that!! That was my map implementation for III, instead use MAP_ENHACEMENTS on some places
#define CUSTOM_MAP
@@ -376,8 +377,7 @@ CMenuManager::CMenuManager()
m_bShowMouse = true;
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
- // TODO(Miami)
- // DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
+ DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
m_bMenuActive = false;
m_bActivateSaveMenu = false;
m_bWantToLoad = false;
@@ -426,9 +426,7 @@ CMenuManager::Initialise(void)
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
m_PrefsRadioStation = DMAudio.GetRadioInCar();
-
- // TODO(Miami)
- // DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
+ DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK)
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
@@ -570,6 +568,7 @@ CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
m_nMousePosY > y1 && m_nMousePosY < y2;
}
+// --MIAMI: Done
void
CMenuManager::CheckSliderMovement(int value)
{
@@ -587,14 +586,27 @@ CMenuManager::CheckSliderMovement(int value)
CRenderer::ms_lodDistScale = m_PrefsLOD;
break;
case MENUACTION_MUSICVOLUME:
- m_PrefsMusicVolume += value * (128/32);
- m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
- DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
+ if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
+ m_PrefsMusicVolume += value * (128 / 32);
+ m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
+ DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
+ }
break;
case MENUACTION_SFXVOLUME:
- m_PrefsSfxVolume += value * (128/32);
- m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
- DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
+ if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
+ m_PrefsSfxVolume += value * (128 / 32);
+ m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
+ DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
+ }
+ break;
+ case MENUACTION_MP3VOLUMEBOOST:
+ if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
+ if (DMAudio.IsMP3RadioChannelAvailable()) {
+ m_PrefsMP3BoostVolume += value * (128 / 32);
+ m_PrefsMP3BoostVolume = clamp(m_PrefsMP3BoostVolume, 0, 65);
+ DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
+ }
+ }
break;
case MENUACTION_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
@@ -1065,20 +1077,17 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
else if (m_nPrefsAudio3DProviderIndex == -1)
rightText = TheText.Get("FEA_ADP");
else {
- char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
- if (provider != NULL) {
- if (!strcmp(strupr(provider), "DIRECTSOUND3D HARDWARE SUPPORT")) {
- strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
- }
- else if (!strcmp(strupr(provider), "DIRECTSOUND3D SOFTWARE EMULATION")) {
- strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
- }
- AsciiToUnicode(provider, unicodeTemp);
- rightText = unicodeTemp;
- }
- else {
- rightText = TheText.Get("not defined");
+ char *rawProvider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
+ AsciiToUnicode(rawProvider, unicodeTemp);
+ char *provider = UnicodeToAscii(unicodeTemp); // genius
+ strupr(provider);
+ if (!strcmp(provider, "DIRECTSOUND3D HARDWARE SUPPORT")) {
+ strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
+ } else if (!strcmp(provider, "DIRECTSOUND3D SOFTWARE EMULATION")) {
+ strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
}
+ AsciiToUnicode(provider, unicodeTemp);
+ rightText = unicodeTemp;
}
break;
case MENUACTION_SPEAKERCONF: {
@@ -4007,6 +4016,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
if (selectedProvider != NO_AUDIO_PROVIDER) {
if (selectedProvider == -1)
selectedProvider = m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders();
+
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
if (selectedProvider != m_nPrefsAudio3DProviderIndex) {
SetHelperText(5);
@@ -4039,7 +4049,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
m_PrefsMP3BoostVolume = 0;
m_PrefsStereoMono = 1;
m_PrefsSpeakers = 0;
- // DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume); // TODO(Miami)
+ DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -4180,11 +4190,36 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
break;
#endif
case MENUACTION_AUDIOHW:
- // TODO(Miami): What are the extra things in here??
-
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
m_nPrefsAudio3DProviderIndex += changeAmount;
- m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
+
+ bool checkIfForbidden = true;
+ while (checkIfForbidden) {
+ checkIfForbidden = false;
+
+ if (m_nPrefsAudio3DProviderIndex < -1)
+ m_nPrefsAudio3DProviderIndex = DMAudio.GetNum3DProvidersAvailable() - 1;
+ else if (m_nPrefsAudio3DProviderIndex > DMAudio.GetNum3DProvidersAvailable() - 1)
+ m_nPrefsAudio3DProviderIndex = -1;
+
+ // what a retarded move...
+ if (m_nPrefsAudio3DProviderIndex != -1) {
+ char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
+ strupr(provider);
+ if (!strcmp(provider, "MILES FAST 2D POSITIONAL AUDIO")) {
+ m_nPrefsAudio3DProviderIndex += changeAmount;
+ checkIfForbidden = true;
+
+ } else if (!strcmp(provider, "AUREAL A3D 2.0 (TM)")) {
+ m_nPrefsAudio3DProviderIndex += changeAmount;
+ checkIfForbidden = true;
+
+ } else if (!strcmp(provider, "AUREAL A3D INTERACTIVE (TM)")) {
+ m_nPrefsAudio3DProviderIndex += changeAmount;
+ checkIfForbidden = true;
+ }
+ }
+ }
}
break;
case MENUACTION_SPEAKERCONF:
@@ -4543,19 +4578,13 @@ CMenuManager::UnloadTextures()
CUserDisplay::PlaceName.ProcessAfterFrontEndShutDown();
}
+// --MIAMI: Done
void
CMenuManager::WaitForUserCD()
{
CSprite2d *splash;
char *splashscreen = nil;
-#if (!(defined RANDOMSPLASH) && !(defined GTA3_1_1_PATCH))
- if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
- splashscreen = "mainsc2";
- else
- splashscreen = "mainsc1";
-#endif
-
splash = LoadSplash(splashscreen);
if (RsGlobal.quit)
@@ -4707,6 +4736,53 @@ CMenuManager::PrintMap(void)
}
CRadar::DrawBlips();
+ if (m_PrefsShowLegends) {
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(84.0f));
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetColor(CRGBA(255, 150, 225, FadeIn(255)));
+ CFont::SetDropShadowPosition(2);
+ CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
+ CFont::SetCentreOn();
+ CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetScale(SCREEN_SCALE_X(0.65f), SCREEN_SCALE_Y(0.95f));
+
+ int secondColumnStart = (CRadar::MapLegendCounter - 1) / 2;
+ int boxBottom = MENU_Y(100.0f);
+
+ // + 3, because we want 19*3 px padding
+ for (int i = 0; i < secondColumnStart + 3; i++) {
+ boxBottom += MENU_Y(19.f);
+ }
+
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(95.0f), MENU_Y(100.0f), MENU_X_LEFT_ALIGNED(555.f), boxBottom),
+ CRGBA(0, 0, 0, FadeIn(190)));
+
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), MENU_Y(102.0f), TheText.Get("FE_MLG"));
+ CFont::SetRightJustifyOff();
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
+ if (m_PrefsLanguage == LANGUAGE_AMERICAN)
+ CFont::SetScale(SCREEN_SCALE_X(0.55f), SCREEN_SCALE_Y(0.55f));
+ else
+ CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.55f));
+
+ CFont::SetColor(CRGBA(225, 225, 225, FadeIn(255)));
+ CFont::SetDropShadowPosition(0);
+
+ int y = MENU_Y(127.0f);
+ int x = MENU_X_LEFT_ALIGNED(160.0f);
+
+ for (int16 i = 0; i < CRadar::MapLegendCounter; i++) {
+ CRadar::DrawLegend(x, y, CRadar::MapLegendList[i]);
+
+ if (i == secondColumnStart) {
+ x = MENU_X_LEFT_ALIGNED(350.0f);
+ y = MENU_Y(127.0f);
+ } else {
+ y += MENU_Y(19.0f);
+ }
+ }
+ }
#ifdef CUSTOM_MAP
CVector2D mapPoint;
@@ -4785,7 +4861,7 @@ CMenuManager::PrintMap(void)
#endif
m_bMenuMapActive = false;
- CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(5.0f));
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(10.0f));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(10.0f));
DisplayHelperText("FEH_MPH");
}
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 01f5bb9b..9f9f81b6 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -436,6 +436,7 @@ public:
bool GetLeftShockJustDown() { return !!(NewState.LeftShock && !OldState.LeftShock); }
bool GetRightShockJustDown() { return !!(NewState.RightShock && !OldState.RightShock); }
bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); }
+ bool GetSelectJustDown() { return !!(NewState.Select && !OldState.Select); }
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
@@ -461,6 +462,7 @@ public:
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
bool GetStart() { return !!NewState.Start; }
+ bool GetSelect() { return !!NewState.Select; }
int16 GetLeftStickX(void) { return NewState.LeftStickX; }
int16 GetLeftStickY(void) { return NewState.LeftStickY; }
int16 GetRightStickX(void) { return NewState.RightStickX; }
@@ -478,4 +480,4 @@ public:
};
VALIDATE_SIZE(CPad, 0xFC);
-extern CPad Pads[MAX_PADS]; \ No newline at end of file
+extern CPad Pads[MAX_PADS];
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index fe2cf7ad..b25fa4e1 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -2,6 +2,7 @@
#include "Pools.h"
+#include "Bike.h"
#include "Boat.h"
#include "CarCtrl.h"
#ifdef MISSION_REPLAY
@@ -13,6 +14,8 @@
#include "Wanted.h"
#include "World.h"
+//--MIAMI: file done
+
CCPtrNodePool *CPools::ms_pPtrNodePool;
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
CPedPool *CPools::ms_pPedPool;
@@ -24,7 +27,6 @@ CDummyPool *CPools::ms_pDummyPool;
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
CColModelPool *CPools::ms_pColModelPool;
-//--MIAMI: done
void
CPools::Initialise(void)
{
@@ -40,7 +42,6 @@ CPools::Initialise(void)
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
}
-//--MIAMI: done
void
CPools::ShutDown(void)
{
@@ -119,7 +120,8 @@ void CPools::LoadVehiclePool(uint8* buf, uint32 size)
INITSAVEBUF
int nNumCars = ReadSaveBuf<int>(buf);
int nNumBoats = ReadSaveBuf<int>(buf);
- for (int i = 0; i < nNumCars + nNumBoats; i++) {
+ int nNumBikes = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nNumCars + nNumBoats + nNumBikes; i++) {
uint32 type = ReadSaveBuf<uint32>(buf);
int16 model = ReadSaveBuf<int16>(buf);
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
@@ -131,13 +133,15 @@ INITSAVEBUF
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
else if (type == VEHICLE_TYPE_CAR)
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
+ else if (type == VEHICLE_TYPE_BIKE)
+ pVehicle = new(slot) CBike(model, RANDOM_VEHICLE);
else
assert(0);
--CCarCtrl::NumRandomCars;
pVehicle->Load(buf);
CWorld::Add(pVehicle);
#else
- char* vbuf = new char[Max(CAutomobile::nSaveStructSize, CBoat::nSaveStructSize)];
+ char* vbuf = new char[Max(CBike::nSaveStructSize, Max(CAutomobile::nSaveStructSize, CBoat::nSaveStructSize))];
if (type == VEHICLE_TYPE_BOAT) {
memcpy(vbuf, buf, sizeof(CBoat));
SkipSaveBuf(buf, sizeof(CBoat));
@@ -156,6 +160,17 @@ INITSAVEBUF
pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
pAutomobile->SetupDamageAfterLoad();
}
+ else if (type == VEHICLE_TYPE_BIKE) {
+#ifdef FIX_BUGS
+ memcpy(vbuf, buf, sizeof(CBike));
+#else
+ memcpy(vbuf, buf, sizeof(CAutomobile));
+#endif
+ SkipSaveBuf(buf, sizeof(CBike));
+ CBike* pBike = new(slot) CBike(model, RANDOM_VEHICLE);
+ pVehicle = pBike;
+ --CCarCtrl::NumRandomCars;
+ }
else
assert(0);
CVehicle* pBufferVehicle = (CVehicle*)vbuf;
@@ -193,6 +208,7 @@ INITSAVEBUF
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
+ CCarCtrl::UpdateCarCount(pVehicle, false);
CWorld::Add(pVehicle);
delete[] vbuf;
#endif
@@ -205,6 +221,7 @@ void CPools::SaveVehiclePool(uint8* buf, uint32* size)
INITSAVEBUF
int nNumCars = 0;
int nNumBoats = 0;
+ int nNumBikes = 0;
int nPoolSize = GetVehiclePool()->GetSize();
for (int i = 0; i < nPoolSize; i++) {
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
@@ -226,19 +243,25 @@ INITSAVEBUF
++nNumCars;
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
++nNumBoats;
+ if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumBoats;
#else
if (!pVehicle->pDriver && !bHasPassenger) {
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumCars;
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumBoats;
+ if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
+ ++nNumBoats;
#endif
}
}
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
- nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBoat::nSaveStructSize) + sizeof(int);
+ nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBoat::nSaveStructSize) + sizeof(int) +
+ nNumBikes * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBike::nSaveStructSize) + sizeof(int);
WriteSaveBuf(buf, nNumCars);
WriteSaveBuf(buf, nNumBoats);
+ WriteSaveBuf(buf, nNumBikes);
for (int i = 0; i < nPoolSize; i++) {
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
if (!pVehicle)
@@ -258,9 +281,9 @@ INITSAVEBUF
#endif
#ifdef COMPATIBLE_SAVES
#ifdef MISSION_REPLAY
- if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+ if ((pVehicle->IsCar() || pVehicle->IsBoat() || pVehicle->IsBike()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
#else
- if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+ if ((pVehicle->IsCar() || pVehicle->IsBoat() || pVehicle->IsBike()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
#endif
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
@@ -290,6 +313,17 @@ INITSAVEBUF
memcpy(buf, pVehicle, sizeof(CBoat));
SkipSaveBuf(buf, sizeof(CBoat));
}
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
+ if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
+ WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
+ WriteSaveBuf(buf, pVehicle->GetModelIndex());
+ WriteSaveBuf(buf, GetVehicleRef(pVehicle));
+ memcpy(buf, pVehicle, sizeof(CBike));
+ SkipSaveBuf(buf, sizeof(CBike));
+ }
#endif
}
}
@@ -311,8 +345,9 @@ INITSAVEBUF
++nObjects;
}
*size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrix) +
- sizeof(float) + sizeof(CCompressedMatrix) + sizeof(int8) + 7 * sizeof(bool) + sizeof(float) +
- sizeof(int8) + sizeof(int8) + sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
+ sizeof(float) + sizeof(CCompressedMatrix) + sizeof(int8) + 7 * sizeof(bool) + sizeof(int16) +
+ + sizeof(int8) * 2 + sizeof(float) + sizeof(int8) + sizeof(int8) +
+ sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
CopyToBuf(buf, nObjects);
for (int i = 0; i < nPoolSize; i++) {
CObject* pObject = GetObjectPool()->GetSlot(i);
@@ -343,6 +378,9 @@ INITSAVEBUF
CopyToBuf(buf, bGlassBroken);
CopyToBuf(buf, bHasBeenDamaged);
CopyToBuf(buf, bUseVehicleColours);
+ CopyToBuf(buf, pObject->m_nCostValue);
+ CopyToBuf(buf, pObject->m_nBonusValue);
+ SkipSaveBuf(buf, 1);
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
@@ -392,6 +430,9 @@ INITSAVEBUF
pBufferObject->bHasBeenDamaged = bitFlag;
CopyFromBuf(buf, bitFlag);
pBufferObject->bUseVehicleColours = bitFlag;
+ CopyFromBuf(buf, pBufferObject->m_nCostValue);
+ CopyFromBuf(buf, pBufferObject->m_nBonusValue);
+ SkipSaveBuf(buf, 1);
CopyFromBuf(buf, pBufferObject->m_fCollisionDamageMultiplier);
CopyFromBuf(buf, pBufferObject->m_nCollisionDamageEffect);
CopyFromBuf(buf, pBufferObject->m_nSpecialCollisionResponseCases);
@@ -426,6 +467,8 @@ INITSAVEBUF
(pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
#endif
pObject->bHasCollided = false;
+ pObject->m_nCostValue = pBufferObject->m_nCostValue;
+ pObject->m_nBonusValue = pBufferObject->m_nBonusValue;
CWorld::Add(pObject);
delete[] obuf;
}
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 5317040f..8fe900ae 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -15,6 +15,9 @@
#include "World.h"
#include "Streaming.h"
#include "SpecialFX.h"
+#include "Font.h"
+
+// --MIAMI: file done
float CRadar::m_radarRange;
sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS];
@@ -123,7 +126,7 @@ static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
CRGBA CRadar::ArrowBlipColour1;
CRGBA CRadar::ArrowBlipColour2;
-uint16 CRadar::MapLegendCounter;
+int16 CRadar::MapLegendCounter;
int16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
#ifdef MAP_ENHANCEMENTS
int CRadar::TargetMarkerId = -1;
@@ -153,7 +156,7 @@ void RequestMapSection(int32 x, int32 y)
void RemoveMapSection(int32 x, int32 y)
{
- if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
+ if (x >= 0 && x <= RADAR_NUM_TILES - 1 && y >= 0 && y <= RADAR_NUM_TILES - 1)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
}
@@ -260,7 +263,6 @@ int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &
return edge;
}
-
uint8 CRadar::CalculateBlipAlpha(float dist)
{
if (FrontEndMenuManager.m_bMenuMapActive)
@@ -269,8 +271,8 @@ uint8 CRadar::CalculateBlipAlpha(float dist)
if (dist <= 1.0f)
return 255;
- if (dist <= 5.0f)
- return (128.0f * ((dist - 1.0f) / 4.0f)) + ((1.0f - (dist - 1.0f) / 4.0f) * 255.0f);
+ if (dist <= 10.0f)
+ return (128.0f * ((dist - 1.0f) / 9.0f)) + ((1.0f - (dist - 1.0f) / 9.0f) * 255.0f);
return 128;
}
@@ -507,7 +509,6 @@ void CRadar::DrawBlips()
DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
}
- CEntity *blipEntity = nil;
for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
if (!ms_RadarTrace[blipId].m_bInUse)
continue;
@@ -516,173 +517,65 @@ void CRadar::DrawBlips()
case BLIP_CAR:
case BLIP_CHAR:
case BLIP_OBJECT:
- if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
- || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_GUN) {
+ if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_PROPERTY
+ && (!CTheScripts::bPlayerIsInTheStatium || !FrontEndMenuManager.m_bMenuMapActive))
+ DrawEntityBlip(blipId);
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_CAR:
- blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- case BLIP_CHAR:
- blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- if (blipEntity != nil) {
- if (((CPed*)blipEntity)->InVehicle())
- blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
- }
- break;
- case BLIP_OBJECT:
- blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- default:
- break;
- }
- if (blipEntity) {
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
- if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
- DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
- }
- else {
-#ifdef TRIANGULAR_BLIPS
- const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
- const CVector& blipPos = blipEntity->GetPosition();
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
- }
- }
break;
case BLIP_COORD:
case BLIP_CONTACT_POINT:
- if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
- || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_GUN)
- && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
-
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
- if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
- DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
- }
- else {
-#ifdef TRIANGULAR_BLIPS
- const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
- const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
- }
+ if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_PHONE
+ && (!CTheScripts::bPlayerIsInTheStatium || !FrontEndMenuManager.m_bMenuMapActive))
+ DrawCoordBlip(blipId);
+
break;
default:
break;
}
}
+
+ // New in VC: Always draw Hardware/gun/pay'n spray/save blips
for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
if (!ms_RadarTrace[blipId].m_bInUse)
continue;
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_HARDWARE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN)
+ continue;
+
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR:
case BLIP_CHAR:
case BLIP_OBJECT:
- if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
- && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN) {
+ if (!CTheScripts::bPlayerIsInTheStatium || !FrontEndMenuManager.m_bMenuMapActive)
+ DrawEntityBlip(blipId);
- switch (ms_RadarTrace[blipId].m_eBlipType) {
- case BLIP_CAR:
- blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- case BLIP_CHAR:
- blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- if (blipEntity != nil) {
- if (((CPed*)blipEntity)->InVehicle())
- blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
- }
- break;
- case BLIP_OBJECT:
- blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
- break;
- default:
- break;
- }
+ break;
+ case BLIP_COORD:
+ case BLIP_CONTACT_POINT:
+ if (!CTheScripts::bPlayerIsInTheStatium || !FrontEndMenuManager.m_bMenuMapActive)
+ DrawCoordBlip(blipId);
+
+ break;
+ default:
+ break;
+ }
+ }
- if (blipEntity) {
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
- if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
- DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
- else
-#ifdef TRIANGULAR_BLIPS
- {
- const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
- const CVector& blipPos = blipEntity->GetPosition();
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
- }
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
- }
+ for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
+ if (!ms_RadarTrace[blipId].m_bInUse)
+ continue;
+
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_CAR:
+ case BLIP_CHAR:
+ case BLIP_OBJECT:
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_HARDWARE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_PROPERTY
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN
+ && (!CTheScripts::bPlayerIsInTheStatium || !FrontEndMenuManager.m_bMenuMapActive))
+
+ DrawEntityBlip(blipId);
break;
default:
break;
@@ -695,44 +588,12 @@ void CRadar::DrawBlips()
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_COORD:
case BLIP_CONTACT_POINT:
- if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
- && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN
- && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
-
- uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
- if (CTheScripts::IsDebugOn()) {
- ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
- ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
- if (ms_RadarTrace[blipId].m_Radius < 1.0f)
- ms_RadarTrace[blipId].m_Radius = 5.0f;
- }
- }
- if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
- TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
- float dist = LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
- if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
- DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
- else
-#ifdef TRIANGULAR_BLIPS
- {
- const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
- const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
- uint8 mode = BLIP_MODE_TRIANGULAR_UP;
- if (blipPos.z - pos.z <= 2.0f) {
- if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
- else mode = BLIP_MODE_SQUARE;
- }
- ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
- }
-#else
- ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
-#endif
- }
- }
- }
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_HARDWARE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_PROPERTY
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_PHONE
+ && (!CTheScripts::bPlayerIsInTheStatium || !FrontEndMenuManager.m_bMenuMapActive))
+
+ DrawCoordBlip(blipId);
break;
default:
break;
@@ -740,7 +601,12 @@ void CRadar::DrawBlips()
}
if (FrontEndMenuManager.m_bMenuMapActive) {
CVector2D in, out;
- TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
+ if (!CTheScripts::bPlayerIsInTheStatium)
+ TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
+ else
+ TransformRealWorldPointToRadarSpace(in, CVector2D(-1302.5f, 1332.8f));
+
+ LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
DrawYouAreHereSprite(out.x, out.y);
}
@@ -771,8 +637,6 @@ void CRadar::DrawMap()
void CRadar::DrawRadarMap()
{
- // Game calculates an unused CRect here
-
DrawRadarMask();
// top left ist (0, 0)
@@ -812,14 +676,20 @@ void CRadar::DrawRadarMask()
};
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+#if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
+#else
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+#endif
CVector2D out[8];
CVector2D in;
@@ -840,7 +710,11 @@ void CRadar::DrawRadarMask()
CSprite2d::SetMaskVertices(8, (float *)out);
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
- };
+ }
+#if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
+ RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
+#endif
+
}
void CRadar::DrawRadarSection(int32 x, int32 y)
@@ -858,11 +732,8 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
GetTextureCorners(x, y, worldPoly);
ClipRadarTileCoords(x, y);
- assert(CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y]));
- txd = CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y])->texDict;
- if (txd)
- texture = GetFirstTexture(txd);
- if (texture == nil)
+ if (!CTheScripts::bPlayerIsInTheStatium &&
+ (!(txd = CTxdStore::GetSlot(gRadarTxdIds[x + RADAR_NUM_TILES * y])->texDict) || !(texture = GetFirstTexture(txd))))
return;
for (i = 0; i < 4; i++)
@@ -880,8 +751,15 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
TransformRealWorldToTexCoordSpace(texCoords[i], worldPoly[i], x, y);
TransformRadarPointToScreenSpace(screenPoly[i], radarPoly[i]);
}
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(texture));
- CSprite2d::SetVertices(numVertices, (float*)screenPoly, (float*)texCoords, CRGBA(255, 255, 255, 255));
+
+ if (CTheScripts::bPlayerIsInTheStatium) {
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
+ CSprite2d::SetVertices(numVertices, (float*)screenPoly, (float*)texCoords, CRGBA(204, 204, 204, 255));
+ } else {
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(texture));
+ CSprite2d::SetVertices(numVertices, (float*)screenPoly, (float*)texCoords, CRGBA(255, 255, 255, 255));
+ }
+
// check done above now
// if(numVertices > 2)
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), numVertices);
@@ -907,28 +785,17 @@ void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
{
CVector curPosn[4];
- CVector oldPosn[4];
-
- curPosn[0].x = x - SCREEN_SCALE_X(5.6f);
- curPosn[0].y = y + SCREEN_SCALE_Y(5.6f);
-
- curPosn[1].x = x + SCREEN_SCALE_X(5.6f);
- curPosn[1].y = y + SCREEN_SCALE_Y(5.6f);
-
- curPosn[2].x = x - SCREEN_SCALE_X(5.6f);
- curPosn[2].y = y - SCREEN_SCALE_Y(5.6f);
-
- curPosn[3].x = x + SCREEN_SCALE_X(5.6f);
- curPosn[3].y = y - SCREEN_SCALE_Y(5.6f);
+ const float sizeX = SCREEN_SCALE_X(8.0f);
+ const float correctedAngle = angle - PI / 4.f;
+ const float sizeY = SCREEN_SCALE_Y(8.0f);
for (uint32 i = 0; i < 4; i++) {
- oldPosn[i] = curPosn[i];
-
- curPosn[i].x = x + (oldPosn[i].x - x) * Cos(angle) + (oldPosn[i].y - y) * Sin(angle);
- curPosn[i].y = y - (oldPosn[i].x - x) * Sin(angle) + (oldPosn[i].y - y) * Cos(angle);
+ const float cornerAngle = i * HALFPI + correctedAngle;
+ curPosn[i].x = x + (0.0f * Cos(cornerAngle) + 1.0f * Sin(cornerAngle)) * sizeX;
+ curPosn[i].y = y - (0.0f * Sin(cornerAngle) - 1.0f * Cos(cornerAngle)) * sizeY;
}
- sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
+ sprite->Draw(curPosn[3].x, curPosn[3].y, curPosn[2].x, curPosn[2].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
}
int32 CRadar::GetActualBlipArrayIndex(int32 i)
@@ -954,43 +821,43 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{
int32 c;
switch (color) {
- case 0:
+ case RADAR_TRACE_RED:
if (bright)
c = 0x712B49FF;
else
c = 0x7F0000FF;
break;
- case 1:
+ case RADAR_TRACE_GREEN:
if (bright)
c = 0x5FA06AFF;
else
c = 0x007F00FF;
break;
- case 2:
+ case RADAR_TRACE_LIGHT_BLUE:
if (bright)
c = 0x80A7F3FF;
else
c = 0x00007FFF;
break;
- case 3:
+ case RADAR_TRACE_GRAY:
if (bright)
c = 0xE1E1E1FF;
else
c = 0x7F7F7FFF;
break;
- case 4:
+ case RADAR_TRACE_YELLOW:
if (bright)
c = 0xFFFF00FF;
else
c = 0x7F7F00FF;
break;
- case 5:
+ case RADAR_TRACE_MAGENTA:
if (bright)
c = 0xFF00FFFF;
else
c = 0x7F007FFF;
break;
- case 6:
+ case RADAR_TRACE_CYAN:
if (bright)
c = 0x00FFFFFF;
else
@@ -1055,12 +922,65 @@ void CRadar::LoadAllRadarBlips(uint8 *buf, uint32 size)
INITSAVEBUF
CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
- for (int i = 0; i < NUMRADARBLIPS; i++)
- ms_RadarTrace[i] = ReadSaveBuf<sRadarTrace>(buf);
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ ms_RadarTrace[i].m_nColor = ReadSaveBuf<uint32>(buf);
+ ms_RadarTrace[i].m_Radius = ReadSaveBuf<float>(buf);
+ ms_RadarTrace[i].m_eBlipType = ReadSaveBuf<uint32>(buf);
+ ms_RadarTrace[i].m_nEntityHandle = ReadSaveBuf<int32>(buf);
+ ms_RadarTrace[i].m_vec2DPos.x = ReadSaveBuf<float>(buf); // CVector2D
+ ms_RadarTrace[i].m_vec2DPos.y = ReadSaveBuf<float>(buf);
+ ms_RadarTrace[i].m_vecPos = ReadSaveBuf<CVector>(buf);
+ ms_RadarTrace[i].m_BlipIndex = ReadSaveBuf<uint16>(buf);
+ ms_RadarTrace[i].m_bDim = ReadSaveBuf<bool>(buf);
+ ms_RadarTrace[i].m_bInUse = ReadSaveBuf<bool>(buf);
+ ms_RadarTrace[i].m_bShortRange = ReadSaveBuf<bool>(buf);
+ ms_RadarTrace[i].m_unused = ReadSaveBuf<bool>(buf);
+ ms_RadarTrace[i].m_wScale = ReadSaveBuf<int16>(buf);
+ ms_RadarTrace[i].m_eBlipDisplay = ReadSaveBuf<uint16>(buf);
+ ms_RadarTrace[i].m_eRadarSprite = ReadSaveBuf<uint16>(buf);
+ }
VALIDATESAVEBUF(size);
}
+void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
+{
+ *size = SAVE_HEADER_SIZE + NUMRADARBLIPS * sizeof(sRadarTraceSave);
+
+INITSAVEBUF
+ WriteSaveHeader(buf, 'R', 'D', 'R', '\0', *size - SAVE_HEADER_SIZE);
+
+#ifdef MAP_ENHANCEMENTS
+ if (TargetMarkerId != -1) {
+ ClearBlip(TargetMarkerId);
+ TargetMarkerId = -1;
+ }
+#endif
+
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ sRadarTraceSave *saveStruct = (sRadarTraceSave*) buf;
+
+ saveStruct->m_nColor = ms_RadarTrace[i].m_nColor;
+ saveStruct->m_Radius = ms_RadarTrace[i].m_Radius;
+ saveStruct->m_eBlipType = ms_RadarTrace[i].m_eBlipType;
+ saveStruct->m_nEntityHandle = ms_RadarTrace[i].m_nEntityHandle;
+ saveStruct->m_vec2DPos = ms_RadarTrace[i].m_vec2DPos;
+ saveStruct->m_vecPos = ms_RadarTrace[i].m_vecPos;
+ saveStruct->m_BlipIndex = ms_RadarTrace[i].m_BlipIndex;
+ saveStruct->m_bDim = ms_RadarTrace[i].m_bDim;
+ saveStruct->m_bInUse = ms_RadarTrace[i].m_bInUse;
+ saveStruct->m_bShortRange = ms_RadarTrace[i].m_bShortRange;
+ saveStruct->m_unused = ms_RadarTrace[i].m_unused;
+ saveStruct->m_wScale = ms_RadarTrace[i].m_wScale;
+ saveStruct->m_eBlipDisplay = ms_RadarTrace[i].m_eBlipDisplay;
+ saveStruct->m_eRadarSprite = ms_RadarTrace[i].m_eRadarSprite;
+
+ SkipSaveBuf(buf, sizeof(sRadarTraceSave));
+ }
+
+VALIDATESAVEBUF(*size);
+}
+
void
CRadar::LoadTextures()
{
@@ -1115,25 +1035,6 @@ void CRadar::RemoveRadarSections()
RemoveMapSection(i, j);
}
-void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
-{
- *size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
-INITSAVEBUF
- WriteSaveHeader(buf, 'R', 'D', 'R', '\0', *size - SAVE_HEADER_SIZE);
-
-#ifdef MAP_ENHANCEMENTS
- if (TargetMarkerId != -1) {
- ClearBlip(TargetMarkerId);
- TargetMarkerId = -1;
- }
-#endif
-
- for (int i = 0; i < NUMRADARBLIPS; i++)
- WriteSaveBuf(buf, ms_RadarTrace[i]);
-
-VALIDATESAVEBUF(*size);
-}
-
void CRadar::SetBlipSprite(int32 i, int32 icon)
{
int index = CRadar::GetActualBlipArrayIndex(i);
@@ -1142,7 +1043,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
}
}
-int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
+int CRadar::SetCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay display)
{
int nextBlip;
for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
@@ -1154,7 +1055,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
return -1;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = type;
- ms_RadarTrace[nextBlip].m_nColor = color;
+ ms_RadarTrace[nextBlip].m_nColor = RADAR_TRACE_MAGENTA;
ms_RadarTrace[nextBlip].m_bDim = true;
ms_RadarTrace[nextBlip].m_bInUse = true;
ms_RadarTrace[nextBlip].m_bShortRange = false;
@@ -1168,7 +1069,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
return CRadar::GetNewUniqueBlipIndex(nextBlip);
}
-int CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
+int CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay display)
{
int index = SetCoordBlip(type, pos, color, display);
if (index == -1)
@@ -1177,7 +1078,7 @@ int CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, int32 color, eBl
return index;
}
-int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display)
+int CRadar::SetEntityBlip(eBlipType type, int32 handle, uint32 color, eBlipDisplay display)
{
int nextBlip;
for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
@@ -1189,7 +1090,7 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
return -1;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = type;
- ms_RadarTrace[nextBlip].m_nColor = color;
+ ms_RadarTrace[nextBlip].m_nColor = RADAR_TRACE_YELLOW;
ms_RadarTrace[nextBlip].m_bDim = true;
ms_RadarTrace[nextBlip].m_bInUse = true;
ms_RadarTrace[nextBlip].m_bShortRange = false;
@@ -1261,12 +1162,12 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
switch (mode)
{
case BLIP_MODE_TRIANGULAR_UP:
- // size++; // VC does size + 1 for triangles
+ size++;
CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(size + 3.0f), y + SCREEN_SCALE_Y(size + 2.0f), x - (SCREEN_SCALE_X(size + 3.0f)), y + SCREEN_SCALE_Y(size + 2.0f), x, y - (SCREEN_SCALE_Y(size + 3.0f)), x, y - (SCREEN_SCALE_Y(size + 3.0f)), CRGBA(0, 0, 0, alpha));
CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(size + 1.0f), y + SCREEN_SCALE_Y(size + 1.0f), x - (SCREEN_SCALE_X(size + 1.0f)), y + SCREEN_SCALE_Y(size + 1.0f), x, y - (SCREEN_SCALE_Y(size + 1.0f)), x, y - (SCREEN_SCALE_Y(size + 1.0f)), CRGBA(red, green, blue, alpha));
break;
case BLIP_MODE_TRIANGULAR_DOWN:
- // size++; // VC does size + 1 for triangles
+ size++;
CSprite2d::Draw2DPolygon(x, y + SCREEN_SCALE_Y(size + 2.0f), x, y + SCREEN_SCALE_Y(size + 3.0f), x + SCREEN_SCALE_X(size + 3.0f), y - (SCREEN_SCALE_Y(size + 2.0f)), x - (SCREEN_SCALE_X(size + 3.0f)), y - (SCREEN_SCALE_Y(size + 2.0f)), CRGBA(0, 0, 0, alpha));
CSprite2d::Draw2DPolygon(x, y + SCREEN_SCALE_Y(size + 1.0f), x, y + SCREEN_SCALE_Y(size + 1.0f), x + SCREEN_SCALE_X(size + 1.0f), y - (SCREEN_SCALE_Y(size + 1.0f)), x - (SCREEN_SCALE_X(size + 1.0f)), y - (SCREEN_SCALE_Y(size + 1.0f)), CRGBA(red, green, blue, alpha));
break;
@@ -1275,21 +1176,6 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
break;
}
-
- // TODO(Miami): Map
- // VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
- if (FrontEndMenuManager.m_bMenuMapActive) {
- bool alreadyThere = false;
- for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
- if (MapLegendList[i] == -1)
- alreadyThere = true;
- }
- if (!alreadyThere) {
- MapLegendList[MapLegendCounter] = -1;
- MapLegendCounter++;
- ArrowBlipColour1 = CRGBA(red, green, blue, alpha);
- }
- }
}
void CRadar::Shutdown()
@@ -1338,7 +1224,8 @@ void CRadar::Shutdown()
void CRadar::StreamRadarSections(const CVector &posn)
{
- StreamRadarSections(Floor((2000.0f + posn.x) / 500.0f), Ceil(7.0f - (2000.0f + posn.y) / 500.0f));
+ if (!CStreaming::ms_disableStreaming)
+ StreamRadarSections(Floor((RADAR_MAX_X + posn.x) / RADAR_TILE_SIZE), Ceil((RADAR_NUM_TILES - 1) - (RADAR_MAX_Y + posn.y) / RADAR_TILE_SIZE));
}
void CRadar::StreamRadarSections(int32 x, int32 y)
@@ -1405,8 +1292,8 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
void
CRadar::CalculateCachedSinCos()
{
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
- || FrontEndMenuManager.m_bMenuMapActive ) {
+ if (/*TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED || */
+ FrontEndMenuManager.m_bMenuMapActive ) {
cachedSin = 0.0f;
cachedCos = 1.0f;
} else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
@@ -1445,7 +1332,7 @@ CRadar::InitFrontEndMap()
void
CRadar::DrawYouAreHereSprite(float x, float y)
{
- static uint32 lastChange = 0;
+ static PauseModeTime lastChange = 0;
static bool show = true;
if (show) {
@@ -1461,13 +1348,30 @@ CRadar::DrawYouAreHereSprite(float x, float y)
}
if (show) {
- float left = x - SCREEN_SCALE_X(12.0f);
- float top = y;
- float right = SCREEN_SCALE_X(12.0) + x;
- float bottom = y - SCREEN_SCALE_Y(24.0f);
- CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
+ const float left = x - SCREEN_SCALE_X(8.0f);
+ const float top = y - SCREEN_SCALE_Y(40.0f);
+ const float right = x + SCREEN_SCALE_X(40.0);
+ const float bottom = y + SCREEN_SCALE_Y(8.0f);
+ MapHereSprite.Draw(CRect(left + SCREEN_SCALE_X(2.f), top + SCREEN_SCALE_Y(2.f), right + SCREEN_SCALE_X(2.f), bottom + SCREEN_SCALE_Y(2.f)),
+ CRGBA(0, 0, 0, 255));
+
+ MapHereSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
+
+ CFont::SetWrapx(right + SCREEN_SCALE_X(28.0f));
+ CFont::SetRightJustifyWrap(right);
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetColor(CRGBA(255, 150, 225, 255));
+ CFont::SetDropShadowPosition(2);
+ CFont::SetDropColor(CRGBA(0, 0, 0, 255));
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOff();
+ CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetScale(SCREEN_SCALE_X(0.65f), SCREEN_SCALE_Y(0.95f));
+ CFont::PrintString(right, top, TheText.Get("MAP_YAH"));
+ CFont::SetDropShadowPosition(0);
+ CFont::DrawFonts();
}
- MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
+ MapLegendList[MapLegendCounter++] = RADAR_SPRITE_MAP_HERE;
}
#ifdef MAP_ENHANCEMENTS
@@ -1485,8 +1389,8 @@ CRadar::ToggleTargetMarker(float x, float y)
return;
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
- ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
- ms_RadarTrace[nextBlip].m_bDim = 1;
+ ms_RadarTrace[nextBlip].m_nColor = RADAR_TRACE_GRAY;
+ ms_RadarTrace[nextBlip].m_bDim = 0;
ms_RadarTrace[nextBlip].m_bInUse = 1;
ms_RadarTrace[nextBlip].m_Radius = 1.0f;
CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));
@@ -1505,3 +1409,287 @@ CRadar::ToggleTargetMarker(float x, float y)
}
#endif
+void
+CRadar::DrawEntityBlip(int32 blipId)
+{
+ CVector2D out;
+ CVector2D in;
+ CEntity *blipEntity;
+ switch (ms_RadarTrace[blipId].m_eBlipType) {
+ case BLIP_CAR:
+ blipEntity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ break;
+ case BLIP_CHAR:
+ blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ if (blipEntity != nil) {
+ if (((CPed*)blipEntity)->InVehicle())
+ blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
+ }
+ break;
+ case BLIP_OBJECT:
+ blipEntity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
+ break;
+ default:
+ break;
+ }
+ if (blipEntity) {
+ uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ if (CTheScripts::IsDebugOn()) {
+ ShowRadarMarker(blipEntity->GetPosition(), color, ms_RadarTrace[blipId].m_Radius);
+ ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
+ if (ms_RadarTrace[blipId].m_Radius < 1.0f)
+ ms_RadarTrace[blipId].m_Radius = 5.0f;
+ }
+ }
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
+ TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
+ float dist = LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
+ } else {
+ const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
+ const CVector& blipPos = blipEntity->GetPosition();
+ uint8 mode = BLIP_MODE_TRIANGULAR_UP;
+ if (blipPos.z - pos.z <= 2.0f) {
+ if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
+ else mode = BLIP_MODE_SQUARE;
+ }
+ ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
+
+ if (FrontEndMenuManager.m_bMenuMapActive) {
+ bool alreadyThere = false;
+ for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
+ if (MapLegendList[i] == -2)
+ alreadyThere = true;
+ }
+ if (!alreadyThere) {
+ MapLegendList[MapLegendCounter] = -2;
+ MapLegendCounter++;
+ ArrowBlipColour2 = CRGBA((uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void
+CRadar::DrawCoordBlip(int32 blipId)
+{
+ CVector2D out;
+ CVector2D in;
+ if (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission()) {
+
+ uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
+ if (CTheScripts::IsDebugOn()) {
+ ShowRadarMarker(ms_RadarTrace[blipId].m_vecPos, color, ms_RadarTrace[blipId].m_Radius);
+ ms_RadarTrace[blipId].m_Radius = ms_RadarTrace[blipId].m_Radius - 0.1f;
+ if (ms_RadarTrace[blipId].m_Radius < 1.0f)
+ ms_RadarTrace[blipId].m_Radius = 5.0f;
+ }
+ }
+ if (ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[blipId].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
+ TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
+ float dist = LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
+ } else {
+ const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
+ const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
+ uint8 mode = BLIP_MODE_TRIANGULAR_UP;
+ if (blipPos.z - pos.z <= 2.0f) {
+ if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
+ else mode = BLIP_MODE_SQUARE;
+ }
+ ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
+
+ if (FrontEndMenuManager.m_bMenuMapActive) {
+ bool alreadyThere = false;
+ for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
+ if (MapLegendList[i] == -1)
+ alreadyThere = true;
+ }
+ if (!alreadyThere) {
+ MapLegendList[MapLegendCounter] = -1;
+ MapLegendCounter++;
+ ArrowBlipColour1 = CRGBA((uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void
+CRadar::DrawLegend(int32 x, int32 y, int32 sprite)
+{
+ if (sprite < 0) {
+ static PauseModeTime lastChange = 0;
+ static int8 blipMode = 0;
+
+ CRGBA color;
+ if (sprite == -1) {
+ color = ArrowBlipColour1;
+ } else {
+ color = ArrowBlipColour2;
+ }
+
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 600) {
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ if ( blipMode == 2 )
+ blipMode = 0;
+ else
+ ++blipMode;
+ }
+
+ switch (blipMode) {
+ case BLIP_MODE_TRIANGULAR_UP:
+ CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(14.0f), y + SCREEN_SCALE_Y(13.0f), x + SCREEN_SCALE_X(2.0f), y + SCREEN_SCALE_Y(13.0f), x + SCREEN_SCALE_X(8.f), y + SCREEN_SCALE_Y(2.0f), x + SCREEN_SCALE_X(8.f), y + SCREEN_SCALE_Y(2.0f), CRGBA(0, 0, 0, 255));
+ CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(12.0f), y + SCREEN_SCALE_Y(12.0f), x + SCREEN_SCALE_X(4.0f), y + SCREEN_SCALE_Y(12.0f), x + SCREEN_SCALE_X(8.f), y + SCREEN_SCALE_Y(4.0f), x + SCREEN_SCALE_X(8.f), y + SCREEN_SCALE_Y(4.0f), color);
+ break;
+ case BLIP_MODE_TRIANGULAR_DOWN:
+ CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(14.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(14.0f), x + SCREEN_SCALE_X(2.f), y + SCREEN_SCALE_Y(3.0f), x + SCREEN_SCALE_X(2.f), y + SCREEN_SCALE_Y(3.0f), CRGBA(0, 0, 0, 255));
+ CSprite2d::Draw2DPolygon(x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(12.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(12.0f), x + SCREEN_SCALE_X(12.f), y + SCREEN_SCALE_Y(4.0f), x + SCREEN_SCALE_X(4.f), y + SCREEN_SCALE_Y(4.0f), color);
+ break;
+ case BLIP_MODE_SQUARE:
+ CSprite2d::DrawRect(CRect(x + SCREEN_SCALE_X(4.0f), y + SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_X(12.0f) + x, SCREEN_SCALE_Y(12.0f) + y), CRGBA(0, 0, 0, 255));
+ CSprite2d::DrawRect(CRect(x + SCREEN_SCALE_X(5.0f), y + SCREEN_SCALE_Y(4.0f), SCREEN_SCALE_X(11.0f) + x, SCREEN_SCALE_Y(11.0f) + y), color);
+ break;
+ }
+
+ } else {
+ RadarSprites[sprite]->Draw(CRect(x, y, x + SCREEN_SCALE_X(16.f), y + SCREEN_SCALE_X(16.f)), CRGBA(255, 255, 255, 255));
+ }
+
+ wchar *text;
+ switch ( sprite ) {
+ case RADAR_SPRITE_ENTITY_BLIP:
+ text = TheText.Get("LG_38");
+ break;
+ case RADAR_SPRITE_COORD_BLIP:
+ text = TheText.Get("LG_35");
+ break;
+ case RADAR_SPRITE_MAP_HERE:
+ text = TheText.Get("LG_01");
+ break;
+ case RADAR_SPRITE_AVERY:
+ text = TheText.Get("LG_02");
+ break;
+ case RADAR_SPRITE_BIKER:
+ text = TheText.Get("LG_03");
+ break;
+ case RADAR_SPRITE_CORTEZ:
+ text = TheText.Get("LG_04");
+ break;
+ case RADAR_SPRITE_DIAZ:
+ text = TheText.Get("LG_05");
+ break;
+ case RADAR_SPRITE_KENT:
+ text = TheText.Get("LG_06");
+ break;
+ case RADAR_SPRITE_LAWYER:
+ text = TheText.Get("LG_07");
+ break;
+ case RADAR_SPRITE_PHIL:
+ text = TheText.Get("LG_08");
+ break;
+ case RADAR_SPRITE_BIKERS:
+ text = TheText.Get("LG_03");
+ break;
+ case RADAR_SPRITE_BOATYARD:
+ text = TheText.Get("LG_09");
+ break;
+ case RADAR_SPRITE_MALIBU_CLUB:
+ text = TheText.Get("LG_10");
+ break;
+ case RADAR_SPRITE_CUBANS:
+ text = TheText.Get("LG_11");
+ break;
+ case RADAR_SPRITE_FILM:
+ text = TheText.Get("LG_12");
+ break;
+ case RADAR_SPRITE_GUN:
+ text = TheText.Get("LG_13");
+ break;
+ case RADAR_SPRITE_HAITIANS:
+ text = TheText.Get("LG_14");
+ break;
+ case RADAR_SPRITE_HARDWARE:
+ text = TheText.Get("LG_15");
+ break;
+ case RADAR_SPRITE_SAVE:
+ text = TheText.Get("LG_16");
+ break;
+ case RADAR_SPRITE_STRIP:
+ text = TheText.Get("LG_37");
+ break;
+ case RADAR_SPRITE_ICE:
+ text = TheText.Get("LG_17");
+ break;
+ case RADAR_SPRITE_KCABS:
+ text = TheText.Get("LG_18");
+ break;
+ case RADAR_SPRITE_LOVEFIST:
+ text = TheText.Get("LG_19");
+ break;
+ case RADAR_SPRITE_PRINTWORKS:
+ text = TheText.Get("LG_20");
+ break;
+ case RADAR_SPRITE_PROPERTY:
+ text = TheText.Get("LG_21");
+ break;
+ case RADAR_SPRITE_SUNYARD:
+ text = TheText.Get("LG_36");
+ break;
+ case RADAR_SPRITE_SPRAY:
+ text = TheText.Get("LG_22");
+ break;
+ case RADAR_SPRITE_TSHIRT:
+ text = TheText.Get("LG_23");
+ break;
+ case RADAR_SPRITE_TOMMY:
+ text = TheText.Get("LG_24");
+ break;
+ case RADAR_SPRITE_PHONE:
+ text = TheText.Get("LG_25");
+ break;
+ case RADAR_SPRITE_RADIO_WILDSTYLE:
+ text = TheText.Get("LG_26");
+ break;
+ case RADAR_SPRITE_RADIO_FLASH:
+ text = TheText.Get("LG_27");
+ break;
+ case RADAR_SPRITE_RADIO_KCHAT:
+ text = TheText.Get("LG_28");
+ break;
+ case RADAR_SPRITE_RADIO_FEVER:
+ text = TheText.Get("LG_29");
+ break;
+ case RADAR_SPRITE_RADIO_VROCK:
+ text = TheText.Get("LG_30");
+ break;
+ case RADAR_SPRITE_RADIO_VCPR:
+ text = TheText.Get("LG_31");
+ break;
+ case RADAR_SPRITE_RADIO_ESPANTOSO:
+ text = TheText.Get("LG_32");
+ break;
+ case RADAR_SPRITE_RADIO_EMOTION:
+ text = TheText.Get("LG_33");
+ break;
+ case RADAR_SPRITE_RADIO_WAVE:
+ text = TheText.Get("LG_34");
+ break;
+ default:
+ break;
+ }
+ CFont::PrintString(SCREEN_SCALE_X(20.f) + x, SCREEN_SCALE_Y(3.0f) + y, text);
+}
diff --git a/src/core/Radar.h b/src/core/Radar.h
index 100da8f3..8f2e7069 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -98,6 +98,17 @@ enum eRadarSprite
enum
{
+ RADAR_TRACE_RED,
+ RADAR_TRACE_GREEN,
+ RADAR_TRACE_LIGHT_BLUE,
+ RADAR_TRACE_GRAY,
+ RADAR_TRACE_YELLOW,
+ RADAR_TRACE_MAGENTA,
+ RADAR_TRACE_CYAN
+};
+
+enum
+{
BLIP_MODE_TRIANGULAR_UP = 0,
BLIP_MODE_TRIANGULAR_DOWN,
BLIP_MODE_SQUARE,
@@ -108,17 +119,39 @@ struct sRadarTrace
uint32 m_nColor;
uint32 m_eBlipType; // eBlipType
int32 m_nEntityHandle;
- CVector2D m_vec2DPos;
+ CVector m_vec2DPos;
CVector m_vecPos;
uint16 m_BlipIndex;
bool m_bDim;
bool m_bInUse;
bool m_bShortRange;
+ bool m_unused;
+ float m_Radius;
+ int16 m_wScale;
+ uint16 m_eBlipDisplay; // eBlipDisplay
+ uint16 m_eRadarSprite; // eRadarSprite
+};
+
+// Either that was a thing while saving/loading blips, or they added sizes of each field one by one. I want to do the former.
+#pragma pack(push,1)
+struct sRadarTraceSave
+{
+ uint32 m_nColor;
float m_Radius;
+ uint32 m_eBlipType; // eBlipType
+ int32 m_nEntityHandle;
+ CVector2D m_vec2DPos;
+ CVector m_vecPos;
+ uint16 m_BlipIndex;
+ bool m_bDim;
+ bool m_bInUse;
+ bool m_bShortRange;
+ bool m_unused;
int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
+#pragma pack(pop)
// Values for screen space
#define RADAR_LEFT (40.0f)
@@ -176,7 +209,7 @@ public:
static CRGBA ArrowBlipColour1;
static CRGBA ArrowBlipColour2;
static int16 MapLegendList[NUM_MAP_LEGENDS];
- static uint16 MapLegendCounter;
+ static int16 MapLegendCounter;
#ifdef MAP_ENHANCEMENTS
static int TargetMarkerId;
@@ -215,9 +248,9 @@ public:
static void RemoveRadarSections();
static void SaveAllRadarBlips(uint8*, uint32*);
static void SetBlipSprite(int32 i, int32 icon);
- static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
- static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
- static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
+ static int32 SetCoordBlip(eBlipType type, CVector pos, uint32, eBlipDisplay);
+ static int32 SetEntityBlip(eBlipType type, int32, uint32, eBlipDisplay);
+ static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32, eBlipDisplay);
static void SetRadarMarkerState(int32 i, bool flag);
static void ShowRadarMarker(CVector pos, uint32 color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha);
@@ -229,7 +262,8 @@ public:
static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in);
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
-
- // no in CRadar in the game:
static void CalculateCachedSinCos();
+ static void DrawEntityBlip(int32 blipId);
+ static void DrawCoordBlip(int32 blipId);
+ static void DrawLegend(int32, int32, int32);
};
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index ddde4664..40d4acee 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -903,7 +903,7 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
int i, n;
mi = CModelInfo::GetModelInfo(modelId);
- if(!CGeneral::faststrcmp("CSPlay", modelName)){
+ if(strncasecmp("CSPlay", modelName, 6) == 0){
char *curname = CModelInfo::GetModelInfo(MI_PLAYER)->GetName();
for(int i = 0; CSnames[i][0]; i++){
if(strcasecmp(curname, IGnames[i]) == 0){
diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp
index e12b48dd..203d24d0 100644
--- a/src/core/TempColModels.cpp
+++ b/src/core/TempColModels.cpp
@@ -22,7 +22,11 @@ CColModel CTempColModels::ms_colModelWeapon;
CColSphere s_aPedSpheres[3];
CColSphere s_aPed2Spheres[3];
CColSphere s_aPedGSpheres[4];
+#ifdef FIX_BUGS
+CColSphere s_aDoorSpheres[3];
+#else
CColSphere s_aDoorSpheres[4];
+#endif
CColSphere s_aBumperSpheres[4];
CColSphere s_aPanelSpheres[4];
CColSphere s_aBonnetSpheres[4];
@@ -130,7 +134,11 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[1].center = CVector(0.0f, -0.95f, -0.35f);
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
+#ifdef FIX_BUGS
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) {
+#else
+ for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) {
+#endif
s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL;
s_aDoorSpheres[i].piece = 0;
}
@@ -286,9 +294,13 @@ CTempColModels::Initialise(void)
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
-
- ms_colModelWeapon.boundingSphere.Set(0.25f, CVector(0.0f, 0.0f, 0.0f));
- ms_colModelWeapon.boundingBox.Set(CVector(-0.25f, -0.25, -0.25f), CVector(0.25f, 0.25, 0.25f));
+ ms_colModelWeapon.boundingSphere.radius = 0.25f;
+ ms_colModelWeapon.boundingBox.min.x = -0.25f;
+ ms_colModelWeapon.boundingBox.min.y = -0.25f;
+ ms_colModelWeapon.boundingBox.min.z = -0.25f;
+ ms_colModelWeapon.boundingBox.max.x = 0.25f;
+ ms_colModelWeapon.boundingBox.max.y = 0.25f;
+ ms_colModelWeapon.boundingBox.max.z = 0.25f;
#undef SET_COLMODEL_SPHERES
}
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp
index f60adf07..bdef6187 100644
--- a/src/core/Timer.cpp
+++ b/src/core/Timer.cpp
@@ -5,6 +5,9 @@
#include "DMAudio.h"
#include "Record.h"
#include "Timer.h"
+#include "SpecialFX.h"
+
+// --MIAMI: file done
uint32 CTimer::m_snTimeInMilliseconds;
PauseModeTime CTimer::m_snTimeInMillisecondsPauseMode = 1;
@@ -95,7 +98,7 @@ void CTimer::Update(void)
_oldPerfCounter = pc;
- float updInCyclesScaled = updInCycles * ms_fTimeScale;
+ float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale;
// We need that real frame time to fix transparent menu bug.
#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND
@@ -141,7 +144,7 @@ void CTimer::Update(void)
}
}
- if ( ms_fTimeStep < 0.01f && !GetIsPaused() )
+ if ( ms_fTimeStep < 0.01f && !GetIsPaused() && !CSpecialFX::bSnapShotActive)
ms_fTimeStep = 0.01f;
ms_fTimeStepNonClipped = ms_fTimeStep;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 6d5e8a81..14c06a81 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -79,7 +79,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
+ if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
}
void
@@ -94,7 +94,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
+ if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@@ -1962,7 +1962,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
@@ -1973,7 +1973,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
}
@@ -2133,13 +2133,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
CObject *pObject = (CObject *)pEntity;
CVehicle *pVehicle = (CVehicle *)pEntity;
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
- if(pEntity->IsStatic()) {
+ if(pEntity->GetIsStatic()) {
if(pEntity->IsObject()) {
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if (IsGlass(pObject->GetModelIndex())) {
CGlass::WindowRespondsToExplosion(pObject, position);
} else {
- pObject->bIsStatic = false;
+ pObject->SetIsStatic(false);
pObject->AddToMovingList();
int16 modelId = pEntity->GetModelIndex();
if(modelId != MI_FIRE_HYDRANT ||
@@ -2157,18 +2157,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
}
}
}
- if(pEntity->IsStatic()) {
+ if(pEntity->GetIsStatic()) {
float fDamageMultiplier =
(fRadius - fMagnitude) * 2.0f / fRadius;
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
pObject->ObjectDamage(fDamage);
}
} else {
- pEntity->bIsStatic = false;
+ pEntity->SetIsStatic(false);
pEntity->AddToMovingList();
}
}
- if(!pEntity->IsStatic()) {
+ if(!pEntity->GetIsStatic()) {
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
CVector vecForceDir =
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 288b975e..45fe6fff 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -633,14 +633,17 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
INITSAVEBUF
int i;
+#define CZONE_SAVE_SIZE (sizeof(char)*8+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(eZoneType)+sizeof(eLevelName)+sizeof(int16)+sizeof(int16)+sizeof(int32)+sizeof(int32)+sizeof(int32))
+
*size = SAVE_HEADER_SIZE
+ sizeof(m_CurrLevel) + sizeof(FindIndex)
+ sizeof(int16) // padding
- + sizeof(NavigationZoneArray) + sizeof(InfoZoneArray) + sizeof(ZoneInfoArray)
+ + CZONE_SAVE_SIZE * ARRAY_SIZE(NavigationZoneArray) + CZONE_SAVE_SIZE * ARRAY_SIZE(InfoZoneArray) + sizeof(ZoneInfoArray)
+ sizeof(TotalNumberOfNavigationZones) + sizeof(TotalNumberOfInfoZones) + sizeof(TotalNumberOfZoneInfos)
+ sizeof(int16) // padding
- + sizeof(MapZoneArray) + sizeof(AudioZoneArray)
+ + CZONE_SAVE_SIZE * ARRAY_SIZE(MapZoneArray) + sizeof(AudioZoneArray)
+ sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
+#undef CZONE_SAVE_SIZE
uint32 length = 0;
WriteSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
diff --git a/src/core/Zones.h b/src/core/Zones.h
index 3a74427d..5306d9f1 100644
--- a/src/core/Zones.h
+++ b/src/core/Zones.h
@@ -77,7 +77,7 @@ public:
static CZone *GetInfoZone(uint16 i) { return &InfoZoneArray[i]; }
static CZone *GetNavigationZone(uint16 i) { return &NavigationZoneArray[i]; }
static CZone *GetMapZone(uint16 i) { return &MapZoneArray[i]; }
- static CZone *GetAudioZone(uint16 i) { return &InfoZoneArray[AudioZoneArray[i]]; }
+ static CZone *GetAudioZone(uint16 i) { return &NavigationZoneArray[AudioZoneArray[i]]; }
static void PostZoneCreation(void);
static void CheckZonesForOverlap(void);
static void InsertZoneIntoZoneHierarchy(CZone *zone);
diff --git a/src/core/config.h b/src/core/config.h
index 3f077f4c..770a7c2e 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -172,7 +172,6 @@ enum Config {
# define RANDOMSPLASH
# define VU_COLLISION
#elif defined GTA_PC
-# define GTA3_1_1_PATCH
//# define GTA3_STEAM_PATCH
//# define GTAVC_JP_PATCH
# ifdef GTA_PS2_STUFF
@@ -263,7 +262,6 @@ enum Config {
// Hud, frontend and radar
//#define BETA_SLIDING_TEXT
-#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PC_MENU
#ifndef PC_MENU
@@ -315,9 +313,7 @@ enum Config {
#define FREE_CAM // Rotating cam
// Audio
-#ifndef AUDIO_OAL // is not working yet for openal
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
-#endif
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
diff --git a/src/core/main.cpp b/src/core/main.cpp
index b39a9c8b..012dda2e 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -644,7 +644,7 @@ ProcessSlowMode(void)
do
{
- if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() )
+ if ( CPad::GetPad(1)->GetSelectJustDown() || CPad::GetPad(1)->GetStart() )
break;
if ( stop )
@@ -658,10 +658,7 @@ ProcessSlowMode(void)
RwCameraBeginUpdate(Scene.camera);
RwCameraEndUpdate(Scene.camera);
- if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() )
- break;
-
- } while (!CPad::GetPad(1)->GetRightShoulder1());
+ } while (!CPad::GetPad(1)->GetSelectJustDown() && !CPad::GetPad(1)->GetStart());
CPad::GetPad(0)->OldState.LeftStickX = lX;
@@ -714,22 +711,32 @@ int32 FrameSamples;
struct tZonePrint
{
- char name[12];
- CRect rect;
+ char name[11];
+ char area[5];
+ CRect rect;
};
tZonePrint ZonePrint[] =
{
- { "suburban", CRect(-1639.4f, 1014.3f, -226.23f, -1347.9f) },
- { "comntop", CRect(-223.52f, 203.62f, 616.79f, -413.6f) },
- { "comnbtm", CRect(-227.24f, -413.6f, 620.51f, -911.84f) },
- { "comse", CRect( 200.35f, -911.84f, 620.51f, -1737.3f) },
- { "comsw", CRect(-223.52f, -911.84f, 200.35f, -1737.3f) },
- { "industsw", CRect( 744.05f, -473.0f, 1067.5f, -1331.5f) },
- { "industne", CRect( 1067.5f, 282.19f, 1915.3f, -473.0f) },
- { "industnw", CRect( 744.05f, 324.95f, 1067.5f, -473.0f) },
- { "industse", CRect( 1070.3f, -473.0f, 1918.1f, -1331.5f) },
- { "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
+ { "DOWNTOWN", "GM", CRect(-1500.0f, 1500.0f, -300.0f, 980.0f)},
+ { "DOWNTOWS", "KB", CRect(-1200.0f, 980.0f, -300.0f, 435.0f)},
+ { "GOLF", "NT", CRect(-300.0f, 660.0f, 320.0f, -255.0f)},
+ { "LITTLEHA", "AG", CRect(-1250.0f, -310.0f, -746.0f, -926.0f)},
+ { "HAITI", "CJ", CRect(-1355.0f, 30.0f, -637.0f, -304.0f)},
+ { "HAITIN", "SM", CRect(-1355.0f, 435.0f, -637.0f, 30.0f)},
+ { "DOCKS", "AW", CRect(-1122.0f, -926.0f, -609.0f, -1575.0f)},
+ { "AIRPORT", "NT", CRect(-2000.0f, 200.0f, -871.0f, -2000.0f)},
+ { "STARISL", "CJ", CRect(-724.0f, -320.0f, -40.0f, -380.0f)},
+ { "CENT.ISLA", "NT", CRect(-163.0f, 1260.0f, 120.0f, 830.0f)},
+ { "MALL", "AW", CRect( 300.0f, 1266.0f, 483.0f, 995.0f)},
+ { "MANSION", "KB", CRect(-724.0f, -500.0f, -40.0f, -670.0f)},
+ { "NBEACH", "AS", CRect( 120.0f, 1340.0f, 900.0f, 600.0f)},
+ { "NBEACHBT", "AS", CRect( 200.0f, 680.0f, 660.0f, -50.0f)},
+ { "NBEACHW", "AS", CRect(-93.0f, 80.0f, 410.0f, -680.0f)},
+ { "OCEANDRV", "AC", CRect( 200.0f, -964.0f, 955.0f, -1797.0f)},
+ { "OCEANDN", "WS", CRect( 400.0f, 50.0f, 955.0f, -964.0f)},
+ { "WASHINGTN", "AC", CRect(-320.0f, -487.0f, 500.0f, -1200.0f)},
+ { "WASHINBTM", "AC", CRect(-255.0f, -1200.0f, 500.0f, -1690.0f)}
};
#ifndef MASTER
@@ -737,14 +744,12 @@ void
DisplayGameDebugText()
{
static bool bDisplayPosn = false;
- static bool bDisplayRate = false;
- static bool bDisplayCheatStr = false;
+ static bool bDisplayCheatStr = false; // custom
#ifndef FINAL
{
SETTWEAKPATH("GameDebugText");
TWEAKBOOL(bDisplayPosn);
- TWEAKBOOL(bDisplayRate);
TWEAKBOOL(bDisplayCheatStr);
}
#endif
@@ -777,23 +782,8 @@ DisplayGameDebugText()
FramesPerSecondCounter = 0.0f;
FrameSamples = 0;
}
-
- if ( !TheCamera.WorldViewerBeingUsed
- && CPad::GetPad(1)->GetSquare()
- && CPad::GetPad(1)->GetTriangle()
- && CPad::GetPad(1)->GetLeftShoulder2JustDown() )
- {
- bDisplayPosn = !bDisplayPosn;
- }
- if ( CPad::GetPad(1)->GetSquare()
- && CPad::GetPad(1)->GetTriangle()
- && CPad::GetPad(1)->GetRightShoulder2JustDown() )
- {
- bDisplayRate = !bDisplayRate;
- }
-
- if ( bDisplayPosn || bDisplayRate )
+ if ( bDisplayPosn )
{
CVector pos = FindPlayerCoors();
int32 ZoneId = ARRAY_SIZE(ZonePrint)-1; // no zone
@@ -810,43 +800,42 @@ DisplayGameDebugText()
}
//NOTE: fps should be 30, but its 29 due to different fp2int conversion
- if ( bDisplayRate )
- sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, F-%d, %s", pos.x, pos.y, pos.z, (int32)FramesPerSecond, ZonePrint[ZoneId].name);
- else
- sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, %s", pos.x, pos.y, pos.z, ZonePrint[ZoneId].name);
-
+ sprintf(str, "X:%4.0f Y:%4.0f Z:%4.0f F-%d %s-%s", pos.x, pos.y, pos.z, (int32)FramesPerSecond,
+ ZonePrint[ZoneId].name, ZonePrint[ZoneId].area);
+
AsciiToUnicode(str, ustr);
- // Let's not scale those numbers, they look better that way :eyes:
- CFont::SetPropOff();
+ CFont::SetPropOn();
CFont::SetBackgroundOff();
- CFont::SetScale(0.7f, 1.5f);
+ CFont::SetScale(SCREEN_SCALE_X(0.6f), SCREEN_SCALE_Y(0.8f));
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff();
- CFont::SetWrapx(640.0f);
- CFont::SetFontStyle(FONT_HEADING);
-
+ CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
+ CFont::SetFontStyle(FONT_STANDARD);
+ CFont::SetDropColor(CRGBA(0, 0, 0, 255));
+ CFont::SetDropShadowPosition(2);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(42.0f, 42.0f, ustr);
+ CFont::PrintString(41.0f, 41.0f, ustr);
- CFont::SetColor(CRGBA(255, 108, 0, 255));
+ CFont::SetColor(CRGBA(205, 205, 0, 255));
CFont::PrintString(40.0f, 40.0f, ustr);
}
+ // custom
if (bDisplayCheatStr)
{
sprintf(str, "%s", CPad::KeyBoardCheatString);
AsciiToUnicode(str, ustr);
- CFont::SetPropOff();
+ CFont::SetPropOn();
CFont::SetBackgroundOff();
- CFont::SetScale(0.7f, 1.5f);
+ CFont::SetScale(SCREEN_SCALE_X(0.6f), SCREEN_SCALE_Y(0.8f));
CFont::SetCentreOn();
CFont::SetBackGroundOnlyTextOff();
- CFont::SetWrapx(640.0f);
- CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
+ CFont::SetFontStyle(FONT_STANDARD);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH * 0.5f)+2.f, SCREEN_SCALE_FROM_BOTTOM(20.0f)+2.f, ustr);
@@ -968,8 +957,8 @@ Render2dStuff(void)
CSceneEdit::Draw();
else
CHud::Draw();
- // TODO(Miami)
- // CSpecialFX::Render2DFXs();
+
+ CSpecialFX::Render2DFXs();
CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display();
CDarkel::DrawMessages();
@@ -1007,6 +996,9 @@ Render2dStuffAfterFade(void)
DisplayGameDebugText();
#endif
+#ifdef MOBILE_IMPROVEMENTS
+ if (CDraw::FadeValue != 0)
+#endif
CHud::DrawAfterFade();
CFont::DrawFonts();
CCredits::Render();
@@ -1065,9 +1057,7 @@ Idle(void *arg)
if(arg == nil)
return;
- // m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
- if((!FrontEndMenuManager.m_bMenuActive/* || FrontEndMenuManager.m_bRenderGameInMenu*/) &&
- TheCamera.GetScreenFadeStatus() != FADE_2)
+ if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2)
{
#ifdef GTA_PC
// This is from SA, but it's nice for windowed mode