# HG changeset patch # User Nomad # Date 1361405549 -7200 # Node ID 672b83584b0f4203a423d052d73c06ecb7a57dbc # Parent b7131c52cdd47f385df030223056a4ab380c0f5d GetActorTintColor diff -r b7131c52cdd4 -r 672b83584b0f Party.h --- a/Party.h Thu Feb 21 00:39:47 2013 +0200 +++ b/Party.h Thu Feb 21 02:12:29 2013 +0200 @@ -280,7 +280,7 @@ char field_15FF2[130]; char pHireling1Name[100]; char pHireling2Name[100]; - int field_1613C; + int armageddon_timer; int field_16140; int pTurnBasedPlayerRecoveryTimes[4]; char field_16154[212]; diff -r b7131c52cdd4 -r 672b83584b0f Render.cpp --- a/Render.cpp Thu Feb 21 00:39:47 2013 +0200 +++ b/Render.cpp Thu Feb 21 02:12:29 2013 +0200 @@ -7234,9 +7234,9 @@ //----- (004A2031) -------------------------------------------------------- -unsigned int Render::GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6) -{ - return ::GetActorTintColor(a3, a4, a2, a5, a6); +unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) +{ + return ::GetActorTintColor(tint, a4, a2, a5, a6); } /*void Render::DrawTerrainPolygon_new(stru148 *a3, IDirect3DTexture2 *pTexture)//new function diff -r b7131c52cdd4 -r 672b83584b0f Render.h --- a/Render.h Thu Feb 21 00:39:47 2013 +0200 +++ b/Render.h Thu Feb 21 02:12:29 2013 +0200 @@ -319,7 +319,7 @@ unsigned int GetParentBillboardID(unsigned int uBillboardID); void BeginSceneD3D(); void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); - unsigned int GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6); + unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6); void DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture); void DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders); void DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture); diff -r b7131c52cdd4 -r 672b83584b0f mm7_2.cpp --- a/mm7_2.cpp Thu Feb 21 00:39:47 2013 +0200 +++ b/mm7_2.cpp Thu Feb 21 02:12:29 2013 +0200 @@ -12354,7 +12354,7 @@ uCurrentlyLoadedLevelType = LEVEL_null; pSpriteFrameTable->ResetSomeSpriteFlags(); v0 = uNumVisibleWindows; - pParty->field_1613C = 0; + pParty->armageddon_timer = 0; while ( v0 > 0 ) pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); } diff -r b7131c52cdd4 -r 672b83584b0f mm7_3.cpp --- a/mm7_3.cpp Thu Feb 21 00:39:47 2013 +0200 +++ b/mm7_3.cpp Thu Feb 21 02:12:29 2013 +0200 @@ -1111,7 +1111,7 @@ { v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); } - if ( pParty->field_1613C != v17 && v0->CanAct() ) + if ( pParty->armageddon_timer != v17 && v0->CanAct() ) { v0->vVelocity.x += rand() % 100 - 50; v0->vVelocity.y += rand() % 100 - 50; @@ -7649,7 +7649,7 @@ v4 = a2; v18 = a2; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) return PaletteManager::Get(a2); if ( !pWeather->field_FA0 ) { @@ -7766,7 +7766,7 @@ v8 = a2; v9 = a1; v26 = a1; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { *a5 = -1; *a6 = -1; @@ -7928,11 +7928,6 @@ *(char *)a8 = 1; return result; } -// 4D864C: using guessed type char byte_4D864C; -// 6BE030: using guessed type int day_attrib; -// 6BE040: using guessed type int day_fogrange_1; -// 6BE044: using guessed type int day_fogrange_2; -// 6BE3C4: using guessed type char bUnderwater; //----- (0047C178) -------------------------------------------------------- void *__fastcall sr_sub_47C178(signed int a1, stru148 *a2, int terrain_gamma, int a4) @@ -7943,7 +7938,7 @@ int v7; // [sp+8h] [bp-4h]@3 v4 = a2; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { result = PaletteManager::Get(a2->pTexture->palette_id2); } @@ -7968,7 +7963,7 @@ v9 = a2; v4 = a1; a3a = 1; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { result = PaletteManager::Get(a1->pTexture->palette_id2); } @@ -8029,7 +8024,7 @@ v9 = a2; v4 = a1; a2a = 1; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { result = (char *)pPaletteManager->field_199600_palettes[a1->pTexture->palette_id2]; } @@ -8109,8 +8104,8 @@ v3 = pWeather->field_FA0; if ( bUnderwater == 1 ) v3 = 0; - if ( pParty->field_1613C || !(day_attrib & 1) && !bUnderwater ) - return 0xFF000000u; + if ( pParty->armageddon_timer || !(day_attrib & 1) && !bUnderwater ) + return 0xFF000000; if ( v3 ) { if ( v3 != 1 ) @@ -8159,56 +8154,56 @@ v7 = 248; return (-1 - v7) << 24; } -// 6BE030: using guessed type int day_attrib; -// 6BE040: using guessed type int day_fogrange_1; -// 6BE044: using guessed type int day_fogrange_2; -// 6BE3C4: using guessed type char bUnderwater; + //----- (0047C4FC) -------------------------------------------------------- -signed int __fastcall GetActorTintColor(int a1, int a2, float a3, int a4, RenderBillboard *a5) -{ - int v5; // esi@1 +signed int __fastcall GetActorTintColor(int tint, int a2, float a3, int a4, RenderBillboard *a5) +{ + //int v5; // esi@1 signed int v6; // edx@1 - signed int result; // eax@2 + //signed int result; // eax@2 int v8; // eax@3 double v9; // st7@12 double v10; // ST0C_8@18 int v11; // ecx@28 - signed int v12; // edi@28 - double v13; // ST0C_8@33 - double v14; // ST0C_8@34 + //signed int v12; // edi@28 + //double v13; // ST0C_8@33 + //double v14; // ST0C_8@34 double v15; // st7@44 - double v16; // ST0C_8@44 - double v17; // ST0C_8@44 + //double v16; // ST0C_8@44 + //double v17; // ST0C_8@44 int v18; // ST14_4@44 - double v19; // ST0C_8@44 + //double v19; // ST0C_8@44 signed int v20; // [sp+10h] [bp-4h]@10 float a3a; // [sp+1Ch] [bp+8h]@33 float a3b; // [sp+1Ch] [bp+8h]@34 float a3c; // [sp+1Ch] [bp+8h]@44 - float a3d; // [sp+1Ch] [bp+8h]@44 + //float a3d; // [sp+1Ch] [bp+8h]@44 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 + //float a4c; // [sp+20h] [bp+Ch]@44 + //float a4d; // [sp+20h] [bp+Ch]@44 int a5a; // [sp+24h] [bp+10h]@44 - v5 = a2; + //v5 = a2; v6 = 0; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - return 8 * (31 - a1) | ((8 * (31 - a1) | ((31 - a1) << 11)) << 8); + + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + return 8 * (31 - tint) | ((8 * (31 - tint) | ((31 - tint) << 11)) << 8); + if (pParty->armageddon_timer) + return 0xFFFF0000; + v8 = pWeather->field_FA0; if ( bUnderwater == 1 ) v8 = 0; - if ( pParty->field_1613C ) - return 16711680; 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[16].uExpireTime > 0 ) - v20 = pParty->pPartyBuffs[16].uPower; + if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) + v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; v9 = (double)v20 * 1024.0; if ( a4 ) goto LABEL_19; @@ -8240,59 +8235,59 @@ v6 = 216; goto LABEL_20; } + + + if ( a3 == 0.0 ) - { - result = (signed int)0xF8F8F8; - } - else - { - v11 = 8 * (a1 - v5); - v12 = v11; + return 0xFFF8F8F8; + + v11 = 8 * (tint - a2); + //v12 = v11; if ( v11 >= 0 ) { if ( v11 > 216 ) - v12 = 216; - } - else - { - v12 = 0; - } + v11 = 216; + } + else + v11 = 0; + if ( a4 ) { a3b = pOutdoor->fFogDensity * 216.0; - v14 = a3b + 6.7553994e15; - a4a = LODWORD(v14); + //v14 = a3b + 6.7553994e15; + a4a = floorf(a3b + 0.5f);//LODWORD(v14); } else { a3a = (a3 / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; - v13 = a3a + 6.7553994e15; - a4a = LODWORD(v13); - } - v6 = a4a + v12; + //v13 = a3a + 6.7553994e15; + a4a = floorf(a3a + 0.5f);//LODWORD(v13); + } + v6 = a4a + v11; if ( a5 ) v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); if ( v6 > 216 ) v6 = 216; - if ( v6 < v12 ) - v6 = v12; + if ( v6 < v11 ) + v6 = v11; if ( v6 > 8 * pOutdoor->field_CBC_terrain_triangles_shade_type ) v6 = 8 * pOutdoor->field_CBC_terrain_triangles_shade_type; if ( !bUnderwater ) return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); + else + { v15 = (double)(255 - v6) * 0.0039215689; a3c = v15; - a4c = v15 * 16.0; - v16 = a4c + 6.7553994e15; - a5a = LODWORD(v16); - a4d = a3c * 194.0; - v17 = a4d + 6.7553994e15; - v18 = LODWORD(v17); - a3d = a3c * 153.0; - v19 = a3d + 6.7553994e15; - result = LODWORD(v19) | ((v18 | (a5a << 8)) << 8); - } - return result; + //a4c = v15 * 16.0; + //v16 = a4c + 6.7553994e15; + a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); + //a4d = a3c * 194.0; + //v17 = a4d + 6.7553994e15; + v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); + //a3d = a3c * 153.0; + //v19 = a3d + 6.7553994e15; + return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); + } } // 6BE3C4: using guessed type char bUnderwater; @@ -17778,11 +17773,11 @@ else BLV_4016FA_AI(); v0 = 0; - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->field_1613C > 0 ) - { - if ( pParty->field_1613C > 417 ) - { - pParty->field_1613C = 0; + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) + { + if ( pParty->armageddon_timer > 417 ) + { + pParty->armageddon_timer = 0; } else { @@ -17794,11 +17789,11 @@ if ( v3 > 128 || (v2 = -128, v3 < -128) ) pParty->sRotationX = v2; pParty->uFlags |= 2u; - pParty->field_1613C -= pMiscTimer->uTimeElapsed; + pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; v4 = pParty->field_16140 + 50; - if ( pParty->field_1613C <= 0 ) - { - pParty->field_1613C = 0; + if ( pParty->armageddon_timer <= 0 ) + { + pParty->armageddon_timer = 0; v84 = 0; if ( (signed int)uNumActors > 0 ) { diff -r b7131c52cdd4 -r 672b83584b0f mm7_6.cpp --- a/mm7_6.cpp Thu Feb 21 00:39:47 2013 +0200 +++ b/mm7_6.cpp Thu Feb 21 02:12:29 2013 +0200 @@ -7686,11 +7686,11 @@ v640 = v12 - 2; if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) amount = 3; - if ( pPlayer->uNumArmageddonCasts >= amount || pParty->field_1613C > v1 ) + if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > v1 ) goto LABEL_200; if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; - pParty->field_1613C = 256; + pParty->armageddon_timer = 256; pParty->field_16140 = v2; ++pPlayer->uNumArmageddonCasts; if ( pParty->bTurnBasedModeOn == 1 )