comparison mm7_4.cpp @ 47:8a8dd0164b12

BLV render cd check fix
author Nomad
date Tue, 23 Oct 2012 13:51:21 +0200
parents 79a30ee1ecdb
children 25fabc49627b fde5c5acb66e
comparison
equal deleted inserted replaced
46:79a30ee1ecdb 47:8a8dd0164b12
3063 // 4ED498: using guessed type char byte_4ED498; 3063 // 4ED498: using guessed type char byte_4ED498;
3064 3064
3065 //----- (00491F87) -------------------------------------------------------- 3065 //----- (00491F87) --------------------------------------------------------
3066 void __cdecl DrawHiredNPCs() 3066 void __cdecl DrawHiredNPCs()
3067 { 3067 {
3068 int v0; // ecx@2
3069 char *v1; // eax@2
3070 int v2; // edx@4
3071 signed int v3; // ebx@6
3072 char *v4; // esi@7
3073 int v5; // ecx@13
3074 int v6; // eax@15 3068 int v6; // eax@15
3075 char v7; // al@17 3069 char v7; // al@17
3076 unsigned int v8; // eax@18 3070 unsigned int v8; // eax@18
3077 int v9; // esi@18 3071 int v9; // esi@18
3078 int v10; // eax@18 3072 int v10; // eax@18
3079 unsigned int v11; // eax@19 3073 unsigned int v11; // eax@19
3080 unsigned int v12; // esi@19 3074 unsigned int v12; // esi@19
3081 unsigned int v13; // eax@23 3075 unsigned int v13; // eax@23
3082 IconFrame *v14; // eax@24 3076 IconFrame *v14; // eax@24
3083 unsigned int v15; // eax@26 3077 unsigned int v15; // eax@26
3084 char pContainer; // [sp+Ch] [bp-30h]@18 3078 char pContainer[20]; // [sp+Ch] [bp-30h]@18
3085 unsigned int v17; // [sp+20h] [bp-1Ch]@19 3079 unsigned int v17; // [sp+20h] [bp-1Ch]@19
3086 signed int uFrameID; // [sp+24h] [bp-18h]@19 3080 signed int uFrameID; // [sp+24h] [bp-18h]@19
3087 int i; // [sp+28h] [bp-14h]@15 3081 int i; // [sp+28h] [bp-14h]@15
3088 unsigned int v20; // [sp+2Ch] [bp-10h]@20 3082 unsigned int v20; // [sp+2Ch] [bp-10h]@20
3089 unsigned int v21; // [sp+30h] [bp-Ch]@19 3083 unsigned int v21; // [sp+30h] [bp-Ch]@19
3092 3086
3093 if ( bNoNPCHiring != 1 ) 3087 if ( bNoNPCHiring != 1 )
3094 { 3088 {
3095 v23 = 0; 3089 v23 = 0;
3096 v22 = 0; 3090 v22 = 0;
3097 v0 = 0; 3091 for (uint i = 0; i < 2; ++i)
3098 v1 = (char *)pParty->pHirelings; 3092 {
3099 do 3093 if (pParty->pHirelings[i].pName)
3100 { 3094 pTmpBuf[v22++] = i;
3101 if ( *(int *)v1 ) 3095 }
3102 { 3096
3103 v2 = v22++; 3097 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
3104 pTmpBuf[v2] = v0; 3098 {
3105 } 3099 if (pNPCStats->pNewNPCData[i].uFlags & 0x80)
3106 v1 += 76; 3100 {
3107 ++v0; 3101 if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName))
3108 } 3102 {
3109 while ( (signed int)v1 < (signed int)&pParty->pPickedItem ); 3103 if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName))
3110 v3 = 0; 3104 pTmpBuf[v22++] = i + 2;
3111 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) 3105 }
3112 { 3106 }
3113 v4 = (char *)pNPCStats->pNewNPCData; 3107 }
3114 do 3108
3115 {
3116 if ( v4[8] & 0x80 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v4, pParty->pHirelings[0].pName)) )
3117 {
3118 if ( !pParty->pHirelings[1].pName || strcmp(*(const char **)v4, pParty->pHirelings[1].pName) )
3119 {
3120 v5 = v22++;
3121 pTmpBuf[v5] = v3 + 2;
3122 }
3123 }
3124 ++v3;
3125 v4 += 76;
3126 }
3127 while ( v3 < (signed int)pNPCStats->uNumNewNPCs );
3128 }
3129 v6 = (unsigned __int8)pParty->field_709; 3109 v6 = (unsigned __int8)pParty->field_709;
3130 for ( i = (unsigned __int8)pParty->field_709; i < v22; v6 = i++ + 1 ) 3110 for ( i = (unsigned __int8)pParty->field_709; i < v22; v6 = i++ + 1 )
3131 { 3111 {
3132 if ( v23 >= 2u ) 3112 if ( v23 >= 2u )
3133 break; 3113 break;
3134 v7 = pTmpBuf[v6]; 3114 v7 = pTmpBuf[v6];
3135 if ( (unsigned __int8)v7 >= 2u ) 3115 if ( (unsigned __int8)v7 >= 2u )
3136 { 3116 {
3137 sprintfex(&pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID); 3117 sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID);
3138 v15 = pIcons_LOD->LoadTexture(&pContainer, TEXTURE_16BIT_PALETTE); 3118 v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
3139 pRenderer->DrawTextureIndexed( 3119 pRenderer->DrawTextureIndexed(
3140 pHiredNPCsIconsOffsetsX[v23], 3120 pHiredNPCsIconsOffsetsX[v23],
3141 pHiredNPCsIconsOffsetsY[v23], 3121 pHiredNPCsIconsOffsetsY[v23],
3142 (Texture *)(v15 != -1 ? 72 * v15 + 7145548 : 0)); 3122 (Texture *)(v15 != -1 ? &pIcons_LOD->pTextures[v15] : 0));
3143 } 3123 }
3144 else 3124 else
3145 { 3125 {
3146 sprintfex(&pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID); 3126 sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID);
3147 v8 = pIcons_LOD->LoadTexture(&pContainer, TEXTURE_16BIT_PALETTE); 3127 v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
3148 v9 = v23; 3128 v9 = v23;
3149 pRenderer->DrawTextureIndexed( 3129 pRenderer->DrawTextureIndexed(
3150 pHiredNPCsIconsOffsetsX[v9], 3130 pHiredNPCsIconsOffsetsX[v9],
3151 pHiredNPCsIconsOffsetsY[v9], 3131 pHiredNPCsIconsOffsetsY[v9],
3152 (Texture *)(v8 != -1 ? (int)&pIcons_LOD->pTextures[v8] : 0)); 3132 (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0));
3153 v10 = (unsigned __int8)pTmpBuf[i]; 3133 v10 = (unsigned __int8)pTmpBuf[i];
3154 if ( pParty->pHirelings[v10].bDrawSomeAnim == 1 ) 3134 if ( pParty->pHirelings[v10].bDrawSomeAnim == 1 )
3155 { 3135 {
3156 uFrameID = pParty->pHirelings[v10].evtb; 3136 uFrameID = pParty->pHirelings[v10].evtb;
3157 v11 = pHiredNPCsIconsOffsetsX[v9]; 3137 v11 = pHiredNPCsIconsOffsetsX[v9];
3188 3168
3189 3169
3190 //----- (004921C1) -------------------------------------------------------- 3170 //----- (004921C1) --------------------------------------------------------
3191 void GameUI_DrawPortraits(unsigned int _this) 3171 void GameUI_DrawPortraits(unsigned int _this)
3192 { 3172 {
3193 signed int v1; // ebx@2
3194 int v2; // ebp@7
3195 char *v3; // esi@7
3196 Texture *v4; // eax@10 3173 Texture *v4; // eax@10
3197 signed int v5; // edx@13
3198 PlayerFrame *v6; // eax@14
3199 unsigned int v7; // eax@17 3174 unsigned int v7; // eax@17
3200 PlayerFrame *v8; // eax@21 3175 PlayerFrame *v8; // eax@21
3201 unsigned int v9; // eax@27 3176 unsigned int v9; // eax@27
3202 bool v10; // eax@33 3177 bool v10; // eax@33
3203 bool v11; // edi@40 3178 bool v11; // edi@40
3204 bool v12; // edx@43 3179 bool v12; // edx@43
3205 bool v13; // ecx@46 3180 bool v13; // ecx@46
3206 int v14; // esi@54
3207 char *v15; // edi@55
3208 int v16; // eax@57 3181 int v16; // eax@57
3209 __int16 *v17; // esi@59
3210 char *v18; // edi@59
3211 int v19; // eax@62 3182 int v19; // eax@62
3212 Texture *v20; // [sp-4h] [bp-1Ch]@27 3183 Texture *v20; // [sp-4h] [bp-1Ch]@27
3213 signed int v21; // [sp+10h] [bp-8h]@7
3214 unsigned int v22; // [sp+14h] [bp-4h]@1 3184 unsigned int v22; // [sp+14h] [bp-4h]@1
3215 3185
3216 v22 = _this; 3186 v22 = _this;
3217 if ( qword_A750D8 ) 3187 if ( qword_A750D8 )
3218 { 3188 {
3219 qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed; 3189 qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed;
3220 v1 = 0;
3221 if ( qword_A750D8 <= 0 ) 3190 if ( qword_A750D8 <= 0 )
3222 { 3191 {
3223 if ( pPlayers[word_A750E2]->CanAct() ) 3192 if ( pPlayers[word_A750E2]->CanAct() )
3224 pPlayers[word_A750E2]->PlaySound(word_A750E0, 0); 3193 pPlayers[word_A750E2]->PlaySound(word_A750E0, 0);
3225 qword_A750D8 = 0i64; 3194 qword_A750D8 = 0i64;
3226 } 3195 }
3227 } 3196 }
3228 else 3197
3229 { 3198 for (uint i = 0; i < 4; ++i)
3230 v1 = 0; 3199 {
3231 } 3200 auto pPlayer = pParty->pPlayers + i;
3232 v2 = 0; 3201
3233 v21 = v1; 3202 if (pPlayer->Eradicated())
3234 v3 = (char *)&pParty->pPlayers[0].pConditions[14];
3235 while ( 1 )
3236 {
3237 if ( *((_QWORD *)v3 + 2) )
3238 { 3203 {
3239 v4 = pTexture_PlayerFaceEradicated; 3204 v4 = pTexture_PlayerFaceEradicated;
3240 LABEL_27: 3205 LABEL_27:
3241 v20 = v4; 3206 v20 = v4;
3242 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[v2]; 3207 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
3243 if ( pParty->pPartyBuffs[11].uExpireTime ) 3208 if ( pParty->pPartyBuffs[11].uExpireTime )
3244 pRenderer->_4A6E7E(v9, 0x183u, v20); 3209 pRenderer->_4A6E7E(v9, 0x183u, v20);
3245 else 3210 else
3246 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, v20); 3211 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, v20);
3247 v10 = *((int *)v3 + 1541) >= v1 && (*((int *)v3 + 1541) > v1 || *((int *)v3 + 1540) > (unsigned int)v1); 3212 auto _v1 = 0;
3248 if ( *((int *)v3 + 1489) >= v1 && (*((int *)v3 + 1489) > v1 || *((int *)v3 + 1488) > (unsigned int)v1) ) 3213 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
3249 v1 = 1; 3214 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
3250 v11 = *((_QWORD *)v3 + 758) > 0i64; 3215 _v1 = 1;
3251 v12 = *((_QWORD *)v3 + 756) > 0i64; 3216 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
3252 v13 = *((_QWORD *)v3 + 768) > 0i64; 3217 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
3253 if ( v13 | v12 | v11 | v1 | v10 ) 3218 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
3254 sub_441A4E(v2); 3219 if ( v13 | v12 | v11 | _v1 | v10 )
3220 sub_441A4E(i);
3255 goto LABEL_50; 3221 goto LABEL_50;
3256 } 3222 }
3257 if ( *(_QWORD *)v3 ) 3223 if (pPlayer->Dead())
3258 { 3224 {
3259 v4 = pTexture_PlayerFaceDead; 3225 v4 = pTexture_PlayerFaceDead;
3260 goto LABEL_27; 3226 goto LABEL_27;
3261 } 3227 }
3262 v5 = 0; 3228
3263 if ( (signed int)pPlayerFrameTable->uNumFrames <= v1 )
3264 {
3265 LABEL_17:
3266 v7 = 0; 3229 v7 = 0;
3267 } 3230 for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
3268 else 3231 if (pPlayerFrameTable->pFrames[j].uSequenceID == pPlayer->uExpressionID)
3269 { 3232 {
3270 v6 = pPlayerFrameTable->pFrames; 3233 v7 = j;
3271 while ( v6->uSequenceID != *((short *)v3 + 3350) ) 3234 break;
3272 { 3235 }
3273 ++v5; 3236
3274 ++v6; 3237 if ( v7 == 0 )
3275 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames )
3276 goto LABEL_17;
3277 }
3278 v7 = v5;
3279 }
3280 if ( v7 == v1 )
3281 v7 = 1; 3238 v7 = 1;
3282 if ( *((short *)v3 + 3350) == 21 ) 3239 if (pPlayer->uExpressionID == 21 )
3283 v8 = pPlayerFrameTable->GetFrameBy_y( 3240 v8 = pPlayerFrameTable->GetFrameBy_y(
3284 (int *)v3 + 1678, 3241 &pPlayer->field_1AA8,
3285 (int *)v3 + 1677, 3242 &pPlayer->field_1AA4,
3286 pMiscTimer->uTimeElapsed); 3243 pMiscTimer->uTimeElapsed);
3287 else 3244 else
3288 v8 = pPlayerFrameTable->GetFrameBy_x(v7, *((short *)v3 + 3351)); 3245 v8 = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed);
3289 if ( *((short *)v3 + 3353) != v8->uTextureID - 1 || v22 ) 3246 if (pPlayer->field_1AA2 != v8->uTextureID - 1 || v22 )
3290 { 3247 {
3291 *((short *)v3 + 3353) = v8->uTextureID - 1; 3248 pPlayer->field_1AA2 = v8->uTextureID - 1;
3292 v1 = 0; 3249 v4 = (Texture *)pTextures_PlayerFaces[i][v8->uTextureID];
3293 v4 = (Texture *)A74CEC_player_faces_minus1_indexing[v21 + v8->uTextureID];
3294 goto LABEL_27; 3250 goto LABEL_27;
3295 } 3251 }
3296 LABEL_50: 3252 LABEL_50:
3297 v21 += 56; 3253 ;
3298 v3 += 6972; 3254 }
3299 ++v2; 3255
3300 if ( (signed int)v3 >= (signed int)&pParty->pHirelings[1].field_24 )
3301 break;
3302 v1 = 0;
3303 }
3304 if ( pParty->bTurnBasedModeOn == 1 ) 3256 if ( pParty->bTurnBasedModeOn == 1 )
3305 { 3257 {
3306 if ( pTurnEngine->field_4 != 1 ) 3258 if ( pTurnEngine->field_4 != 1 )
3307 { 3259 {
3308 if ( (pTurnEngine->pQueue[0].uPackedID & 7) == 4 ) 3260 if ( (pTurnEngine->pQueue[0].uPackedID & 7) == 4 )
3309 { 3261 {
3310 v14 = 0; 3262 //v14 = 0;
3311 if ( pTurnEngine->uActorQueueSize > 0 ) 3263 if ( pTurnEngine->uActorQueueSize > 0 )
3312 { 3264 {
3313 v15 = (char *)pTurnEngine->pQueue; 3265 //v15 = (char *)pTurnEngine->pQueue;
3314 do 3266 for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i)
3315 { 3267 {
3316 if ( (*v15 & 7) != 4 ) 3268 auto pElem = pTurnEngine->pQueue + i;
3269
3270 if ( (pElem->uPackedID & 7) != 4 )
3317 break; 3271 break;
3318 v16 = dword_5079D0; 3272 v16 = dword_5079D0;
3319 if ( pParty->uFlags & 0x10 ) 3273 if ( pParty->uFlags & 0x10 )
3320 { 3274 {
3321 v16 = dword_5079CC; 3275 v16 = dword_5079CC;
3324 { 3278 {
3325 if ( pParty->uFlags & 0x20 ) 3279 if ( pParty->uFlags & 0x20 )
3326 v16 = dword_5079C8; 3280 v16 = dword_5079C8;
3327 } 3281 }
3328 pRenderer->DrawTextureTransparent( 3282 pRenderer->DrawTextureTransparent(
3329 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[*(int *)v15 >> 3] - 4, 3283 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[pElem->uPackedID >> 3] - 4,
3330 0x181u, 3284 0x181u,
3331 (Texture *)(v16 != -1 ? (int)&pIcons_LOD->pTextures[v16] : 0)); 3285 (Texture *)(v16 != -1 ? &pIcons_LOD->pTextures[v16] : 0));
3332 ++v14;
3333 v15 += 16;
3334 } 3286 }
3335 while ( v14 < pTurnEngine->uActorQueueSize );
3336 } 3287 }
3337 } 3288 }
3338 } 3289 }
3339 } 3290 }
3340 else 3291 else
3341 { 3292 {
3342 v17 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing; 3293 for (uint i = 0; i < 4; ++i)
3343 v18 = (char *)pParty->pPlayers; 3294 {
3344 do 3295 auto pPlayer = pParty->pPlayers + i;
3345 { 3296 if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery)
3346 if ( ((Player *)v18)->CanAct() && !*((short *)v18 + 3226) )
3347 { 3297 {
3348 v19 = dword_5079D0; 3298 v19 = dword_5079D0;
3349 if ( pParty->uFlags & 0x10 ) 3299 if ( pParty->uFlags & 0x10 )
3350 { 3300 {
3351 v19 = dword_5079CC; 3301 v19 = dword_5079CC;
3354 { 3304 {
3355 if ( pParty->uFlags & 0x20 ) 3305 if ( pParty->uFlags & 0x20 )
3356 v19 = dword_5079C8; 3306 v19 = dword_5079C8;
3357 } 3307 }
3358 pRenderer->DrawTextureTransparent( 3308 pRenderer->DrawTextureTransparent(
3359 *v17 - 4, 3309 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4,
3360 0x181u, 3310 0x181u,
3361 (Texture *)(v19 != -1 ? (int)&pIcons_LOD->pTextures[v19] : 0)); 3311 (Texture *)(v19 != -1 ? &pIcons_LOD->pTextures[v19] : 0));
3362 } 3312 }
3363 v18 += 6972; 3313 }
3364 ++v17;
3365 }
3366 while ( (signed int)v18 < (signed int)pParty->pHirelings );
3367 } 3314 }
3368 } 3315 }
3369 3316
3370 3317
3371 //----- (0049387A) -------------------------------------------------------- 3318 //----- (0049387A) --------------------------------------------------------