comparison mm7_4.cpp @ 722:70c5a87a1307

Слияние
author Ritor1
date Wed, 20 Mar 2013 17:49:15 +0600
parents f39d5902c85a d6236f6a9882
children 256211e8243a
comparison
equal deleted inserted replaced
721:f39d5902c85a 722:70c5a87a1307
2837 } 2837 }
2838 2838
2839 2839
2840 2840
2841 2841
2842 //----- (004908DE) --------------------------------------------------------
2843 signed int __cdecl PlayerCreation_Chose4Skills()
2844 {
2845 Player *v0; // esi@1
2846 signed int v1; // edx@2
2847 unsigned short *v2; // eax@2
2848 signed int v3; // ecx@2
2849
2850 v0 = pParty->pPlayers;//[0].pActiveSkills;
2851 while ( 1 )
2852 {
2853 v1 = 0;
2854 v2 = v0->pActiveSkills;
2855 v3 = 37;
2856 do
2857 {
2858 if ( *v2 )
2859 ++v1;
2860 ++v2;
2861 --v3;
2862 }
2863 while ( v3 );
2864 if ( v1 < 4 )
2865 break;
2866 ++v0;
2867 if ( v0 > &pParty->pPlayers[3] )
2868 return 1;
2869 }
2870 return 0;
2871 }
2872
2873
2874
2875
2876 //----- (00491CB5) --------------------------------------------------------
2877 void __cdecl LoadPlayerPortraintsAndVoices()
2878 {
2879 //Texture **v0; // ebx@1
2880 //int v1; // eax@2
2881 //int v2; // edi@3
2882 char *v3; // esi@5
2883 char *v4; // [sp+10h] [bp-4h]@1
2884
2885 pIcons_LOD->pFacesLock = pIcons_LOD->uNumLoadedFiles;
2886
2887 for (uint i = 0; i < 4; ++i)
2888 for (uint j = 0; j < 56; ++j)
2889 {
2890 sprintf(pTmpBuf, "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uFace], j + 1);
2891 pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
2892 }
2893
2894 pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE);
2895 pTexture_PlayerFaceDead = pIcons_LOD->LoadTexturePtr("DEAD", TEXTURE_16BIT_PALETTE);
2896 pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE);
2897
2898 if (SoundSetAction[24][0])
2899 for (uint i = 0; i < 4; ++i)
2900 {
2901 pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0);
2902 pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0);
2903 }
2904 }
2905
2906 //----- (00491DE7) --------------------------------------------------------
2907 int __fastcall ReloadPlayerPortraits(int a1, int a2)
2908 {
2909 int result; // eax@1
2910 const char **v3; // ebp@1
2911 Texture **v4; // ebx@1
2912 int v5; // esi@2
2913
2914 result = 0;
2915 v3 = &pPlayerPortraitsNames[a2];
2916 v4 = pTextures_PlayerFaces[a1];
2917 do
2918 {
2919 v5 = result + 1;
2920 sprintf(pTmpBuf, "%s%02d", *v3, result + 1);
2921 pIcons_LOD->ReloadTexture(*v4, pTmpBuf, 2);
2922 result = v5;
2923 ++v4;
2924 }
2925 while ( v5 < 56 );
2926 return result;
2927 }
2928 2842
2929 2843
2930 //----- (00491E3A) -------------------------------------------------------- 2844 //----- (00491E3A) --------------------------------------------------------
2931 void __cdecl sub_491E3A() 2845 void __cdecl sub_491E3A()
2932 { 2846 {
3026 pIcons_LOD->pFacesLock = 0; 2940 pIcons_LOD->pFacesLock = 0;
3027 pIcons_LOD->uNumLoadedFiles = v12; 2941 pIcons_LOD->uNumLoadedFiles = v12;
3028 } 2942 }
3029 // 4ED498: using guessed type char byte_4ED498; 2943 // 4ED498: using guessed type char byte_4ED498;
3030 2944
3031 //----- (00491F87) -------------------------------------------------------- 2945
3032 void __cdecl DrawHiredNPCs()
3033 {
3034 //int v6; // eax@15
3035 char v7; // al@17
3036 unsigned int v8; // eax@18
3037 int v9; // esi@18
3038 int v10; // eax@18
3039 unsigned int v11; // eax@19
3040 unsigned int v12; // esi@19
3041 unsigned int v13; // eax@23
3042 IconFrame *v14; // eax@24
3043 unsigned int v15; // eax@26
3044 char pContainer[20]; // [sp+Ch] [bp-30h]@18
3045 unsigned int v17; // [sp+20h] [bp-1Ch]@19
3046 signed int uFrameID; // [sp+24h] [bp-18h]@19
3047 //int i; // [sp+28h] [bp-14h]@15
3048 unsigned int v20; // [sp+2Ch] [bp-10h]@20
3049 unsigned int v21; // [sp+30h] [bp-Ch]@19
3050 int v22; // [sp+34h] [bp-8h]@2
3051 unsigned __int8 v23; // [sp+3Bh] [bp-1h]@2
3052
3053 if ( bNoNPCHiring != 1 )
3054 {
3055 v23 = 0;
3056 v22 = 0;
3057 /*for (uint i = 0; i < 2; ++i)
3058 {
3059 if (pParty->pHirelings[i].pName)
3060 pTmpBuf[v22++] = i;
3061 }*/
3062 if (pParty->pHirelings[0].pName)
3063 pTmpBuf[v22++] = 0;
3064 if (pParty->pHirelings[1].pName)
3065 pTmpBuf[v22++] = 1;
3066
3067 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
3068 {
3069 if (pNPCStats->pNewNPCData[i].uFlags & 128)
3070 {
3071 if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName))
3072 {
3073 if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName))
3074 pTmpBuf[v22++] = i + 2;
3075 }
3076 }
3077 }
3078
3079 //v6 = (unsigned __int8)pParty->field_709;
3080 for ( int i = (unsigned __int8)pParty->field_709; i < v22 && v23 < 2; i++ )
3081 {
3082 v7 = pTmpBuf[i];
3083 if ( (unsigned __int8)v7 >= 2 )
3084 {
3085 sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID);
3086 v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
3087 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], (Texture *)(v15 != -1 ? &pIcons_LOD->pTextures[v15] : 0));
3088 }
3089 else
3090 {
3091 sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID);
3092 v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
3093 v9 = v23;
3094 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0));
3095 v10 = (unsigned __int8)pTmpBuf[i];
3096 if ( pParty->pHirelings[v10].evt_A == 1 )
3097 {
3098 uFrameID = pParty->pHirelings[v10].evt_B;
3099 v11 = pHiredNPCsIconsOffsetsX[v9];
3100 v12 = pHiredNPCsIconsOffsetsY[v9];
3101 v17 = v11;
3102 v21 = 0;
3103 if ( (signed int)pIconsFrameTable->uNumIcons <= 0 )
3104 {
3105 LABEL_23:
3106 v13 = 0;
3107 }
3108 else
3109 {
3110 v20 = 0;
3111 while ( _strcmpi("spell96", pIconsFrameTable->pIcons[v20 / 0x20].pAnimationName) )
3112 {
3113 ++v21;
3114 v20 += 32;
3115 if ( (signed int)v21 >= (signed int)pIconsFrameTable->uNumIcons )
3116 goto LABEL_23;
3117 }
3118 v13 = v21;
3119 }
3120 v14 = pIconsFrameTable->GetFrame(v13, uFrameID);
3121 pRenderer->DrawTextureTransparent(v17, v12, &pIcons_LOD->pTextures[v14->uTextureID]);
3122 }
3123 }
3124 ++v23;
3125 }
3126 }
3127 }
3128 // 6BE3C5: using guessed type char bNoNPCHiring;
3129
3130
3131
3132 //----- (004921C1) --------------------------------------------------------
3133 void GameUI_DrawPortraits(unsigned int _this)
3134 {
3135 Texture *pFace; // eax@10
3136 unsigned int v7; // eax@17
3137 PlayerFrame *pFrame; // eax@21
3138 unsigned int v9; // eax@27
3139 bool v10; // eax@33
3140 bool v11; // edi@40
3141 bool v12; // edx@43
3142 bool v13; // ecx@46
3143 int v16; // eax@57
3144 int v19; // eax@62
3145 Texture *pPortrait; // [sp-4h] [bp-1Ch]@27
3146 unsigned int v22; // [sp+14h] [bp-4h]@1
3147
3148 v22 = _this;
3149 if ( qword_A750D8 )
3150 {
3151 qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed;
3152 if ( qword_A750D8 <= 0 )
3153 {
3154 if ( pPlayers[word_A750E2]->CanAct() )
3155 pPlayers[word_A750E2]->PlaySound((PlayerSpeech)word_A750E0, 0);
3156 qword_A750D8 = 0i64;
3157 }
3158 }
3159
3160 for (uint i = 0; i < 4; ++i)
3161 {
3162 auto pPlayer = pParty->pPlayers + i;
3163
3164 if (pPlayer->Eradicated())
3165 {
3166 pFace = pTexture_PlayerFaceEradicated;
3167 pPortrait = pFace;
3168 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
3169 if ( pParty->pPartyBuffs[11].uExpireTime )
3170 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
3171 else
3172 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
3173 auto _v1 = 0;
3174 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
3175 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
3176 _v1 = 1;
3177 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
3178 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
3179 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
3180 if ( v13 | v12 | v11 | _v1 | v10 )
3181 sub_441A4E(i);
3182 continue;
3183 }
3184 if (pPlayer->Dead())
3185 {
3186 pFace = pTexture_PlayerFaceDead;
3187 pPortrait = pFace;
3188 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
3189 if ( pParty->pPartyBuffs[11].uExpireTime )
3190 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
3191 else
3192 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
3193 auto _v1 = 0;
3194 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
3195 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
3196 _v1 = 1;
3197 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
3198 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
3199 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
3200 if ( v13 | v12 | v11 | _v1 | v10 )
3201 sub_441A4E(i);
3202 continue;
3203 }
3204 v7 = 0;
3205 for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
3206 if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression)
3207 {
3208 v7 = j;
3209 break;
3210 }
3211 if ( v7 == 0 )
3212 v7 = 1;
3213 if (pPlayer->expression == CHARACTER_EXPRESSION_21)
3214 pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed);
3215 else
3216 pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed);
3217 if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || v22 )
3218 {
3219 pPlayer->field_1AA2 = pFrame->uTextureID - 1;
3220 pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID];
3221 pPortrait = pFace;
3222 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
3223 if ( pParty->pPartyBuffs[11].uExpireTime )
3224 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
3225 else
3226 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
3227 auto _v1 = 0;
3228 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
3229 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
3230 _v1 = 1;
3231 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
3232 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
3233 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
3234 if ( v13 | v12 | v11 | _v1 | v10 )
3235 sub_441A4E(i);
3236 continue;
3237 }
3238 }
3239 if ( pParty->bTurnBasedModeOn == 1 )
3240 {
3241 if ( pTurnEngine->field_4 != 1 )
3242 {
3243 if ( (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player)
3244 {
3245 //v14 = 0;
3246 if ( pTurnEngine->uActorQueueSize > 0 )
3247 {
3248 //v15 = (char *)pTurnEngine->pQueue;
3249 for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i)
3250 {
3251 auto pElem = pTurnEngine->pQueue + i;
3252
3253 if ( (pElem->uPackedID & 7) != OBJECT_Player)
3254 break;
3255 v16 = dword_5079D0;
3256 if ( pParty->uFlags & 0x10 )
3257 {
3258 v16 = dword_5079CC;
3259 }
3260 else
3261 {
3262 if ( pParty->uFlags & 0x20 )
3263 v16 = dword_5079C8;
3264 }
3265 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[pElem->uPackedID >> 3] - 4,
3266 0x181u, (Texture *)(v16 != -1 ? &pIcons_LOD->pTextures[v16] : 0));
3267 }
3268 }
3269 }
3270 }
3271 }
3272 else
3273 {
3274 for (uint i = 0; i < 4; ++i)
3275 {
3276 auto pPlayer = pParty->pPlayers + i;
3277 if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery)
3278 {
3279 v19 = dword_5079D0;
3280 if ( pParty->uFlags & 0x10 )
3281 {
3282 v19 = dword_5079CC;
3283 }
3284 else
3285 {
3286 if ( pParty->uFlags & 0x20 )
3287 v19 = dword_5079C8;
3288 }
3289 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4,
3290 0x181u, (Texture *)(v19 != -1 ? &pIcons_LOD->pTextures[v19] : 0));
3291 }
3292 }
3293 }
3294 }
3295 2946
3296 2947
3297 //----- (0049387A) -------------------------------------------------------- 2948 //----- (0049387A) --------------------------------------------------------
3298 int CycleCharacter(unsigned int _this) 2949 int CycleCharacter(unsigned int _this)
3299 { 2950 {
5257 } 4908 }
5258 } 4909 }
5259 return pTmpBuf2; 4910 return pTmpBuf2;
5260 } 4911 }
5261 4912
5262 //----- (00495B39) -------------------------------------------------------- 4913
5263 void __cdecl PlayerCreationUI_Draw() 4914
5264 {
5265 const char *uTitleText; // ST10_4@3
5266 int pTextCenter; // eax@3
5267 IconFrame *v3; // eax@3
5268 int v4; // ecx@7
5269 GUIButton *uPosActiveItem; // edi@12
5270 int v6; // esi@14
5271 int uNumLet; // eax@14
5272 char v8; // al@17
5273 int v9; // ecx@17
5274 char v10; // sf@17
5275 int v11; // ecx@19
5276 void *v12; // eax@20
5277 int v13; // ecx@21
5278 int v14; // ecx@22
5279 char *v15; // ST14_4@24
5280 size_t v16; // eax@28
5281 int v17; // eax@33
5282 //enum CHARACTER_RACE uNumRace; // eax@35
5283 int v19; // eax@36
5284 int v20; // eax@37
5285 int uNumMight; // eax@44
5286 unsigned int v24; // eax@44
5287 int v25; // eax@44
5288 unsigned int v26; // eax@44
5289 int v27; // eax@44
5290 unsigned int v28; // eax@44
5291 int v29; // eax@44
5292 unsigned int v30; // eax@44
5293 int v31; // eax@44
5294 unsigned int v32; // eax@44
5295 int v33; // eax@44
5296 unsigned int v34; // eax@44
5297 int v35; // eax@44
5298 unsigned int v36; // eax@44
5299 enum PLAYER_SKILL_TYPE v37; // eax@44
5300 enum PLAYER_SKILL_TYPE v39; // eax@44
5301 enum PLAYER_SKILL_TYPE v41; // eax@44
5302 const char *v42; // edx@44
5303 char *v43; // ST1C_4@44
5304 int v45; // eax@44
5305 enum PLAYER_SKILL_TYPE v46; // eax@46
5306 const char *v47; // edx@46
5307 char *v48; // ST1C_4@46
5308 int v50; // eax@46
5309 int v51; // eax@49
5310 char *v52; // edi@52
5311 char v53; // al@52
5312 PLAYER_CLASS_TYPE uClassType; // edi@53
5313 int v55; // ST0C_4@53
5314 int v57; // eax@53
5315 int v61; // ecx@55
5316 int v64; // ST08_4@57
5317 int v66; // ecx@57
5318 int v71; // eax@59
5319 int v75; // eax@61
5320 int v80; // eax@63
5321 int v85; // eax@65
5322 int v89; // eax@67
5323 int v94; // eax@69
5324 enum PLAYER_SKILL_TYPE pSkillId; // edi@72
5325 size_t pLenText; // eax@72
5326 signed int v104; // ecx@72
5327 int pColorText; // ecx@79
5328 unsigned int v107; // ST0C_4@81
5329 int pTextY; // ST08_4@81
5330 int v111; // ST0C_4@82
5331 signed int v113; // edi@82
5332 int v114; // ST0C_4@82
5333 const char *uRaceName; // [sp+0h] [bp-170h]@39
5334 char pText[200]; // [sp+10h] [bp-160h]@14
5335 GUIWindow pWindow; // [sp+D8h] [bp-98h]@83
5336 int v119; // [sp+12Ch] [bp-44h]@18
5337 size_t v120; // [sp+130h] [bp-40h]@25
5338 int uY; // [sp+134h] [bp-3Ch]@18
5339 int v122; // [sp+138h] [bp-38h]@18
5340 int v123; // [sp+13Ch] [bp-34h]@11
5341 void *v124; // [sp+140h] [bp-30h]@18
5342 int uColor1; // [sp+144h] [bp-2Ch]@1
5343 int v126; // [sp+148h] [bp-28h]@25
5344 int uColorGreen; // [sp+14Ch] [bp-24h]@1
5345 int v128; // [sp+150h] [bp-20h]@14
5346 int v129; // [sp+154h] [bp-1Ch]@18
5347 int uColorTeal; // [sp+158h] [bp-18h]@1
5348 int uColorWhite; // [sp+15Ch] [bp-14h]@1
5349 int uX; // [sp+160h] [bp-10h]@18
5350 unsigned int v133; // [sp+164h] [bp-Ch]@25
5351 int pOrder; // [sp+168h] [bp-8h]@14
5352 //char *Str; // [sp+16Ch] [bp-4h]@18
5353 //Player *pPlayer;
5354 const char *pSkillName;
5355
5356 uColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xD1, 0xBB, 0x61);
5357 uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7, 0xF7);
5358 uColorGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFF, 0);
5359 uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
5360 pRenderer->BeginScene();
5361 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
5362 uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20;
5363 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY);
5364 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - 640, 2, pTexture_MAKESKY);
5365 //if (uPlayerCreationUI_SkySliderPos > 640)
5366 //uPlayerCreationUI_SkySliderPos = 0;
5367 pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP);
5368 uTitleText = pGlobalTXT_LocalizationStrings[51];
5369 uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7;
5370 pTextCenter = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]);
5371 pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, uTitleText, 0, 0, 0);
5372 pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uFace]);
5373 pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uFace]);
5374 pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uFace]);
5375 pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uFace]);
5376 v3 = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime);
5377 if ( uPlayerCreationUI_SelectedCharacter )
5378 {
5379 switch ( uPlayerCreationUI_SelectedCharacter )
5380 {
5381 case 1:
5382 v4 = 171;
5383 break;
5384 case 2:
5385 v4 = 329;
5386 break;
5387 case 3:
5388 v4 = 488;
5389 break;
5390 default:
5391 v4 = v123;
5392 break;
5393 }
5394 }
5395 else
5396 {
5397 v4 = 12;
5398 }
5399
5400 pRenderer->DrawTextureTransparent(v4, 29, &pIcons_LOD->pTextures[v3->uTextureID]);
5401 uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem);
5402 uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25;
5403 pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]);
5404 pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]);
5405 //if (uPlayerCreationUI_ArrowAnim < 0)
5406 // uPlayerCreationUI_ArrowAnim = 18;
5407 v6 = pFontCreate->uFontHeight - 2;
5408 v128 = pFontCreate->uFontHeight - 2;
5409 memset(pText, 0, 200);
5410 strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills"
5411 uNumLet = strlen(pText) - 1;
5412 pOrder = uNumLet;
5413 if ( uNumLet >= 0 )
5414 {
5415 while ( 1 )
5416 {
5417 v8 = toupper((unsigned __int8)pText[uNumLet]);
5418 v9 = pOrder;
5419 v10 = pOrder-- - 1 < 0;
5420 pText[v9] = v8;
5421 if ( v10 )
5422 break;
5423 uNumLet = pOrder;
5424 }
5425 }
5426 pOrder = 18;
5427 v124 = 0;
5428 uX = 32;
5429 uY = 3 * v6 + 169;
5430 v122 = 5 * v6 + 169;
5431 v123 = 3 * v6 + 311;
5432 v129 = 493;
5433 //pPlayer = pParty->pPlayers;
5434 v119 = 6 * v6 + 169;
5435 //do
5436
5437 //for ( pPlayer = pParty->pPlayers; (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges; pPlayer++)
5438 for (int i = 0; i < 4; ++i)
5439 {
5440 auto player = pParty->pPlayers + i;
5441
5442 //Str = pPlayer->pName;
5443 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pOrder + 73, 100, 0, pClassNames[player->classType], 0, 0, 0);
5444 pRenderer->DrawTextureTransparent(pOrder + 77, 50, pTexture_IC_KNIGHT[player->classType / 4]);
5445 v11 = pGUIWindow_CurrentMenu->field_40;
5446 if ( v11 && (v12 = pGUIWindow_CurrentMenu->ptr_1C, v12 == v124) )
5447 {
5448 v13 = v11 - 1;
5449 if ( v13 )
5450 {
5451 v14 = v13 - 1;
5452 if ( v14 )
5453 {
5454 if ( v14 == 1 )
5455 {
5456 pGUIWindow_CurrentMenu->field_40 = 0;
5457 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 124, 0, player->pName, 130, 0);
5458 SetCurrentMenuID(MENU_NAMEPANELESC);
5459 }
5460 }
5461 else
5462 {
5463 pGUIWindow_CurrentMenu->field_40 = 0;
5464 v120 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
5465 v126 = 0;
5466 v133 = 0;
5467 if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) )//edit name
5468 {
5469 do
5470 {
5471 if ( pKeyActionMap->pPressedKeysBuffer[v133] == ' ' )
5472 ++v126;
5473 ++v133;
5474 v16 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
5475 }
5476 while ( v133 < v16 );
5477 }
5478 if ( v120 && v126 != v120 )
5479 strcpy(player->pName, (const char *)pKeyActionMap->pPressedKeysBuffer);
5480 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7C, 0, player->pName, 130, 0);
5481 *(short *)&player->field_1988[27] = 1; //
5482 }
5483 }
5484 else
5485 {
5486 v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)v12 + 18, 0x7Cu, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1);
5487 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate);
5488 }
5489 }
5490 else
5491 {
5492 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7C, 0, player->pName, 130, 0);
5493 }
5494 switch (player->GetRace())
5495 {
5496 case 0: uRaceName = pGlobalTXT_LocalizationStrings[99]; break; // "Human"
5497 case 1: uRaceName = pGlobalTXT_LocalizationStrings[103]; break; // "Dwarf"
5498 case 2: uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin"
5499 case 3: uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf"
5500 };
5501 strcpy(pTmpBuf, uRaceName);
5502 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder + 72, v128 + 12, 0, pTmpBuf, 130, 0);
5503 pTextCenter = pFontCreate->AlignText_Center(0x96, pText);
5504 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, uColor1, pText, 0, 0, 0);
5505 uNumMight = player->GetActualMight();
5506 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], v129, uNumMight);// "Might"
5507 LOWORD(v24) = player->GetStatColor(0);
5508 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, v24, pTmpBuf, 0, 0, 0);
5509 v25 = player->GetActualIntelligence();
5510 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], v129, v25);// "Intellect"
5511 LOWORD(v26) = player->GetStatColor(1);
5512 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v128 + 169, v26, pTmpBuf, 0, 0, 0);
5513 v27 = player->GetActualWillpower();
5514 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], v129, v27);// "Personality"
5515 LOWORD(v28) = player->GetStatColor(2);
5516 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * v128 + 169, v28, pTmpBuf, 0, 0, 0);
5517 v29 = player->GetActualEndurance();
5518 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], v129, v29);// "Endurance"
5519 LOWORD(v30) = player->GetStatColor(3);
5520 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, uY, v30, pTmpBuf, 0, 0, 0);
5521 v31 = player->GetActualAccuracy();
5522 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], v129, v31);// "Accuracy"
5523 LOWORD(v32) = player->GetStatColor(4);
5524 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * v128 + 169, v32, pTmpBuf, 0, 0, 0);
5525 v33 = player->GetActualSpeed();
5526 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], v129, v33);// "Speed"
5527 LOWORD(v34) = player->GetStatColor(5);
5528 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v122, v34, pTmpBuf, 0, 0, 0);
5529 v35 = player->GetActualLuck();
5530 sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], v129, v35);// "Luck"
5531 LOWORD(v36) = player->GetStatColor(6);
5532 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v119, v36, pTmpBuf, 0, 0, 0);
5533 v37 = player->GetSkillIdxByOrder(0);
5534 pTextCenter = pFontCreate->AlignText_Center(0x96u, pSkillNames[v37]);
5535 sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v37]);
5536 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf, 0, 0, 0);
5537 v39 = player->GetSkillIdxByOrder(1);
5538 pTextCenter = pFontCreate->AlignText_Center(0x96u, pSkillNames[v39]);
5539 sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v39]);
5540 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v128 + 311, uColorWhite, pTmpBuf, 0, 0, 0);
5541 v41 = player->GetSkillIdxByOrder(2);
5542 pTextCenter = pFontCreate->AlignText_Center(150u, pSkillNames[v41]);
5543 sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v41]);
5544 v45 = uColorGreen;
5545 if ( (signed int)v41 >= 37 )
5546 v45 = uColorTeal;
5547 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * v128 + 311, v45, pTmpBuf, 0, 0, 0);
5548 v46 = player->GetSkillIdxByOrder(3);
5549 pTextCenter = pFontCreate->AlignText_Center(150u, pSkillNames[v46]);
5550 sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v46]);
5551 v50 = uColorGreen;
5552 if ( (signed int)v46 >= 37 )
5553 v50 = uColorTeal;
5554 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v123, v50, pTmpBuf, 0, 0, 0);
5555 //pPlayer++;
5556 v124 = (char *)v124 + 1;
5557 pOrder += 159;
5558 v129 -= 158;
5559 uX += 158;
5560 }
5561
5562 //while ( (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges );
5563 strcpy(pText, pGlobalTXT_LocalizationStrings[41]);// "Class"
5564 v51 = strlen(pText) - 1;
5565 pOrder = v51;
5566 if ( v51 >= 0 )
5567 {
5568 while ( 1 )
5569 {
5570 v52 = &pText[v51];
5571 v53 = toupper((unsigned __int8)pText[v51]);
5572 v10 = pOrder-- - 1 < 0;
5573 *v52 = v53;
5574 if ( v10 )
5575 break;
5576 v51 = pOrder;
5577 }
5578 }
5579 uClassType = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].classType;
5580 pTextCenter = pFontCreate->AlignText_Center(193u, pText);
5581 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 324, 395, uColor1, pText, 0, 0, 0);
5582 v57 = uColorTeal;
5583 if ( uClassType )
5584 v57 = uColorWhite;
5585 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[0]);
5586 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 417, v57, pClassNames[0], 0, 0, 0);
5587 v61 = uColorTeal;
5588 if ( uClassType != PLAYER_CLASS_PALADIN )
5589 v61 = uColorWhite;
5590 uColorGreen = v128 + 417;
5591 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[12]);
5592 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, v128 + 417, v61, pClassNames[12], 0, 0, 0);
5593 v66 = uColorTeal;
5594 if ( uClassType != PLAYER_CLASS_DRUID )
5595 v66 = uColorWhite;
5596 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[20]);
5597 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 2 * v128 + 417, v66, pClassNames[20], 0, 0, 0);
5598 v71 = uColorTeal;
5599 if ( uClassType != PLAYER_CLASS_CLERIC )
5600 v71 = uColorWhite;
5601 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[24]);
5602 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 417, v71, pClassNames[24], 0, 0, 0);
5603 v75 = uColorTeal;
5604 if ( uClassType != PLAYER_CLASS_DRUID)
5605 v75 = uColorWhite;
5606 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[28]);
5607 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, uColorGreen, v75, pClassNames[28], 0, 0, 0);
5608 v80 = uColorTeal;
5609 if ( uClassType != PLAYER_CLASS_SORCERER )
5610 v80 = uColorWhite;
5611 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[32]);
5612 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 2 * v128 + 417, v80, pClassNames[32], 0, 0, 0);
5613 v85 = uColorTeal;
5614 if ( uClassType != PLAYER_CLASS_ARCHER )
5615 v85 = uColorWhite;
5616 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[16]);
5617 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 417, v85, pClassNames[16], 0, 0, 0);
5618 v89 = uColorTeal;
5619 if ( uClassType != PLAYER_CLASS_MONK )
5620 v89 = uColorWhite;
5621 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[8]);
5622 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, uColorGreen, v89, pClassNames[8], 0, 0, 0);
5623 v94 = uColorTeal;
5624 if ( uClassType != PLAYER_CLASS_THEIF )
5625 v94 = uColorWhite;
5626 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[4]);
5627 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 2 * v128 + 417, v94, pClassNames[4], 0, 0, 0);
5628 pTextCenter = pFontCreate->AlignText_Center(0xECu, pGlobalTXT_LocalizationStrings[20]); // "Available Skills"
5629 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 37, 395, uColor1, pGlobalTXT_LocalizationStrings[20], 0, 0, 0);
5630 //pOrder = 0;
5631 //do
5632 for (pOrder = 0; pOrder < 9; ++pOrder)
5633 {
5634 pSkillId = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pOrder + 4);
5635 strcpy(pText, pSkillNames[pSkillId]);
5636 pLenText = strlen(pText);
5637 v104 = 0;
5638 if ( (signed int)pLenText > 0 )
5639 {
5640 if ( pText[v104] == 32 )
5641 {
5642 pText[v104] = 0;
5643 }
5644 else
5645 {
5646 while ( pText[v104] != 32 )
5647 //for (v104 = 0; v104 < (signed int)pLenText || pText[v104] != 32; ++v104)
5648 {
5649 ++v104;
5650 if ( v104 >= (signed int)pLenText )
5651 break;
5652 }
5653 }
5654 }
5655 uColorGreen = -5;
5656 if ( (signed int)v124 > 2 )
5657 uColorGreen = 0;
5658 pColorText = uColorTeal;
5659 if ( !pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pSkillId] )
5660 pColorText = uColorWhite;
5661 pTextCenter = pFontCreate->AlignText_Center(100, pText);
5662 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 100 * (pOrder / 3) + pTextCenter + uColorGreen + 17, v128 * (pOrder % 3) + 417, pColorText, pText, 0, 0, 0);
5663 //++pOrder;
5664 }
5665 //while ( pOrder < 9 );
5666 pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus"
5667 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, uColor1, pGlobalTXT_LocalizationStrings[30], 0, 0, 0);
5668 v113 = PlayerCreation_ComputeAttributeBonus();
5669 sprintf(pTmpBuf, "%d", v113);
5670 pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf);
5671 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf, 0, 0, 0);
5672 if ( GameUI_StatusBar_TimedStringTimeLeft > GetTickCount() )
5673 {
5674 pWindow.Hint = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points."
5675 if ( v113 < 0 )
5676 pWindow.Hint = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points."
5677 pWindow.uFrameWidth = 300;
5678 pWindow.uFrameHeight = 100;
5679 pWindow.uFrameX = 170;
5680 pWindow.uFrameY = 140;
5681 pWindow.uFrameZ = 469;
5682 pWindow.uFrameW = 239;
5683 pWindow.DrawMessageBox(0);
5684 }
5685 pRenderer->EndScene();
5686 }
5687
5688 //----- (0049695A) --------------------------------------------------------
5689 void __cdecl PlayerCreationUI_Initialize()
5690 {
5691 unsigned int v0; // ebx@5
5692 unsigned int v1; // eax@6
5693 int v2; // ecx@6
5694 unsigned int v3; // eax@8
5695 signed int v4; // ecx@8
5696 signed int uControlParam; // [sp+10h] [bp-Ch]@7
5697 unsigned int uControlParama; // [sp+10h] [bp-Ch]@9
5698 unsigned int uControlParamb; // [sp+10h] [bp-Ch]@11
5699 unsigned int uControlParamc; // [sp+10h] [bp-Ch]@13
5700 signed int uControlParamd; // [sp+10h] [bp-Ch]@15
5701 signed int uX; // [sp+14h] [bp-8h]@5
5702 unsigned int uXa; // [sp+14h] [bp-8h]@9
5703 unsigned int uXb; // [sp+14h] [bp-8h]@11
5704 unsigned int uXc; // [sp+14h] [bp-8h]@13
5705 signed int uXd; // [sp+14h] [bp-8h]@16
5706
5707 if ( pMessageQueue_50CBD0->uNumMessages )
5708 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
5709 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
5710 ++pIcons_LOD->uTexturePacksCount;
5711 if ( !pIcons_LOD->uNumPrevLoadedFiles )
5712 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
5713 pCurrentScreen = SCREEN_PARTY_CREATION;
5714 uPlayerCreationUI_ArrowAnim = 0;
5715 uPlayerCreationUI_SkySliderPos = 0;
5716 uPlayerCreationUI_SelectedCharacter = 0;
5717 v0 = LOBYTE(pFontCreate->uFontHeight) - 2;
5718 pTexture_IC_KNIGHT[0] = pIcons_LOD->LoadTexturePtr("IC_KNIGHT", TEXTURE_16BIT_PALETTE);
5719 pTexture_IC_KNIGHT[1] = pIcons_LOD->LoadTexturePtr("IC_THIEF", TEXTURE_16BIT_PALETTE);
5720 pTexture_IC_KNIGHT[2] = pIcons_LOD->LoadTexturePtr("IC_MONK", TEXTURE_16BIT_PALETTE);
5721 pTexture_IC_KNIGHT[3] = pIcons_LOD->LoadTexturePtr("IC_PALAD", TEXTURE_16BIT_PALETTE);
5722 pTexture_IC_KNIGHT[4] = pIcons_LOD->LoadTexturePtr("IC_ARCH", TEXTURE_16BIT_PALETTE);
5723 pTexture_IC_KNIGHT[5] = pIcons_LOD->LoadTexturePtr("IC_RANGER", TEXTURE_16BIT_PALETTE);
5724 pTexture_IC_KNIGHT[6] = pIcons_LOD->LoadTexturePtr("IC_CLER", TEXTURE_16BIT_PALETTE);
5725 pTexture_IC_KNIGHT[7] = pIcons_LOD->LoadTexturePtr("IC_DRUID", TEXTURE_16BIT_PALETTE);
5726 pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE);
5727 pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE);
5728 pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE);
5729 for(uX=0;uX < 22;++uX ) // load PlayerPortraits texture
5730 {
5731 sprintf(pTmpBuf, "%s01", pPlayerPortraitsNames[uX]);
5732 v1 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
5733 pPlayerPortraits[uX] = &pIcons_LOD->pTextures[v1];
5734
5735 }
5736 pTexture_PlayerFaceMask = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("FACEMASK", TEXTURE_16BIT_PALETTE)];
5737 pTexture_buttminu = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttminu", TEXTURE_16BIT_PALETTE)];
5738 pTexture_buttplus = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttplus", TEXTURE_16BIT_PALETTE)];
5739 pTexture_pressrigh = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("presrigh", TEXTURE_16BIT_PALETTE)];
5740 pTexture_presleft = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("presleft", TEXTURE_16BIT_PALETTE)];
5741 uControlParam = 1;
5742 do
5743 {
5744 sprintf(pTmpBuf, "arrowl%d", uControlParam);
5745 pTextures_arrowl[uControlParam] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)];
5746 sprintf(pTmpBuf, "arrowr%d", uControlParam);
5747 v3 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
5748 v4 = uControlParam++;
5749 pTextures_arrowr[v4] = &pIcons_LOD->pTextures[v3];
5750 }
5751 while ( uControlParam < 20 );
5752 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
5753 uControlParama = 0;
5754 uXa = 8;
5755 do
5756 {
5757 pGUIWindow_CurrentMenu->CreateButton(uXa, 120u, 145u, 25u, 1, 0, 0x3Cu, uControlParama, 0, "", 0);
5758 uXa += 158;
5759 ++uControlParama;
5760 }
5761 while ( (signed int)uXa < 640 );
5762 pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10, 32, 11, 13, 1, 0, 0xABu, 0, 0, "", pTexture_presleft, 0);
5763 pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169, 32, 11, 13, 1, 0, 0xABu, 1, 0, "", pTexture_presleft, 0);
5764 pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(327, 32, 11, 13, 1, 0, 0xABu, 2, 0, "", pTexture_presleft, 0);
5765 pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(486, 32, 11, 13, 1, 0, 0xABu, 3, 0, "", pTexture_presleft, 0);
5766 pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton(74, 32, 11, 13, 1, 0, 0xACu, 0, 0, "", pTexture_pressrigh, 0);
5767 pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(233, 32, 11, 13, 1, 0, 0xACu, 1, 0, "", pTexture_pressrigh, 0);
5768 pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(391, 32, 11, 13, 1, 0, 0xACu, 2, 0, "", pTexture_pressrigh, 0);
5769 pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(549, 32, 11, 13, 1, 0, 0xACu, 3, 0, "", pTexture_pressrigh, 0);
5770 pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton(10, 103, 11, 13, 1, 0, 0x90u, 0, 0, "", pTexture_presleft, 0);
5771 pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, 0x90u, 1, 0, "", pTexture_presleft, 0);
5772 pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, 0x90u, 2, 0, "", pTexture_presleft, 0);
5773 pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, 0x90u, 3, 0, "", pTexture_presleft, 0);
5774 pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton(74, 103, 11, 13, 1, 0, 0x91u, 0, 0, "", pTexture_pressrigh, 0);
5775 pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, 0x91u, 1, 0, "", pTexture_pressrigh, 0);
5776 pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, 0x91u, 2, 0, "", pTexture_pressrigh, 0);
5777 pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, 0x91u, 3, 0, "", pTexture_pressrigh, 0);
5778 uControlParamb = 0;
5779 uXb = 8;
5780 do
5781 {
5782 pGUIWindow_CurrentMenu->CreateButton(uXb, 308, 150, v0, 1, 0, 0x48u, uControlParamb, 0, "", 0);
5783 pGUIWindow_CurrentMenu->CreateButton(uXb, v0 + 308, 150, v0, 1, 0, 0x49u, uControlParamb, 0, "", 0);
5784 pGUIWindow_CurrentMenu->CreateButton(uXb, 2 * v0 + 308, 150u, v0, 1, 0, 0x4Au, uControlParamb, 0, "", 0);
5785 pGUIWindow_CurrentMenu->CreateButton(uXb, 3 * v0 + 308, 150u, v0, 1, 0, 0x4Bu, uControlParamb, 0, "", 0);
5786 uXb += 158;
5787 ++uControlParamb;
5788 }
5789 while ( (signed int)uXb < 640 );
5790 pGUIWindow_CurrentMenu->CreateButton(5u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 0, 0x31u, "", 0);
5791 pGUIWindow_CurrentMenu->CreateButton(163u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 1u, 0x32u, "", 0);
5792 pGUIWindow_CurrentMenu->CreateButton(321u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 2u, 0x33u, "", 0);
5793 pGUIWindow_CurrentMenu->CreateButton(479u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 3u, 0x34u, "", 0);
5794 uXc = 23;
5795 uControlParamc = 2;
5796 do
5797 {
5798 pGUIWindow_CurrentMenu->CreateButton(uXc, 169, 120, 20, 1, 0, 0, uControlParamc - 2, 0, "", 0);
5799 pGUIWindow_CurrentMenu->CreateButton(uXc, v0 + 169, 120, 20, 1, 0, 0, uControlParamc - 1, 0, "", 0);
5800 pGUIWindow_CurrentMenu->CreateButton(uXc, 2 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc, 0, "", 0);
5801 pGUIWindow_CurrentMenu->CreateButton(uXc, 3 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 1, 0, "", 0);
5802 pGUIWindow_CurrentMenu->CreateButton(uXc, 4 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 2, 0, "", 0);
5803 pGUIWindow_CurrentMenu->CreateButton(uXc, 5 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 3, 0, "", 0);
5804 pGUIWindow_CurrentMenu->CreateButton(uXc, 6 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 4, 0, "", 0);
5805 uControlParamc += 7;
5806 uXc += 158;
5807 }
5808 while ( (signed int)uControlParamc < 30 );
5809 pGUIWindow_CurrentMenu->_41D08F(28, 0, 7, 40);
5810 pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, 0x41, 0, 0, "", 0);
5811 pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, 0x41, 0xC, 0, "", 0);
5812 pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x14, 0, "", 0);
5813 pGUIWindow_CurrentMenu->CreateButton(388, 417, 65, v0, 1, 0, 0x41, 0x18, 0, "", 0);
5814 pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417, 65, v0, 1, 0, 0x41, 0x1C, 0, "", 0);
5815 pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x20, 0, "", 0);
5816 pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, 0x41, 0x10, 0, "", 0);
5817 pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, 0x41, 8, 0, "", 0);
5818 pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 4, 0, "", 0);
5819 uControlParamd = 0;
5820 do
5821 {
5822 uXd = -5;
5823 if ( uControlParamd <= 3 )
5824 uXd = 0;
5825 pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParamd / 3) + uXd + 17, v0 * (uControlParamd % 3) + 417, 100, v0, 1, 0, 0x40,
5826 uControlParamd, 0, "", 0);
5827 ++uControlParamd;
5828 }
5829 while ( uControlParamd < 9 );
5830 pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, 0x42, 0, 0xD, "",
5831 (Texture *)(uTextureID_BUTTMAKE != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE] : 0), 0);
5832 pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, 0x43, 0, 0x43, "",
5833 (Texture *)(uTextureID_BUTTMAKE2 != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE2] : 0), 0);
5834 pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, 0x3F, 0, 0x2D, "", pTexture_buttminu, 0);
5835 pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, 0x3E, 1, 0x2B, "", pTexture_buttplus, 0);
5836 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
5837 }
5838 // 4E28F8: using guessed type int pCurrentScreen;
5839
5840 //----- (0049750E) --------------------------------------------------------
5841 void __cdecl DeleteCCharFont()
5842 {
5843 pAllocator->FreeChunk(pFontCChar);
5844 pFontCChar = 0;
5845 }
5846 //----- (00497526) --------------------------------------------------------
5847 bool __cdecl PlayerCreationUI_Loop()
5848 {
5849 //RGBTexture *pTexture; // ebx@1
5850 UINT v1; // esi@1
5851 unsigned int v2; // ecx@3
5852 LONG uMouseX; // edi@6
5853 LONG uMouseY; // eax@6
5854 GUIButton *pControlsHead; // edx@6
5855 //unsigned int pNumMessage; // ecx@7
5856 int pControlParam; // esi@12
5857 signed int v8; // edi@30
5858 int v9; // edx@31
5859 char *v10; // ebx@37
5860 Player *v11; // esi@38
5861 //signed int uSpellBookPageCount; // ecx@40
5862 int v13; // eax@40
5863 //signed int uSkillIdx; // eax@45
5864 int v15; // eax@70
5865 signed int v16; // ecx@70
5866 //unsigned int v18; // [sp-4h] [bp-84h]@48
5867 ItemGen item; // [sp+Ch] [bp-74h]@37
5868 char v20[32]; // [sp+30h] [bp-50h]@29
5869 //char v21; // [sp+31h] [bp-4Fh]@29
5870 //__int16 v22; // [sp+4Dh] [bp-33h]@29
5871 char v23; // [sp+4Fh] [bp-31h]@29
5872 MSG Msg; // [sp+50h] [bp-30h]@17
5873 POINT v25; // [sp+6Ch] [bp-14h]@6
5874 bool v26; // [sp+74h] [bp-Ch]@1
5875 //POINT v24; // [sp+78h] [bp-8h]@6
5876 //Player *pPlayer;
5877
5878 //pTexture = &pTexture_PCX;
5879 v1 = 0;
5880 v26 = 0;
5881 pTexture_PCX.Release();
5882 pTexture_PCX.Load("makeme.pcx", 0);
5883 if (pAsyncMouse)
5884 pAsyncMouse->Resume();
5885 v2 = 6;
5886 pGUIWindow_CurrentMenu->field_40 = 0;
5887 //LABEL_27:
5888 SetCurrentMenuID((MENU_STATE)v2);
5889 while ( GetCurrentMenuID() == MENU_CREATEPARTY )
5890 {
5891 if ( pAsyncMouse != (void *)v1 )
5892 pAsyncMouse->_46B736_consume_click_lists(1);
5893 uMouseX = pMouse->GetCursorPos(&v25)->x;
5894 uMouseY = pMouse->GetCursorPos(&v25)->y;
5895 pControlsHead = pGUIWindow_CurrentMenu->pControlsHead;
5896
5897 //does nothing actually
5898 /*if ( pControlsHead != (GUIButton *)v1 )
5899 {
5900 pNumMessage = pMessageQueue_50CBD0->uNumMessages;
5901 do
5902 {
5903 if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ
5904 && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
5905 {
5906 pControlParam = pControlsHead->uControlParam;
5907 pMessageQueue_50CBD0->AddMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0);
5908 v1 = 0;
5909 }
5910 pControlsHead = pControlsHead->pNext;
5911 }
5912 while ( pControlsHead != (GUIButton *)v1 );
5913 }*/
5914
5915 while ( PeekMessageA(&Msg, (HWND)v1, v1, v1, PM_REMOVE) )
5916 {
5917 if ( Msg.message == WM_QUIT )
5918 Game_DeinitializeAndTerminate(0);
5919 TranslateMessage(&Msg);
5920 DispatchMessageA(&Msg);
5921 }
5922 if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
5923 {
5924 WaitMessage();
5925 }
5926 else
5927 {
5928 PlayerCreationUI_Draw();
5929 GUI_MainMenuMessageProc();
5930 pRenderer->BeginScene();
5931 GUI_UpdateWindows();
5932 pRenderer->EndScene();
5933 pRenderer->Present();
5934 if ( uGameState == 1 )
5935 {
5936 v26 = 1;
5937 v2 = 0;
5938 //goto LABEL_27;
5939 SetCurrentMenuID((MENU_STATE)v2);
5940 continue;
5941 }
5942 if ( uGameState == 6 )
5943 {
5944 uGameState = v1;
5945 v2 = 1;
5946 //goto LABEL_27;
5947 SetCurrentMenuID((MENU_STATE)v2);
5948 continue;
5949 }
5950 }
5951 }
5952 pTexture_PCX.Release();
5953 pGUIWindow_CurrentMenu->Release();
5954 pIcons_LOD->_4114F2();
5955
5956 memset(v20, 0, 32);
5957 do
5958 {
5959 v8 = 0;
5960 do
5961 {
5962 v9 = rand() % 32;
5963 if ( !v20[v9] )
5964 break;
5965 ++v8;
5966 }
5967 while ( v8 < 10 );
5968 if ( v8 == 10 )
5969 {
5970 v9 = 0;
5971 if ( v20[0] )
5972 {
5973 do
5974 ++v9;
5975 while ( v20[v9] );
5976 }
5977 }
5978 pParty->field_854[v1++] = v9;
5979 v20[v9] = 1;
5980 }
5981 while ( (signed int)v1 < 32 );
5982 //v10 = (char *)&pParty->pPlayers[0].sResMagicBase;
5983
5984 item.Reset();
5985 //for ( pPlayer = &pParty->pPlayers[0]; pPlayer < &pParty->pPlayers[4]; pPlayer++)
5986 for (uint i = 0; i < 4; ++i)
5987 {
5988 auto player = &pParty->pPlayers[i];
5989 //v11 = pPlayer;
5990 if (player->classType == PLAYER_CLASS_KNIGHT)
5991 player->sResMagicBase = 10;
5992 //*((short *)v10 + 400) = 0;
5993 player->pPlayerBuffs[22].uExpireTime = 0;
5994 for (uint j = 0; j < 9; j++)
5995 {
5996 if (player->pActiveSkills[PLAYER_SKILL_FIRE + j])
5997 {
5998 player->lastOpenedSpellbookPage = j;
5999 break;
6000 }
6001 }
6002 pItemsTable->GenerateItem(2, 40, &item);
6003 player->AddItem2(-1, &item);
6004 //uSkillIdx = 0;
6005 //v24.y = 0;
6006
6007 player->sHealth = player->GetMaxHealth();
6008 player->sMana = player->GetMaxMana();
6009 for (uint j = 0; j < 37; ++j)
6010 {
6011 if (!player->pActiveSkills[j])
6012 continue;
6013
6014 switch (j)
6015 {
6016 case PLAYER_SKILL_STAFF: player->AddItem(-1, 61); break;
6017 case PLAYER_SKILL_SWORD: player->AddItem(-1, 1); break;
6018 case PLAYER_SKILL_DAGGER: player->AddItem(-1, 15); break;
6019 case PLAYER_SKILL_AXE: player->AddItem(-1, 23); break;
6020 case PLAYER_SKILL_SPEAR: player->AddItem(-1, 31); break;
6021 case PLAYER_SKILL_BOW: player->AddItem(-1, 47); break;
6022 case PLAYER_SKILL_MACE: player->AddItem(-1, 50); break;
6023 case PLAYER_SKILL_BLASTER: assert(false); break;
6024 case PLAYER_SKILL_SHIELD: player->AddItem(-1, 84); break;
6025 case PLAYER_SKILL_LEATHER: player->AddItem(-1, 66); break;
6026 case PLAYER_SKILL_CHAIN: player->AddItem(-1, 71); break;
6027 case PLAYER_SKILL_PLATE: player->AddItem(-1, 76); break;
6028 case PLAYER_SKILL_FIRE:
6029 player->AddItem(-1, 0x191);
6030 player->spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;
6031 break;
6032 case PLAYER_SKILL_AIR:
6033 player->AddItem(-1, 0x19C);
6034 player->spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
6035 break;
6036 case PLAYER_SKILL_WATER:
6037 player->AddItem(-1, 0x1A7);
6038 player->spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
6039 break;
6040 case PLAYER_SKILL_EARTH:
6041 player->AddItem(-1, 0x1B2);
6042 player->spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
6043 break;
6044 case PLAYER_SKILL_SPIRIT:
6045 player->AddItem(-1, 0x1BD);
6046 player->spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
6047 break;
6048 case PLAYER_SKILL_MIND:
6049 player->AddItem(-1, 0x1C8);
6050 player->spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
6051 break;
6052 case PLAYER_SKILL_BODY:
6053 player->AddItem(-1, 0x1D3);
6054 player->spellbook.pBodySpellbook.bIsSpellAvailable[0] = true;
6055 break;
6056 case PLAYER_SKILL_LIGHT:
6057 case PLAYER_SKILL_DARK:
6058 case PLAYER_SKILL_DIPLOMACY:
6059 assert(false);
6060 break;
6061 case PLAYER_SKILL_ITEM_ID:
6062 case PLAYER_SKILL_REPAIR:
6063 case PLAYER_SKILL_MEDITATION:
6064 case PLAYER_SKILL_PERCEPTION:
6065 case PLAYER_SKILL_TRAP_DISARM:
6066 case PLAYER_SKILL_LEARNING:
6067 player->AddItem(-1, 0xDC);
6068 player->AddItem(-1, 5 * (rand() % 3 + 40));
6069 break;
6070 case PLAYER_SKILL_DODGE: player->AddItem(-1, 115); break;
6071 case PLAYER_SKILL_UNARMED: player->AddItem(-1, 110); break;
6072 default:
6073 break;
6074 }
6075
6076 for (uint k = 0; k < 138; k++)
6077 {
6078 if (&player->pInventoryItems[k])
6079 player->pInventoryItems[k].SetIdentified();
6080 }
6081 }
6082 }
6083
6084 pAudioPlayer->StopChannels(-1, -1);
6085 if (pAsyncMouse)
6086 pAsyncMouse->Suspend();
6087 return v26;
6088 }
6089
6090 //----- (004979D2) --------------------------------------------------------
6091 MENU_STATE __cdecl CreditsMenu__Loop()
6092 {
6093 char *v0; // eax@5
6094 char *v1; // edi@5
6095 FILE *pFile; // eax@5
6096 unsigned int pSize; // esi@7
6097 GUIFont *pFont; // edx@9
6098 GUIFont *pFont2; // ecx@9
6099 __int16 pHeight; // ax@9
6100 void *v7; // eax@9
6101 unsigned int pNumPixels; // ST2C_4@9
6102 unsigned int teal; // eax@9
6103 unsigned int v10; // ST2C_4@19
6104 MSG Msg; // [sp+84h] [bp-B8h]@10
6105 int v17; // [sp+A0h] [bp-9Ch]@9
6106 int pX; // [sp+A4h] [bp-98h]@9
6107 unsigned int pY; // [sp+A8h] [bp-94h]@9
6108 int v20; // [sp+ACh] [bp-90h]@9
6109 int a4; // [sp+B0h] [bp-8Ch]@9
6110 int pColor2; // [sp+F8h] [bp-44h]@9
6111 int pColor1; // [sp+FCh] [bp-40h]@9
6112 int a5; // [sp+128h] [bp-14h]@1
6113 char *pString; // [sp+12Ch] [bp-10h]@9
6114 char *ptr; // [sp+130h] [bp-Ch]@5
6115 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1
6116 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1
6117 RGBTexture pTexture; // [sp+54h] [bp-E8h]@1
6118 RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1
6119 Texture pTexture3; // [sp+Ch] [bp-130h]@5
6120
6121 a5 = 0;
6122 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL);
6123 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
6124 if ( pMessageQueue_50CBD0->uNumMessages )
6125 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
6126 ++pIcons_LOD->uTexturePacksCount;
6127 if ( !pIcons_LOD->uNumPrevLoadedFiles )
6128 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
6129 dword_A74C88 = 0;
6130 pAudioPlayer->PlayMusicTrack(MUSIC_Credits);
6131 pTexture.Load("mm6title.pcx", 0);
6132 v0 = (char *)pEvents_LOD->LoadRaw("credits.txt", 0);
6133 v1 = v0;
6134 ptr = v0;
6135 pFile = pEvents_LOD->FindContainer("credits.txt", 0);
6136 if ( !pFile )
6137 Abortf(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files.
6138 // Please re-install to fix this problem. Note: Re-installing will not destroy your save games."
6139 fread(&pTexture3, 1, 0x30, pFile);
6140 pSize = pTexture3.uDecompressedSize;
6141 if ( !pTexture3.uDecompressedSize )
6142 pSize = pTexture3.uTextureSize;
6143 memset(&pTexture3, 0, 0x48);
6144 pFont = pFontCChar;
6145 pFont2 = pFontQuick;
6146 v1[pSize] = 0;
6147 v20 = 250;
6148 a4 = 440;
6149 pX = 389;
6150 pY = 19;
6151 pTexture2.uWidth = 250;
6152 pHeight = pFont2->GetStringHeight2(pFont, v1, (int)&pX, 0, 1);
6153 pTexture2.uHeight = pHeight + 2 * a4;
6154 pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight;
6155 v7 = pAllocator->AllocNamedChunk(pTexture2.pPixels, 2 * pTexture2.uNumPixels, "scrollermap");
6156 pNumPixels = pTexture2.uNumPixels;
6157 pTexture2.pPixels = (unsigned __int16 *)v7;
6158 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu);
6159 fill_pixels_fast(teal, pTexture2.pPixels, pNumPixels);
6160 pTexture2.field_20 = 0;
6161 pTexture2.field_22 = 0;
6162 pColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x70u, 0x8Fu, 0xFEu);
6163 pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xECu, 0xE6u, 0x9Cu);
6164 pString = (char *)operator new(2 * pSize);
6165 strncpy(pString, ptr, pSize);
6166 pString[pSize]=0;
6167 pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a4, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1,
6168 pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth);
6169 free(pString);
6170 pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr);
6171 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, "", 0);
6172 pCurrentScreen = SCREEN_CREATORS;
6173 SetCurrentMenuID(MENU_CREDITSPROC);
6174 do
6175 {
6176 while ( PeekMessageA(&Msg, 0, 0, 0, 1) )
6177 {
6178 if ( Msg.message == 18 )
6179 Game_DeinitializeAndTerminate(0);
6180 TranslateMessage(&Msg);
6181 DispatchMessageA(&Msg);
6182 }
6183 if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
6184 {
6185 WaitMessage();
6186 }
6187 else
6188 {
6189 if (pAsyncMouse)
6190 pAsyncMouse->_46B736_consume_click_lists(1);
6191 pRenderer->BeginScene();
6192 pRenderer->DrawTextureRGB(0, 0, &pTexture);
6193 pRenderer->Clip(pX, pY, pX + v20, pY + a4);
6194 pRenderer->_4A5D33(pX, pY, 0, a5, &pTexture2);
6195 pRenderer->ResetClip();
6196 pRenderer->EndScene();
6197 ++a5;
6198 if ( a5 >= (signed __int16)pTexture2.uHeight )
6199 SetCurrentMenuID(MENU_MAIN);
6200 pRenderer->Present();
6201 pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc()
6202 GUI_MainMenuMessageProc();
6203 }
6204 }
6205 while ( GetCurrentMenuID() == MENU_CREDITSPROC );
6206 pAudioPlayer->_4AA258(1);
6207 pAllocator->FreeChunk(ptr);
6208 pAllocator->FreeChunk(pFontQuick);
6209 pAllocator->FreeChunk(pFontCChar);
6210 pWindow_MainMenu->Release();
6211 pIcons_LOD->_4114F2();
6212 pTexture.Release();
6213 pTexture2.Release();
6214 return MENU_MAIN; // return MENU_Main
6215 }
6216 4915
6217 //----- (0049B04D) -------------------------------------------------------- 4916 //----- (0049B04D) --------------------------------------------------------
6218 int stru154::_49B04D(ODMFace *a2, BSPVertexBuffer *a3) 4917 int stru154::_49B04D(ODMFace *a2, BSPVertexBuffer *a3)
6219 { 4918 {
6220 stru154 *v3; // edi@1 4919 stru154 *v3; // edi@1