Mercurial > mm7
diff 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 |
line wrap: on
line diff
--- a/mm7_4.cpp Mon Mar 18 21:50:20 2013 +0000 +++ b/mm7_4.cpp Tue Mar 19 21:53:21 2013 +0400 @@ -2835,92 +2835,6 @@ -//----- (004908DE) -------------------------------------------------------- -signed int __cdecl PlayerCreation_Chose4Skills() -{ - Player *v0; // esi@1 - signed int v1; // edx@2 - unsigned short *v2; // eax@2 - signed int v3; // ecx@2 - - v0 = pParty->pPlayers;//[0].pActiveSkills; - while ( 1 ) - { - v1 = 0; - v2 = v0->pActiveSkills; - v3 = 37; - do - { - if ( *v2 ) - ++v1; - ++v2; - --v3; - } - while ( v3 ); - if ( v1 < 4 ) - break; - ++v0; - if ( v0 > &pParty->pPlayers[3] ) - return 1; - } - return 0; -} - - - - -//----- (00491CB5) -------------------------------------------------------- -void __cdecl LoadPlayerPortraintsAndVoices() -{ - //Texture **v0; // ebx@1 - //int v1; // eax@2 - //int v2; // edi@3 - char *v3; // esi@5 - char *v4; // [sp+10h] [bp-4h]@1 - - pIcons_LOD->pFacesLock = pIcons_LOD->uNumLoadedFiles; - - for (uint i = 0; i < 4; ++i) - for (uint j = 0; j < 56; ++j) - { - sprintf(pTmpBuf, "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uFace], j + 1); - pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE); - } - - pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE); - pTexture_PlayerFaceDead = pIcons_LOD->LoadTexturePtr("DEAD", TEXTURE_16BIT_PALETTE); - pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE); - - if (SoundSetAction[24][0]) - for (uint i = 0; i < 4; ++i) - { - pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0); - pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0); - } -} - -//----- (00491DE7) -------------------------------------------------------- -int __fastcall ReloadPlayerPortraits(int a1, int a2) -{ - int result; // eax@1 - const char **v3; // ebp@1 - Texture **v4; // ebx@1 - int v5; // esi@2 - - result = 0; - v3 = &pPlayerPortraitsNames[a2]; - v4 = pTextures_PlayerFaces[a1]; - do - { - v5 = result + 1; - sprintf(pTmpBuf, "%s%02d", *v3, result + 1); - pIcons_LOD->ReloadTexture(*v4, pTmpBuf, 2); - result = v5; - ++v4; - } - while ( v5 < 56 ); - return result; -} //----- (00491E3A) -------------------------------------------------------- @@ -3024,270 +2938,7 @@ } // 4ED498: using guessed type char byte_4ED498; -//----- (00491F87) -------------------------------------------------------- -void __cdecl DrawHiredNPCs() -{ - //int v6; // eax@15 - char v7; // al@17 - unsigned int v8; // eax@18 - int v9; // esi@18 - int v10; // eax@18 - unsigned int v11; // eax@19 - unsigned int v12; // esi@19 - unsigned int v13; // eax@23 - IconFrame *v14; // eax@24 - unsigned int v15; // eax@26 - char pContainer[20]; // [sp+Ch] [bp-30h]@18 - unsigned int v17; // [sp+20h] [bp-1Ch]@19 - signed int uFrameID; // [sp+24h] [bp-18h]@19 - //int i; // [sp+28h] [bp-14h]@15 - unsigned int v20; // [sp+2Ch] [bp-10h]@20 - unsigned int v21; // [sp+30h] [bp-Ch]@19 - int v22; // [sp+34h] [bp-8h]@2 - unsigned __int8 v23; // [sp+3Bh] [bp-1h]@2 - - if ( bNoNPCHiring != 1 ) - { - v23 = 0; - v22 = 0; - /*for (uint i = 0; i < 2; ++i) - { - if (pParty->pHirelings[i].pName) - pTmpBuf[v22++] = i; - }*/ - if (pParty->pHirelings[0].pName) - pTmpBuf[v22++] = 0; - if (pParty->pHirelings[1].pName) - pTmpBuf[v22++] = 1; - - for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) - { - if (pNPCStats->pNewNPCData[i].uFlags & 128) - { - if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) - { - if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) - pTmpBuf[v22++] = i + 2; - } - } - } - - //v6 = (unsigned __int8)pParty->field_709; - for ( int i = (unsigned __int8)pParty->field_709; i < v22 && v23 < 2; i++ ) - { - v7 = pTmpBuf[i]; - if ( (unsigned __int8)v7 >= 2 ) - { - sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID); - v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], (Texture *)(v15 != -1 ? &pIcons_LOD->pTextures[v15] : 0)); - } - else - { - sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID); - v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - v9 = v23; - pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0)); - v10 = (unsigned __int8)pTmpBuf[i]; - if ( pParty->pHirelings[v10].evt_A == 1 ) - { - uFrameID = pParty->pHirelings[v10].evt_B; - v11 = pHiredNPCsIconsOffsetsX[v9]; - v12 = pHiredNPCsIconsOffsetsY[v9]; - v17 = v11; - v21 = 0; - if ( (signed int)pIconsFrameTable->uNumIcons <= 0 ) - { -LABEL_23: - v13 = 0; - } - else - { - v20 = 0; - while ( _strcmpi("spell96", pIconsFrameTable->pIcons[v20 / 0x20].pAnimationName) ) - { - ++v21; - v20 += 32; - if ( (signed int)v21 >= (signed int)pIconsFrameTable->uNumIcons ) - goto LABEL_23; - } - v13 = v21; - } - v14 = pIconsFrameTable->GetFrame(v13, uFrameID); - pRenderer->DrawTextureTransparent(v17, v12, &pIcons_LOD->pTextures[v14->uTextureID]); - } - } - ++v23; - } - } -} -// 6BE3C5: using guessed type char bNoNPCHiring; - - - -//----- (004921C1) -------------------------------------------------------- -void GameUI_DrawPortraits(unsigned int _this) -{ - Texture *pFace; // eax@10 - unsigned int v7; // eax@17 - PlayerFrame *pFrame; // eax@21 - unsigned int v9; // eax@27 - bool v10; // eax@33 - bool v11; // edi@40 - bool v12; // edx@43 - bool v13; // ecx@46 - int v16; // eax@57 - int v19; // eax@62 - Texture *pPortrait; // [sp-4h] [bp-1Ch]@27 - unsigned int v22; // [sp+14h] [bp-4h]@1 - - v22 = _this; - if ( qword_A750D8 ) - { - qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed; - if ( qword_A750D8 <= 0 ) - { - if ( pPlayers[word_A750E2]->CanAct() ) - pPlayers[word_A750E2]->PlaySound((PlayerSpeech)word_A750E0, 0); - qword_A750D8 = 0i64; - } - } - - for (uint i = 0; i < 4; ++i) - { - auto pPlayer = pParty->pPlayers + i; - - if (pPlayer->Eradicated()) - { - pFace = pTexture_PlayerFaceEradicated; - pPortrait = pFace; - v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; - if ( pParty->pPartyBuffs[11].uExpireTime ) - pRenderer->_4A6E7E(v9, 0x183u, pPortrait); - else - pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); - auto _v1 = 0; - v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; - if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) - _v1 = 1; - v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; - v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; - v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; - if ( v13 | v12 | v11 | _v1 | v10 ) - sub_441A4E(i); - continue; - } - if (pPlayer->Dead()) - { - pFace = pTexture_PlayerFaceDead; - pPortrait = pFace; - v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; - if ( pParty->pPartyBuffs[11].uExpireTime ) - pRenderer->_4A6E7E(v9, 0x183u, pPortrait); - else - pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); - auto _v1 = 0; - v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; - if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) - _v1 = 1; - v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; - v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; - v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; - if ( v13 | v12 | v11 | _v1 | v10 ) - sub_441A4E(i); - continue; - } - v7 = 0; - for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j) - if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression) - { - v7 = j; - break; - } - if ( v7 == 0 ) - v7 = 1; - if (pPlayer->expression == CHARACTER_EXPRESSION_21) - pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); - else - pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed); - if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || v22 ) - { - pPlayer->field_1AA2 = pFrame->uTextureID - 1; - pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; - pPortrait = pFace; - v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; - if ( pParty->pPartyBuffs[11].uExpireTime ) - pRenderer->_4A6E7E(v9, 0x183u, pPortrait); - else - pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); - auto _v1 = 0; - v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; - if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) - _v1 = 1; - v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; - v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; - v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; - if ( v13 | v12 | v11 | _v1 | v10 ) - sub_441A4E(i); - continue; - } - } - if ( pParty->bTurnBasedModeOn == 1 ) - { - if ( pTurnEngine->field_4 != 1 ) - { - if ( (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player) - { - //v14 = 0; - if ( pTurnEngine->uActorQueueSize > 0 ) - { - //v15 = (char *)pTurnEngine->pQueue; - for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i) - { - auto pElem = pTurnEngine->pQueue + i; - - if ( (pElem->uPackedID & 7) != OBJECT_Player) - break; - v16 = dword_5079D0; - if ( pParty->uFlags & 0x10 ) - { - v16 = dword_5079CC; - } - else - { - if ( pParty->uFlags & 0x20 ) - v16 = dword_5079C8; - } - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[pElem->uPackedID >> 3] - 4, - 0x181u, (Texture *)(v16 != -1 ? &pIcons_LOD->pTextures[v16] : 0)); - } - } - } - } - } - else - { - for (uint i = 0; i < 4; ++i) - { - auto pPlayer = pParty->pPlayers + i; - if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery) - { - v19 = dword_5079D0; - if ( pParty->uFlags & 0x10 ) - { - v19 = dword_5079CC; - } - else - { - if ( pParty->uFlags & 0x20 ) - v19 = dword_5079C8; - } - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, - 0x181u, (Texture *)(v19 != -1 ? &pIcons_LOD->pTextures[v19] : 0)); - } - } - } -} + //----- (0049387A) -------------------------------------------------------- @@ -5255,960 +4906,8 @@ return pTmpBuf2; } -//----- (00495B39) -------------------------------------------------------- -void __cdecl PlayerCreationUI_Draw() -{ - const char *uTitleText; // ST10_4@3 - int pTextCenter; // eax@3 - IconFrame *v3; // eax@3 - int v4; // ecx@7 - GUIButton *uPosActiveItem; // edi@12 - int v6; // esi@14 - int uNumLet; // eax@14 - char v8; // al@17 - int v9; // ecx@17 - char v10; // sf@17 - int v11; // ecx@19 - void *v12; // eax@20 - int v13; // ecx@21 - int v14; // ecx@22 - char *v15; // ST14_4@24 - size_t v16; // eax@28 - int v17; // eax@33 - //enum CHARACTER_RACE uNumRace; // eax@35 - int v19; // eax@36 - int v20; // eax@37 - int uNumMight; // eax@44 - unsigned int v24; // eax@44 - int v25; // eax@44 - unsigned int v26; // eax@44 - int v27; // eax@44 - unsigned int v28; // eax@44 - int v29; // eax@44 - unsigned int v30; // eax@44 - int v31; // eax@44 - unsigned int v32; // eax@44 - int v33; // eax@44 - unsigned int v34; // eax@44 - int v35; // eax@44 - unsigned int v36; // eax@44 - enum PLAYER_SKILL_TYPE v37; // eax@44 - enum PLAYER_SKILL_TYPE v39; // eax@44 - enum PLAYER_SKILL_TYPE v41; // eax@44 - const char *v42; // edx@44 - char *v43; // ST1C_4@44 - int v45; // eax@44 - enum PLAYER_SKILL_TYPE v46; // eax@46 - const char *v47; // edx@46 - char *v48; // ST1C_4@46 - int v50; // eax@46 - int v51; // eax@49 - char *v52; // edi@52 - char v53; // al@52 - PLAYER_CLASS_TYPE uClassType; // edi@53 - int v55; // ST0C_4@53 - int v57; // eax@53 - int v61; // ecx@55 - int v64; // ST08_4@57 - int v66; // ecx@57 - int v71; // eax@59 - int v75; // eax@61 - int v80; // eax@63 - int v85; // eax@65 - int v89; // eax@67 - int v94; // eax@69 - enum PLAYER_SKILL_TYPE pSkillId; // edi@72 - size_t pLenText; // eax@72 - signed int v104; // ecx@72 - int pColorText; // ecx@79 - unsigned int v107; // ST0C_4@81 - int pTextY; // ST08_4@81 - int v111; // ST0C_4@82 - signed int v113; // edi@82 - int v114; // ST0C_4@82 - const char *uRaceName; // [sp+0h] [bp-170h]@39 - char pText[200]; // [sp+10h] [bp-160h]@14 - GUIWindow pWindow; // [sp+D8h] [bp-98h]@83 - int v119; // [sp+12Ch] [bp-44h]@18 - size_t v120; // [sp+130h] [bp-40h]@25 - int uY; // [sp+134h] [bp-3Ch]@18 - int v122; // [sp+138h] [bp-38h]@18 - int v123; // [sp+13Ch] [bp-34h]@11 - void *v124; // [sp+140h] [bp-30h]@18 - int uColor1; // [sp+144h] [bp-2Ch]@1 - int v126; // [sp+148h] [bp-28h]@25 - int uColorGreen; // [sp+14Ch] [bp-24h]@1 - int v128; // [sp+150h] [bp-20h]@14 - int v129; // [sp+154h] [bp-1Ch]@18 - int uColorTeal; // [sp+158h] [bp-18h]@1 - int uColorWhite; // [sp+15Ch] [bp-14h]@1 - int uX; // [sp+160h] [bp-10h]@18 - unsigned int v133; // [sp+164h] [bp-Ch]@25 - int pOrder; // [sp+168h] [bp-8h]@14 - //char *Str; // [sp+16Ch] [bp-4h]@18 - //Player *pPlayer; - const char *pSkillName; - - uColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xD1, 0xBB, 0x61); - uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7, 0xF7); - uColorGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFF, 0); - uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF); - pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); - uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20; - pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY); - pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - 640, 2, pTexture_MAKESKY); - //if (uPlayerCreationUI_SkySliderPos > 640) - //uPlayerCreationUI_SkySliderPos = 0; - pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP); - uTitleText = pGlobalTXT_LocalizationStrings[51]; - uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7; - pTextCenter = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]); - pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, uTitleText, 0, 0, 0); - pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uFace]); - pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uFace]); - pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uFace]); - pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uFace]); - v3 = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime); - if ( uPlayerCreationUI_SelectedCharacter ) - { - switch ( uPlayerCreationUI_SelectedCharacter ) - { - case 1: - v4 = 171; - break; - case 2: - v4 = 329; - break; - case 3: - v4 = 488; - break; - default: - v4 = v123; - break; - } - } - else - { - v4 = 12; - } - - pRenderer->DrawTextureTransparent(v4, 29, &pIcons_LOD->pTextures[v3->uTextureID]); - uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem); - uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25; - pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]); - pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]); - //if (uPlayerCreationUI_ArrowAnim < 0) - // uPlayerCreationUI_ArrowAnim = 18; - v6 = pFontCreate->uFontHeight - 2; - v128 = pFontCreate->uFontHeight - 2; - memset(pText, 0, 200); - strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills" - uNumLet = strlen(pText) - 1; - pOrder = uNumLet; - if ( uNumLet >= 0 ) - { - while ( 1 ) - { - v8 = toupper((unsigned __int8)pText[uNumLet]); - v9 = pOrder; - v10 = pOrder-- - 1 < 0; - pText[v9] = v8; - if ( v10 ) - break; - uNumLet = pOrder; - } - } - pOrder = 18; - v124 = 0; - uX = 32; - uY = 3 * v6 + 169; - v122 = 5 * v6 + 169; - v123 = 3 * v6 + 311; - v129 = 493; - //pPlayer = pParty->pPlayers; - v119 = 6 * v6 + 169; - //do - - //for ( pPlayer = pParty->pPlayers; (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges; pPlayer++) - for (int i = 0; i < 4; ++i) - { - auto player = pParty->pPlayers + i; - - //Str = pPlayer->pName; - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pOrder + 73, 100, 0, pClassNames[player->classType], 0, 0, 0); - pRenderer->DrawTextureTransparent(pOrder + 77, 50, pTexture_IC_KNIGHT[player->classType / 4]); - v11 = pGUIWindow_CurrentMenu->field_40; - if ( v11 && (v12 = pGUIWindow_CurrentMenu->ptr_1C, v12 == v124) ) - { - v13 = v11 - 1; - if ( v13 ) - { - v14 = v13 - 1; - if ( v14 ) - { - if ( v14 == 1 ) - { - pGUIWindow_CurrentMenu->field_40 = 0; - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 124, 0, player->pName, 130, 0); - SetCurrentMenuID(MENU_NAMEPANELESC); - } - } - else - { - pGUIWindow_CurrentMenu->field_40 = 0; - v120 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); - v126 = 0; - v133 = 0; - if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) )//edit name - { - do - { - if ( pKeyActionMap->pPressedKeysBuffer[v133] == ' ' ) - ++v126; - ++v133; - v16 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); - } - while ( v133 < v16 ); - } - if ( v120 && v126 != v120 ) - strcpy(player->pName, (const char *)pKeyActionMap->pPressedKeysBuffer); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7C, 0, player->pName, 130, 0); - *(short *)&player->field_1988[27] = 1; // - } - } - else - { - v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)v12 + 18, 0x7Cu, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1); - pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate); - } - } - else - { - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7C, 0, player->pName, 130, 0); - } - switch (player->GetRace()) - { - case 0: uRaceName = pGlobalTXT_LocalizationStrings[99]; break; // "Human" - case 1: uRaceName = pGlobalTXT_LocalizationStrings[103]; break; // "Dwarf" - case 2: uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin" - case 3: uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf" - }; - strcpy(pTmpBuf, uRaceName); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder + 72, v128 + 12, 0, pTmpBuf, 130, 0); - pTextCenter = pFontCreate->AlignText_Center(0x96, pText); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, uColor1, pText, 0, 0, 0); - uNumMight = player->GetActualMight(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], v129, uNumMight);// "Might" - LOWORD(v24) = player->GetStatColor(0); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, v24, pTmpBuf, 0, 0, 0); - v25 = player->GetActualIntelligence(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], v129, v25);// "Intellect" - LOWORD(v26) = player->GetStatColor(1); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v128 + 169, v26, pTmpBuf, 0, 0, 0); - v27 = player->GetActualWillpower(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], v129, v27);// "Personality" - LOWORD(v28) = player->GetStatColor(2); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * v128 + 169, v28, pTmpBuf, 0, 0, 0); - v29 = player->GetActualEndurance(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], v129, v29);// "Endurance" - LOWORD(v30) = player->GetStatColor(3); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, uY, v30, pTmpBuf, 0, 0, 0); - v31 = player->GetActualAccuracy(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], v129, v31);// "Accuracy" - LOWORD(v32) = player->GetStatColor(4); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * v128 + 169, v32, pTmpBuf, 0, 0, 0); - v33 = player->GetActualSpeed(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], v129, v33);// "Speed" - LOWORD(v34) = player->GetStatColor(5); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v122, v34, pTmpBuf, 0, 0, 0); - v35 = player->GetActualLuck(); - sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], v129, v35);// "Luck" - LOWORD(v36) = player->GetStatColor(6); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v119, v36, pTmpBuf, 0, 0, 0); - v37 = player->GetSkillIdxByOrder(0); - pTextCenter = pFontCreate->AlignText_Center(0x96u, pSkillNames[v37]); - sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v37]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf, 0, 0, 0); - v39 = player->GetSkillIdxByOrder(1); - pTextCenter = pFontCreate->AlignText_Center(0x96u, pSkillNames[v39]); - sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v39]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v128 + 311, uColorWhite, pTmpBuf, 0, 0, 0); - v41 = player->GetSkillIdxByOrder(2); - pTextCenter = pFontCreate->AlignText_Center(150u, pSkillNames[v41]); - sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v41]); - v45 = uColorGreen; - if ( (signed int)v41 >= 37 ) - v45 = uColorTeal; - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * v128 + 311, v45, pTmpBuf, 0, 0, 0); - v46 = player->GetSkillIdxByOrder(3); - pTextCenter = pFontCreate->AlignText_Center(150u, pSkillNames[v46]); - sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[v46]); - v50 = uColorGreen; - if ( (signed int)v46 >= 37 ) - v50 = uColorTeal; - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v123, v50, pTmpBuf, 0, 0, 0); - //pPlayer++; - v124 = (char *)v124 + 1; - pOrder += 159; - v129 -= 158; - uX += 158; - } - - //while ( (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges ); - strcpy(pText, pGlobalTXT_LocalizationStrings[41]);// "Class" - v51 = strlen(pText) - 1; - pOrder = v51; - if ( v51 >= 0 ) - { - while ( 1 ) - { - v52 = &pText[v51]; - v53 = toupper((unsigned __int8)pText[v51]); - v10 = pOrder-- - 1 < 0; - *v52 = v53; - if ( v10 ) - break; - v51 = pOrder; - } - } - uClassType = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].classType; - pTextCenter = pFontCreate->AlignText_Center(193u, pText); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 324, 395, uColor1, pText, 0, 0, 0); - v57 = uColorTeal; - if ( uClassType ) - v57 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[0]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 417, v57, pClassNames[0], 0, 0, 0); - v61 = uColorTeal; - if ( uClassType != PLAYER_CLASS_PALADIN ) - v61 = uColorWhite; - uColorGreen = v128 + 417; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[12]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, v128 + 417, v61, pClassNames[12], 0, 0, 0); - v66 = uColorTeal; - if ( uClassType != PLAYER_CLASS_DRUID ) - v66 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[20]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 2 * v128 + 417, v66, pClassNames[20], 0, 0, 0); - v71 = uColorTeal; - if ( uClassType != PLAYER_CLASS_CLERIC ) - v71 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[24]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 417, v71, pClassNames[24], 0, 0, 0); - v75 = uColorTeal; - if ( uClassType != PLAYER_CLASS_DRUID) - v75 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[28]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, uColorGreen, v75, pClassNames[28], 0, 0, 0); - v80 = uColorTeal; - if ( uClassType != PLAYER_CLASS_SORCERER ) - v80 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[32]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 2 * v128 + 417, v80, pClassNames[32], 0, 0, 0); - v85 = uColorTeal; - if ( uClassType != PLAYER_CLASS_ARCHER ) - v85 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[16]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 417, v85, pClassNames[16], 0, 0, 0); - v89 = uColorTeal; - if ( uClassType != PLAYER_CLASS_MONK ) - v89 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[8]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, uColorGreen, v89, pClassNames[8], 0, 0, 0); - v94 = uColorTeal; - if ( uClassType != PLAYER_CLASS_THEIF ) - v94 = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[4]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 2 * v128 + 417, v94, pClassNames[4], 0, 0, 0); - pTextCenter = pFontCreate->AlignText_Center(0xECu, pGlobalTXT_LocalizationStrings[20]); // "Available Skills" - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 37, 395, uColor1, pGlobalTXT_LocalizationStrings[20], 0, 0, 0); - //pOrder = 0; - //do - for (pOrder = 0; pOrder < 9; ++pOrder) - { - pSkillId = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pOrder + 4); - strcpy(pText, pSkillNames[pSkillId]); - pLenText = strlen(pText); - v104 = 0; - if ( (signed int)pLenText > 0 ) - { - if ( pText[v104] == 32 ) - { - pText[v104] = 0; - } - else - { - while ( pText[v104] != 32 ) - //for (v104 = 0; v104 < (signed int)pLenText || pText[v104] != 32; ++v104) - { - ++v104; - if ( v104 >= (signed int)pLenText ) - break; - } - } - } - uColorGreen = -5; - if ( (signed int)v124 > 2 ) - uColorGreen = 0; - pColorText = uColorTeal; - if ( !pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pSkillId] ) - pColorText = uColorWhite; - pTextCenter = pFontCreate->AlignText_Center(100, pText); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 100 * (pOrder / 3) + pTextCenter + uColorGreen + 17, v128 * (pOrder % 3) + 417, pColorText, pText, 0, 0, 0); - //++pOrder; - } - //while ( pOrder < 9 ); - pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus" - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, uColor1, pGlobalTXT_LocalizationStrings[30], 0, 0, 0); - v113 = PlayerCreation_ComputeAttributeBonus(); - sprintf(pTmpBuf, "%d", v113); - pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf, 0, 0, 0); - if ( GameUI_StatusBar_TimedStringTimeLeft > GetTickCount() ) - { - 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." - if ( v113 < 0 ) - pWindow.Hint = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points." - pWindow.uFrameWidth = 300; - pWindow.uFrameHeight = 100; - pWindow.uFrameX = 170; - pWindow.uFrameY = 140; - pWindow.uFrameZ = 469; - pWindow.uFrameW = 239; - pWindow.DrawMessageBox(0); - } - pRenderer->EndScene(); -} - -//----- (0049695A) -------------------------------------------------------- -void __cdecl PlayerCreationUI_Initialize() -{ - unsigned int v0; // ebx@5 - unsigned int v1; // eax@6 - int v2; // ecx@6 - unsigned int v3; // eax@8 - signed int v4; // ecx@8 - signed int uControlParam; // [sp+10h] [bp-Ch]@7 - unsigned int uControlParama; // [sp+10h] [bp-Ch]@9 - unsigned int uControlParamb; // [sp+10h] [bp-Ch]@11 - unsigned int uControlParamc; // [sp+10h] [bp-Ch]@13 - signed int uControlParamd; // [sp+10h] [bp-Ch]@15 - signed int uX; // [sp+14h] [bp-8h]@5 - unsigned int uXa; // [sp+14h] [bp-8h]@9 - unsigned int uXb; // [sp+14h] [bp-8h]@11 - unsigned int uXc; // [sp+14h] [bp-8h]@13 - signed int uXd; // [sp+14h] [bp-8h]@16 - - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pCurrentScreen = SCREEN_PARTY_CREATION; - uPlayerCreationUI_ArrowAnim = 0; - uPlayerCreationUI_SkySliderPos = 0; - uPlayerCreationUI_SelectedCharacter = 0; - v0 = LOBYTE(pFontCreate->uFontHeight) - 2; - pTexture_IC_KNIGHT[0] = pIcons_LOD->LoadTexturePtr("IC_KNIGHT", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[1] = pIcons_LOD->LoadTexturePtr("IC_THIEF", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[2] = pIcons_LOD->LoadTexturePtr("IC_MONK", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[3] = pIcons_LOD->LoadTexturePtr("IC_PALAD", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[4] = pIcons_LOD->LoadTexturePtr("IC_ARCH", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[5] = pIcons_LOD->LoadTexturePtr("IC_RANGER", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[6] = pIcons_LOD->LoadTexturePtr("IC_CLER", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[7] = pIcons_LOD->LoadTexturePtr("IC_DRUID", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE); - pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE); - pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE); - for(uX=0;uX < 22;++uX ) // load PlayerPortraits texture - { - sprintf(pTmpBuf, "%s01", pPlayerPortraitsNames[uX]); - v1 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE); - pPlayerPortraits[uX] = &pIcons_LOD->pTextures[v1]; - - } - pTexture_PlayerFaceMask = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("FACEMASK", TEXTURE_16BIT_PALETTE)]; - pTexture_buttminu = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttminu", TEXTURE_16BIT_PALETTE)]; - pTexture_buttplus = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttplus", TEXTURE_16BIT_PALETTE)]; - pTexture_pressrigh = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("presrigh", TEXTURE_16BIT_PALETTE)]; - pTexture_presleft = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("presleft", TEXTURE_16BIT_PALETTE)]; - uControlParam = 1; - do - { - sprintf(pTmpBuf, "arrowl%d", uControlParam); - pTextures_arrowl[uControlParam] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)]; - sprintf(pTmpBuf, "arrowr%d", uControlParam); - v3 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE); - v4 = uControlParam++; - pTextures_arrowr[v4] = &pIcons_LOD->pTextures[v3]; - } - while ( uControlParam < 20 ); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); - uControlParama = 0; - uXa = 8; - do - { - pGUIWindow_CurrentMenu->CreateButton(uXa, 120u, 145u, 25u, 1, 0, 0x3Cu, uControlParama, 0, "", 0); - uXa += 158; - ++uControlParama; - } - while ( (signed int)uXa < 640 ); - pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10, 32, 11, 13, 1, 0, 0xABu, 0, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169, 32, 11, 13, 1, 0, 0xABu, 1, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(327, 32, 11, 13, 1, 0, 0xABu, 2, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(486, 32, 11, 13, 1, 0, 0xABu, 3, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton(74, 32, 11, 13, 1, 0, 0xACu, 0, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(233, 32, 11, 13, 1, 0, 0xACu, 1, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(391, 32, 11, 13, 1, 0, 0xACu, 2, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(549, 32, 11, 13, 1, 0, 0xACu, 3, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton(10, 103, 11, 13, 1, 0, 0x90u, 0, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, 0x90u, 1, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, 0x90u, 2, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, 0x90u, 3, 0, "", pTexture_presleft, 0); - pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton(74, 103, 11, 13, 1, 0, 0x91u, 0, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, 0x91u, 1, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, 0x91u, 2, 0, "", pTexture_pressrigh, 0); - pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, 0x91u, 3, 0, "", pTexture_pressrigh, 0); - uControlParamb = 0; - uXb = 8; - do - { - pGUIWindow_CurrentMenu->CreateButton(uXb, 308, 150, v0, 1, 0, 0x48u, uControlParamb, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXb, v0 + 308, 150, v0, 1, 0, 0x49u, uControlParamb, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXb, 2 * v0 + 308, 150u, v0, 1, 0, 0x4Au, uControlParamb, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXb, 3 * v0 + 308, 150u, v0, 1, 0, 0x4Bu, uControlParamb, 0, "", 0); - uXb += 158; - ++uControlParamb; - } - while ( (signed int)uXb < 640 ); - pGUIWindow_CurrentMenu->CreateButton(5u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 0, 0x31u, "", 0); - pGUIWindow_CurrentMenu->CreateButton(163u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 1u, 0x32u, "", 0); - pGUIWindow_CurrentMenu->CreateButton(321u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 2u, 0x33u, "", 0); - pGUIWindow_CurrentMenu->CreateButton(479u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 3u, 0x34u, "", 0); - uXc = 23; - uControlParamc = 2; - do - { - pGUIWindow_CurrentMenu->CreateButton(uXc, 169, 120, 20, 1, 0, 0, uControlParamc - 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXc, v0 + 169, 120, 20, 1, 0, 0, uControlParamc - 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXc, 2 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXc, 3 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXc, 4 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXc, 5 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(uXc, 6 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 4, 0, "", 0); - uControlParamc += 7; - uXc += 158; - } - while ( (signed int)uControlParamc < 30 ); - pGUIWindow_CurrentMenu->_41D08F(28, 0, 7, 40); - pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, 0x41, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, 0x41, 0xC, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x14, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(388, 417, 65, v0, 1, 0, 0x41, 0x18, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417, 65, v0, 1, 0, 0x41, 0x1C, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x20, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, 0x41, 0x10, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, 0x41, 8, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 4, 0, "", 0); - uControlParamd = 0; - do - { - uXd = -5; - if ( uControlParamd <= 3 ) - uXd = 0; - pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParamd / 3) + uXd + 17, v0 * (uControlParamd % 3) + 417, 100, v0, 1, 0, 0x40, - uControlParamd, 0, "", 0); - ++uControlParamd; - } - while ( uControlParamd < 9 ); - pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, 0x42, 0, 0xD, "", - (Texture *)(uTextureID_BUTTMAKE != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE] : 0), 0); - pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, 0x43, 0, 0x43, "", - (Texture *)(uTextureID_BUTTMAKE2 != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE2] : 0), 0); - pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, 0x3F, 0, 0x2D, "", pTexture_buttminu, 0); - pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, 0x3E, 1, 0x2B, "", pTexture_buttplus, 0); - pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); -} -// 4E28F8: using guessed type int pCurrentScreen; - -//----- (0049750E) -------------------------------------------------------- -void __cdecl DeleteCCharFont() -{ - pAllocator->FreeChunk(pFontCChar); - pFontCChar = 0; -} -//----- (00497526) -------------------------------------------------------- -bool __cdecl PlayerCreationUI_Loop() -{ - //RGBTexture *pTexture; // ebx@1 - UINT v1; // esi@1 - unsigned int v2; // ecx@3 - LONG uMouseX; // edi@6 - LONG uMouseY; // eax@6 - GUIButton *pControlsHead; // edx@6 - //unsigned int pNumMessage; // ecx@7 - int pControlParam; // esi@12 - signed int v8; // edi@30 - int v9; // edx@31 - char *v10; // ebx@37 - Player *v11; // esi@38 - //signed int uSpellBookPageCount; // ecx@40 - int v13; // eax@40 - //signed int uSkillIdx; // eax@45 - int v15; // eax@70 - signed int v16; // ecx@70 - //unsigned int v18; // [sp-4h] [bp-84h]@48 - ItemGen item; // [sp+Ch] [bp-74h]@37 - char v20[32]; // [sp+30h] [bp-50h]@29 - //char v21; // [sp+31h] [bp-4Fh]@29 - //__int16 v22; // [sp+4Dh] [bp-33h]@29 - char v23; // [sp+4Fh] [bp-31h]@29 - MSG Msg; // [sp+50h] [bp-30h]@17 - POINT v25; // [sp+6Ch] [bp-14h]@6 - bool v26; // [sp+74h] [bp-Ch]@1 - //POINT v24; // [sp+78h] [bp-8h]@6 - //Player *pPlayer; - - //pTexture = &pTexture_PCX; - v1 = 0; - v26 = 0; - pTexture_PCX.Release(); - pTexture_PCX.Load("makeme.pcx", 0); - if (pAsyncMouse) - pAsyncMouse->Resume(); - v2 = 6; - pGUIWindow_CurrentMenu->field_40 = 0; -//LABEL_27: - SetCurrentMenuID((MENU_STATE)v2); - while ( GetCurrentMenuID() == MENU_CREATEPARTY ) - { - if ( pAsyncMouse != (void *)v1 ) - pAsyncMouse->_46B736_consume_click_lists(1); - uMouseX = pMouse->GetCursorPos(&v25)->x; - uMouseY = pMouse->GetCursorPos(&v25)->y; - pControlsHead = pGUIWindow_CurrentMenu->pControlsHead; - - //does nothing actually - /*if ( pControlsHead != (GUIButton *)v1 ) - { - pNumMessage = pMessageQueue_50CBD0->uNumMessages; - do - { - if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ - && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement - { - pControlParam = pControlsHead->uControlParam; - pMessageQueue_50CBD0->AddMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0); - v1 = 0; - } - pControlsHead = pControlsHead->pNext; - } - while ( pControlsHead != (GUIButton *)v1 ); - }*/ - - while ( PeekMessageA(&Msg, (HWND)v1, v1, v1, PM_REMOVE) ) - { - if ( Msg.message == WM_QUIT ) - Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) - { - WaitMessage(); - } - else - { - PlayerCreationUI_Draw(); - GUI_MainMenuMessageProc(); - pRenderer->BeginScene(); - GUI_UpdateWindows(); - pRenderer->EndScene(); - pRenderer->Present(); - if ( uGameState == 1 ) - { - v26 = 1; - v2 = 0; - //goto LABEL_27; - SetCurrentMenuID((MENU_STATE)v2); - continue; - } - if ( uGameState == 6 ) - { - uGameState = v1; - v2 = 1; - //goto LABEL_27; - SetCurrentMenuID((MENU_STATE)v2); - continue; - } - } - } - pTexture_PCX.Release(); - pGUIWindow_CurrentMenu->Release(); - pIcons_LOD->_4114F2(); - - memset(v20, 0, 32); - do - { - v8 = 0; - do - { - v9 = rand() % 32; - if ( !v20[v9] ) - break; - ++v8; - } - while ( v8 < 10 ); - if ( v8 == 10 ) - { - v9 = 0; - if ( v20[0] ) - { - do - ++v9; - while ( v20[v9] ); - } - } - pParty->field_854[v1++] = v9; - v20[v9] = 1; - } - while ( (signed int)v1 < 32 ); - //v10 = (char *)&pParty->pPlayers[0].sResMagicBase; - - item.Reset(); - //for ( pPlayer = &pParty->pPlayers[0]; pPlayer < &pParty->pPlayers[4]; pPlayer++) - for (uint i = 0; i < 4; ++i) - { - auto player = &pParty->pPlayers[i]; - //v11 = pPlayer; - if (player->classType == PLAYER_CLASS_KNIGHT) - player->sResMagicBase = 10; - //*((short *)v10 + 400) = 0; - player->pPlayerBuffs[22].uExpireTime = 0; - for (uint j = 0; j < 9; j++) - { - if (player->pActiveSkills[PLAYER_SKILL_FIRE + j]) - { - player->lastOpenedSpellbookPage = j; - break; - } - } - pItemsTable->GenerateItem(2, 40, &item); - player->AddItem2(-1, &item); - //uSkillIdx = 0; - //v24.y = 0; - - player->sHealth = player->GetMaxHealth(); - player->sMana = player->GetMaxMana(); - for (uint j = 0; j < 37; ++j) - { - if (!player->pActiveSkills[j]) - continue; - - switch (j) - { - case PLAYER_SKILL_STAFF: player->AddItem(-1, 61); break; - case PLAYER_SKILL_SWORD: player->AddItem(-1, 1); break; - case PLAYER_SKILL_DAGGER: player->AddItem(-1, 15); break; - case PLAYER_SKILL_AXE: player->AddItem(-1, 23); break; - case PLAYER_SKILL_SPEAR: player->AddItem(-1, 31); break; - case PLAYER_SKILL_BOW: player->AddItem(-1, 47); break; - case PLAYER_SKILL_MACE: player->AddItem(-1, 50); break; - case PLAYER_SKILL_BLASTER: assert(false); break; - case PLAYER_SKILL_SHIELD: player->AddItem(-1, 84); break; - case PLAYER_SKILL_LEATHER: player->AddItem(-1, 66); break; - case PLAYER_SKILL_CHAIN: player->AddItem(-1, 71); break; - case PLAYER_SKILL_PLATE: player->AddItem(-1, 76); break; - case PLAYER_SKILL_FIRE: - player->AddItem(-1, 0x191); - player->spellbook.pFireSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_AIR: - player->AddItem(-1, 0x19C); - player->spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_WATER: - player->AddItem(-1, 0x1A7); - player->spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_EARTH: - player->AddItem(-1, 0x1B2); - player->spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_SPIRIT: - player->AddItem(-1, 0x1BD); - player->spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_MIND: - player->AddItem(-1, 0x1C8); - player->spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_BODY: - player->AddItem(-1, 0x1D3); - player->spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_LIGHT: - case PLAYER_SKILL_DARK: - case PLAYER_SKILL_DIPLOMACY: - assert(false); - break; - case PLAYER_SKILL_ITEM_ID: - case PLAYER_SKILL_REPAIR: - case PLAYER_SKILL_MEDITATION: - case PLAYER_SKILL_PERCEPTION: - case PLAYER_SKILL_TRAP_DISARM: - case PLAYER_SKILL_LEARNING: - player->AddItem(-1, 0xDC); - player->AddItem(-1, 5 * (rand() % 3 + 40)); - break; - case PLAYER_SKILL_DODGE: player->AddItem(-1, 115); break; - case PLAYER_SKILL_UNARMED: player->AddItem(-1, 110); break; - default: - break; - } - - for (uint k = 0; k < 138; k++) - { - if (&player->pInventoryItems[k]) - player->pInventoryItems[k].SetIdentified(); - } - } - } - - pAudioPlayer->StopChannels(-1, -1); - if (pAsyncMouse) - pAsyncMouse->Suspend(); - return v26; -} - -//----- (004979D2) -------------------------------------------------------- -MENU_STATE __cdecl CreditsMenu__Loop() -{ - char *v0; // eax@5 - char *v1; // edi@5 - FILE *pFile; // eax@5 - unsigned int pSize; // esi@7 - GUIFont *pFont; // edx@9 - GUIFont *pFont2; // ecx@9 - __int16 pHeight; // ax@9 - void *v7; // eax@9 - unsigned int pNumPixels; // ST2C_4@9 - unsigned int teal; // eax@9 - unsigned int v10; // ST2C_4@19 - MSG Msg; // [sp+84h] [bp-B8h]@10 - int v17; // [sp+A0h] [bp-9Ch]@9 - int pX; // [sp+A4h] [bp-98h]@9 - unsigned int pY; // [sp+A8h] [bp-94h]@9 - int v20; // [sp+ACh] [bp-90h]@9 - int a4; // [sp+B0h] [bp-8Ch]@9 - int pColor2; // [sp+F8h] [bp-44h]@9 - int pColor1; // [sp+FCh] [bp-40h]@9 - int a5; // [sp+128h] [bp-14h]@1 - char *pString; // [sp+12Ch] [bp-10h]@9 - char *ptr; // [sp+130h] [bp-Ch]@5 - GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 - GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 - RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 - RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 - Texture pTexture3; // [sp+Ch] [bp-130h]@5 - - a5 = 0; - pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); - pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - dword_A74C88 = 0; - pAudioPlayer->PlayMusicTrack(MUSIC_Credits); - pTexture.Load("mm6title.pcx", 0); - v0 = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); - v1 = v0; - ptr = v0; - pFile = pEvents_LOD->FindContainer("credits.txt", 0); - if ( !pFile ) - Abortf(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. - // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." - fread(&pTexture3, 1, 0x30, pFile); - pSize = pTexture3.uDecompressedSize; - if ( !pTexture3.uDecompressedSize ) - pSize = pTexture3.uTextureSize; - memset(&pTexture3, 0, 0x48); - pFont = pFontCChar; - pFont2 = pFontQuick; - v1[pSize] = 0; - v20 = 250; - a4 = 440; - pX = 389; - pY = 19; - pTexture2.uWidth = 250; - pHeight = pFont2->GetStringHeight2(pFont, v1, (int)&pX, 0, 1); - pTexture2.uHeight = pHeight + 2 * a4; - pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; - v7 = pAllocator->AllocNamedChunk(pTexture2.pPixels, 2 * pTexture2.uNumPixels, "scrollermap"); - pNumPixels = pTexture2.uNumPixels; - pTexture2.pPixels = (unsigned __int16 *)v7; - teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); - fill_pixels_fast(teal, pTexture2.pPixels, pNumPixels); - pTexture2.field_20 = 0; - pTexture2.field_22 = 0; - pColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x70u, 0x8Fu, 0xFEu); - pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xECu, 0xE6u, 0x9Cu); - pString = (char *)operator new(2 * pSize); - strncpy(pString, ptr, pSize); - pString[pSize]=0; - pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a4, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1, - pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth); - free(pString); - pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr); - pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, "", 0); - pCurrentScreen = SCREEN_CREATORS; - SetCurrentMenuID(MENU_CREDITSPROC); - do - { - while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) - { - if ( Msg.message == 18 ) - Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) - { - WaitMessage(); - } - else - { - if (pAsyncMouse) - pAsyncMouse->_46B736_consume_click_lists(1); - pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &pTexture); - pRenderer->Clip(pX, pY, pX + v20, pY + a4); - pRenderer->_4A5D33(pX, pY, 0, a5, &pTexture2); - pRenderer->ResetClip(); - pRenderer->EndScene(); - ++a5; - if ( a5 >= (signed __int16)pTexture2.uHeight ) - SetCurrentMenuID(MENU_MAIN); - pRenderer->Present(); - pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() - GUI_MainMenuMessageProc(); - } - } - while ( GetCurrentMenuID() == MENU_CREDITSPROC ); - pAudioPlayer->_4AA258(1); - pAllocator->FreeChunk(ptr); - pAllocator->FreeChunk(pFontQuick); - pAllocator->FreeChunk(pFontCChar); - pWindow_MainMenu->Release(); - pIcons_LOD->_4114F2(); - pTexture.Release(); - pTexture2.Release(); - return MENU_MAIN; // return MENU_Main -} + + //----- (0049B04D) -------------------------------------------------------- int stru154::_49B04D(ODMFace *a2, BSPVertexBuffer *a3)