comparison mm7_4.cpp @ 51:4211cceb3813

Merge
author Nomad
date Tue, 23 Oct 2012 23:40:55 +0200
parents fde5c5acb66e 25fabc49627b
children 663d5bf032d9 41cbaabde2cb
comparison
equal deleted inserted replaced
50:fde5c5acb66e 51:4211cceb3813
5278 } 5278 }
5279 5279
5280 //----- (00495B39) -------------------------------------------------------- 5280 //----- (00495B39) --------------------------------------------------------
5281 void __cdecl PlayerCreationUI_Draw() 5281 void __cdecl PlayerCreationUI_Draw()
5282 { 5282 {
5283 Texture *v0; // edi@1
5284 const char *uTitleText; // ST10_4@3 5283 const char *uTitleText; // ST10_4@3
5285 int v2; // eax@3 5284 int v2; // eax@3
5286 IconFrame *v3; // eax@3 5285 IconFrame *v3; // eax@3
5287 int v4; // ecx@7 5286 int v4; // ecx@7
5288 GUIButton *uPosActiveItem; // edi@12 5287 GUIButton *uPosActiveItem; // edi@12
5422 uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7u, 0xF7u); 5421 uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7u, 0xF7u);
5423 uColorGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); 5422 uColorGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
5424 uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 5423 uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
5425 pRenderer->BeginScene(); 5424 pRenderer->BeginScene();
5426 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); 5425 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
5427 v0 = pTexture_MAKESKY; 5426 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY);
5428 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2u, pTexture_MAKESKY); 5427 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos++ - 640, 2, pTexture_MAKESKY);
5429 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos++ - 640, 2u, v0);
5430 if ( (signed int)uPlayerCreationUI_SkySliderPos > 640 ) 5428 if ( (signed int)uPlayerCreationUI_SkySliderPos > 640 )
5431 uPlayerCreationUI_SkySliderPos = 0; 5429 uPlayerCreationUI_SkySliderPos = 0;
5432 pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP); 5430 pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP);
5433 uTitleText = pGlobalTXT_LocalizationStrings[51]; 5431 uTitleText = pGlobalTXT_LocalizationStrings[51];
5434 uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->field_2C_focus_id - pGUIWindow_CurrentMenu->field_38) 5432 uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7;
5435 / 7; 5433 v2 = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]);
5436 v2 = pFontCChar->AlignText_Center(640u, pGlobalTXT_LocalizationStrings[51]);
5437 pGUIWindow_CurrentMenu->DrawText(pFontCChar, v2 + 1, 0, 0, uTitleText, 0, 0, 0); 5434 pGUIWindow_CurrentMenu->DrawText(pFontCChar, v2 + 1, 0, 0, uTitleText, 0, 0, 0);
5438 pRenderer->DrawTextureTransparent(17u, 35u, pPlayerPortraits[(char)pParty->pPlayers[0].uFace]); 5435 pRenderer->DrawTextureTransparent(17u, 35u, pPlayerPortraits[(char)pParty->pPlayers[0].uFace]);
5439 pRenderer->DrawTextureTransparent(176u, 35u, pPlayerPortraits[(char)pParty->pPlayers[1].uFace]); 5436 pRenderer->DrawTextureTransparent(176u, 35u, pPlayerPortraits[(char)pParty->pPlayers[1].uFace]);
5440 pRenderer->DrawTextureTransparent(335u, 35u, pPlayerPortraits[(char)pParty->pPlayers[2].uFace]); 5437 pRenderer->DrawTextureTransparent(335u, 35u, pPlayerPortraits[(char)pParty->pPlayers[2].uFace]);
5441 pRenderer->DrawTextureTransparent(494u, 35u, pPlayerPortraits[(char)pParty->pPlayers[3].uFace]); 5438 pRenderer->DrawTextureTransparent(494u, 35u, pPlayerPortraits[(char)pParty->pPlayers[3].uFace]);
5461 else 5458 else
5462 { 5459 {
5463 v4 = 12; 5460 v4 = 12;
5464 } 5461 }
5465 pRenderer->DrawTextureTransparent(v4, 29, &pIcons_LOD->pTextures[v3->uTextureID]); 5462 pRenderer->DrawTextureTransparent(v4, 29, &pIcons_LOD->pTextures[v3->uTextureID]);
5466 uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->field_2C_focus_id); 5463 uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem);
5467 pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim + 1]); 5464 pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim + 1]);
5468 pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim-- + 1]); 5465 pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim-- + 1]);
5469 if ( uPlayerCreationUI_ArrowAnim < 0 ) 5466 if ( uPlayerCreationUI_ArrowAnim < 0 )
5470 uPlayerCreationUI_ArrowAnim = 18; 5467 uPlayerCreationUI_ArrowAnim = 18;
5471 v6 = LOBYTE(pFontCreate->uFontHeight) - 2; 5468 v6 = LOBYTE(pFontCreate->uFontHeight) - 2;
9633 GUIWindow v4; // [sp+4h] [bp-54h]@3 9630 GUIWindow v4; // [sp+4h] [bp-54h]@3
9634 9631
9635 pPlayer = pPlayers[uActiveCharacter]; 9632 pPlayer = pPlayers[uActiveCharacter];
9636 if ( pPlayer->CanAct() ) 9633 if ( pPlayer->CanAct() )
9637 { 9634 {
9638 pDialogueWindow->field_28 = dword_F8B1E0; 9635 pDialogueWindow->pNumPresenceButton = dword_F8B1E0;
9639 result = 1; 9636 result = 1;
9640 } 9637 }
9641 else 9638 else
9642 { 9639 {
9643 pDialogueWindow->field_28 = 0; 9640 pDialogueWindow->pNumPresenceButton = 0;
9644 memcpy(&v4, pGUIWindow0, sizeof(v4)); 9641 memcpy(&v4, pGUIWindow0, sizeof(v4));
9645 v4.uFrameX = 483; 9642 v4.uFrameX = 483;
9646 v4.uFrameWidth = 148; 9643 v4.uFrameWidth = 148;
9647 v4.uFrameZ = 334; 9644 v4.uFrameZ = 334;
9648 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 9645 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);//
10761 v14 = pDialogueWindow; 10758 v14 = pDialogueWindow;
10762 memcpy(&v52, pDialogueWindow, sizeof(v52)); 10759 memcpy(&v52, pDialogueWindow, sizeof(v52));
10763 v52.uFrameX = 483; 10760 v52.uFrameX = 483;
10764 v52.uFrameWidth = 148; 10761 v52.uFrameWidth = 148;
10765 v52.uFrameZ = 334; 10762 v52.uFrameZ = 334;
10766 v56 = v52.field_38; 10763 v56 = v52.pStartingPosActiveItem;
10767 if ( v52.field_38 < v52.field_38 + v52.field_28 ) 10764 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
10768 { 10765 {
10769 v15 = (char *)v54; 10766 v15 = (char *)v54;
10770 while ( 1 ) 10767 while ( 1 )
10771 { 10768 {
10772 v16 = v52.GetControl(v56); 10769 v16 = v52.GetControl(v56);
10881 v15 = pGlobalTXT_LocalizationStrings[122]; 10878 v15 = pGlobalTXT_LocalizationStrings[122];
10882 } 10879 }
10883 LABEL_49: 10880 LABEL_49:
10884 strcpy(v16->pButtonName, v15); 10881 strcpy(v16->pButtonName, v15);
10885 ++v56; 10882 ++v56;
10886 if ( v56 >= v52.field_38 + v52.field_28 ) 10883 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton )
10887 { 10884 {
10888 v14 = pDialogueWindow; 10885 v14 = pDialogueWindow;
10889 break; 10886 break;
10890 } 10887 }
10891 } 10888 }
10892 } 10889 }
10893 v34 = 0; 10890 v34 = 0;
10894 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 10891 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
10895 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 10892 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
10896 v36 = v14->field_38; 10893 v36 = v14->pStartingPosActiveItem;
10897 v55 = v35; 10894 v55 = v35;
10898 for ( i = v36 + v14->field_28; (signed int)v36 < (signed int)i; i = pDialogueWindow->field_28 10895 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
10899 + pDialogueWindow->field_38 ) 10896 + pDialogueWindow->pStartingPosActiveItem )
10900 { 10897 {
10901 v37 = v14->GetControl(v36); 10898 v37 = v14->GetControl(v36);
10902 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); 10899 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
10903 v14 = pDialogueWindow; 10900 v14 = pDialogueWindow;
10904 v34 += v38; 10901 v34 += v38;
10905 ++v36; 10902 ++v36;
10906 } 10903 }
10907 v39 = v14->field_28; 10904 v39 = v14->pNumPresenceButton;
10908 if ( v39 ) 10905 if ( v39 )
10909 { 10906 {
10910 v58 = (NPCData *)((174 - v34) / v39); 10907 v58 = (NPCData *)((174 - v34) / v39);
10911 if ( (signed int)v58 > 32 ) 10908 if ( (signed int)v58 > 32 )
10912 v58 = (NPCData *)32; 10909 v58 = (NPCData *)32;
10913 pInString = (char *)2; 10910 pInString = (char *)2;
10914 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; 10911 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138;
10915 v56 = v14->field_38; 10912 v56 = v14->pStartingPosActiveItem;
10916 i = v56; 10913 i = v56;
10917 if ( (signed int)i < (signed int)(i + v39) ) 10914 if ( (signed int)i < (signed int)(i + v39) )
10918 { 10915 {
10919 while ( 1 ) 10916 while ( 1 )
10920 { 10917 {
10926 v45 = v42->uY; 10923 v45 = v42->uY;
10927 v42->uHeight = v44; 10924 v42->uHeight = v44;
10928 v40 = v45 + v44 - 1; 10925 v40 = v45 + v44 - 1;
10929 v42->uW = v40; 10926 v42->uW = v40;
10930 v46 = v55; 10927 v46 = v55;
10931 if ( (char *)pDialogueWindow->field_2C_focus_id != pInString ) 10928 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString )
10932 v46 = v54; 10929 v46 = v54;
10933 v52.DrawText2(pFontArrus, 0, v45, v46, v43, 3u); 10930 v52.DrawText2(pFontArrus, 0, v45, v46, v43, 3u);
10934 v14 = pDialogueWindow; 10931 v14 = pDialogueWindow;
10935 ++pInString; 10932 ++pInString;
10936 ++v56; 10933 ++v56;
10937 i = pDialogueWindow->field_28 + pDialogueWindow->field_38; 10934 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
10938 if ( v56 >= (signed int)i ) 10935 if ( v56 >= (signed int)i )
10939 break; 10936 break;
10940 i = v56; 10937 i = v56;
10941 } 10938 }
10942 } 10939 }
11358 v30 = pGlobalTXT_LocalizationStrings[127]; 11355 v30 = pGlobalTXT_LocalizationStrings[127];
11359 goto LABEL_106; 11356 goto LABEL_106;
11360 } 11357 }
11361 LABEL_107: 11358 LABEL_107:
11362 pDialogueWindow->_41D08F(a2, 1, 0, 2); 11359 pDialogueWindow->_41D08F(a2, 1, 0, 2);
11363 result = pDialogueWindow->field_28; 11360 result = pDialogueWindow->pNumPresenceButton;
11364 dword_F8B1E0 = pDialogueWindow->field_28; 11361 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
11365 return result; 11362 return result;
11366 } 11363 }
11367 11364
11368 11365
11369 //----- (004B3A72) -------------------------------------------------------- 11366 //----- (004B3A72) --------------------------------------------------------
11383 v1 = 3; 11380 v1 = 3;
11384 sub_4B36CC(2, 0x68u); 11381 sub_4B36CC(2, 0x68u);
11385 } 11382 }
11386 } 11383 }
11387 pDialogueWindow->_41D08F(v1, 1, 0, 2); 11384 pDialogueWindow->_41D08F(v1, 1, 0, 2);
11388 result = pDialogueWindow->field_28; 11385 result = pDialogueWindow->pNumPresenceButton;
11389 dword_F8B1E0 = pDialogueWindow->field_28; 11386 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
11390 return result; 11387 return result;
11391 } 11388 }
11392 // F8B1E0: using guessed type int dword_F8B1E0; 11389 // F8B1E0: using guessed type int dword_F8B1E0;
11393 11390
11394 //----- (004B3AD4) -------------------------------------------------------- 11391 //----- (004B3AD4) --------------------------------------------------------
11425 pDialogueWindow->_41D08F(v2, v3, v4, v5); 11422 pDialogueWindow->_41D08F(v2, v3, v4, v5);
11426 goto LABEL_7; 11423 goto LABEL_7;
11427 } 11424 }
11428 } 11425 }
11429 LABEL_7: 11426 LABEL_7:
11430 result = pDialogueWindow->field_28; 11427 result = pDialogueWindow->pNumPresenceButton;
11431 dword_F8B1E0 = pDialogueWindow->field_28; 11428 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
11432 return result; 11429 return result;
11433 } 11430 }
11434 // F8B1E0: using guessed type int dword_F8B1E0; 11431 // F8B1E0: using guessed type int dword_F8B1E0;
11435 11432
11436 //----- (004B3B42) -------------------------------------------------------- 11433 //----- (004B3B42) --------------------------------------------------------
11625 goto LABEL_37; 11622 goto LABEL_37;
11626 default: 11623 default:
11627 break; 11624 break;
11628 } 11625 }
11629 LABEL_43: 11626 LABEL_43:
11630 result = pDialogueWindow->field_28; 11627 result = pDialogueWindow->pNumPresenceButton;
11631 dword_F8B1E0 = pDialogueWindow->field_28; 11628 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
11632 return result; 11629 return result;
11633 } 11630 }
11634 // F8B1E0: using guessed type int dword_F8B1E0; 11631 // F8B1E0: using guessed type int dword_F8B1E0;
11635 11632
11636 //----- (004B3E1E) -------------------------------------------------------- 11633 //----- (004B3E1E) --------------------------------------------------------
12045 0); 12042 0);
12046 } 12043 }
12047 } 12044 }
12048 pDialogueWindow->_41D08F(v1, 1, 0, 2); 12045 pDialogueWindow->_41D08F(v1, 1, 0, 2);
12049 v4 = 1; 12046 v4 = 1;
12050 result = (GUIButton *)pDialogueWindow->field_28; 12047 result = (GUIButton *)pDialogueWindow->pNumPresenceButton;
12051 dword_F8B1E0 = pDialogueWindow->field_28; 12048 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
12052 } 12049 }
12053 dword_F8B19C = v4; 12050 dword_F8B19C = v4;
12054 } 12051 }
12055 return result; 12052 return result;
12056 } 12053 }
12212 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 12209 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
12213 v14 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0); 12210 v14 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0);
12214 v73 = v14 * (100 - v0->GetMerchant()) / 100; 12211 v73 = v14 * (100 - v0->GetMerchant()) / 100;
12215 if ( v73 < v14 / 3 ) 12212 if ( v73 < v14 / 3 )
12216 v73 = v14 / 3; 12213 v73 = v14 / 3;
12217 v15 = v13->field_38; 12214 v15 = v13->pStartingPosActiveItem;
12218 v16 = v13->field_28; 12215 v16 = v13->pNumPresenceButton;
12219 v72 = 0; 12216 v72 = 0;
12220 if ( (signed int)v15 >= (signed int)(v15 + v16) ) 12217 if ( (signed int)v15 >= (signed int)(v15 + v16) )
12221 goto LABEL_76; 12218 goto LABEL_76;
12222 do 12219 do
12223 { 12220 {
12228 i += v18; 12225 i += v18;
12229 ++v72; 12226 ++v72;
12230 } 12227 }
12231 ++v15; 12228 ++v15;
12232 } 12229 }
12233 while ( (signed int)v15 < v13->field_28 + v13->field_38 ); 12230 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
12234 if ( v72 ) 12231 if ( v72 )
12235 { 12232 {
12236 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" 12233 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
12237 v65.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 12234 v65.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
12238 v73 = (signed int)(149 - i) / v72; 12235 v73 = (signed int)(149 - i) / v72;
12239 if ( v73 > 32 ) 12236 if ( v73 > 32 )
12240 v73 = 32; 12237 v73 = 32;
12241 result = v13->field_38; 12238 result = v13->pStartingPosActiveItem;
12242 v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162; 12239 v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162;
12243 i = result; 12240 i = result;
12244 v68 = v19; 12241 v68 = v19;
12245 if ( result < result + v13->field_28 ) 12242 if ( result < result + v13->pNumPresenceButton )
12246 { 12243 {
12247 v72 = 2; 12244 v72 = 2;
12248 do 12245 do
12249 { 12246 {
12250 v20 = v13->GetControl(i); 12247 v20 = v13->GetControl(i);
12266 v21->uHeight = v24; 12263 v21->uHeight = v24;
12267 v26 = v25 + v24 - 1; 12264 v26 = v25 + v24 - 1;
12268 v21->uW = v26; 12265 v21->uW = v26;
12269 v68 = v26; 12266 v68 = v26;
12270 v27 = v71; 12267 v27 = v71;
12271 if ( pDialogueWindow->field_2C_focus_id != v72 ) 12268 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
12272 v27 = white; 12269 v27 = white;
12273 v65.DrawText2(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u); 12270 v65.DrawText2(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u);
12274 } 12271 }
12275 v28 = v13->field_38; 12272 v28 = v13->pStartingPosActiveItem;
12276 ++i; 12273 ++i;
12277 result = v13->field_28 + v28; 12274 result = v13->pNumPresenceButton + v28;
12278 ++v72; 12275 ++v72;
12279 } 12276 }
12280 while ( (signed int)i < result ); 12277 while ( (signed int)i < result );
12281 } 12278 }
12282 } 12279 }
12300 v31 = pNPCTopics[122].pText; 12297 v31 = pNPCTopics[122].pText;
12301 v32 = v71; 12298 v32 = v71;
12302 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); 12299 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
12303 v65.DrawText2(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); 12300 v65.DrawText2(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u);
12304 result = (int)pDialogueWindow; 12301 result = (int)pDialogueWindow;
12305 pDialogueWindow->field_28 = 0; 12302 pDialogueWindow->pNumPresenceButton = 0;
12306 return result; 12303 return result;
12307 } 12304 }
12308 v34 = v0->uLevel; 12305 v34 = v0->uLevel;
12309 if ( v34 < v68 ) 12306 if ( v34 < v68 )
12310 { 12307 {
12390 { 12387 {
12391 v43 = pDialogueWindow; 12388 v43 = pDialogueWindow;
12392 v72 = 0; 12389 v72 = 0;
12393 pShopOptions[0] = pTmpBuf; 12390 pShopOptions[0] = pTmpBuf;
12394 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" 12391 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
12395 v44 = pDialogueWindow->field_28; 12392 v44 = pDialogueWindow->pNumPresenceButton;
12396 v73 = pDialogueWindow->field_38; 12393 v73 = pDialogueWindow->pStartingPosActiveItem;
12397 if ( v73 < v73 + v44 ) 12394 if ( v73 < v73 + v44 )
12398 { 12395 {
12399 v45 = pShopOptions; 12396 v45 = pShopOptions;
12400 do 12397 do
12401 { 12398 {
12429 v43 = pDialogueWindow; 12426 v43 = pDialogueWindow;
12430 v72 += v47; 12427 v72 += v47;
12431 ++v45; 12428 ++v45;
12432 ++v73; 12429 ++v73;
12433 } 12430 }
12434 while ( v73 < pDialogueWindow->field_28 + pDialogueWindow->field_38 ); 12431 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
12435 } 12432 }
12436 HIDWORD(v66) = (174 - v72) / 2; 12433 HIDWORD(v66) = (174 - v72) / 2;
12437 result = v43->field_38; 12434 result = v43->pStartingPosActiveItem;
12438 v48 = result + v43->field_28; 12435 v48 = result + v43->pNumPresenceButton;
12439 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; 12436 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
12440 v50 = -v43->field_28 < 0; 12437 v50 = -v43->pNumPresenceButton < 0;
12441 v73 = v43->field_38; 12438 v73 = v43->pStartingPosActiveItem;
12442 if ( v50 ^ __OFSUB__(result, v48) ) 12439 if ( v50 ^ __OFSUB__(result, v48) )
12443 { 12440 {
12444 i = 2; 12441 i = 2;
12445 v51 = pShopOptions; 12442 v51 = pShopOptions;
12446 do 12443 do
12453 v53->uHeight = v54; 12450 v53->uHeight = v54;
12454 v56 = v54 + v55 - 1; 12451 v56 = v54 + v55 - 1;
12455 v53->uW = v56; 12452 v53->uW = v56;
12456 v49 = v56; 12453 v49 = v56;
12457 v57 = v71; 12454 v57 = v71;
12458 if ( pDialogueWindow->field_2C_focus_id != i ) 12455 if ( pDialogueWindow->pCurrentPosActiveItem != i )
12459 v57 = white; 12456 v57 = white;
12460 v65.DrawText2(pFontArrus, 0, v55, v57, *v51, 3u); 12457 v65.DrawText2(pFontArrus, 0, v55, v57, *v51, 3u);
12461 v43 = pDialogueWindow; 12458 v43 = pDialogueWindow;
12462 ++i; 12459 ++i;
12463 ++v51; 12460 ++v51;
12464 ++v73; 12461 ++v73;
12465 result = pDialogueWindow->field_28 + pDialogueWindow->field_38; 12462 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
12466 } 12463 }
12467 while ( v73 < result ); 12464 while ( v73 < result );
12468 } 12465 }
12469 } 12466 }
12470 } 12467 }
12632 v76 += v78; 12629 v76 += v78;
12633 } 12630 }
12634 while ( (signed int)v77 < (signed int)&pShopOptions[3] ); 12631 while ( (signed int)v77 < (signed int)&pShopOptions[3] );
12635 v79 = pDialogueWindow; 12632 v79 = pDialogueWindow;
12636 _this = (Player *)((174 - v76) / 3); 12633 _this = (Player *)((174 - v76) / 3);
12637 result = pDialogueWindow->field_38; 12634 result = pDialogueWindow->pStartingPosActiveItem;
12638 v80 = result + pDialogueWindow->field_28; 12635 v80 = result + pDialogueWindow->pNumPresenceButton;
12639 v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138; 12636 v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138;
12640 v20 = -pDialogueWindow->field_28 < 0; 12637 v20 = -pDialogueWindow->pNumPresenceButton < 0;
12641 v118 = pDialogueWindow->field_38; 12638 v118 = pDialogueWindow->pStartingPosActiveItem;
12642 if ( v20 ^ __OFSUB__(result, v80) ) 12639 if ( v20 ^ __OFSUB__(result, v80) )
12643 { 12640 {
12644 v122 = 2; 12641 v122 = 2;
12645 v119 = (const char **)pShopOptions; 12642 v119 = (const char **)pShopOptions;
12646 do 12643 do
12653 v86 = v122; 12650 v86 = v122;
12654 v82->uHeight = v84; 12651 v82->uHeight = v84;
12655 v81 = v84 + v85 - 1; 12652 v81 = v84 + v85 - 1;
12656 v82->uW = v81; 12653 v82->uW = v81;
12657 v87 = color2; 12654 v87 = color2;
12658 if ( pDialogueWindow->field_2C_focus_id != v86 ) 12655 if ( pDialogueWindow->pCurrentPosActiveItem != v86 )
12659 v87 = white; 12656 v87 = white;
12660 v112.DrawText2(pFontArrus, 0, v85, v87, *v119, 3u); 12657 v112.DrawText2(pFontArrus, 0, v85, v87, *v119, 3u);
12661 v79 = pDialogueWindow; 12658 v79 = pDialogueWindow;
12662 ++v122; 12659 ++v122;
12663 ++v119; 12660 ++v119;
12664 ++v118; 12661 ++v118;
12665 result = pDialogueWindow->field_28 + pDialogueWindow->field_38; 12662 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
12666 } 12663 }
12667 while ( v118 < result ); 12664 while ( v118 < result );
12668 } 12665 }
12669 return result; 12666 return result;
12670 } 12667 }
12683 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); 12680 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0);
12684 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); 12681 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0);
12685 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100); 12682 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100);
12686 if ( (signed int)v119 < v33 / 3 ) 12683 if ( (signed int)v119 < v33 / 3 )
12687 v119 = (const char **)(v33 / 3); 12684 v119 = (const char **)(v33 / 3);
12688 v34 = v31->field_38; 12685 v34 = v31->pStartingPosActiveItem;
12689 v35 = v34 + v31->field_28; 12686 v35 = v34 + v31->pNumPresenceButton;
12690 v122 = 0; 12687 v122 = 0;
12691 if ( (signed int)v34 >= v35 ) 12688 if ( (signed int)v34 >= v35 )
12692 goto LABEL_140; 12689 goto LABEL_140;
12693 do 12690 do
12694 { 12691 {
12699 v118 += v37; 12696 v118 += v37;
12700 ++v122; 12697 ++v122;
12701 } 12698 }
12702 ++v34; 12699 ++v34;
12703 } 12700 }
12704 while ( (signed int)v34 < v31->field_28 + v31->field_38 ); 12701 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem );
12705 if ( !v122 ) 12702 if ( !v122 )
12706 { 12703 {
12707 LABEL_140: 12704 LABEL_140:
12708 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);// 12705 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);//
12709 // "Seek knowledge elsewhere %s the %s" 12706 // "Seek knowledge elsewhere %s the %s"
12721 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" 12718 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
12722 v112.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 12719 v112.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
12723 v119 = (const char **)((149 - v118) / v122); 12720 v119 = (const char **)((149 - v118) / v122);
12724 if ( (149 - v118) / v122 > 32 ) 12721 if ( (149 - v118) / v122 > 32 )
12725 v119 = (const char **)32; 12722 v119 = (const char **)32;
12726 result = v31->field_38; 12723 result = v31->pStartingPosActiveItem;
12727 v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162; 12724 v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162;
12728 v118 = result; 12725 v118 = result;
12729 v114 = v38; 12726 v114 = v38;
12730 if ( result < result + v31->field_28 ) 12727 if ( result < result + v31->pNumPresenceButton )
12731 { 12728 {
12732 v122 = 2; 12729 v122 = 2;
12733 do 12730 do
12734 { 12731 {
12735 v39 = v31->GetControl(v118); 12732 v39 = v31->GetControl(v118);
12752 v40->uHeight = v43; 12749 v40->uHeight = v43;
12753 v46 = v44 + v43 - 1; 12750 v46 = v44 + v43 - 1;
12754 v40->uW = v46; 12751 v40->uW = v46;
12755 v114 = v46; 12752 v114 = v46;
12756 v47 = color2; 12753 v47 = color2;
12757 if ( pDialogueWindow->field_2C_focus_id != v45 ) 12754 if ( pDialogueWindow->pCurrentPosActiveItem != v45 )
12758 v47 = white; 12755 v47 = white;
12759 v112.DrawText2(pFontArrus, 0, v44, v47, Str, 3u); 12756 v112.DrawText2(pFontArrus, 0, v44, v47, Str, 3u);
12760 } 12757 }
12761 v48 = v31->field_38; 12758 v48 = v31->pStartingPosActiveItem;
12762 ++v118; 12759 ++v118;
12763 result = v31->field_28 + v48; 12760 result = v31->pNumPresenceButton + v48;
12764 ++v122; 12761 ++v122;
12765 } 12762 }
12766 while ( v118 < result ); 12763 while ( v118 < result );
12767 } 12764 }
12768 } 12765 }
12816 v14 += v16; 12813 v14 += v16;
12817 } 12814 }
12818 while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); 12815 while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
12819 v17 = pDialogueWindow; 12816 v17 = pDialogueWindow;
12820 v114 = (174 - v14) / 4; 12817 v114 = (174 - v14) / 4;
12821 result = pDialogueWindow->field_38; 12818 result = pDialogueWindow->pStartingPosActiveItem;
12822 v18 = result + pDialogueWindow->field_28; 12819 v18 = result + pDialogueWindow->pNumPresenceButton;
12823 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; 12820 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
12824 v20 = -pDialogueWindow->field_28 < 0; 12821 v20 = -pDialogueWindow->pNumPresenceButton < 0;
12825 v122 = pDialogueWindow->field_38; 12822 v122 = pDialogueWindow->pStartingPosActiveItem;
12826 if ( v20 ^ __OFSUB__(result, v18) ) 12823 if ( v20 ^ __OFSUB__(result, v18) )
12827 { 12824 {
12828 v119 = (const char **)2; 12825 v119 = (const char **)2;
12829 _this = (Player *)pShopOptions; 12826 _this = (Player *)pShopOptions;
12830 do 12827 do
12837 v25 = v119; 12834 v25 = v119;
12838 v21->uHeight = v23; 12835 v21->uHeight = v23;
12839 v19 = v24 + v23 - 1; 12836 v19 = v24 + v23 - 1;
12840 v21->uW = v19; 12837 v21->uW = v19;
12841 v26 = color2; 12838 v26 = color2;
12842 if ( (const char **)pDialogueWindow->field_2C_focus_id != v25 ) 12839 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 )
12843 v26 = white; 12840 v26 = white;
12844 v112.DrawText2(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); 12841 v112.DrawText2(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u);
12845 v17 = pDialogueWindow; 12842 v17 = pDialogueWindow;
12846 v119 = (const char **)((char *)v119 + 1); 12843 v119 = (const char **)((char *)v119 + 1);
12847 _this = (Player *)((char *)_this + 4); 12844 _this = (Player *)((char *)_this + 4);
12848 ++v122; 12845 ++v122;
12849 result = pDialogueWindow->field_28 + pDialogueWindow->field_38; 12846 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
12850 } 12847 }
12851 while ( v122 < result ); 12848 while ( v122 < result );
12852 } 12849 }
12853 } 12850 }
12854 return result; 12851 return result;
13697 v36 = pNPCTopics[121].pText; 13694 v36 = pNPCTopics[121].pText;
13698 v37 = v57; 13695 v37 = v57;
13699 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &v52, 0, 0); 13696 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &v52, 0, 0);
13700 v52.DrawText2(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u); 13697 v52.DrawText2(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u);
13701 result = (int)pDialogueWindow; 13698 result = (int)pDialogueWindow;
13702 pDialogueWindow->field_28 = 0; 13699 pDialogueWindow->pNumPresenceButton = 0;
13703 return result; 13700 return result;
13704 } 13701 }
13705 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 13702 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
13706 if ( !result ) 13703 if ( !result )
13707 return result; 13704 return result;
13708 v20 = pDialogueWindow; 13705 v20 = pDialogueWindow;
13709 v5 = 0; 13706 v5 = 0;
13710 v62 = 0; 13707 v62 = 0;
13711 Str = 0; 13708 Str = 0;
13712 v21 = pDialogueWindow->field_38; 13709 v21 = pDialogueWindow->pStartingPosActiveItem;
13713 v22 = v21 + pDialogueWindow->field_28; 13710 v22 = v21 + pDialogueWindow->pNumPresenceButton;
13714 v61 = 0; 13711 v61 = 0;
13715 if ( v21 >= v22 ) 13712 if ( v21 >= v22 )
13716 goto LABEL_64; 13713 goto LABEL_64;
13717 do 13714 do
13718 { 13715 {
13740 ++Str; 13737 ++Str;
13741 } 13738 }
13742 } 13739 }
13743 ++v21; 13740 ++v21;
13744 } 13741 }
13745 while ( v21 < v20->field_28 + v20->field_38 ); 13742 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem );
13746 if ( !v61 ) 13743 if ( !v61 )
13747 { 13744 {
13748 LABEL_64: 13745 LABEL_64:
13749 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->uClass]); 13746 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->uClass]);
13750 strcat(pTmpBuf, "\n \n"); 13747 strcat(pTmpBuf, "\n \n");
13764 v52.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 13761 v52.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
13765 } 13762 }
13766 v63 = (signed int)(149 - v62) / v61; 13763 v63 = (signed int)(149 - v62) / v61;
13767 if ( v63 > 32 ) 13764 if ( v63 > 32 )
13768 v63 = 32; 13765 v63 = 32;
13769 result = v20->field_38; 13766 result = v20->pStartingPosActiveItem;
13770 v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162; 13767 v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162;
13771 v62 = result; 13768 v62 = result;
13772 v55 = v26; 13769 v55 = v26;
13773 if ( result < result + v20->field_28 ) 13770 if ( result < result + v20->pNumPresenceButton )
13774 { 13771 {
13775 v61 = 2; 13772 v61 = 2;
13776 while ( 1 ) 13773 while ( 1 )
13777 { 13774 {
13778 v27 = v20->GetControl(v62); 13775 v27 = v20->GetControl(v62);
13799 v28->uHeight = v31; 13796 v28->uHeight = v31;
13800 v33 = v32 + v31 - 1; 13797 v33 = v32 + v31 - 1;
13801 v28->uW = v33; 13798 v28->uW = v33;
13802 v55 = v33; 13799 v55 = v33;
13803 v34 = v57; 13800 v34 = v57;
13804 if ( pDialogueWindow->field_2C_focus_id != v61 ) 13801 if ( pDialogueWindow->pCurrentPosActiveItem != v61 )
13805 v34 = v56; 13802 v34 = v56;
13806 v52.DrawText2(pFontArrus, 0, v32, v34, Str, 3u); 13803 v52.DrawText2(pFontArrus, 0, v32, v34, Str, 3u);
13807 goto LABEL_58; 13804 goto LABEL_58;
13808 } 13805 }
13809 v28->uW = 0; 13806 v28->uW = 0;
13810 v28->uHeight = 0; 13807 v28->uHeight = 0;
13811 v28->uY = 0; 13808 v28->uY = 0;
13812 LABEL_58: 13809 LABEL_58:
13813 v35 = v20->field_38; 13810 v35 = v20->pStartingPosActiveItem;
13814 ++v62; 13811 ++v62;
13815 result = v20->field_28 + v35; 13812 result = v20->pNumPresenceButton + v35;
13816 ++v61; 13813 ++v61;
13817 if ( (signed int)v62 >= result ) 13814 if ( (signed int)v62 >= result )
13818 return result; 13815 return result;
13819 } 13816 }
13820 v30 = pGlobalTXT_LocalizationStrings[400]; 13817 v30 = pGlobalTXT_LocalizationStrings[400];
13927 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); 13924 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
13928 v6 = v1->GetMerchant(); 13925 v6 = v1->GetMerchant();
13929 v64 = (signed int)(v65 * (100 - v6)) / 100; 13926 v64 = (signed int)(v65 * (100 - v6)) / 100;
13930 if ( v64 < (signed int)v65 / 3 ) 13927 if ( v64 < (signed int)v65 / 3 )
13931 v64 = (signed int)v65 / 3; 13928 v64 = (signed int)v65 / 3;
13932 v7 = v4->field_38; 13929 v7 = v4->pStartingPosActiveItem;
13933 v8 = v7 + v4->field_28; 13930 v8 = v7 + v4->pNumPresenceButton;
13934 v65 = 0; 13931 v65 = 0;
13935 v62 = v7; 13932 v62 = v7;
13936 if ( (signed int)v7 >= v8 ) 13933 if ( (signed int)v7 >= v8 )
13937 goto LABEL_78; 13934 goto LABEL_78;
13938 do 13935 do
13942 { 13939 {
13943 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); 13940 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
13944 v66 = (DDM_DLV_Header *)((char *)v66 + v10); 13941 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
13945 ++v65; 13942 ++v65;
13946 } 13943 }
13947 v11 = v4->field_38; 13944 v11 = v4->pStartingPosActiveItem;
13948 ++v62; 13945 ++v62;
13949 } 13946 }
13950 while ( (signed int)v62 < v4->field_28 + v11 ); 13947 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
13951 if ( v65 ) 13948 if ( v65 )
13952 { 13949 {
13953 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); 13950 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
13954 v57.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 13951 v57.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
13955 v64 = (149 - (signed int)v66) / (signed int)v65; 13952 v64 = (149 - (signed int)v66) / (signed int)v65;
13956 if ( v64 > 32 ) 13953 if ( v64 > 32 )
13957 v64 = 32; 13954 v64 = 32;
13958 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; 13955 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
13959 v12 = v61; 13956 v12 = v61;
13960 result = v61->field_38; 13957 result = v61->pStartingPosActiveItem;
13961 v13 = result + v61->field_28; 13958 v13 = result + v61->pNumPresenceButton;
13962 v62 = v61->field_38; 13959 v62 = v61->pStartingPosActiveItem;
13963 if ( result < v13 ) 13960 if ( result < v13 )
13964 { 13961 {
13965 v66 = (DDM_DLV_Header *)2; 13962 v66 = (DDM_DLV_Header *)2;
13966 while ( 1 ) 13963 while ( 1 )
13967 { 13964 {
13984 v15->uHeight = v18; 13981 v15->uHeight = v18;
13985 v20 = v19 + v18 - 1; 13982 v20 = v19 + v18 - 1;
13986 v15->uW = v20; 13983 v15->uW = v20;
13987 v65 = v20; 13984 v65 = v20;
13988 v21 = WORD2(v59); 13985 v21 = WORD2(v59);
13989 if ( (DDM_DLV_Header *)pDialogueWindow->field_2C_focus_id != v66 ) 13986 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
13990 v21 = WORD2(v58); 13987 v21 = WORD2(v58);
13991 v57.DrawText2(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); 13988 v57.DrawText2(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
13992 } 13989 }
13993 result = (int)v61; 13990 result = (int)v61;
13994 ++v62; 13991 ++v62;
13995 v66 = (DDM_DLV_Header *)((char *)v66 + 1); 13992 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
13996 if ( (signed int)v62 >= v61->field_28 + v61->field_38 ) 13993 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
13997 break; 13994 break;
13998 v12 = v61; 13995 v12 = v61;
13999 } 13996 }
14000 } 13997 }
14001 } 13998 }
14148 ++pMessageQueue_50CBD0->uNumMessages; 14145 ++pMessageQueue_50CBD0->uNumMessages;
14149 } 14146 }
14150 return result; 14147 return result;
14151 } 14148 }
14152 v63 = 1; 14149 v63 = 1;
14153 v41 = pDialogueWindow->GetControl(pDialogueWindow->field_38); 14150 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
14154 strcpy(a1, nullstring); 14151 strcpy(a1, nullstring);
14155 v41->uHeight = 0; 14152 v41->uHeight = 0;
14156 v41->uY = 0; 14153 v41->uY = 0;
14157 if ( v1->_4B6FF9() ) 14154 if ( v1->_4B6FF9() )
14158 { 14155 {
14163 strcpy(&v56, pGlobalTXT_LocalizationStrings[160]); 14160 strcpy(&v56, pGlobalTXT_LocalizationStrings[160]);
14164 v42 = v63; 14161 v42 = v63;
14165 v43 = pDialogueWindow; 14162 v43 = pDialogueWindow;
14166 v44 = v63; 14163 v44 = v63;
14167 v66 = 0; 14164 v66 = 0;
14168 if ( v63 < pDialogueWindow->field_28 ) 14165 if ( v63 < pDialogueWindow->pNumPresenceButton )
14169 { 14166 {
14170 v61 = (GUIWindow *)&a1[100 * v63]; 14167 v61 = (GUIWindow *)&a1[100 * v63];
14171 do 14168 do
14172 { 14169 {
14173 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); 14170 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0);
14174 v66 = (DDM_DLV_Header *)((char *)v66 + v45); 14171 v66 = (DDM_DLV_Header *)((char *)v66 + v45);
14175 v43 = pDialogueWindow; 14172 v43 = pDialogueWindow;
14176 v61 = (GUIWindow *)((char *)v61 + 100); 14173 v61 = (GUIWindow *)((char *)v61 + 100);
14177 ++v44; 14174 ++v44;
14178 } 14175 }
14179 while ( v44 < pDialogueWindow->field_28 ); 14176 while ( v44 < pDialogueWindow->pNumPresenceButton );
14180 } 14177 }
14181 v46 = v43->field_28 - v42; 14178 v46 = v43->pNumPresenceButton - v42;
14182 v64 = (174 - (signed int)v66) / v46; 14179 v64 = (174 - (signed int)v66) / v46;
14183 if ( v64 > 32 ) 14180 if ( v64 > 32 )
14184 v64 = 32; 14181 v64 = 32;
14185 result = v43->field_38; 14182 result = v43->pStartingPosActiveItem;
14186 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138; 14183 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
14187 v65 = v42 + result; 14184 v65 = v42 + result;
14188 if ( v42 + result < result + v43->field_28 ) 14185 if ( v42 + result < result + v43->pNumPresenceButton )
14189 { 14186 {
14190 v61 = (GUIWindow *)(v42 + 2); 14187 v61 = (GUIWindow *)(v42 + 2);
14191 v66 = (DDM_DLV_Header *)&a1[100 * v42]; 14188 v66 = (DDM_DLV_Header *)&a1[100 * v42];
14192 do 14189 do
14193 { 14190 {
14199 v52 = v50->uY; 14196 v52 = v50->uY;
14200 v50->uHeight = v51; 14197 v50->uHeight = v51;
14201 v47 = v52 + v51 - 1; 14198 v47 = v52 + v51 - 1;
14202 v50->uW = v47; 14199 v50->uW = v47;
14203 v53 = WORD2(v59); 14200 v53 = WORD2(v59);
14204 if ( (GUIWindow *)pDialogueWindow->field_2C_focus_id != v61 ) 14201 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 )
14205 v53 = WORD2(v58); 14202 v53 = WORD2(v58);
14206 v57.DrawText2(pFontArrus, 0, v52, v53, (const char *)v66, 3u); 14203 v57.DrawText2(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
14207 v43 = pDialogueWindow; 14204 v43 = pDialogueWindow;
14208 v66 = (DDM_DLV_Header *)((char *)v66 + 100); 14205 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
14209 v61 = (GUIWindow *)((char *)v61 + 1); 14206 v61 = (GUIWindow *)((char *)v61 + 1);
14210 ++v65; 14207 ++v65;
14211 result = pDialogueWindow->field_28 + pDialogueWindow->field_38; 14208 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
14212 } 14209 }
14213 while ( (signed int)v65 < result ); 14210 while ( (signed int)v65 < result );
14214 } 14211 }
14215 return result; 14212 return result;
14216 } 14213 }
14418 v24 = pNPCTopics[171].pText; 14415 v24 = pNPCTopics[171].pText;
14419 v25 = v31; 14416 v25 = v31;
14420 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); 14417 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
14421 v28.DrawText2(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); 14418 v28.DrawText2(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
14422 result = (int)pDialogueWindow; 14419 result = (int)pDialogueWindow;
14423 pDialogueWindow->field_28 = 0; 14420 pDialogueWindow->pNumPresenceButton = 0;
14424 return result; 14421 return result;
14425 } 14422 }
14426 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 14423 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
14427 if ( !result ) 14424 if ( !result )
14428 return result; 14425 return result;
14429 v8 = pDialogueWindow; 14426 v8 = pDialogueWindow;
14430 v33 = 0; 14427 v33 = 0;
14431 v34 = 0; 14428 v34 = 0;
14432 v29 = pDialogueWindow; 14429 v29 = pDialogueWindow;
14433 v9 = pDialogueWindow->field_38; 14430 v9 = pDialogueWindow->pStartingPosActiveItem;
14434 v10 = v9 + pDialogueWindow->field_28; 14431 v10 = v9 + pDialogueWindow->pNumPresenceButton;
14435 v35 = pDialogueWindow->field_38; 14432 v35 = pDialogueWindow->pStartingPosActiveItem;
14436 if ( v9 >= v10 ) 14433 if ( v9 >= v10 )
14437 goto LABEL_40; 14434 goto LABEL_40;
14438 do 14435 do
14439 { 14436 {
14440 v11 = v8->GetControl(v35)->uControlParam - 36; 14437 v11 = v8->GetControl(v35)->uControlParam - 36;
14442 { 14439 {
14443 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); 14440 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
14444 v33 += v12; 14441 v33 += v12;
14445 ++v34; 14442 ++v34;
14446 } 14443 }
14447 v13 = v8->field_38; 14444 v13 = v8->pStartingPosActiveItem;
14448 ++v35; 14445 ++v35;
14449 } 14446 }
14450 while ( v35 < v8->field_28 + v13 ); 14447 while ( v35 < v8->pNumPresenceButton + v13 );
14451 if ( !v34 ) 14448 if ( !v34 )
14452 { 14449 {
14453 LABEL_40: 14450 LABEL_40:
14454 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->uClass]); 14451 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->uClass]);
14455 strcat(pTmpBuf, "\n \n"); 14452 strcat(pTmpBuf, "\n \n");
14461 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); 14458 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
14462 v28.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 14459 v28.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
14463 v32 = (149 - v33) / v34; 14460 v32 = (149 - v33) / v34;
14464 if ( (149 - v33) / v34 > 32 ) 14461 if ( (149 - v33) / v34 > 32 )
14465 v32 = 32; 14462 v32 = 32;
14466 result = v8->field_38; 14463 result = v8->pStartingPosActiveItem;
14467 v35 = result; 14464 v35 = result;
14468 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; 14465 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
14469 if ( result < result + v8->field_28 ) 14466 if ( result < result + v8->pNumPresenceButton )
14470 { 14467 {
14471 v33 = 2; 14468 v33 = 2;
14472 do 14469 do
14473 { 14470 {
14474 v14 = v8->GetControl(v35); 14471 v14 = v8->GetControl(v35);
14485 v14->uHeight = v18; 14482 v14->uHeight = v18;
14486 v20 = v19 + v18 - 1; 14483 v20 = v19 + v18 - 1;
14487 v14->uW = v20; 14484 v14->uW = v20;
14488 v34 = v20; 14485 v34 = v20;
14489 v21 = v31; 14486 v21 = v31;
14490 if ( pDialogueWindow->field_2C_focus_id != v33 ) 14487 if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
14491 v21 = v30; 14488 v21 = v30;
14492 v28.DrawText2(pFontArrus, 0, v19, v21, v17, 3u); 14489 v28.DrawText2(pFontArrus, 0, v19, v21, v17, 3u);
14493 goto LABEL_34; 14490 goto LABEL_34;
14494 } 14491 }
14495 } 14492 }
14502 v14->uY = v16; 14499 v14->uY = v16;
14503 LABEL_34: 14500 LABEL_34:
14504 v8 = v29; 14501 v8 = v29;
14505 ++v35; 14502 ++v35;
14506 ++v33; 14503 ++v33;
14507 result = v29->field_28 + v29->field_38; 14504 result = v29->pNumPresenceButton + v29->pStartingPosActiveItem;
14508 } 14505 }
14509 while ( v35 < result ); 14506 while ( v35 < result );
14510 } 14507 }
14511 return result; 14508 return result;
14512 } 14509 }
14613 v59 = pDialogueWindow; 14610 v59 = pDialogueWindow;
14614 v54 = v17; 14611 v54 = v17;
14615 strcpy(&Dest, nullstring); 14612 strcpy(&Dest, nullstring);
14616 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); 14613 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1);
14617 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); 14614 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
14618 v19 = v16->field_28; 14615 v19 = v16->pNumPresenceButton;
14619 v20 = v18 + v17 + 146; 14616 v20 = v18 + v17 + 146;
14620 v21 = v16->field_38; 14617 v21 = v16->pStartingPosActiveItem;
14621 v63 = v20; 14618 v63 = v20;
14622 v55 = v20; 14619 v55 = v20;
14623 v60 = v21; 14620 v60 = v21;
14624 if ( v21 >= v21 + v19 ) 14621 if ( v21 >= v21 + v19 )
14625 goto LABEL_71; 14622 goto LABEL_71;
14639 && ((v26 = 8 * (int)v23, !dword_4F09CC[v26]) 14636 && ((v26 = 8 * (int)v23, !dword_4F09CC[v26])
14640 || (unsigned __int16)_449B57_test_bit(pParty->_award_bits, LOWORD(dword_4F09CC[v26])))) ) 14637 || (unsigned __int16)_449B57_test_bit(pParty->_award_bits, LOWORD(dword_4F09CC[v26])))) )
14641 { 14638 {
14642 v58 = v61; 14639 v58 = v61;
14643 v27 = (const char *)v56; 14640 v27 = (const char *)v56;
14644 if ( pDialogueWindow->field_2C_focus_id != s1 ) 14641 if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
14645 v27 = *(const char **)v57; 14642 v27 = *(const char **)v57;
14646 v47[1] = v27; 14643 v47[1] = v27;
14647 sprintfex(a1, format_4E2DC8, v27); 14644 sprintfex(a1, format_4E2DC8, v27);
14648 v66 = (unsigned __int8)byte_4F09B8[v26 * 4]; 14645 v66 = (unsigned __int8)byte_4F09B8[v26 * 4];
14649 if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) 14646 if ( (signed int)ptr_507BC0->ptr_1C >= 63 )
14715 v24->uHeight = 0; 14712 v24->uHeight = 0;
14716 v24->uY = 0; 14713 v24->uY = 0;
14717 } 14714 }
14718 } 14715 }
14719 ++v60; 14716 ++v60;
14720 if ( (signed int)v60 >= v59->field_28 + v59->field_38 ) 14717 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem )
14721 break; 14718 break;
14722 v16 = v59; 14719 v16 = v59;
14723 } 14720 }
14724 if ( v63 != v55 ) 14721 if ( v63 != v55 )
14725 { 14722 {