1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 04:00:00 +00:00
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
on:
branch: master
APPVEYOR_REPO_TAG: false
APPVEYOR_REPO_TAG: true
cache:
- "%GLEW_FILE%"

Binary file not shown.

View file

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

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "AudioManager.h"
#include "audio_enums.h"
@ -4107,14 +4107,13 @@ cAudioManager::GetArmyTalkSfx(int16 sound)
PedState pedState;
static uint32 lastSfx = NO_SAMPLE;
switch (sound) {
switch(sound) {
case SOUND_PED_PURSUIT_ARMY:
pedState = FindPlayerPed()->m_nPedState;
if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
return NO_SAMPLE;
if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE;
GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15);
default:
return GetGenericMaleTalkSfx(sound);
break;
default: return GetGenericMaleTalkSfx(sound);
}
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;
static uint32 lastSfx = NO_SAMPLE;
switch (sound) {
case SOUND_PED_HANDS_UP:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2);
break;
case SOUND_PED_ROBBED:
GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2);
break;
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);
switch(sound) {
case SOUND_PED_HANDS_UP: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); break;
case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); break;
case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); break;
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); break;
default: return GetGenericMaleTalkSfx(sound);
}
if (model == MI_P_MAN2)
@ -4641,26 +4624,14 @@ cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound)
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
switch (sound) {
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3);
break;
case SOUND_PED_ROBBED:
GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3);
break;
case SOUND_PED_EVADE:
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);
switch(sound) {
case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); break;
case SOUND_PED_ROBBED: GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); break;
case SOUND_PED_EVADE: 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); break;
default: return GetGenericMaleTalkSfx(sound);
}
return sfx;
}

View file

@ -321,8 +321,13 @@ cAudioManager::Get3DProviderName(uint8 id) const
{
if (!m_bIsInitialised)
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())
return nil;
#endif
return SampleManager.Get3DProviderName(id);
}

View file

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

View file

@ -5,9 +5,6 @@
#include "AudioManager.h"
#include "AudioScriptObject.h"
#include "sampman.h"
#include "Font.h"
#include "Text.h"
#include "crossplatform.h"
cDMAudio DMAudio;
@ -113,28 +110,6 @@ cDMAudio::Get3DProviderName(uint8 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
cDMAudio::GetCurrent3DProviderIndex(void)
{
@ -198,7 +173,7 @@ cDMAudio::IsAudioInitialised(void)
void
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
{
AudioManager.ReportCrime(crime, &pos);
AudioManager.ReportCrime(crime, pos);
}
int32
@ -345,7 +320,7 @@ cDMAudio::SetRadioInCar(uint32 radio)
}
void
cDMAudio::SetRadioChannel(int8 radio, int32 pos)
cDMAudio::SetRadioChannel(uint8 radio, int32 pos)
{
MusicManager.SetRadioChannelByScript(radio, pos);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -195,7 +195,7 @@ public:
if (m_FileH) {
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);
for (int i = 0; i < tags->comments; i++) {
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
else
m_pSoundFile = nil;
ASSERT(m_pSoundFile != nil);
if (m_pSoundFile && m_pSoundFile->IsOpened() )
if ( IsOpened() )
{
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
ASSERT(m_pBuffer!=nil);
@ -371,14 +371,14 @@ bool CStream::HasSource()
bool CStream::IsOpened()
{
return m_pSoundFile->IsOpened();
return m_pSoundFile && m_pSoundFile->IsOpened();
}
bool CStream::IsPlaying()
{
if ( !HasSource() || !IsOpened() ) return false;
if ( m_pSoundFile->IsOpened() && !m_bPaused )
if ( !m_bPaused )
{
ALint sourceState;
alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState);
@ -446,7 +446,7 @@ void CStream::SetPan(uint8 nPan)
void CStream::SetPosMS(uint32 nPos)
{
if ( !m_pSoundFile->IsOpened() ) return;
if ( !IsOpened() ) return;
m_pSoundFile->Seek(nPos);
ClearBuffers();
}
@ -454,7 +454,7 @@ void CStream::SetPosMS(uint32 nPos)
uint32 CStream::GetPosMS()
{
if ( !HasSource() ) return 0;
if ( !m_pSoundFile->IsOpened() ) return 0;
if ( !IsOpened() ) return 0;
ALint offset;
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
@ -467,7 +467,7 @@ uint32 CStream::GetPosMS()
uint32 CStream::GetLengthMS()
{
if ( !m_pSoundFile->IsOpened() ) return 0;
if ( !IsOpened() ) return 0;
return m_pSoundFile->GetLength();
}
@ -475,7 +475,7 @@ bool CStream::FillBuffer(ALuint alBuffer)
{
if ( !HasSource() )
return false;
if ( !m_pSoundFile->IsOpened() )
if ( !IsOpened() )
return false;
if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) )
return false;
@ -517,7 +517,7 @@ void CStream::ClearBuffers()
bool CStream::Setup()
{
if ( m_pSoundFile->IsOpened() )
if ( IsOpened() )
{
m_pSoundFile->Seek(0);
alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE);

View file

@ -153,11 +153,7 @@ public:
bool Initialise(void);
void Terminate (void);
#ifdef AUDIO_OAL
void UpdateSoundBuffers(void);
#endif
bool CheckForAnAudioFileOnCD(void);
char GetCDAudioDriveLetter (void);
@ -218,6 +214,10 @@ public:
extern cSampleManager SampleManager;
extern uint32 BankStartOffset[MAX_SFX_BANKS];
#ifdef AUDIO_OAL
extern int defaultProvider;
#endif
#ifdef AUDIO_OPUS
static char StreamedNameTable[][25] = {
"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;
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

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

View file

@ -1400,7 +1400,7 @@ void CGarages::PrintMessages()
CFont::SetPropOn();
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f));
CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
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 };
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);
delete m_pObject;
m_bRemoved = true;
m_pObject = nil;
}
void
CPickup::Remove()
{
RemoveKeepType();
m_eType = PICKUP_NONE;
}
@ -131,7 +126,6 @@ CPickup::GiveUsAPickUpObject(int32 handle)
bool
CPickup::CanBePickedUp(CPlayerPed *player)
{
assert(m_pObject != nil);
bool cannotBePickedUp =
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 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)
{
float waterLevel;
bool result = false;
if (m_bRemoved) {
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()));
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;
return true;
m_bRemoved = true;
}
break;
case PICKUP_ON_STREET:
@ -235,8 +233,12 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
m_nTimer = CTimer::GetTimeInMilliseconds() + 720000;
}
RemoveKeepType();
return true;
result = true;
CWorld::Remove(m_pObject);
delete m_pObject;
m_pObject = nil;
m_bRemoved = true;
break;
case PICKUP_ONCE:
case PICKUP_ONCE_TIMEOUT:
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);
}
result = true;
Remove();
return true;
break;
case PICKUP_COLLECTABLE1:
CWorld::Players[playerId].m_nCollectedPackages++;
CWorld::Players[playerId].m_nMoney += 1000;
@ -260,18 +263,20 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
} else
CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
result = true;
Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HIDDEN_PACKAGE, 0);
return true;
break;
case PICKUP_MONEY:
CWorld::Players[playerId].m_nMoney += m_nQuantity;
sprintf(gString, "$%d", m_nQuantity);
#ifdef MONEY_MESSAGES
CMoneyMessages::RegisterOne(m_vecPos + CVector(0.0f, 0.0f, 1.0f), gString, 0, 255, 0, 0.5f, 0.5f);
#endif
result = true;
Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
return true;
break;
default:
break;
}
@ -298,7 +303,9 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
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)) {
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;
if (CTimer::GetTimeInMilliseconds() > m_nTimer)
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--) {
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)) {
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();
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 2.0f)) {
Remove();
result = true;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_FLOAT_PACKAGE, 0);
return true;
}
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)
Remove();
return false;
return result;
}
void
@ -628,7 +640,7 @@ CPickups::Update()
#ifdef CAMERA_PICKUP
if ( bPickUpcamActivated ) // taken from PS2
{
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D();
float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
float mult;
if ( 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);
}
if ( FindPlayerVehicle() != pPlayerVehicle
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
{
TheCamera.RestoreWithJumpCut();
@ -715,7 +726,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
CObject *object = (CObject*)entity;
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;
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
@ -746,7 +757,7 @@ void
CPickups::DoMineEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f;
if (dist < MAXDIST) {
@ -765,7 +776,7 @@ void
CPickups::DoMoneyEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f;
if (dist < MAXDIST) {
@ -784,7 +795,7 @@ void
CPickups::DoCollectableEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 14.0f;
if (dist < MAXDIST) {

View file

@ -41,10 +41,9 @@ public:
CObject *GiveUsAPickUpObject(int32 handle);
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
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);
void RemoveKeepType();
void Remove();
inline void Remove();
};
VALIDATE_SIZE(CPickup, 0x1C);

View file

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

View file

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

View file

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

View file

@ -2316,8 +2316,416 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
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)
{
#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 sets = 0;

View file

@ -1,6 +1,7 @@
#include "common.h"
#include "main.h"
#include "General.h"
#include "Quaternion.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
@ -449,6 +450,334 @@ CFileLoader::LoadAtomicFile(RwStream *stream, uint32 id)
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*
CFileLoader::SetRelatedModelInfoCB(RpAtomic *atomic, void *data)
{
@ -600,6 +929,21 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
mi->m_isSubway = !!(flags & 0x10);
mi->m_ignoreLight = !!(flags & 0x20);
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

View file

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

View file

@ -89,6 +89,7 @@
#include "frontendoption.h"
#include "postfx.h"
#include "custompipes.h"
#include "crossplatform.h"
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@ -128,10 +129,10 @@ void MessageScreen(char *msg)
CFont::SetFontStyle(FONT_BANK);
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::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
CFont::SetCentreSize(SCREEN_SCALE_X(450.0f)); // 450.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetDropColor(CRGBA(32, 32, 32, 255));
@ -277,12 +278,31 @@ bool CGame::InitialiseOnceAfterRW(void)
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
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;
int8 provider = DMAudio.AutoDetect3DProviders();
if ( provider != -1 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider;
int32 i;
for (i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++) {
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);
@ -725,10 +745,10 @@ void CGame::InitialiseWhenRestarting(void)
//CFont::SetFontStyle(?);
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::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
CFont::SetCentreSize(SCREEN_SCALE_X(480.0f)); // 480.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetBackGroundOnlyTextOff();

View file

@ -2399,7 +2399,7 @@ bool CPad::GetAnaloguePadLeftJustUp(void)
if ( X == 0 && oldfStickX < 0 )
{
oldfStickX = X;
oldfStickX = 0;
return true;
}
@ -2419,7 +2419,7 @@ bool CPad::GetAnaloguePadRightJustUp(void)
if ( X == 0 && oldfStickX > 0 )
{
oldfStickX = X;
oldfStickX = 0;
return true;
}
@ -2593,7 +2593,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetScale(0.85f, 1.0f);
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_WIDTH - 20);
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
@ -2610,7 +2610,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetScale(0.85f, 1.0f);
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_WIDTH - 20);
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn();
CFont::SetPropOn();
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)
#ifdef MENU_MAP
CRGBA CRadar::ArrowBlipColour1;
CRGBA CRadar::ArrowBlipColour2;
uint16 CRadar::MapLegendCounter;
uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
int CRadar::TargetMarkerId = -1;
CVector CRadar::TargetMarkerPos;
#endif
@ -116,7 +112,7 @@ void RequestMapSection(int32 x, int32 y)
void RemoveMapSection(int32 x, int32 y)
{
if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
if (x >= 0 && x <= RADAR_NUM_TILES - 1 && y >= 0 && y <= RADAR_NUM_TILES - 1)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
}
@ -709,6 +705,7 @@ void CRadar::DrawBlips()
if (CMenuManager::bMenuMapActive) {
CVector2D in, out;
TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
DrawYouAreHereSprite(out.x, out.y);
}
@ -782,14 +779,20 @@ void CRadar::DrawRadarMask()
};
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
#if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
#else
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
#endif
CVector2D out[8];
CVector2D in;
@ -810,7 +813,10 @@ void CRadar::DrawRadarMask()
CSprite2d::SetMaskVertices(8, (float *)out);
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
};
}
#if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
#endif
}
void CRadar::DrawRadarSection(int32 x, int32 y)
@ -860,46 +866,22 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
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));
#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)
{
CVector curPosn[4];
CVector oldPosn[4];
curPosn[0].x = x - SCREEN_SCALE_X(5.6f);
curPosn[0].y = y + SCREEN_SCALE_Y(5.6f);
curPosn[1].x = x + SCREEN_SCALE_X(5.6f);
curPosn[1].y = y + SCREEN_SCALE_Y(5.6f);
curPosn[2].x = x - SCREEN_SCALE_X(5.6f);
curPosn[2].y = y - SCREEN_SCALE_Y(5.6f);
curPosn[3].x = x + SCREEN_SCALE_X(5.6f);
curPosn[3].y = y - SCREEN_SCALE_Y(5.6f);
const float sizeX = SCREEN_SCALE_X(8.0f);
const float correctedAngle = angle - PI / 4.f;
const float sizeY = SCREEN_SCALE_Y(8.0f);
for (uint32 i = 0; i < 4; i++) {
oldPosn[i] = curPosn[i];
curPosn[i].x = x + (oldPosn[i].x - x) * Cos(angle) + (oldPosn[i].y - y) * Sin(angle);
curPosn[i].y = y - (oldPosn[i].x - x) * Sin(angle) + (oldPosn[i].y - y) * Cos(angle);
const float cornerAngle = i * HALFPI + correctedAngle;
curPosn[i].x = x + (0.0f * Cos(cornerAngle) + 1.0f * Sin(cornerAngle)) * sizeX;
curPosn[i].y = y - (0.0f * Sin(cornerAngle) - 1.0f * Cos(cornerAngle)) * sizeY;
}
sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
sprite->Draw(curPosn[3].x, curPosn[3].y, curPosn[2].x, curPosn[2].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
}
int32 CRadar::GetActualBlipArrayIndex(int32 i)
@ -925,43 +907,43 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{
int32 c;
switch (color) {
case 0:
case RADAR_TRACE_RED:
if (bright)
c = 0x712B49FF;
else
c = 0x7F0000FF;
break;
case 1:
case RADAR_TRACE_GREEN:
if (bright)
c = 0x5FA06AFF;
else
c = 0x007F00FF;
break;
case 2:
case RADAR_TRACE_LIGHT_BLUE:
if (bright)
c = 0x80A7F3FF;
else
c = 0x00007FFF;
break;
case 3:
case RADAR_TRACE_GRAY:
if (bright)
c = 0xE1E1E1FF;
else
c = 0x7F7F7FFF;
break;
case 4:
case RADAR_TRACE_YELLOW:
if (bright)
c = 0xFFFF00FF;
else
c = 0x7F7F00FF;
break;
case 5:
case RADAR_TRACE_MAGENTA:
if (bright)
c = 0xFF00FFFF;
else
c = 0x7F007FFF;
break;
case 6:
case RADAR_TRACE_CYAN:
if (bright)
c = 0x00FFFFFF;
else
@ -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));
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()
@ -1415,12 +1382,6 @@ CRadar::InitFrontEndMap()
vec2DRadarOrigin.x = 0.0f;
vec2DRadarOrigin.y = 0.0f;
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
@ -1448,7 +1409,6 @@ CRadar::DrawYouAreHereSprite(float x, float y)
float bottom = y - SCREEN_SCALE_Y(24.0f);
CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
}
MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
}
void
@ -1465,8 +1425,8 @@ CRadar::ToggleTargetMarker(float x, float y)
return;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
ms_RadarTrace[nextBlip].m_bDim = 1;
ms_RadarTrace[nextBlip].m_nColor = RADAR_TRACE_GRAY;
ms_RadarTrace[nextBlip].m_bDim = 0;
ms_RadarTrace[nextBlip].m_bInUse = 1;
ms_RadarTrace[nextBlip].m_Radius = 1.0f;
CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));

View file

@ -49,6 +49,17 @@ enum eRadarSprite
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
{
BLIP_MODE_TRIANGULAR_UP = 0,
@ -108,11 +119,6 @@ public:
static float cachedCos;
static float cachedSin;
#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 CVector TargetMarkerPos;

View file

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

View file

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

View file

@ -156,6 +156,23 @@ enum Config {
// any debug stuff that is only left in mobile, is not in 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
# define GTA_PS2_STUFF
# define RANDOMSPLASH
@ -177,9 +194,13 @@ enum Config {
#ifdef MASTER
// only in master builds
#undef DRAW_GAME_VERSION_TEXT
#else
// not in master builds
#define VALIDATE_SAVE_SIZE
#define NO_MOVIES // disable intro videos
#define DEBUGMENU
#endif
#ifdef FINAL
@ -187,11 +208,7 @@ enum Config {
# define USE_MY_DOCUMENTS // use my documents directory for user files
#else
// 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 DEBUGMENU
# define TIMEBARS // print debug timers
#endif
@ -201,6 +218,9 @@ enum Config {
#define LOAD_INI_SETTINGS
// 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 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

View file

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

View file

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

View file

@ -33,6 +33,11 @@
#include "postfx.h"
#include "custompipes.h"
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
#include "FileMgr.h"
#include "ControllerConfig.h"
#endif
#ifndef _WIN32
#include "assert.h"
#include <stdarg.h>
@ -275,7 +280,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
const char *joyname;
if (userHovering) {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
if (joyname = glfwGetJoystickName(i)) {
if ((joyname = glfwGetJoystickName(i))) {
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
for (int j = 0; j < numButtons; j++) {
if (buttons[j]) {
@ -455,8 +460,34 @@ void LoadINISettings()
char defaultStr[4];
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// Written by assuming the codes below will run after _InputInitialiseJoys().
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
#ifdef CUSTOM_FRONTEND_OPTIONS
@ -818,9 +849,12 @@ DebugMenuPopulate(void)
DebugMenuEntrySetWrap(e, true);
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 Ped Rim light", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
DebugMenuAddVar("Render", "Neo World Lightmaps", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
DebugMenuAddVar("Render", "Neo Road Gloss", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
DebugMenuAddVarBool8("Render", "Neo Ped Rim light enable", &CustomPipes::RimlightEnable, nil);
DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, 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
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);

View file

@ -1,6 +1,13 @@
#pragma once
#ifdef TIMEBARS
void tbInit();
void tbStartTimer(int32, 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; }
void SetStatus(eEntityStatus status) { m_status = status; }
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
void SaveEntityFlags(uint8*& buf);
void LoadEntityFlags(uint8*& buf);

View file

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

View file

@ -337,7 +337,7 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp)
* Neo Vehicle pipe
*/
int32 VehiclePipeSwitch = VEHICLEPIPE_NEO;
int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX;
float VehicleShininess = 0.7f; // the default is a bit extreme
float VehicleSpecularity = 1.0f;
InterpolatedFloat Fresnel(0.4f);
@ -365,6 +365,7 @@ AttachVehiclePipe(rw::Clump *clump)
* Neo World pipe
*/
bool LightmapEnable;
float LightmapMult = 1.0f;
InterpolatedFloat WorldLightmapBlend(1.0f);
rw::ObjPipeline *worldPipe;
@ -389,6 +390,7 @@ AttachWorldPipe(rw::Clump *clump)
* Neo Gloss pipe
*/
bool GlossEnable;
float GlossMult = 1.0f;
rw::ObjPipeline *glossPipe;
@ -427,6 +429,7 @@ AttachGlossPipe(rw::Clump *clump)
* Neo Rim pipes
*/
bool RimlightEnable;
float RimlightMult = 1.0f;
InterpolatedColor RampStart(Color(0.0f, 0.0f, 0.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::Clump *clump);
extern bool LightmapEnable;
extern float LightmapMult;
extern InterpolatedFloat WorldLightmapBlend;
extern rw::ObjPipeline *worldPipe;
@ -106,6 +107,7 @@ void DestroyWorldPipe(void);
void AttachWorldPipe(rw::Atomic *atomic);
void AttachWorldPipe(rw::Clump *clump);
extern bool GlossEnable;
extern float GlossMult;
extern rw::ObjPipeline *glossPipe;
void CreateGlossPipe(void);
@ -114,6 +116,7 @@ void AttachGlossPipe(rw::Atomic *atomic);
void AttachGlossPipe(rw::Clump *clump);
rw::Texture *GetGlossTex(rw::Material *mat);
extern bool RimlightEnable;
extern float RimlightMult;
extern InterpolatedColor RampStart;
extern InterpolatedColor RampEnd;

View file

@ -190,6 +190,11 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d;
using namespace rw::d3d9;
if(!LightmapEnable){
defaultRenderCB_Shader(atomic, header);
return;
}
int vsBits;
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
setIndices(header->indexBuffer);
@ -297,6 +302,9 @@ glossRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d;
using namespace rw::d3d9;
if(!GlossEnable)
return;
setVertexShader(neoGloss_VS);
setPixelShader(neoGloss_PS);
@ -395,6 +403,11 @@ rimRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d;
using namespace rw::d3d9;
if(!RimlightEnable){
defaultRenderCB_Shader(atomic, header);
return;
}
int vsBits;
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
setIndices(header->indexBuffer);
@ -433,6 +446,11 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d;
using namespace rw::d3d9;
if(!RimlightEnable){
skinRenderCB(atomic, header);
return;
}
int vsBits;
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::gl3;
if(!LightmapEnable){
gl3::defaultRenderCB(atomic, header);
return;
}
Material *m;
setWorldMatrix(atomic->getFrame()->getLTM());
@ -315,6 +320,8 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw::gl3;
worldRenderCB(atomic, header);
if(!GlossEnable)
return;
Material *m;
@ -442,6 +449,11 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw;
using namespace rw::gl3;
if(!RimlightEnable){
gl3::skinRenderCB(atomic, header);
return;
}
Material *m;
setWorldMatrix(atomic->getFrame()->getLTM());
@ -487,6 +499,11 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw;
using namespace rw::gl3;
if(!RimlightEnable){
gl3::defaultRenderCB(atomic, header);
return;
}
Material *m;
setWorldMatrix(atomic->getFrame()->getLTM());

View file

@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
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;
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);

View file

@ -31,6 +31,14 @@ protected:
ModelInfoType m_type;
uint8 m_num2dEffects;
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:
CBaseModelInfo(ModelInfoType type);

View file

@ -5,6 +5,7 @@
#include "NodeName.h"
#include "VisibilityPlugins.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
void
CClumpModelInfo::DeleteRwObject(void)
@ -110,12 +111,18 @@ CClumpModelInfo::SetClump(RpClump *clump)
weights->w3 /= sum;
}
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
}else
#endif
// do not set on skinned clip because cutscene head is not compatible with player head
if(strncmp(GetName(), "playerh", 8) == 0)
}
if(strncmp(GetName(), "playerh", 8) == 0){
// playerh is incompatible with the xbox player skin
// 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);
}
#else
if(strncmp(GetName(), "playerh", 8) == 0){
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
#endif
}
void

View file

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

View file

@ -91,7 +91,7 @@ CObject::ProcessControl(void)
CPhysical::ProcessControl();
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
bIsInWater = true;
bIsStatic = false;
SetIsStatic(false);
ApplyMoveForce(impulse);
ApplyTurnForce(impulse, point);
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
@ -182,7 +182,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_COMPLETELY:
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -194,7 +194,7 @@ CObject::ObjectDamage(float amount)
else {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(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: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(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: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(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: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(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: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -314,7 +314,7 @@ CObject::Init(void)
CObjectData::SetObjectData(GetModelIndex(), *this);
m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT;
bIsStatic = true;
SetIsStatic(true);
bIsPickup = false;
bPickupObjWithMessage = 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.
// 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;
@ -814,15 +814,15 @@ CPed::Avoid(void)
// Get distance to ped we want to avoid
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()
+ 500 + (m_randomSeed + 3 * CTimer::GetFrameCounter())
% 1000 / 5;
m_fRotationDest += DEGTORAD(45.0f);
if (!bIsLooking) {
CPed::SetLookFlag(nearestPed, false);
CPed::SetLookTimer(CGeneral::GetRandomNumberInRange(500, 800));
SetLookFlag(nearestPed, false);
SetLookTimer(CGeneral::GetRandomNumberInRange(500, 800));
}
}
}
@ -861,8 +861,7 @@ CPed::ClearLookFlag(void) {
m_lookTimer = CTimer::GetTimeInMilliseconds() + 4000;
if (m_nPedState == PED_LOOK_HEADING || m_nPedState == PED_LOOK_ENTITY) {
RestorePreviousState();
ClearLookFlag();
ClearLook();
}
}
}
@ -985,7 +984,7 @@ CPed::Attack(void)
weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ourWeapon->m_Anim2ToPlay, 8.0f);
}
weaponAnimAssoc->SetFinishCallback(CPed::FinishedAttackCB, this);
weaponAnimAssoc->SetFinishCallback(FinishedAttackCB, this);
weaponAnimAssoc->SetRun();
if (weaponAnimAssoc->currentTime == weaponAnimAssoc->hierarchy->totalLength)
@ -2900,7 +2899,7 @@ CPed::ReactToAttack(CEntity *attacker)
#ifdef VC_PED_PORTS
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
&& (m_pMyVehicle->GetStatus() == STATUS_SIMPLE || m_pMyVehicle->GetStatus() == STATUS_PHYSICS)
@ -4435,11 +4434,11 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
bool vehPressedHorn = false;
if (neededTurn > PI)
neededTurn = 2 * PI - neededTurn;
neededTurn = TWOPI - neededTurn;
CVehicle *veh = (CVehicle*)reason;
if (reason->IsVehicle() && veh->m_vehType == VEHICLE_TYPE_CAR) {
if (veh->m_nCarHornTimer) {
if (veh->m_nCarHornTimer != 0) {
vehPressedHorn = true;
if (!IsPlayer())
animType = 1;
@ -4459,7 +4458,7 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
angleToFace += PI;
if (angleToFace > PI)
angleToFace -= 2*PI;
angleToFace -= TWOPI;
// We don't want to run towards car's direction
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
if (dangerZone <= 0.0f)
angleToFace = 0.5f*PI + vehDirection;
angleToFace = HALFPI + vehDirection;
else
angleToFace = vehDirection - 0.5f*PI;
angleToFace = vehDirection - HALFPI;
if (animType == 2)
stepAnim = ANIM_HANDSCOWER;
else if (animType < 2)
stepAnim = NUM_ANIMS;
if (animType == 0 || animType == 1)
stepAnim = ANIM_EV_STEP;
else
stepAnim = NUM_ANIMS;
else if (animType == 2)
stepAnim = ANIM_HANDSCOWER;
}
if (!RpAnimBlendClumpGetAssociation(GetClump(), stepAnim)) {
CAnimBlendAssociation *stepAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, stepAnim, 8.0f);
@ -4506,7 +4504,7 @@ CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
angleToFace = m_fRotationCur;
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;
}
@ -8341,7 +8339,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
CPad::GetPad(0)->StartShake(40000 / shakeFreq, shakeFreq);
}
bIsStanding = false;
damageDir = CPed::GetLocalDirection(-m_vecMoveSpeed);
damageDir = GetLocalDirection(-m_vecMoveSpeed);
vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(car->GetModelIndex());
vehColModel = vehModel->GetColModel();
float carRightAndDistDotProd = DotProduct(distVec, car->GetRight());
@ -8477,7 +8475,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
pieceToDamage = PEDPIECE_MID;
break;
}
CPed::InflictDamage(car, killMethod, 1000.0f, pieceToDamage, damageDir);
InflictDamage(car, killMethod, 1000.0f, pieceToDamage, damageDir);
if (DyingOrDead()
&& bIsPedDieAnimPlaying && !m_pCollidingEntity) {
@ -8507,8 +8505,8 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
else
damage = 30.0f;
CPed::InflictDamage(car, WEAPONTYPE_RAMMEDBYCAR, damage, PEDPIECE_TORSO, fallDirection);
CPed::SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true);
InflictDamage(car, WEAPONTYPE_RAMMEDBYCAR, damage, PEDPIECE_TORSO, fallDirection);
SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true);
if (OnGround() && !m_pCollidingEntity &&
(!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
|| m_nPedStateTimer >= CTimer::GetTimeInMilliseconds()) {
CPed::SetDirectionToWalkAroundObject(collidingVeh);
SetDirectionToWalkAroundObject(collidingVeh);
CWorld::Players[CWorld::PlayerInFocus].m_nLastBumpPlayerCarTimer = m_nPedStateTimer;
} else if (m_fleeFrom != collidingVeh) {
@ -9906,7 +9904,7 @@ CPed::ProcessControl(void)
SetHeading(m_fRotationCur);
if (m_nPedState != PED_FALL && !bIsPedDieAnimPlaying) {
CPed::SetFall(1000, ANIM_KO_SKID_BACK, true);
SetFall(1000, ANIM_KO_SKID_BACK, true);
}
bIsInTheAir = false;
} else if (m_vecDamageNormal.z > 0.4f) {
@ -10217,19 +10215,19 @@ CPed::ProcessControl(void)
Flee();
break;
case PED_FOLLOW_PATH:
CPed::FollowPath();
FollowPath();
break;
case PED_PAUSE:
CPed::Pause();
Pause();
break;
case PED_ATTACK:
CPed::Attack();
Attack();
break;
case PED_FIGHT:
CPed::Fight();
Fight();
break;
case PED_CHAT:
CPed::Chat();
Chat();
break;
case PED_AIM_GUN:
if (m_pPointGunAt && m_pPointGunAt->IsPed()
@ -14606,11 +14604,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (!collidingEnt->IsBuilding())
((CPhysical*)collidingEnt)->AddCollisionRecord(this);
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->IsStatic())) {
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic())) {
bHasHitWall = true;
}
}
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
if (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic()) {
if (bWasStanding) {
CVector sphereNormal;
@ -15956,7 +15954,7 @@ CPed::SeekCar(void)
} else {
m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) {
vehToSeek->bIsStatic = false;
vehToSeek->SetIsStatic(false);
if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
SetSolicit(1000);
} 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 (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer())
CPed::SetEnterCar(vehToSeek, m_vehEnterType);
SetEnterCar(vehToSeek, m_vehEnterType);
} else {
SetCarJack(vehToSeek);
}
@ -16152,15 +16150,15 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
case HITLEVEL_LOW:
#ifndef VC_PED_PORTS
if (direction == 2) {
CPed::SetFall(1000, ANIM_KO_SKID_BACK, false);
SetFall(1000, ANIM_KO_SKID_BACK, false);
return;
}
#else
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;
} 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;
}
#endif
@ -16637,7 +16635,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction)
obj->m_fElasticity = 0.03f;
obj->m_fBuoyancy = m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SMALLBOX;
@ -17366,12 +17364,12 @@ CPed::SetExitBoat(CVehicle *boat)
CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f);
if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) {
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_nPedState = PED_EXIT_CAR;
} else {
m_vehEnterType = CAR_DOOR_RF;
CPed::PedSetOutCarCB(nil, this);
PedSetOutCarCB(nil, this);
bIsStanding = true;
m_pCurSurface = boat;
m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface);

View file

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

View file

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

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "Glass.h"
#include "Timer.h"
@ -138,7 +138,11 @@ CFallingGlassPane::Render(void)
fwdNorm.Normalise();
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) );

View file

@ -41,13 +41,13 @@ CRGBA ODDJOB_COLOR(89, 115, 150, 255);
CRGBA ODDJOB2_COLOR(156, 91, 40, 255);
CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255);
wchar CHud::m_HelpMessage[256];
wchar CHud::m_LastHelpMessage[256];
wchar CHud::m_HelpMessage[HELP_MSG_LENGTH];
wchar CHud::m_LastHelpMessage[HELP_MSG_LENGTH];
uint32 CHud::m_HelpMessageState;
uint32 CHud::m_HelpMessageTimer;
int32 CHud::m_HelpMessageFadeTimer;
wchar CHud::m_HelpMessageToPrint[256];
float CHud::m_fHelpMessageTime;
wchar CHud::m_HelpMessageToPrint[HELP_MSG_LENGTH];
float CHud::m_HelpMessageDisplayTime;
bool CHud::m_HelpMessageQuick;
uint32 CHud::m_ZoneState;
int32 CHud::m_ZoneFadeTimer;
@ -247,7 +247,7 @@ void CHud::Draw()
rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
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);
@ -336,7 +336,7 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
CFont::SetJustifyOff();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetPropOn();
CFont::SetFontStyle(FONT_BANK);
@ -740,7 +740,7 @@ void CHud::Draw()
CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
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::SetBackGroundOnlyTextOn();
@ -869,8 +869,8 @@ void CHud::Draw()
else
CFont::SetCentreOff();
CFont::SetWrapx(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fWrapX));
CFont::SetCentreSize(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fCenterSize));
CFont::SetWrapx(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fWrapX));
CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize));
if (CTheScripts::IntroTextLines[i].m_bBackground)
CFont::SetBackgroundOn();
@ -957,12 +957,12 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
CFont::SetPropOn();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(25.0f));
CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
CFont::SetFontStyle(FONT_HEADING);
// 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();
if (BigMessageInUse[0] >= 120.0f) {
@ -997,7 +997,7 @@ void CHud::Draw()
}
else {
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;
}
}
@ -1047,14 +1047,14 @@ void CHud::DrawAfterFade()
return;
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) {
case 0:
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, HELP_MSG_LENGTH);
m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
@ -1069,7 +1069,7 @@ void CHud::DrawAfterFade()
default:
break;
}
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, HELP_MSG_LENGTH);
}
float fAlpha = 225.0f;
@ -1079,7 +1079,7 @@ void CHud::DrawAfterFade()
case 1:
fAlpha = 225.0f;
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_HelpMessageState = 3;
}
@ -1105,7 +1105,7 @@ void CHud::DrawAfterFade()
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
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;
break;
@ -1166,8 +1166,8 @@ void CHud::DrawAfterFade()
else
CFont::SetCentreOff();
CFont::SetWrapx(SCALE_AND_CENTER_X(line.m_fWrapX));
CFont::SetCentreSize(SCALE_AND_CENTER_X(line.m_fCenterSize));
CFont::SetWrapx(SCREEN_SCALE_X(line.m_fWrapX));
CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize));
if (line.m_bBackground)
CFont::SetBackgroundOn();
else
@ -1213,7 +1213,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(40.0f));
CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
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::SetCentreOn();
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::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::SetCentreOn();
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::SetFontStyle(FONT_LOCALE(FONT_BANK));
@ -1371,7 +1371,7 @@ void CHud::GetRidOfAllHudMessages()
m_ZoneNameTimer = 0;
m_pZoneName = nil;
for (int i = 0; i < 256; i++) {
for (int i = 0; i < HELP_MSG_LENGTH; i++) {
m_HelpMessage[i] = 0;
m_LastHelpMessage[i] = 0;
m_HelpMessageToPrint[i] = 0;
@ -1381,7 +1381,7 @@ void CHud::GetRidOfAllHudMessages()
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 0;
m_HelpMessageQuick = 0;
m_fHelpMessageTime = 1.0f;
m_HelpMessageDisplayTime = 1.0f;
m_VehicleName = nil;
m_pLastVehicleName = nil;
m_pVehicleNameToPrint = nil;
@ -1389,7 +1389,7 @@ void CHud::GetRidOfAllHudMessages()
m_VehicleFadeTimer = 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;
for (int i = 0; i < 6; i++) {
@ -1464,7 +1464,7 @@ void CHud::ReInitialise() {
wchar LastBigMessage[6][128];
void CHud::SetBigMessage(wchar *message, int16 style)
void CHud::SetBigMessage(wchar *message, uint16 style)
{
int i = 0;
@ -1495,10 +1495,10 @@ void CHud::SetBigMessage(wchar *message, int16 style)
void CHud::SetHelpMessage(wchar *message, bool quick)
{
if (!CReplay::IsPlayingBack()) {
CMessages::WideStringCopy(m_HelpMessage, message, 256);
CMessages::WideStringCopy(m_HelpMessage, message, HELP_MSG_LENGTH);
CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
for (int i = 0; i < 256; i++) {
for (int i = 0; i < HELP_MSG_LENGTH; i++) {
m_LastHelpMessage[i] = 0;
}
@ -1510,7 +1510,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
void CHud::SetMessage(wchar *message)
{
int i = 0;
for (i = 0; i < 256; i++) {
for (i = 0; i < ARRAY_SIZE(m_Message); i++) {
if (message[i] == 0)
break;
@ -1522,7 +1522,7 @@ void CHud::SetMessage(wchar *message)
void CHud::SetPagerMessage(wchar *message)
{
int i = 0;
for (i = 0; i < 256; i++) {
for (i = 0; i < ARRAY_SIZE(m_PagerMessage); i++) {
if (message[i] == 0)
break;

View file

@ -1,6 +1,8 @@
#pragma once
#include "Sprite2d.h"
#define HELP_MSG_LENGTH 256
enum eItems
{
ITEM_NONE = -1,
@ -36,14 +38,13 @@ class CHud
{
public:
static CSprite2d Sprites[NUM_HUD_SPRITES];
static wchar m_HelpMessage[256];
static wchar m_LastHelpMessage[256];
static wchar m_HelpMessage[HELP_MSG_LENGTH];
static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
static uint32 m_HelpMessageState;
static uint32 m_HelpMessageTimer;
static int32 m_HelpMessageFadeTimer;
static wchar m_HelpMessageToPrint[256];
static float &m_HelpMessageDisplayTime;
static float m_fHelpMessageTime;
static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
static float m_HelpMessageDisplayTime;
static bool m_HelpMessageQuick;
static uint32 m_ZoneState;
static int32 m_ZoneFadeTimer;
@ -88,7 +89,7 @@ public:
static void GetRidOfAllHudMessages();
static void Initialise();
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 SetMessage(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));
m_SinTable[i] = Sin(angle);
m_CosTable[i] = Cos(angle);
m_SinTable[i] = ::Sin(angle);
m_CosTable[i] = ::Cos(angle);
}
int32 slot = CTxdStore::FindTxdSlot("particle");

View file

@ -53,6 +53,14 @@ CVehicle *CRenderer::m_pFirstPersonVehicle;
bool CRenderer::m_loadingPriority;
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
CRenderer::Init(void)
{
@ -101,6 +109,13 @@ CRenderer::RenderOneRoad(CEntity *e)
else{
#ifdef EXTENDED_PIPELINES
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
e->Render();
}
@ -163,13 +178,22 @@ CRenderer::RenderOneNonRoad(CEntity *e)
for(i = 0; i < 8; i++)
if(veh->pPassengers[i] && veh->pPassengers[i]->m_nPedState == PED_DRIVING)
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();
if(e->IsVehicle()){
e->bImBeingRendered = true;
CVisibilityPlugins::RenderAlphaAtomics();
e->bImBeingRendered = false;
BACKFACE_CULLING_ON;
}
e->RemoveLighting(resetLights);
@ -197,6 +221,7 @@ CRenderer::RenderRoads(void)
CTreadable *t;
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
BACKFACE_CULLING_ON;
DeActivateDirectional();
SetAmbientColours();
@ -230,6 +255,7 @@ CRenderer::RenderEverythingBarRoads(void)
CVector dist;
EntityInfo ei;
BACKFACE_CULLING_ON;
gSortedVehiclesAndPeds.Clear();
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
@ -284,6 +310,8 @@ CRenderer::RenderBoats(void)
{
CLink<EntityInfo> *node;
BACKFACE_CULLING_ON;
for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head;
node = node->prev){
@ -298,6 +326,7 @@ void
CRenderer::RenderFadingInEntities(void)
{
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
BACKFACE_CULLING_ON;
DeActivateDirectional();
SetAmbientColours();
CVisibilityPlugins::RenderFadingEntities();
@ -1208,7 +1237,7 @@ CRenderer::IsEntityCullZoneVisible(CEntity *ent)
return !(ped->m_pCurSurface && ped->m_pCurSurface->bZoneCulled2);
case ENTITY_TYPE_OBJECT:
obj = (CObject*)ent;
if(!obj->IsStatic())
if(!obj->GetIsStatic())
return true;
return !(obj->m_pCurSurface && obj->m_pCurSurface->bZoneCulled2);
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::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity));
CFont::SetBackGroundOnlyTextOff();

View file

@ -64,7 +64,7 @@ void CWaterCannon::Update_OncePerFrame(int16 index)
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;
}
@ -124,7 +124,7 @@ void CWaterCannon::Render(void)
RwIm3DVertexSetV(&WaterCannonVertices[2], v);
RwIm3DVertexSetV(&WaterCannonVertices[3], v);
int16 pointA = m_nCur % -NUM_SEGMENTPOINTS;
int16 pointA = m_nCur % NUM_SEGMENTPOINTS;
int16 pointB = pointA - 1;
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.z = 0.0f;
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_splashes = (int)(3 * Rain) + 4;

View file

@ -3,11 +3,14 @@
#endif
#include "common.h"
#include "RwHelper.h"
#include "Timecycle.h"
#include "skeleton.h"
#include "Debug.h"
#ifndef FINAL
#if !defined(FINAL) || defined(DEBUGMENU)
#include "rtcharse.h"
#endif
#ifndef FINAL
RtCharset *debugCharset;
#endif
@ -16,8 +19,9 @@ bool gPS2alphaTest = true;
#else
bool gPS2alphaTest = false;
#endif
bool gBackfaceCulling = true;
#ifndef FINAL
#if !defined(FINAL) || defined(DEBUGMENU)
static bool charsetOpen;
void OpenCharsetSafe()
{
@ -121,14 +125,32 @@ DefinedState(void)
#ifdef LIBRW
rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
rw::SetRenderState(rw::ALPHATESTREF, 3);
rw::SetRenderState(rw::GSALPHATEST, gPS2alphaTest);
#else
// D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
RwD3D8SetRenderState(D3DRS_ALPHAREF, 2);
#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*
@ -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 *zRaster;
// BUG: game just changes camera raster's sizes, but this is a hack
#ifdef FIX_BUGS
/*
* Destroy rasters...
*/
@ -444,12 +468,14 @@ CameraSize(RwCamera * camera, RwRect * rect,
if( raster )
{
RwRasterDestroy(raster);
camera->frameBuffer = nil;
}
zRaster = RwCameraGetZRaster(camera);
if( zRaster )
{
RwRasterDestroy(zRaster);
camera->zBuffer = nil;
}
/*
@ -493,6 +519,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
RwCameraSetRaster(camera, raster);
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 */
@ -648,4 +681,4 @@ RestoreAlphaTest()
RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef);
#endif
}
#endif
#endif

View file

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

View file

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

View file

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

View file

@ -418,7 +418,7 @@ psInitialize(void)
}
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");
_dwOperatingSystemVersion = OS_WIN98;
@ -847,7 +847,8 @@ bool IsThisJoystickBlacklisted(int 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 true;
@ -1219,14 +1220,17 @@ void resizeCB(GLFWwindow* window, int width, int height) {
* memory things don't work.
*/
/* redraw window */
if (RwInitialised && (gGameState == GS_PLAYING_GAME
#ifndef MASTER
|| gGameState == GS_ANIMVIEWER
#endif
))
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
if (RwInitialised && height > 0 && width > 0) {
RwRect r;

View file

@ -684,7 +684,7 @@ psInitialize(void)
}
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");
_dwOperatingSystemVersion = OS_WIN98;
@ -1012,11 +1012,17 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
RECT rect;
/* redraw window */
#ifndef MASTER
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
{
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
}
#else
if (RwInitialised && gGameState == GS_PLAYING_GAME)
{
RsEventHandler(rsIDLE, (void *)TRUE);
}
#endif
/* Manually resize window */
rect.left = rect.top = 0;
rect.bottom = newPos->bottom - newPos->top;
@ -1369,14 +1375,20 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
#endif
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;
}
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
refreshRate = mode.RefreshRate;
}
}
// From VC
#ifdef FIX_BUGS
d3d->Release();
#endif

View file

@ -69,10 +69,7 @@ CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
if (len1 != len2 && (len1 < size || len2 < size))
return false;
for (int32 i = 0; i < size; i++) {
if (FixupChar(str1[i]) == '\0')
break;
for (int32 i = 0; i < size && FixupChar(str1[i]) != '\0'; i++) {
if (FixupChar(str1[i]) != FixupChar(str2[i]))
return false;
}
@ -100,13 +97,9 @@ CMessages::Process()
if (BriefMessages[0].m_pText != nil && CTimer::GetTimeInMilliseconds() > BriefMessages[0].m_nTime + BriefMessages[0].m_nStartTime) {
BriefMessages[0].m_pText = nil;
int32 i = 0;
while (i < NUMBRIEFMESSAGES-1) {
if (BriefMessages[i + 1].m_pText == nil)
break;
int32 i;
for (i = 0; i < NUMBRIEFMESSAGES-1 && BriefMessages[i + 1].m_pText != nil; i++) {
BriefMessages[i] = BriefMessages[i + 1];
i++;
}
CMessages::BriefMessages[i].m_pText = nil;
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)
{
int32 i = 0;
while (i < NUMPREVIOUSBRIEFS) {
if (PreviousBriefs[i].m_pText == nil)
break;
for (i = 0; i < NUMPREVIOUSBRIEFS && PreviousBriefs[i].m_pText != nil; i++) {
if (PreviousBriefs[i].m_nNumber[0] == n1
&& PreviousBriefs[i].m_nNumber[1] == n2
&& 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_pString == string)
return;
i++;
}
if (i != 0) {
@ -374,6 +363,14 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
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 i = 0;
@ -385,22 +382,20 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
#else
if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
#endif
c += 3;
for (int j = 0; j < outLen; )
*(outstr++) = wNumStr[j++];
i++;
switch (i) {
case 0: sprintf(numStr, "%d", n1); break;
case 1: sprintf(numStr, "%d", n2); break;
case 2: sprintf(numStr, "%d", n3); break;
case 3: sprintf(numStr, "%d", n4); break;
case 4: sprintf(numStr, "%d", n5); break;
case 5: sprintf(numStr, "%d", n6); break;
}
i++;
outLen = strlen(numStr);
AsciiToUnicode(numStr, wNumStr);
int j = 0;
while (wNumStr[j] != '\0')
*(outstr++) = wNumStr[j++];
c += 3;
} else {
*(outstr++) = str[c++];
}
@ -466,10 +461,12 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
#endif
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]);
if (contSize != 0) {
if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {
done = true;
ControlsManager.GetWideStringOfCommandKeys(cont, keybuf, 256);
uint16 keybuf_size = GetWideStringLength(keybuf);
for (uint16 j = 0; j < keybuf_size; j++) {
@ -502,7 +499,7 @@ CMessages::AddMessageWithNumber(wchar *str, uint32 time, uint16 flag, int32 n1,
GetWideStringLength(outstr);
uint16 i = 0;
while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText)
while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil)
i++;
if (i >= NUMBRIEFMESSAGES) return;
@ -719,39 +716,28 @@ CMessages::ClearThisPrint(wchar *str)
do {
equal = false;
uint16 i = 0;
while (i < NUMBRIEFMESSAGES) {
if (BriefMessages[i].m_pText == nil)
break;
uint16 i;
for (i = 0; i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil; i++) {
equal = FastWideStringComparison(str, BriefMessages[i].m_pText);
if (equal) break;
i++;
}
if (equal) {
if (i != 0) {
BriefMessages[i].m_pText = nil;
while (i < NUMBRIEFMESSAGES-1) {
if (BriefMessages[i + 1].m_pText == nil)
break;
for (; i < NUMBRIEFMESSAGES-1 && BriefMessages[i+1].m_pText != nil; i++) {
BriefMessages[i] = BriefMessages[i + 1];
i++;
}
BriefMessages[i].m_pText = nil;
} else {
BriefMessages[0].m_pText = nil;
while (i < NUMBRIEFMESSAGES-1) {
if (BriefMessages[i + 1].m_pText == nil)
break;
for (; i < NUMBRIEFMESSAGES-1 && BriefMessages[i+1].m_pText != nil; i++) {
BriefMessages[i] = BriefMessages[i + 1];
i++;
}
BriefMessages[i].m_pText = nil;
BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
if (BriefMessages[0].m_pText == nil)
if (BriefMessages[0].m_pText != nil)
AddToPreviousBriefArray(
BriefMessages[0].m_pText,
BriefMessages[0].m_nNumber[0],
@ -801,7 +787,7 @@ CMessages::ClearThisBigPrint(wchar *str)
}
BIGMessages[style].m_Stack[i].m_pText = nil;
} else {
BIGMessages[style].m_Stack[0].m_pText = 0;
BIGMessages[style].m_Stack[0].m_pText = nil;
i = 0;
while (i < 3) {
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 "General.h"
@ -2192,8 +2192,8 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
}
// move body cast
if(phys->IsStatic()){
phys->bIsStatic = false;
if(phys->GetIsStatic()){
phys->SetIsStatic(false);
phys->m_nStaticFrames = 0;
phys->ApplyMoveForce(m_vecMoveSpeed / Sqrt(speed));
phys->AddToMovingList();
@ -3746,7 +3746,6 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_ROLLDOOR_LOW:
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
break;
break;
case ANIM_CAR_GETOUT_LHS:
case ANIM_CAR_GETOUT_LOW_LHS:
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_LOW_RHS:
OpenDoor(component, door, 1.0f);
break;
case ANIM_COACH_OPEN_L:
case ANIM_COACH_OPEN_R:
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_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
obj->bUseVehicleColours = true;
obj->m_colour1 = m_currentColour1;

View file

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

View file

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

View file

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

View file

@ -185,11 +185,11 @@ void CBulletInfo::Update(void)
if (pHitEntity->IsObject()) {
CObject* pObject = (CObject*)pHitEntity;
if (!pObject->bInfiniteMass) {
if (pObject->IsStatic() && pObject->m_fUprootLimit <= 0.0f) {
pObject->bIsStatic = false;
if (pObject->GetIsStatic() && pObject->m_fUprootLimit <= 0.0f) {
pObject->SetIsStatic(false);
pObject->AddToMovingList();
}
if (!pObject->IsStatic())
if (!pObject->GetIsStatic())
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 *source = fireSource;
if (!fireSource) {
if (!fireSource)
{
fireOffset = shooter->GetMatrix() * fireOffset;
#ifdef FIX_BUGS
static CVector tmp;
tmp = shooter->GetMatrix() * fireOffset;
tmp = fireOffset;
source = &tmp;
#else
source = &fireOffset;
#endif
}
if ( m_bAddRotOffset )
{
@ -1057,13 +1064,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
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();
}
if ( !victimObject->IsStatic())
if ( !victimObject->GetIsStatic())
{
CVector moveForce = point->normal*-4.0f;
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);
CVector2D shootRot(-Sin(shootAngle), Cos(shootAngle));
shootRot.Normalise();
CVector source, target;
CColPoint point;
@ -1316,13 +1324,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
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();
}
if ( !victimObject->IsStatic())
if ( !victimObject->GetIsStatic())
{
CVector moveForce = point.normal*-5.0f;
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.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
if ( object->IsStatic())
if ( object->GetIsStatic())
{
object->bIsStatic = false;
object->SetIsStatic(false);
object->AddToMovingList();
}
}

View file

@ -8022,6 +8022,45 @@ REPLAY MISSION
[FESZ_RM]
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 }
[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