CookiePLMonster / SilentPatch

SilentPatch for GTA III, Vice City, and San Andreas
MIT License
137 stars 8 forks source link

GTA III/VC/SA: Randomness of vehicles not turning on headlights during rain/fog is broken on PC #2

Closed CookiePLMonster closed 2 days ago

CookiePLMonster commented 8 months ago

In CAutomobile::PreRender there is

      if ( !v76
        && (double)(unsigned __int16)this->__parent.__parent.__parent.m_nRandom * f1_div_50000 < CWeather::Foggyness )
      {
        v74 = 0;
      }
      if ( !v74
        && (double)(unsigned __int16)this->__parent.__parent.__parent.m_nRandom * f1_div_50000 < CWeather::WetRoads )
      {
        v72 = 0;
      }

which is eventually never going to be true on PC, because m_nRandom can only go up to to 0x7FFF and the weather constants are from 0 to 1. On PS2 with its 0xFFFF max random value it means some cars will never turn on their headlights, on PC they eventually all will.