comparison mm7_4.cpp @ 706:d6236f6a9882

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