diff --git a/src/audio/oal/channel.cpp b/src/audio/oal/channel.cpp index 519ecf040..7d06d3de4 100644 --- a/src/audio/oal/channel.cpp +++ b/src/audio/oal/channel.cpp @@ -9,7 +9,11 @@ #endif extern bool IsFXSupported(); +#ifdef FIX_BUGS +// Defined in sampman_oal.cpp behind the same guard, so without one here the Vanilla +// configuration references a symbol that was never emitted and fails at link (LNK2001). extern size_t gPlayerTalkDataSize; +#endif ALuint alSources[NUM_CHANNELS]; ALuint alFilters[NUM_CHANNELS]; @@ -26,7 +30,11 @@ CChannel::InitChannels() if (IsFXSupported()) alGenFilters(NUM_CHANNELS, alFilters); +#ifdef FIX_BUGS tempStereoBuffer = new uint8[Max(PED_BLOCKSIZE, gPlayerTalkDataSize) * 2]; +#else + tempStereoBuffer = new uint8[PED_BLOCKSIZE * 2]; +#endif bChannelsCreated = true; } diff --git a/src/renderer/Coronas.cpp b/src/renderer/Coronas.cpp index c44e07b42..0836a4f3d 100644 --- a/src/renderer/Coronas.cpp +++ b/src/renderer/Coronas.cpp @@ -913,9 +913,21 @@ CEntity::ProcessLightsForEntity(void) effect->light.shadowSize, 0.0f, 0.0f, -effect->light.shadowSize, 128, +#ifdef FIX_BUGS + // StoreStaticShadow takes these as uint8 and nothing bounds them on + // the way in, so a value past 255 wraps instead of clipping and the + // decal comes out dark rather than merely too bright. Retail data + // stops at exactly 255 (sprBght tops out at 1.00 in timecyc.dat), + // but the parser stores sprBght*10 in an int8, so anything asking + // for more than 1.0 is already over. + Min(effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, 255.0f), + Min(effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, 255.0f), + Min(effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, 255.0f), +#else effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, +#endif 15.0f, 1.0f, 40.0f, false, 0.0f); }else if(lightFlickering){ CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 9b190a4a1..3587ea220 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -296,12 +296,16 @@ bool CanVideoCardDoDXT(void) { #ifdef LIBRW - // TODO -#ifdef RW_OPENGL - return false; -#else - return true; -#endif + // Answering "no" unconditionally is not free: CStreaming::Init then builds + // MODELS\TXD.IMG, repacking every texture dictionary out of its D3D8 container, and + // TXD.DIR is scanned before GTA3.DIR - so that copy is what gets read from then on and + // the originals are shadowed. On the retail PC data that is 1360 dictionaries, ~180 MB + // of duplicate and a conversion pass on first run, for a card that can read the + // originals directly. GetGPUcaps already asks librw the same question, so ask it here: + // desktop GL has S3TC, and a GLES device without it still takes the conversion path. + GPUcaps caps; + GetGPUcaps(&caps); + return !!caps.dxtSupport; #else return _rwD3D8CheckValidTextureFormat(D3DFMT_DXT1) && _rwD3D8CheckValidTextureFormat(D3DFMT_DXT3); #endif