This commit is contained in:
Roman Masanin 2020-11-01 23:39:21 +03:00
commit 076fc24e86
76 changed files with 2276 additions and 806 deletions

View File

@ -47,7 +47,7 @@ deploy:
publish: true publish: true
on: on:
branch: master branch: master
APPVEYOR_REPO_TAG: false APPVEYOR_REPO_TAG: true
cache: cache:
- "%GLEW_FILE%" - "%GLEW_FILE%"

Binary file not shown.

View File

@ -19,6 +19,11 @@ newoption {
default = "vendor/glfw-3.3.2.bin.WIN32", default = "vendor/glfw-3.3.2.bin.WIN32",
} }
newoption {
trigger = "with-asan",
description = "Build with address sanitizer"
}
newoption { newoption {
trigger = "with-librw", trigger = "with-librw",
description = "Build and use librw from this solution" description = "Build and use librw from this solution"
@ -60,6 +65,11 @@ workspace "re3"
symbols "Full" symbols "Full"
staticruntime "off" staticruntime "off"
if _OPTIONS["with-asan"] then
buildoptions { "-fsanitize=address -g3 -fno-omit-frame-pointer" }
linkoptions { "-fsanitize=address" }
end
filter { "system:windows" } filter { "system:windows" }
platforms { platforms {
"win-x86-RW33_d3d8-mss", "win-x86-RW33_d3d8-mss",
@ -330,14 +340,12 @@ project "re3"
links { "rw" } links { "rw" }
filter "platforms:*d3d9*" filter "platforms:*d3d9*"
defines { "USE_D3D9" }
links { "d3d9" } links { "d3d9" }
filter "platforms:*x86*d3d*" filter "platforms:*x86*d3d*"
includedirs { "sdk/dx8sdk/include" } includedirs { "sdk/dx8sdk/include" }
libdirs { "sdk/dx8sdk/lib" } libdirs { "sdk/dx8sdk/lib" }
filter "platforms:*amd64*d3d9*"
defines { "USE_D3D9" }
filter "platforms:win-x86*gl3_glfw*" filter "platforms:win-x86*gl3_glfw*"
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }

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"
@ -4107,14 +4107,13 @@ cAudioManager::GetArmyTalkSfx(int16 sound)
PedState pedState; PedState pedState;
static uint32 lastSfx = NO_SAMPLE; static uint32 lastSfx = NO_SAMPLE;
switch (sound) { switch(sound) {
case SOUND_PED_PURSUIT_ARMY: case SOUND_PED_PURSUIT_ARMY:
pedState = FindPlayerPed()->m_nPedState; pedState = FindPlayerPed()->m_nPedState;
if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE;
return NO_SAMPLE;
GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15); GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15);
default: break;
return GetGenericMaleTalkSfx(sound); default: return GetGenericMaleTalkSfx(sound);
} }
return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
@ -4602,32 +4601,16 @@ cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
uint32 sfx; uint32 sfx;
static uint32 lastSfx = NO_SAMPLE; static uint32 lastSfx = NO_SAMPLE;
switch (sound) { switch(sound) {
case SOUND_PED_HANDS_UP: case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); break;
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); break;
break; case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); break;
case SOUND_PED_CAR_JACKED: case SOUND_PED_ATTACK: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6); break;
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5); break;
break; case SOUND_PED_ANNOYED_DRIVER: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7); break;
case SOUND_PED_ROBBED: case SOUND_PED_CHAT_SEXY: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3); break;
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6); break;
break; default: return GetGenericMaleTalkSfx(sound);
case SOUND_PED_ATTACK:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5);
break;
case SOUND_PED_ANNOYED_DRIVER:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
break;
case SOUND_PED_CHAT_SEXY:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6);
default:
return GetGenericMaleTalkSfx(sound);
} }
if (model == MI_P_MAN2) if (model == MI_P_MAN2)
@ -4641,26 +4624,14 @@ cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound)
uint32 sfx; uint32 sfx;
static uint32 lastSfx = NO_SAMPLE; static uint32 lastSfx = NO_SAMPLE;
switch (sound) { switch(sound) {
case SOUND_PED_CAR_JACKED: case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); break;
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); break;
break; case SOUND_PED_EVADE: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9); break;
case SOUND_PED_ROBBED: case SOUND_PED_ANNOYED_DRIVER: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9); break;
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); case SOUND_PED_WAIT_DOUBLEBACK: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2); break;
break; case SOUND_PED_CHAT: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9); break;
case SOUND_PED_EVADE: default: return GetGenericMaleTalkSfx(sound);
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9);
break;
case SOUND_PED_ANNOYED_DRIVER:
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9);
break;
case SOUND_PED_WAIT_DOUBLEBACK:
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9);
default:
return GetGenericMaleTalkSfx(sound);
} }
return sfx; return sfx;
} }

View File

@ -321,8 +321,13 @@ cAudioManager::Get3DProviderName(uint8 id) const
{ {
if (!m_bIsInitialised) if (!m_bIsInitialised)
return nil; return nil;
#ifdef AUDIO_OAL
id = clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
#else
// We don't want that either since it will crash the game, but skipping for now
if (id >= SampleManager.GetNum3DProvidersAvailable()) if (id >= SampleManager.GetNum3DProvidersAvailable())
return nil; return nil;
#endif
return SampleManager.Get3DProviderName(id); return SampleManager.Get3DProviderName(id);
} }

View File

@ -432,7 +432,7 @@ public:
void ReleaseDigitalHandle() const; void ReleaseDigitalHandle() const;
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
float collisionPower, float intensity2); float collisionPower, float intensity2);
void ReportCrime(int32 crime, const CVector *pos); void ReportCrime(eCrimeType crime, const CVector &pos);
void ResetAudioLogicTimers(uint32 timer); void ResetAudioLogicTimers(uint32 timer);
void ResetPoliceRadio(); void ResetPoliceRadio();
void ResetTimers(uint32 time); void ResetTimers(uint32 time);
@ -440,7 +440,7 @@ public:
void Service(); void Service();
void ServiceCollisions(); void ServiceCollisions();
void ServicePoliceRadio(); void ServicePoliceRadio();
void ServicePoliceRadioChannel(int32 wantedLevel); void ServicePoliceRadioChannel(uint8 wantedLevel);
void ServiceSoundEffects(); void ServiceSoundEffects();
int8 SetCurrent3DProvider(uint8 which); int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(uint8 status); void SetDynamicAcousticModelingStatus(uint8 status);

View File

@ -5,9 +5,6 @@
#include "AudioManager.h" #include "AudioManager.h"
#include "AudioScriptObject.h" #include "AudioScriptObject.h"
#include "sampman.h" #include "sampman.h"
#include "Font.h"
#include "Text.h"
#include "crossplatform.h"
cDMAudio DMAudio; cDMAudio DMAudio;
@ -113,28 +110,6 @@ cDMAudio::Get3DProviderName(uint8 id)
return AudioManager.Get3DProviderName(id); return AudioManager.Get3DProviderName(id);
} }
int8 cDMAudio::AutoDetect3DProviders(void)
{
for ( int32 i = 0; i < GetNum3DProvidersAvailable(); i++ )
{
wchar buff[64];
char *name = Get3DProviderName(i);
AsciiToUnicode(name, buff);
char *providername = UnicodeToAscii(buff);
strupr(providername);
#if defined(AUDIO_MSS)
if ( !strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") )
return i;
#elif defined(AUDIO_OAL)
if ( !strcmp(providername, "OPENAL SOFT") )
return i;
#endif
}
return -1;
}
int8 int8
cDMAudio::GetCurrent3DProviderIndex(void) cDMAudio::GetCurrent3DProviderIndex(void)
{ {
@ -198,7 +173,7 @@ cDMAudio::IsAudioInitialised(void)
void void
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
{ {
AudioManager.ReportCrime(crime, &pos); AudioManager.ReportCrime(crime, pos);
} }
int32 int32
@ -345,7 +320,7 @@ cDMAudio::SetRadioInCar(uint32 radio)
} }
void void
cDMAudio::SetRadioChannel(int8 radio, int32 pos) cDMAudio::SetRadioChannel(uint8 radio, int32 pos)
{ {
MusicManager.SetRadioChannelByScript(radio, pos); MusicManager.SetRadioChannelByScript(radio, pos);
} }

View File

@ -35,8 +35,6 @@ public:
uint8 GetNum3DProvidersAvailable(void); uint8 GetNum3DProvidersAvailable(void);
char *Get3DProviderName(uint8 id); char *Get3DProviderName(uint8 id);
int8 AutoDetect3DProviders(void);
int8 GetCurrent3DProviderIndex(void); int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which); int8 SetCurrent3DProvider(uint8 which);
@ -86,6 +84,6 @@ public:
uint8 GetRadioInCar(void); uint8 GetRadioInCar(void);
void SetRadioInCar(uint32 radio); void SetRadioInCar(uint32 radio);
void SetRadioChannel(int8 radio, int32 pos); void SetRadioChannel(uint8 radio, int32 pos);
}; };
extern cDMAudio DMAudio; extern cDMAudio DMAudio;

View File

@ -161,7 +161,7 @@ cMusicManager::DisplayRadioStationName()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(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); CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation);

View File

@ -91,7 +91,7 @@ cAudioManager::InitialisePoliceRadio()
m_sPoliceRadioQueue.policeChannelTimerSeconds = 0; m_sPoliceRadioQueue.policeChannelTimerSeconds = 0;
m_sPoliceRadioQueue.policeChannelCounterSeconds = 0; m_sPoliceRadioQueue.policeChannelCounterSeconds = 0;
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
m_sPoliceRadioQueue.crimes[i].type = 0; m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
SampleManager.SetChannelReverbFlag(policeChannel, 0); SampleManager.SetChannelReverbFlag(policeChannel, 0);
gSpecialSuspectLastSeenReport = false; gSpecialSuspectLastSeenReport = false;
@ -154,7 +154,7 @@ cAudioManager::ServicePoliceRadio()
if(!m_bIsInitialised) return; if(!m_bIsInitialised) return;
if(!m_nUserPause) { if(m_nUserPause == 0) {
bool crimeReport = SetupCrimeReport(); bool crimeReport = SetupCrimeReport();
#ifdef FIX_BUGS // Crash at 0x5fe6ef #ifdef FIX_BUGS // Crash at 0x5fe6ef
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted) if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
@ -162,8 +162,8 @@ cAudioManager::ServicePoliceRadio()
#endif #endif
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel; wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
if(!crimeReport) { if(!crimeReport) {
if(wantedLevel) { if(wantedLevel != 0) {
if(nLastSeen) { if(nLastSeen != 0) {
--nLastSeen; --nLastSeen;
} else { } else {
nLastSeen = m_anRandomTable[1] % 1000 + 2000; nLastSeen = m_anRandomTable[1] % 1000 + 2000;
@ -176,7 +176,7 @@ cAudioManager::ServicePoliceRadio()
} }
void void
cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel) cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
{ {
bool processed = false; bool processed = false;
uint32 sample; uint32 sample;
@ -189,7 +189,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel)
if (!m_bIsInitialised) return; if (!m_bIsInitialised) return;
if (m_nUserPause) { if (m_nUserPause != 0) {
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 && if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 &&
SampleManager.IsStreamPlaying(1)) { SampleManager.IsStreamPlaying(1)) {
@ -241,7 +241,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel)
} else { } else {
sample = TOTAL_AUDIO_SAMPLES; sample = TOTAL_AUDIO_SAMPLES;
} }
if (!wantedLevel) { if (wantedLevel == 0) {
if (gSpecialSuspectLastSeenReport) { if (gSpecialSuspectLastSeenReport) {
gSpecialSuspectLastSeenReport = 0; gSpecialSuspectLastSeenReport = 0;
} else if (((sample >= SFX_POLICE_RADIO_MESSAGE_NOISE_1) && (sample <= SFX_POLICE_RADIO_MESSAGE_NOISE_3)) || sample == TOTAL_AUDIO_SAMPLES) { } else if (((sample >= SFX_POLICE_RADIO_MESSAGE_NOISE_1) && (sample <= SFX_POLICE_RADIO_MESSAGE_NOISE_3)) || sample == TOTAL_AUDIO_SAMPLES) {
@ -675,7 +675,7 @@ cAudioManager::SetupSuspectLastSeenReport()
void void
cAudioManager::ReportCrime(int32 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->m_nWantedLevel > 0 &&
@ -683,7 +683,7 @@ cAudioManager::ReportCrime(int32 type, const CVector *pos)
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) { if (m_sPoliceRadioQueue.crimes[i].type) {
if (m_sPoliceRadioQueue.crimes[i].type == type) { if (m_sPoliceRadioQueue.crimes[i].type == type) {
m_sPoliceRadioQueue.crimes[i].position = *pos; m_sPoliceRadioQueue.crimes[i].position = pos;
m_sPoliceRadioQueue.crimes[i].timer = 0; m_sPoliceRadioQueue.crimes[i].timer = 0;
return; return;
} }
@ -694,7 +694,7 @@ cAudioManager::ReportCrime(int32 type, const CVector *pos)
if (lastCrime < ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) { if (lastCrime < ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) {
m_sPoliceRadioQueue.crimes[lastCrime].type = type; m_sPoliceRadioQueue.crimes[lastCrime].type = type;
m_sPoliceRadioQueue.crimes[lastCrime].position = *pos; m_sPoliceRadioQueue.crimes[lastCrime].position = pos;
m_sPoliceRadioQueue.crimes[lastCrime].timer = 0; m_sPoliceRadioQueue.crimes[lastCrime].timer = 0;
gMinTimeToNextReport[type] = m_FrameCounter + 500; gMinTimeToNextReport[type] = m_FrameCounter + 500;
} }

View File

@ -10,17 +10,49 @@
extern bool IsFXSupported(); extern bool IsFXSupported();
ALuint alSources[MAXCHANNELS+MAX2DCHANNELS];
ALuint alFilters[MAXCHANNELS+MAX2DCHANNELS];
ALuint alBuffers[MAXCHANNELS+MAX2DCHANNELS];
bool bChannelsCreated = false;
void
CChannel::InitChannels()
{
alGenSources(MAXCHANNELS+MAX2DCHANNELS, alSources);
alGenBuffers(MAXCHANNELS+MAX2DCHANNELS, alBuffers);
if (IsFXSupported())
alGenFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
bChannelsCreated = true;
}
void
CChannel::DestroyChannels()
{
if (bChannelsCreated)
{
alDeleteSources(MAXCHANNELS + MAX2DCHANNELS, alSources);
memset(alSources, 0, sizeof(alSources));
alDeleteBuffers(MAXCHANNELS + MAX2DCHANNELS, alBuffers);
memset(alBuffers, 0, sizeof(alBuffers));
if (IsFXSupported())
{
alDeleteFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
memset(alFilters, 0, sizeof(alFilters));
}
bChannelsCreated = false;
}
}
CChannel::CChannel() CChannel::CChannel()
{ {
alSource = AL_NONE; Data = nil;
alFilter = AL_FILTER_NULL; DataSize = 0;
SetDefault(); SetDefault();
} }
void CChannel::SetDefault() void CChannel::SetDefault()
{ {
alBuffer = AL_NONE;
Pitch = 1.0f; Pitch = 1.0f;
Gain = 1.0f; Gain = 1.0f;
Mix = 0.0f; Mix = 0.0f;
@ -39,25 +71,19 @@ void CChannel::Reset()
SetDefault(); SetDefault();
} }
void CChannel::Init(bool Is2D) void CChannel::Init(uint32 _id, bool Is2D)
{ {
ASSERT(!HasSource()); id = _id;
alGenSources(1, &alSource);
if ( HasSource() ) if ( HasSource() )
{ {
alSourcei(alSource, AL_SOURCE_RELATIVE, AL_TRUE); alSourcei(alSources[id], AL_SOURCE_RELATIVE, AL_TRUE);
if ( IsFXSupported() ) if ( IsFXSupported() )
alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL); alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
if ( Is2D ) if ( Is2D )
{ {
alSource3f(alSource, AL_POSITION, 0.0f, 0.0f, 0.0f); alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSourcef (alSource, AL_GAIN, 1.0f); alSourcef(alSources[id], AL_GAIN, 1.0f);
}
else
{
if ( IsFXSupported() )
alGenFilters(1,&alFilter);
} }
} }
} }
@ -69,39 +95,34 @@ void CChannel::Term()
{ {
if ( IsFXSupported() ) if ( IsFXSupported() )
{ {
alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL); alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
if(alFilter != AL_FILTER_NULL)
alDeleteFilters(1,&alFilter);
} }
alDeleteSources(1, &alSource);
} }
alSource = AL_NONE;
alFilter = AL_FILTER_NULL;
} }
void CChannel::Start() void CChannel::Start()
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
if ( !Data ) return;
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 ) if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
alBufferiv(alBuffer, AL_LOOP_POINTS_SOFT, LoopPoints); alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
alSourcei (alSource, AL_BUFFER, alBuffer); alSourcei(alSources[id], AL_BUFFER, alBuffers[id]);
alSourcePlay(alSource); alSourcePlay(alSources[id]);
} }
void CChannel::Stop() void CChannel::Stop()
{ {
if ( HasSource() ) if ( HasSource() )
alSourceStop(alSource); alSourceStop(alSources[id]);
Reset(); Reset();
} }
bool CChannel::HasSource() bool CChannel::HasSource()
{ {
return alSource != AL_NONE; return alSources[id] != AL_NONE;
} }
bool CChannel::IsUsed() bool CChannel::IsUsed()
@ -109,7 +130,7 @@ bool CChannel::IsUsed()
if ( HasSource() ) if ( HasSource() )
{ {
ALint sourceState; ALint sourceState;
alGetSourcei(alSource, AL_SOURCE_STATE, &sourceState); alGetSourcei(alSources[id], AL_SOURCE_STATE, &sourceState);
return sourceState == AL_PLAYING; return sourceState == AL_PLAYING;
} }
return false; return false;
@ -118,27 +139,24 @@ bool CChannel::IsUsed()
void CChannel::SetPitch(float pitch) void CChannel::SetPitch(float pitch)
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
alSourcef(alSource, AL_PITCH, pitch); alSourcef(alSources[id], AL_PITCH, pitch);
} }
void CChannel::SetGain(float gain) void CChannel::SetGain(float gain)
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
alSourcef(alSource, AL_GAIN, gain); alSourcef(alSources[id], AL_GAIN, gain);
} }
void CChannel::SetVolume(int32 vol) void CChannel::SetVolume(int32 vol)
{ {
SetGain(ALfloat(vol) / MAX_VOLUME); SetGain(ALfloat(vol) / MAX_VOLUME);
} }
void CChannel::SetSampleID(uint32 nSfx) void CChannel::SetSampleData(void *_data, size_t _DataSize, int32 freq)
{
Sample = nSfx;
}
void CChannel::SetFreq(int32 freq)
{ {
Data = _data;
DataSize = _DataSize;
Frequency = freq; Frequency = freq;
} }
@ -150,7 +168,7 @@ void CChannel::SetCurrentFreq(uint32 freq)
void CChannel::SetLoopCount(int32 loopCount) // fake. TODO: void CChannel::SetLoopCount(int32 loopCount) // fake. TODO:
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
alSourcei(alSource, AL_LOOPING, loopCount == 1 ? AL_FALSE : AL_TRUE); alSourcei(alSources[id], AL_LOOPING, loopCount == 1 ? AL_FALSE : AL_TRUE);
} }
void CChannel::SetLoopPoints(ALint start, ALint end) void CChannel::SetLoopPoints(ALint start, ALint end)
@ -162,53 +180,49 @@ void CChannel::SetLoopPoints(ALint start, ALint end)
void CChannel::SetPosition(float x, float y, float z) void CChannel::SetPosition(float x, float y, float z)
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
alSource3f(alSource, AL_POSITION, x, y, z); alSource3f(alSources[id], AL_POSITION, x, y, z);
} }
void CChannel::SetDistances(float max, float min) void CChannel::SetDistances(float max, float min)
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
alSourcef (alSource, AL_MAX_DISTANCE, max); alSourcef (alSources[id], AL_MAX_DISTANCE, max);
alSourcef (alSource, AL_REFERENCE_DISTANCE, min); alSourcef (alSources[id], AL_REFERENCE_DISTANCE, min);
alSourcef (alSource, AL_MAX_GAIN, 1.0f); alSourcef (alSources[id], AL_MAX_GAIN, 1.0f);
alSourcef (alSource, AL_ROLLOFF_FACTOR, 1.0f); alSourcef (alSources[id], AL_ROLLOFF_FACTOR, 1.0f);
} }
void CChannel::SetPan(uint32 pan) void CChannel::SetPan(int32 pan)
{ {
SetPosition((pan-63)/64.0f, 0.0f, Sqrt(1.0f-SQR((pan-63)/64.0f))); SetPosition((pan-63)/64.0f, 0.0f, Sqrt(1.0f-SQR((pan-63)/64.0f)));
} }
void CChannel::SetBuffer(ALuint buffer)
{
alBuffer = buffer;
}
void CChannel::ClearBuffer() void CChannel::ClearBuffer()
{ {
if ( !HasSource() ) return; if ( !HasSource() ) return;
SetBuffer(AL_NONE); alSourcei(alSources[id], AL_BUFFER, AL_NONE);
alSourcei(alSource, AL_BUFFER, AL_NONE); Data = nil;
DataSize = 0;
} }
void CChannel::SetReverbMix(ALuint slot, float mix) void CChannel::SetReverbMix(ALuint slot, float mix)
{ {
if ( !IsFXSupported() ) return; if ( !IsFXSupported() ) return;
if ( !HasSource() ) return; if ( !HasSource() ) return;
if ( alFilter == AL_FILTER_NULL ) return; if ( alFilters[id] == AL_FILTER_NULL ) return;
Mix = mix; Mix = mix;
EAX3_SetReverbMix(alFilter, mix); EAX3_SetReverbMix(alFilters[id], mix);
alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, slot, 0, alFilter); alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, slot, 0, alFilters[id]);
} }
void CChannel::UpdateReverb(ALuint slot) void CChannel::UpdateReverb(ALuint slot)
{ {
if ( !IsFXSupported() ) return; if ( !IsFXSupported() ) return;
if ( !HasSource() ) return; if ( !HasSource() ) return;
if ( alFilter == AL_FILTER_NULL ) return; if ( alFilters[id] == AL_FILTER_NULL ) return;
EAX3_SetReverbMix(alFilter, Mix); EAX3_SetReverbMix(alFilters[id], Mix);
alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, slot, 0, alFilter); alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, slot, 0, alFilters[id]);
} }
#endif #endif

View File

@ -9,22 +9,24 @@
class CChannel class CChannel
{ {
ALuint alSource; uint32 id;
ALuint alFilter;
ALuint alBuffer;
float Pitch, Gain; float Pitch, Gain;
float Mix; float Mix;
void *Data;
size_t DataSize;
int32 Frequency; int32 Frequency;
float Position[3]; float Position[3];
float Distances[2]; float Distances[2];
int32 LoopCount; int32 LoopCount;
ALint LoopPoints[2]; ALint LoopPoints[2];
uint32 Sample;
public: public:
static void InitChannels();
static void DestroyChannels();
CChannel(); CChannel();
void SetDefault(); void SetDefault();
void Reset(); void Reset();
void Init(bool Is2D = false); void Init(uint32 _id, bool Is2D = false);
void Term(); void Term();
void Start(); void Start();
void Stop(); void Stop();
@ -33,15 +35,13 @@ public:
void SetPitch(float pitch); void SetPitch(float pitch);
void SetGain(float gain); void SetGain(float gain);
void SetVolume(int32 vol); void SetVolume(int32 vol);
void SetSampleID(uint32 nSfx); void SetSampleData(void *_data, size_t _DataSize, int32 freq);
void SetFreq(int32 freq);
void SetCurrentFreq(uint32 freq); void SetCurrentFreq(uint32 freq);
void SetLoopCount(int32 loopCount); // fake void SetLoopCount(int32 loopCount); // fake
void SetLoopPoints(ALint start, ALint end); void SetLoopPoints(ALint start, ALint end);
void SetPosition(float x, float y, float z); void SetPosition(float x, float y, float z);
void SetDistances(float max, float min); void SetDistances(float max, float min);
void SetPan(uint32 pan); void SetPan(int32 pan);
void SetBuffer(ALuint buffer);
void ClearBuffer(); void ClearBuffer();
void SetReverbMix(ALuint slot, float mix); void SetReverbMix(ALuint slot, float mix);
void UpdateReverb(ALuint slot); void UpdateReverb(ALuint slot);

View File

@ -195,7 +195,7 @@ public:
if (m_FileH) { if (m_FileH) {
m_nChannels = op_head(m_FileH, 0)->channel_count; m_nChannels = op_head(m_FileH, 0)->channel_count;
m_nRate = op_head(m_FileH, 0)->input_sample_rate; m_nRate = 48000;
const OpusTags *tags = op_tags(m_FileH, 0); const OpusTags *tags = op_tags(m_FileH, 0);
for (int i = 0; i < tags->comments; i++) { for (int i = 0; i < tags->comments; i++) {
if (strncmp(tags->user_comments[i], "SAMPLERATE", sizeof("SAMPLERATE")-1) == 0) if (strncmp(tags->user_comments[i], "SAMPLERATE", sizeof("SAMPLERATE")-1) == 0)
@ -323,8 +323,8 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
#endif #endif
else else
m_pSoundFile = nil; m_pSoundFile = nil;
ASSERT(m_pSoundFile != nil);
if (m_pSoundFile && m_pSoundFile->IsOpened() ) if ( IsOpened() )
{ {
m_pBuffer = malloc(m_pSoundFile->GetBufferSize()); m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
ASSERT(m_pBuffer!=nil); ASSERT(m_pBuffer!=nil);
@ -371,14 +371,14 @@ bool CStream::HasSource()
bool CStream::IsOpened() bool CStream::IsOpened()
{ {
return m_pSoundFile->IsOpened(); return m_pSoundFile && m_pSoundFile->IsOpened();
} }
bool CStream::IsPlaying() bool CStream::IsPlaying()
{ {
if ( !HasSource() || !IsOpened() ) return false; if ( !HasSource() || !IsOpened() ) return false;
if ( m_pSoundFile->IsOpened() && !m_bPaused ) if ( !m_bPaused )
{ {
ALint sourceState; ALint sourceState;
alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState); alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState);
@ -446,7 +446,7 @@ void CStream::SetPan(uint8 nPan)
void CStream::SetPosMS(uint32 nPos) void CStream::SetPosMS(uint32 nPos)
{ {
if ( !m_pSoundFile->IsOpened() ) return; if ( !IsOpened() ) return;
m_pSoundFile->Seek(nPos); m_pSoundFile->Seek(nPos);
ClearBuffers(); ClearBuffers();
} }
@ -454,7 +454,7 @@ void CStream::SetPosMS(uint32 nPos)
uint32 CStream::GetPosMS() uint32 CStream::GetPosMS()
{ {
if ( !HasSource() ) return 0; if ( !HasSource() ) return 0;
if ( !m_pSoundFile->IsOpened() ) return 0; if ( !IsOpened() ) return 0;
ALint offset; ALint offset;
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset); //alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
@ -467,7 +467,7 @@ uint32 CStream::GetPosMS()
uint32 CStream::GetLengthMS() uint32 CStream::GetLengthMS()
{ {
if ( !m_pSoundFile->IsOpened() ) return 0; if ( !IsOpened() ) return 0;
return m_pSoundFile->GetLength(); return m_pSoundFile->GetLength();
} }
@ -475,7 +475,7 @@ bool CStream::FillBuffer(ALuint alBuffer)
{ {
if ( !HasSource() ) if ( !HasSource() )
return false; return false;
if ( !m_pSoundFile->IsOpened() ) if ( !IsOpened() )
return false; return false;
if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) ) if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) )
return false; return false;
@ -517,7 +517,7 @@ void CStream::ClearBuffers()
bool CStream::Setup() bool CStream::Setup()
{ {
if ( m_pSoundFile->IsOpened() ) if ( IsOpened() )
{ {
m_pSoundFile->Seek(0); m_pSoundFile->Seek(0);
alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE); alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE);

View File

@ -153,11 +153,7 @@ public:
bool Initialise(void); bool Initialise(void);
void Terminate (void); void Terminate (void);
#ifdef AUDIO_OAL
void UpdateSoundBuffers(void);
#endif
bool CheckForAnAudioFileOnCD(void); bool CheckForAnAudioFileOnCD(void);
char GetCDAudioDriveLetter (void); char GetCDAudioDriveLetter (void);
@ -218,6 +214,10 @@ public:
extern cSampleManager SampleManager; extern cSampleManager SampleManager;
extern uint32 BankStartOffset[MAX_SFX_BANKS]; extern uint32 BankStartOffset[MAX_SFX_BANKS];
#ifdef AUDIO_OAL
extern int defaultProvider;
#endif
#ifdef AUDIO_OPUS #ifdef AUDIO_OPUS
static char StreamedNameTable[][25] = { static char StreamedNameTable[][25] = {
"AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS", "AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS",

View File

@ -2331,4 +2331,4 @@ cSampleManager::InitialiseSampleBanks(void)
return true; return true;
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,7 @@ CDarkel::DrawMessages()
{ {
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(610.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart; uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
@ -132,7 +132,7 @@ CDarkel::DrawMessages()
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart; uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) { if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) {
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f)); CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
CFont::SetJustifyOff(); CFont::SetJustifyOff();

View File

@ -1400,7 +1400,7 @@ void CGarages::PrintMessages()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));

View File

@ -54,20 +54,15 @@ uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 25
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 }; uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f }; float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
void
CPickup::RemoveKeepType() inline void
CPickup::Remove()
{ {
CWorld::Remove(m_pObject); CWorld::Remove(m_pObject);
delete m_pObject; delete m_pObject;
m_bRemoved = true; m_bRemoved = true;
m_pObject = nil; m_pObject = nil;
}
void
CPickup::Remove()
{
RemoveKeepType();
m_eType = PICKUP_NONE; m_eType = PICKUP_NONE;
} }
@ -131,7 +126,6 @@ CPickup::GiveUsAPickUpObject(int32 handle)
bool bool
CPickup::CanBePickedUp(CPlayerPed *player) CPickup::CanBePickedUp(CPlayerPed *player)
{ {
assert(m_pObject != nil);
bool cannotBePickedUp = bool cannotBePickedUp =
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f) (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f) || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
@ -144,6 +138,7 @@ bool
CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
{ {
float waterLevel; float waterLevel;
bool result = false;
if (m_bRemoved) { if (m_bRemoved) {
if (CTimer::GetTimeInMilliseconds() > m_nTimer) { if (CTimer::GetTimeInMilliseconds() > m_nTimer) {
@ -204,9 +199,12 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex())); player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex()));
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON_BOUGHT, m_pObject->GetModelIndex() - MI_GRENADE); DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON_BOUGHT, m_pObject->GetModelIndex() - MI_GRENADE);
} }
RemoveKeepType(); result = true;
CWorld::Remove(m_pObject);
delete m_pObject;
m_pObject = nil;
m_nTimer = CTimer::GetTimeInMilliseconds() + 5000; m_nTimer = CTimer::GetTimeInMilliseconds() + 5000;
return true; m_bRemoved = true;
} }
break; break;
case PICKUP_ON_STREET: case PICKUP_ON_STREET:
@ -235,8 +233,12 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
m_nTimer = CTimer::GetTimeInMilliseconds() + 720000; m_nTimer = CTimer::GetTimeInMilliseconds() + 720000;
} }
RemoveKeepType(); result = true;
return true; CWorld::Remove(m_pObject);
delete m_pObject;
m_pObject = nil;
m_bRemoved = true;
break;
case PICKUP_ONCE: case PICKUP_ONCE:
case PICKUP_ONCE_TIMEOUT: case PICKUP_ONCE_TIMEOUT:
if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) { if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) {
@ -247,8 +249,9 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
} }
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE); DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE);
} }
result = true;
Remove(); Remove();
return true; break;
case PICKUP_COLLECTABLE1: case PICKUP_COLLECTABLE1:
CWorld::Players[playerId].m_nCollectedPackages++; CWorld::Players[playerId].m_nCollectedPackages++;
CWorld::Players[playerId].m_nMoney += 1000; CWorld::Players[playerId].m_nMoney += 1000;
@ -260,18 +263,20 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
} else } else
CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages); CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
result = true;
Remove(); Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HIDDEN_PACKAGE, 0); DMAudio.PlayFrontEndSound(SOUND_PICKUP_HIDDEN_PACKAGE, 0);
return true; break;
case PICKUP_MONEY: case PICKUP_MONEY:
CWorld::Players[playerId].m_nMoney += m_nQuantity; CWorld::Players[playerId].m_nMoney += m_nQuantity;
sprintf(gString, "$%d", m_nQuantity); sprintf(gString, "$%d", m_nQuantity);
#ifdef MONEY_MESSAGES #ifdef MONEY_MESSAGES
CMoneyMessages::RegisterOne(m_vecPos + CVector(0.0f, 0.0f, 1.0f), gString, 0, 255, 0, 0.5f, 0.5f); CMoneyMessages::RegisterOne(m_vecPos + CVector(0.0f, 0.0f, 1.0f), gString, 0, 255, 0, 0.5f, 0.5f);
#endif #endif
result = true;
Remove(); Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0); DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
return true; break;
default: default:
break; break;
} }
@ -298,7 +303,9 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i); CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) { if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
touched = true; touched = true;
break; // added break here #ifdef FIX_BUGS
break;
#endif
} }
} }
@ -320,12 +327,17 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
bool explode = false; bool explode = false;
if (CTimer::GetTimeInMilliseconds() > m_nTimer) if (CTimer::GetTimeInMilliseconds() > m_nTimer)
explode = true; explode = true;
else {// added else here since vehicle lookup is useless #ifdef FIX_BUGS
else// added else here since vehicle lookup is useless
#endif
{
for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) { for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i); CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) { if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
explode = true; explode = true;
break; // added break here #ifdef FIX_BUGS
break;
#endif
} }
} }
} }
@ -352,8 +364,8 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
m_pObject->UpdateRwFrame(); m_pObject->UpdateRwFrame();
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 2.0f)) { if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 2.0f)) {
Remove(); Remove();
result = true;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_FLOAT_PACKAGE, 0); DMAudio.PlayFrontEndSound(SOUND_PICKUP_FLOAT_PACKAGE, 0);
return true;
} }
break; break;
default: break; default: break;
@ -361,7 +373,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
} }
if (!m_bRemoved && (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_MONEY) && CTimer::GetTimeInMilliseconds() > m_nTimer) if (!m_bRemoved && (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_MONEY) && CTimer::GetTimeInMilliseconds() > m_nTimer)
Remove(); Remove();
return false; return result;
} }
void void
@ -628,7 +640,7 @@ CPickups::Update()
#ifdef CAMERA_PICKUP #ifdef CAMERA_PICKUP
if ( bPickUpcamActivated ) // taken from PS2 if ( bPickUpcamActivated ) // taken from PS2
{ {
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D(); float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
float mult; float mult;
if ( dist < 10.0f ) if ( dist < 10.0f )
mult = 1.0f - (dist / 10.0f ); mult = 1.0f - (dist / 10.0f );
@ -644,8 +656,7 @@ CPickups::Update()
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT); TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
} }
if ( FindPlayerVehicle() != pPlayerVehicle if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) ) || ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
{ {
TheCamera.RestoreWithJumpCut(); TheCamera.RestoreWithJumpCut();
@ -715,7 +726,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
CObject *object = (CObject*)entity; CObject *object = (CObject*)entity;
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) { if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance2D(pos, TheCamera.GetPosition());
const float MAXDIST = 12.0f; const float MAXDIST = 12.0f;
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) { if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
@ -746,7 +757,7 @@ void
CPickups::DoMineEffects(CEntity *entity) CPickups::DoMineEffects(CEntity *entity)
{ {
const CVector &pos = entity->GetPosition(); const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f; const float MAXDIST = 20.0f;
if (dist < MAXDIST) { if (dist < MAXDIST) {
@ -765,7 +776,7 @@ void
CPickups::DoMoneyEffects(CEntity *entity) CPickups::DoMoneyEffects(CEntity *entity)
{ {
const CVector &pos = entity->GetPosition(); const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f; const float MAXDIST = 20.0f;
if (dist < MAXDIST) { if (dist < MAXDIST) {
@ -784,7 +795,7 @@ void
CPickups::DoCollectableEffects(CEntity *entity) CPickups::DoCollectableEffects(CEntity *entity)
{ {
const CVector &pos = entity->GetPosition(); const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 14.0f; const float MAXDIST = 14.0f;
if (dist < MAXDIST) { if (dist < MAXDIST) {

View File

@ -41,10 +41,9 @@ public:
CObject *GiveUsAPickUpObject(int32 handle); CObject *GiveUsAPickUpObject(int32 handle);
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId); bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
private: private:
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; } inline bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
inline bool CanBePickedUp(CPlayerPed *player); inline bool CanBePickedUp(CPlayerPed *player);
void RemoveKeepType(); inline void Remove();
void Remove();
}; };
VALIDATE_SIZE(CPickup, 0x1C); VALIDATE_SIZE(CPickup, 0x1C);

View File

@ -165,7 +165,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = vehicleMatrix; pVehicle->m_matrix = vehicleMatrix;
pVehicle->PlaceOnRoadProperly(); pVehicle->PlaceOnRoadProperly();
pVehicle->bIsStatic = false; pVehicle->SetIsStatic(false);
pVehicle->m_matrix.UpdateRW(); pVehicle->m_matrix.UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle); CCarCtrl::JoinCarWithRoadSystem(pVehicle);

View File

@ -2002,9 +2002,11 @@ void CTheScripts::Process()
case 4: case 4:
AllowMissionReplay = 5; AllowMissionReplay = 5;
RetryMission(0, 0); RetryMission(0, 0);
break;
case 6: case 6:
AllowMissionReplay = 7; AllowMissionReplay = 7;
TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500; TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
break;
case 7: case 7:
if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) { if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
AllowMissionReplay = 0; AllowMissionReplay = 0;
@ -2694,8 +2696,10 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
if (m_bMissionFlag) { if (m_bMissionFlag) {
CPlayerInfo* pPlayerInfo = &CWorld::Players[CWorld::PlayerInFocus]; CPlayerInfo* pPlayerInfo = &CWorld::Players[CWorld::PlayerInFocus];
#if 0 // makeing autosave is pointless and is a bit buggy
if (pPlayerInfo->m_pPed->GetPedState() != PED_DEAD && pPlayerInfo->m_WBState == WBSTATE_PLAYING && !m_bDeatharrestExecuted) if (pPlayerInfo->m_pPed->GetPedState() != PED_DEAD && pPlayerInfo->m_WBState == WBSTATE_PLAYING && !m_bDeatharrestExecuted)
SaveGameForPause(1); SaveGameForPause(1);
#endif
oldTargetX = oldTargetY = 0.0f; oldTargetX = oldTargetY = 0.0f;
if (AllowMissionReplay == 1) if (AllowMissionReplay == 1)
AllowMissionReplay = 2; AllowMissionReplay = 2;
@ -3575,7 +3579,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
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);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->bIsStatic = false; car->SetIsStatic(false);
/* Again weird usage of virtual functions. */ /* Again weird usage of virtual functions. */
if (car->IsBoat()) { if (car->IsBoat()) {
car->Teleport(pos); car->Teleport(pos);
@ -8331,11 +8335,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
} }
case COMMAND_INDUSTRIAL_PASSED: case COMMAND_INDUSTRIAL_PASSED:
CStats::IndustrialPassed = true; CStats::IndustrialPassed = true;
DMAudio.PlayRadioAnnouncement(13); //TODO: enum? DMAudio.PlayRadioAnnouncement(STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN);
return 0; return 0;
case COMMAND_COMMERCIAL_PASSED: case COMMAND_COMMERCIAL_PASSED:
CStats::CommercialPassed = true; CStats::CommercialPassed = true;
DMAudio.PlayRadioAnnouncement(14); //TODO: enum? DMAudio.PlayRadioAnnouncement(STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN);
return 0; return 0;
case COMMAND_SUBURBAN_PASSED: case COMMAND_SUBURBAN_PASSED:
CStats::SuburbanPassed = true; CStats::SuburbanPassed = true;
@ -9183,13 +9187,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
script_assert(pObject); script_assert(pObject);
if (ScriptParams[1]) { if (ScriptParams[1]) {
if (pObject->bIsStatic) { if (pObject->bIsStatic) {
pObject->bIsStatic = false; pObject->SetIsStatic(false);
pObject->AddToMovingList(); pObject->AddToMovingList();
} }
} }
else { else {
if (!pObject->bIsStatic) { if (!pObject->bIsStatic) {
pObject->bIsStatic = true; pObject->SetIsStatic(true);
pObject->RemoveFromMovingList(); pObject->RemoveFromMovingList();
} }
} }

View File

@ -216,10 +216,12 @@ CdStreamShutdown(void)
#ifndef ONE_THREAD_PER_CHANNEL #ifndef ONE_THREAD_PER_CHANNEL
gCdStreamThreadStatus = 2; gCdStreamThreadStatus = 2;
sem_post(gCdStreamSema); sem_post(gCdStreamSema);
pthread_join(_gCdStreamThread, nil);
#else #else
for ( int32 i = 0; i < gNumChannels; i++ ) { for ( int32 i = 0; i < gNumChannels; i++ ) {
gpReadInfo[i].nThreadStatus = 2; gpReadInfo[i].nThreadStatus = 2;
sem_post(gpReadInfo[i].pStartSemaphore); sem_post(gpReadInfo[i].pStartSemaphore);
pthread_join(gpReadInfo[i].pChannelThread, nil);
} }
#endif #endif
} }

View File

@ -2316,8 +2316,416 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
return num; return num;
} }
const char *XboxButtons[][MAX_CONTROLLERACTIONS] =
{
{
"B", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"X", // PED_SNIPER_ZOOM_IN
"A", // PED_SNIPER_ZOOM_OUT
"Y", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"A", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"B", // VEHICLE_FIREWEAPON
#endif
"A", // VEHICLE_ACCELERATE
"X", // VEHICLE_BRAKE
"LB", // VEHICLE_CHANGE_RADIO_STATION
"LS", // VEHICLE_HORN
"RS", // TOGGLE_SUBMISSIONS
"RB", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"LB", // PED_CENTER_CAMERA_BEHIND_PLAYER
"RB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"B", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"X", // PED_SNIPER_ZOOM_IN
"A", // PED_SNIPER_ZOOM_OUT
"Y", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"A", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"B", // VEHICLE_FIREWEAPON
#endif
"A", // VEHICLE_ACCELERATE
"X", // VEHICLE_BRAKE
"BACK", // VEHICLE_CHANGE_RADIO_STATION
"LB", // VEHICLE_HORN
"RS", // TOGGLE_SUBMISSIONS
"RB", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"LB", // PED_CENTER_CAMERA_BEHIND_PLAYER
"RB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"A", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"Y", // PED_SNIPER_ZOOM_IN
"X", // PED_SNIPER_ZOOM_OUT
"LB", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"B", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"B", // VEHICLE_FIREWEAPON
#endif
"A", // VEHICLE_ACCELERATE
"X", // VEHICLE_BRAKE
"LS", // VEHICLE_CHANGE_RADIO_STATION
"RB", // VEHICLE_HORN
"RS", // TOGGLE_SUBMISSIONS
"Y", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"Y", // PED_CENTER_CAMERA_BEHIND_PLAYER
"RB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"RB", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"X", // PED_SNIPER_ZOOM_IN
"A", // PED_SNIPER_ZOOM_OUT
"Y", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"A", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"RB", // VEHICLE_FIREWEAPON
#endif
nil, // VEHICLE_ACCELERATE
nil, // VEHICLE_BRAKE
"B", // VEHICLE_CHANGE_RADIO_STATION
"LS", // VEHICLE_HORN
"X", // TOGGLE_SUBMISSIONS
"LB", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"B", // PED_CENTER_CAMERA_BEHIND_PLAYER
"LB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
}
};
#if 0 // set 1 for ps2 fonts
#define PS2_TRIANGLE "\""
#define PS2_CIRCLE "|"
#define PS2_CROSS "/"
#define PS2_SQUARE "^"
#else
#define PS2_TRIANGLE "TRIANGLE"
#define PS2_CIRCLE "CIRCLE"
#define PS2_CROSS "CROSS"
#define PS2_SQUARE "SQUARE"
#endif
const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
{
{
PS2_CIRCLE, // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_SQUARE, // PED_SNIPER_ZOOM_IN
PS2_CROSS, // PED_SNIPER_ZOOM_OUT
PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
"SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CROSS, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
PS2_CIRCLE, // VEHICLE_FIREWEAPON
#endif
PS2_CROSS, // VEHICLE_ACCELERATE
PS2_SQUARE, // VEHICLE_BRAKE
"L1", // VEHICLE_CHANGE_RADIO_STATION
"L3", // VEHICLE_HORN
"R3", // TOGGLE_SUBMISSIONS
"R1", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
"L1", // PED_CENTER_CAMERA_BEHIND_PLAYER
"R1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
PS2_CIRCLE, // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_SQUARE, // PED_SNIPER_ZOOM_IN
PS2_CROSS, // PED_SNIPER_ZOOM_OUT
PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
"SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CROSS, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
PS2_CIRCLE, // VEHICLE_FIREWEAPON
#endif
PS2_CROSS, // VEHICLE_ACCELERATE
PS2_SQUARE, // VEHICLE_BRAKE
"BACK", // VEHICLE_CHANGE_RADIO_STATION
"L1", // VEHICLE_HORN
"R3", // TOGGLE_SUBMISSIONS
"R1", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
"L1", // PED_CENTER_CAMERA_BEHIND_PLAYER
"R1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
PS2_CROSS, // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_TRIANGLE, // PED_SNIPER_ZOOM_IN
PS2_SQUARE, // PED_SNIPER_ZOOM_OUT
"L1", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CIRCLE, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
PS2_CIRCLE, // VEHICLE_FIREWEAPON
#endif
PS2_CROSS, // VEHICLE_ACCELERATE
PS2_SQUARE, // VEHICLE_BRAKE
"L3", // VEHICLE_CHANGE_RADIO_STATION
"R1", // VEHICLE_HORN
"R3", // TOGGLE_SUBMISSIONS
PS2_TRIANGLE, // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
PS2_TRIANGLE, // PED_CENTER_CAMERA_BEHIND_PLAYER
"R1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"R1", // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_SQUARE, // PED_SNIPER_ZOOM_IN
PS2_CROSS, // PED_SNIPER_ZOOM_OUT
PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
"SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CROSS, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"R1", // VEHICLE_FIREWEAPON
#endif
nil, // VEHICLE_ACCELERATE
nil, // VEHICLE_BRAKE
PS2_CIRCLE, // VEHICLE_CHANGE_RADIO_STATION
"L3", // VEHICLE_HORN
PS2_SQUARE, // TOGGLE_SUBMISSIONS
"L1", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
PS2_CIRCLE, // PED_CENTER_CAMERA_BEHIND_PLAYER
"L1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
}
};
#undef PS2_TRIANGLE
#undef PS2_CIRCLE
#undef PS2_CROSS
#undef PS2_SQUARE
void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight) void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight)
{ {
#ifdef DETECT_PAD_INPUT_SWITCH
if (CPad::GetPad(0)->IsAffectedByController) {
wchar wstr[16];
// TODO: INI and/or menu setting for Xbox/PS switch
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons;
assert(Buttons[CPad::GetPad(0)->Mode][action] != nil); // we cannot use these
AsciiToUnicode(Buttons[CPad::GetPad(0)->Mode][action], wstr);
CMessages::WideStringCopy(text, wstr, leight);
return;
}
#endif
int32 nums = GetNumOfSettingsForAction((e_ControllerAction)action); int32 nums = GetNumOfSettingsForAction((e_ControllerAction)action);
int32 sets = 0; int32 sets = 0;

View File

@ -1,6 +1,7 @@
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"
#include "General.h"
#include "Quaternion.h" #include "Quaternion.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "ModelIndices.h" #include "ModelIndices.h"
@ -449,6 +450,334 @@ CFileLoader::LoadAtomicFile(RwStream *stream, uint32 id)
return true; return true;
} }
#ifdef HARDCODED_MODEL_FLAGS
char *DoubleSidedNames[] = {
"chnabankdoor",
"Security_Hut",
"Hospital_Sub",
"phonebooth1",
"trafficlight1",
"sub_roadbarrier",
"redlightbuild09",
"doublestreetlght1",
"doc_shedbig31",
"com_land_128",
"garage7",
"proj_garage01",
"buildingground2",
"buildingground3",
"ch_roof_kb",
"overpassind",
"casino",
"ind_land100",
"fuckedup_skewlbus",
"Police_Station_ind",
"flagsitaly",
"sidebarrier_gaz1",
"bar_barrier12",
"bar_barrier10b",
"sidebarrier_gaz2",
"doc_shedbig3",
"doc_shedbig4",
"verticalift_bridge",
"verticalift_bridg2",
"usdcrdlrbuild01",
"apairporthanger",
"apairporthangerA",
"porthangerclosed",
"redlightbuild13",
"doc_rave",
"const_woodfence",
"const_woodfence2",
"const_woodfence3",
"subfraightback01",
"subfraightback02",
"subfraightback03",
"subfraightback04",
"subind_build03",
"chinabanner1",
"chinabanner2",
"chinabanner3",
"chinabanner4",
"Pumpfirescape",
"Pumphouse",
"amcounder",
"barrel1",
"barrel2",
"barrel3",
"barrel4",
"com_1way50",
"com_1way20",
"overpasscom01",
"overpasscom02",
"overpasscom03",
"overpasscom04",
"overpass_comse",
"newdockbuilding",
"newdockbuilding2",
"newdockbuilding",
"policeballhall",
"fuzballdoor",
"ind_land106",
"PoliceBallSigns",
"amcoudet",
"rustship_structure",
"impexpgrgesub",
"ind_land128",
"fshfctry_dstryd",
"railtrax_bentl",
"railtrax_lo4b",
"railtrax_straight",
"railtrax_bentrb",
"railtrax_skew",
"newtrackaaa",
"railtrax_skew5",
// these they forgot:
"railtrax_skewp",
"railtrax_ske2b",
"railtrax_strtshort",
"railtrax_2b",
"railtrax_straightss",
"railtrax_bentr",
""
};
char *TreeNames[] = {
"coast_treepatch",
"comparknewtrees",
"comtreepatchprk",
"condotree01",
"condotree1",
"indatree03",
"indtreepatch5",
"indtreepatch06f",
"new_carprktrees",
"new_carprktrees4",
"newcoasttrees1",
"newcoasttrees2",
"newcoasttrees3",
"newtreepatch_sub",
"newtrees1_sub",
"newunitrepatch",
"pinetree_narrow",
"pinetree_wide",
"treencom2",
"treepatch",
"treepatch01_sub",
"treepatch02_sub",
"treepatch2",
"treepatch2b",
"treepatch03",
"treepatch03_sub",
"treepatch04_sub",
"treepatch05_sub",
"treepatch06_sub",
"treepatch07_sub",
"treepatch08_sub",
"treepatch09_sub",
"treepatch10_sub",
"treepatch11_sub",
"treepatch12_sub",
"treepatch13_sub",
"treepatch14_sub",
"treepatch15_sub",
"treepatch16_sub",
"treepatch17_sub",
"treepatch18_sub",
"treepatch19_sub",
"treepatch20_sub",
"treepatch21_sub",
"treepatch22_sub",
"treepatch23_sub",
"treepatch24_sub",
"treepatch25_sub",
"treepatch26_sub",
"treepatch27_sub",
"treepatch28_sub",
"treepatch29_sub",
"treepatch30_sub",
"treepatch31_sub",
"treepatch32_sub",
"treepatch33_sub",
"treepatch34_sub",
"treepatch35_sub",
"treepatch69",
"treepatch152_sub",
"treepatch153_sub",
"treepatch171_sub",
"treepatch172_sub",
"treepatch173_sub",
"treepatch212_sub",
"treepatch213_sub",
"treepatch214_sub",
"treepatcha",
"treepatchb",
"treepatchcomtop1",
"treepatchd",
"treepatche",
"treepatchh",
"treepatchindaa2",
"treepatchindnew",
"treepatchindnew2",
"treepatchk",
"treepatchkb4",
"treepatchkb5",
"treepatchkb6",
"treepatchkb7",
"treepatchkb9",
"treepatchl",
"treepatchm",
"treepatchnew_sub",
"treepatchttwrs",
"treesuni1",
"trepatchindaa1",
"veg_bush2",
"veg_bush14",
"veg_tree1",
"veg_tree3",
"veg_treea1",
"veg_treea3",
"veg_treeb1",
"veg_treenew01",
"veg_treenew03",
"veg_treenew05",
"veg_treenew06",
"veg_treenew08",
"veg_treenew09",
"veg_treenew10",
"veg_treenew16",
"veg_treenew17",
"vegclubtree01",
"vegclubtree02",
"vegclubtree03",
"vegpathtree",
""
};
char *OptimizedNames[] = {
"coast_treepatch",
"comparknewtrees",
"comtreepatchprk",
"indtreepatch5",
"indtreepatch06f",
"new_carprktrees",
"new_carprktrees4",
"newcoasttrees1",
"newcoasttrees2",
"newcoasttrees3",
"newtreepatch_sub",
"newtrees1_sub",
"newunitrepatch",
"treepatch",
"treepatch01_sub",
"treepatch02_sub",
"treepatch2",
"treepatch2b",
"treepatch03",
"treepatch03_sub",
"treepatch04_sub",
"treepatch05_sub",
"treepatch06_sub",
"treepatch07_sub",
"treepatch08_sub",
"treepatch09_sub",
"treepatch10_sub",
"treepatch11_sub",
"treepatch12_sub",
"treepatch13_sub",
"treepatch14_sub",
"treepatch15_sub",
"treepatch16_sub",
"treepatch17_sub",
"treepatch18_sub",
"treepatch19_sub",
"treepatch20_sub",
"treepatch21_sub",
"treepatch22_sub",
"treepatch23_sub",
"treepatch24_sub",
"treepatch25_sub",
"treepatch26_sub",
"treepatch27_sub",
"treepatch28_sub",
"treepatch29_sub",
"treepatch30_sub",
"treepatch31_sub",
"treepatch32_sub",
"treepatch33_sub",
"treepatch34_sub",
"treepatch35_sub",
"treepatch69",
"treepatch152_sub",
"treepatch153_sub",
"treepatch171_sub",
"treepatch172_sub",
"treepatch173_sub",
"treepatch212_sub",
"treepatch213_sub",
"treepatch214_sub",
"treepatcha",
"treepatchb",
"treepatchcomtop1",
"treepatchd",
"treepatche",
"treepatchh",
"treepatchindaa2",
"treepatchindnew",
"treepatchindnew2",
"treepatchk",
"treepatchkb4",
"treepatchkb5",
"treepatchkb6",
"treepatchkb7",
"treepatchkb9",
"treepatchl",
"treepatchm",
"treepatchnew_sub",
"treepatchttwrs",
"treesuni1",
"trepatchindaa1",
"combtm_treeshad01",
"combtm_treeshad02",
"combtm_treeshad03",
"combtm_treeshad04",
"combtm_treeshad05",
"combtm_treeshad06",
"comtop_tshad",
"comtop_tshad2",
"comtop_tshad3",
"comtop_tshad4",
"comtop_tshad5",
"comtop_tshad6",
"se_treeshad01",
"se_treeshad02",
"se_treeshad03",
"se_treeshad04",
"se_treeshad05",
"se_treeshad06",
"treeshads01",
"treeshads02",
"treeshads03",
"treeshads04",
"treeshads05",
""
};
// not from mobile
static bool
MatchModelName(char *name, char **list)
{
int i;
char *s;
for(i = 0; *list[i] != '\0'; i++)
if(strncmp(name, "LOD", 3) == 0){
if(!CGeneral::faststricmp(name+3, list[i]+3))
return true;
}else{
if(!CGeneral::faststricmp(name, list[i]))
return true;
}
return false;
}
#endif
RpAtomic* RpAtomic*
CFileLoader::SetRelatedModelInfoCB(RpAtomic *atomic, void *data) CFileLoader::SetRelatedModelInfoCB(RpAtomic *atomic, void *data)
{ {
@ -600,6 +929,21 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
mi->m_isSubway = !!(flags & 0x10); mi->m_isSubway = !!(flags & 0x10);
mi->m_ignoreLight = !!(flags & 0x20); mi->m_ignoreLight = !!(flags & 0x20);
mi->m_noZwrite = !!(flags & 0x40); mi->m_noZwrite = !!(flags & 0x40);
#ifdef EXTRA_MODEL_FLAGS
// same flag values as SA
mi->m_bIsTree = !!(flags & 0x2000);
mi->m_bIsDoubleSided = !!(flags & 0x200000);
// new value otherwise unused
mi->m_bCanBeIgnored = !!(flags & 0x10000);
#ifdef HARDCODED_MODEL_FLAGS
// mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
if(MatchModelName(mi->GetName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
if(MatchModelName(mi->GetName(), TreeNames)) mi->m_bIsTree = true;
if(MatchModelName(mi->GetName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
#endif
#endif
} }
void void

View File

@ -783,15 +783,17 @@ CMenuManager::Draw()
CFont::SetJustifyOn(); CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn(); CFont::SetBackGroundOnlyTextOn();
#ifdef GTA3_1_1_PATCH #ifdef GTA3_1_1_PATCH
#ifdef DRAW_MENU_VERSION_TEXT
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
CFont::SetScale(MENU_X(0.7f), MENU_Y(0.5f)); CFont::SetScale(MENU_X(0.7f), MENU_Y(0.5f));
CFont::SetWrapx(SCREEN_WIDTH); CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
strcpy(gString, "V1.1"); strcpy(gString, "V1.1");
AsciiToUnicode(gString, gUString); AsciiToUnicode(gString, gUString);
CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString); CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString);
#endif
#endif #endif
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH)); CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
@ -873,7 +875,7 @@ CMenuManager::Draw()
#endif #endif
} }
CFont::SetCentreSize(SCREEN_WIDTH); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
#ifdef PS2_LIKE_MENU #ifdef PS2_LIKE_MENU
bool itemsAreSelectable = !bottomBarActive; bool itemsAreSelectable = !bottomBarActive;
@ -3575,11 +3577,11 @@ CMenuManager::MessageScreen(const char *text)
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetJustifyOn(); CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn(); CFont::SetBackGroundOnlyTextOn();
CFont::SetWrapx(SCREEN_WIDTH - StretchX(170.0f)); CFont::SetWrapx(SCREEN_WIDTH - StretchX(170.0f)); // not used
CFont::SetRightJustifyWrap(SCREEN_WIDTH - StretchX(170.0f)); CFont::SetRightJustifyWrap(SCREEN_WIDTH - StretchX(170.0f)); // not used
CSprite2d::DrawRect(CRect(StretchX(120.0f), StretchY(150.0f), SCREEN_WIDTH - StretchX(120.0f), SCREEN_HEIGHT - StretchY(220.0f)), CRGBA(50, 50, 50, 210)); CSprite2d::DrawRect(CRect(StretchX(120.0f), StretchY(150.0f), SCREEN_WIDTH - StretchX(120.0f), SCREEN_HEIGHT - StretchY(220.0f)), CRGBA(50, 50, 50, 210));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetCentreSize(SCREEN_STRETCH_X(380.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(380.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetColor(CRGBA(255, 217, 106, 255)); CFont::SetColor(CRGBA(255, 217, 106, 255));
CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE)); CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE));

View File

@ -89,6 +89,7 @@
#include "frontendoption.h" #include "frontendoption.h"
#include "postfx.h" #include "postfx.h"
#include "custompipes.h" #include "custompipes.h"
#include "crossplatform.h"
eLevelName CGame::currLevel; eLevelName CGame::currLevel;
bool CGame::bDemoMode = true; bool CGame::bDemoMode = true;
@ -128,10 +129,10 @@ void MessageScreen(char *msg)
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f // unused
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f)); CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f CFont::SetCentreSize(SCREEN_SCALE_X(450.0f)); // 450.0f
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255)); CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetDropColor(CRGBA(32, 32, 32, 255)); CFont::SetDropColor(CRGBA(32, 32, 32, 255));
@ -277,12 +278,31 @@ bool CGame::InitialiseOnceAfterRW(void)
if ( DMAudio.GetNum3DProvidersAvailable() == 0 ) if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1; FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) {
{
CMenuManager::m_PrefsSpeakers = 0; CMenuManager::m_PrefsSpeakers = 0;
int8 provider = DMAudio.AutoDetect3DProviders(); int32 i;
if ( provider != -1 ) for (i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++) {
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider; wchar buff[64];
#ifdef AUDIO_OAL
extern int defaultProvider;
if (defaultProvider >= 0 && defaultProvider < DMAudio.GetNum3DProvidersAvailable())
break;
#endif
char *name = DMAudio.Get3DProviderName(i);
AsciiToUnicode(name, buff);
char *providername = UnicodeToAscii(buff);
strupr(providername);
#if defined(AUDIO_MSS)
if (strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") == 0)
break;
#elif defined(AUDIO_OAL)
if (strcmp(providername, "OPENAL SOFT") == 0)
break;
#endif
}
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = i;
} }
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex); DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
@ -725,10 +745,10 @@ void CGame::InitialiseWhenRestarting(void)
//CFont::SetFontStyle(?); //CFont::SetFontStyle(?);
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f // unused
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f)); CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f CFont::SetCentreSize(SCREEN_SCALE_X(480.0f)); // 480.0f
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255)); CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();

View File

@ -2399,7 +2399,7 @@ bool CPad::GetAnaloguePadLeftJustUp(void)
if ( X == 0 && oldfStickX < 0 ) if ( X == 0 && oldfStickX < 0 )
{ {
oldfStickX = X; oldfStickX = 0;
return true; return true;
} }
@ -2419,7 +2419,7 @@ bool CPad::GetAnaloguePadRightJustUp(void)
if ( X == 0 && oldfStickX > 0 ) if ( X == 0 && oldfStickX > 0 )
{ {
oldfStickX = X; oldfStickX = 0;
return true; return true;
} }
@ -2593,7 +2593,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetScale(0.85f, 1.0f); CFont::SetScale(0.85f, 1.0f);
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_WIDTH - 20); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200)); CFont::SetColor(CRGBA(255, 255, 200, 200));
@ -2610,7 +2610,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetScale(0.85f, 1.0f); CFont::SetScale(0.85f, 1.0f);
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_WIDTH - 20); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200)); CFont::SetColor(CRGBA(255, 255, 200, 200));

View File

@ -84,10 +84,6 @@ static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
#define RADAR_MAX_SPEED (0.9f) #define RADAR_MAX_SPEED (0.9f)
#ifdef MENU_MAP #ifdef MENU_MAP
CRGBA CRadar::ArrowBlipColour1;
CRGBA CRadar::ArrowBlipColour2;
uint16 CRadar::MapLegendCounter;
uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
int CRadar::TargetMarkerId = -1; int CRadar::TargetMarkerId = -1;
CVector CRadar::TargetMarkerPos; CVector CRadar::TargetMarkerPos;
#endif #endif
@ -116,7 +112,7 @@ void RequestMapSection(int32 x, int32 y)
void RemoveMapSection(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]); CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
} }
@ -709,6 +705,7 @@ void CRadar::DrawBlips()
if (CMenuManager::bMenuMapActive) { if (CMenuManager::bMenuMapActive) {
CVector2D in, out; CVector2D in, out;
TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift()); TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
DrawYouAreHereSprite(out.x, out.y); DrawYouAreHereSprite(out.x, out.y);
} }
@ -782,14 +779,20 @@ void CRadar::DrawRadarMask()
}; };
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (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 out[8];
CVector2D in; CVector2D in;
@ -810,7 +813,10 @@ void CRadar::DrawRadarMask()
CSprite2d::SetMaskVertices(8, (float *)out); CSprite2d::SetMaskVertices(8, (float *)out);
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8); 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) void CRadar::DrawRadarSection(int32 x, int32 y)
@ -860,46 +866,22 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha) void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{ {
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha)); RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive) {
bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == sprite)
alreadyThere = true;
}
if (!alreadyThere) {
MapLegendList[MapLegendCounter] = sprite;
MapLegendCounter++;
}
}
#endif
} }
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha) void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
{ {
CVector curPosn[4]; CVector curPosn[4];
CVector oldPosn[4]; const float sizeX = SCREEN_SCALE_X(8.0f);
const float correctedAngle = angle - PI / 4.f;
curPosn[0].x = x - SCREEN_SCALE_X(5.6f); const float sizeY = SCREEN_SCALE_Y(8.0f);
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);
for (uint32 i = 0; i < 4; i++) { for (uint32 i = 0; i < 4; i++) {
oldPosn[i] = curPosn[i]; const float cornerAngle = i * HALFPI + correctedAngle;
curPosn[i].x = x + (0.0f * Cos(cornerAngle) + 1.0f * Sin(cornerAngle)) * sizeX;
curPosn[i].x = x + (oldPosn[i].x - x) * Cos(angle) + (oldPosn[i].y - y) * Sin(angle); curPosn[i].y = y - (0.0f * Sin(cornerAngle) - 1.0f * Cos(cornerAngle)) * sizeY;
curPosn[i].y = y - (oldPosn[i].x - x) * Sin(angle) + (oldPosn[i].y - y) * Cos(angle);
} }
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) int32 CRadar::GetActualBlipArrayIndex(int32 i)
@ -925,43 +907,43 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{ {
int32 c; int32 c;
switch (color) { switch (color) {
case 0: case RADAR_TRACE_RED:
if (bright) if (bright)
c = 0x712B49FF; c = 0x712B49FF;
else else
c = 0x7F0000FF; c = 0x7F0000FF;
break; break;
case 1: case RADAR_TRACE_GREEN:
if (bright) if (bright)
c = 0x5FA06AFF; c = 0x5FA06AFF;
else else
c = 0x007F00FF; c = 0x007F00FF;
break; break;
case 2: case RADAR_TRACE_LIGHT_BLUE:
if (bright) if (bright)
c = 0x80A7F3FF; c = 0x80A7F3FF;
else else
c = 0x00007FFF; c = 0x00007FFF;
break; break;
case 3: case RADAR_TRACE_GRAY:
if (bright) if (bright)
c = 0xE1E1E1FF; c = 0xE1E1E1FF;
else else
c = 0x7F7F7FFF; c = 0x7F7F7FFF;
break; break;
case 4: case RADAR_TRACE_YELLOW:
if (bright) if (bright)
c = 0xFFFF00FF; c = 0xFFFF00FF;
else else
c = 0x7F7F00FF; c = 0x7F7F00FF;
break; break;
case 5: case RADAR_TRACE_MAGENTA:
if (bright) if (bright)
c = 0xFF00FFFF; c = 0xFF00FFFF;
else else
c = 0x7F007FFF; c = 0x7F007FFF;
break; break;
case 6: case RADAR_TRACE_CYAN:
if (bright) if (bright)
c = 0x00FFFFFF; c = 0x00FFFFFF;
else else
@ -1215,21 +1197,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)); 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; break;
} }
#ifdef MENU_MAP
// VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
if (CMenuManager::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);
}
}
#endif
} }
void CRadar::Shutdown() void CRadar::Shutdown()
@ -1415,12 +1382,6 @@ CRadar::InitFrontEndMap()
vec2DRadarOrigin.x = 0.0f; vec2DRadarOrigin.x = 0.0f;
vec2DRadarOrigin.y = 0.0f; vec2DRadarOrigin.y = 0.0f;
m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
MapLegendList[i] = RADAR_SPRITE_NONE;
}
MapLegendCounter = 0;
ArrowBlipColour1 = CRGBA(0, 0, 0, 0);
ArrowBlipColour2 = CRGBA(0, 0, 0, 0);
} }
void void
@ -1448,7 +1409,6 @@ CRadar::DrawYouAreHereSprite(float x, float y)
float bottom = y - SCREEN_SCALE_Y(24.0f); float bottom = y - SCREEN_SCALE_Y(24.0f);
CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255)); CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
} }
MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
} }
void void
@ -1465,8 +1425,8 @@ CRadar::ToggleTargetMarker(float x, float y)
return; return;
#endif #endif
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD; ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
ms_RadarTrace[nextBlip].m_nColor = 0x333333FF; ms_RadarTrace[nextBlip].m_nColor = RADAR_TRACE_GRAY;
ms_RadarTrace[nextBlip].m_bDim = 1; ms_RadarTrace[nextBlip].m_bDim = 0;
ms_RadarTrace[nextBlip].m_bInUse = 1; ms_RadarTrace[nextBlip].m_bInUse = 1;
ms_RadarTrace[nextBlip].m_Radius = 1.0f; ms_RadarTrace[nextBlip].m_Radius = 1.0f;
CVector pos(x, y, CWorld::FindGroundZForCoord(x,y)); CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));

View File

@ -49,6 +49,17 @@ enum eRadarSprite
RADAR_SPRITE_COUNT RADAR_SPRITE_COUNT
}; };
enum
{
RADAR_TRACE_RED,
RADAR_TRACE_GREEN,
RADAR_TRACE_LIGHT_BLUE,
RADAR_TRACE_GRAY,
RADAR_TRACE_YELLOW,
RADAR_TRACE_MAGENTA,
RADAR_TRACE_CYAN
};
enum enum
{ {
BLIP_MODE_TRIANGULAR_UP = 0, BLIP_MODE_TRIANGULAR_UP = 0,
@ -108,11 +119,6 @@ public:
static float cachedCos; static float cachedCos;
static float cachedSin; static float cachedSin;
#ifdef MENU_MAP #ifdef MENU_MAP
#define NUM_MAP_LEGENDS 75
static CRGBA ArrowBlipColour1;
static CRGBA ArrowBlipColour2;
static uint16 MapLegendList[NUM_MAP_LEGENDS];
static uint16 MapLegendCounter;
static int TargetMarkerId; static int TargetMarkerId;
static CVector TargetMarkerPos; static CVector TargetMarkerPos;

View File

@ -21,7 +21,11 @@ CColModel CTempColModels::ms_colModelBonnet1;
CColSphere s_aPedSpheres[3]; CColSphere s_aPedSpheres[3];
CColSphere s_aPed2Spheres[3]; CColSphere s_aPed2Spheres[3];
CColSphere s_aPedGSpheres[4]; CColSphere s_aPedGSpheres[4];
#ifdef FIX_BUGS
CColSphere s_aDoorSpheres[3];
#else
CColSphere s_aDoorSpheres[4]; CColSphere s_aDoorSpheres[4];
#endif
CColSphere s_aBumperSpheres[4]; CColSphere s_aBumperSpheres[4];
CColSphere s_aPanelSpheres[4]; CColSphere s_aPanelSpheres[4];
CColSphere s_aBonnetSpheres[4]; CColSphere s_aBonnetSpheres[4];
@ -129,7 +133,11 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[1].center = CVector(0.0f, -0.95f, -0.35f); s_aDoorSpheres[1].center = CVector(0.0f, -0.95f, -0.35f);
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f); s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
#ifdef FIX_BUGS
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) { 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].surface = SURFACE_CAR_PANEL;
s_aDoorSpheres[i].piece = 0; s_aDoorSpheres[i].piece = 0;
} }

View File

@ -75,7 +75,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return; if(ent->IsBuilding() || ent->IsDummy()) return;
if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList(); if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
} }
void void
@ -90,7 +90,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return; if(ent->IsBuilding() || ent->IsDummy()) return;
if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList(); if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
} }
void void
@ -1960,7 +1960,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt); RemoveEntityInsteadOfProcessingIt(movingEnt);
} else { } else {
movingEnt->ProcessControl(); movingEnt->ProcessControl();
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); } if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
} }
} }
bForceProcessControl = true; bForceProcessControl = true;
@ -1971,7 +1971,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt); RemoveEntityInsteadOfProcessingIt(movingEnt);
} else { } else {
movingEnt->ProcessControl(); movingEnt->ProcessControl();
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); } if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
} }
} }
} }
@ -2124,13 +2124,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
CObject *pObject = (CObject *)pEntity; CObject *pObject = (CObject *)pEntity;
CVehicle *pVehicle = (CVehicle *)pEntity; CVehicle *pVehicle = (CVehicle *)pEntity;
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
if(pEntity->IsStatic()) { if(pEntity->GetIsStatic()) {
if(pEntity->IsObject()) { if(pEntity->IsObject()) {
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) { if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if (IsGlass(pObject->GetModelIndex())) { if (IsGlass(pObject->GetModelIndex())) {
CGlass::WindowRespondsToExplosion(pObject, position); CGlass::WindowRespondsToExplosion(pObject, position);
} else { } else {
pObject->bIsStatic = false; pObject->SetIsStatic(false);
pObject->AddToMovingList(); pObject->AddToMovingList();
int16 modelId = pEntity->GetModelIndex(); int16 modelId = pEntity->GetModelIndex();
if(modelId != MI_FIRE_HYDRANT || if(modelId != MI_FIRE_HYDRANT ||
@ -2148,18 +2148,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
} }
} }
} }
if(pEntity->IsStatic()) { if(pEntity->GetIsStatic()) {
float fDamageMultiplier = float fDamageMultiplier =
(fRadius - fMagnitude) * 2.0f / fRadius; (fRadius - fMagnitude) * 2.0f / fRadius;
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f); float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
pObject->ObjectDamage(fDamage); pObject->ObjectDamage(fDamage);
} }
} else { } else {
pEntity->bIsStatic = false; pEntity->SetIsStatic(false);
pEntity->AddToMovingList(); pEntity->AddToMovingList();
} }
} }
if(!pEntity->IsStatic()) { if(!pEntity->GetIsStatic()) {
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f); float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
CVector vecForceDir = CVector vecForceDir =
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier / vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /

View File

@ -156,6 +156,23 @@ enum Config {
// any debug stuff that is only left in mobile, is not in MASTER // any debug stuff that is only left in mobile, is not in MASTER
//#define MASTER //#define MASTER
// once and for all:
// pc: FINAL & MASTER
// mobile: FINAL
// MASTER builds must be FINAL
#ifdef MASTER
#define FINAL
#endif
// quality of life fixes that should also be in FINAL
#define NASTY_GAME // nasty game for all languages
#define NO_CDCHECK
// those infamous texts
#define DRAW_GAME_VERSION_TEXT
#define DRAW_MENU_VERSION_TEXT
#if defined GTA_PS2 #if defined GTA_PS2
# define GTA_PS2_STUFF # define GTA_PS2_STUFF
# define RANDOMSPLASH # define RANDOMSPLASH
@ -177,9 +194,13 @@ enum Config {
#ifdef MASTER #ifdef MASTER
// only in master builds // only in master builds
#undef DRAW_GAME_VERSION_TEXT
#else #else
// not in master builds // not in master builds
#define VALIDATE_SAVE_SIZE #define VALIDATE_SAVE_SIZE
#define NO_MOVIES // disable intro videos
#define DEBUGMENU
#endif #endif
#ifdef FINAL #ifdef FINAL
@ -187,11 +208,7 @@ enum Config {
# define USE_MY_DOCUMENTS // use my documents directory for user files # define USE_MY_DOCUMENTS // use my documents directory for user files
#else #else
// not in any game // not in any game
# define NASTY_GAME // nasty game for all languages
# define NO_MOVIES // disable intro videos
# define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading # define CHATTYSPLASH // print what the game is loading
# define DEBUGMENU
# define TIMEBARS // print debug timers # define TIMEBARS // print debug timers
#endif #endif
@ -201,6 +218,9 @@ enum Config {
#define LOAD_INI_SETTINGS #define LOAD_INI_SETTINGS
// Rendering/display // Rendering/display
//#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
// NB: keep this enabled unless your map IDEs have these flags baked in
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img #define USE_TXD_CDIMAGE // generate and load textures from txd.img

View File

@ -768,6 +768,8 @@ DisplayGameDebugText()
char str[200]; char str[200];
wchar ustr[200]; wchar ustr[200];
#ifdef DRAW_GAME_VERSION_TEXT
wchar ver[200]; wchar ver[200];
AsciiToUnicode(version_name, ver); AsciiToUnicode(version_name, ver);
@ -783,6 +785,7 @@ DisplayGameDebugText()
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetColor(CRGBA(255, 108, 0, 255)); CFont::SetColor(CRGBA(255, 108, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver); CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver);
#endif
FrameSamples++; FrameSamples++;
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f); FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
@ -841,7 +844,7 @@ DisplayGameDebugText()
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetWrapx(640.0f); CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
@ -1008,9 +1011,7 @@ Idle(void *arg)
CTimer::Update(); CTimer::Update();
#ifdef TIMEBARS
tbInit(); tbInit();
#endif
CSprite2d::InitPerFrame(); CSprite2d::InitPerFrame();
CFont::InitPerFrame(); CFont::InitPerFrame();
@ -1026,39 +1027,27 @@ Idle(void *arg)
FrontEndMenuManager.Process(); FrontEndMenuManager.Process();
} else { } else {
CPointLights::InitPerFrame(); CPointLights::InitPerFrame();
#ifdef TIMEBARS
tbStartTimer(0, "CGame::Process"); tbStartTimer(0, "CGame::Process");
#endif
CGame::Process(); CGame::Process();
#ifdef TIMEBARS
tbEndTimer("CGame::Process"); tbEndTimer("CGame::Process");
tbStartTimer(0, "DMAudio.Service"); tbStartTimer(0, "DMAudio.Service");
#endif
DMAudio.Service(); DMAudio.Service();
#ifdef TIMEBARS
tbEndTimer("DMAudio.Service"); tbEndTimer("DMAudio.Service");
#endif
} }
if (RsGlobal.quit) if (RsGlobal.quit)
return; return;
#else #else
CPointLights::InitPerFrame(); CPointLights::InitPerFrame();
#ifdef TIMEBARS
tbStartTimer(0, "CGame::Process"); tbStartTimer(0, "CGame::Process");
#endif
CGame::Process(); CGame::Process();
#ifdef TIMEBARS
tbEndTimer("CGame::Process"); tbEndTimer("CGame::Process");
tbStartTimer(0, "DMAudio.Service"); tbStartTimer(0, "DMAudio.Service");
#endif
DMAudio.Service(); DMAudio.Service();
#ifdef TIMEBARS
tbEndTimer("DMAudio.Service"); tbEndTimer("DMAudio.Service");
#endif
#endif #endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){ if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
@ -1098,18 +1087,13 @@ Idle(void *arg)
RsMouseSetPos(&pos); RsMouseSetPos(&pos);
} }
#endif #endif
#ifdef TIMEBARS
tbStartTimer(0, "CnstrRenderList"); tbStartTimer(0, "CnstrRenderList");
#endif
CRenderer::ConstructRenderList(); CRenderer::ConstructRenderList();
#ifdef TIMEBARS
tbEndTimer("CnstrRenderList"); tbEndTimer("CnstrRenderList");
tbStartTimer(0, "PreRender"); tbStartTimer(0, "PreRender");
#endif
CRenderer::PreRender(); CRenderer::PreRender();
#ifdef TIMEBARS
tbEndTimer("PreRender"); tbEndTimer("PreRender");
#endif
#ifdef FIX_BUGS #ifdef FIX_BUGS
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); // TODO: temp? this fixes OpenGL render but there should be a better place for this RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); // TODO: temp? this fixes OpenGL render but there should be a better place for this
@ -1135,13 +1119,9 @@ Idle(void *arg)
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart()); RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
#endif #endif
#ifdef TIMEBARS
tbStartTimer(0, "RenderScene"); tbStartTimer(0, "RenderScene");
#endif
RenderScene(); RenderScene();
#ifdef TIMEBARS
tbEndTimer("RenderScene"); tbEndTimer("RenderScene");
#endif
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES
CustomPipes::EnvMapRender(); CustomPipes::EnvMapRender();
@ -1150,21 +1130,16 @@ Idle(void *arg)
RenderDebugShit(); RenderDebugShit();
RenderEffects(); RenderEffects();
#ifdef TIMEBARS
tbStartTimer(0, "RenderMotionBlur"); tbStartTimer(0, "RenderMotionBlur");
#endif
if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) && if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
TheCamera.m_ScreenReductionPercentage > 0.0f) TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150); TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur(); TheCamera.RenderMotionBlur();
#ifdef TIMEBARS
tbEndTimer("RenderMotionBlur"); tbEndTimer("RenderMotionBlur");
tbStartTimer(0, "Render2dStuff"); tbStartTimer(0, "Render2dStuff");
#endif
Render2dStuff(); Render2dStuff();
#ifdef TIMEBARS
tbEndTimer("Render2dStuff"); tbEndTimer("Render2dStuff");
#endif
}else{ }else{
#ifdef ASPECT_RATIO_SCALE #ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
@ -1181,35 +1156,28 @@ Idle(void *arg)
if (FrontEndMenuManager.m_bMenuActive) if (FrontEndMenuManager.m_bMenuActive)
DefinedState(); DefinedState();
#endif #endif
#ifdef TIMEBARS
tbStartTimer(0, "RenderMenus"); tbStartTimer(0, "RenderMenus");
#endif
RenderMenus(); RenderMenus();
#ifdef TIMEBARS
tbEndTimer("RenderMenus"); tbEndTimer("RenderMenus");
tbStartTimer(0, "DoFade");
#endif
#ifdef PS2_MENU #ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad ) if ( TheMemoryCard.m_bWantToLoad )
return; return;
#endif #endif
tbStartTimer(0, "DoFade");
DoFade(); DoFade();
#ifdef TIMEBARS
tbEndTimer("DoFade"); tbEndTimer("DoFade");
tbStartTimer(0, "Render2dStuff-Fade"); tbStartTimer(0, "Render2dStuff-Fade");
#endif
Render2dStuffAfterFade(); Render2dStuffAfterFade();
#ifdef TIMEBARS
tbEndTimer("Render2dStuff-Fade"); tbEndTimer("Render2dStuff-Fade");
#endif
CCredits::Render(); CCredits::Render();
#ifdef TIMEBARS
if (gbShowTimebars) if (gbShowTimebars)
tbDisplay(); tbDisplay();
#endif
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();

View File

@ -16,6 +16,8 @@ extern bool gbPrintShite;
extern bool gbModelViewer; extern bool gbModelViewer;
#ifdef TIMEBARS #ifdef TIMEBARS
extern bool gbShowTimebars; extern bool gbShowTimebars;
#else
#define gbShowTimebars false
#endif #endif
class CSprite2d; class CSprite2d;

View File

@ -33,6 +33,11 @@
#include "postfx.h" #include "postfx.h"
#include "custompipes.h" #include "custompipes.h"
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#include "FileMgr.h"
#include "ControllerConfig.h"
#endif
#ifndef _WIN32 #ifndef _WIN32
#include "assert.h" #include "assert.h"
#include <stdarg.h> #include <stdarg.h>
@ -275,7 +280,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
const char *joyname; const char *joyname;
if (userHovering) { if (userHovering) {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) { for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
if (joyname = glfwGetJoystickName(i)) { if ((joyname = glfwGetJoystickName(i))) {
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons); const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
for (int j = 0; j < numButtons; j++) { for (int j = 0; j < numButtons; j++) {
if (buttons[j]) { if (buttons[j]) {
@ -455,8 +460,34 @@ void LoadINISettings()
char defaultStr[4]; char defaultStr[4];
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// Written by assuming the codes below will run after _InputInitialiseJoys().
strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str()); strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str());
_InputInitialiseJoys();
if(gSelectedJoystickName[0] != '\0') {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
if (glfwJoystickPresent(i) && strncmp(gSelectedJoystickName, glfwGetJoystickName(i), strlen(gSelectedJoystickName)) == 0) {
if (PSGLOBAL(joy1id) != -1) {
PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
}
PSGLOBAL(joy1id) = i;
int count;
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
// We need to init and reload bindings, because;
// 1-joypad button number may differ with saved/prvly connected one
// 2-bindings are not init'ed if there is no joypad at the start
ControlsManager.InitDefaultControlConfigJoyPad(count);
CFileMgr::SetDirMyDocuments();
int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
if (gta3set) {
ControlsManager.LoadSettings(gta3set);
CFileMgr::CloseFile(gta3set);
}
CFileMgr::SetDir("");
break;
}
}
}
#endif #endif
#ifdef CUSTOM_FRONTEND_OPTIONS #ifdef CUSTOM_FRONTEND_OPTIONS
@ -818,9 +849,12 @@ DebugMenuPopulate(void)
DebugMenuEntrySetWrap(e, true); DebugMenuEntrySetWrap(e, true);
DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f); DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f);
DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f); DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f);
DebugMenuAddVar("Render", "Neo Ped Rim light", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f); DebugMenuAddVarBool8("Render", "Neo Ped Rim light enable", &CustomPipes::RimlightEnable, nil);
DebugMenuAddVar("Render", "Neo World Lightmaps", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f); DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
DebugMenuAddVar("Render", "Neo Road Gloss", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f); DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil);
DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil);
DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
#endif #endif
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil); DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil); DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);

View File

@ -1,6 +1,13 @@
#pragma once #pragma once
#ifdef TIMEBARS
void tbInit(); void tbInit();
void tbStartTimer(int32, Const char*); void tbStartTimer(int32, Const char*);
void tbEndTimer(Const char*); void tbEndTimer(Const char*);
void tbDisplay(); void tbDisplay();
#else
#define tbInit()
#define tbStartTimer(a, b)
#define tbEndTimer(a)
#define tbDisplay()
#endif

View File

@ -97,7 +97,8 @@ public:
eEntityStatus GetStatus() const { return (eEntityStatus)m_status; } eEntityStatus GetStatus() const { return (eEntityStatus)m_status; }
void SetStatus(eEntityStatus status) { m_status = status; } void SetStatus(eEntityStatus status) { m_status = status; }
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); } CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
bool IsStatic(void) { return bIsStatic; } bool GetIsStatic(void) const { return bIsStatic; }
void SetIsStatic(bool state) { bIsStatic = state; }
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
void SaveEntityFlags(uint8*& buf); void SaveEntityFlags(uint8*& buf);
void LoadEntityFlags(uint8*& buf); void LoadEntityFlags(uint8*& buf);

View File

@ -341,7 +341,7 @@ CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
AddCollisionRecord(ent); AddCollisionRecord(ent);
if(!ent->IsBuilding()) // Can't this catch dummies too? if(!ent->IsBuilding()) // Can't this catch dummies too?
((CPhysical*)ent)->AddCollisionRecord(this); ((CPhysical*)ent)->AddCollisionRecord(this);
if(ent->IsBuilding() || ent->IsStatic()) if(ent->IsBuilding() || ent->GetIsStatic())
this->bHasHitWall = true; this->bHasHitWall = true;
} }
return numSpheres; return numSpheres;
@ -377,7 +377,7 @@ CPhysical::ProcessControl(void)
m_nStaticFrames++; m_nStaticFrames++;
if(m_nStaticFrames > 10){ if(m_nStaticFrames > 10){
m_nStaticFrames = 10; m_nStaticFrames = 10;
bIsStatic = true; SetIsStatic(true);
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecMoveFriction = m_vecMoveSpeed; m_vecMoveFriction = m_vecMoveSpeed;
@ -556,7 +556,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
massFactorB = B->bIsHeavy ? 2.0f : 1.0f; massFactorB = B->bIsHeavy ? 2.0f : 1.0f;
float speedA, speedB; float speedA, speedB;
if(B->IsStatic()){ if(B->GetIsStatic()){
if(A->bPedPhysics){ if(A->bPedPhysics){
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal); speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
if(speedA < 0.0f){ if(speedA < 0.0f){
@ -567,7 +567,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(IsGlass(B->GetModelIndex())) if(IsGlass(B->GetModelIndex()))
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false); CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
else if(!B->bInfiniteMass) else if(!B->bInfiniteMass)
B->bIsStatic = false; B->SetIsStatic(false);
}else{ }else{
if(IsGlass(B->GetModelIndex())) if(IsGlass(B->GetModelIndex()))
CGlass::WindowRespondsToSoftCollision(B, impulseA); CGlass::WindowRespondsToSoftCollision(B, impulseA);
@ -576,7 +576,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
return true; return true;
} }
}else if(!B->bInfiniteMass) }else if(!B->bInfiniteMass)
B->bIsStatic = false; B->SetIsStatic(false);
if(B->bInfiniteMass){ if(B->bInfiniteMass){
impulseA = -speedA * A->m_fMass; impulseA = -speedA * A->m_fMass;
@ -614,7 +614,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(IsGlass(B->GetModelIndex())) if(IsGlass(B->GetModelIndex()))
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false); CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
else else
B->bIsStatic = false; B->SetIsStatic(false);
int16 model = B->GetModelIndex(); int16 model = B->GetModelIndex();
if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){ if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){
CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true); CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true);
@ -635,11 +635,11 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
return true; return true;
} }
}else if(!B->bInfiniteMass) }else if(!B->bInfiniteMass)
B->bIsStatic = false; B->SetIsStatic(false);
} }
} }
if(B->IsStatic()) if(B->GetIsStatic())
return false; return false;
if(!B->bInfiniteMass) if(!B->bInfiniteMass)
B->AddToMovingList(); B->AddToMovingList();
@ -1074,7 +1074,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
canshift = true; canshift = true;
else else
canshift = A->IsPed() && canshift = A->IsPed() &&
B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged; B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged;
if(B == A || if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() || B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision || !B->bUsesCollision ||
@ -1098,7 +1098,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CObject *Aobj = (CObject*)A; CObject *Aobj = (CObject*)A;
if(Aobj->ObjectCreatedBy != TEMP_OBJECT && if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
!Aobj->bHasBeenDamaged && !Aobj->bHasBeenDamaged &&
Aobj->IsStatic()){ Aobj->GetIsStatic()){
if(Aobj->m_pCollidingEntity == B) if(Aobj->m_pCollidingEntity == B)
Aobj->m_pCollidingEntity = nil; Aobj->m_pCollidingEntity = nil;
}else if(Aobj->m_pCollidingEntity != B){ }else if(Aobj->m_pCollidingEntity != B){
@ -1115,7 +1115,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CObject *Bobj = (CObject*)B; CObject *Bobj = (CObject*)B;
if(Bobj->ObjectCreatedBy != TEMP_OBJECT && if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
!Bobj->bHasBeenDamaged && !Bobj->bHasBeenDamaged &&
Bobj->IsStatic()){ Bobj->GetIsStatic()){
if(Bobj->m_pCollidingEntity == A) if(Bobj->m_pCollidingEntity == A)
Bobj->m_pCollidingEntity = nil; Bobj->m_pCollidingEntity = nil;
}else if(Bobj->m_pCollidingEntity != A){ }else if(Bobj->m_pCollidingEntity != A){
@ -1433,7 +1433,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true; skipCollision = true;
else if(Aobj->ObjectCreatedBy == TEMP_OBJECT || else if(Aobj->ObjectCreatedBy == TEMP_OBJECT ||
Aobj->bHasBeenDamaged || Aobj->bHasBeenDamaged ||
!Aobj->IsStatic()){ !Aobj->GetIsStatic()){
if(Aobj->m_pCollidingEntity == B) if(Aobj->m_pCollidingEntity == B)
skipCollision = true; skipCollision = true;
else{ else{
@ -1452,7 +1452,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true; skipCollision = true;
else if(Bobj->ObjectCreatedBy == TEMP_OBJECT || else if(Bobj->ObjectCreatedBy == TEMP_OBJECT ||
Bobj->bHasBeenDamaged || Bobj->bHasBeenDamaged ||
!Bobj->IsStatic()){ !Bobj->GetIsStatic()){
if(Bobj->m_pCollidingEntity == A) if(Bobj->m_pCollidingEntity == A)
skipCollision = true; skipCollision = true;
else{ else{

View File

@ -337,7 +337,7 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp)
* Neo Vehicle pipe * Neo Vehicle pipe
*/ */
int32 VehiclePipeSwitch = VEHICLEPIPE_NEO; int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX;
float VehicleShininess = 0.7f; // the default is a bit extreme float VehicleShininess = 0.7f; // the default is a bit extreme
float VehicleSpecularity = 1.0f; float VehicleSpecularity = 1.0f;
InterpolatedFloat Fresnel(0.4f); InterpolatedFloat Fresnel(0.4f);
@ -365,6 +365,7 @@ AttachVehiclePipe(rw::Clump *clump)
* Neo World pipe * Neo World pipe
*/ */
bool LightmapEnable;
float LightmapMult = 1.0f; float LightmapMult = 1.0f;
InterpolatedFloat WorldLightmapBlend(1.0f); InterpolatedFloat WorldLightmapBlend(1.0f);
rw::ObjPipeline *worldPipe; rw::ObjPipeline *worldPipe;
@ -389,6 +390,7 @@ AttachWorldPipe(rw::Clump *clump)
* Neo Gloss pipe * Neo Gloss pipe
*/ */
bool GlossEnable;
float GlossMult = 1.0f; float GlossMult = 1.0f;
rw::ObjPipeline *glossPipe; rw::ObjPipeline *glossPipe;
@ -427,6 +429,7 @@ AttachGlossPipe(rw::Clump *clump)
* Neo Rim pipes * Neo Rim pipes
*/ */
bool RimlightEnable;
float RimlightMult = 1.0f; float RimlightMult = 1.0f;
InterpolatedColor RampStart(Color(0.0f, 0.0f, 0.0f, 1.0f)); InterpolatedColor RampStart(Color(0.0f, 0.0f, 0.0f, 1.0f));
InterpolatedColor RampEnd(Color(1.0f, 1.0f, 1.0f, 1.0f)); InterpolatedColor RampEnd(Color(1.0f, 1.0f, 1.0f, 1.0f));

View File

@ -98,6 +98,7 @@ void DestroyVehiclePipe(void);
void AttachVehiclePipe(rw::Atomic *atomic); void AttachVehiclePipe(rw::Atomic *atomic);
void AttachVehiclePipe(rw::Clump *clump); void AttachVehiclePipe(rw::Clump *clump);
extern bool LightmapEnable;
extern float LightmapMult; extern float LightmapMult;
extern InterpolatedFloat WorldLightmapBlend; extern InterpolatedFloat WorldLightmapBlend;
extern rw::ObjPipeline *worldPipe; extern rw::ObjPipeline *worldPipe;
@ -106,6 +107,7 @@ void DestroyWorldPipe(void);
void AttachWorldPipe(rw::Atomic *atomic); void AttachWorldPipe(rw::Atomic *atomic);
void AttachWorldPipe(rw::Clump *clump); void AttachWorldPipe(rw::Clump *clump);
extern bool GlossEnable;
extern float GlossMult; extern float GlossMult;
extern rw::ObjPipeline *glossPipe; extern rw::ObjPipeline *glossPipe;
void CreateGlossPipe(void); void CreateGlossPipe(void);
@ -114,6 +116,7 @@ void AttachGlossPipe(rw::Atomic *atomic);
void AttachGlossPipe(rw::Clump *clump); void AttachGlossPipe(rw::Clump *clump);
rw::Texture *GetGlossTex(rw::Material *mat); rw::Texture *GetGlossTex(rw::Material *mat);
extern bool RimlightEnable;
extern float RimlightMult; extern float RimlightMult;
extern InterpolatedColor RampStart; extern InterpolatedColor RampStart;
extern InterpolatedColor RampEnd; extern InterpolatedColor RampEnd;

View File

@ -190,6 +190,11 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d; using namespace rw::d3d;
using namespace rw::d3d9; using namespace rw::d3d9;
if(!LightmapEnable){
defaultRenderCB_Shader(atomic, header);
return;
}
int vsBits; int vsBits;
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride); setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
setIndices(header->indexBuffer); setIndices(header->indexBuffer);
@ -297,6 +302,9 @@ glossRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d; using namespace rw::d3d;
using namespace rw::d3d9; using namespace rw::d3d9;
if(!GlossEnable)
return;
setVertexShader(neoGloss_VS); setVertexShader(neoGloss_VS);
setPixelShader(neoGloss_PS); setPixelShader(neoGloss_PS);
@ -395,6 +403,11 @@ rimRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d; using namespace rw::d3d;
using namespace rw::d3d9; using namespace rw::d3d9;
if(!RimlightEnable){
defaultRenderCB_Shader(atomic, header);
return;
}
int vsBits; int vsBits;
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride); setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
setIndices(header->indexBuffer); setIndices(header->indexBuffer);
@ -433,6 +446,11 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d; using namespace rw::d3d;
using namespace rw::d3d9; using namespace rw::d3d9;
if(!RimlightEnable){
skinRenderCB(atomic, header);
return;
}
int vsBits; int vsBits;
setStreamSource(0, (IDirect3DVertexBuffer9*)header->vertexStream[0].vertexBuffer, setStreamSource(0, (IDirect3DVertexBuffer9*)header->vertexStream[0].vertexBuffer,

View File

@ -203,6 +203,11 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw; using namespace rw;
using namespace rw::gl3; using namespace rw::gl3;
if(!LightmapEnable){
gl3::defaultRenderCB(atomic, header);
return;
}
Material *m; Material *m;
setWorldMatrix(atomic->getFrame()->getLTM()); setWorldMatrix(atomic->getFrame()->getLTM());
@ -315,6 +320,8 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw::gl3; using namespace rw::gl3;
worldRenderCB(atomic, header); worldRenderCB(atomic, header);
if(!GlossEnable)
return;
Material *m; Material *m;
@ -442,6 +449,11 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw; using namespace rw;
using namespace rw::gl3; using namespace rw::gl3;
if(!RimlightEnable){
gl3::skinRenderCB(atomic, header);
return;
}
Material *m; Material *m;
setWorldMatrix(atomic->getFrame()->getLTM()); setWorldMatrix(atomic->getFrame()->getLTM());
@ -487,6 +499,11 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw; using namespace rw;
using namespace rw::gl3; using namespace rw::gl3;
if(!RimlightEnable){
gl3::defaultRenderCB(atomic, header);
return;
}
Material *m; Material *m;
setWorldMatrix(atomic->getFrame()->getLTM()); setWorldMatrix(atomic->getFrame()->getLTM());

View File

@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
return (v2 - v1).Magnitude(); return (v2 - v1).Magnitude();
} }
inline float
Distance2D(const CVector &v1, const CVector &v2)
{
float x = v2.x - v1.x;
float y = v2.y - v1.y;
return Sqrt(x*x + y*y);
}
class CMatrix; class CMatrix;
CVector Multiply3x3(const CMatrix &mat, const CVector &vec); CVector Multiply3x3(const CMatrix &mat, const CVector &vec);

View File

@ -31,6 +31,14 @@ protected:
ModelInfoType m_type; ModelInfoType m_type;
uint8 m_num2dEffects; uint8 m_num2dEffects;
bool m_bOwnsColModel; bool m_bOwnsColModel;
#ifdef EXTRA_MODEL_FLAGS
public:
// from mobile
bool m_bIsDoubleSided;
bool m_bIsTree;
bool m_bCanBeIgnored; // for low-end devices
bool RenderDoubleSided(void) { return m_bIsDoubleSided || m_bIsTree; }
#endif
public: public:
CBaseModelInfo(ModelInfoType type); CBaseModelInfo(ModelInfoType type);

View File

@ -5,6 +5,7 @@
#include "NodeName.h" #include "NodeName.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "ModelIndices.h"
void void
CClumpModelInfo::DeleteRwObject(void) CClumpModelInfo::DeleteRwObject(void)
@ -110,12 +111,18 @@ CClumpModelInfo::SetClump(RpClump *clump)
weights->w3 /= sum; weights->w3 /= sum;
} }
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
}else }
#endif if(strncmp(GetName(), "playerh", 8) == 0){
// do not set on skinned clip because cutscene head is not compatible with player head // playerh is incompatible with the xbox player skin
if(strncmp(GetName(), "playerh", 8) == 0) // so check if player model is skinned and only apply skin to head if it isn't
CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER);
if(!(body->m_clump && IsClumpSkinned(body->m_clump)))
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
}
#else
if(strncmp(GetName(), "playerh", 8) == 0){
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
#endif
} }
void void

View File

@ -218,7 +218,6 @@ CPedModelInfo::CreateHitColModel(void)
{ {
RwObjectNameAssociation nameAssoc; RwObjectNameAssociation nameAssoc;
RwObjectIdAssociation idAssoc; RwObjectIdAssociation idAssoc;
CVector center;
RwFrame *nodeFrame; RwFrame *nodeFrame;
CColModel *colmodel = new CColModel; CColModel *colmodel = new CColModel;
CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere)); CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere));
@ -251,23 +250,17 @@ CPedModelInfo::CreateHitColModel(void)
if(RwFrameGetParent(nodeFrame) == root) if(RwFrameGetParent(nodeFrame) == root)
break; break;
} }
center.x = mat->pos.x + m_pColNodeInfos[i].x; spheres[i].center = mat->pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
center.y = mat->pos.y + 0.0f; spheres[i].radius = radius;
center.z = mat->pos.z + m_pColNodeInfos[i].z; spheres[i].surface = SURFACE_PED;
spheres[i].Set(radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType); spheres[i].piece = m_pColNodeInfos[i].pieceType;
} }
} }
RwMatrixDestroy(mat); RwMatrixDestroy(mat);
colmodel->spheres = spheres; colmodel->spheres = spheres;
colmodel->numSpheres = NUMPEDINFONODES; colmodel->numSpheres = NUMPEDINFONODES;
center.x = center.y = center.z = 0.0f; colmodel->boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
colmodel->boundingSphere.Set(2.0f, center, 0, 0); colmodel->boundingBox.Set(CVector(-0.5f, -0.5f, -1.2f), CVector(0.5f, 0.5f, 1.2f), SURFACE_DEFAULT, 0);
CVector min, max;
min.x = min.y = -0.5f;
min.z = -1.2f;
max.x = max.y = 0.5f;
max.z = 1.2f;
colmodel->boundingBox.Set(min, max, 0, 0);
colmodel->level = LEVEL_GENERIC; colmodel->level = LEVEL_GENERIC;
m_hitColModel = colmodel; m_hitColModel = colmodel;
} }
@ -303,9 +296,7 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame)
break; break;
} }
spheres[i].center.x = mat->pos.x + m_pColNodeInfos[i].x; spheres[i].center = mat->pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
spheres[i].center.y = mat->pos.y + 0.0f;
spheres[i].center.z = mat->pos.z + m_pColNodeInfos[i].z;
} }
} }
@ -316,7 +307,6 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame)
void void
CPedModelInfo::CreateHitColModelSkinned(RpClump *clump) CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
{ {
CVector center;
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump); RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump);
CColModel *colmodel = new CColModel; CColModel *colmodel = new CColModel;
CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere)); CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere));
@ -335,23 +325,17 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
RwV3d pos = { 0.0f, 0.0f, 0.0f }; RwV3d pos = { 0.0f, 0.0f, 0.0f };
RwV3dTransformPoints(&pos, &pos, 1, mat); RwV3dTransformPoints(&pos, &pos, 1, mat);
center.x = pos.x + m_pColNodeInfos[i].x; spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
center.y = pos.y + 0.0f; spheres[i].radius = m_pColNodeInfos[i].radius;
center.z = pos.z + m_pColNodeInfos[i].z; spheres[i].surface = SURFACE_PED;
spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType); spheres[i].piece = m_pColNodeInfos[i].pieceType;
} }
RwMatrixDestroy(invmat); RwMatrixDestroy(invmat);
RwMatrixDestroy(mat); RwMatrixDestroy(mat);
colmodel->spheres = spheres; colmodel->spheres = spheres;
colmodel->numSpheres = NUMPEDINFONODES; colmodel->numSpheres = NUMPEDINFONODES;
center.x = center.y = center.z = 0.0f; colmodel->boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
colmodel->boundingSphere.Set(2.0f, center, 0, 0); colmodel->boundingBox.Set(CVector(-0.5f, -0.5f, -1.2f), CVector(0.5f, 0.5f, 1.2f), SURFACE_DEFAULT, 0);
CVector min, max;
min.x = min.y = -0.5f;
min.z = -1.2f;
max.x = max.y = 0.5f;
max.z = 1.2f;
colmodel->boundingBox.Set(min, max, 0, 0);
colmodel->level = LEVEL_GENERIC; colmodel->level = LEVEL_GENERIC;
m_hitColModel = colmodel; m_hitColModel = colmodel;
} }
@ -379,9 +363,7 @@ CPedModelInfo::AnimatePedColModelSkinned(RpClump *clump)
RwV3d pos = { 0.0f, 0.0f, 0.0f }; RwV3d pos = { 0.0f, 0.0f, 0.0f };
RwV3dTransformPoints(&pos, &pos, 1, mat); RwV3dTransformPoints(&pos, &pos, 1, mat);
spheres[i].center.x = pos.x + m_pColNodeInfos[i].x; spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
spheres[i].center.y = pos.y + 0.0f;
spheres[i].center.z = pos.z + m_pColNodeInfos[i].z;
} }
RwMatrixDestroy(invmat); RwMatrixDestroy(invmat);
RwMatrixDestroy(mat); RwMatrixDestroy(mat);

View File

@ -91,7 +91,7 @@ CObject::ProcessControl(void)
CPhysical::ProcessControl(); CPhysical::ProcessControl();
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) { if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
bIsInWater = true; bIsInWater = true;
bIsStatic = false; SetIsStatic(false);
ApplyMoveForce(impulse); ApplyMoveForce(impulse);
ApplyTurnForce(impulse, point); ApplyTurnForce(impulse, point);
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep()); float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
@ -182,7 +182,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_COMPLETELY: case DAMAGE_EFFECT_SMASH_COMPLETELY:
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; SetIsStatic(true);
bExplosionProof = true; bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -194,7 +194,7 @@ CObject::ObjectDamage(float amount)
else { else {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; SetIsStatic(true);
bExplosionProof = true; bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -203,7 +203,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: { case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; SetIsStatic(true);
bExplosionProof = true; bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -226,7 +226,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; SetIsStatic(true);
bExplosionProof = true; bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -249,7 +249,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; SetIsStatic(true);
bExplosionProof = true; bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -274,7 +274,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; SetIsStatic(true);
bExplosionProof = true; bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -314,7 +314,7 @@ CObject::Init(void)
CObjectData::SetObjectData(GetModelIndex(), *this); CObjectData::SetObjectData(GetModelIndex(), *this);
m_nEndOfLifeTime = 0; m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT; ObjectCreatedBy = GAME_OBJECT;
bIsStatic = true; SetIsStatic(true);
bIsPickup = false; bIsPickup = false;
bPickupObjWithMessage = false; bPickupObjWithMessage = false;
bOutOfStock = false; bOutOfStock = false;

View File

@ -631,7 +631,7 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer)
// BUG: This condition will always return true. Even fixing it won't work, because these states are unused. // BUG: This condition will always return true. Even fixing it won't work, because these states are unused.
// if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) { // if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) {
CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
// } // }
bBodyPartJustCameOff = true; bBodyPartJustCameOff = true;
@ -814,15 +814,15 @@ CPed::Avoid(void)
// Get distance to ped we want to avoid // Get distance to ped we want to avoid
CVector2D distToPed = CVector2D(nearestPed->GetPosition()) - testPosition; CVector2D distToPed = CVector2D(nearestPed->GetPosition()) - testPosition;
if (distToPed.Magnitude() <= 1.0f && CPed::OurPedCanSeeThisOne((CEntity*)nearestPed)) { if (distToPed.Magnitude() <= 1.0f && OurPedCanSeeThisOne((CEntity*)nearestPed)) {
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() m_nPedStateTimer = CTimer::GetTimeInMilliseconds()
+ 500 + (m_randomSeed + 3 * CTimer::GetFrameCounter()) + 500 + (m_randomSeed + 3 * CTimer::GetFrameCounter())
% 1000 / 5; % 1000 / 5;
m_fRotationDest += DEGTORAD(45.0f); m_fRotationDest += DEGTORAD(45.0f);
if (!bIsLooking) { if (!bIsLooking) {
CPed::SetLookFlag(nearestPed, false); SetLookFlag(nearestPed, false);
CPed::SetLookTimer(CGeneral::GetRandomNumberInRange(500, 800)); SetLookTimer(CGeneral::GetRandomNumberInRange(500, 800));
} }
} }
} }
@ -861,8 +861,7 @@ CPed::ClearLookFlag(void) {
m_lookTimer = CTimer::GetTimeInMilliseconds() + 4000; m_lookTimer = CTimer::GetTimeInMilliseconds() + 4000;
if (m_nPedState == PED_LOOK_HEADING || m_nPedState == PED_LOOK_ENTITY) { if (m_nPedState == PED_LOOK_HEADING || m_nPedState == PED_LOOK_ENTITY) {
RestorePreviousState(); ClearLook();
ClearLookFlag();
} }
} }
} }
@ -985,7 +984,7 @@ CPed::Attack(void)
weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ourWeapon->m_Anim2ToPlay, 8.0f); weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ourWeapon->m_Anim2ToPlay, 8.0f);
} }
weaponAnimAssoc->SetFinishCallback(CPed::FinishedAttackCB, this); weaponAnimAssoc->SetFinishCallback(FinishedAttackCB, this);
weaponAnimAssoc->SetRun(); weaponAnimAssoc->SetRun();
if (weaponAnimAssoc->currentTime == weaponAnimAssoc->hierarchy->totalLength) if (weaponAnimAssoc->currentTime == weaponAnimAssoc->hierarchy->totalLength)
@ -2900,7 +2899,7 @@ CPed::ReactToAttack(CEntity *attacker)
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (m_nPedState == PED_DRIVING && InVehicle() if (m_nPedState == PED_DRIVING && InVehicle()
&& (m_pMyVehicle->pDriver == this || m_pMyVehicle->pDriver && m_pMyVehicle->pDriver->m_nPedState == PED_DRIVING)) { && (m_pMyVehicle->pDriver == this || m_pMyVehicle->pDriver && m_pMyVehicle->pDriver->m_nPedState == PED_DRIVING && m_pMyVehicle->pDriver->m_objective != OBJECTIVE_LEAVE_CAR_AND_DIE)) {
if (m_pMyVehicle->VehicleCreatedBy == RANDOM_VEHICLE if (m_pMyVehicle->VehicleCreatedBy == RANDOM_VEHICLE
&& (m_pMyVehicle->GetStatus() == STATUS_SIMPLE || m_pMyVehicle->GetStatus() == STATUS_PHYSICS) && (m_pMyVehicle->GetStatus() == STATUS_SIMPLE || m_pMyVehicle->GetStatus() == STATUS_PHYSICS)
@ -4435,11 +4434,11 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
bool vehPressedHorn = false; bool vehPressedHorn = false;
if (neededTurn > PI) if (neededTurn > PI)
neededTurn = 2 * PI - neededTurn; neededTurn = TWOPI - neededTurn;
CVehicle *veh = (CVehicle*)reason; CVehicle *veh = (CVehicle*)reason;
if (reason->IsVehicle() && veh->m_vehType == VEHICLE_TYPE_CAR) { if (reason->IsVehicle() && veh->m_vehType == VEHICLE_TYPE_CAR) {
if (veh->m_nCarHornTimer) { if (veh->m_nCarHornTimer != 0) {
vehPressedHorn = true; vehPressedHorn = true;
if (!IsPlayer()) if (!IsPlayer())
animType = 1; animType = 1;
@ -4459,7 +4458,7 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
angleToFace += PI; angleToFace += PI;
if (angleToFace > PI) if (angleToFace > PI)
angleToFace -= 2*PI; angleToFace -= TWOPI;
// We don't want to run towards car's direction // We don't want to run towards car's direction
float dangerZone = angleToFace - vehDirection; float dangerZone = angleToFace - vehDirection;
@ -4467,16 +4466,15 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
// So, add or subtract 90deg (jump to left/right) according to that // So, add or subtract 90deg (jump to left/right) according to that
if (dangerZone <= 0.0f) if (dangerZone <= 0.0f)
angleToFace = 0.5f*PI + vehDirection; angleToFace = HALFPI + vehDirection;
else else
angleToFace = vehDirection - 0.5f*PI; angleToFace = vehDirection - HALFPI;
if (animType == 2) stepAnim = NUM_ANIMS;
stepAnim = ANIM_HANDSCOWER; if (animType == 0 || animType == 1)
else if (animType < 2)
stepAnim = ANIM_EV_STEP; stepAnim = ANIM_EV_STEP;
else else if (animType == 2)
stepAnim = NUM_ANIMS; stepAnim = ANIM_HANDSCOWER;
} }
if (!RpAnimBlendClumpGetAssociation(GetClump(), stepAnim)) { if (!RpAnimBlendClumpGetAssociation(GetClump(), stepAnim)) {
CAnimBlendAssociation *stepAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, stepAnim, 8.0f); CAnimBlendAssociation *stepAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, stepAnim, 8.0f);
@ -4506,7 +4504,7 @@ CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
angleToFace = m_fRotationCur; angleToFace = m_fRotationCur;
CVehicle *veh = (CVehicle*) reason; CVehicle *veh = (CVehicle*) reason;
if (reason->IsVehicle() && veh->m_vehType == VEHICLE_TYPE_CAR && veh->m_nCarHornTimer && !IsPlayer()) { if (reason->IsVehicle() && veh->m_vehType == VEHICLE_TYPE_CAR && veh->m_nCarHornTimer != 0 && !IsPlayer()) {
onlyRandomJump = true; onlyRandomJump = true;
} }
@ -8341,7 +8339,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
CPad::GetPad(0)->StartShake(40000 / shakeFreq, shakeFreq); CPad::GetPad(0)->StartShake(40000 / shakeFreq, shakeFreq);
} }
bIsStanding = false; bIsStanding = false;
damageDir = CPed::GetLocalDirection(-m_vecMoveSpeed); damageDir = GetLocalDirection(-m_vecMoveSpeed);
vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(car->GetModelIndex()); vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(car->GetModelIndex());
vehColModel = vehModel->GetColModel(); vehColModel = vehModel->GetColModel();
float carRightAndDistDotProd = DotProduct(distVec, car->GetRight()); float carRightAndDistDotProd = DotProduct(distVec, car->GetRight());
@ -8477,7 +8475,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
pieceToDamage = PEDPIECE_MID; pieceToDamage = PEDPIECE_MID;
break; break;
} }
CPed::InflictDamage(car, killMethod, 1000.0f, pieceToDamage, damageDir); InflictDamage(car, killMethod, 1000.0f, pieceToDamage, damageDir);
if (DyingOrDead() if (DyingOrDead()
&& bIsPedDieAnimPlaying && !m_pCollidingEntity) { && bIsPedDieAnimPlaying && !m_pCollidingEntity) {
@ -8507,8 +8505,8 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
else else
damage = 30.0f; damage = 30.0f;
CPed::InflictDamage(car, WEAPONTYPE_RAMMEDBYCAR, damage, PEDPIECE_TORSO, fallDirection); InflictDamage(car, WEAPONTYPE_RAMMEDBYCAR, damage, PEDPIECE_TORSO, fallDirection);
CPed::SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true); SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true);
if (OnGround() && !m_pCollidingEntity && if (OnGround() && !m_pCollidingEntity &&
(!IsPlayer() || bHasHitWall || car->GetModelIndex() == MI_TRAIN || m_vecDamageNormal.z < -0.8f)) { (!IsPlayer() || bHasHitWall || car->GetModelIndex() == MI_TRAIN || m_vecDamageNormal.z < -0.8f)) {
@ -9680,7 +9678,7 @@ CPed::ProcessControl(void)
} else if (CTimer::GetTimeInMilliseconds() >= CWorld::Players[CWorld::PlayerInFocus].m_nLastBumpPlayerCarTimer } else if (CTimer::GetTimeInMilliseconds() >= CWorld::Players[CWorld::PlayerInFocus].m_nLastBumpPlayerCarTimer
|| m_nPedStateTimer >= CTimer::GetTimeInMilliseconds()) { || m_nPedStateTimer >= CTimer::GetTimeInMilliseconds()) {
CPed::SetDirectionToWalkAroundObject(collidingVeh); SetDirectionToWalkAroundObject(collidingVeh);
CWorld::Players[CWorld::PlayerInFocus].m_nLastBumpPlayerCarTimer = m_nPedStateTimer; CWorld::Players[CWorld::PlayerInFocus].m_nLastBumpPlayerCarTimer = m_nPedStateTimer;
} else if (m_fleeFrom != collidingVeh) { } else if (m_fleeFrom != collidingVeh) {
@ -9906,7 +9904,7 @@ CPed::ProcessControl(void)
SetHeading(m_fRotationCur); SetHeading(m_fRotationCur);
if (m_nPedState != PED_FALL && !bIsPedDieAnimPlaying) { if (m_nPedState != PED_FALL && !bIsPedDieAnimPlaying) {
CPed::SetFall(1000, ANIM_KO_SKID_BACK, true); SetFall(1000, ANIM_KO_SKID_BACK, true);
} }
bIsInTheAir = false; bIsInTheAir = false;
} else if (m_vecDamageNormal.z > 0.4f) { } else if (m_vecDamageNormal.z > 0.4f) {
@ -10217,19 +10215,19 @@ CPed::ProcessControl(void)
Flee(); Flee();
break; break;
case PED_FOLLOW_PATH: case PED_FOLLOW_PATH:
CPed::FollowPath(); FollowPath();
break; break;
case PED_PAUSE: case PED_PAUSE:
CPed::Pause(); Pause();
break; break;
case PED_ATTACK: case PED_ATTACK:
CPed::Attack(); Attack();
break; break;
case PED_FIGHT: case PED_FIGHT:
CPed::Fight(); Fight();
break; break;
case PED_CHAT: case PED_CHAT:
CPed::Chat(); Chat();
break; break;
case PED_AIM_GUN: case PED_AIM_GUN:
if (m_pPointGunAt && m_pPointGunAt->IsPed() if (m_pPointGunAt && m_pPointGunAt->IsPed()
@ -14606,11 +14604,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (!collidingEnt->IsBuilding()) if (!collidingEnt->IsBuilding())
((CPhysical*)collidingEnt)->AddCollisionRecord(this); ((CPhysical*)collidingEnt)->AddCollisionRecord(this);
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->IsStatic())) { if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic())) {
bHasHitWall = true; bHasHitWall = true;
} }
} }
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) { if (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic()) {
if (bWasStanding) { if (bWasStanding) {
CVector sphereNormal; CVector sphereNormal;
@ -15956,7 +15954,7 @@ CPed::SeekCar(void)
} else { } else {
m_fRotationCur = m_fRotationDest; m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) { if (!bVehEnterDoorIsBlocked) {
vehToSeek->bIsStatic = false; vehToSeek->SetIsStatic(false);
if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) { if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
SetSolicit(1000); SetSolicit(1000);
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) { } else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {
@ -15982,7 +15980,7 @@ CPed::SeekCar(void)
if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer()) if (IsPlayer())
CPed::SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehEnterType);
} else { } else {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
} }
@ -16152,15 +16150,15 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
case HITLEVEL_LOW: case HITLEVEL_LOW:
#ifndef VC_PED_PORTS #ifndef VC_PED_PORTS
if (direction == 2) { if (direction == 2) {
CPed::SetFall(1000, ANIM_KO_SKID_BACK, false); SetFall(1000, ANIM_KO_SKID_BACK, false);
return; return;
} }
#else #else
if (direction == 2 && (!IsPlayer() || ((CGeneral::GetRandomNumber() & 1) && m_fHealth < 30.0f))) { if (direction == 2 && (!IsPlayer() || ((CGeneral::GetRandomNumber() & 1) && m_fHealth < 30.0f))) {
CPed::SetFall(1000, ANIM_KO_SKID_BACK, false); SetFall(1000, ANIM_KO_SKID_BACK, false);
return; return;
} else if (direction != 2 && !IsPlayer() && (CGeneral::GetRandomNumber() & 1) && m_fHealth < 30.0f) { } else if (direction != 2 && !IsPlayer() && (CGeneral::GetRandomNumber() & 1) && m_fHealth < 30.0f) {
CPed::SetFall(1000, ANIM_KO_SHOT_STOM, false); SetFall(1000, ANIM_KO_SHOT_STOM, false);
return; return;
} }
#endif #endif
@ -16637,7 +16635,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction)
obj->m_fElasticity = 0.03f; obj->m_fElasticity = 0.03f;
obj->m_fBuoyancy = m_fMass*GRAVITY/0.75f; obj->m_fBuoyancy = m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT; obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false; obj->SetIsStatic(false);
obj->bIsPickup = false; obj->bIsPickup = false;
obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SMALLBOX; obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SMALLBOX;
@ -17366,12 +17364,12 @@ CPed::SetExitBoat(CVehicle *boat)
CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f);
if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) { if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) {
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f);
m_pVehicleAnim->SetFinishCallback(CPed::PedSetOutCarCB, this); m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this);
m_vehEnterType = CAR_DOOR_RF; m_vehEnterType = CAR_DOOR_RF;
m_nPedState = PED_EXIT_CAR; m_nPedState = PED_EXIT_CAR;
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehEnterType = CAR_DOOR_RF;
CPed::PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
m_pCurSurface = boat; m_pCurSurface = boat;
m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface); m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface);

View File

@ -972,7 +972,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (IsGlass(obj->GetModelIndex())) { if (IsGlass(obj->GetModelIndex())) {
obj->bIsVisible = false; obj->bIsVisible = false;
} else if (obj->GetModelIndex() == MI_BUOY) { } else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false; obj->SetIsStatic(false);
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f); obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
obj->bTouchingWater = true; obj->bTouchingWater = true;
obj->AddToMovingList(); obj->AddToMovingList();

View File

@ -62,7 +62,7 @@ CCredits::Render(void)
scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f; scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f;
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH - 20)); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetColor(CRGBA(220, 220, 220, 220)); CFont::SetColor(CRGBA(220, 220, 220, 220));
@ -496,4 +496,4 @@ CCredits::Render(void)
bool CCredits::AreCreditsDone(void) bool CCredits::AreCreditsDone(void)
{ {
return !bCreditsGoing; return !bCreditsGoing;
} }

View File

@ -1,4 +1,4 @@
#include "common.h" #include "common.h"
#include "Glass.h" #include "Glass.h"
#include "Timer.h" #include "Timer.h"
@ -138,7 +138,11 @@ CFallingGlassPane::Render(void)
fwdNorm.Normalise(); fwdNorm.Normalise();
uint8 alpha = CGlass::CalcAlphaWithNormal(&fwdNorm); uint8 alpha = CGlass::CalcAlphaWithNormal(&fwdNorm);
int32 time = clamp(CTimer::GetTimeInMilliseconds() - m_nTimer, 0, 500); #ifdef FIX_BUGS
uint16 time = clamp(CTimer::GetTimeInMilliseconds() > m_nTimer ? CTimer::GetTimeInMilliseconds() - m_nTimer : 0u, 0u, 500u);
#else
uint16 time = clamp(CTimer::GetTimeInMilliseconds() - m_nTimer, 0, 500);
#endif
uint8 color = int32( float(alpha) * (float(time) / 500) ); uint8 color = int32( float(alpha) * (float(time) / 500) );

View File

@ -41,13 +41,13 @@ CRGBA ODDJOB_COLOR(89, 115, 150, 255);
CRGBA ODDJOB2_COLOR(156, 91, 40, 255); CRGBA ODDJOB2_COLOR(156, 91, 40, 255);
CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255); CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255);
wchar CHud::m_HelpMessage[256]; wchar CHud::m_HelpMessage[HELP_MSG_LENGTH];
wchar CHud::m_LastHelpMessage[256]; wchar CHud::m_LastHelpMessage[HELP_MSG_LENGTH];
uint32 CHud::m_HelpMessageState; uint32 CHud::m_HelpMessageState;
uint32 CHud::m_HelpMessageTimer; uint32 CHud::m_HelpMessageTimer;
int32 CHud::m_HelpMessageFadeTimer; int32 CHud::m_HelpMessageFadeTimer;
wchar CHud::m_HelpMessageToPrint[256]; wchar CHud::m_HelpMessageToPrint[HELP_MSG_LENGTH];
float CHud::m_fHelpMessageTime; float CHud::m_HelpMessageDisplayTime;
bool CHud::m_HelpMessageQuick; bool CHud::m_HelpMessageQuick;
uint32 CHud::m_ZoneState; uint32 CHud::m_ZoneState;
int32 CHud::m_ZoneFadeTimer; int32 CHud::m_ZoneFadeTimer;
@ -247,7 +247,7 @@ void CHud::Draw()
rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f); rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f); rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255), Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
0.99f, 0.99f, 0.01f, 0.99f, 0.99f, 0.01f, 0.1f, 0.01f); 0.99f, 0.99f, 0.01f, 0.99f, 0.99f, 0.01f, 0.01f, 0.01f);
} }
} }
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
@ -336,7 +336,7 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f)); CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
@ -740,7 +740,7 @@ void CHud::Draw()
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetColor(CRGBA(244, 20, 20, 255)); CFont::SetColor(CRGBA(244, 20, 20, 255));
CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetPropOff(); CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn(); CFont::SetBackGroundOnlyTextOn();
@ -869,8 +869,8 @@ void CHud::Draw()
else else
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetWrapx(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fWrapX)); CFont::SetWrapx(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fWrapX));
CFont::SetCentreSize(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize));
if (CTheScripts::IntroTextLines[i].m_bBackground) if (CTheScripts::IntroTextLines[i].m_bBackground)
CFont::SetBackgroundOn(); CFont::SetBackgroundOn();
@ -957,12 +957,12 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(25.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
// Appearently sliding text in here was abandoned very early, since this text is centered now. // Appearently sliding text in here was abandoned very early, since this text is centered now.
if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) { if (BigMessageX[0] >= SCALE_AND_CENTER_X(620.0f)) {
BigMessageInUse[0] += CTimer::GetTimeStep(); BigMessageInUse[0] += CTimer::GetTimeStep();
if (BigMessageInUse[0] >= 120.0f) { if (BigMessageInUse[0] >= 120.0f) {
@ -997,7 +997,7 @@ void CHud::Draw()
} }
else { else {
BigMessageAlpha[0] = 0.0f; BigMessageAlpha[0] = 0.0f;
BigMessageX[0] = SCREEN_SCALE_FROM_RIGHT(DEFAULT_SCREEN_WIDTH + 60.0f); BigMessageX[0] = SCALE_AND_CENTER_X(-60.0f);
BigMessageInUse[0] = 1.0f; BigMessageInUse[0] = 1.0f;
} }
} }
@ -1047,14 +1047,14 @@ void CHud::DrawAfterFade()
return; return;
if (m_HelpMessage[0]) { if (m_HelpMessage[0]) {
if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) { if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, HELP_MSG_LENGTH)) {
switch (m_HelpMessageState) { switch (m_HelpMessageState) {
case 0: case 0:
m_HelpMessageFadeTimer = 0; m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2; m_HelpMessageState = 2;
m_HelpMessageTimer = 0; m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256); CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, HELP_MSG_LENGTH);
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f; m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f) if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD, 0); DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
@ -1069,7 +1069,7 @@ void CHud::DrawAfterFade()
default: default:
break; break;
} }
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256); CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, HELP_MSG_LENGTH);
} }
float fAlpha = 225.0f; float fAlpha = 225.0f;
@ -1079,7 +1079,7 @@ void CHud::DrawAfterFade()
case 1: case 1:
fAlpha = 225.0f; fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600; m_HelpMessageFadeTimer = 600;
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) { if (m_HelpMessageTimer > m_HelpMessageDisplayTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600; m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3; m_HelpMessageState = 3;
} }
@ -1105,7 +1105,7 @@ void CHud::DrawAfterFade()
if (m_HelpMessageFadeTimer < 0) { if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2; m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0; m_HelpMessageFadeTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256); CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, HELP_MSG_LENGTH);
} }
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f; fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break; break;
@ -1166,8 +1166,8 @@ void CHud::DrawAfterFade()
else else
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetWrapx(SCALE_AND_CENTER_X(line.m_fWrapX)); CFont::SetWrapx(SCREEN_SCALE_X(line.m_fWrapX));
CFont::SetCentreSize(SCALE_AND_CENTER_X(line.m_fCenterSize)); CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize));
if (line.m_bBackground) if (line.m_bBackground)
CFont::SetBackgroundOn(); CFont::SetBackgroundOn();
else else
@ -1213,7 +1213,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(40.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
@ -1229,7 +1229,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
@ -1286,7 +1286,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
@ -1371,7 +1371,7 @@ void CHud::GetRidOfAllHudMessages()
m_ZoneNameTimer = 0; m_ZoneNameTimer = 0;
m_pZoneName = nil; m_pZoneName = nil;
for (int i = 0; i < 256; i++) { for (int i = 0; i < HELP_MSG_LENGTH; i++) {
m_HelpMessage[i] = 0; m_HelpMessage[i] = 0;
m_LastHelpMessage[i] = 0; m_LastHelpMessage[i] = 0;
m_HelpMessageToPrint[i] = 0; m_HelpMessageToPrint[i] = 0;
@ -1381,7 +1381,7 @@ void CHud::GetRidOfAllHudMessages()
m_HelpMessageFadeTimer = 0; m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 0; m_HelpMessageState = 0;
m_HelpMessageQuick = 0; m_HelpMessageQuick = 0;
m_fHelpMessageTime = 1.0f; m_HelpMessageDisplayTime = 1.0f;
m_VehicleName = nil; m_VehicleName = nil;
m_pLastVehicleName = nil; m_pLastVehicleName = nil;
m_pVehicleNameToPrint = nil; m_pVehicleNameToPrint = nil;
@ -1389,7 +1389,7 @@ void CHud::GetRidOfAllHudMessages()
m_VehicleFadeTimer = 0; m_VehicleFadeTimer = 0;
m_VehicleState = 0; m_VehicleState = 0;
for (int i = 0; i < 256; i++) for (int i = 0; i < ARRAY_SIZE(m_Message); i++)
m_Message[i] = 0; m_Message[i] = 0;
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
@ -1464,7 +1464,7 @@ void CHud::ReInitialise() {
wchar LastBigMessage[6][128]; wchar LastBigMessage[6][128];
void CHud::SetBigMessage(wchar *message, int16 style) void CHud::SetBigMessage(wchar *message, uint16 style)
{ {
int i = 0; int i = 0;
@ -1495,10 +1495,10 @@ void CHud::SetBigMessage(wchar *message, int16 style)
void CHud::SetHelpMessage(wchar *message, bool quick) void CHud::SetHelpMessage(wchar *message, bool quick)
{ {
if (!CReplay::IsPlayingBack()) { if (!CReplay::IsPlayingBack()) {
CMessages::WideStringCopy(m_HelpMessage, message, 256); CMessages::WideStringCopy(m_HelpMessage, message, HELP_MSG_LENGTH);
CMessages::InsertPlayerControlKeysInString(m_HelpMessage); CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
for (int i = 0; i < 256; i++) { for (int i = 0; i < HELP_MSG_LENGTH; i++) {
m_LastHelpMessage[i] = 0; m_LastHelpMessage[i] = 0;
} }
@ -1510,7 +1510,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
void CHud::SetMessage(wchar *message) void CHud::SetMessage(wchar *message)
{ {
int i = 0; int i = 0;
for (i = 0; i < 256; i++) { for (i = 0; i < ARRAY_SIZE(m_Message); i++) {
if (message[i] == 0) if (message[i] == 0)
break; break;
@ -1522,7 +1522,7 @@ void CHud::SetMessage(wchar *message)
void CHud::SetPagerMessage(wchar *message) void CHud::SetPagerMessage(wchar *message)
{ {
int i = 0; int i = 0;
for (i = 0; i < 256; i++) { for (i = 0; i < ARRAY_SIZE(m_PagerMessage); i++) {
if (message[i] == 0) if (message[i] == 0)
break; break;

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "Sprite2d.h" #include "Sprite2d.h"
#define HELP_MSG_LENGTH 256
enum eItems enum eItems
{ {
ITEM_NONE = -1, ITEM_NONE = -1,
@ -36,14 +38,13 @@ class CHud
{ {
public: public:
static CSprite2d Sprites[NUM_HUD_SPRITES]; static CSprite2d Sprites[NUM_HUD_SPRITES];
static wchar m_HelpMessage[256]; static wchar m_HelpMessage[HELP_MSG_LENGTH];
static wchar m_LastHelpMessage[256]; static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
static uint32 m_HelpMessageState; static uint32 m_HelpMessageState;
static uint32 m_HelpMessageTimer; static uint32 m_HelpMessageTimer;
static int32 m_HelpMessageFadeTimer; static int32 m_HelpMessageFadeTimer;
static wchar m_HelpMessageToPrint[256]; static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
static float &m_HelpMessageDisplayTime; static float m_HelpMessageDisplayTime;
static float m_fHelpMessageTime;
static bool m_HelpMessageQuick; static bool m_HelpMessageQuick;
static uint32 m_ZoneState; static uint32 m_ZoneState;
static int32 m_ZoneFadeTimer; static int32 m_ZoneFadeTimer;
@ -88,7 +89,7 @@ public:
static void GetRidOfAllHudMessages(); static void GetRidOfAllHudMessages();
static void Initialise(); static void Initialise();
static void ReInitialise(); static void ReInitialise();
static void SetBigMessage(wchar *message, int16 style); static void SetBigMessage(wchar *message, uint16 style);
static void SetHelpMessage(wchar *message, bool quick); static void SetHelpMessage(wchar *message, bool quick);
static void SetMessage(wchar *message); static void SetMessage(wchar *message);
static void SetPagerMessage(wchar *message); static void SetPagerMessage(wchar *message);

View File

@ -302,8 +302,8 @@ void CParticle::Initialise()
{ {
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE)); float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
m_SinTable[i] = Sin(angle); m_SinTable[i] = ::Sin(angle);
m_CosTable[i] = Cos(angle); m_CosTable[i] = ::Cos(angle);
} }
int32 slot = CTxdStore::FindTxdSlot("particle"); int32 slot = CTxdStore::FindTxdSlot("particle");

View File

@ -53,6 +53,14 @@ CVehicle *CRenderer::m_pFirstPersonVehicle;
bool CRenderer::m_loadingPriority; bool CRenderer::m_loadingPriority;
float CRenderer::ms_lodDistScale = 1.2f; float CRenderer::ms_lodDistScale = 1.2f;
#ifdef EXTRA_MODEL_FLAGS
#define BACKFACE_CULLING_ON SetCullMode(rwCULLMODECULLBACK)
#define BACKFACE_CULLING_OFF SetCullMode(rwCULLMODECULLNONE)
#else
#define BACKFACE_CULLING_ON
#define BACKFACE_CULLING_OFF
#endif
void void
CRenderer::Init(void) CRenderer::Init(void)
{ {
@ -101,6 +109,13 @@ CRenderer::RenderOneRoad(CEntity *e)
else{ else{
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES
CustomPipes::AttachGlossPipe(e->GetAtomic()); CustomPipes::AttachGlossPipe(e->GetAtomic());
#endif
#ifdef EXTRA_MODEL_FLAGS
if(CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
BACKFACE_CULLING_OFF;
e->Render();
BACKFACE_CULLING_ON;
}else
#endif #endif
e->Render(); e->Render();
} }
@ -163,13 +178,22 @@ CRenderer::RenderOneNonRoad(CEntity *e)
for(i = 0; i < 8; i++) for(i = 0; i < 8; i++)
if(veh->pPassengers[i] && veh->pPassengers[i]->m_nPedState == PED_DRIVING) if(veh->pPassengers[i] && veh->pPassengers[i]->m_nPedState == PED_DRIVING)
veh->pPassengers[i]->Render(); veh->pPassengers[i]->Render();
BACKFACE_CULLING_OFF;
} }
#ifdef EXTRA_MODEL_FLAGS
if(CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
BACKFACE_CULLING_OFF;
e->Render();
BACKFACE_CULLING_ON;
}else
#endif
e->Render(); e->Render();
if(e->IsVehicle()){ if(e->IsVehicle()){
e->bImBeingRendered = true; e->bImBeingRendered = true;
CVisibilityPlugins::RenderAlphaAtomics(); CVisibilityPlugins::RenderAlphaAtomics();
e->bImBeingRendered = false; e->bImBeingRendered = false;
BACKFACE_CULLING_ON;
} }
e->RemoveLighting(resetLights); e->RemoveLighting(resetLights);
@ -197,6 +221,7 @@ CRenderer::RenderRoads(void)
CTreadable *t; CTreadable *t;
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
BACKFACE_CULLING_ON;
DeActivateDirectional(); DeActivateDirectional();
SetAmbientColours(); SetAmbientColours();
@ -230,6 +255,7 @@ CRenderer::RenderEverythingBarRoads(void)
CVector dist; CVector dist;
EntityInfo ei; EntityInfo ei;
BACKFACE_CULLING_ON;
gSortedVehiclesAndPeds.Clear(); gSortedVehiclesAndPeds.Clear();
for(i = 0; i < ms_nNoOfVisibleEntities; i++){ for(i = 0; i < ms_nNoOfVisibleEntities; i++){
@ -284,6 +310,8 @@ CRenderer::RenderBoats(void)
{ {
CLink<EntityInfo> *node; CLink<EntityInfo> *node;
BACKFACE_CULLING_ON;
for(node = gSortedVehiclesAndPeds.tail.prev; for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head; node != &gSortedVehiclesAndPeds.head;
node = node->prev){ node = node->prev){
@ -298,6 +326,7 @@ void
CRenderer::RenderFadingInEntities(void) CRenderer::RenderFadingInEntities(void)
{ {
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
BACKFACE_CULLING_ON;
DeActivateDirectional(); DeActivateDirectional();
SetAmbientColours(); SetAmbientColours();
CVisibilityPlugins::RenderFadingEntities(); CVisibilityPlugins::RenderFadingEntities();
@ -1208,7 +1237,7 @@ CRenderer::IsEntityCullZoneVisible(CEntity *ent)
return !(ped->m_pCurSurface && ped->m_pCurSurface->bZoneCulled2); return !(ped->m_pCurSurface && ped->m_pCurSurface->bZoneCulled2);
case ENTITY_TYPE_OBJECT: case ENTITY_TYPE_OBJECT:
obj = (CObject*)ent; obj = (CObject*)ent;
if(!obj->IsStatic()) if(!obj->GetIsStatic())
return true; return true;
return !(obj->m_pCurSurface && obj->m_pCurSurface->bZoneCulled2); return !(obj->m_pCurSurface && obj->m_pCurSurface->bZoneCulled2);
default: break; default: break;

View File

@ -1058,7 +1058,7 @@ CMoneyMessage::Render()
CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here? CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here?
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity)); CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity));
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();

View File

@ -64,7 +64,7 @@ void CWaterCannon::Update_OncePerFrame(int16 index)
if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME ) if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME )
{ {
m_nCur = (m_nCur + 1) % -NUM_SEGMENTPOINTS; m_nCur = (m_nCur + 1) % NUM_SEGMENTPOINTS;
m_abUsed[m_nCur] = false; m_abUsed[m_nCur] = false;
} }
@ -124,7 +124,7 @@ void CWaterCannon::Render(void)
RwIm3DVertexSetV(&WaterCannonVertices[2], v); RwIm3DVertexSetV(&WaterCannonVertices[2], v);
RwIm3DVertexSetV(&WaterCannonVertices[3], v); RwIm3DVertexSetV(&WaterCannonVertices[3], v);
int16 pointA = m_nCur % -NUM_SEGMENTPOINTS; int16 pointA = m_nCur % NUM_SEGMENTPOINTS;
int16 pointB = pointA - 1; int16 pointB = pointA - 1;
if ( (pointA - 1) < 0 ) if ( (pointA - 1) < 0 )

View File

@ -346,7 +346,7 @@ void CWeather::AddRain()
pos.y = CGeneral::GetRandomNumberInRange(DROPLETS_TOP_OFFSET, screen_height - DROPLETS_TOP_OFFSET); pos.y = CGeneral::GetRandomNumberInRange(DROPLETS_TOP_OFFSET, screen_height - DROPLETS_TOP_OFFSET);
pos.z = 0.0f; pos.z = 0.0f;
CParticle::AddParticle(PARTICLE_RAINDROP_2D, pos, CVector(0.0f, 0.0f, 0.0f), nil, CGeneral::GetRandomNumberInRange(0.5f, 0.9f), CParticle::AddParticle(PARTICLE_RAINDROP_2D, pos, CVector(0.0f, 0.0f, 0.0f), nil, CGeneral::GetRandomNumberInRange(0.5f, 0.9f),
colour, CGeneral::GetRandomNumberInRange(-10, 10), 360 - rain_angle + CGeneral::GetRandomNumberInRange(-30, 30), cur_frame, 0); colour, CGeneral::GetRandomNumberInRange(-10, 10), 360 - rain_angle + CGeneral::GetRandomNumberInRange(-30, 30), cur_frame, 50);
} }
int num_splash_attempts = (int)(3 * Rain) + 1; int num_splash_attempts = (int)(3 * Rain) + 1;
int num_splashes = (int)(3 * Rain) + 4; int num_splashes = (int)(3 * Rain) + 4;

View File

@ -3,11 +3,14 @@
#endif #endif
#include "common.h" #include "common.h"
#include "RwHelper.h"
#include "Timecycle.h" #include "Timecycle.h"
#include "skeleton.h" #include "skeleton.h"
#include "Debug.h" #include "Debug.h"
#ifndef FINAL #if !defined(FINAL) || defined(DEBUGMENU)
#include "rtcharse.h" #include "rtcharse.h"
#endif
#ifndef FINAL
RtCharset *debugCharset; RtCharset *debugCharset;
#endif #endif
@ -16,8 +19,9 @@ bool gPS2alphaTest = true;
#else #else
bool gPS2alphaTest = false; bool gPS2alphaTest = false;
#endif #endif
bool gBackfaceCulling = true;
#ifndef FINAL #if !defined(FINAL) || defined(DEBUGMENU)
static bool charsetOpen; static bool charsetOpen;
void OpenCharsetSafe() void OpenCharsetSafe()
{ {
@ -121,14 +125,32 @@ DefinedState(void)
#ifdef LIBRW #ifdef LIBRW
rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL); rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
rw::SetRenderState(rw::ALPHATESTREF, 3);
rw::SetRenderState(rw::GSALPHATEST, gPS2alphaTest); rw::SetRenderState(rw::GSALPHATEST, gPS2alphaTest);
#else #else
// D3D stuff // D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER); RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
RwD3D8SetRenderState(D3DRS_ALPHAREF, 2);
#endif #endif
SetAlphaRef(2);
}
void
SetAlphaRef(int ref)
{
#ifdef LIBRW
rw::SetRenderState(rw::ALPHATESTREF, ref+1);
#else
RwD3D8SetRenderState(D3DRS_ALPHAREF, ref);
#endif
}
void
SetCullMode(uint32 mode)
{
if(gBackfaceCulling)
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)mode);
else
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
} }
RwFrame* RwFrame*
@ -431,11 +453,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
} }
} }
if (( origSize.w != rect->w ) && ( origSize.h != rect->h )) if (( origSize.w != rect->w ) || ( origSize.h != rect->h ))
{ {
RwRaster *raster; RwRaster *raster;
RwRaster *zRaster; RwRaster *zRaster;
// BUG: game just changes camera raster's sizes, but this is a hack
#ifdef FIX_BUGS
/* /*
* Destroy rasters... * Destroy rasters...
*/ */
@ -444,12 +468,14 @@ CameraSize(RwCamera * camera, RwRect * rect,
if( raster ) if( raster )
{ {
RwRasterDestroy(raster); RwRasterDestroy(raster);
camera->frameBuffer = nil;
} }
zRaster = RwCameraGetZRaster(camera); zRaster = RwCameraGetZRaster(camera);
if( zRaster ) if( zRaster )
{ {
RwRasterDestroy(zRaster); RwRasterDestroy(zRaster);
camera->zBuffer = nil;
} }
/* /*
@ -493,6 +519,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
RwCameraSetRaster(camera, raster); RwCameraSetRaster(camera, raster);
RwCameraSetZRaster(camera, zRaster); RwCameraSetZRaster(camera, zRaster);
} }
#else
raster = RwCameraGetRaster(camera);
zRaster = RwCameraGetZRaster(camera);
raster->width = zRaster->width = rect->w;
raster->height = zRaster->height = rect->h;
#endif
} }
/* Figure out the view window */ /* Figure out the view window */
@ -648,4 +681,4 @@ RestoreAlphaTest()
RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef); RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef);
#endif #endif
} }
#endif #endif

View File

@ -11,6 +11,8 @@ void DestroyDebugFont();
void ObrsPrintfString(const char *str, short x, short y); void ObrsPrintfString(const char *str, short x, short y);
void FlushObrsPrintfs(); void FlushObrsPrintfs();
void DefinedState(void); void DefinedState(void);
void SetAlphaRef(int ref);
void SetCullMode(uint32 mode);
RwFrame *GetFirstChild(RwFrame *frame); RwFrame *GetFirstChild(RwFrame *frame);
RwObject *GetFirstObject(RwFrame *frame); RwObject *GetFirstObject(RwFrame *frame);
RpAtomic *GetFirstAtomic(RpClump *clump); RpAtomic *GetFirstAtomic(RpClump *clump);

View File

@ -1,5 +1,6 @@
#include "common.h" #include "common.h"
#include "RwHelper.h"
#include "templates.h" #include "templates.h"
#include "Entity.h" #include "Entity.h"
#include "ModelInfo.h" #include "ModelInfo.h"
@ -158,6 +159,10 @@ CVisibilityPlugins::RenderFadingEntities(void)
if(mi->m_noZwrite) if(mi->m_noZwrite)
#endif #endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
#ifdef EXTRA_MODEL_FLAGS
else if(mi->m_bIsTree)
SetAlphaRef(128);
#endif
if(e->bDistanceFade){ if(e->bDistanceFade){
DeActivateDirectional(); DeActivateDirectional();
@ -168,6 +173,10 @@ CVisibilityPlugins::RenderFadingEntities(void)
}else }else
CRenderer::RenderOneNonRoad(e); CRenderer::RenderOneNonRoad(e);
#ifdef EXTRA_MODEL_FLAGS
if(mi->m_bIsTree)
SetAlphaRef(2);
#endif
#ifdef FIX_BUGS #ifdef FIX_BUGS
if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite) if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite)
#else #else

View File

@ -26,34 +26,35 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
// Compatible with Linux/POSIX and MinGW on Windows // Compatible with Linux/POSIX and MinGW on Windows
#ifndef _WIN32 #ifndef _WIN32
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
char newpathname[32]; char pathCopy[MAX_PATH];
strcpy(pathCopy, pathname);
strncpy(newpathname, pathname, 32);
char* path = strtok(newpathname, "*"); char *folder = strtok(pathCopy, "*");
char *extension = strtok(NULL, "*");
// because strtok doesn't return NULL for last delimiter
if (extension - folder == strlen(pathname))
extension = nil;
// Case-sensitivity and backslashes... // Case-sensitivity and backslashes...
char *real = casepath(path); // Will be freed at the bottom
if (real) { char *realFolder = casepath(folder);
real[strlen(real)] = '*'; if (realFolder) {
char *extension = strtok(NULL, "*"); folder = realFolder;
if (extension)
strcat(real, extension);
strncpy(newpathname, real, 32);
free(real);
path = strtok(newpathname, "*");
} }
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
// Both w/ extension and w/o extension is ok strncpy(firstfile->folder, folder, sizeof(firstfile->folder));
if (strlen(path) + 1 != strlen(pathname))
strncpy(firstfile->extension, strtok(NULL, "*"), sizeof(firstfile->extension)); if (extension)
strncpy(firstfile->extension, extension, sizeof(firstfile->extension));
else else
strncpy(firstfile->extension, "", sizeof(firstfile->extension)); firstfile->extension[0] = '\0';
if (realFolder)
free(realFolder);
HANDLE d; HANDLE d;
if ((d = (HANDLE)opendir(path)) == NULL || !FindNextFile(d, firstfile)) if ((d = (HANDLE)opendir(firstfile->folder)) == NULL || !FindNextFile(d, firstfile))
return NULL; return NULL;
return d; return d;

View File

@ -418,7 +418,7 @@ psInitialize(void)
} }
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
{ {
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 ) if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 )
{ {
debug("Operating System is Win98\n"); debug("Operating System is Win98\n");
_dwOperatingSystemVersion = OS_WIN98; _dwOperatingSystemVersion = OS_WIN98;
@ -847,7 +847,8 @@ bool IsThisJoystickBlacklisted(int i)
const char* joyname = glfwGetJoystickName(i); const char* joyname = glfwGetJoystickName(i);
if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0) if (gSelectedJoystickName[0] != '\0' &&
strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
return false; return false;
return true; return true;
@ -1219,14 +1220,17 @@ void resizeCB(GLFWwindow* window, int width, int height) {
* memory things don't work. * memory things don't work.
*/ */
/* redraw window */ /* redraw window */
if (RwInitialised && (gGameState == GS_PLAYING_GAME
#ifndef MASTER #ifndef MASTER
|| gGameState == GS_ANIMVIEWER if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
#endif
))
{ {
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void*)TRUE); RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
} }
#else
if (RwInitialised && gGameState == GS_PLAYING_GAME)
{
RsEventHandler(rsIDLE, (void *)TRUE);
}
#endif
if (RwInitialised && height > 0 && width > 0) { if (RwInitialised && height > 0 && width > 0) {
RwRect r; RwRect r;

View File

@ -684,7 +684,7 @@ psInitialize(void)
} }
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
{ {
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 ) if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 )
{ {
debug("Operating System is Win98\n"); debug("Operating System is Win98\n");
_dwOperatingSystemVersion = OS_WIN98; _dwOperatingSystemVersion = OS_WIN98;
@ -1012,11 +1012,17 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
RECT rect; RECT rect;
/* redraw window */ /* redraw window */
#ifndef MASTER
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER)) if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
{ {
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE); RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
} }
#else
if (RwInitialised && gGameState == GS_PLAYING_GAME)
{
RsEventHandler(rsIDLE, (void *)TRUE);
}
#endif
/* Manually resize window */ /* Manually resize window */
rect.left = rect.top = 0; rect.left = rect.top = 0;
rect.bottom = newPos->bottom - newPos->top; rect.bottom = newPos->bottom - newPos->top;
@ -1369,14 +1375,20 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
#endif #endif
if ( mode.Width == width && mode.Height == height && mode.Format == format ) if ( mode.Width == width && mode.Height == height && mode.Format == format )
{ {
if ( mode.RefreshRate == 0 ) if ( mode.RefreshRate == 0 ) {
// From VC
#ifdef FIX_BUGS
d3d->Release();
#endif
return 0; return 0;
}
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 ) if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
refreshRate = mode.RefreshRate; refreshRate = mode.RefreshRate;
} }
} }
// From VC
#ifdef FIX_BUGS #ifdef FIX_BUGS
d3d->Release(); d3d->Release();
#endif #endif

View File

@ -69,10 +69,7 @@ CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
if (len1 != len2 && (len1 < size || len2 < size)) if (len1 != len2 && (len1 < size || len2 < size))
return false; return false;
for (int32 i = 0; i < size; i++) { for (int32 i = 0; i < size && FixupChar(str1[i]) != '\0'; i++) {
if (FixupChar(str1[i]) == '\0')
break;
if (FixupChar(str1[i]) != FixupChar(str2[i])) if (FixupChar(str1[i]) != FixupChar(str2[i]))
return false; return false;
} }
@ -100,13 +97,9 @@ CMessages::Process()
if (BriefMessages[0].m_pText != nil && CTimer::GetTimeInMilliseconds() > BriefMessages[0].m_nTime + BriefMessages[0].m_nStartTime) { if (BriefMessages[0].m_pText != nil && CTimer::GetTimeInMilliseconds() > BriefMessages[0].m_nTime + BriefMessages[0].m_nStartTime) {
BriefMessages[0].m_pText = nil; BriefMessages[0].m_pText = nil;
int32 i = 0; int32 i;
while (i < NUMBRIEFMESSAGES-1) { for (i = 0; i < NUMBRIEFMESSAGES-1 && BriefMessages[i + 1].m_pText != nil; i++) {
if (BriefMessages[i + 1].m_pText == nil)
break;
BriefMessages[i] = BriefMessages[i + 1]; BriefMessages[i] = BriefMessages[i + 1];
i++;
} }
CMessages::BriefMessages[i].m_pText = nil; CMessages::BriefMessages[i].m_pText = nil;
CMessages::BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds(); CMessages::BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
@ -328,9 +321,7 @@ void
CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string) CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string)
{ {
int32 i = 0; int32 i = 0;
while (i < NUMPREVIOUSBRIEFS) { for (i = 0; i < NUMPREVIOUSBRIEFS && PreviousBriefs[i].m_pText != nil; i++) {
if (PreviousBriefs[i].m_pText == nil)
break;
if (PreviousBriefs[i].m_nNumber[0] == n1 if (PreviousBriefs[i].m_nNumber[0] == n1
&& PreviousBriefs[i].m_nNumber[1] == n2 && PreviousBriefs[i].m_nNumber[1] == n2
&& PreviousBriefs[i].m_nNumber[2] == n3 && PreviousBriefs[i].m_nNumber[2] == n3
@ -340,8 +331,6 @@ CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, in
&& PreviousBriefs[i].m_pText == text && PreviousBriefs[i].m_pText == text
&& PreviousBriefs[i].m_pString == string) && PreviousBriefs[i].m_pString == string)
return; return;
i++;
} }
if (i != 0) { if (i != 0) {
@ -374,6 +363,14 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
return; return;
} }
sprintf(numStr, "%d", n1);
size_t outLen = strlen(numStr);
AsciiToUnicode(numStr, wNumStr);
if (str[0] == 0) {
*outstr = '\0';
return;
}
int32 size = GetWideStringLength(str); int32 size = GetWideStringLength(str);
int32 i = 0; int32 i = 0;
@ -385,22 +382,20 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
#else #else
if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') { if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
#endif #endif
c += 3;
for (int j = 0; j < outLen; )
*(outstr++) = wNumStr[j++];
i++;
switch (i) { switch (i) {
case 0: sprintf(numStr, "%d", n1); break;
case 1: sprintf(numStr, "%d", n2); break; case 1: sprintf(numStr, "%d", n2); break;
case 2: sprintf(numStr, "%d", n3); break; case 2: sprintf(numStr, "%d", n3); break;
case 3: sprintf(numStr, "%d", n4); break; case 3: sprintf(numStr, "%d", n4); break;
case 4: sprintf(numStr, "%d", n5); break; case 4: sprintf(numStr, "%d", n5); break;
case 5: sprintf(numStr, "%d", n6); break; case 5: sprintf(numStr, "%d", n6); break;
} }
i++; outLen = strlen(numStr);
AsciiToUnicode(numStr, wNumStr); AsciiToUnicode(numStr, wNumStr);
int j = 0;
while (wNumStr[j] != '\0')
*(outstr++) = wNumStr[j++];
c += 3;
} else { } else {
*(outstr++) = str[c++]; *(outstr++) = str[c++];
} }
@ -466,10 +461,12 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') { if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
#endif #endif
i += 4; i += 4;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS; cont++) { bool done = false;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS && !done; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]); uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);
if (contSize != 0) { if (contSize != 0) {
if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) { if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {
done = true;
ControlsManager.GetWideStringOfCommandKeys(cont, keybuf, 256); ControlsManager.GetWideStringOfCommandKeys(cont, keybuf, 256);
uint16 keybuf_size = GetWideStringLength(keybuf); uint16 keybuf_size = GetWideStringLength(keybuf);
for (uint16 j = 0; j < keybuf_size; j++) { for (uint16 j = 0; j < keybuf_size; j++) {
@ -502,7 +499,7 @@ CMessages::AddMessageWithNumber(wchar *str, uint32 time, uint16 flag, int32 n1,
GetWideStringLength(outstr); GetWideStringLength(outstr);
uint16 i = 0; uint16 i = 0;
while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText) while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil)
i++; i++;
if (i >= NUMBRIEFMESSAGES) return; if (i >= NUMBRIEFMESSAGES) return;
@ -719,39 +716,28 @@ CMessages::ClearThisPrint(wchar *str)
do { do {
equal = false; equal = false;
uint16 i = 0; uint16 i;
while (i < NUMBRIEFMESSAGES) { for (i = 0; i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil; i++) {
if (BriefMessages[i].m_pText == nil)
break;
equal = FastWideStringComparison(str, BriefMessages[i].m_pText); equal = FastWideStringComparison(str, BriefMessages[i].m_pText);
if (equal) break; if (equal) break;
i++;
} }
if (equal) { if (equal) {
if (i != 0) { if (i != 0) {
BriefMessages[i].m_pText = nil; BriefMessages[i].m_pText = nil;
while (i < NUMBRIEFMESSAGES-1) { for (; i < NUMBRIEFMESSAGES-1 && BriefMessages[i+1].m_pText != nil; i++) {
if (BriefMessages[i + 1].m_pText == nil)
break;
BriefMessages[i] = BriefMessages[i + 1]; BriefMessages[i] = BriefMessages[i + 1];
i++;
} }
BriefMessages[i].m_pText = nil; BriefMessages[i].m_pText = nil;
} else { } else {
BriefMessages[0].m_pText = nil; BriefMessages[0].m_pText = nil;
while (i < NUMBRIEFMESSAGES-1) { for (; i < NUMBRIEFMESSAGES-1 && BriefMessages[i+1].m_pText != nil; i++) {
if (BriefMessages[i + 1].m_pText == nil)
break;
BriefMessages[i] = BriefMessages[i + 1]; BriefMessages[i] = BriefMessages[i + 1];
i++;
} }
BriefMessages[i].m_pText = nil; BriefMessages[i].m_pText = nil;
BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds(); BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
if (BriefMessages[0].m_pText == nil) if (BriefMessages[0].m_pText != nil)
AddToPreviousBriefArray( AddToPreviousBriefArray(
BriefMessages[0].m_pText, BriefMessages[0].m_pText,
BriefMessages[0].m_nNumber[0], BriefMessages[0].m_nNumber[0],
@ -801,7 +787,7 @@ CMessages::ClearThisBigPrint(wchar *str)
} }
BIGMessages[style].m_Stack[i].m_pText = nil; BIGMessages[style].m_Stack[i].m_pText = nil;
} else { } else {
BIGMessages[style].m_Stack[0].m_pText = 0; BIGMessages[style].m_Stack[0].m_pText = nil;
i = 0; i = 0;
while (i < 3) { while (i < 3) {
if (BIGMessages[style].m_Stack[i + 1].m_pText == nil) if (BIGMessages[style].m_Stack[i + 1].m_pText == nil)

View File

@ -1,4 +1,4 @@
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"
#include "General.h" #include "General.h"
@ -2192,8 +2192,8 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
} }
// move body cast // move body cast
if(phys->IsStatic()){ if(phys->GetIsStatic()){
phys->bIsStatic = false; phys->SetIsStatic(false);
phys->m_nStaticFrames = 0; phys->m_nStaticFrames = 0;
phys->ApplyMoveForce(m_vecMoveSpeed / Sqrt(speed)); phys->ApplyMoveForce(m_vecMoveSpeed / Sqrt(speed));
phys->AddToMovingList(); phys->AddToMovingList();
@ -3746,7 +3746,6 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_ROLLDOOR_LOW: case ANIM_CAR_ROLLDOOR_LOW:
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f); ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
break; break;
break;
case ANIM_CAR_GETOUT_LHS: case ANIM_CAR_GETOUT_LHS:
case ANIM_CAR_GETOUT_LOW_LHS: case ANIM_CAR_GETOUT_LOW_LHS:
case ANIM_CAR_GETOUT_RHS: case ANIM_CAR_GETOUT_RHS:
@ -3760,6 +3759,7 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_PULLOUT_RHS: case ANIM_CAR_PULLOUT_RHS:
case ANIM_CAR_PULLOUT_LOW_RHS: case ANIM_CAR_PULLOUT_LOW_RHS:
OpenDoor(component, door, 1.0f); OpenDoor(component, door, 1.0f);
break;
case ANIM_COACH_OPEN_L: case ANIM_COACH_OPEN_L:
case ANIM_COACH_OPEN_R: case ANIM_COACH_OPEN_R:
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f); ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
@ -4385,7 +4385,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
obj->m_fElasticity = 0.1f; obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f; obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT; obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false; obj->SetIsStatic(false);
obj->bIsPickup = false; obj->bIsPickup = false;
obj->bUseVehicleColours = true; obj->bUseVehicleColours = true;
obj->m_colour1 = m_currentColour1; obj->m_colour1 = m_currentColour1;

View File

@ -664,7 +664,7 @@ CBoat::BlowUpCar(CEntity *culprit)
obj->m_fElasticity = 0.1f; obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f; obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT; obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false; obj->SetIsStatic(false);
obj->bIsPickup = false; obj->bIsPickup = false;
// life time // life time

View File

@ -58,7 +58,7 @@ void CCarGenerator::DoInternalProcessing()
return; return;
if (CModelInfo::IsBoatModel(m_nModelIndex)){ if (CModelInfo::IsBoatModel(m_nModelIndex)){
CBoat* pBoat = new CBoat(m_nModelIndex, PARKED_VEHICLE); CBoat* pBoat = new CBoat(m_nModelIndex, PARKED_VEHICLE);
pBoat->bIsStatic = false; pBoat->SetIsStatic(false);
pBoat->bEngineOn = false; pBoat->bEngineOn = false;
CVector pos = m_vecPos; CVector pos = m_vecPos;
if (pos.z <= -100.0f) if (pos.z <= -100.0f)
@ -101,7 +101,7 @@ void CCarGenerator::DoInternalProcessing()
if (((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex))->m_vehicleType != VEHICLE_TYPE_BIKE) if (((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex))->m_vehicleType != VEHICLE_TYPE_BIKE)
pCar = new CAutomobile(m_nModelIndex, PARKED_VEHICLE); pCar = new CAutomobile(m_nModelIndex, PARKED_VEHICLE);
pCar->bIsStatic = false; pCar->SetIsStatic(false);
pCar->bEngineOn = false; pCar->bEngineOn = false;
pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel();
pCar->SetPosition(pos); pCar->SetPosition(pos);

View File

@ -726,7 +726,7 @@ CHeli::SpawnFlyingComponent(int32 component)
obj->m_fElasticity = 0.1f; obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f; obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT; obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false; obj->SetIsStatic(false);
obj->bIsPickup = false; obj->bIsPickup = false;
// life time // life time

View File

@ -185,11 +185,11 @@ void CBulletInfo::Update(void)
if (pHitEntity->IsObject()) { if (pHitEntity->IsObject()) {
CObject* pObject = (CObject*)pHitEntity; CObject* pObject = (CObject*)pHitEntity;
if (!pObject->bInfiniteMass) { if (!pObject->bInfiniteMass) {
if (pObject->IsStatic() && pObject->m_fUprootLimit <= 0.0f) { if (pObject->GetIsStatic() && pObject->m_fUprootLimit <= 0.0f) {
pObject->bIsStatic = false; pObject->SetIsStatic(false);
pObject->AddToMovingList(); pObject->AddToMovingList();
} }
if (!pObject->IsStatic()) if (!pObject->GetIsStatic())
pObject->ApplyMoveForce(-BULLET_HIT_FORCE * point.normal); pObject->ApplyMoveForce(-BULLET_HIT_FORCE * point.normal);
} }
} }

View File

@ -108,10 +108,17 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
CVector fireOffset(0.0f, 0.0f, 0.6f); CVector fireOffset(0.0f, 0.0f, 0.6f);
CVector *source = fireSource; CVector *source = fireSource;
if (!fireSource) { if (!fireSource)
{
fireOffset = shooter->GetMatrix() * fireOffset;
#ifdef FIX_BUGS
static CVector tmp; static CVector tmp;
tmp = shooter->GetMatrix() * fireOffset; tmp = fireOffset;
source = &tmp; source = &tmp;
#else
source = &fireOffset;
#endif
} }
if ( m_bAddRotOffset ) if ( m_bAddRotOffset )
{ {
@ -1057,13 +1064,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( !victimObject->bInfiniteMass ) if ( !victimObject->bInfiniteMass )
{ {
if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f ) if ( victimObject->GetIsStatic() && victimObject->m_fUprootLimit <= 0.0f )
{ {
victimObject->bIsStatic = false; victimObject->SetIsStatic(false);
victimObject->AddToMovingList(); victimObject->AddToMovingList();
} }
if ( !victimObject->IsStatic()) if ( !victimObject->GetIsStatic())
{ {
CVector moveForce = point->normal*-4.0f; CVector moveForce = point->normal*-4.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z); victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@ -1166,6 +1173,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
{ {
float shootAngle = DEGTORAD(7.5f*i + shooterAngle - 15.0f); float shootAngle = DEGTORAD(7.5f*i + shooterAngle - 15.0f);
CVector2D shootRot(-Sin(shootAngle), Cos(shootAngle)); CVector2D shootRot(-Sin(shootAngle), Cos(shootAngle));
shootRot.Normalise();
CVector source, target; CVector source, target;
CColPoint point; CColPoint point;
@ -1316,13 +1324,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass ) if ( !victimObject->bInfiniteMass )
{ {
if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f ) if ( victimObject->GetIsStatic() && victimObject->m_fUprootLimit <= 0.0f )
{ {
victimObject->bIsStatic = false; victimObject->SetIsStatic(false);
victimObject->AddToMovingList(); victimObject->AddToMovingList();
} }
if ( !victimObject->IsStatic()) if ( !victimObject->GetIsStatic())
{ {
CVector moveForce = point.normal*-5.0f; CVector moveForce = point.normal*-5.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z); victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@ -2258,9 +2266,9 @@ CWeapon::BlowUpExplosiveThings(CEntity *thing)
object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f; object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f; object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
if ( object->IsStatic()) if ( object->GetIsStatic())
{ {
object->bIsStatic = false; object->SetIsStatic(false);
object->AddToMovingList(); object->AddToMovingList();
} }
} }

View File

@ -8022,6 +8022,45 @@ REPLAY MISSION
[FESZ_RM] [FESZ_RM]
RETRY? RETRY?
[FED_VPL]
VEHICLE PIPELINE
[FED_PRM]
PED RIM LIGHT
[FED_RGL]
ROAD GLOSS
[FED_CLF]
COLOUR FILTER
[FED_WLM]
WORLD LIGHTMAPS
[FED_MBL]
MOTION BLUR
[FEM_SIM]
SIMPLE
[FEM_NRM]
NORMAL
[FEM_MOB]
MOBILE
[FED_MFX]
MATFX
[FED_NEO]
NEO
[FEM_PS2]
PS2
[FEM_XBX]
XBOX
{ end of file } { end of file }
[DUMMY] [DUMMY]

2
vendor/librw vendored

@ -1 +1 @@
Subproject commit edc77742c512b85ad35544b2cfbe3f359dc75805 Subproject commit e68ef1374d20071887348e9031f5fa38a2e4f7ed

2
vendor/ogg vendored

@ -1 +1 @@
Subproject commit 684c73773e7e2683245ffd6aa75f04115b51123a Subproject commit 36f969bb37559345ee03796ed625a9abd42c6db9

2
vendor/opusfile vendored

@ -1 +1 @@
Subproject commit f94a1764b0dcdd84ee8c13c040de9f4c1a67e4df Subproject commit 4174c26e0aaab19d01afdea0a46f7f95fdc6b3e6