# HG changeset patch # User Gloval # Date 1363985670 -14400 # Node ID 5ba796adbf5e7e438f2184d12644c398dc7f5b0d # Parent e13ce1b0930de85aacb32eb41e73afe223f05b10# Parent 23a07ead5980793b5c5cf08859a61b7345707a2e Merge diff -r e13ce1b0930d -r 5ba796adbf5e Outdoor.cpp --- a/Outdoor.cpp Sat Mar 23 00:53:15 2013 +0400 +++ b/Outdoor.cpp Sat Mar 23 00:54:30 2013 +0400 @@ -171,7 +171,7 @@ { if ( pParty->uCurrentHour < 0x14 ) { - pWeather->field_FA0 = 0; + pWeather->bNight = 0; v2 = 0.0; return v2 * 0.016666668; } @@ -183,13 +183,13 @@ } LABEL_9: v2 = 60.0; - pWeather->field_FA0 = 1; + pWeather->bNight = 1; return v2 * 0.016666668; } v1 = 0; v2 = 60.0 - (double)(60 * pParty->uCurrentHour + pParty->uCurrentMinute - 300); LABEL_4: - pWeather->field_FA0 = v1; + pWeather->bNight = v1; return v2 * 0.016666668; } diff -r e13ce1b0930d -r 5ba796adbf5e Weather.h --- a/Weather.h Sat Mar 23 00:53:15 2013 +0400 +++ b/Weather.h Sat Mar 23 00:54:30 2013 +0400 @@ -17,7 +17,7 @@ __int16 field_0[2000]; - int field_FA0; + int bNight; int bRenderSnow; }; #pragma pack(pop) diff -r e13ce1b0930d -r 5ba796adbf5e mm7_3.cpp --- a/mm7_3.cpp Sat Mar 23 00:53:15 2013 +0400 +++ b/mm7_3.cpp Sat Mar 23 00:54:30 2013 +0400 @@ -6824,7 +6824,7 @@ v18 = a2; if ( pParty->armageddon_timer ) return PaletteManager::Get(a2); - if ( !pWeather->field_FA0 ) + if ( !pWeather->bNight ) { if ( day_attrib & 1 ) { @@ -6873,7 +6873,7 @@ return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); } v6 = 0; - if ( pWeather->field_FA0 == 1 ) + if (pWeather->bNight) { v8 = 67108864; if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime > 0 ) @@ -6954,7 +6954,7 @@ v26 = v8->field_34 << 16; v9 = v8->field_34 << 16; } - v10 = pWeather->field_FA0; + v10 = pWeather->bNight; if ( bUnderwater == 1 ) v10 = 0; if ( !v10 ) @@ -7240,9 +7240,10 @@ { if ( day_attrib & 1 ) { - if ( pWeather->field_FA0 ) - { - v2 = -(pWeather->field_FA0 != 1); + if ( pWeather->bNight ) + { + __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad + v2 = -(pWeather->bNight != 1); result = (v2 & 0xE0E0E1) - 0xE0E0E1; } else @@ -7274,15 +7275,13 @@ float v11; // ST14_4@17 double v12; // ST08_8@17 - v3 = pWeather->field_FA0; + v3 = pWeather->bNight; if ( bUnderwater == 1 ) v3 = 0; if ( pParty->armageddon_timer || !(day_attrib & 1) && !bUnderwater ) return 0xFF000000; if ( v3 ) { - if ( v3 != 1 ) - return 0; v5 = (double)day_fogrange_1; v6 = 216; if ( a3 < v5 ) @@ -7337,7 +7336,7 @@ //signed int result; // eax@2 int v8; // eax@3 double v9; // st7@12 - double v10; // ST0C_8@18 + //double v10; // ST0C_8@18 int v11; // ecx@28 //signed int v12; // edi@28 //double v13; // ST0C_8@33 @@ -7352,7 +7351,7 @@ //float a3b; // [sp+1Ch] [bp+8h]@34 float a3c; // [sp+1Ch] [bp+8h]@44 //float a3d; // [sp+1Ch] [bp+8h]@44 - float a4b; // [sp+20h] [bp+Ch]@18 + //float a4b; // [sp+20h] [bp+Ch]@18 //int a4a; // [sp+20h] [bp+Ch]@33 //float a4c; // [sp+20h] [bp+Ch]@44 //float a4d; // [sp+20h] [bp+Ch]@44 @@ -7367,14 +7366,11 @@ if (pParty->armageddon_timer) return 0xFFFF0000; - v8 = pWeather->field_FA0; + v8 = pWeather->bNight; if (bUnderwater) v8 = 0; if ( v8 ) { - __debugbreak(); // doubt that weather-related stuff will ever trigger, but if it suddenly does - find out what it is - if ( v8 != 1 ) - return 0; v20 = 1; if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; @@ -7385,10 +7381,11 @@ { if ( distance > 0.0 ) { - a4b = distance * 216.0 / v9; - v10 = a4b + 6.7553994e15; - v6 = LODWORD(v10); - if ( SLODWORD(v10) > 216 ) + //a4b = distance * 216.0 / v9; + //v10 = a4b + 6.7553994e15; + //v6 = LODWORD(v10); + v6 = floorf(0.5f + distance * 216.0 / v9); + if (v6 > 216 ) goto LABEL_19; } }