Mercurial > mm7
comparison UI/UiGame.cpp @ 2397:eff78dab2142
Fixing GameUI_WritePointedObjectStatusString conditions
author | Grumpy7 |
---|---|
date | Thu, 10 Jul 2014 00:58:45 +0200 |
parents | bddcaf5d5db2 |
children | 79e750ba00b9 |
comparison
equal
deleted
inserted
replaced
2380:56f87a5c402b | 2397:eff78dab2142 |
---|---|
1150 int v1; // ebx@6 | 1150 int v1; // ebx@6 |
1151 GUIWindow *pWindow; // edi@7 | 1151 GUIWindow *pWindow; // edi@7 |
1152 GUIButton *pButton; // ecx@11 | 1152 GUIButton *pButton; // ecx@11 |
1153 int v7; // ecx@19 | 1153 int v7; // ecx@19 |
1154 enum UIMessageType pMessageType1; // esi@24 | 1154 enum UIMessageType pMessageType1; // esi@24 |
1155 // int v14; // eax@41 | 1155 int v14; // eax@41 |
1156 ItemGen *pItemGen; // ecx@44 | 1156 ItemGen *pItemGen; // ecx@44 |
1157 int v16; // ecx@46 | 1157 int v16; // ecx@46 |
1158 signed int v18; // eax@55 | 1158 signed int v18; // eax@55 |
1159 signed int v18b; | 1159 signed int v18b; |
1160 signed int v19; // ecx@63 | 1160 signed int v19; // ecx@63 |
1161 BLVFace *pFace; // eax@69 | |
1161 const char *pText; // ecx@79 | 1162 const char *pText; // ecx@79 |
1162 // char *v28; // esi@82 | 1163 char *v28; // esi@82 |
1163 // enum UIMessageType pMessageType2; // esi@110 | 1164 enum UIMessageType pMessageType2; // esi@110 |
1164 // enum UIMessageType pMessageType3; // edx@117 | 1165 enum UIMessageType pMessageType3; // edx@117 |
1165 char Str1[200]; // [sp+Ch] [bp-D4h]@129 | 1166 char Str1[200]; // [sp+Ch] [bp-D4h]@129 |
1166 unsigned int pX; // [sp+D4h] [bp-Ch]@1 | 1167 unsigned int pX; // [sp+D4h] [bp-Ch]@1 |
1167 unsigned int pY; // [sp+D8h] [bp-8h]@1 | 1168 unsigned int pY; // [sp+D8h] [bp-8h]@1 |
1168 // unsigned int v45; // [sp+DCh] [bp-4h]@21 | 1169 unsigned int v45; // [sp+DCh] [bp-4h]@21 |
1169 | 1170 |
1170 int interaction_distance_limit = 512; | 1171 int interaction_distance_limit = 512; |
1171 int monster_info_distance_limit = 5120; | |
1172 | 1172 |
1173 pMouse->uPointingObjectID = 0; | 1173 pMouse->uPointingObjectID = 0; |
1174 pMouse->GetClickPos(&pX, &pY); | 1174 pMouse->GetClickPos(&pX, &pY); |
1175 if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 )//границы окна игры | 1175 if ( pX < 0 || pX > 639 || pY < 0 || pY > 479 ) |
1176 return; | 1176 return; |
1177 if ( pX <= 467 && pY <= 351 )//пределы основной области | 1177 if ( pCurrentScreen == SCREEN_GAME ) |
1178 { | 1178 { |
1179 //окно(область) игры---------------------------------- | 1179 if ( pX <= 467 && pY <= 351 ) |
1180 if ( pCurrentScreen == SCREEN_GAME ) | |
1181 { | 1180 { |
1182 //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 | 1181 //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 |
1183 { | 1182 { |
1184 v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); | 1183 v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); |
1185 if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X | 1184 if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X |
1199 uLastPointedObjectID = pMouse->uPointingObjectID; | 1198 uLastPointedObjectID = pMouse->uPointingObjectID; |
1200 return; | 1199 return; |
1201 } | 1200 } |
1202 } | 1201 } |
1203 /*else | 1202 /*else |
1204 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ | 1203 { |
1204 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1205 }*/ | |
1205 pMouse->uPointingObjectID = (unsigned __int16)v18; | 1206 pMouse->uPointingObjectID = (unsigned __int16)v18; |
1206 v19 = (signed)PID_ID(v18); | 1207 v19 = (signed)PID_ID(v18); |
1207 //For Items------------------------------------ | 1208 if ( PID_TYPE(v18) == OBJECT_Item ) |
1208 if (PID_TYPE(v18) == OBJECT_Item) | |
1209 { | 1209 { |
1210 if ( pObjectList->pObjects[pSpriteObjects[v19].uObjectDescID].uFlags & 0x10 ) | 1210 if ( pObjectList->pObjects[pSpriteObjects[v19].uObjectDescID].uFlags & 0x10 ) |
1211 { | 1211 { |
1212 pMouse->uPointingObjectID = 0; | 1212 pMouse->uPointingObjectID = 0; |
1213 pFooterString[0] = 0; | 1213 uLastPointedObjectID = 1; |
1214 bForceDrawFooter = 1; | 1214 if ( pMouse->uPointingObjectID == 0 ) |
1215 uLastPointedObjectID = 0; | 1215 { |
1216 if ( uLastPointedObjectID != 0 ) | |
1217 { | |
1218 pFooterString[0] = 0; | |
1219 bForceDrawFooter = 1; | |
1220 } | |
1221 } | |
1222 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1216 return; | 1223 return; |
1217 } | 1224 } |
1218 if ( HIWORD(v18) < interaction_distance_limit && !pParty->pPickedItem.uItemID ) | 1225 if ( v18 >= 0x2000000u || pParty->pPickedItem.uItemID ) |
1219 { | 1226 { |
1220 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[v19].stru_24.GetDisplayName());// "Get %s" | 1227 GameUI_SetFooterString(pSpriteObjects[v19].stru_24.GetDisplayName()); |
1221 GameUI_SetFooterString(pTmpBuf.data()); | 1228 if ( pMouse->uPointingObjectID == 0 ) |
1229 { | |
1230 if ( uLastPointedObjectID != 0 ) | |
1231 { | |
1232 pFooterString[0] = 0; | |
1233 bForceDrawFooter = 1; | |
1234 } | |
1235 } | |
1236 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1222 return; | 1237 return; |
1223 } | 1238 } |
1224 GameUI_SetFooterString(pSpriteObjects[v19].stru_24.GetDisplayName()); | 1239 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[v19].stru_24.GetDisplayName());// "Get %s" |
1240 GameUI_SetFooterString(pTmpBuf.data()); | |
1225 if ( pMouse->uPointingObjectID == 0 ) | 1241 if ( pMouse->uPointingObjectID == 0 ) |
1226 { | 1242 { |
1227 if ( uLastPointedObjectID != 0 ) | 1243 if ( uLastPointedObjectID != 0 ) |
1228 { | 1244 { |
1229 pFooterString[0] = 0; | 1245 pFooterString[0] = 0; |
1231 } | 1247 } |
1232 } | 1248 } |
1233 uLastPointedObjectID = pMouse->uPointingObjectID; | 1249 uLastPointedObjectID = pMouse->uPointingObjectID; |
1234 return; | 1250 return; |
1235 } | 1251 } |
1236 //For Decorations---------------------------------- | 1252 else if ( PID_TYPE(v18) == OBJECT_Decoration ) |
1237 if (PID_TYPE(v18) == OBJECT_Decoration) | |
1238 { | 1253 { |
1239 if ( !pLevelDecorations[v19].uEventID ) | 1254 if ( !pLevelDecorations[v19].uEventID ) |
1240 { | 1255 { |
1241 if ( pLevelDecorations[v19].IsInteractive() ) | 1256 if ( pLevelDecorations[v19].IsInteractive() ) |
1242 pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 380].pTopic;//-379 | 1257 pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//неверно для костра |
1243 else | 1258 else |
1244 pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20; | 1259 pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20; |
1245 GameUI_SetFooterString(pText); | 1260 GameUI_SetFooterString(pText); |
1246 } | 1261 if ( pMouse->uPointingObjectID == 0 ) |
1247 else | 1262 { |
1248 { | 1263 if ( uLastPointedObjectID != 0 ) |
1249 if ( GetEventHintString(pLevelDecorations[v19].uEventID) ) | 1264 { |
1250 GameUI_SetFooterString(GetEventHintString(pLevelDecorations[v19].uEventID)); | 1265 pFooterString[0] = 0; |
1251 } | 1266 bForceDrawFooter = 1; |
1267 } | |
1268 } | |
1269 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1270 return; | |
1271 } | |
1272 if ( !GetEventHintString(pLevelDecorations[v19].uEventID) ) | |
1273 { | |
1274 if ( pMouse->uPointingObjectID == 0 ) | |
1275 { | |
1276 if ( uLastPointedObjectID != 0 ) | |
1277 { | |
1278 pFooterString[0] = 0; | |
1279 bForceDrawFooter = 1; | |
1280 } | |
1281 } | |
1282 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1283 return; | |
1284 } | |
1285 GameUI_SetFooterString(GetEventHintString(pLevelDecorations[v19].uEventID)); | |
1252 if ( pMouse->uPointingObjectID == 0 ) | 1286 if ( pMouse->uPointingObjectID == 0 ) |
1253 { | 1287 { |
1254 if ( uLastPointedObjectID != 0 ) | 1288 if ( uLastPointedObjectID != 0 ) |
1255 { | 1289 { |
1256 pFooterString[0] = 0; | 1290 pFooterString[0] = 0; |
1258 } | 1292 } |
1259 } | 1293 } |
1260 uLastPointedObjectID = pMouse->uPointingObjectID; | 1294 uLastPointedObjectID = pMouse->uPointingObjectID; |
1261 return; | 1295 return; |
1262 } | 1296 } |
1263 //For 3D Model------------------------------------- | 1297 else if ( PID_TYPE(v18) == OBJECT_BModel ) |
1264 if (PID_TYPE(v18) == OBJECT_BModel) | 1298 { |
1265 { | 1299 if ( v18 < 0x2000000u ) |
1266 if ( HIWORD(v18) < interaction_distance_limit ) | 1300 { |
1267 { | 1301 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) |
1268 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1269 { | 1302 { |
1270 v18b = (signed int)(unsigned __int16)v18 >> 9; | 1303 v18b = (signed int)(unsigned __int16)v18 >> 9; |
1271 if ( !pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID | 1304 if ( !pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID |
1272 || !GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID) ) | 1305 || !GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID) ) |
1273 { | 1306 { |
1274 pMouse->uPointingObjectID = 0; | 1307 pMouse->uPointingObjectID = 0; |
1275 pFooterString[0] = 0; | 1308 uLastPointedObjectID = 1; |
1276 bForceDrawFooter = 1; | 1309 if ( pMouse->uPointingObjectID == 0 ) |
1277 uLastPointedObjectID = 0; | 1310 { |
1311 if ( uLastPointedObjectID != 0 ) | |
1312 { | |
1313 pFooterString[0] = 0; | |
1314 bForceDrawFooter = 1; | |
1315 } | |
1316 } | |
1317 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1278 return; | 1318 return; |
1279 } | 1319 } |
1280 GameUI_SetFooterString(GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID)); | 1320 GameUI_SetFooterString(GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID)); |
1281 if ( pMouse->uPointingObjectID == 0 ) | 1321 if ( pMouse->uPointingObjectID == 0 ) |
1282 { | 1322 { |
1287 } | 1327 } |
1288 } | 1328 } |
1289 uLastPointedObjectID = pMouse->uPointingObjectID; | 1329 uLastPointedObjectID = pMouse->uPointingObjectID; |
1290 return; | 1330 return; |
1291 } | 1331 } |
1292 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 1332 pFace = &pIndoor->pFaces[v19]; |
1293 { | 1333 if ( BYTE3(pFace->uAttributes) & 6 ) |
1294 if ( pIndoor->pFaces[v19].uAttributes & FACE_INDICATE ) | 1334 { |
1335 if ( !pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID | |
1336 || !GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID) ) | |
1295 { | 1337 { |
1296 if ( !pIndoor->pFaceExtras[pIndoor->pFaces[v19].uFaceExtraID].uEventID | 1338 pMouse->uPointingObjectID = 0; |
1297 || !GetEventHintString(pIndoor->pFaceExtras[pIndoor->pFaces[v19].uFaceExtraID].uEventID) ) | 1339 uLastPointedObjectID = 1; |
1298 { | |
1299 pMouse->uPointingObjectID = 0; | |
1300 pFooterString[0] = 0; | |
1301 bForceDrawFooter = 1; | |
1302 uLastPointedObjectID = 0; | |
1303 return; | |
1304 } | |
1305 GameUI_SetFooterString(GetEventHintString(pIndoor->pFaceExtras[pIndoor->pFaces[v19].uFaceExtraID].uEventID)); | |
1306 if ( pMouse->uPointingObjectID == 0 ) | 1340 if ( pMouse->uPointingObjectID == 0 ) |
1307 { | 1341 { |
1308 if ( uLastPointedObjectID != 0 ) | 1342 if ( uLastPointedObjectID != 0 ) |
1309 { | 1343 { |
1310 pFooterString[0] = 0; | 1344 pFooterString[0] = 0; |
1312 } | 1346 } |
1313 } | 1347 } |
1314 uLastPointedObjectID = pMouse->uPointingObjectID; | 1348 uLastPointedObjectID = pMouse->uPointingObjectID; |
1315 return; | 1349 return; |
1316 } | 1350 } |
1351 GameUI_SetFooterString(GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID)); | |
1352 if ( pMouse->uPointingObjectID == 0 ) | |
1353 { | |
1354 if ( uLastPointedObjectID != 0 ) | |
1355 { | |
1356 pFooterString[0] = 0; | |
1357 bForceDrawFooter = 1; | |
1358 } | |
1359 } | |
1360 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1361 return; | |
1317 } | 1362 } |
1318 } | 1363 } |
1319 pMouse->uPointingObjectID = 0; | 1364 pMouse->uPointingObjectID = 0; |
1320 pFooterString[0] = 0; | 1365 uLastPointedObjectID = 1; |
1321 bForceDrawFooter = 1; | 1366 if ( pMouse->uPointingObjectID == 0 ) |
1322 uLastPointedObjectID = 0; | 1367 { |
1368 if ( uLastPointedObjectID != 0 ) | |
1369 { | |
1370 pFooterString[0] = 0; | |
1371 bForceDrawFooter = 1; | |
1372 } | |
1373 } | |
1374 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1323 return; | 1375 return; |
1324 } | 1376 } |
1325 if (PID_TYPE(v18) == OBJECT_Actor && HIWORD(v18) < monster_info_distance_limit ) | 1377 else if ( PID_TYPE(v18) == OBJECT_Actor ) |
1326 { | 1378 { |
1379 if ( v18 >= 0x2000000u ) | |
1380 { | |
1381 pMouse->uPointingObjectID = 0; | |
1382 if ( pMouse->uPointingObjectID == 0 ) | |
1383 { | |
1384 if ( uLastPointedObjectID != 0 ) | |
1385 { | |
1386 pFooterString[0] = 0; | |
1387 bForceDrawFooter = 1; | |
1388 } | |
1389 } | |
1390 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1391 return; | |
1392 } | |
1327 if ( pActors[v19].dword_000334_unique_name ) | 1393 if ( pActors[v19].dword_000334_unique_name ) |
1328 pText = pMonsterStats->pPlaceStrings[pActors[v19].dword_000334_unique_name]; | 1394 pText = pMonsterStats->pPlaceStrings[pActors[v19].dword_000334_unique_name]; |
1329 else | 1395 else |
1330 pText = pMonsterStats->pInfos[pActors[v19].pMonsterInfo.uID].pName; | 1396 pText = pMonsterStats->pInfos[pActors[v19].pMonsterInfo.uID].pName; |
1331 strncpy(pTmpBuf.data(), pText, 2000); | 1397 GameUI_SetFooterString(pText); |
1332 GameUI_SetFooterString(pTmpBuf.data()); | 1398 if ( pMouse->uPointingObjectID == 0 ) |
1333 } | 1399 { |
1400 if ( uLastPointedObjectID != 0 ) | |
1401 { | |
1402 pFooterString[0] = 0; | |
1403 bForceDrawFooter = 1; | |
1404 } | |
1405 } | |
1406 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1407 return; | |
1408 } | |
1409 pMouse->uPointingObjectID = 0; | |
1334 if ( pMouse->uPointingObjectID == 0 ) | 1410 if ( pMouse->uPointingObjectID == 0 ) |
1335 { | 1411 { |
1336 if ( uLastPointedObjectID != 0 ) | 1412 if ( uLastPointedObjectID != 0 ) |
1337 { | 1413 { |
1338 pFooterString[0] = 0; | 1414 pFooterString[0] = 0; |
1340 } | 1416 } |
1341 } | 1417 } |
1342 uLastPointedObjectID = pMouse->uPointingObjectID; | 1418 uLastPointedObjectID = pMouse->uPointingObjectID; |
1343 return; | 1419 return; |
1344 } | 1420 } |
1345 //окно(область) ящика------------------------------------------- | 1421 } |
1346 if ( pCurrentScreen == SCREEN_CHEST ) | 1422 else |
1347 { | 1423 { |
1348 Chest::ChestUI_WritePointedObjectStatusString(); | 1424 for (v1 = uNumVisibleWindows; v1 > 0; --v1) |
1349 if ( pMouse->uPointingObjectID == 0 ) | |
1350 { | |
1351 if ( uLastPointedObjectID != 0 ) | |
1352 { | |
1353 pFooterString[0] = 0; | |
1354 bForceDrawFooter = 1; | |
1355 } | |
1356 } | |
1357 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1358 return; | |
1359 } | |
1360 //окно(область) магазина----------------------------------------- | |
1361 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1362 { | |
1363 v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1364 if ( v16 != 0 && v16 != -65536 ) | |
1365 { | |
1366 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) | |
1367 { | |
1368 pItemGen = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v16-1]; | |
1369 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1370 uLastPointedObjectID = 1; | |
1371 } | |
1372 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) | |
1373 { | |
1374 pItemGen = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v16-1]; | |
1375 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1376 uLastPointedObjectID = 1; | |
1377 } | |
1378 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL ) | |
1379 { | |
1380 pItemGen = &pPlayers[uActiveCharacter]->pInventoryItemList[v16-1]; | |
1381 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1382 uLastPointedObjectID = 1; | |
1383 } | |
1384 } | |
1385 if ( pMouse->uPointingObjectID == 0 ) | |
1386 { | |
1387 if ( uLastPointedObjectID != 0 ) | |
1388 { | |
1389 pFooterString[0] = 0; | |
1390 bForceDrawFooter = 1; | |
1391 } | |
1392 } | |
1393 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1394 return; | |
1395 } | |
1396 //----------------------------------------- | |
1397 for ( v1 = uNumVisibleWindows; v1 >= 0; --v1 ) // some other fullscreen ui | |
1398 { | 1425 { |
1399 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; | 1426 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; |
1400 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ | 1427 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ |
1401 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) | 1428 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) |
1402 { | 1429 { |
1403 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | 1430 for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) |
1404 { | 1431 { |
1405 if ( !pButton ) | |
1406 break; | |
1407 switch ( pButton->uButtonType ) | 1432 switch ( pButton->uButtonType ) |
1408 { | 1433 { |
1409 case 1://for dialogue window | |
1410 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | |
1411 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | |
1412 { | |
1413 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1414 if ( pMessageType1 ) | |
1415 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1416 GameUI_SetFooterString(pButton->pButtonName); | |
1417 uLastPointedObjectID = 1; | |
1418 return; | |
1419 } | |
1420 break; | |
1421 case 2: | |
1422 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1423 && pY >= pButton->uY && pY <= pButton->uW ) | |
1424 { | |
1425 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1426 if ( pMessageType1 ) | |
1427 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1428 GameUI_SetFooterString(pButton->pButtonName); | |
1429 uLastPointedObjectID = 1; | |
1430 return; | |
1431 } | |
1432 break; | |
1433 case 3:// click on skill | |
1434 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1435 && pY >= pButton->uY && pY <= pButton->uW ) | |
1436 { | |
1437 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | |
1438 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) | |
1439 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | |
1440 else | |
1441 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" | |
1442 GameUI_SetFooterString(Str1); | |
1443 uLastPointedObjectID = 1; | |
1444 return; | |
1445 } | |
1446 break; | |
1447 } | |
1448 } | |
1449 } | |
1450 } | |
1451 }//конец пределов основного экрана------------------------ | |
1452 if ( pX > 467 && pX <= window->GetWidth() - 1 && pY <= window->GetHeight() - 1 )//пределы правой области | |
1453 { | |
1454 if ( pCurrentScreen == SCREEN_GAME ) | |
1455 { | |
1456 pWindow = &pWindowList[0]; | |
1457 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ | |
1458 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
1459 { | |
1460 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | |
1461 { | |
1462 if ( !pButton ) | |
1463 break; | |
1464 switch ( pButton->uButtonType ) | |
1465 { | |
1466 case 1://for dialogue window | |
1467 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | |
1468 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | |
1469 { | |
1470 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1471 if ( pMessageType1 ) | |
1472 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1473 GameUI_SetFooterString(pButton->pButtonName); | |
1474 uLastPointedObjectID = 1; | |
1475 return; | |
1476 } | |
1477 break; | |
1478 case 2: | |
1479 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1480 && pY >= pButton->uY && pY <= pButton->uW ) | |
1481 { | |
1482 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1483 if ( pMessageType1 ) | |
1484 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1485 GameUI_SetFooterString(pButton->pButtonName); | |
1486 uLastPointedObjectID = 1; | |
1487 return; | |
1488 } | |
1489 break; | |
1490 case 3:// click on skill | |
1491 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1492 && pY >= pButton->uY && pY <= pButton->uW ) | |
1493 { | |
1494 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | |
1495 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) | |
1496 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | |
1497 else | |
1498 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" | |
1499 GameUI_SetFooterString(Str1); | |
1500 uLastPointedObjectID = 1; | |
1501 return; | |
1502 } | |
1503 break; | |
1504 } | |
1505 } | |
1506 } | |
1507 } | |
1508 else | |
1509 { | |
1510 for ( v1 = uNumVisibleWindows; v1 > 0; --v1 ) | |
1511 { | |
1512 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; | |
1513 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ | |
1514 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
1515 { | |
1516 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | |
1517 { | |
1518 if ( !pButton ) | |
1519 break; | |
1520 switch ( pButton->uButtonType ) | |
1521 { | |
1522 case 1://for dialogue window | |
1523 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | |
1524 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | |
1525 { | |
1526 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1527 if ( pMessageType1 ) | |
1528 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1529 GameUI_SetFooterString(pButton->pButtonName); | |
1530 uLastPointedObjectID = 1; | |
1531 return; | |
1532 } | |
1533 break; | |
1534 case 2: | |
1535 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1536 && pY >= pButton->uY && pY <= pButton->uW ) | |
1537 { | |
1538 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1539 if ( pMessageType1 ) | |
1540 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1541 GameUI_SetFooterString(pButton->pButtonName); | |
1542 uLastPointedObjectID = 1; | |
1543 return; | |
1544 } | |
1545 break; | |
1546 case 3:// click on skill | |
1547 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1548 && pY >= pButton->uY && pY <= pButton->uW ) | |
1549 { | |
1550 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | |
1551 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) | |
1552 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | |
1553 else | |
1554 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" | |
1555 GameUI_SetFooterString(Str1); | |
1556 uLastPointedObjectID = 1; | |
1557 return; | |
1558 } | |
1559 break; | |
1560 } | |
1561 } | |
1562 } | |
1563 } | |
1564 } | |
1565 } | |
1566 if ( pX <= 467 && pY > 351 && pY <= 479 )//пределы нижней области | |
1567 { | |
1568 pWindow = &pWindowList[0]; | |
1569 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ | |
1570 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
1571 { | |
1572 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | |
1573 { | |
1574 if ( !pButton ) | |
1575 break; | |
1576 switch ( pButton->uButtonType ) | |
1577 { | |
1578 case 1://for dialogue window | 1434 case 1://for dialogue window |
1579 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | 1435 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ |
1580 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | 1436 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) |
1581 { | 1437 { |
1582 pMessageType1 = (UIMessageType)pButton->field_1C; | 1438 pMessageType1 = (UIMessageType)pButton->field_1C; |
1585 GameUI_SetFooterString(pButton->pButtonName); | 1441 GameUI_SetFooterString(pButton->pButtonName); |
1586 uLastPointedObjectID = 1; | 1442 uLastPointedObjectID = 1; |
1587 return; | 1443 return; |
1588 } | 1444 } |
1589 break; | 1445 break; |
1590 case 2: | 1446 case 2://hovering over portraits |
1447 if (pButton->uWidth != 0 && pButton->uHeight != 0) | |
1448 { | |
1449 uint distW = pX - pButton->uX; | |
1450 uint distY = pY - pButton->uY; | |
1451 | |
1452 double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); | |
1453 double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); | |
1454 | |
1455 if (ratioX + ratioY < 1.0) | |
1456 { | |
1457 pMessageType2 = (UIMessageType)pButton->field_1C; | |
1458 if ( pMessageType2 != 0 ) | |
1459 pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0); | |
1460 GameUI_SetFooterString(pButton->pButtonName); // for character name | |
1461 uLastPointedObjectID = 1; | |
1462 return; | |
1463 } | |
1464 } | |
1465 break; | |
1466 case 3:// click on skill | |
1591 if ( pX >= pButton->uX && pX <= pButton->uZ | 1467 if ( pX >= pButton->uX && pX <= pButton->uZ |
1592 && pY >= pButton->uY && pY <= pButton->uW ) | 1468 && pY >= pButton->uY && pY <= pButton->uW ) |
1593 { | 1469 { |
1594 pMessageType1 = (UIMessageType)pButton->field_1C; | 1470 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; |
1595 if ( pMessageType1 ) | 1471 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) |
1596 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | 1472 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" |
1597 GameUI_SetFooterString(pButton->pButtonName); | 1473 else |
1474 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" | |
1475 GameUI_SetFooterString(Str1); | |
1598 uLastPointedObjectID = 1; | 1476 uLastPointedObjectID = 1; |
1599 return; | 1477 return; |
1600 } | 1478 } |
1601 break; | 1479 break; |
1602 case 3:// click on skill | 1480 } |
1603 if ( pX >= pButton->uX && pX <= pButton->uZ | 1481 } |
1604 && pY >= pButton->uY && pY <= pButton->uW ) | 1482 } |
1605 { | 1483 if ( pWindow->uFrameHeight == 480 ) |
1606 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | 1484 { |
1607 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) | 1485 //DebugBreak(); //Why is this condition here (in the original too)? Might check fullscreen windows. Let Silvo know if you find out |
1608 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | 1486 return; |
1609 else | 1487 } |
1610 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" | 1488 } |
1611 GameUI_SetFooterString(Str1); | 1489 //The game never gets to this point even in the original. It's also bugged(neither branch displays anything). |
1612 uLastPointedObjectID = 1; | 1490 //TODO fix these and move them up before the window check loop. |
1613 return; | 1491 if ( pCurrentScreen == SCREEN_CHEST ) |
1614 } | 1492 { |
1615 break; | 1493 Chest::ChestUI_WritePointedObjectStatusString(); |
1616 } | 1494 if ( pMouse->uPointingObjectID == 0 ) |
1495 { | |
1496 if ( uLastPointedObjectID != 0 ) | |
1497 { | |
1498 pFooterString[0] = 0; | |
1499 bForceDrawFooter = 1; | |
1500 } | |
1501 } | |
1502 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1503 return; | |
1504 } | |
1505 else if ( pCurrentScreen == SCREEN_HOUSE ) | |
1506 { | |
1507 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD | |
1508 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) | |
1509 || v16 == -65536 ) | |
1510 { | |
1511 if ( pMouse->uPointingObjectID == 0 ) | |
1512 { | |
1513 if ( uLastPointedObjectID != 0 ) | |
1514 { | |
1515 pFooterString[0] = 0; | |
1516 bForceDrawFooter = 1; | |
1517 } | |
1518 } | |
1519 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1520 return; | |
1521 } | |
1522 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); | |
1523 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1524 uLastPointedObjectID = 1; | |
1525 if ( pMouse->uPointingObjectID == 0 ) | |
1526 { | |
1527 if ( uLastPointedObjectID != 0 ) | |
1528 { | |
1529 pFooterString[0] = 0; | |
1530 bForceDrawFooter = 1; | |
1531 } | |
1532 } | |
1533 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1534 return; | |
1535 } | |
1536 if ( pY < 350 ) | |
1537 { | |
1538 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1539 if ( v14 == 0 || v14 == -65536 || v14 >= 5000 ) | |
1540 { | |
1541 if ( pMouse->uPointingObjectID == 0 ) | |
1542 { | |
1543 if ( uLastPointedObjectID != 0 ) | |
1544 { | |
1545 pFooterString[0] = 0; | |
1546 bForceDrawFooter = 1; | |
1547 } | |
1548 } | |
1549 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1550 return; | |
1551 } | |
1552 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; | |
1553 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1554 uLastPointedObjectID = 1; | |
1555 if ( pMouse->uPointingObjectID == 0 ) | |
1556 { | |
1557 if ( uLastPointedObjectID != 0 ) | |
1558 { | |
1559 pFooterString[0] = 0; | |
1560 bForceDrawFooter = 1; | |
1561 } | |
1562 } | |
1563 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1564 return; | |
1565 } | |
1566 } | |
1567 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ | |
1568 && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) | |
1569 { | |
1570 for ( pButton = pWindowList[0].pControlsHead; pButton != nullptr; pButton = pButton->pNext ) | |
1571 { | |
1572 switch (pButton->uButtonType) | |
1573 { | |
1574 case 1: | |
1575 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | |
1576 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | |
1577 { | |
1578 pMessageType3 = (UIMessageType)pButton->field_1C; | |
1579 if ( pMessageType3 == 0 ) // For books | |
1580 { | |
1581 GameUI_SetFooterString(pButton->pButtonName); | |
1582 uLastPointedObjectID = 1; | |
1583 return; | |
1584 } | |
1585 pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0); | |
1586 uLastPointedObjectID = 1; | |
1587 return; | |
1588 } | |
1589 break; | |
1590 case 2://hovering over portraits | |
1591 if (pButton->uWidth != 0 && pButton->uHeight != 0) | |
1592 { | |
1593 uint distW = pX - pButton->uX; | |
1594 uint distY = pY - pButton->uY; | |
1595 | |
1596 double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); | |
1597 double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); | |
1598 | |
1599 if (ratioX + ratioY < 1.0) | |
1600 { | |
1601 pMessageType2 = (UIMessageType)pButton->field_1C; | |
1602 if ( pMessageType2 != 0 ) | |
1603 pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0); | |
1604 GameUI_SetFooterString(pButton->pButtonName); // for character name | |
1605 uLastPointedObjectID = 1; | |
1606 return; | |
1607 } | |
1608 } | |
1609 break; | |
1610 case 3: | |
1611 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1612 && pY >= pButton->uY && pY <= pButton->uW ) | |
1613 { | |
1614 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | |
1615 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) | |
1616 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | |
1617 else | |
1618 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" | |
1619 GameUI_SetFooterString(Str1); | |
1620 uLastPointedObjectID = 1; | |
1621 return; | |
1622 } | |
1623 break; | |
1617 } | 1624 } |
1618 } | 1625 } |
1619 } | 1626 } |
1620 //pMouse->uPointingObjectID = sub_46A99B(); //for software | 1627 //pMouse->uPointingObjectID = sub_46A99B(); //for software |
1621 if ( pMouse->uPointingObjectID == 0 ) | 1628 if ( pMouse->uPointingObjectID == 0 ) |