Mercurial > mm7
diff UIHouses.cpp @ 1295:86a83e12d795
moving files
author | Ritor1 |
---|---|
date | Mon, 17 Jun 2013 17:34:01 +0600 |
parents | 6bbd50bda571 |
children | 5450af4f57ef |
line wrap: on
line diff
--- a/UIHouses.cpp Mon Jun 17 09:09:30 2013 +0600 +++ b/UIHouses.cpp Mon Jun 17 17:34:01 2013 +0600 @@ -6255,4 +6255,478 @@ while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); } return; -} \ No newline at end of file +} +//----- (004B1A2D) -------------------------------------------------------- +void __cdecl ShowPopupShopItem() +{ + POINT *v1; // esi@5 + unsigned int v2; // eax@5 + int v3; // ecx@5 + POINT *v4; // esi@12 + int v5; // eax@12 + unsigned int v6; // eax@13 + ItemGen *v7; // ecx@13 + signed int v8; // esi@17 + unsigned int v9; // eax@19 + POINT v10; // [sp+8h] [bp-44h]@12 + POINT v11; // [sp+10h] [bp-3Ch]@12 + POINT v12; // [sp+18h] [bp-34h]@18 + POINT v13; // [sp+20h] [bp-2Ch]@17 + POINT v14; // [sp+28h] [bp-24h]@17 + POINT v15; // [sp+30h] [bp-1Ch]@17 + POINT v16; // [sp+38h] [bp-14h]@5 + POINT a2; // [sp+40h] [bp-Ch]@5 + + if ( in_current_building_type <= 0 ) + return; + if ( in_current_building_type <= BildingType_AlchemistShop ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + { + if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + return; + if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) + { + v8 = pMouse->GetCursorPos(&v15)->x - 14; + v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&v13)->x <= 13 + || pMouse->GetCursorPos(&v12)->x >= 462 + || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) + return; + GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); + return; + } + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + return; + } + v4 = pMouse->GetCursorPos(&v11); + v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; + if ( !v5 ) + return; + v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); + v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; + GameUI_DrawItemInfo(v7); + return; + } + if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) + { + v1 = pMouse->GetCursorPos(&a2); + v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; + v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; + v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; + if ( v5 ) + sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); + } +} +//----- (004B1D27) -------------------------------------------------------- +void __cdecl sub_4B1D27() +{ + int v0; // edx@2 + unsigned int v1; // ecx@7 + signed int v2; // edi@10 + int v3; // esi@10 + __int16 v4; // ax@15 + signed int v5; // edi@20 + int v6; // esi@20 + int v7[4]; // [sp+Ch] [bp-10h]@12 + + if ( in_current_building_type > 0 ) + { + v0 = 3; + if ( in_current_building_type > BildingType_MagicShop ) + { + if ( in_current_building_type == BildingType_Bank ) + { + if ( !dword_F8B1E4 ) + return; + } + else + { + if ( in_current_building_type != BildingType_Temple ) + return; + } + v1 = (unsigned int)window_SpeakInHouse->ptr_1C; + PlayHouseSound(v1, (HouseSoundID)v0); + return; + } + v1 = (unsigned int)window_SpeakInHouse->ptr_1C; + if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) + { + if ( pParty->uNumGold <= 0x2710 ) + { + if ( !dword_F8B1E4 ) + return; + v0 = 4; + PlayHouseSound(v1, (HouseSoundID)v0); + return; + } + PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); + if ( !dword_F8B1E4 && !qword_A750D8 ) + { + v5 = 0; + v6 = 1; + do + { + if ( pPlayers[v6]->CanAct() ) + v7[v5++] = v6; + ++v6; + } + while ( v6 <= 4 ); + if ( v5 ) + { + qword_A750D8 = 256i64; + word_A750E0 = 80; + v4 = LOWORD(v7[rand() % v5]); + word_A750E2 = v4; + return; + } + } + } + else + { + if ( !qword_A750D8 ) + { + v2 = 0; + v3 = 1; + do + { + if ( pPlayers[v3]->CanAct() ) + v7[v2++] = v3; + ++v3; + } + while ( v3 <= 4 ); + if ( v2 ) + { + qword_A750D8 = 256i64; + word_A750E0 = 80; + v4 = LOWORD(v7[rand() % v2]); + word_A750E2 = v4; + return; + } + } + } + } +} +//----- (004B2A74) -------------------------------------------------------- +void SimpleHouseAndBoatsDialog() +{ + char *v0; // esi@3 + char *v1; // ST1C_4@3 + char *v2; // eax@3 + const char *v3; // ST1C_4@5 + int v4; // eax@5 + unsigned int i; // eax@5 + NPCData *v6; // esi@6 + unsigned __int16 v7; // bx@6 + unsigned int v8; // eax@6 + int v9; // eax@11 + unsigned int v10; // ecx@12 + int v11; // eax@12 + int v12; // esi@12 + char *v13; // eax@12 + GUIWindow *v14; // ebx@13 + char *v15; // esi@14 + GUIButton *v16; // eax@15 + unsigned int v17; // ecx@15 + int v18; // ecx@17 + int v19; // ecx@18 + int v20; // ecx@19 + int v21; // ecx@20 + int v22; // ecx@21 + unsigned int v23; // ecx@23 + int v24; // ecx@35 + int v25; // ecx@36 + int v26; // ecx@37 + int v27; // ecx@38 + int v28; // ecx@39 + char *v29; // esi@42 + unsigned int v30; // ST20_4@42 + int v31; // ST1C_4@42 + unsigned int v32; // eax@42 + char *v33; // eax@43 + int v34; // esi@51 + int v35; // eax@51 + unsigned int v36; // edi@51 + GUIButton *v37; // eax@52 + int v38; // eax@52 + signed int v39; // ecx@54 + int v40; // edi@57 + GUIButton *v41; // eax@60 + GUIButton *v42; // esi@60 + const char *v43; // ebx@60 + int v44; // eax@60 + unsigned int v45; // ecx@60 + unsigned __int16 v46; // ax@60 + GUIFont *v47; // ebx@64 + int v48; // esi@64 + char *v49; // eax@66 + GUIWindow w; // [sp+Ch] [bp-110h]@64 + GUIWindow v52; // [sp+60h] [bp-BCh]@13 + GUIWindow a1; // [sp+B4h] [bp-68h]@1 + unsigned int v54; // [sp+108h] [bp-14h]@14 + int v55; // [sp+10Ch] [bp-10h]@6 + int v56; // [sp+110h] [bp-Ch]@13 + char *pInString; // [sp+114h] [bp-8h]@12 + NPCData *v58; // [sp+118h] [bp-4h]@6 + + memcpy(&a1, pDialogueWindow, sizeof(a1)); + if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) + { + v0 = pMapStats->pInfos[uHouse_ExitPic].pName; + v1 = pMapStats->pInfos[uHouse_ExitPic].pName; + a1.uFrameX = 493; + a1.uFrameWidth = 126; + a1.uFrameZ = 366; + a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); + a1.uFrameX = 483; + a1.uFrameWidth = 148; + a1.uFrameZ = 334; + v2 = pTransitionStrings[uHouse_ExitPic]; + if ( !v2 ) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0); + v2 = pTmpBuf.data(); + } + v3 = v2; + v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); + a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); + return; + } + a1.uFrameWidth -= 10; + a1.uFrameZ -= 10; + v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 + v6 = v58; + v55 = TargetColor(0xE1u, 0xCDu, 0x23u); + v7 = TargetColor(0x15u, 0x99u, 0xE9u); + v8 = v6->uProfession; + if ( v8 ) + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); + else + strcpy(pTmpBuf.data(), v6->pName); + a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u); + if ( !dword_591080 ) + { + if ( !uDialogueType ) + { + v9 = v6->greet; + if ( v9 ) + { + v10 = v6->uFlags; + a1.uFrameWidth = game_viewport_width; + a1.uFrameZ = 452; + pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); + v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); + v12 = v11 + 7; + pRenderer->_4A6A68(8, 352 - (v11 + 7), + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); + pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); + } + } + } + v14 = pDialogueWindow; + memcpy(&v52, pDialogueWindow, sizeof(v52)); + v52.uFrameX = 483; + v52.uFrameWidth = 148; + v52.uFrameZ = 334; + v56 = v52.pStartingPosActiveItem; + if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) + { + v15 = "";//(char *)v54; + while ( 1 ) + { + v16 = v52.GetControl(v56); + v17 = v16->msg_param; + pInString = (char *)v16; + if ( (signed int)v17 > 24 ) + { + v24 = v17 - 76; + if ( !v24 ) + { + v15 = pGlobalTXT_LocalizationStrings[406]; + goto LABEL_49; + } + v25 = v24 - 1; + if ( !v25 ) + { + v15 = pGlobalTXT_LocalizationStrings[407]; + goto LABEL_49; + } + v26 = v25 - 2; + if ( !v26 ) + { + v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); +LABEL_44: + v15 = v33; +LABEL_45: + v16 = (GUIButton *)pInString; + goto LABEL_49; + } + v27 = v26 - 3; + if ( !v27 ) + { + v33 = (char *)ContractSelectText((int)v52.ptr_1C); + goto LABEL_44; + } + v28 = v27 - 1; + if ( !v28 ) + { + v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; + v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); + v31 = *(int *)v29; + v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30); + sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); + current_npc_text = pTmpBuf2.data(); + v15 = ""; + goto LABEL_45; + } + if ( v28 != 10 ) + goto LABEL_41; + } + else + { + if ( v17 == 24 ) + { + v23 = v58->evt_F; +LABEL_33: + v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; + if ( !v15 ) + { + v16->msg_param = 0; + v15 = ""; + } + goto LABEL_49; + } + v18 = v17 - 13; + if ( v18 ) + { + v19 = v18 - 6; + if ( !v19 ) + { + v23 = v58->evt_A; + goto LABEL_33; + } + v20 = v19 - 1; + if ( !v20 ) + { + v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; + if ( !v15 ) + { + v16->msg_param = 0; + v15 = ""; + } + if ( uDialogueType != 84 ) + goto LABEL_49; + sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); + sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); + current_npc_text = pTmpBuf2.data(); + goto LABEL_45; + } + v21 = v20 - 1; + if ( !v21 ) + { + v23 = v58->evt_C; + goto LABEL_33; + } + v22 = v21 - 1; + if ( !v22 ) + { + v23 = v58->evt_D; + goto LABEL_33; + } + if ( v22 == 1 ) + { + v23 = v58->evt_E; + goto LABEL_33; + } +LABEL_41: + v15 = ""; + goto LABEL_49; + } + v15 = pGlobalTXT_LocalizationStrings[122]; + } +LABEL_49: + strcpy(v16->pButtonName, v15); + ++v56; + if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) + { + v14 = pDialogueWindow; + break; + } + } + } + v34 = 0; + v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); + v35 = TargetColor(0xE1u, 0xCDu, 0x23u); + v36 = v14->pStartingPosActiveItem; + v55 = v35; + for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton + + pDialogueWindow->pStartingPosActiveItem ) + { + v37 = v14->GetControl(v36); + v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); + v14 = pDialogueWindow; + v34 += v38; + ++v36; + } + v39 = v14->pNumPresenceButton; + if ( v39 ) + { + v58 = (NPCData *)((174 - v34) / v39); + if ( (signed int)v58 > 32 ) + v58 = (NPCData *)32; + pInString = (char *)2; + v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; + v56 = v14->pStartingPosActiveItem; + i = v56; + if ( (signed int)i < (signed int)(i + v39) ) + { + while ( 1 ) + { + v41 = v14->GetControl(i); + v42 = v41; + v43 = v41->pButtonName; + v41->uY = (unsigned int)((char *)v58 + v40); + v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); + v45 = v42->uY; + v42->uHeight = v44; + v40 = v45 + v44 - 1; + v42->uW = v40; + v46 = v55; + if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) + v46 = v54; + v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); + v14 = pDialogueWindow; + ++pInString; + ++v56; + i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + if ( v56 >= (signed int)i ) + break; + i = v56; + } + } + } + if ( current_npc_text ) + { + w.uFrameWidth = 458; + w.uFrameZ = 457; + v47 = pFontArrus; + v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + if ( 352 - v48 < 8 ) + { + v47 = pFontCreate; + v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + } + pRenderer->_4A6A68(8, 352 - v48, + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); + pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); + v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); + a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); + } +}