diff options
86 files changed, 1488 insertions, 971 deletions
diff --git a/.github/workflows/reVC_msvc_amd64.yml b/.github/workflows/reLCS_msvc_amd64.yml index 2053a770..012051a9 100644 --- a/.github/workflows/reVC_msvc_amd64.yml +++ b/.github/workflows/reLCS_msvc_amd64.yml @@ -1,4 +1,4 @@ -name: reVC_msvc_amd64 +name: reLCS_msvc_amd64 on: pull_request: @@ -47,19 +47,19 @@ jobs: ./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir64=${{env.GLFW_BASE}} - name: Build run: | - msbuild -m build/reVC.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} + msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} - name: Pack artifacts run: | - 7z a reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* + 7z a reLCS_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* - name: Upload artifact to actions uses: actions/upload-artifact@v2 with: - name: reVC_${{matrix.buildtype}}_${{matrix.platform}} + name: reLCS_${{matrix.buildtype}}_${{matrix.platform}} path: ./bin/${{matrix.platform}}/${{matrix.buildtype}} # - name: Upload artifact to Bintray # uses: hpcsc/upload-bintray-docker-action@v1 # with: -# repository: reVC +# repository: reLCS # package: ${{matrix.buildtype}}_${{matrix.platform}} # version: 1.0-$(echo ${GITHUB_SHA} # sourcePath: ./bin/${{matrix.platform}}/${{matrix.buildtype}} diff --git a/.github/workflows/reVC_msvc_x86.yml b/.github/workflows/reLCS_msvc_x86.yml index 99079608..bffd545f 100644 --- a/.github/workflows/reVC_msvc_x86.yml +++ b/.github/workflows/reLCS_msvc_x86.yml @@ -1,4 +1,4 @@ -name: reVC_msvc_x86 +name: reLCS_msvc_x86 on: pull_request: @@ -47,19 +47,19 @@ jobs: ./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir32=${{env.GLFW_BASE}} - name: Build run: | - msbuild -m build/reVC.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} + msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} - name: Pack artifacts run: | - 7z a reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* + 7z a reLCS_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* - name: Upload artifact to actions uses: actions/upload-artifact@v2 with: - name: reVC_${{matrix.buildtype}}_${{matrix.platform}} - path: reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip + name: reLCS_${{matrix.buildtype}}_${{matrix.platform}} + path: reLCS_${{matrix.buildtype}}_${{matrix.platform}}.zip # - name: Upload artifact to Bintray # uses: hpcsc/upload-bintray-docker-action@v1 # with: -# repository: reVC +# repository: reLCS # package: ${{matrix.buildtype}}_${{matrix.platform}} # version: 1.0-$(echo ${GITHUB_SHA} # sourcePath: ./bin/${{matrix.platform}}/${{matrix.buildtype}} @@ -1,21 +1,21 @@ -# reVC -[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmiami&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=miami) +# reLCS +[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dlcs&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=lcs) <a href="https://discord.gg/aKYAwCx92H"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a> ## Intro -The aim of this project is to reverse GTA Vice City for PC. +The aim of this project is to reverse GTA Liberty City Stories. ## How can I try it? -- reVC requires game assets to work, so you **must** own [a copy of GTA Vice City](https://store.steampowered.com/app/12110/Grand_Theft_Auto_Vice_City/). -- Build reVC or download it from one of the above links (Debug or Release). +- reLCS requires game assets to work. +- Build reLCS or download it from one of the above links (Debug or Release). - (Optional) If you want to use optional features, copy the files in /gamefiles folder to your game root folder. -- Move reVC.exe to GTA VC directory and run it. +- Move reLCS.exe to GTA LCS directory and run it. ## Preparing the environment for building -You may want to point GTA_VC_RE_DIR environment variable to GTA VC root folder if you want executable to be moved there via post-build script. +You may want to point GTA_LCS_RE_DIR environment variable to GTA LCS root folder if you want executable to be moved there via post-build script. - For Linux, proceed: [Building on Linux](https://github.com/GTAmodding/re3/wiki/Building-on-Linux) - For FreeBSD, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD) @@ -26,11 +26,11 @@ You may want to point GTA_VC_RE_DIR environment variable to GTA VC root folder i **If you use 64-bit D3D9**: We don't ship 64-bit Dx9 SDK. You need to download it from Microsoft if you don't have it(although it should come pre-installed after some Windows version) -There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/miami/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across. +There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/lcs/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across. > :information_source: **If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows). -> :information_source: **Did you notice librw?** reVC uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of reVC, but you also can use LIBRW enviorenment variable to specify path to your own librw. +> :information_source: **Did you notice librw?** reLCS uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of reLCS, but you also can use LIBRW enviorenment variable to specify path to your own librw. ## Contributing Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt Binary files differindex eaeab8bb..767454de 100644 --- a/gamefiles/TEXT/american.gxt +++ b/gamefiles/TEXT/american.gxt diff --git a/premake5.lua b/premake5.lua index 9796b8a9..7634ccdf 100644 --- a/premake5.lua +++ b/premake5.lua @@ -58,7 +58,7 @@ function getarch(a) return a end -workspace "reVC" +workspace "reLCS" language "C++" configurations { "Debug", "Release" } location "build" @@ -221,9 +221,9 @@ local function addSrcFiles( prefix ) return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" end -project "reVC" +project "reLCS" kind "WindowedApp" - targetname "reVC" + targetname "reLCS" targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" defines { "MIAMI" } @@ -237,6 +237,7 @@ project "reVC" files { addSrcFiles("src/control") } files { addSrcFiles("src/core") } files { addSrcFiles("src/entities") } + files { addSrcFiles("src/leeds/base") } files { addSrcFiles("src/math") } files { addSrcFiles("src/modelinfo") } files { addSrcFiles("src/objects") } @@ -261,6 +262,7 @@ project "reVC" includedirs { "src/control" } includedirs { "src/core" } includedirs { "src/entities" } + includedirs { "src/leeds/base" } includedirs { "src/math" } includedirs { "src/modelinfo" } includedirs { "src/objects" } @@ -299,8 +301,8 @@ project "reVC" defines { "AUDIO_OAL" } filter {} - if(os.getenv("GTA_VC_RE_DIR")) then - setpaths("$(GTA_VC_RE_DIR)/", "%(cfg.buildtarget.name)", "") + if(os.getenv("GTA_LCS_RE_DIR")) then + setpaths("$(GTA_LCS_RE_DIR)/", "%(cfg.buildtarget.name)", "") end filter "platforms:win*" diff --git a/src/animation/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp index b312236b..003385da 100644 --- a/src/animation/CutsceneMgr.cpp +++ b/src/animation/CutsceneMgr.cpp @@ -633,8 +633,8 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver() CStreaming::RemoveCurrentZonesModels(); CStreaming::SetModelIsDeletable(MI_MALE01); CStreaming::SetModelTxdIsDeletable(MI_MALE01); - CStreaming::SetModelIsDeletable(MI_HMOCA); - CStreaming::SetModelTxdIsDeletable(MI_HMOCA); + CStreaming::SetModelIsDeletable(MI_TAXI_D); + CStreaming::SetModelTxdIsDeletable(MI_TAXI_D); CStreaming::SetModelIsDeletable(MI_NIGHTSTICK); CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK); CStreaming::SetModelIsDeletable(MI_MISSILE); diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index c5aa170c..250cd18e 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -219,7 +219,9 @@ static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1, SFX_TYRE_BUMP, SFX_COL_CARDBOARD_1, SFX_COL_TARMAC_1, - SFX_COL_GATE}; + SFX_COL_GATE, + SFX_COL_SAND_1, + SFX_COL_TARMAC_1 }; void cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 01b33fa5..53483ae1 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -5296,6 +5296,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) case MI_MEDIC: return GetMedicTalkSfx(ped, sound); case MI_FIREMAN: return GetFiremanTalkSfx(ped, sound); case MI_MALE01: return GetDefaultTalkSfx(ped, sound); +/* LCS: removed for now case MI_HFYST: return GetHFYSTTalkSfx(ped, sound); case MI_HFOST: return GetHFOSTTalkSfx(ped, sound); case MI_HMYST: return GetHMYSTTalkSfx(ped, sound); @@ -5384,6 +5385,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) case MI_BKB: return GetBKTalkSfx(ped, sound); case MI_PGA: case MI_PGB: return GetPGTalkSfx(ped, sound); +*/ case MI_VICE1: case MI_VICE2: case MI_VICE3: @@ -7567,7 +7569,8 @@ cAudioManager::GetSGTalkSfx(CPed *ped, int16 sound) case SOUND_PED_CHAT: GetPhrase(sfx, ped->m_lastComment, 1064, 12); break; default: return GetGenericMaleTalkSfx(ped, sound); } - if(ped->GetModelIndex() == MI_SGB) sfx += 93; +// LCS removed for now +// if(ped->GetModelIndex() == MI_SGB) sfx += 93; return sfx; } diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index acfe09c3..098b2fc3 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -1295,7 +1295,7 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh) bool cMusicManager::UsesTaxiRadio(CVehicle *veh) { - if (veh->GetModelIndex() != MI_KAUFMAN) return false; + if (veh->GetModelIndex() != MI_CABBIE) return false; return CTheScripts::bPlayerHasMetDebbieHarry; } diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index 30fcbde0..07dfb890 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -546,8 +546,7 @@ cAudioManager::SetupSuspectLastSeenReport() break; case MI_TAXI: case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: + case MI_BORGNINE: sample = SFX_POLICE_RADIO_TAXI; break; case MI_BOBCAT: diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp index cdf063fa..81a78381 100644 --- a/src/audio/oal/stream.cpp +++ b/src/audio/oal/stream.cpp @@ -4,20 +4,23 @@ #include "stream.h" #include "sampman.h" -#ifdef AUDIO_OPUS -#include <opusfile.h> -#else #ifdef _WIN32 #ifdef AUDIO_OAL_USE_SNDFILE #pragma comment( lib, "libsndfile-1.lib" ) #endif +#ifdef AUDIO_OAL_USE_MPG123 #pragma comment( lib, "libmpg123-0.lib" ) #endif +#endif #ifdef AUDIO_OAL_USE_SNDFILE #include <sndfile.h> #endif +#ifdef AUDIO_OAL_USE_MPG123 #include <mpg123.h> #endif +#ifdef AUDIO_OAL_USE_OPUS +#include <opusfile.h> +#endif #ifndef _WIN32 #include "crossplatform.h" @@ -81,7 +84,6 @@ public: CSortStereoBuffer SortStereoBuffer; -#ifndef AUDIO_OPUS class CImaADPCMDecoder { const uint16 StepTable[89] = { @@ -461,11 +463,9 @@ public: }; #endif -#ifdef _WIN32 +#ifdef AUDIO_OAL_USE_MPG123 // fuzzy seek eliminates stutter when playing ADF but spams errors a lot (nothing breaks though) #define MP3_USE_FUZZY_SEEK -#endif // _WIN32 - class CMP3File : public IDecoder { @@ -491,7 +491,7 @@ public: if ( m_pMH ) { #ifdef MP3_USE_FUZZY_SEEK - mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS, 0.0); + mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS | MPG123_QUIET, 0.0); #endif long rate = 0; int channels = 0; @@ -574,6 +574,55 @@ public: } }; +class CADFFile : public CMP3File +{ + static ssize_t r_read(void* fh, void* buf, size_t size) + { + size_t bytesRead = fread(buf, 1, size, (FILE*)fh); + uint8* _buf = (uint8*)buf; + for (size_t i = 0; i < size; i++) + _buf[i] ^= 0x22; + return bytesRead; + } + static off_t r_seek(void* fh, off_t pos, int seekType) + { + fseek((FILE*)fh, pos, seekType); + return ftell((FILE*)fh); + } + static void r_close(void* fh) + { + fclose((FILE*)fh); + } +public: + CADFFile(const char* path) + { + m_pMH = mpg123_new(nil, nil); + if (m_pMH) + { +#ifdef MP3_USE_FUZZY_SEEK + mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS | MPG123_QUIET, 0.0); +#endif + long rate = 0; + int channels = 0; + int encoding = 0; + + FILE* f = fopen(path, "rb"); + + m_bOpened = mpg123_replace_reader_handle(m_pMH, r_read, r_seek, r_close) == MPG123_OK + && mpg123_open_handle(m_pMH, f) == MPG123_OK && mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK; + m_nRate = rate; + m_nChannels = channels; + + if (IsOpened()) + { + mpg123_format_none(m_pMH); + mpg123_format(m_pMH, rate, channels, encoding); + } + } + } +}; + +#endif #define VAG_LINE_SIZE (0x10) #define VAG_SAMPLES_IN_LINE (28) @@ -811,7 +860,7 @@ public: return bufSizePerChannel * m_nChannels; } }; -#else +#ifdef AUDIO_OAL_USE_OPUS class COpusFile : public IDecoder { OggOpusFile *m_FileH; @@ -907,64 +956,16 @@ public: }; #endif -class CADFFile : public CMP3File -{ - static ssize_t r_read(void* fh, void* buf, size_t size) - { - size_t bytesRead = fread(buf, 1, size, (FILE*)fh); - uint8* _buf = (uint8*)buf; - for (size_t i = 0; i < size; i++) - _buf[i] ^= 0x22; - return bytesRead; - } - static off_t r_seek(void* fh, off_t pos, int seekType) - { - fseek((FILE*)fh, pos, seekType); - return ftell((FILE*)fh); - } - static void r_close(void* fh) - { - fclose((FILE*)fh); - } -public: - CADFFile(const char* path) - { - m_pMH = mpg123_new(nil, nil); - if (m_pMH) - { -#ifdef MP3_USE_FUZZY_SEEK - mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS, 0.0); -#endif - long rate = 0; - int channels = 0; - int encoding = 0; - - FILE* f = fopen(path, "rb"); - - m_bOpened = mpg123_replace_reader_handle(m_pMH, r_read, r_seek, r_close) == MPG123_OK - && mpg123_open_handle(m_pMH, f) == MPG123_OK && mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK; - m_nRate = rate; - m_nChannels = channels; - - if (IsOpened()) - { - mpg123_format_none(m_pMH); - mpg123_format(m_pMH, rate, channels, encoding); - } - } - } -}; - void CStream::Initialise() { -#ifndef AUDIO_OPUS +#ifdef AUDIO_OAL_USE_MPG123 mpg123_init(); #endif } void CStream::Terminate() { -#ifndef AUDIO_OPUS +#ifdef AUDIO_OAL_USE_MPG123 mpg123_exit(); #endif } @@ -997,21 +998,22 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU DEV("Stream %s\n", m_aFilename); -#ifndef AUDIO_OPUS - if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".mp3")], ".mp3")) - m_pSoundFile = new CMP3File(m_aFilename); - else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".wav")], ".wav")) + if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".wav")], ".wav")) #ifdef AUDIO_OAL_USE_SNDFILE m_pSoundFile = new CSndFile(m_aFilename); #else m_pSoundFile = new CWavFile(m_aFilename); #endif +#ifdef AUDIO_OAL_USE_MPG123 + else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".mp3")], ".mp3")) + m_pSoundFile = new CMP3File(m_aFilename); else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".adf")], ".adf")) m_pSoundFile = new CADFFile(m_aFilename); +#endif else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".vb")], ".VB")) m_pSoundFile = new CVbFile(m_aFilename, overrideSampleRate); -#else - if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".opus")], ".opus")) +#ifdef AUDIO_OAL_USE_OPUS + else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".opus")], ".opus")) m_pSoundFile = new COpusFile(m_aFilename); #endif else diff --git a/src/audio/sampman.h b/src/audio/sampman.h index d3e4415f..2db29244 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -240,7 +240,7 @@ public: extern cSampleManager SampleManager; extern uint32 BankStartOffset[MAX_SFX_BANKS]; -#ifdef AUDIO_OPUS +#if defined(OPUS_AUDIO_PATHS) static char StreamedNameTable[][25] = { "AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS", "AUDIO\\MSX.OPUS", "AUDIO\\FLASH.OPUS", "AUDIO\\CHAT.OPUS", "AUDIO\\HEAD.OPUS", "AUDIO\\POLICE.OPUS", "AUDIO\\CITY.OPUS", @@ -275,8 +275,7 @@ static char StreamedNameTable[][25] = { "AUDIO\\h5_b.OPUS", "AUDIO\\h5_c.OPUS", "AUDIO\\ammu_a.OPUS", "AUDIO\\ammu_b.OPUS", "AUDIO\\ammu_c.OPUS", "AUDIO\\door_1.OPUS", "AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS", "AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"}; -#else -#ifdef PS2_AUDIO +#elif defined(PS2_AUDIO_PATHS) static char StreamedNameTable[][40] = { "AUDIO\\MUSIC\\WILD.VB", @@ -1610,5 +1609,4 @@ static char StreamedNameTable[][25] = "AUDIO\\BUST_26.WAV", "AUDIO\\BUST_27.WAV", "AUDIO\\BUST_28.WAV", -}; -#endif
\ No newline at end of file +};
\ No newline at end of file diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 0d82d552..ce6458e6 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -30,7 +30,7 @@ #include "MusicManager.h" #include "Frontend.h" #include "Timer.h" -#ifdef AUDIO_OPUS +#ifdef AUDIO_OAL_USE_OPUS #include <opusfile.h> #endif @@ -83,7 +83,7 @@ char SampleBankDescFilename[] = "audio/sfx.SDT"; char SampleBankDataFilename[] = "audio/sfx.RAW"; FILE *fpSampleDescHandle; -#ifdef AUDIO_OPUS +#ifdef OPUS_SFX OggOpusFile *fpSampleDataHandle; #else FILE *fpSampleDataHandle; @@ -1245,7 +1245,7 @@ cSampleManager::LoadSampleBank(uint8 nBank) return false; } -#ifdef AUDIO_OPUS +#ifdef OPUS_SFX int samplesRead = 0; int samplesSize = nSampleBankSize[nBank] / 2; op_pcm_seek(fpSampleDataHandle, 0); @@ -1350,7 +1350,7 @@ cSampleManager::LoadPedComment(uint32 nComment) } } -#ifdef AUDIO_OPUS +#ifdef OPUS_SFX int samplesRead = 0; int samplesSize = m_aSamples[nComment].nSize / 2; op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2); @@ -2007,7 +2007,7 @@ cSampleManager::InitialiseSampleBanks(void) fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb"); if ( fpSampleDescHandle == NULL ) return false; -#ifndef AUDIO_OPUS +#ifndef OPUS_SFX fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb"); if ( fpSampleDataHandle == NULL ) { @@ -2025,7 +2025,7 @@ cSampleManager::InitialiseSampleBanks(void) fpSampleDataHandle = op_open_file(SampleBankDataFilename, &e); #endif fread(m_aSamples, sizeof(tSample), TOTAL_AUDIO_SAMPLES, fpSampleDescHandle); -#ifdef AUDIO_OPUS +#ifdef OPUS_SFX int32 _nSampleDataEndOffset = m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nOffset + m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nSize; #endif fclose(fpSampleDescHandle); diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index e7f7d525..2eea9645 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -420,7 +420,7 @@ CGameLogic::SetUpShortCut(CVector vStartPos, float fStartAngle, CVector vEndPos, ShortCutStartOrientation = fStartAngle; ShortCutDestination = vEndPos; ShortCutDestinationOrientation = fEndAngle; - CStreaming::RequestModel(MI_KAUFMAN, 0); + CStreaming::RequestModel(MI_CABBIE, 0); } void @@ -452,11 +452,11 @@ CGameLogic::UpdateShortCut() { switch (ShortCutState) { case SHORTCUT_INIT: - if (!CStreaming::HasModelLoaded(MI_KAUFMAN)) { - CStreaming::RequestModel(MI_KAUFMAN, 0); + if (!CStreaming::HasModelLoaded(MI_CABBIE)) { + CStreaming::RequestModel(MI_CABBIE, 0); return; } - pShortCutTaxi = new CAutomobile(MI_KAUFMAN, RANDOM_VEHICLE); + pShortCutTaxi = new CAutomobile(MI_CABBIE, RANDOM_VEHICLE); if (!pShortCutTaxi) return; pShortCutTaxi->SetPosition(ShortCutStart); diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 72053f8d..89377db5 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1414,11 +1414,7 @@ void CGarages::PrintMessages() CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); -#if defined(GTA_PS2) || defined (FIX_BUGS) - float y_offset = SCREEN_HEIGHT / 3 - SCREEN_SCALE_Y(40.0f); // THIS is PS2 calculation -#else - float y_offset = SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(84.0f); // This is PC and results in text being written over some HUD elements -#endif + float y_offset = SCREEN_SCALE_Y(140.0f); if (MessageNumberInString2 >= 0) { CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, MessageNumberInString2, -1, -1, -1, -1, gUString); diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index cc80360d..d25f146f 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -286,6 +286,7 @@ CPhoneInfo::Initialise(void) CBuilding *building = pool->GetSlot(i); if (building) { if (building->GetModelIndex() == MI_PHONEBOOTH1) { + assert(m_nMax < ARRAY_SIZE(m_aPhones) && "NUMPHONES should be increased"); CPhone *maxPhone = &m_aPhones[m_nMax]; maxPhone->m_nState = PHONE_STATE_FREE; maxPhone->m_vecPos = building->GetPosition(); diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index bd0fa989..3470e475 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1336,7 +1336,7 @@ CPickups::RenderPickUpText() #ifdef FIX_BUGS const float MAX_SCALE = SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH; #else - const float MAX_SCALE = RsGlobal.width / DEFAULT_SCREEN_WIDTH; + float MAX_SCALE = RsGlobal.width / DEFAULT_SCREEN_WIDTH; #endif float fScaleY = aMessages[i].m_dist.y / 30.0f; @@ -1345,11 +1345,7 @@ CPickups::RenderPickUpText() float fScaleX = aMessages[i].m_dist.x / 30.0f; if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE; -#ifdef FIX_BUGS - CFont::SetScale(SCREEN_SCALE_X(fScaleX), SCREEN_SCALE_Y(fScaleY)); -#else - CFont::SetScale(fScaleX, fScaleY); -#endif + CFont::SetScale(fScaleX, fScaleY); // this shouldn't be scaled CFont::SetCentreOn(); CFont::SetCentreSize(SCREEN_WIDTH); CFont::SetJustifyOff(); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 9cfc2c55..ce6d6ee2 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2348,7 +2348,7 @@ int open_script() #endif switch (scriptToLoad) { case 0: scriptfile = "main.scm"; break; - case 1: scriptfile = "freeroam_miami.scm"; break; + case 1: scriptfile = "freeroam_lcs.scm"; break; case 2: scriptfile = "main_d.scm"; break; } return CFileMgr::OpenFile(scriptfile, "rb"); diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index 2177afa4..a8658532 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -68,7 +68,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CPed* pLeader = CWorld::Players[ScriptParams[1]].m_pPed; script_assert(pPed); script_assert(pLeader); - UpdateCompareFlag(pPed->m_leader == pLeader); + UpdateCompareFlag(pPed->m_leader == pLeader && !pPed->bWaitForLeaderToComeCloser); return 0; } case COMMAND_EXPLODE_CHAR_HEAD: @@ -92,7 +92,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CollectParameters(&m_nIp, 2); CBoat* pBoat = (CBoat*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pBoat && pBoat->m_vehType == VEHICLE_TYPE_BOAT); - pBoat->m_bIsAnchored = (ScriptParams[1] == 0); + pBoat->m_bIsAnchored = (ScriptParams[1] != 0); return 0; } case COMMAND_SET_ZONE_GROUP: @@ -1817,6 +1817,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) continue; if (CModelInfo::IsCarModel(model) || CModelInfo::IsBikeModel(model)) { switch (model) { + // TODO(LCS): do it right case MI_LANDSTAL: case MI_LINERUN: case MI_RIO: @@ -1842,13 +1843,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_ANGEL: case MI_COACH: case MI_RCBANDIT: - case MI_ROMERO: - case MI_PACKER: - case MI_SENTXS: + //case MI_ROMERO: + //case MI_PACKER: + //case MI_SENTXS: case MI_SQUALO: case MI_SEASPAR: case MI_PIZZABOY: - case MI_GANGBUR: + //case MI_GANGBUR: case MI_AIRTRAIN: case MI_DEADDODO: case MI_SPEEDER: @@ -1857,44 +1858,44 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_FLATBED: case MI_YANKEE: case MI_CADDY: - case MI_ZEBRA: + //case MI_ZEBRA: case MI_TOPFUN: case MI_SKIMMER: case MI_RCBARON: case MI_RCRAIDER: case MI_SPARROW: case MI_PATRIOT: - case MI_LOVEFIST: + //case MI_LOVEFIST: case MI_COASTG: case MI_DINGHY: - case MI_HERMES: - case MI_SABRETUR: + //case MI_HERMES: + //case MI_SABRETUR: case MI_PHEONIX: - case MI_WALTON: + //case MI_WALTON: case MI_COMET: - case MI_DELUXO: - case MI_BURRITO: - case MI_SPAND: + //case MI_DELUXO: + //case MI_BURRITO: + //case MI_SPAND: case MI_MARQUIS: case MI_BAGGAGE: - case MI_KAUFMAN: + //case MI_KAUFMAN: case MI_MAVERICK: case MI_VCNMAV: - case MI_RANCHER: + //case MI_RANCHER: case MI_FBIRANCH: case MI_JETMAX: - case MI_HOTRING: + //case MI_HOTRING: case MI_SANDKING: - case MI_BLISTAC: + //case MI_BLISTAC: case MI_POLMAV: - case MI_BOXVILLE: - case MI_BENSON: - case MI_MESA: + //case MI_BOXVILLE: + //case MI_BENSON: + //case MI_MESA: case MI_RCGOBLIN: - case MI_HOTRINA: - case MI_HOTRINB: - case MI_BLOODRA: - case MI_BLOODRB: + //case MI_HOTRINA: + //case MI_HOTRINB: + //case MI_BLOODRA: + //case MI_BLOODRB: case MI_VICECHEE: model = -1; break; @@ -1909,23 +1910,23 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_MOONBEAM: case MI_ESPERANT: case MI_TAXI: - case MI_WASHING: + //case MI_WASHING: case MI_BOBCAT: case MI_BANSHEE: case MI_CABBIE: case MI_STALLION: case MI_RUMPO: - case MI_ADMIRAL: + //case MI_ADMIRAL: case MI_PCJ600: case MI_FAGGIO: case MI_FREEWAY: - case MI_GLENDALE: - case MI_OCEANIC: + //case MI_GLENDALE: + //case MI_OCEANIC: case MI_SANCHEZ: - case MI_SABRE: - case MI_REGINA: - case MI_VIRGO: - case MI_GREENWOO: + //case MI_SABRE: + //case MI_REGINA: + //case MI_VIRGO: + //case MI_GREENWOO: break; default: printf("CREATE_RANDOM_CAR_FOR_CAR_PARK - Unknown car model %d\n", CStreaming::ms_vehiclesLoaded[index]); diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 9aaba611..f711407a 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -846,14 +846,15 @@ CFileLoader::LoadVehicleObject(const char *line) char type[8], handlingId[16], gamename[32], animFile[16], vehclass[12]; uint32 frequency, comprules; int32 level, misc; - float wheelScale; + float wheelScale, normalSplay; CVehicleModelInfo *mi; char *p; - sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f", + sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f %f", &id, model, txd, type, handlingId, gamename, animFile, vehclass, - &frequency, &level, &comprules, &misc, &wheelScale); + &frequency, &level, &comprules, &misc, &wheelScale, + &normalSplay); mi = CModelInfo::AddVehicleModel(id); mi->SetName(model); @@ -873,6 +874,8 @@ CFileLoader::LoadVehicleObject(const char *line) mi->m_vehicleType = VEHICLE_TYPE_BOAT; }else if(strcmp(type, "train") == 0){ mi->m_vehicleType = VEHICLE_TYPE_TRAIN; + }else if(strcmp(type, "ferry") == 0){ + mi->m_vehicleType = VEHICLE_TYPE_FERRY; }else if(strcmp(type, "heli") == 0){ mi->m_vehicleType = VEHICLE_TYPE_HELI; }else if(strcmp(type, "plane") == 0){ diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp index 99923ddf..32aa4041 100644 --- a/src/core/FileMgr.cpp +++ b/src/core/FileMgr.cpp @@ -241,7 +241,7 @@ CFileMgr::SetDirMyDocuments(void) } ssize_t -CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode) +CFileMgr::LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode) { int fd; ssize_t n, len; @@ -257,6 +257,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode) return -1; #endif len += n; + assert(len < maxlen); }while(n == 0x4000); buf[len] = 0; myfclose(fd); diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h index 98a78360..f70451b7 100644 --- a/src/core/FileMgr.h +++ b/src/core/FileMgr.h @@ -9,7 +9,7 @@ public: static void ChangeDir(const char *dir); static void SetDir(const char *dir); static void SetDirMyDocuments(void); - static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode); + static ssize_t LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode); static int OpenFile(const char *file, const char *mode); static int OpenFile(const char *file) { return OpenFile(file, "rb"); } static int OpenFileForWriting(const char *file); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index e5e42b8c..11488aec 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3639,7 +3639,7 @@ CMenuManager::ExportStats() char *statValue = UnicodeToAscii(gUString2); for (int j = 0; statValue[j] != '\0'; ++j) { if (statValue[j] == '_') - statValue[j] = 0xBA; // This is degree symbol, but my editors keeps messing up with it so I wrote hex representation + statValue[j] = '\xBA'; // This is degree symbol, but my editors keeps messing up with it so I wrote hex representation } if (statValue) fprintf(txtFile, "%s\n\n", statValue); @@ -3701,7 +3701,7 @@ CMenuManager::ExportStats() char *statValue = UnicodeToAscii(gUString2); for (int l = 0; statValue[l] != '\0'; ++l) { if (statValue[l] == '_') - statValue[l] = 0xBA; // This is degree symbol, but my editors keeps messing up with it so I wrote hex representation + statValue[l] = '\xBA'; // This is degree symbol, but my editors keeps messing up with it so I wrote hex representation } if (statValue) fprintf(htmlFile, "%s", statValue); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 8405c2ec..79698dde 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -375,7 +375,7 @@ bool CGame::Initialise(const char* datFile) #ifdef USE_TEXTURE_POOL _TexturePoolsUnknown(false); #endif - currLevel = LEVEL_BEACH; + currLevel = LEVEL_INDUSTRIAL; currArea = AREA_MAIN_MAP; PUSH_MEMID(MEMID_TEXTURES); @@ -441,7 +441,7 @@ bool CGame::Initialise(const char* datFile) CdStreamAddImage("MODELS\\GTA3.IMG"); - CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); +// CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); CFileLoader::LoadLevel(datFile); #ifdef EXTENDED_PIPELINES // for generic fallback @@ -661,8 +661,9 @@ void CGame::ReInitGameObjectVariables(void) CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; CStreaming::RequestBigBuildings(LEVEL_GENERIC); - CStreaming::RemoveIslandsNotUsed(LEVEL_BEACH); - CStreaming::RemoveIslandsNotUsed(LEVEL_MAINLAND); + CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); CStreaming::LoadAllRequestedModels(false); currArea = AREA_MAIN_MAP; CPed::Initialise(); diff --git a/src/core/Game.h b/src/core/Game.h index 4052eb00..fe3268be 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -3,10 +3,11 @@ enum eLevelName { LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel LEVEL_GENERIC = 0, - LEVEL_BEACH, - LEVEL_MAINLAND, + LEVEL_INDUSTRIAL, + LEVEL_COMMERCIAL, + LEVEL_SUBURBAN, - NUM_LEVELS + NUM_LEVELS // LCS: should be 5 eventually... }; enum eAreaName { diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index feda19c6..1e4f48f4 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -97,6 +97,7 @@ extern bool gbFastTime; extern bool gGravityCheat; #endif +/* LCS: removed void SpecialCarCheats() { if ( !CVehicle::bCheat9 ) @@ -145,6 +146,7 @@ void SpecialCarCheats() CPad::bHasPlayerCheated = true; } } +*/ void PickUpChicksCheat() { @@ -370,7 +372,7 @@ void ChangePlayerCheat() do { do { - modelId = CGeneral::GetRandomNumberInRange(0, MI_PGA); + modelId = CGeneral::GetRandomNumberInRange(0, MI_GANG18); anotherModelId = modelId+1; } while (!CModelInfo::GetModelInfo(anotherModelId)); } while (anotherModelId >= MI_SPECIAL01 && anotherModelId <= MI_SPECIAL04 || modelId == MI_TAXI_D); @@ -589,16 +591,18 @@ void SuicideCheat(void) { } void DoChicksWithGunsCheat(void) { +/* // broken in LCS CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CStreaming::SetModelIsDeletable(CGangs::GetGangPedModel1(GANG_PLAYER)); CStreaming::SetModelIsDeletable(CGangs::GetGangPedModel2(GANG_PLAYER)); CStreaming::SetModelTxdIsDeletable(CGangs::GetGangPedModel1(GANG_PLAYER)); CStreaming::SetModelTxdIsDeletable(CGangs::GetGangPedModel2(GANG_PLAYER)); CStreaming::RemoveCurrentZonesModels(); - CGangs::SetGangPedModels(GANG_PLAYER, MI_HFYBE, MI_WFYBE); + CGangs::SetGangPedModels(GANG_PLAYER, MI_CAS_WOM, MI_HOS_WOM); CGangs::SetGangWeapons(GANG_PLAYER, WEAPONTYPE_M4, WEAPONTYPE_M4); CStats::CheatedCount += 1000; CPad::bHasPlayerCheated = true; +*/ } ////////////////////////////////////////////////////////////////////////// @@ -1420,6 +1424,8 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; BlackCarsCheat(); } +/* + // LCS: removed for now // "TRAVELINSTYLE" else if (!Cheat_strncmp(KeyBoardCheatString, "HQ`U`iLSFaNZ[")) { KeyBoardCheatString[0] = ' '; @@ -1515,6 +1521,7 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; ChangePlayerModel("igdiaz"); } +*/ // DEEPFRIEDMARSBARS else if (!Cheat_strncmp(KeyBoardCheatString, "VWHC`mDTEPVZMpRK")) { KeyBoardCheatString[0] = ' '; @@ -1530,11 +1537,13 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; BackToTheFuture(); } +/* LCS: removed // LOADSOFLITTLETHINGS else if (!Cheat_strncmp(KeyBoardCheatString, "VLUJUoHSU_VTMo`J]bV")) { KeyBoardCheatString[0] = ' '; SpecialCarCheats(); } +*/ // HOPINGIRL else if (!Cheat_strncmp(KeyBoardCheatString, "OWPH[dSVI")) { KeyBoardCheatString[0] = ' '; diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 3e470fde..27d41fca 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -78,10 +78,16 @@ size_t CStreaming::ms_memoryAvailable; int32 desiredNumVehiclesLoaded = 12; -CEntity *pIslandLODmainlandEntity; -CEntity *pIslandLODbeachEntity; -int32 islandLODmainland; -int32 islandLODbeach; +CEntity *pIslandLODindustEntity; +CEntity *pIslandLODcomIndEntity; +CEntity *pIslandLODcomSubEntity; +CEntity *pIslandLODsubIndEntity; +CEntity *pIslandLODsubComEntity; +int32 islandLODindust; +int32 islandLODcomInd; +int32 islandLODcomSub; +int32 islandLODsubInd; +int32 islandLODsubCom; #ifndef MASTER bool gbPrintStats; @@ -240,12 +246,21 @@ CStreaming::Init2(void) // find island LODs - pIslandLODmainlandEntity = nil; - pIslandLODbeachEntity = nil; - islandLODmainland = -1; - islandLODbeach = -1; - CModelInfo::GetModelInfo("IslandLODmainland", &islandLODmainland); - CModelInfo::GetModelInfo("IslandLODbeach", &islandLODbeach); + pIslandLODindustEntity = nil; + pIslandLODcomIndEntity = nil; + pIslandLODcomSubEntity = nil; + pIslandLODsubIndEntity = nil; + pIslandLODsubComEntity = nil; + islandLODindust = -1; + islandLODcomInd = -1; + islandLODcomSub = -1; + islandLODsubInd = -1; + islandLODsubCom = -1; + CModelInfo::GetModelInfo("IslandLODInd", &islandLODindust); + CModelInfo::GetModelInfo("IslandLODcomIND", &islandLODcomInd); + CModelInfo::GetModelInfo("IslandLODcomSUB", &islandLODcomSub); + CModelInfo::GetModelInfo("IslandLODsubIND", &islandLODsubInd); + CModelInfo::GetModelInfo("IslandLODsubCOM", &islandLODsubCom); #ifndef MASTER VarConsole.Add("Streaming Debug", &gbPrintStats, true); @@ -526,7 +541,12 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId) // Txd and anim have to be loaded int animId = mi->GetAnimFileIndex(); +#ifdef FIX_BUGS + if(!HasTxdLoaded(mi->GetTxdSlot()) || +#else + // texDict will exist even if only first part has loaded if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil || +#endif animId != -1 && !CAnimManager::GetAnimationBlock(animId)->isLoaded){ RemoveModel(streamId); ReRequestModel(streamId); @@ -912,13 +932,17 @@ CStreaming::RequestIslands(eLevelName level) { ISLAND_LOADING_ISNT(HIGH) switch(level){ - case LEVEL_MAINLAND: - if(islandLODbeach != -1) - RequestModel(islandLODbeach, BIGBUILDINGFLAGS); + case LEVEL_INDUSTRIAL: + RequestModel(islandLODcomInd, BIGBUILDINGFLAGS); + RequestModel(islandLODsubInd, BIGBUILDINGFLAGS); break; - case LEVEL_BEACH: - if(islandLODmainland != -1) - RequestModel(islandLODmainland, BIGBUILDINGFLAGS); + case LEVEL_COMMERCIAL: + RequestModel(islandLODindust, BIGBUILDINGFLAGS); + RequestModel(islandLODsubCom, BIGBUILDINGFLAGS); + break; + case LEVEL_SUBURBAN: + RequestModel(islandLODindust, BIGBUILDINGFLAGS); + RequestModel(islandLODcomSub, BIGBUILDINGFLAGS); break; default: break; } @@ -1127,10 +1151,12 @@ CStreaming::RemoveModel(int32 id) void CStreaming::RemoveUnusedBuildings(eLevelName level) { - if(level != LEVEL_BEACH) - RemoveBuildings(LEVEL_BEACH); - if(level != LEVEL_MAINLAND) - RemoveBuildings(LEVEL_MAINLAND); + if(level != LEVEL_INDUSTRIAL) + RemoveBuildings(LEVEL_INDUSTRIAL); + if(level != LEVEL_COMMERCIAL) + RemoveBuildings(LEVEL_COMMERCIAL); + if(level != LEVEL_SUBURBAN) + RemoveBuildings(LEVEL_SUBURBAN); } void @@ -1253,10 +1279,12 @@ CStreaming::RemoveUnusedBigBuildings(eLevelName level) { ISLAND_LOADING_IS(LOW) { - if(level != LEVEL_BEACH) - RemoveBigBuildings(LEVEL_BEACH); - if(level != LEVEL_MAINLAND) - RemoveBigBuildings(LEVEL_MAINLAND); + if(level != LEVEL_INDUSTRIAL) + RemoveBigBuildings(LEVEL_INDUSTRIAL); + if(level != LEVEL_COMMERCIAL) + RemoveBigBuildings(LEVEL_COMMERCIAL); + if(level != LEVEL_SUBURBAN) + RemoveBigBuildings(LEVEL_SUBURBAN); } RemoveIslandsNotUsed(level); } @@ -1278,15 +1306,21 @@ void CStreaming::RemoveIslandsNotUsed(eLevelName level) { int i; - if(pIslandLODmainlandEntity == nil) + if(pIslandLODindustEntity == nil) for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){ CBuilding *building = CPools::GetBuildingPool()->GetSlot(i); if(building == nil) continue; - if(building->GetModelIndex() == islandLODmainland) - pIslandLODmainlandEntity = building; - if(building->GetModelIndex() == islandLODbeach) - pIslandLODbeachEntity = building; + if(building->GetModelIndex() == islandLODindust) + pIslandLODindustEntity = building; + else if(building->GetModelIndex() == islandLODcomInd) + pIslandLODcomIndEntity = building; + else if(building->GetModelIndex() == islandLODcomSub) + pIslandLODcomSubEntity = building; + else if(building->GetModelIndex() == islandLODsubInd) + pIslandLODsubIndEntity = building; + else if(building->GetModelIndex() == islandLODsubCom) + pIslandLODsubComEntity = building; } #ifdef NO_ISLAND_LOADING if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { @@ -1295,12 +1329,27 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level) } else #endif switch(level){ - case LEVEL_MAINLAND: - DeleteIsland(pIslandLODmainlandEntity); + case LEVEL_INDUSTRIAL: + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubComEntity); break; - case LEVEL_BEACH: - DeleteIsland(pIslandLODbeachEntity); - + case LEVEL_COMMERCIAL: + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + break; + case LEVEL_SUBURBAN: + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); + DeleteIsland(pIslandLODcomIndEntity); + break; + default: + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); break; } } @@ -1562,6 +1611,7 @@ CStreaming::IsObjectInCdImage(int32 id) void CStreaming::SetModelIsDeletable(int32 id) { + assert(id >= 0); // guard against fake IDs ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_DONT_REMOVE; if ((id >= STREAM_OFFSET_TXD && id < STREAM_OFFSET_COL || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) && (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED) == 0){ @@ -1640,11 +1690,11 @@ CStreaming::StreamVehiclesAndPeds(void) } if(FindPlayerPed()->m_pWanted->AreFbiRequired()){ - RequestModel(MI_FBIRANCH, STREAMFLAGS_DONT_REMOVE); + RequestModel(MI_FBICAR, STREAMFLAGS_DONT_REMOVE); RequestModel(MI_FBI, STREAMFLAGS_DONT_REMOVE); }else{ - SetModelIsDeletable(MI_FBIRANCH); - if(!HasModelLoaded(MI_FBIRANCH)) + SetModelIsDeletable(MI_FBICAR); + if(!HasModelLoaded(MI_FBICAR)) SetModelIsDeletable(MI_FBI); } @@ -1664,6 +1714,7 @@ CStreaming::StreamVehiclesAndPeds(void) else SetModelIsDeletable(MI_CHOPPER); +/* LCS: removed if (FindPlayerPed()->m_pWanted->AreMiamiViceRequired()) { SetModelIsDeletable(MI_VICE1); SetModelIsDeletable(MI_VICE2); @@ -1705,6 +1756,7 @@ CStreaming::StreamVehiclesAndPeds(void) SetModelIsDeletable(MI_VICE7); SetModelIsDeletable(MI_VICE8); } +*/ if(timeBeforeNextLoad >= 0) timeBeforeNextLoad--; diff --git a/src/core/World.h b/src/core/World.h index 59bf634c..b0e77193 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -16,7 +16,7 @@ #define WORLD_SIZE_X (NUMSECTORS_X * SECTOR_SIZE_X) #define WORLD_SIZE_Y (NUMSECTORS_Y * SECTOR_SIZE_Y) -#define WORLD_MIN_X (-2400.0f) +#define WORLD_MIN_X (-2000.0f) #define WORLD_MIN_Y (-2000.0f) #define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X) diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 55b43c10..1715d811 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -88,20 +88,20 @@ CTheZones::Init(void) TotalNumberOfInfoZones = 1; strcpy(InfoZoneArray[0].name, "CITYINF"); - InfoZoneArray[0].minx = -2400.0f; + InfoZoneArray[0].minx = -2000.0f; InfoZoneArray[0].miny = -2000.0f; InfoZoneArray[0].minz = -500.0f; - InfoZoneArray[0].maxx = 1600.0f; + InfoZoneArray[0].maxx = 2000.0f; InfoZoneArray[0].maxy = 2000.0f; InfoZoneArray[0].maxz = 500.0f; InfoZoneArray[0].level = LEVEL_GENERIC; InfoZoneArray[0].type = ZONE_INFO; strcpy(NavigationZoneArray[0].name, "VICE_C"); - NavigationZoneArray[0].minx = -2400.0f; + NavigationZoneArray[0].minx = -2000.0f; NavigationZoneArray[0].miny = -2000.0f; NavigationZoneArray[0].minz = -500.0f; - NavigationZoneArray[0].maxx = 1600.0f; + NavigationZoneArray[0].maxx = 2000.0f; NavigationZoneArray[0].maxy = 2000.0f; NavigationZoneArray[0].maxz = 500.0f; NavigationZoneArray[0].level = LEVEL_GENERIC; @@ -115,10 +115,10 @@ CTheZones::Init(void) } TotalNumberOfMapZones = 1; strcpy(MapZoneArray[0].name, "THEMAP"); - MapZoneArray[0].minx = -2400.0f; + MapZoneArray[0].minx = -2000.0f; MapZoneArray[0].miny = -2000.0f; MapZoneArray[0].minz = -500.0f; - MapZoneArray[0].maxx = 1600.0f; + MapZoneArray[0].maxx = 2000.0f; MapZoneArray[0].maxy = 2000.0f; MapZoneArray[0].maxz = 500.0f; MapZoneArray[0].level = LEVEL_GENERIC; diff --git a/src/core/common.h b/src/core/common.h index 3fb2e963..ed95f6d3 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -92,6 +92,7 @@ typedef ptrdiff_t ssize_t; #endif #include "config.h" +#include "memoryManager.h" #include <rphanim.h> #include <rpskin.h> diff --git a/src/core/config.h b/src/core/config.h index a06ed1be..7dfb5bba 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -7,15 +7,15 @@ enum Config { MAX_CDIMAGES = 8, // additional cdimages MAX_CDCHANNELS = 5, - MODELINFOSIZE = 6500, // 4900 on PS2 - TXDSTORESIZE = 1385, - COLSTORESIZE = 31, + MODELINFOSIZE = 6500, // only 4900 + TXDSTORESIZE = 1385, // only 1200 + COLSTORESIZE = 31, // only 15 EXTRADIRSIZE = 256, CUTSCENEDIRSIZE = 512, SIMPLEMODELSIZE = 3885, TIMEMODELSIZE = 385, - CLUMPMODELSIZE = 5, + CLUMPMODELSIZE = 10, WEAPONMODELSIZE = 37, PEDMODELSIZE = 130, VEHICLEMODELSIZE = 110, @@ -26,19 +26,19 @@ enum Config { NUMOBJECTINFO = 210, // Pool sizes - NUMPTRNODES = 50000, - NUMENTRYINFOS = 3200, - NUMPEDS = 140, - NUMVEHICLES = 110, - NUMBUILDINGS = 7000, - NUMTREADABLES = 1, - NUMOBJECTS = 460, - NUMDUMMIES = 2340, + NUMPTRNODES = 50000, // only 30100 + NUMENTRYINFOS = 4000, + NUMPEDS = 140, // only 70 + NUMVEHICLES = 110, // only 70 + NUMBUILDINGS = 7000, // only 6757 + NUMTREADABLES = 1300, + NUMOBJECTS = 475, + NUMDUMMIES = 3000, NUMAUDIOSCRIPTOBJECTS = 192, NUMCOLMODELS = 4400, NUMCUTSCENEOBJECTS = 50, // not a pool in VC - NUMANIMBLOCKS = 35, + NUMANIMBLOCKS = 60, NUMANIMATIONS = 450, NUMTEMPOBJECTS = 40, @@ -58,20 +58,20 @@ enum Config { NUMREFERENCES = 800, // Zones - NUMAUDIOZONES = 14, + NUMAUDIOZONES = 36, NUMINFOZONES = 169, - NUMMAPZONES = 39, - NUMNAVIGZONES = 20, + NUMMAPZONES = 110, + NUMNAVIGZONES = 70, // Cull zones - NUMATTRIBZONES = 704, + NUMATTRIBZONES = 900, NUMOCCLUSIONVOLUMES = 350, NUMACTIVEOCCLUDERS = 48, PATHNODESIZE = 4500, - NUMWEATHERS = 7, + NUMWEATHERS = 8, NUMHOURS = 24, NUMEXTRADIRECTIONALS = 4, @@ -111,7 +111,7 @@ enum Config { NUM_WATERCANNONS = 3, NUMPEDROUTES = 200, - NUMPHONES = 50, + NUMPHONES = 60, NUMPEDGROUPS = 67, NUMMODELSPERPEDGROUP = 16, MAXZONEPEDSLOADED = 8, @@ -256,7 +256,7 @@ enum Config { #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number -#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time +//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time #define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync //#define USE_TEXTURE_POOL #ifdef LIBRW @@ -310,7 +310,7 @@ enum Config { # ifdef CUSTOM_FRONTEND_OPTIONS # define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable -# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU +//# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU # define CUTSCENE_BORDERS_SWITCH //# define MULTISAMPLING // adds MSAA option # define INVERT_LOOK_FOR_PAD // enable the hidden option @@ -364,9 +364,21 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually // Audio #define AUDIO_CACHE // cache sound lengths to speed up the cold boot -//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS +//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder +#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files +#ifdef AUDIO_OPUS +#define AUDIO_OAL_USE_OPUS // enable support of opus files +//#define OPUS_AUDIO_PATHS // (not supported on VC yet) changes audio paths to opus paths (doesn't work if AUDIO_OAL_USE_OPUS isn't enabled) +//#define OPUS_SFX // enable if your sfx.raw is encoded with opus (doesn't work if AUDIO_OAL_USE_OPUS isn't enabled) + +#ifndef AUDIO_OAL_USE_OPUS +#undef OPUS_AUDIO_PATHS +#undef OPUS_SFX +#endif + +#endif #ifdef LIBRW // these are not supported with librw yet diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 0e5ed2af..3a5488d1 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -157,7 +157,7 @@ void CheckAndSaveIniFloat(const char *cat, const char *key, float val, bool &cha void LoadINISettings() { - cfg.load_file("reVC.ini"); + cfg.load_file("reLCS.ini"); #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS // Written by assuming the codes below will run after _InputInitialiseJoys(). @@ -260,7 +260,7 @@ void SaveINISettings() CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed); if (changed) - cfg.write_file("reVC.ini"); + cfg.write_file("reLCS.ini"); } #endif @@ -290,7 +290,6 @@ void FastWeatherCheat(); void OnlyRenderWheelsCheat(); void ChittyChittyBangBangCheat(); void StrongGripCheat(); -void SpecialCarCheats(); void PickUpChicksCheat(); DebugMenuEntry *carCol1; @@ -561,7 +560,6 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Only render wheels", OnlyRenderWheelsCheat); DebugMenuAddCmd("Cheats", "Chitty chitty bang bang", ChittyChittyBangBangCheat); DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat); - DebugMenuAddCmd("Cheats", "Special car", SpecialCarCheats); DebugMenuAddCmd("Cheats", "Pickup chicks", PickUpChicksCheat); static int spawnCarId = MI_LANDSTAL; diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index a195a4cc..57f364a3 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -36,7 +36,13 @@ enum { VSLOC_eye = rw::d3d::VSLOC_afterLights, VSLOC_reflProps, - VSLOC_specLights + VSLOC_specLights, + + // Leeds building + VSLOC_emissive = rw::d3d::VSLOC_afterLights, + VSLOC_ambient, + + PSLOC_colorscale = 1 }; /* @@ -182,11 +188,11 @@ DestroyVehiclePipe(void) /* - * Neo World pipe + * Leeds World pipe */ -static void *neoWorld_VS; -static void *neoWorldVC_PS; +static void *leedsBuilding_VS; +static void *scale_PS; static void worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) @@ -195,79 +201,67 @@ 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); setVertexDeclaration(header->vertexDeclaration); - vsBits = lightingCB_Shader(atomic); + setVertexShader(leedsBuilding_VS); + setPixelShader(scale_PS); + uploadMatrices(atomic->getFrame()->getLTM()); + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1); + d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1); - float lightfactor[4]; + float colorscale[4]; + colorscale[3] = 1.0f; InstanceData *inst = header->inst; for(rw::uint32 i = 0; i < header->numMeshes; i++){ Material *m = inst->material; - if(MatFX::getEffects(m) == MatFX::DUAL){ - setVertexShader(neoWorld_VS); - - MatFX *matfx = MatFX::get(m); - Texture *dualtex = matfx->getDualTexture(); - if(dualtex == nil) - goto notex; - d3d::setTexture(1, dualtex); - lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult; - }else{ - notex: - setVertexShader(default_amb_VS); - - d3d::setTexture(1, nil); - lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f; - } - lightfactor[3] = m->color.alpha/255.0f; - d3d::setTexture(0, m->texture); - d3ddevice->SetPixelShaderConstantF(1, lightfactor, 1); - - SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); - - RGBA color = { 255, 255, 255, m->color.alpha }; - setMaterial(color, m->surfaceProps); + float cs = 1.0f; + if(m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1); if(m->texture) d3d::setTexture(0, m->texture); else - d3d::setTexture(0, gpWhiteTexture); - setPixelShader(neoWorldVC_PS); + d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this + + setMaterial(m->color, m->surfaceProps, 0.5f); + + SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); drawInst(header, inst); inst++; } - d3d::setTexture(1, nil); } void CreateWorldPipe(void) { - if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) - printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); - else - ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); - -#include "shaders/default_UV2_VS.inc" - neoWorld_VS = rw::d3d::createVertexShader(default_UV2_VS_cso); - assert(neoWorld_VS); - -#include "shaders/neoWorldVC_PS.inc" - neoWorldVC_PS = rw::d3d::createPixelShader(neoWorldVC_PS_cso); - assert(neoWorldVC_PS); - +// if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) +// printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); +// else +// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); + +#include "shaders/leedsBuilding_VS.inc" + leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso); + assert(leedsBuilding_VS); +#include "shaders/scale_PS.inc" + scale_PS = rw::d3d::createPixelShader(scale_PS_cso); + assert(scale_PS); rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create(); pipe->instanceCB = rw::d3d9::defaultInstanceCB; @@ -279,10 +273,10 @@ CreateWorldPipe(void) void DestroyWorldPipe(void) { - rw::d3d::destroyVertexShader(neoWorld_VS); - neoWorld_VS = nil; - rw::d3d::destroyPixelShader(neoWorldVC_PS); - neoWorldVC_PS = nil; + rw::d3d::destroyVertexShader(leedsBuilding_VS); + leedsBuilding_VS = nil; + rw::d3d::destroyPixelShader(scale_PS); + scale_PS = nil; ((rw::d3d9::ObjPipeline*)worldPipe)->destroy(); diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index 5f372530..a222f5e9 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -33,6 +33,10 @@ static int32 u_reflProps; static int32 u_specDir; static int32 u_specColor; +static int32 u_amb; +static int32 u_emiss; +static int32 u_colorscale; + #define U(i) currentShader->uniformLocations[i] /* @@ -189,10 +193,10 @@ DestroyVehiclePipe(void) /* - * Neo World pipe + * Leeds World pipe */ -rw::gl3::Shader *neoWorldShader; +rw::gl3::Shader *leedsWorldShader; static void worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -200,15 +204,9 @@ 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()); - lightingCB(atomic); #ifdef RW_GL_USE_VAOS glBindVertexArray(header->vao); @@ -221,39 +219,39 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) InstanceData *inst = header->inst; rw::int32 n = header->numMeshes; - neoWorldShader->use(); + leedsWorldShader->use(); + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; - float lightfactor[4]; + glUniform4fv(U(u_amb), 1, (float*)&amb); + glUniform4fv(U(u_emiss), 1, (float*)&emiss); + + float colorscale[4]; + colorscale[3] = 1.0f; while(n--){ m = inst->material; - if(MatFX::getEffects(m) == MatFX::DUAL){ - MatFX *matfx = MatFX::get(m); - Texture *dualtex = matfx->getDualTexture(); - if(dualtex == nil) - goto notex; - setTexture(1, dualtex); - lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult; - }else{ - notex: - setTexture(1, nil); - lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f; - } - lightfactor[3] = m->color.alpha/255.0f; - glUniform4fv(U(u_lightMap), 1, lightfactor); - - RGBA color = { 255, 255, 255, m->color.alpha }; - setMaterial(color, m->surfaceProps); + float cs = 1.0f; + if(m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + glUniform4fv(U(u_colorscale), 1, colorscale); setTexture(0, m->texture); + setMaterial(m->color, m->surfaceProps); + rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); drawInst(header, inst); inst++; } - setTexture(1, nil); #ifndef RW_GL_USE_VAOS disableAttribPointers(header->attribDesc, header->numAttribs); #endif @@ -265,18 +263,18 @@ CreateWorldPipe(void) using namespace rw; using namespace rw::gl3; - if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) - printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); - else - ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); +// if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) +// printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); +// else +// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); { -#include "shaders/neoWorldVC_fs_gl.inc" -#include "shaders/default_UV2_gl.inc" - const char *vs[] = { shaderDecl, header_vert_src, default_UV2_vert_src, nil }; - const char *fs[] = { shaderDecl, header_frag_src, neoWorldVC_frag_src, nil }; - neoWorldShader = Shader::create(vs, fs); - assert(neoWorldShader); +#include "shaders/scale_fs_gl.inc" +#include "shaders/leedsBuilding_vs_gl.inc" + const char *vs[] = { shaderDecl, header_vert_src, leedsBuilding_vert_src, nil }; + const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil }; + leedsWorldShader = Shader::create(vs, fs); + assert(leedsWorldShader); } @@ -290,8 +288,8 @@ CreateWorldPipe(void) void DestroyWorldPipe(void) { - neoWorldShader->destroy(); - neoWorldShader = nil; + leedsWorldShader->destroy(); + leedsWorldShader = nil; ((rw::gl3::ObjPipeline*)worldPipe)->destroy(); worldPipe = nil; @@ -609,6 +607,10 @@ CustomPipeRegisterGL(void) u_reflProps = rw::gl3::registerUniform("u_reflProps"); u_specDir = rw::gl3::registerUniform("u_specDir"); u_specColor = rw::gl3::registerUniform("u_specColor"); + + u_amb = rw::gl3::registerUniform("u_amb"); + u_emiss = rw::gl3::registerUniform("u_emiss"); + u_colorscale = rw::gl3::registerUniform("u_colorscale"); } diff --git a/src/extras/postfx.cpp b/src/extras/postfx.cpp index 2ea08141..b07b5426 100644 --- a/src/extras/postfx.cpp +++ b/src/extras/postfx.cpp @@ -25,14 +25,14 @@ static RwIm2DVertex Vertex2[4]; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; #ifdef RW_D3D9 -void *colourfilterVC_PS; +void *colourfilterLCS_PS; void *contrast_PS; #endif #ifdef RW_OPENGL int32 u_blurcolor; int32 u_contrastAdd; int32 u_contrastMult; -rw::gl3::Shader *colourFilterVC; +rw::gl3::Shader *colourFilterLCS; rw::gl3::Shader *contrast; #endif @@ -143,8 +143,8 @@ CPostFX::Open(RwCamera *cam) #ifdef RW_D3D9 -#include "shaders/colourfilterVC_PS.inc" - colourfilterVC_PS = rw::d3d::createPixelShader(colourfilterVC_PS_cso); +#include "shaders/colourfilterLCS_PS.inc" + colourfilterLCS_PS = rw::d3d::createPixelShader(colourfilterLCS_PS_cso); #include "shaders/contrastPS.inc" contrast_PS = rw::d3d::createPixelShader(contrastPS_cso); #endif @@ -153,11 +153,11 @@ CPostFX::Open(RwCamera *cam) { #include "shaders/im2d_gl.inc" -#include "shaders/colourfilterVC_fs_gl.inc" +#include "shaders/colourfilterLCS_fs_gl.inc" const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil }; - const char *fs[] = { shaderDecl, header_frag_src, colourfilterVC_frag_src, nil }; - colourFilterVC = Shader::create(vs, fs); - assert(colourFilterVC); + const char *fs[] = { shaderDecl, header_frag_src, colourfilterLCS_frag_src, nil }; + colourFilterLCS = Shader::create(vs, fs); + assert(colourFilterLCS); } { @@ -184,9 +184,9 @@ CPostFX::Close(void) pBackBuffer = nil; } #ifdef RW_D3D9 - if(colourfilterVC_PS){ - rw::d3d::destroyPixelShader(colourfilterVC_PS); - colourfilterVC_PS = nil; + if(colourfilterLCS_PS){ + rw::d3d::destroyPixelShader(colourfilterLCS_PS); + colourfilterLCS_PS = nil; } if(contrast_PS){ rw::d3d::destroyPixelShader(contrast_PS); @@ -194,9 +194,9 @@ CPostFX::Close(void) } #endif #ifdef RW_OPENGL - if(colourFilterVC){ - colourFilterVC->destroy(); - colourFilterVC = nil; + if(colourFilterLCS){ + colourFilterLCS->destroy(); + colourFilterLCS = nil; } if(contrast){ contrast->destroy(); @@ -294,12 +294,12 @@ CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) blurcolors[3] = 30/255.0f; #ifdef RW_D3D9 rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1); - rw::d3d::im2dOverridePS = colourfilterVC_PS; + rw::d3d::im2dOverridePS = colourfilterLCS_PS; #endif #ifdef RW_OPENGL - rw::gl3::im2dOverrideShader = colourFilterVC; - colourFilterVC->use(); - glUniform4fv(colourFilterVC->uniformLocations[u_blurcolor], 1, blurcolors); + rw::gl3::im2dOverrideShader = colourFilterLCS; + colourFilterLCS->use(); + glUniform4fv(colourFilterLCS->uniformLocations[u_blurcolor], 1, blurcolors); #endif } RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile index 5089e16a..355d71af 100644 --- a/src/extras/shaders/Makefile +++ b/src/extras/shaders/Makefile @@ -1,19 +1,20 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \ - colourfilterVC_fs_gl.inc contrast_fs_gl.inc \ + colourfilterLCS_fs_gl.inc contrast_fs_gl.inc \ neoRim_gl.inc neoRimSkin_gl.inc \ neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \ neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \ - im2d_UV2_gl.inc screenDroplet_fs_gl.inc + im2d_UV2_gl.inc screenDroplet_fs_gl.inc \ + leedsBuilding_vs_gl.inc scale_fs_gl.inc im2d_gl.inc: im2d.vert (echo 'const char *im2d_vert_src =';\ sed 's/..*/"&\\n"/' im2d.vert;\ echo ';') >im2d_gl.inc -colourfilterVC_fs_gl.inc: colourfilterVC.frag - (echo 'const char *colourfilterVC_frag_src =';\ - sed 's/..*/"&\\n"/' colourfilterVC.frag;\ - echo ';') >colourfilterVC_fs_gl.inc +colourfilterLCS_fs_gl.inc: colourfilterLCS.frag + (echo 'const char *colourfilterLCS_frag_src =';\ + sed 's/..*/"&\\n"/' colourfilterLCS.frag;\ + echo ';') >colourfilterLCS_fs_gl.inc simple_fs_gl.inc: simple.frag (echo 'const char *simple_frag_src =';\ sed 's/..*/"&\\n"/' simple.frag;\ @@ -76,3 +77,13 @@ screenDroplet_fs_gl.inc: screenDroplet.frag (echo 'const char *screenDroplet_frag_src =';\ sed 's/..*/"&\\n"/' screenDroplet.frag;\ echo ';') >screenDroplet_fs_gl.inc + +leedsBuilding_vs_gl.inc: leedsBuilding.vert + (echo 'const char *leedsBuilding_vert_src =';\ + sed 's/..*/"&\\n"/' leedsBuilding.vert;\ + echo ';') >leedsBuilding_vs_gl.inc + +scale_fs_gl.inc: scale.frag + (echo 'const char *scale_frag_src =';\ + sed 's/..*/"&\\n"/' scale.frag;\ + echo ';') >scale_fs_gl.inc diff --git a/src/extras/shaders/colourfilterLCS.frag b/src/extras/shaders/colourfilterLCS.frag new file mode 100644 index 00000000..67348d0c --- /dev/null +++ b/src/extras/shaders/colourfilterLCS.frag @@ -0,0 +1,20 @@ +uniform sampler2D tex0; +uniform vec4 u_blurcolor; + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN float v_fog; + +void +main(void) +{ + vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + dst += dst*u_blurcolor; + + vec4 color; + color.rgb = dst.rgb; + color.a = 1.0f; + + FRAGCOLOR(color); +} + diff --git a/src/extras/shaders/colourfilterLCS_PS.cso b/src/extras/shaders/colourfilterLCS_PS.cso Binary files differnew file mode 100644 index 00000000..e5ffa3f1 --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_PS.cso diff --git a/src/extras/shaders/colourfilterLCS_PS.hlsl b/src/extras/shaders/colourfilterLCS_PS.hlsl new file mode 100644 index 00000000..bd91567d --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_PS.hlsl @@ -0,0 +1,13 @@ +sampler2D tex : register(s0); +float4 blurcol : register(c10); + +//float4 blurcols[10] : register(c15); + + +float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 +{ + float4 dst = tex2D(tex, texcoord.xy); + dst += dst*blurcol; + dst.a = 1.0; + return dst; +} diff --git a/src/extras/shaders/colourfilterLCS_PS.inc b/src/extras/shaders/colourfilterLCS_PS.inc new file mode 100644 index 00000000..f9eeab52 --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_PS.inc @@ -0,0 +1,27 @@ +static unsigned char colourfilterLCS_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, + 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, + 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, + 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, + 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, + 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, + 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, + 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/colourfilterLCS_fs_gl.inc b/src/extras/shaders/colourfilterLCS_fs_gl.inc new file mode 100644 index 00000000..2c8e3532 --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_fs_gl.inc @@ -0,0 +1,22 @@ +const char *colourfilterLCS_frag_src = +"uniform sampler2D tex0;\n" +"uniform vec4 u_blurcolor;\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" +" dst += dst*u_blurcolor;\n" + +" vec4 color;\n" +" color.rgb = dst.rgb;\n" +" color.a = 1.0f;\n" + +" FRAGCOLOR(color);\n" +"}\n" + +; diff --git a/src/extras/shaders/colourfilterVC.frag b/src/extras/shaders/colourfilterVC.frag deleted file mode 100644 index 9db3950e..00000000 --- a/src/extras/shaders/colourfilterVC.frag +++ /dev/null @@ -1,27 +0,0 @@ -uniform sampler2D tex0; -uniform vec4 u_blurcolor; - -FSIN vec4 v_color; -FSIN vec2 v_tex0; -FSIN float v_fog; - -void -main(void) -{ - float a = u_blurcolor.a; - vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0); - vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); - vec4 prev = dst; - for(int i = 0; i < 5; i++){ - vec4 tmp = dst*(1.0-a) + prev*doublec*a; - tmp += prev*u_blurcolor; - tmp += prev*u_blurcolor; - prev = clamp(tmp, 0.0, 1.0); - } - vec4 color; - color.rgb = prev.rgb; - color.a = 1.0f; - - FRAGCOLOR(color); -} - diff --git a/src/extras/shaders/colourfilterVC_PS.cso b/src/extras/shaders/colourfilterVC_PS.cso Binary files differdeleted file mode 100644 index 4b0e9f3f..00000000 --- a/src/extras/shaders/colourfilterVC_PS.cso +++ /dev/null diff --git a/src/extras/shaders/colourfilterVC_PS.hlsl b/src/extras/shaders/colourfilterVC_PS.hlsl deleted file mode 100644 index 1e62950b..00000000 --- a/src/extras/shaders/colourfilterVC_PS.hlsl +++ /dev/null @@ -1,23 +0,0 @@ -sampler2D tex : register(s0); -float4 blurcol : register(c10); - -//float4 blurcols[10] : register(c15); - - -float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 -{ - float a = blurcol.a; - - float4 doublec = saturate(blurcol*2); - float4 dst = tex2D(tex, texcoord.xy); - float4 prev = dst; - for(int i = 0; i < 5; i++){ -// float4 doublec = saturate(blurcol*2); - float4 tmp = dst*(1-a) + prev*doublec*a; - tmp += prev*blurcol; - tmp += prev*blurcol; - prev = saturate(tmp); - } - prev.a = 1.0f; - return prev; -} diff --git a/src/extras/shaders/colourfilterVC_PS.inc b/src/extras/shaders/colourfilterVC_PS.inc deleted file mode 100644 index daa18360..00000000 --- a/src/extras/shaders/colourfilterVC_PS.inc +++ /dev/null @@ -1,56 +0,0 @@ -static unsigned char colourfilterVC_PS_cso[] = { - 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, - 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, - 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, - 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, - 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, - 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, - 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, - 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, - 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, - 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, - 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, - 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, - 0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x17, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x0a, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, - 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, - 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xff, 0xa0, - 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 -}; diff --git a/src/extras/shaders/colourfilterVC_fs_gl.inc b/src/extras/shaders/colourfilterVC_fs_gl.inc deleted file mode 100644 index 1f9bf6d8..00000000 --- a/src/extras/shaders/colourfilterVC_fs_gl.inc +++ /dev/null @@ -1,29 +0,0 @@ -const char *colourfilterVC_frag_src = -"uniform sampler2D tex0;\n" -"uniform vec4 u_blurcolor;\n" - -"FSIN vec4 v_color;\n" -"FSIN vec2 v_tex0;\n" -"FSIN float v_fog;\n" - -"void\n" -"main(void)\n" -"{\n" -" float a = u_blurcolor.a;\n" -" vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0);\n" -" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" -" vec4 prev = dst;\n" -" for(int i = 0; i < 5; i++){\n" -" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n" -" tmp += prev*u_blurcolor;\n" -" tmp += prev*u_blurcolor;\n" -" prev = clamp(tmp, 0.0, 1.0);\n" -" }\n" -" vec4 color;\n" -" color.rgb = prev.rgb;\n" -" color.a = 1.0f;\n" - -" FRAGCOLOR(color);\n" -"}\n" - -; diff --git a/src/extras/shaders/leedsBuilding.vert b/src/extras/shaders/leedsBuilding.vert new file mode 100644 index 00000000..67dd7938 --- /dev/null +++ b/src/extras/shaders/leedsBuilding.vert @@ -0,0 +1,26 @@ +uniform vec4 u_amb; +uniform vec4 u_emiss; + +VSIN(ATTRIB_POS) vec3 in_pos; + +VSOUT vec4 v_color; +VSOUT vec2 v_tex0; +VSOUT float v_fog; + +void +main(void) +{ + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; + + v_tex0 = in_tex0; + + v_color = in_color; + v_color.rgb *= u_amb.rgb; + v_color.rgb += u_emiss.rgb; + v_color = clamp(v_color, 0.0, 1.0); + v_color.a *= u_matColor.a; + + v_fog = DoFog(gl_Position.w); +} diff --git a/src/extras/shaders/leedsBuilding_VS.cso b/src/extras/shaders/leedsBuilding_VS.cso Binary files differnew file mode 100644 index 00000000..1ec92fb1 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_VS.cso diff --git a/src/extras/shaders/leedsBuilding_VS.hlsl b/src/extras/shaders/leedsBuilding_VS.hlsl new file mode 100644 index 00000000..dd3592e9 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_VS.hlsl @@ -0,0 +1,44 @@ +#include "standardConstants.h" + +float4 emissive : register(c41); +float4 ambient : register(c42); + +struct VS_in +{ + float4 Position : POSITION; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + float2 TexCoord1 : TEXCOORD1; + float4 Prelight : COLOR0; +}; + +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; // also fog + float2 TexCoord1 : TEXCOORD1; + float4 Color : COLOR0; +}; + + +VS_out main(in VS_in input) +{ + VS_out output; + + output.Position = mul(combinedMat, input.Position); + float3 Vertex = mul(worldMat, input.Position).xyz; + float3 Normal = mul(normalMat, input.Normal); + + output.TexCoord0.xy = input.TexCoord; + output.TexCoord1.xy = input.TexCoord1; + + output.Color = input.Prelight; + output.Color.rgb *= ambient.rgb; + output.Color.rgb += emissive.rgb; + + output.Color = clamp(output.Color, 0.0, 1.0); + output.Color.a *= matCol.a; + + output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0); + + return output; +} diff --git a/src/extras/shaders/leedsBuilding_VS.inc b/src/extras/shaders/leedsBuilding_VS.inc new file mode 100644 index 00000000..d24f45b0 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_VS.inc @@ -0,0 +1,55 @@ +static unsigned char leedsBuilding_VS_cso[] = { + 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, + 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00, + 0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, + 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, + 0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00, + 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, + 0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, + 0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67, + 0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, + 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, + 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, + 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, + 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x0a, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x07, 0x80, 0x2a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x03, 0x00, 0xe4, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x29, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, + 0x03, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x55, 0xa0, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80, + 0x0c, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0xd0, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, + 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0e, 0x00, 0x55, 0xa1, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, + 0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x55, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, + 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsBuilding_vs_gl.inc b/src/extras/shaders/leedsBuilding_vs_gl.inc new file mode 100644 index 00000000..4e2db0d0 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_vs_gl.inc @@ -0,0 +1,28 @@ +const char *leedsBuilding_vert_src = +"uniform vec4 u_amb;\n" +"uniform vec4 u_emiss;\n" + +"VSIN(ATTRIB_POS) vec3 in_pos;\n" + +"VSOUT vec4 v_color;\n" +"VSOUT vec2 v_tex0;\n" +"VSOUT float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" + +" v_tex0 = in_tex0;\n" + +" v_color = in_color;\n" +" v_color.rgb *= u_amb.rgb;\n" +" v_color.rgb += u_emiss.rgb;\n" +" v_color = clamp(v_color, 0.0, 1.0);\n" +" v_color.a *= u_matColor.a;\n" + +" v_fog = DoFog(gl_Position.w);\n" +"}\n" +; diff --git a/src/extras/shaders/scale.frag b/src/extras/shaders/scale.frag new file mode 100644 index 00000000..29165154 --- /dev/null +++ b/src/extras/shaders/scale.frag @@ -0,0 +1,18 @@ +uniform sampler2D tex0; +uniform vec4 u_colorscale; + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN float v_fog; + +void +main(void) +{ + vec4 color; + color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale; + color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog); + DoAlphaTest(color.a); + + FRAGCOLOR(color); +} + diff --git a/src/extras/shaders/scale_PS.cso b/src/extras/shaders/scale_PS.cso Binary files differnew file mode 100644 index 00000000..d7f7374c --- /dev/null +++ b/src/extras/shaders/scale_PS.cso diff --git a/src/extras/shaders/scale_PS.hlsl b/src/extras/shaders/scale_PS.hlsl new file mode 100644 index 00000000..92466e94 --- /dev/null +++ b/src/extras/shaders/scale_PS.hlsl @@ -0,0 +1,19 @@ +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; + float4 Color : COLOR0; +}; + +sampler2D tex0 : register(s0); + +float4 fogColor : register(c0); +float4 colorscale : register(c1); + +float4 main(VS_out input) : COLOR +{ + float4 color = input.Color; + color *= tex2D(tex0, input.TexCoord0.xy); + color *= colorscale; + color.rgb = lerp(fogColor.rgb, color.rgb, input.TexCoord0.z); + return color; +} diff --git a/src/extras/shaders/scale_PS.inc b/src/extras/shaders/scale_PS.inc new file mode 100644 index 00000000..5f711ac8 --- /dev/null +++ b/src/extras/shaders/scale_PS.inc @@ -0,0 +1,33 @@ +static unsigned char scale_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x34, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x94, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x06, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x67, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x30, 0x00, 0xab, 0xab, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, + 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, + 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, + 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, + 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, + 0x01, 0x00, 0xe4, 0x81, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x08, 0x80, + 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/scale_fs_gl.inc b/src/extras/shaders/scale_fs_gl.inc new file mode 100644 index 00000000..8d9563e2 --- /dev/null +++ b/src/extras/shaders/scale_fs_gl.inc @@ -0,0 +1,20 @@ +const char *scale_frag_src = +"uniform sampler2D tex0;\n" +"uniform vec4 u_colorscale;\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 color;\n" +" color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale;\n" +" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n" +" DoAlphaTest(color.a);\n" + +" FRAGCOLOR(color);\n" +"}\n" + +; diff --git a/src/leeds/base/memoryManager.cpp b/src/leeds/base/memoryManager.cpp new file mode 100644 index 00000000..20604299 --- /dev/null +++ b/src/leeds/base/memoryManager.cpp @@ -0,0 +1,75 @@ +#include "common.h" +#include "memoryManager.h" + +namespace base +{ + cMemoryManager::cMemoryManager() + { + + } + + void* cMemoryManager::Allocate(uint32 size) + { + void* buf = malloc(size); + memset(buf, 0, size); + return buf; + } + + void* cMemoryManager::AllocateAligned(uint32 size) + { + void* buf = malloc(size); + memset(buf, 0, size); + return buf; + } + + void* cMemoryManager::Realloc(void* buf, uint32 newSize, bool unk) + { + return realloc(buf, newSize); + } + + void cMemoryManager::Free(void* buf) + { + if (buf) + free(buf); + } + + bool cMemoryManager::IsFree(void* buf) + { + return buf == nil; + } + + + cMainMemoryManager* cMainMemoryManager::m_pInstance = nil; + + cMainMemoryManager::cMainMemoryManager() + { + assert(m_pInstance == nil); + m_pInstance = this; + Init(nil, 0); + } + + void cMainMemoryManager::Init(void*, uint32) + { + + } +}; + +void* operator new(size_t size) +{ + return base::cMainMemoryManager::Instance()->Allocate(size); +} + +void* operator new[](size_t size) +{ + return base::cMainMemoryManager::Instance()->Allocate(size); +} + +void operator delete(void* buf) +{ + base::cMainMemoryManager::Instance()->Free(buf); +} + +void operator delete[](void* buf) +{ + base::cMainMemoryManager::Instance()->Free(buf); +}
\ No newline at end of file diff --git a/src/leeds/base/memoryManager.h b/src/leeds/base/memoryManager.h new file mode 100644 index 00000000..a4b1beac --- /dev/null +++ b/src/leeds/base/memoryManager.h @@ -0,0 +1,39 @@ +#pragma once + +namespace base +{ + class cMemoryManager + { + public: + cMemoryManager(); + void* Allocate(uint32 size); + void* AllocateAligned(uint32 size); + void* Realloc(void* buf, uint32 newSize, bool unk); + void Free(void* buf); + bool IsFree(void* buf); + }; + + class cMainMemoryManager : public cMemoryManager + { + static cMainMemoryManager* m_pInstance; + static void Init(void*, uint32); + + public: + cMainMemoryManager(); + static cMainMemoryManager *Instance() + { + static cMainMemoryManager instance; + return &instance; + } + }; + + class cMemoryBlock + { + // TODO + }; +} + +void* operator new(size_t size); +void* operator new[](size_t size); +void operator delete(void* buf); +void operator delete[](void* buf);
\ No newline at end of file diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 182a0cea..7c920cbf 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -157,96 +157,85 @@ enum MI_FIREMAN, MI_MALE01, - MI_HFYST = 9, - MI_HFOST, - MI_HMYST, - MI_HMOST, - MI_HFYRI, - MI_HFORI, - MI_HMYRI, - MI_HMORI, - MI_HFYBE, - MI_HFOBE, - MI_HMYBE, - MI_HMOBE, - MI_HFYBU, - MI_HFYMD, - MI_HFYCG, - MI_HFYPR, - MI_HFOTR, - MI_HMOTR, - MI_HMYAP, - MI_HMOCA, - MI_TAXI_D = MI_HMOCA, - MI_BMODK, - MI_BMYKR, - MI_BFYST, - MI_BFOST, - MI_BMYST, - MI_BMOST, - MI_BFYRI, - MI_BFORI, - MI_BMYRI, - MI_BFYBE, - MI_BMYBE, - MI_BFOBE, - MI_BMOBE, - MI_BMYBU, - MI_BFYPR, - MI_BFOTR, - MI_BMOTR, - MI_BMYPI, - MI_BMYBB, - MI_WMYCR, - MI_WFYST, - MI_WFOST, - MI_WMYST, - MI_WMOST, - MI_WFYRI, - MI_WFORI, - MI_WMYRI, - MI_WMORI, - MI_WFYBE, - MI_WMYBE, - MI_WFOBE, - MI_WMOBE, - MI_WMYCW, - MI_WMYGO, - MI_WFOGO, - MI_WMOGO, - MI_WFYLG, - MI_WMYLG, - MI_WFYBU, - MI_WMYBU, - MI_WMOBU, - MI_WFYPR, - MI_WFOTR, - MI_WMOTR, - MI_WMYPI, - MI_WMOCA, - MI_WFYJG, - MI_WMYJG, - MI_WFYSK, - MI_WMYSK, - MI_WFYSH, - MI_WFOSH, - MI_JFOTO, - MI_JMOTO, - - MI_CBA,// = 83, - MI_CBB, - MI_HNA, - MI_HNB, - MI_SGA, - MI_SGB, - MI_CLA, - MI_CLB, - MI_GDA, - MI_GDB, - MI_BKA, - MI_BKB, - MI_PGA, - MI_PGB, + MI_TAXI_D = 9, + MI_PIMP, + MI_CRIMINAL01, + MI_CRIMINAL02, + MI_MALE02, + MI_MALE03, + MI_FATMALE01, + MI_FATMALE02, + MI_FEMALE01, + MI_FEMALE02, + MI_FEMALE03, + MI_FATFEMALE01, + MI_FATFEMALE02, + MI_PROSTITUTE, + MI_PROSTITUTE2, + MI_P_MAN1, + MI_P_MAN2, + MI_P_WOM1, + MI_P_WOM2, + MI_CT_MAN1, + MI_CT_MAN2, + MI_CT_WOM1, + MI_CT_WOM2, + MI_LI_MAN1, + MI_LI_MAN2, + MI_LI_WOM1, + MI_LI_WOM2, + MI_DOCKER1, + MI_DOCKER2, + MI_SCUM_MAN, + MI_SCUM_WOM, + MI_WORKER1, + MI_WORKER2, + MI_B_MAN1, + MI_B_MAN2, + MI_B_MAN3, + MI_B_WOM1, + MI_B_WOM2, + MI_B_WOM3, + MI_MOD_MAN, + MI_MOD_WOM, + MI_ST_MAN, + MI_ST_WOM, + MI_FAN_MAN1, + MI_FAN_MAN2, + MI_FAN_WOM, + MI_HOS_MAN, + MI_HOS_WOM, + MI_CONST1, + MI_CONST2, + MI_SHOPPER1, + MI_SHOPPER2, + MI_SHOPPER3, + MI_STUD_MAN, + MI_STUD_WOM, + MI_CAS_MAN, + MI_CAS_WOM, + MI_CAMP_MAN, + MI_CAMP_WOM, + MI_HITMAN, + + MI_GANG01 = 79, + MI_GANG02, + MI_GANG03, + MI_GANG04, + MI_GANG05, + MI_GANG06, + MI_GANG07, + MI_GANG08, + MI_GANG09, + MI_GANG10, + MI_GANG11, + MI_GANG12, + MI_GANG13, + MI_GANG14, + MI_GANG15, + MI_GANG16, + MI_GANG17, + MI_GANG18, MI_VICE1, MI_VICE2, MI_VICE3, @@ -283,19 +272,20 @@ enum MI_LAST_PED = MI_SPECIAL21, MI_FIRST_VEHICLE, - MI_LANDSTAL = MI_FIRST_VEHICLE, + MI_SPIDER = MI_FIRST_VEHICLE, + MI_LANDSTAL, MI_IDAHO, MI_STINGER, MI_LINERUN, MI_PEREN, MI_SENTINEL, - MI_RIO, - MI_FIRETRUCK, + MI_PATRIOT, + MI_FIRETRUK, MI_TRASH, MI_STRETCH, MI_MANANA, MI_INFERNUS, - MI_VOODOO, + MI_BLISTA, MI_PONY, MI_MULE, MI_CHEETAH, @@ -304,100 +294,121 @@ enum MI_MOONBEAM, MI_ESPERANT, MI_TAXI, - MI_WASHING, + MI_KURUMA, MI_BOBCAT, MI_MRWHOOP, MI_BFINJECT, - MI_HUNTER, + MI_HEARSE, MI_POLICE, MI_ENFORCER, MI_SECURICA, MI_BANSHEE, - MI_PREDATOR, MI_BUS, MI_RHINO, MI_BARRACKS, - MI_CUBAN, - MI_CHOPPER, - MI_ANGEL, + MI_DODO, MI_COACH, MI_CABBIE, MI_STALLION, MI_RUMPO, MI_RCBANDIT, - MI_ROMERO, - MI_PACKER, - MI_SENTXS, - MI_ADMIRAL, - MI_SQUALO, - MI_SEASPAR, - MI_PIZZABOY, - MI_GANGBUR, - MI_AIRTRAIN, - MI_DEADDODO, - MI_SPEEDER, - MI_REEFER, - MI_TROPIC, + MI_BELLYUP, + MI_MRWONGS, + MI_MAFIA, + MI_YARDIE, + MI_YAKUZA, + MI_DIABLOS, + MI_COLUMB, + MI_HOODS, + MI_PANLANT, MI_FLATBED, MI_YANKEE, - MI_CADDY, - MI_ZEBRA, - MI_TOPFUN, - MI_SKIMMER, + MI_BORGNINE, + MI_TOYZ, + MI_CAMPVAN, + MI_BALLOT, + MI_SHELBY, + MI_PONTIAC, + MI_ESPRIT, + MI_AMMOTRUK, + MI_HOTROD, + MI_SINDACCO_CAR, + MI_FORELLI_CAR, + MI_FERRY, + MI_GHOST, + MI_SPEEDER, + MI_REEFER, + MI_PREDATOR, + MI_TRAIN, + MI_ESCAPE, + MI_CHOPPER, + MI_AIRTRAIN, + MI_DEADDODO, + MI_ANGEL, + MI_PIZZABOY, + MI_NOODLEBOY, MI_PCJ600, MI_FAGGIO, MI_FREEWAY, - MI_RCBARON, - MI_RCRAIDER, - MI_GLENDALE, - MI_OCEANIC, + MI_ANGEL2, + MI_SANCHEZ2, MI_SANCHEZ, + MI_RCGOBLIN, + MI_RCRAIDER, + MI_HUNTER, + MI_MAVERICK, + MI_POLMAV, + MI_VCNMAV, + + MI_LAST_VEHICLE = MI_VCNMAV, + + // HACK HACK, hopefully temporary + MI_SEASPAR = -1000, MI_SPARROW, - MI_PATRIOT, - MI_LOVEFIST, + MI_RCBARON, + MI_TOPFUN, + MI_CADDY, + MI_BAGGAGE, + MI_FBIRANCH, + MI_VICECHEE, + MI_FIRETRUCK, + MI_RIO, + MI_SQUALO, + MI_JETMAX, MI_COASTG, MI_DINGHY, - MI_HERMES, - MI_SABRE, - MI_SABRETUR, + MI_MARQUIS, + MI_SKIMMER, + MI_TROPIC, + MI_SANDKING, + MI_VOODOO, + MI_CUBAN, MI_PHEONIX, - MI_WALTON, - MI_REGINA, MI_COMET, + MI_SABRE, + MI_VIRGO, + MI_RANCHER, + MI_BLISTAC, + MI_WASHING, + MI_ADMIRAL, + MI_SABRETUR, MI_DELUXO, + MI_HOTRING, + MI_REGINA, + MI_SENTXS, + MI_GLENDALE, + MI_OCEANIC, + MI_HERMES, + MI_GREENWOO, + MI_LOVEFIST, + MI_GANGBUR, MI_BURRITO, MI_SPAND, - MI_MARQUIS, - MI_BAGGAGE, - MI_KAUFMAN, - MI_MAVERICK, - MI_VCNMAV, - MI_RANCHER, - MI_FBIRANCH, - MI_VIRGO, - MI_GREENWOO, - MI_JETMAX, - MI_HOTRING, - MI_SANDKING, - MI_BLISTAC, - MI_POLMAV, - MI_BOXVILLE, - MI_BENSON, - MI_MESA, - MI_RCGOBLIN, - MI_HOTRINA, - MI_HOTRINB, - MI_BLOODRA, - MI_BLOODRB, - MI_VICECHEE, - - // HACK - MI_TRAIN = -1, - MI_DODO = -2, - - MI_LAST_VEHICLE = MI_VICECHEE, + MI_PACKER, + MI_WALTON, + MI_ROMERO, - MI_WHEEL_RIM, + MI_WHEEL_RIM = 237, MI_WHEEL_OFFROAD, MI_WHEEL_TRUCK, @@ -458,14 +469,18 @@ enum MI_FINGERS, MI_MINIGUN2, - MI_CUTOBJ01,// = 295, + MI_CUTOBJ01 = 120, MI_CUTOBJ02, MI_CUTOBJ03, MI_CUTOBJ04, MI_CUTOBJ05, + MI_CUTOBJ06, + MI_CUTOBJ07, + MI_CUTOBJ08, + MI_CUTOBJ09, + MI_CUTOBJ10, - - NUM_DEFAULT_MODELS,// = 300 + NUM_DEFAULT_MODELS = 300 }; enum{ diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index 2e6e557e..77275ce7 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -175,7 +175,7 @@ CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID) } } -#define NEAR_DRAW_DIST 0.0f // 100.0f in liberty city +#define NEAR_DRAW_DIST 100.0f // 0.0f in vice city void CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID) diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index c7a41126..6c654284 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -31,6 +31,7 @@ enum eVehicleType { VEHICLE_TYPE_HELI, VEHICLE_TYPE_PLANE, VEHICLE_TYPE_BIKE, + VEHICLE_TYPE_FERRY, NUM_VEHICLE_TYPES }; diff --git a/src/peds/Gangs.cpp b/src/peds/Gangs.cpp index 38e37430..7e120af9 100644 --- a/src/peds/Gangs.cpp +++ b/src/peds/Gangs.cpp @@ -22,23 +22,24 @@ CGangInfo::CGangInfo() : void CGangs::Initialise(void) { - SetGangPedModels(GANG_CUBAN, MI_CBA, MI_CBB); - SetGangPedModels(GANG_HAITIAN, MI_HNA, MI_HNB); - SetGangPedModels(GANG_STREET, MI_SGA, MI_SGB); - SetGangPedModels(GANG_DIAZ, MI_CLA, MI_CLB); - SetGangPedModels(GANG_SECURITY, MI_GDA, MI_GDB); - SetGangPedModels(GANG_BIKER, MI_BKA, MI_BKB); - SetGangPedModels(GANG_PLAYER, MI_PGA, MI_PGB); - SetGangPedModels(GANG_GOLFER, MI_WFOGO, MI_WMOGO); - SetGangVehicleModel(GANG_CUBAN, MI_CUBAN); - SetGangVehicleModel(GANG_HAITIAN, MI_VOODOO); - SetGangVehicleModel(GANG_STREET, MI_GANGBUR); - SetGangVehicleModel(GANG_DIAZ, -1); - SetGangVehicleModel(GANG_SECURITY, -1); - SetGangVehicleModel(GANG_BIKER, MI_ANGEL); - SetGangVehicleModel(GANG_PLAYER, -1); - SetGangVehicleModel(GANG_GOLFER, MI_CADDY); - SetGangWeapons(GANG_GOLFER, WEAPONTYPE_GOLFCLUB, WEAPONTYPE_GOLFCLUB); + SetGangPedModels(GANG_MAFIA, MI_GANG01, MI_GANG02); + SetGangPedModels(GANG_TRIAD, MI_GANG03, MI_GANG04); + SetGangPedModels(GANG_DIABLOS, MI_GANG05, MI_GANG06); + SetGangPedModels(GANG_YAKUZA, MI_GANG07, MI_GANG08); + SetGangPedModels(GANG_YARDIE, MI_GANG09, MI_GANG10); + SetGangPedModels(GANG_COLUMB, MI_GANG11, MI_GANG12); + SetGangPedModels(GANG_HOODS, MI_GANG13, MI_GANG14); + SetGangPedModels(GANG_FORELLI, MI_GANG15, MI_GANG16); + SetGangPedModels(GANG_SINDACCO, MI_GANG17, MI_GANG18); + SetGangVehicleModel(GANG_MAFIA, MI_MAFIA); + SetGangVehicleModel(GANG_TRIAD, MI_BELLYUP); + SetGangVehicleModel(GANG_DIABLOS, MI_DIABLOS); + SetGangVehicleModel(GANG_YAKUZA, MI_YAKUZA); + SetGangVehicleModel(GANG_YARDIE, MI_YARDIE); + SetGangVehicleModel(GANG_COLUMB, MI_COLUMB); + SetGangVehicleModel(GANG_HOODS, MI_HOODS); + SetGangVehicleModel(GANG_FORELLI, MI_FORELLI_CAR); + SetGangVehicleModel(GANG_SINDACCO, MI_SINDACCO_CAR); #ifdef FIX_BUGS for (int i = 0; i < NUM_GANGS; i++) SetGangPedModelOverride(i, -1); diff --git a/src/peds/Gangs.h b/src/peds/Gangs.h index c6381343..acb2fb99 100644 --- a/src/peds/Gangs.h +++ b/src/peds/Gangs.h @@ -17,15 +17,15 @@ struct CGangInfo VALIDATE_SIZE(CGangInfo, 0x10); enum { - GANG_CUBAN = 0, - GANG_HAITIAN, - GANG_STREET, - GANG_DIAZ, - GANG_SECURITY, - GANG_BIKER, - GANG_PLAYER, - GANG_GOLFER, - GANG_9, + GANG_MAFIA = 0, + GANG_TRIAD, + GANG_DIABLOS, + GANG_YAKUZA, + GANG_YARDIE, + GANG_COLUMB, + GANG_HOODS, + GANG_FORELLI, + GANG_SINDACCO, NUM_GANGS }; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index b8afaeab..f597edea 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -9433,7 +9433,7 @@ CPed::SetRadioStation(void) if (IsPlayer() || !m_pMyVehicle || m_pMyVehicle->pDriver != this) return; - if (GetModelIndex() != MI_PGA && GetModelIndex() != MI_PGB) { + if (GetModelIndex() != MI_GANG13 && GetModelIndex() != MI_GANG14) { if (m_pMyVehicle->m_nRadioStation != modelInfo->radio1 && m_pMyVehicle->m_nRadioStation != modelInfo->radio2) { if (CGeneral::GetRandomTrueFalse()) m_pMyVehicle->m_nRadioStation = modelInfo->radio1; diff --git a/src/peds/PedType.h b/src/peds/PedType.h index a4698bbb..776dd14d 100644 --- a/src/peds/PedType.h +++ b/src/peds/PedType.h @@ -95,6 +95,9 @@ VALIDATE_SIZE(CPedType, 0x20); enum ePedStats { + PEDSTAT_COWARD, + PEDSTAT_SHOPPER, + PEDSTAT_OLDSHOPPER, PEDSTAT_PLAYER, PEDSTAT_COP, PEDSTAT_MEDIC, @@ -106,6 +109,8 @@ enum ePedStats PEDSTAT_GANG5, PEDSTAT_GANG6, PEDSTAT_GANG7, + PEDSTAT_GANG8, + PEDSTAT_GANG9, PEDSTAT_STREET_GUY, PEDSTAT_SUIT_GUY, PEDSTAT_SENSIBLE_GUY, @@ -128,13 +133,10 @@ enum ePedStats PEDSTAT_PSYCHO, PEDSTAT_STEWARD, PEDSTAT_SPORTSFAN, - PEDSTAT_SHOPPER, - PEDSTAT_OLDSHOPPER, PEDSTAT_BEACH_GUY, PEDSTAT_BEACH_GIRL, PEDSTAT_SKATER, PEDSTAT_STD_MISSION, - PEDSTAT_COWARD, NUM_PEDSTATS }; diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 7314080b..4284def5 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -558,11 +558,8 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree // Taxi side mission if (CTheScripts::IsPlayerOnAMission()) { CPed *player = FindPlayerPed(); - if (player && player->InVehicle()) { - int32 model = player->m_pMyVehicle->GetModelIndex(); - if (model == MI_TAXI || model == MI_CABBIE || model == MI_ZEBRA || model == MI_KAUFMAN) - missionAndWeatherMult = 1.0f; - } + if (player && player->InVehicle() && player->m_pMyVehicle->IsTaxi()) + missionAndWeatherMult = 1.0f; } if (CDarkel::FrenzyOnGoing()) missionAndWeatherMult = 1.0f; @@ -843,7 +840,7 @@ CPopulation::AddPedInCar(CVehicle* car, bool isDriver) pedType = PEDTYPE_COP; break; default: - if (car->GetModelIndex() == MI_TAXI || car->GetModelIndex() == MI_CABBIE || car->GetModelIndex() == MI_ZEBRA || car->GetModelIndex() == MI_KAUFMAN) { + if (car->IsTaxi()) { if (isDriver) { pedType = PEDTYPE_CIVMALE; preferredModel = MI_TAXI_D; @@ -1210,10 +1207,11 @@ CPopulation::IsSkateable(CVector const& pos) return foundCol.surfaceB == SURFACE_TARMAC || foundCol.surfaceB == SURFACE_PAVEMENT; } +//--LCS: done bool CPopulation::CanJeerAtStripper(int32 model) { - return model == MI_WMOBE || model == MI_WMYBE || model == MI_WMOST || model == MI_BMYBB; + return false; } void @@ -1245,46 +1243,38 @@ bool CPopulation::IsMale(int32 model) { switch (model) { - case MI_HMYST: - case MI_HMOST: - case MI_HMYRI: - case MI_HMORI: - case MI_HMYBE: - case MI_HMOBE: - case MI_HMOTR: - case MI_HMYAP: - case MI_HMOCA: - case MI_BMODK: - case MI_BMYKR: - case MI_BMYST: - case MI_BMOST: - case MI_BMYRI: - case MI_BMYBE: - case MI_BMOBE: - case MI_BMYBU: - case MI_BMOTR: - case MI_BMYPI: - case MI_BMYBB: - case MI_WMYCR: - case MI_WMYST: - case MI_WMOST: - case MI_WMYRI: - case MI_WMORI: - case MI_WMYBE: - case MI_WMOBE: - case MI_WMYCW: - case MI_WMYGO: - case MI_WMOGO: - case MI_WMYLG: - case MI_WMYBU: - case MI_WMOBU: - case MI_WMOTR: - case MI_WMYPI: - case MI_WMOCA: - case MI_WMYJG: - case MI_WMYSK: - - // BUG? Why no JMOTO? + // TODO(LCS): do this right + case MI_TAXI_D: + case MI_PIMP: + case MI_CRIMINAL01: + case MI_CRIMINAL02: + case MI_MALE02: + case MI_MALE03: + case MI_P_MAN1: + case MI_P_MAN2: + case MI_CT_MAN1: + case MI_CT_MAN2: + case MI_LI_MAN1: + case MI_LI_MAN2: + case MI_DOCKER1: + case MI_DOCKER2: + case MI_SCUM_MAN: + case MI_WORKER1: + case MI_WORKER2: + case MI_B_MAN1: + case MI_B_MAN2: + case MI_B_MAN3: + case MI_MOD_MAN: + case MI_ST_MAN: + case MI_FAN_MAN1: + case MI_FAN_MAN2: + case MI_HOS_MAN: + case MI_CONST1: + case MI_CONST2: + case MI_STUD_MAN: + case MI_CAS_MAN: + case MI_CAMP_MAN: + case MI_HITMAN: return true; default: return false; @@ -1295,41 +1285,34 @@ bool CPopulation::IsFemale(int32 model) { switch (model) { - case MI_HFYST: - case MI_HFOST: - case MI_HFYRI: - case MI_HFORI: - case MI_HFYBE: - case MI_HFOBE: - case MI_HFYBU: - case MI_HFYMD: - case MI_HFYCG: - case MI_HFYPR: - case MI_HFOTR: - case MI_BFYST: - case MI_BFOST: - case MI_BFYRI: - case MI_BFORI: - case MI_BFYBE: - case MI_BFOBE: - case MI_BFYPR: - case MI_BFOTR: - case MI_WFYST: - case MI_WFOST: - case MI_WFYRI: - case MI_WFORI: - case MI_WFYBE: - case MI_WFOBE: - case MI_WFOGO: - case MI_WFYLG: - case MI_WFYBU: - case MI_WFYPR: - case MI_WFOTR: - case MI_WFYJG: - case MI_WFYSK: - case MI_WFYSH: - case MI_WFOSH: - case MI_JFOTO: + // TODO(LCS): do this right + case MI_FEMALE01: + case MI_FEMALE02: + case MI_FEMALE03: + case MI_FATFEMALE01: + case MI_FATFEMALE02: + case MI_PROSTITUTE: + case MI_PROSTITUTE2: + case MI_P_WOM1: + case MI_P_WOM2: + case MI_CT_WOM1: + case MI_CT_WOM2: + case MI_LI_WOM1: + case MI_LI_WOM2: + case MI_SCUM_WOM: + case MI_B_WOM1: + case MI_B_WOM2: + case MI_B_WOM3: + case MI_MOD_WOM: + case MI_ST_WOM: + case MI_FAN_WOM: + case MI_HOS_WOM: + case MI_SHOPPER1: + case MI_SHOPPER2: + case MI_SHOPPER3: + case MI_STUD_WOM: + case MI_CAS_WOM: + case MI_CAMP_WOM: return true; default: return false; @@ -1339,23 +1322,7 @@ CPopulation::IsFemale(int32 model) bool CPopulation::IsSunbather(int32 model) { - switch (model) { - case MI_HFYBE: - case MI_HFOBE: - case MI_HMYBE: - case MI_HMOBE: - case MI_BFYBE: - case MI_BMYBE: - case MI_BFOBE: - case MI_BMOBE: - case MI_WFYBE: - case MI_WMYBE: - case MI_WFOBE: - case MI_WMOBE: - return true; - default: - return false; - } + return false; } int32 @@ -1367,13 +1334,13 @@ CPopulation::ComputeRandomisedGangSize(void) bool CPopulation::CanSolicitPlayerInCar(int32 model) { - return model == MI_HFYPR || model == MI_BFYPR || model == MI_WFYPR; + return model == MI_PROSTITUTE || model == MI_PROSTITUTE2; } bool CPopulation::CanSolicitPlayerOnFoot(int32 model) { - return model == MI_HFYMD || model == MI_HFYCG || model == MI_BFOTR || model == MI_BMOTR || model == MI_WFOTR || model == MI_WMOTR; + return model == MI_B_WOM3 || model == MI_FEMALE01 || model == MI_FEMALE02 || model == MI_FEMALE03; } bool diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 157be0c8..be5c0d6f 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -417,8 +417,9 @@ void CMovingThings::Init() } } - CEscalators::Init(); - aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f); +// LCS: removed +// CEscalators::Init(); +// aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f); } void CMovingThings::Shutdown() diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index b1cce8e2..4eed988d 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -186,7 +186,7 @@ CSpecialFX::Render2DFXs(void) CFont::SetCentreOff(); CFont::SetPropOn(); CFont::SetColor(CRGBA(0, 255, 0, 200)); - FONT_LOCALE(FONT_STANDARD); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); sprintf(gString, "%d", CTimer::GetFrameCounter() & 0x3F); // mb % 63 AsciiToUnicode(gString, gUString); CFont::PrintString(SCREEN_WIDTH * 8 / 10, SCREEN_HEIGHT * 8 / 10, gUString); @@ -211,7 +211,7 @@ CSpecialFX::Render2DFXs(void) CFont::SetCentreOff(); CFont::SetPropOn(); CFont::SetColor(CRGBA(100, 100, 100, 200)); - FONT_LOCALE(FONT_STANDARD); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::PrintString(SCREEN_WIDTH * 8 / 10, SCREEN_HEIGHT * 8 / 10, gUString); for (int32 i = 0; i < SCREEN_HEIGHT; i += 4) { RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index b20a2443..3cb5a0b0 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -136,6 +136,61 @@ float CTimeCycle::m_fShadowSideY[16]; float CTimeCycle::m_fShadowDisplacementX[16]; float CTimeCycle::m_fShadowDisplacementY[16]; + + +static float tmp_nAmbientRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nDirectionalRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyTopRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoreRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fSunSize[NUMHOURS][NUMWEATHERS]; +static float tmp_fSpriteSize[NUMHOURS][NUMWEATHERS]; +static float tmp_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; +static float tmp_nShadowStrength[NUMHOURS][NUMWEATHERS]; +static float tmp_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; +static float tmp_nPoleShadowStrength[NUMHOURS][NUMWEATHERS]; +static float tmp_fFogStart[NUMHOURS][NUMWEATHERS]; +static float tmp_fFarClip[NUMHOURS][NUMWEATHERS]; +static float tmp_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; +static float tmp_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fBlurRed[NUMHOURS][NUMWEATHERS]; +static float tmp_fBlurGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_fBlurBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterRed[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterAlpha[NUMHOURS][NUMWEATHERS]; + void CTimeCycle::Initialise(void) { @@ -172,8 +227,9 @@ CTimeCycle::Initialise(void) for(w = 0; w < NUMWEATHERS; w++) for(h = 0; h < NUMHOURS; h++){ li = 0; - while(work_buff[bi] == '/'){ - while(work_buff[bi] != '\n') + while(work_buff[bi] == '/' || work_buff[bi] == '\n' || + work_buff[bi] == '\0' || work_buff[bi] == '\r'){ + while(work_buff[bi] != '\n' && work_buff[bi] != '\0' && work_buff[bi] != '\r') bi++; bi++; } @@ -208,65 +264,180 @@ CTimeCycle::Initialise(void) &blurR, &blurG, &blurB, &waterR, &waterG, &waterB, &waterA); - m_nAmbientRed[h][w] = ambR; - m_nAmbientGreen[h][w] = ambG; - m_nAmbientBlue[h][w] = ambB; - m_nAmbientRed_Obj[h][w] = ambobjR; - m_nAmbientGreen_Obj[h][w] = ambobjG; - m_nAmbientBlue_Obj[h][w] = ambobjB; - m_nAmbientRed_Bl[h][w] = ambblR; - m_nAmbientGreen_Bl[h][w] = ambblG; - m_nAmbientBlue_Bl[h][w] = ambblB; - m_nAmbientRed_Obj_Bl[h][w] = ambobjblR; - m_nAmbientGreen_Obj_Bl[h][w] = ambobjblG; - m_nAmbientBlue_Obj_Bl[h][w] = ambobjblB; - m_nDirectionalRed[h][w] = dirR; - m_nDirectionalGreen[h][w] = dirG; - m_nDirectionalBlue[h][w] = dirB; - m_nSkyTopRed[h][w] = skyTopR; - m_nSkyTopGreen[h][w] = skyTopG; - m_nSkyTopBlue[h][w] = skyTopB; - m_nSkyBottomRed[h][w] = skyBotR; - m_nSkyBottomGreen[h][w] = skyBotG; - m_nSkyBottomBlue[h][w] = skyBotB; - m_nSunCoreRed[h][w] = sunCoreR; - m_nSunCoreGreen[h][w] = sunCoreG; - m_nSunCoreBlue[h][w] = sunCoreB; - m_nSunCoronaRed[h][w] = sunCoronaR; - m_nSunCoronaGreen[h][w] = sunCoronaG; - m_nSunCoronaBlue[h][w] = sunCoronaB; - m_fSunSize[h][w] = sunSz * 10.0f; - m_fSpriteSize[h][w] = sprSz * 10.0f; - m_fSpriteBrightness[h][w] = sprBght * 10.0f; - m_nShadowStrength[h][w] = shad; - m_nLightShadowStrength[h][w] = lightShad; - m_nPoleShadowStrength[h][w] = poleShad; - m_fFarClip[h][w] = farClp; - m_fFogStart[h][w] = fogSt; - m_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f; - m_nLowCloudsRed[h][w] = cloudR; - m_nLowCloudsGreen[h][w] = cloudG; - m_nLowCloudsBlue[h][w] = cloudB; - m_nFluffyCloudsTopRed[h][w] = fluffyTopR; - m_nFluffyCloudsTopGreen[h][w] = fluffyTopG; - m_nFluffyCloudsTopBlue[h][w] = fluffyTopB; - m_nFluffyCloudsBottomRed[h][w] = fluffyBotR; - m_nFluffyCloudsBottomGreen[h][w] = fluffyBotG; - m_nFluffyCloudsBottomBlue[h][w] = fluffyBotB; - m_fBlurRed[h][w] = blurR; - m_fBlurGreen[h][w] = blurG; - m_fBlurBlue[h][w] = blurB; - m_fWaterRed[h][w] = waterR; - m_fWaterGreen[h][w] = waterG; - m_fWaterBlue[h][w] = waterB; - m_fWaterAlpha[h][w] = waterA; + tmp_nAmbientRed[h][w] = ambR; + tmp_nAmbientGreen[h][w] = ambG; + tmp_nAmbientBlue[h][w] = ambB; + tmp_nAmbientRed_Obj[h][w] = ambobjR; + tmp_nAmbientGreen_Obj[h][w] = ambobjG; + tmp_nAmbientBlue_Obj[h][w] = ambobjB; + tmp_nAmbientRed_Bl[h][w] = ambblR; + tmp_nAmbientGreen_Bl[h][w] = ambblG; + tmp_nAmbientBlue_Bl[h][w] = ambblB; + tmp_nAmbientRed_Obj_Bl[h][w] = ambobjblR; + tmp_nAmbientGreen_Obj_Bl[h][w] = ambobjblG; + tmp_nAmbientBlue_Obj_Bl[h][w] = ambobjblB; + tmp_nDirectionalRed[h][w] = dirR; + tmp_nDirectionalGreen[h][w] = dirG; + tmp_nDirectionalBlue[h][w] = dirB; + tmp_nSkyTopRed[h][w] = skyTopR; + tmp_nSkyTopGreen[h][w] = skyTopG; + tmp_nSkyTopBlue[h][w] = skyTopB; + tmp_nSkyBottomRed[h][w] = skyBotR; + tmp_nSkyBottomGreen[h][w] = skyBotG; + tmp_nSkyBottomBlue[h][w] = skyBotB; + tmp_nSunCoreRed[h][w] = sunCoreR; + tmp_nSunCoreGreen[h][w] = sunCoreG; + tmp_nSunCoreBlue[h][w] = sunCoreB; + tmp_nSunCoronaRed[h][w] = sunCoronaR; + tmp_nSunCoronaGreen[h][w] = sunCoronaG; + tmp_nSunCoronaBlue[h][w] = sunCoronaB; + if(sunSz == -1) + tmp_fSunSize[h][w] = -1; + else + tmp_fSunSize[h][w] = sunSz * 10.0f; + if(sprSz == -1) + tmp_fSpriteSize[h][w] = -1; + else + tmp_fSpriteSize[h][w] = sprSz * 10.0f; + if(sprBght == -1) + tmp_fSpriteBrightness[h][w] = -1; + else + tmp_fSpriteBrightness[h][w] = sprBght * 10.0f; + tmp_nShadowStrength[h][w] = shad; + tmp_nLightShadowStrength[h][w] = lightShad; + tmp_nPoleShadowStrength[h][w] = poleShad; + tmp_fFarClip[h][w] = farClp; + tmp_fFogStart[h][w] = fogSt; + if(lightGnd == -1) + tmp_fLightsOnGroundBrightness[h][w] = -1; + else + tmp_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f; + tmp_nLowCloudsRed[h][w] = cloudR; + tmp_nLowCloudsGreen[h][w] = cloudG; + tmp_nLowCloudsBlue[h][w] = cloudB; + tmp_nFluffyCloudsTopRed[h][w] = fluffyTopR; + tmp_nFluffyCloudsTopGreen[h][w] = fluffyTopG; + tmp_nFluffyCloudsTopBlue[h][w] = fluffyTopB; + tmp_nFluffyCloudsBottomRed[h][w] = fluffyBotR; + tmp_nFluffyCloudsBottomGreen[h][w] = fluffyBotG; + tmp_nFluffyCloudsBottomBlue[h][w] = fluffyBotB; + tmp_fBlurRed[h][w] = blurR; + tmp_fBlurGreen[h][w] = blurG; + tmp_fBlurBlue[h][w] = blurB; + tmp_fWaterRed[h][w] = waterR; + tmp_fWaterGreen[h][w] = waterG; + tmp_fWaterBlue[h][w] = waterB; + tmp_fWaterAlpha[h][w] = waterA; } + UpdateArrays(); + m_FogReduction = 0; debug("CTimeCycle ready\n"); } +template<typename T> void +FillGaps(T (*out)[NUMWEATHERS], float (*in)[NUMWEATHERS]) +{ + int w; + for(w = 0; w < NUMWEATHERS; w++){ + for(int h = 0; h < NUMHOURS; h++) + out[h][w] = in[h][w]; + +#define NEXT(h) (((h)+1)%NUMHOURS) +#define PREV(h) (((h)+NUMHOURS-1)%NUMHOURS) + int hend, h1, h2; + for(hend = 0; hend < NUMHOURS; hend++) + if(in[hend][w] != -1.0f) + goto foundstart; + return; // this should never happen +foundstart: + // Found the start of a block of filled in entries + for(h1 = NEXT(hend); h1 != hend; h1 = h2){ + // Skip filled in entries + for(; h1 != hend; h1 = NEXT(h1)) + if(in[h1][w] == -1.0f) + goto foundfirst; + break; // all filled in already +foundfirst: + // h1 is now the first -1 after n filled in values + for(h2 = NEXT(h1); ; h2 = NEXT(h2)) + if(in[h2][w] != -1.0f) + goto foundlast; + break; +foundlast: + // h2 is now the first entry after a row of -1s + h1 = PREV(h1); // make h1 the first before a row of -1s + int n = (h2-h1 + NUMHOURS) % NUMHOURS; + if(n == 0) n = NUMHOURS; // can't happen + float step = (in[h2][w] - in[h1][w])/n; + + for(int i = 1; i < n; i++){ + float f = (float)i/n; + out[(h1+i)%NUMHOURS][w] = in[h2][w]*f + in[h1][w]*(1.0f-f); + } + } + } +} + +void +CTimeCycle::UpdateArrays(void) +{ + FillGaps(m_nAmbientRed, tmp_nAmbientRed); + FillGaps(m_nAmbientGreen, tmp_nAmbientGreen); + FillGaps(m_nAmbientBlue, tmp_nAmbientBlue); + FillGaps(m_nAmbientRed_Obj, tmp_nAmbientRed_Obj); + FillGaps(m_nAmbientGreen_Obj, tmp_nAmbientGreen_Obj); + FillGaps(m_nAmbientBlue_Obj, tmp_nAmbientBlue_Obj); + FillGaps(m_nAmbientRed_Bl, tmp_nAmbientRed_Bl); + FillGaps(m_nAmbientGreen_Bl, tmp_nAmbientGreen_Bl); + FillGaps(m_nAmbientBlue_Bl, tmp_nAmbientBlue_Bl); + FillGaps(m_nAmbientRed_Obj_Bl, tmp_nAmbientRed_Obj_Bl); + FillGaps(m_nAmbientGreen_Obj_Bl, tmp_nAmbientGreen_Obj_Bl); + FillGaps(m_nAmbientBlue_Obj_Bl, tmp_nAmbientBlue_Obj_Bl); + FillGaps(m_nDirectionalRed, tmp_nDirectionalRed); + FillGaps(m_nDirectionalGreen, tmp_nDirectionalGreen); + FillGaps(m_nDirectionalBlue, tmp_nDirectionalBlue); + FillGaps(m_nSkyTopRed, tmp_nSkyTopRed); + FillGaps(m_nSkyTopGreen, tmp_nSkyTopGreen); + FillGaps(m_nSkyTopBlue, tmp_nSkyTopBlue); + FillGaps(m_nSkyBottomRed, tmp_nSkyBottomRed); + FillGaps(m_nSkyBottomGreen, tmp_nSkyBottomGreen); + FillGaps(m_nSkyBottomBlue, tmp_nSkyBottomBlue); + FillGaps(m_nSunCoreRed, tmp_nSunCoreRed); + FillGaps(m_nSunCoreGreen, tmp_nSunCoreGreen); + FillGaps(m_nSunCoreBlue, tmp_nSunCoreBlue); + FillGaps(m_nSunCoronaRed, tmp_nSunCoronaRed); + FillGaps(m_nSunCoronaGreen, tmp_nSunCoronaGreen); + FillGaps(m_nSunCoronaBlue, tmp_nSunCoronaBlue); + FillGaps(m_fSunSize, tmp_fSunSize); + FillGaps(m_fSpriteSize, tmp_fSpriteSize); + FillGaps(m_fSpriteBrightness, tmp_fSpriteBrightness); + FillGaps(m_nShadowStrength, tmp_nShadowStrength); + FillGaps(m_nLightShadowStrength, tmp_nLightShadowStrength); + FillGaps(m_nPoleShadowStrength, tmp_nPoleShadowStrength); + FillGaps(m_fFogStart, tmp_fFogStart); + FillGaps(m_fFarClip, tmp_fFarClip); + FillGaps(m_fLightsOnGroundBrightness, tmp_fLightsOnGroundBrightness); + FillGaps(m_nLowCloudsRed, tmp_nLowCloudsRed); + FillGaps(m_nLowCloudsGreen, tmp_nLowCloudsGreen); + FillGaps(m_nLowCloudsBlue, tmp_nLowCloudsBlue); + FillGaps(m_nFluffyCloudsTopRed, tmp_nFluffyCloudsTopRed); + FillGaps(m_nFluffyCloudsTopGreen, tmp_nFluffyCloudsTopGreen); + FillGaps(m_nFluffyCloudsTopBlue, tmp_nFluffyCloudsTopBlue); + FillGaps(m_nFluffyCloudsBottomRed, tmp_nFluffyCloudsBottomRed); + FillGaps(m_nFluffyCloudsBottomGreen, tmp_nFluffyCloudsBottomGreen); + FillGaps(m_nFluffyCloudsBottomBlue, tmp_nFluffyCloudsBottomBlue); + FillGaps(m_fBlurRed, tmp_fBlurRed); + FillGaps(m_fBlurGreen, tmp_fBlurGreen); + FillGaps(m_fBlurBlue, tmp_fBlurBlue); + FillGaps(m_fWaterRed, tmp_fWaterRed); + FillGaps(m_fWaterGreen, tmp_fWaterGreen); + FillGaps(m_fWaterBlue, tmp_fWaterBlue); + FillGaps(m_fWaterAlpha, tmp_fWaterAlpha); +} + static float interp_c0, interp_c1, interp_c2, interp_c3; float CTimeCycle::Interpolate(int8 *a, int8 *b) diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index da911b75..d8c333f6 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -185,6 +185,7 @@ public: static int32 GetWaterAlpha(void) { return m_fCurrentWaterAlpha; } static void Initialise(void); + static void UpdateArrays(void); static void Update(void); static float Interpolate(int8 *a, int8 *b); static float Interpolate(uint8 *a, uint8 *b); diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index 5a497ddf..d0c64eb4 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -1,6 +1,6 @@ #pragma once -#define WATER_X_OFFSET (400.0f) +#define WATER_X_OFFSET (0.0f) #define WATER_Z_OFFSET (0.5f) diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp index e0dff850..19115ba8 100644 --- a/src/rw/Lights.cpp +++ b/src/rw/Lights.cpp @@ -26,12 +26,7 @@ RwRGBAReal DirectionalLightColourForFrame; RwRGBAReal AmbientLightColour; RwRGBAReal DirectionalLightColour; -#ifdef EXTENDED_COLOURFILTER -#include "postfx.h" -#define USEBLURCOLORS CPostFX::UseBlurColours() -#else -#define USEBLURCOLORS CMBlur::BlurOn -#endif +#define USEBLURCOLORS true // actually CMBlur::BlurOn, but that's always supposed to be on void SetLightsWithTimeOfDayColour(RpWorld *) diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index cab3b68c..38a0f613 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -18,7 +18,7 @@ bool gPS2alphaTest = true; #else bool gPS2alphaTest = false; #endif -bool gBackfaceCulling = true; +bool gBackfaceCulling = false; // can we ever enable this in LCS even? #if !defined(FINAL) || defined(DEBUGMENU) static bool charsetOpen; diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 83c3c5bc..b06c847c 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -632,8 +632,9 @@ CVisibilityPlugins::RenderVehicleTailRotorAlphaCB(RpAtomic *atomic) RpAtomic* CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic) { - if(CWorld::Players[0].m_pSkinTexture) - RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture); +// LCS: removed +// if(CWorld::Players[0].m_pSkinTexture) +// RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture); RENDERCALLBACK(atomic); return atomic; } diff --git a/src/skel/win/gtalcs.ico b/src/skel/win/gtalcs.ico Binary files differnew file mode 100644 index 00000000..c4b53436 --- /dev/null +++ b/src/skel/win/gtalcs.ico diff --git a/src/skel/win/gtavc.ico b/src/skel/win/gtavc.ico Binary files differdeleted file mode 100644 index d253ff2c..00000000 --- a/src/skel/win/gtavc.ico +++ /dev/null diff --git a/src/skel/win/win.rc b/src/skel/win/win.rc index 9b5aa305..702c3de7 100644 --- a/src/skel/win/win.rc +++ b/src/skel/win/win.rc @@ -42,6 +42,6 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_MAIN_ICON ICON DISCARDABLE "gtavc.ico" +IDI_MAIN_ICON ICON DISCARDABLE "gtalcs.ico" /////////////////////////////////////////////////////////////////////////////
\ No newline at end of file diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 5f7a07cc..a11acd26 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -13,7 +13,7 @@ static wchar WideErrorString[25]; -CText TheText; +CText *CText::msInstance = nil; CText::CText(void) { @@ -41,7 +41,7 @@ CText::Load(void) CFileMgr::SetDir("TEXT"); switch(FrontEndMenuManager.m_PrefsLanguage){ case CMenuManager::LANGUAGE_AMERICAN: - sprintf(filename, "AMERICAN.GXT"); + sprintf(filename, "ENGLISH.GXT"); break; case CMenuManager::LANGUAGE_FRENCH: sprintf(filename, "FRENCH.GXT"); @@ -93,11 +93,13 @@ CText::Load(void) keyArray.Update(data.chars); CFileMgr::CloseFile(file); CFileMgr::SetDir(""); + bIsLoaded = true; } void CText::Unload(void) { + bIsLoaded = false; CMessages::ClearAllMessagesDisplayedByGame(); keyArray.Unload(); data.Unload(); @@ -307,6 +309,11 @@ CText::LoadMissionText(char *MissionTableName) bIsMissionTextLoaded = true; } +bool +CText::IsLoaded() +{ + return bIsLoaded; +} void CKeyArray::Load(size_t length, int file, size_t* offset) diff --git a/src/text/Text.h b/src/text/Text.h index 33dc313e..3e11ea46 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -58,7 +58,7 @@ public: uint32 offset; }; - enum {MAX_MISSION_TEXTS = 90}; // beware that LCS has more + enum {MAX_MISSION_TEXTS = 200}; Entry data[MAX_MISSION_TEXTS]; uint16 size; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready. @@ -84,6 +84,9 @@ class CText bool bIsMissionTextLoaded; char szMissionTableName[8]; CMissionTextOffsets MissionTextOffsets; + bool bIsLoaded; + + static CText *msInstance; public: CText(void); void Load(void); @@ -94,6 +97,15 @@ public: void GetNameOfLoadedMissionText(char *outName); void ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *bytes_read); void LoadMissionText(char *MissionTableName); + bool IsLoaded(); + void GetUTF8(const char*, char*, int); // TODO but unused + + static CText &Instance() + { + if (!msInstance) + msInstance = new CText; + return *msInstance; + } }; -extern CText TheText; +#define TheText CText::Instance() diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index a946bacb..028cd9cd 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -2193,8 +2193,7 @@ CAutomobile::PreRender(void) case MI_TAXI: case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: + case MI_BORGNINE: if(bTaxiLight){ CVector pos = GetPosition() + GetUp()*0.95f; CCoronas::RegisterCorona((uintptr)this + 21, diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 8433a0ba..ffcb80d0 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -62,6 +62,7 @@ void CCranes::InitCranes(void) } } } +/* // TODO(LCS) for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_MAINLAND).first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; if (MODELID_CRANE_1 == pEntity->GetModelIndex() || @@ -72,6 +73,7 @@ void CCranes::InitCranes(void) MODELID_CRANE_6 == pEntity->GetModelIndex()) AddThisOneCrane(pEntity); } +*/ } void CCranes::AddThisOneCrane(CEntity* pEntity) diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 611ddcc9..040b6972 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -44,6 +44,7 @@ const char VehicleNames[NUMHANDLINGS][14] = { "RHINO", "BARRACKS", "TRAIN", + "FERRY", "HELI", "DODO", "COACH", @@ -56,66 +57,40 @@ const char VehicleNames[NUMHANDLINGS][14] = { "DEADDODO", "FLATBED", "YANKEE", - "GOLFCART", - "VOODOO", - "WASHING", - "CUBAN", - "ROMERO", - "PACKER", - "ADMIRAL", - "GANGBUR", - "ZEBRA", - "TOPFUN", - "GLENDALE", - "OCEANIC", - "HERMES", - "SABRE1", - "SABRETUR", - "PHEONIX", - "WALTON", - "REGINA", - "COMET", - "DELUXO", - "BURRITO", - "SPAND", - "BAGGAGE", - "KAUFMAN", - "RANCHER", - "FBIRANCH", - "VIRGO", - "GREENWOO", - "HOTRING", - "SANDKING", - "BLISTAC", - "BOXVILLE", - "BENSON", - "DESPERAD", - "LOVEFIST", - "BLOODRA", - "BLOODRB", + "BLISTA", + "BELLYUP", + "MRWONGS", + "YARDIE", + "YAKUZA", + "DIABLOS", + "COLUMB", + "HOODS", + "PANLANT", + "BORGNINE", + "CAMPVAN", + "BALLOT", + "SPIDER", + "SHELBY", + "PONTIAC", + "ESPRIT", + "MINI", + "HOTROD", + "SINDACCO", + "FORELLI", "BIKE", "MOPED", "DIRTBIKE", "ANGEL", + "DIRTBIK2", + "ANGE2", "FREEWAY", "PREDATOR", "SPEEDER", "REEFER", - "RIO", - "SQUALO", - "TROPIC", - "COASTGRD", - "DINGHY", - "MARQUIS", - "CUPBOAT", - "SEAPLANE", - "SPARROW", - "SEASPAR", "MAVERICK", "COASTMAV", "POLMAV", "HUNTER", - "RCBARON", "RCGOBLIN", "RCCOPTER" }; @@ -350,7 +325,7 @@ void cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling) { // convert distance to m, time to 1/50s - float velocity, a, b, specificVolume; + float velocity, a, b; handling->Transmission.fEngineAcceleration *= 1.0f/(50.0f*50.0f); handling->Transmission.fMaxVelocity *= 1000.0f/(60.0f*60.0f * 50.0f); @@ -422,15 +397,15 @@ cHandlingDataMgr::GetHandlingId(const char *name) tFlyingHandlingData* cHandlingDataMgr::GetFlyingPointer(uint8 id) { - if(id >= HANDLING_SEAPLANE && id <= HANDLING_RCCOPTER) - return &FlyingHandlingData[id-HANDLING_SEAPLANE]; + if(id >= HANDLING_MAVERICK && id <= HANDLING_RCCOPTER) + return &FlyingHandlingData[id-HANDLING_MAVERICK]; return &FlyingHandlingData[0]; } tBoatHandlingData* cHandlingDataMgr::GetBoatPointer(uint8 id) { - if(id >= HANDLING_PREDATOR && id <= HANDLING_SEAPLANE) + if(id >= HANDLING_PREDATOR && id <= HANDLING_MAVERICK) return &BoatHandlingData[id-HANDLING_PREDATOR]; return &BoatHandlingData[0]; } diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 446395f2..e6b5236f 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -36,6 +36,7 @@ enum tVehicleType HANDLING_RHINO, HANDLING_BARRACKS, HANDLING_TRAIN, + HANDLING_FERRY, HANDLING_HELI, HANDLING_DODO, HANDLING_COACH, @@ -48,76 +49,51 @@ enum tVehicleType HANDLING_DEADDODO, HANDLING_FLATBED, HANDLING_YANKEE, - HANDLING_GOLFCART, - HANDLING_VOODOO, - HANDLING_WASHING, - HANDLING_CUBAN, - HANDLING_ROMERO, - HANDLING_PACKER, - HANDLING_ADMIRAL, - HANDLING_GANGBUR, - HANDLING_ZEBRA, - HANDLING_TOPFUN, - HANDLING_GLENDALE, - HANDLING_OCEANIC, - HANDLING_HERMES, - HANDLING_SABRE1, - HANDLING_SABRETUR, - HANDLING_PHEONIX, - HANDLING_WALTON, - HANDLING_REGINA, - HANDLING_COMET, - HANDLING_DELUXO, - HANDLING_BURRITO, - HANDLING_SPAND, - HANDLING_BAGGAGE, - HANDLING_KAUFMAN, - HANDLING_RANCHER, - HANDLING_FBIRANCH, - HANDLING_VIRGO, - HANDLING_GREENWOO, - HANDLING_HOTRING, - HANDLING_SANDKING, - HANDLING_BLISTAC, - HANDLING_BOXVILLE, - HANDLING_BENSON, - HANDLING_DESPERAD, - HANDLING_LOVEFIST, - HANDLING_BLOODRA, - HANDLING_BLOODRB, + HANDLING_BLISTA, + HANDLING_BELLYUP, + HANDLING_MRWONGS, + HANDLING_YARDIE, + HANDLING_YAKUZA, + HANDLING_DIABLOS, + HANDLING_COLUMB, + HANDLING_HOODS, + HANDLING_PANLANT, + HANDLING_BORGNINE, + HANDLING_CAMPVAN, + HANDLING_BALLOT, + HANDLING_SPIDER, + HANDLING_SHELBY, + HANDLING_PONTIAC, + HANDLING_ESPRIT, + HANDLING_MINI, + HANDLING_HOTROD, + HANDLING_SINDACCO, + HANDLING_FORELLI, HANDLING_BIKE, HANDLING_MOPED, HANDLING_DIRTBIKE, HANDLING_ANGEL, + HANDLING_DIRTBIK2, + HANDLING_ANGE2, HANDLING_FREEWAY, HANDLING_PREDATOR, HANDLING_SPEEDER, HANDLING_REEFER, - HANDLING_RIO, - HANDLING_SQUALO, - HANDLING_TROPIC, - HANDLING_COASTGRD, - HANDLING_DINGHY, - HANDLING_MARQUIS, - HANDLING_CUPBOAT, - HANDLING_SEAPLANE, // both boat and plane! - HANDLING_SPARROW, - HANDLING_SEASPAR, + HANDLING_MAVERICK, HANDLING_COASTMAV, HANDLING_POLMAV, HANDLING_HUNTER, - HANDLING_RCBARON, HANDLING_RCGOBLIN, HANDLING_RCCOPTER, NUMHANDLINGS, NUMBIKEHANDLINGS = HANDLING_FREEWAY+1 - HANDLING_BIKE, - NUMFLYINGHANDLINGS = HANDLING_RCCOPTER+1 - HANDLING_SEAPLANE, - NUMBOATHANDLINGS = HANDLING_SEAPLANE+1 - HANDLING_PREDATOR, + NUMFLYINGHANDLINGS = HANDLING_RCCOPTER+1 - HANDLING_MAVERICK, + NUMBOATHANDLINGS = HANDLING_COASTMAV+1 - HANDLING_PREDATOR, }; enum tField // most likely a handling field enum, never used so :shrug: diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 1849fd7f..c2bca63e 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1841,8 +1841,7 @@ CVehicle::SetDriver(CPed *driver) case MI_TAXI: case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: + case MI_BORGNINE: CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 12; break; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 7388bfab..795161bf 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -384,8 +384,8 @@ public: bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } - bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; } - bool IsLimo(void) { return GetModelIndex() == MI_STRETCH || GetModelIndex() == MI_LOVEFIST; } + bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } + bool IsLimo(void) { return GetModelIndex() == MI_STRETCH; } bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); } bool IsRealPlane(void) { return !!(pHandling->Flags & HANDLING_IS_PLANE); } diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index bb1f44e9..fcb3a80f 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -14394,6 +14394,9 @@ XBOX [FEC_IVP] INVERT PAD VERTICALLY +[FEM_NON] +NONE + { end of file } [DUMMY] THIS LABEL NEEDS TO BE HERE !!! |