comparison GUIWindow.cpp @ 854:06fc66ceecd6

for Arcomage game
author Ritor1
date Sun, 31 Mar 2013 16:42:11 +0600
parents dfd683c4f538
children a0ae8d36c2d6
comparison
equal deleted inserted replaced
853:7ada14f991f5 854:06fc66ceecd6
1016 // 50640C: using guessed type int dword_50640C[]; 1016 // 50640C: using guessed type int dword_50640C[];
1017 1017
1018 //----- (004B3157) -------------------------------------------------------- 1018 //----- (004B3157) --------------------------------------------------------
1019 void GUIWindow::HouseDialogManager() 1019 void GUIWindow::HouseDialogManager()
1020 { 1020 {
1021 unsigned __int16 v1; // di@2 1021 unsigned __int16 pWhiteColor; // di@2
1022 const char *v2; // edx@4 1022 const char *pHouseName; // edx@4
1023 signed int v3; // edx@5 1023 signed int v3; // edx@5
1024 char *v4; // edi@9 1024 char *v4; // edi@9
1025 int v5; // eax@45 1025 int pTextHeight; // eax@45
1026 int v6; // edi@45 1026 int v6; // edi@45
1027 char *v7; // eax@45 1027 char *v7; // eax@45
1028 int v8; // edi@46 1028 int v8; // edi@46
1029 int v9; // eax@50 1029 int v9; // eax@50
1030 unsigned int v10; // [sp-10h] [bp-C8h]@53 1030 unsigned int v10; // [sp-10h] [bp-C8h]@53
1031 unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53 1031 //unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53
1032 //unsigned int v12; // [sp-Ch] [bp-C4h]@60 1032 //unsigned int v12; // [sp-Ch] [bp-C4h]@60
1033 char *v13; // [sp-8h] [bp-C0h]@50 1033 char *v13; // [sp-8h] [bp-C0h]@50
1034 //unsigned int v14; // [sp-8h] [bp-C0h]@60 1034 //unsigned int v14; // [sp-8h] [bp-C0h]@60
1035 unsigned int v15; // [sp-4h] [bp-BCh]@50 1035 unsigned int v15; // [sp-4h] [bp-BCh]@50
1036 //Texture *v16; // [sp-4h] [bp-BCh]@60 1036 //Texture *v16; // [sp-4h] [bp-BCh]@60
1037 GUIWindow w; // [sp+Ch] [bp-ACh]@4 1037 GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4
1038 GUIWindow v18; // [sp+60h] [bp-58h]@2 1038 GUIWindow pWindow; // [sp+60h] [bp-58h]@2
1039 int v19; // [sp+B4h] [bp-4h]@2 1039 int pColor2; // [sp+B4h] [bp-4h]@2
1040 1040
1041 if ( !window_SpeakInHouse ) 1041 if ( !window_SpeakInHouse )
1042 return; 1042 return;
1043 memcpy(&v18, this, sizeof(v18)); 1043 memcpy(&pWindow, this, sizeof(pWindow));
1044 v18.uFrameWidth -= 18; 1044 pWindow.uFrameWidth -= 18;
1045 v18.uFrameZ -= 18; 1045 pWindow.uFrameZ -= 18;
1046 v1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1046 pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
1047 v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); 1047 pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
1048 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); 1048 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
1049 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]); 1049 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]);
1050 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) 1050 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic )
1051 { 1051 {
1052 w.uFrameWidth = 130; 1052 pDialogWindow.uFrameWidth = 130;
1053 w.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); 1053 pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight);
1054 1054
1055 //v2 = (const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C]; 1055 //v2 = (const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C];
1056 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName; 1056 pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName;
1057 1057
1058 if ( v2 ) 1058 if ( pHouseName )
1059 { 1059 {
1060 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(v2, &w, 0, 0); 1060 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0);
1061 if ( v3 < 0 ) 1061 if ( v3 < 0 )
1062 v3 = 0; 1062 v3 = 0;
1063 v18.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, v1, 1063 pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor,
1064 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], 1064 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C],
1065 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3); 1065 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3);
1066 } 1066 }
1067 } 1067 }
1068 v18.uFrameWidth += 8; 1068 pWindow.uFrameWidth += 8;
1069 v18.uFrameZ += 8; 1069 pWindow.uFrameZ += 8;
1070 if ( !pDialogueNPCCount ) 1070 if ( !pDialogueNPCCount )
1071 { 1071 {
1072 if ( in_current_building_type == BildingType_Jail ) 1072 if ( in_current_building_type == BildingType_Jail )
1073 { 1073 {
1074 JailDialog(); 1074 JailDialog();
1075 goto LABEL_58; 1075 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
1076 {
1077 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
1078 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
1079 }
1080 else
1081 {
1082 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
1083 }
1084 return;
1076 } 1085 }
1077 if ( current_npc_text ) 1086 if ( current_npc_text )
1078 { 1087 {
1079 w.uFrameWidth = 458; 1088 pDialogWindow.uFrameWidth = 458;
1080 w.uFrameZ = 457; 1089 pDialogWindow.uFrameZ = 457;
1081 v5 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0); 1090 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0);
1082 v6 = v5 + 7; 1091 v6 = pTextHeight + 7;
1083 pRenderer->_4A6A68(8, 352 - (v5 + 7), &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (v5 + 7)); 1092 pRenderer->_4A6A68(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather],
1084 pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428); 1093 pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7));
1085 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &w, 0xDu, 0); 1094 pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428);
1095 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0);
1086 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); 1096 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0);
1087 } 1097 }
1088 v8 = 0; 1098 v8 = 0;
1089 if ( uNumDialogueNPCPortraits <= 0 ) 1099 if ( uNumDialogueNPCPortraits <= 0 )
1090 goto LABEL_58; 1100 {
1101 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
1102 {
1103 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
1104 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
1105 }
1106 else
1107 {
1108 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
1109 }
1110 return;
1111 }
1091 while ( 1 ) 1112 while ( 1 )
1092 { 1113 {
1093 //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, 1114 //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
1094 // *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, 1115 // *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
1095 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4, 1116 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4,
1101 if ( uNumDialogueNPCPortraits < 4 ) 1122 if ( uNumDialogueNPCPortraits < 4 )
1102 break; 1123 break;
1103 LABEL_57: 1124 LABEL_57:
1104 ++v8; 1125 ++v8;
1105 if ( v8 >= uNumDialogueNPCPortraits ) 1126 if ( v8 >= uNumDialogueNPCPortraits )
1106 goto LABEL_58; 1127 //goto LABEL_58;
1128 {
1129 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
1130 {
1131 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
1132 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
1133 }
1134 else
1135 {
1136 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
1137 }
1138 return;
1139 }
1107 } 1140 }
1108 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) 1141 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
1109 { 1142 {
1110 v15 = 3; 1143 v15 = 3;
1111 v13 = pMapStats->pInfos[uHouse_ExitPic].pName; 1144 v13 = pMapStats->pInfos[uHouse_ExitPic].pName;
1116 if ( !v8 && dword_591080 ) 1149 if ( !v8 && dword_591080 )
1117 { 1150 {
1118 v15 = 3; 1151 v15 = 3;
1119 //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]; 1152 //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C];
1120 v13 = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; 1153 v13 = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle;
1121 v18.DrawTitleText(pFontCreate, 0x1E3u, 113, v19, v13, 3); 1154 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, v13, 3);
1122 goto LABEL_57; 1155 goto LABEL_57;
1123 } 1156 }
1124 v15 = 3; 1157 v15 = 3;
1125 v13 = HouseNPCData[v8 - (dword_591080 != 0)]->pName; 1158 v13 = HouseNPCData[(v8 +1) - (dword_591080 != 0)]->pName;
1126 v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; 1159 v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
1127 } 1160 }
1128 v11 = v19; 1161 //v11 = pColor2;
1129 v10 = v9; 1162 v10 = v9;
1130 v18.DrawTitleText(pFontCreate, 0x1E3u, v10, v11, v13, v15); 1163 pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, v13, v15);
1131 goto LABEL_57; 1164 goto LABEL_57;
1132 } 1165 }
1133 v4 = (char *)pDialogueNPCCount - 1; 1166 v4 = (char *)pDialogueNPCCount - 1;
1134 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); 1167 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
1135 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); 1168 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]);
1136 if ( pCurrentScreen == SCREEN_E ) 1169 if ( pCurrentScreen == SCREEN_E )
1137 { 1170 {
1138 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1171 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1139 goto LABEL_58; 1172 //goto LABEL_58;
1173 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
1174 {
1175 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
1176 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
1177 }
1178 else
1179 {
1180 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
1181 }
1182 return;
1140 } 1183 }
1141 if ( v4 || !dword_591080 ) 1184 if ( v4 || !dword_591080 )
1142 { 1185 {
1143 SimpleHouseAndBoatsDialog(); 1186 SimpleHouseAndBoatsDialog();
1144 } 1187 }
1145 else 1188 else
1146 { 1189 {
1147 sprintfex( pTmpBuf, pGlobalTXT_LocalizationStrings[429], 1190 sprintfex( pTmpBuf, pGlobalTXT_LocalizationStrings[429],
1148 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName, 1191 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName,
1149 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); 1192 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle);
1150 v18.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v19, pTmpBuf, 3u); 1193 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf, 3);
1151 switch ( in_current_building_type ) 1194 switch ( in_current_building_type )
1152 { 1195 {
1153 case BildingType_WeaponShop: 1196 case BildingType_WeaponShop:
1154 WeaponShopDialog(); 1197 WeaponShopDialog();
1155 break; 1198 break;
1201 default: 1244 default:
1202 __debugbreak;//New BildingType 1245 __debugbreak;//New BildingType
1203 break; 1246 break;
1204 } 1247 }
1205 } 1248 }
1206 LABEL_58: 1249 //LABEL_58:
1207 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) 1250 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
1208 { 1251 {
1209 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); 1252 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
1210 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); 1253 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
1211 } 1254 }
1926 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];//Войти в ^Pv[%s] 1969 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];//Войти в ^Pv[%s]
1927 } 1970 }
1928 else 1971 else
1929 { 1972 {
1930 if ( v26 || !dword_591080 ) 1973 if ( v26 || !dword_591080 )
1931 v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName; 1974 v27 = HouseNPCData[(v26 +1) - (dword_591080 != 0)]->pName;
1932 else 1975 else
1933 //v27 = (char *)p2DEvents_minus1_::08[13 * a4]; 1976 //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
1934 v27 = (char *)p2DEvents[pButton - 1].pProprieterName; 1977 v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
1935 v30 = v27; 1978 v30 = v27;
1936 v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" Побеседовать с ^Pt[%s] 1979 v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" Побеседовать с ^Pt[%s]