comparison mm7_3.cpp @ 349:672b83584b0f

GetActorTintColor
author Nomad
date Thu, 21 Feb 2013 02:12:29 +0200
parents ea55d6414029
children 5f36449527c6
comparison
equal deleted inserted replaced
344:b7131c52cdd4 349:672b83584b0f
1109 } 1109 }
1110 else 1110 else
1111 { 1111 {
1112 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); 1112 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
1113 } 1113 }
1114 if ( pParty->field_1613C != v17 && v0->CanAct() ) 1114 if ( pParty->armageddon_timer != v17 && v0->CanAct() )
1115 { 1115 {
1116 v0->vVelocity.x += rand() % 100 - 50; 1116 v0->vVelocity.x += rand() % 100 - 50;
1117 v0->vVelocity.y += rand() % 100 - 50; 1117 v0->vVelocity.y += rand() % 100 - 50;
1118 v0->vVelocity.z += rand() % 100 - 20; 1118 v0->vVelocity.z += rand() % 100 - 20;
1119 v25 = rand(); 1119 v25 = rand();
7647 int v18; // [sp+10h] [bp-8h]@1 7647 int v18; // [sp+10h] [bp-8h]@1
7648 float a3a; // [sp+20h] [bp+8h]@19 7648 float a3a; // [sp+20h] [bp+8h]@19
7649 7649
7650 v4 = a2; 7650 v4 = a2;
7651 v18 = a2; 7651 v18 = a2;
7652 if ( pParty->field_1613C ) 7652 if ( pParty->armageddon_timer )
7653 return PaletteManager::Get(a2); 7653 return PaletteManager::Get(a2);
7654 if ( !pWeather->field_FA0 ) 7654 if ( !pWeather->field_FA0 )
7655 { 7655 {
7656 if ( day_attrib & 1 ) 7656 if ( day_attrib & 1 )
7657 { 7657 {
7764 int v29; // [sp+2Ch] [bp+14h]@37 7764 int v29; // [sp+2Ch] [bp+14h]@37
7765 7765
7766 v8 = a2; 7766 v8 = a2;
7767 v9 = a1; 7767 v9 = a1;
7768 v26 = a1; 7768 v26 = a1;
7769 if ( pParty->field_1613C ) 7769 if ( pParty->armageddon_timer )
7770 { 7770 {
7771 *a5 = -1; 7771 *a5 = -1;
7772 *a6 = -1; 7772 *a6 = -1;
7773 *(char *)a7 = 1; 7773 *(char *)a7 = 1;
7774 LABEL_46: 7774 LABEL_46:
7926 LABEL_59: 7926 LABEL_59:
7927 result = a8; 7927 result = a8;
7928 *(char *)a8 = 1; 7928 *(char *)a8 = 1;
7929 return result; 7929 return result;
7930 } 7930 }
7931 // 4D864C: using guessed type char byte_4D864C;
7932 // 6BE030: using guessed type int day_attrib;
7933 // 6BE040: using guessed type int day_fogrange_1;
7934 // 6BE044: using guessed type int day_fogrange_2;
7935 // 6BE3C4: using guessed type char bUnderwater;
7936 7931
7937 //----- (0047C178) -------------------------------------------------------- 7932 //----- (0047C178) --------------------------------------------------------
7938 void *__fastcall sr_sub_47C178(signed int a1, stru148 *a2, int terrain_gamma, int a4) 7933 void *__fastcall sr_sub_47C178(signed int a1, stru148 *a2, int terrain_gamma, int a4)
7939 { 7934 {
7940 stru148 *v4; // esi@1 7935 stru148 *v4; // esi@1
7941 void *result; // eax@2 7936 void *result; // eax@2
7942 int v6; // [sp+4h] [bp-8h]@3 7937 int v6; // [sp+4h] [bp-8h]@3
7943 int v7; // [sp+8h] [bp-4h]@3 7938 int v7; // [sp+8h] [bp-4h]@3
7944 7939
7945 v4 = a2; 7940 v4 = a2;
7946 if ( pParty->field_1613C ) 7941 if ( pParty->armageddon_timer )
7947 { 7942 {
7948 result = PaletteManager::Get(a2->pTexture->palette_id2); 7943 result = PaletteManager::Get(a2->pTexture->palette_id2);
7949 } 7944 }
7950 else 7945 else
7951 { 7946 {
7966 char v9; // [sp+8h] [bp-4h]@1 7961 char v9; // [sp+8h] [bp-4h]@1
7967 7962
7968 v9 = a2; 7963 v9 = a2;
7969 v4 = a1; 7964 v4 = a1;
7970 a3a = 1; 7965 a3a = 1;
7971 if ( pParty->field_1613C ) 7966 if ( pParty->armageddon_timer )
7972 { 7967 {
7973 result = PaletteManager::Get(a1->pTexture->palette_id2); 7968 result = PaletteManager::Get(a1->pTexture->palette_id2);
7974 } 7969 }
7975 else 7970 else
7976 { 7971 {
8027 char v9; // [sp+8h] [bp-4h]@1 8022 char v9; // [sp+8h] [bp-4h]@1
8028 8023
8029 v9 = a2; 8024 v9 = a2;
8030 v4 = a1; 8025 v4 = a1;
8031 a2a = 1; 8026 a2a = 1;
8032 if ( pParty->field_1613C ) 8027 if ( pParty->armageddon_timer )
8033 { 8028 {
8034 result = (char *)pPaletteManager->field_199600_palettes[a1->pTexture->palette_id2]; 8029 result = (char *)pPaletteManager->field_199600_palettes[a1->pTexture->palette_id2];
8035 } 8030 }
8036 else 8031 else
8037 { 8032 {
8107 double v12; // ST08_8@17 8102 double v12; // ST08_8@17
8108 8103
8109 v3 = pWeather->field_FA0; 8104 v3 = pWeather->field_FA0;
8110 if ( bUnderwater == 1 ) 8105 if ( bUnderwater == 1 )
8111 v3 = 0; 8106 v3 = 0;
8112 if ( pParty->field_1613C || !(day_attrib & 1) && !bUnderwater ) 8107 if ( pParty->armageddon_timer || !(day_attrib & 1) && !bUnderwater )
8113 return 0xFF000000u; 8108 return 0xFF000000;
8114 if ( v3 ) 8109 if ( v3 )
8115 { 8110 {
8116 if ( v3 != 1 ) 8111 if ( v3 != 1 )
8117 return 0; 8112 return 0;
8118 v5 = (double)day_fogrange_1; 8113 v5 = (double)day_fogrange_1;
8157 LABEL_21: 8152 LABEL_21:
8158 if ( a2 ) 8153 if ( a2 )
8159 v7 = 248; 8154 v7 = 248;
8160 return (-1 - v7) << 24; 8155 return (-1 - v7) << 24;
8161 } 8156 }
8162 // 6BE030: using guessed type int day_attrib; 8157
8163 // 6BE040: using guessed type int day_fogrange_1;
8164 // 6BE044: using guessed type int day_fogrange_2;
8165 // 6BE3C4: using guessed type char bUnderwater;
8166 8158
8167 //----- (0047C4FC) -------------------------------------------------------- 8159 //----- (0047C4FC) --------------------------------------------------------
8168 signed int __fastcall GetActorTintColor(int a1, int a2, float a3, int a4, RenderBillboard *a5) 8160 signed int __fastcall GetActorTintColor(int tint, int a2, float a3, int a4, RenderBillboard *a5)
8169 { 8161 {
8170 int v5; // esi@1 8162 //int v5; // esi@1
8171 signed int v6; // edx@1 8163 signed int v6; // edx@1
8172 signed int result; // eax@2 8164 //signed int result; // eax@2
8173 int v8; // eax@3 8165 int v8; // eax@3
8174 double v9; // st7@12 8166 double v9; // st7@12
8175 double v10; // ST0C_8@18 8167 double v10; // ST0C_8@18
8176 int v11; // ecx@28 8168 int v11; // ecx@28
8177 signed int v12; // edi@28 8169 //signed int v12; // edi@28
8178 double v13; // ST0C_8@33 8170 //double v13; // ST0C_8@33
8179 double v14; // ST0C_8@34 8171 //double v14; // ST0C_8@34
8180 double v15; // st7@44 8172 double v15; // st7@44
8181 double v16; // ST0C_8@44 8173 //double v16; // ST0C_8@44
8182 double v17; // ST0C_8@44 8174 //double v17; // ST0C_8@44
8183 int v18; // ST14_4@44 8175 int v18; // ST14_4@44
8184 double v19; // ST0C_8@44 8176 //double v19; // ST0C_8@44
8185 signed int v20; // [sp+10h] [bp-4h]@10 8177 signed int v20; // [sp+10h] [bp-4h]@10
8186 float a3a; // [sp+1Ch] [bp+8h]@33 8178 float a3a; // [sp+1Ch] [bp+8h]@33
8187 float a3b; // [sp+1Ch] [bp+8h]@34 8179 float a3b; // [sp+1Ch] [bp+8h]@34
8188 float a3c; // [sp+1Ch] [bp+8h]@44 8180 float a3c; // [sp+1Ch] [bp+8h]@44
8189 float a3d; // [sp+1Ch] [bp+8h]@44 8181 //float a3d; // [sp+1Ch] [bp+8h]@44
8190 float a4b; // [sp+20h] [bp+Ch]@18 8182 float a4b; // [sp+20h] [bp+Ch]@18
8191 int a4a; // [sp+20h] [bp+Ch]@33 8183 int a4a; // [sp+20h] [bp+Ch]@33
8192 float a4c; // [sp+20h] [bp+Ch]@44 8184 //float a4c; // [sp+20h] [bp+Ch]@44
8193 float a4d; // [sp+20h] [bp+Ch]@44 8185 //float a4d; // [sp+20h] [bp+Ch]@44
8194 int a5a; // [sp+24h] [bp+10h]@44 8186 int a5a; // [sp+24h] [bp+10h]@44
8195 8187
8196 v5 = a2; 8188 //v5 = a2;
8197 v6 = 0; 8189 v6 = 0;
8198 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 8190
8199 return 8 * (31 - a1) | ((8 * (31 - a1) | ((31 - a1) << 11)) << 8); 8191 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
8192 return 8 * (31 - tint) | ((8 * (31 - tint) | ((31 - tint) << 11)) << 8);
8193 if (pParty->armageddon_timer)
8194 return 0xFFFF0000;
8195
8200 v8 = pWeather->field_FA0; 8196 v8 = pWeather->field_FA0;
8201 if ( bUnderwater == 1 ) 8197 if ( bUnderwater == 1 )
8202 v8 = 0; 8198 v8 = 0;
8203 if ( pParty->field_1613C )
8204 return 16711680;
8205 if ( v8 ) 8199 if ( v8 )
8206 { 8200 {
8201 __debugbreak(); // doubt that weather-related stuff will ever trigger, but if it suddenly does - find out what it is
8207 if ( v8 != 1 ) 8202 if ( v8 != 1 )
8208 return 0; 8203 return 0;
8209 v20 = 1; 8204 v20 = 1;
8210 if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime > 0 ) 8205 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
8211 v20 = pParty->pPartyBuffs[16].uPower; 8206 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower;
8212 v9 = (double)v20 * 1024.0; 8207 v9 = (double)v20 * 1024.0;
8213 if ( a4 ) 8208 if ( a4 )
8214 goto LABEL_19; 8209 goto LABEL_19;
8215 if ( a3 <= v9 ) 8210 if ( a3 <= v9 )
8216 { 8211 {
8238 } 8233 }
8239 LABEL_19: 8234 LABEL_19:
8240 v6 = 216; 8235 v6 = 216;
8241 goto LABEL_20; 8236 goto LABEL_20;
8242 } 8237 }
8238
8239
8240
8243 if ( a3 == 0.0 ) 8241 if ( a3 == 0.0 )
8244 { 8242 return 0xFFF8F8F8;
8245 result = (signed int)0xF8F8F8; 8243
8246 } 8244 v11 = 8 * (tint - a2);
8247 else 8245 //v12 = v11;
8248 {
8249 v11 = 8 * (a1 - v5);
8250 v12 = v11;
8251 if ( v11 >= 0 ) 8246 if ( v11 >= 0 )
8252 { 8247 {
8253 if ( v11 > 216 ) 8248 if ( v11 > 216 )
8254 v12 = 216; 8249 v11 = 216;
8255 } 8250 }
8256 else 8251 else
8257 { 8252 v11 = 0;
8258 v12 = 0; 8253
8259 }
8260 if ( a4 ) 8254 if ( a4 )
8261 { 8255 {
8262 a3b = pOutdoor->fFogDensity * 216.0; 8256 a3b = pOutdoor->fFogDensity * 216.0;
8263 v14 = a3b + 6.7553994e15; 8257 //v14 = a3b + 6.7553994e15;
8264 a4a = LODWORD(v14); 8258 a4a = floorf(a3b + 0.5f);//LODWORD(v14);
8265 } 8259 }
8266 else 8260 else
8267 { 8261 {
8268 a3a = (a3 / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; 8262 a3a = (a3 / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity;
8269 v13 = a3a + 6.7553994e15; 8263 //v13 = a3a + 6.7553994e15;
8270 a4a = LODWORD(v13); 8264 a4a = floorf(a3a + 0.5f);//LODWORD(v13);
8271 } 8265 }
8272 v6 = a4a + v12; 8266 v6 = a4a + v11;
8273 if ( a5 ) 8267 if ( a5 )
8274 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); 8268 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
8275 if ( v6 > 216 ) 8269 if ( v6 > 216 )
8276 v6 = 216; 8270 v6 = 216;
8277 if ( v6 < v12 ) 8271 if ( v6 < v11 )
8278 v6 = v12; 8272 v6 = v11;
8279 if ( v6 > 8 * pOutdoor->field_CBC_terrain_triangles_shade_type ) 8273 if ( v6 > 8 * pOutdoor->field_CBC_terrain_triangles_shade_type )
8280 v6 = 8 * pOutdoor->field_CBC_terrain_triangles_shade_type; 8274 v6 = 8 * pOutdoor->field_CBC_terrain_triangles_shade_type;
8281 if ( !bUnderwater ) 8275 if ( !bUnderwater )
8282 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); 8276 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
8277 else
8278 {
8283 v15 = (double)(255 - v6) * 0.0039215689; 8279 v15 = (double)(255 - v6) * 0.0039215689;
8284 a3c = v15; 8280 a3c = v15;
8285 a4c = v15 * 16.0; 8281 //a4c = v15 * 16.0;
8286 v16 = a4c + 6.7553994e15; 8282 //v16 = a4c + 6.7553994e15;
8287 a5a = LODWORD(v16); 8283 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16);
8288 a4d = a3c * 194.0; 8284 //a4d = a3c * 194.0;
8289 v17 = a4d + 6.7553994e15; 8285 //v17 = a4d + 6.7553994e15;
8290 v18 = LODWORD(v17); 8286 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17);
8291 a3d = a3c * 153.0; 8287 //a3d = a3c * 153.0;
8292 v19 = a3d + 6.7553994e15; 8288 //v19 = a3d + 6.7553994e15;
8293 result = LODWORD(v19) | ((v18 | (a5a << 8)) << 8); 8289 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8);
8294 } 8290 }
8295 return result;
8296 } 8291 }
8297 // 6BE3C4: using guessed type char bUnderwater; 8292 // 6BE3C4: using guessed type char bUnderwater;
8298 8293
8299 8294
8300 8295
17776 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 17771 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
17777 ODM_4014E6_AI(); 17772 ODM_4014E6_AI();
17778 else 17773 else
17779 BLV_4016FA_AI(); 17774 BLV_4016FA_AI();
17780 v0 = 0; 17775 v0 = 0;
17781 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->field_1613C > 0 ) 17776 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 )
17782 { 17777 {
17783 if ( pParty->field_1613C > 417 ) 17778 if ( pParty->armageddon_timer > 417 )
17784 { 17779 {
17785 pParty->field_1613C = 0; 17780 pParty->armageddon_timer = 0;
17786 } 17781 }
17787 else 17782 else
17788 { 17783 {
17789 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); 17784 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8);
17790 v1 = rand(); 17785 v1 = rand();
17792 v3 = pParty->sRotationX + v1 % 16 - 8; 17787 v3 = pParty->sRotationX + v1 % 16 - 8;
17793 pParty->sRotationX = v3; 17788 pParty->sRotationX = v3;
17794 if ( v3 > 128 || (v2 = -128, v3 < -128) ) 17789 if ( v3 > 128 || (v2 = -128, v3 < -128) )
17795 pParty->sRotationX = v2; 17790 pParty->sRotationX = v2;
17796 pParty->uFlags |= 2u; 17791 pParty->uFlags |= 2u;
17797 pParty->field_1613C -= pMiscTimer->uTimeElapsed; 17792 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed;
17798 v4 = pParty->field_16140 + 50; 17793 v4 = pParty->field_16140 + 50;
17799 if ( pParty->field_1613C <= 0 ) 17794 if ( pParty->armageddon_timer <= 0 )
17800 { 17795 {
17801 pParty->field_1613C = 0; 17796 pParty->armageddon_timer = 0;
17802 v84 = 0; 17797 v84 = 0;
17803 if ( (signed int)uNumActors > 0 ) 17798 if ( (signed int)uNumActors > 0 )
17804 { 17799 {
17805 v5 = pActors;//[0].sCurrentHP; 17800 v5 = pActors;//[0].sCurrentHP;
17806 do 17801 do