comparison UI/UiGame.cpp @ 2398:79e750ba00b9

some polishing on GameUI_WritePointedObjectStatusString
author Grumpy7
date Thu, 10 Jul 2014 01:34:57 +0200
parents eff78dab2142
children aad4f31aa297
comparison
equal deleted inserted replaced
2397:eff78dab2142 2398:79e750ba00b9
1145 } 1145 }
1146 // 5C35BC: using guessed type int bForceDrawFooter; 1146 // 5C35BC: using guessed type int bForceDrawFooter;
1147 //----- (00420EFF) -------------------------------------------------------- 1147 //----- (00420EFF) --------------------------------------------------------
1148 void GameUI_WritePointedObjectStatusString() 1148 void GameUI_WritePointedObjectStatusString()
1149 { 1149 {
1150 int v1; // ebx@6
1151 GUIWindow *pWindow; // edi@7 1150 GUIWindow *pWindow; // edi@7
1152 GUIButton *pButton; // ecx@11 1151 GUIButton *pButton; // ecx@11
1153 int v7; // ecx@19 1152 int requiredSkillpoints; // ecx@19
1154 enum UIMessageType pMessageType1; // esi@24 1153 enum UIMessageType pMessageType1; // esi@24
1155 int v14; // eax@41 1154 int v14; // eax@41
1156 ItemGen *pItemGen; // ecx@44 1155 ItemGen *pItemGen; // ecx@44
1157 int v16; // ecx@46 1156 int v16; // ecx@46
1158 signed int v18; // eax@55 1157 signed int pickedObjectPID; // eax@55
1159 signed int v18b; 1158 signed int v18b;
1160 signed int v19; // ecx@63 1159 signed int pickedObjectID; // ecx@63
1161 BLVFace *pFace; // eax@69 1160 BLVFace *pFace; // eax@69
1162 const char *pText; // ecx@79 1161 const char *pText; // ecx@79
1163 char *v28; // esi@82
1164 enum UIMessageType pMessageType2; // esi@110 1162 enum UIMessageType pMessageType2; // esi@110
1165 enum UIMessageType pMessageType3; // edx@117 1163 enum UIMessageType pMessageType3; // edx@117
1166 char Str1[200]; // [sp+Ch] [bp-D4h]@129 1164 char Str1[200]; // [sp+Ch] [bp-D4h]@129
1167 unsigned int pX; // [sp+D4h] [bp-Ch]@1 1165 unsigned int pX; // [sp+D4h] [bp-Ch]@1
1168 unsigned int pY; // [sp+D8h] [bp-8h]@1 1166 unsigned int pY; // [sp+D8h] [bp-8h]@1
1169 unsigned int v45; // [sp+DCh] [bp-4h]@21
1170 1167
1171 int interaction_distance_limit = 512; 1168 int interaction_distance_limit = 512;
1172 1169
1173 pMouse->uPointingObjectID = 0; 1170 pMouse->uPointingObjectID = 0;
1174 pMouse->GetClickPos(&pX, &pY); 1171 pMouse->GetClickPos(&pX, &pY);
1175 if ( pX < 0 || pX > 639 || pY < 0 || pY > 479 ) 1172 if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 )
1176 return; 1173 return;
1177 if ( pCurrentScreen == SCREEN_GAME ) 1174 if ( pCurrentScreen == SCREEN_GAME )
1178 { 1175 {
1179 if ( pX <= 467 && pY <= 351 ) 1176 if ( pX <= (window->GetWidth() - 1) * 0.73125 && pY <= (window->GetHeight() - 1) * 0.73125 )
1180 { 1177 {
1181 //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 1178 //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01
1182 { 1179 {
1183 v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); 1180 pickedObjectPID = pGame->pVisInstance->get_picked_object_zbuf_val();
1184 if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X 1181 if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X
1185 || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y ) 1182 || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y )
1186 v18 = -1; 1183 pickedObjectPID = -1;
1187 if ( v18 == -1 ) 1184 if ( pickedObjectPID == -1 )
1185 {
1186 if ( uLastPointedObjectID != 0 )
1187 {
1188 pFooterString[0] = 0;
1189 bForceDrawFooter = 1;
1190 }
1191 uLastPointedObjectID = 0;
1192 return;
1193 }
1194 }
1195 /*else
1196 {
1197 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
1198 }*/
1199 pMouse->uPointingObjectID = (unsigned __int16)pickedObjectPID;
1200 pickedObjectID = (signed)PID_ID(pickedObjectPID);
1201 if ( PID_TYPE(pickedObjectPID) == OBJECT_Item )
1202 {
1203 if ( pObjectList->pObjects[pSpriteObjects[pickedObjectID].uObjectDescID].uFlags & 0x10 )
1188 { 1204 {
1189 pMouse->uPointingObjectID = 0; 1205 pMouse->uPointingObjectID = 0;
1190 if ( pMouse->uPointingObjectID == 0 ) 1206 if ( uLastPointedObjectID != 0 )
1191 { 1207 {
1192 if ( uLastPointedObjectID != 0 ) 1208 pFooterString[0] = 0;
1209 bForceDrawFooter = 1;
1210 }
1211 uLastPointedObjectID = 0;
1212 return;
1213 }
1214 if ( pickedObjectPID >= 0x2000000u || pParty->pPickedItem.uItemID )
1215 {
1216 GameUI_SetFooterString(pSpriteObjects[pickedObjectID].stru_24.GetDisplayName());
1217 }
1218 else
1219 {
1220 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[pickedObjectID].stru_24.GetDisplayName());// "Get %s"
1221 GameUI_SetFooterString(pTmpBuf.data());
1222 } //intentional fallthrough
1223 }
1224 else if ( PID_TYPE(pickedObjectPID) == OBJECT_Decoration )
1225 {
1226 if ( !pLevelDecorations[pickedObjectID].uEventID )
1227 {
1228 if ( pLevelDecorations[pickedObjectID].IsInteractive() )
1229 pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[pickedObjectID]._idx_in_stru123 - 75] + 379].pTopic;//неверно для костра
1230 else
1231 pText = pDecorationList->pDecorations[pLevelDecorations[pickedObjectID].uDecorationDescID].field_20;
1232 GameUI_SetFooterString(pText);
1233 }
1234 else
1235 {
1236 char* hintString = GetEventHintString(pLevelDecorations[pickedObjectID].uEventID);
1237 if ( hintString != '\0' )
1238 {
1239 GameUI_SetFooterString(hintString);
1240 }
1241 } //intentional fallthrough
1242 }
1243 else if ( PID_TYPE(pickedObjectPID) == OBJECT_BModel )
1244 {
1245 if ( pickedObjectPID < 0x2000000u )
1246 {
1247 char* newString = nullptr;
1248 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )
1249 {
1250 v18b = (signed int)(unsigned __int16)pickedObjectPID >> 9;
1251 short triggeredId = pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID;
1252 if (triggeredId != 0)
1253 {
1254 newString = GetEventHintString(pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID);
1255 }
1256 }
1257 else
1258 {
1259 pFace = &pIndoor->pFaces[pickedObjectID];
1260 if ( BYTE3(pFace->uAttributes) & 6 )
1261 {
1262 unsigned short eventId = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
1263 if (eventId != 0)
1264 {
1265 newString = GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID);
1266 }
1267 }
1268 }
1269 if (newString)
1270 {
1271 if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0)
1193 { 1272 {
1194 pFooterString[0] = 0; 1273 pFooterString[0] = 0;
1195 bForceDrawFooter = 1; 1274 bForceDrawFooter = 1;
1196 } 1275 }
1197 } 1276 uLastPointedObjectID = pMouse->uPointingObjectID;
1198 uLastPointedObjectID = pMouse->uPointingObjectID; 1277 return;
1199 return; 1278 }
1200 } 1279 }
1201 } 1280 pMouse->uPointingObjectID = 0;
1202 /*else 1281 pFooterString[0] = 0;
1203 { 1282 bForceDrawFooter = 1;
1204 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; 1283 uLastPointedObjectID = 0;
1205 }*/ 1284 return;
1206 pMouse->uPointingObjectID = (unsigned __int16)v18; 1285 }
1207 v19 = (signed)PID_ID(v18); 1286 else if ( PID_TYPE(pickedObjectPID) == OBJECT_Actor )
1208 if ( PID_TYPE(v18) == OBJECT_Item ) 1287 {
1209 { 1288 if ( pickedObjectPID >= 0x2000000u )
1210 if ( pObjectList->pObjects[pSpriteObjects[v19].uObjectDescID].uFlags & 0x10 )
1211 { 1289 {
1212 pMouse->uPointingObjectID = 0; 1290 pMouse->uPointingObjectID = 0;
1213 uLastPointedObjectID = 1;
1214 if ( pMouse->uPointingObjectID == 0 )
1215 {
1216 if ( uLastPointedObjectID != 0 )
1217 {
1218 pFooterString[0] = 0;
1219 bForceDrawFooter = 1;
1220 }
1221 }
1222 uLastPointedObjectID = pMouse->uPointingObjectID;
1223 return;
1224 }
1225 if ( v18 >= 0x2000000u || pParty->pPickedItem.uItemID )
1226 {
1227 GameUI_SetFooterString(pSpriteObjects[v19].stru_24.GetDisplayName());
1228 if ( pMouse->uPointingObjectID == 0 )
1229 {
1230 if ( uLastPointedObjectID != 0 )
1231 {
1232 pFooterString[0] = 0;
1233 bForceDrawFooter = 1;
1234 }
1235 }
1236 uLastPointedObjectID = pMouse->uPointingObjectID;
1237 return;
1238 }
1239 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[v19].stru_24.GetDisplayName());// "Get %s"
1240 GameUI_SetFooterString(pTmpBuf.data());
1241 if ( pMouse->uPointingObjectID == 0 )
1242 {
1243 if ( uLastPointedObjectID != 0 ) 1291 if ( uLastPointedObjectID != 0 )
1244 { 1292 {
1245 pFooterString[0] = 0; 1293 pFooterString[0] = 0;
1246 bForceDrawFooter = 1; 1294 bForceDrawFooter = 1;
1247 } 1295 }
1248 } 1296 uLastPointedObjectID = 0;
1249 uLastPointedObjectID = pMouse->uPointingObjectID;
1250 return;
1251 }
1252 else if ( PID_TYPE(v18) == OBJECT_Decoration )
1253 {
1254 if ( !pLevelDecorations[v19].uEventID )
1255 {
1256 if ( pLevelDecorations[v19].IsInteractive() )
1257 pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//неверно для костра
1258 else
1259 pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20;
1260 GameUI_SetFooterString(pText);
1261 if ( pMouse->uPointingObjectID == 0 )
1262 {
1263 if ( uLastPointedObjectID != 0 )
1264 {
1265 pFooterString[0] = 0;
1266 bForceDrawFooter = 1;
1267 }
1268 }
1269 uLastPointedObjectID = pMouse->uPointingObjectID;
1270 return; 1297 return;
1271 } 1298 }
1272 if ( !GetEventHintString(pLevelDecorations[v19].uEventID) ) 1299 if ( pActors[pickedObjectID].dword_000334_unique_name )
1273 { 1300 pText = pMonsterStats->pPlaceStrings[pActors[pickedObjectID].dword_000334_unique_name];
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));
1286 if ( pMouse->uPointingObjectID == 0 )
1287 {
1288 if ( uLastPointedObjectID != 0 )
1289 {
1290 pFooterString[0] = 0;
1291 bForceDrawFooter = 1;
1292 }
1293 }
1294 uLastPointedObjectID = pMouse->uPointingObjectID;
1295 return;
1296 }
1297 else if ( PID_TYPE(v18) == OBJECT_BModel )
1298 {
1299 if ( v18 < 0x2000000u )
1300 {
1301 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )
1302 {
1303 v18b = (signed int)(unsigned __int16)v18 >> 9;
1304 if ( !pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID
1305 || !GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID) )
1306 {
1307 pMouse->uPointingObjectID = 0;
1308 uLastPointedObjectID = 1;
1309 if ( pMouse->uPointingObjectID == 0 )
1310 {
1311 if ( uLastPointedObjectID != 0 )
1312 {
1313 pFooterString[0] = 0;
1314 bForceDrawFooter = 1;
1315 }
1316 }
1317 uLastPointedObjectID = pMouse->uPointingObjectID;
1318 return;
1319 }
1320 GameUI_SetFooterString(GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID));
1321 if ( pMouse->uPointingObjectID == 0 )
1322 {
1323 if ( uLastPointedObjectID != 0 )
1324 {
1325 pFooterString[0] = 0;
1326 bForceDrawFooter = 1;
1327 }
1328 }
1329 uLastPointedObjectID = pMouse->uPointingObjectID;
1330 return;
1331 }
1332 pFace = &pIndoor->pFaces[v19];
1333 if ( BYTE3(pFace->uAttributes) & 6 )
1334 {
1335 if ( !pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID
1336 || !GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID) )
1337 {
1338 pMouse->uPointingObjectID = 0;
1339 uLastPointedObjectID = 1;
1340 if ( pMouse->uPointingObjectID == 0 )
1341 {
1342 if ( uLastPointedObjectID != 0 )
1343 {
1344 pFooterString[0] = 0;
1345 bForceDrawFooter = 1;
1346 }
1347 }
1348 uLastPointedObjectID = pMouse->uPointingObjectID;
1349 return;
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;
1362 }
1363 }
1364 pMouse->uPointingObjectID = 0;
1365 uLastPointedObjectID = 1;
1366 if ( pMouse->uPointingObjectID == 0 )
1367 {
1368 if ( uLastPointedObjectID != 0 )
1369 {
1370 pFooterString[0] = 0;
1371 bForceDrawFooter = 1;
1372 }
1373 }
1374 uLastPointedObjectID = pMouse->uPointingObjectID;
1375 return;
1376 }
1377 else if ( PID_TYPE(v18) == OBJECT_Actor )
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 }
1393 if ( pActors[v19].dword_000334_unique_name )
1394 pText = pMonsterStats->pPlaceStrings[pActors[v19].dword_000334_unique_name];
1395 else 1301 else
1396 pText = pMonsterStats->pInfos[pActors[v19].pMonsterInfo.uID].pName; 1302 pText = pMonsterStats->pInfos[pActors[pickedObjectID].pMonsterInfo.uID].pName;
1397 GameUI_SetFooterString(pText); 1303 GameUI_SetFooterString(pText); //intentional fallthrough
1398 if ( pMouse->uPointingObjectID == 0 ) 1304 }
1399 { 1305 if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0)
1400 if ( uLastPointedObjectID != 0 ) 1306 {
1401 { 1307 pFooterString[0] = 0;
1402 pFooterString[0] = 0; 1308 bForceDrawFooter = 1;
1403 bForceDrawFooter = 1;
1404 }
1405 }
1406 uLastPointedObjectID = pMouse->uPointingObjectID;
1407 return;
1408 }
1409 pMouse->uPointingObjectID = 0;
1410 if ( pMouse->uPointingObjectID == 0 )
1411 {
1412 if ( uLastPointedObjectID != 0 )
1413 {
1414 pFooterString[0] = 0;
1415 bForceDrawFooter = 1;
1416 }
1417 } 1309 }
1418 uLastPointedObjectID = pMouse->uPointingObjectID; 1310 uLastPointedObjectID = pMouse->uPointingObjectID;
1419 return; 1311 return;
1420 } 1312 }
1421 } 1313 }
1422 else 1314 else
1423 { 1315 {
1424 for (v1 = uNumVisibleWindows; v1 > 0; --v1) 1316 for (int i = uNumVisibleWindows; i > 0; --i)
1425 { 1317 {
1426 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; 1318 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
1427 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ 1319 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ
1428 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) 1320 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW )
1429 { 1321 {
1430 for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) 1322 for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext )
1431 { 1323 {
1465 break; 1357 break;
1466 case 3:// click on skill 1358 case 3:// click on skill
1467 if ( pX >= pButton->uX && pX <= pButton->uZ 1359 if ( pX >= pButton->uX && pX <= pButton->uZ
1468 && pY >= pButton->uY && pY <= pButton->uW ) 1360 && pY >= pButton->uY && pY <= pButton->uW )
1469 { 1361 {
1470 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; 1362 requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
1471 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) 1363 if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints )
1472 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" 1364 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here"
1473 else 1365 else
1474 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" 1366 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points"
1475 GameUI_SetFooterString(Str1); 1367 GameUI_SetFooterString(Str1);
1476 uLastPointedObjectID = 1; 1368 uLastPointedObjectID = 1;
1477 return; 1369 return;
1478 } 1370 }
1479 break; 1371 break;
1489 //The game never gets to this point even in the original. It's also bugged(neither branch displays anything). 1381 //The game never gets to this point even in the original. It's also bugged(neither branch displays anything).
1490 //TODO fix these and move them up before the window check loop. 1382 //TODO fix these and move them up before the window check loop.
1491 if ( pCurrentScreen == SCREEN_CHEST ) 1383 if ( pCurrentScreen == SCREEN_CHEST )
1492 { 1384 {
1493 Chest::ChestUI_WritePointedObjectStatusString(); 1385 Chest::ChestUI_WritePointedObjectStatusString();
1494 if ( pMouse->uPointingObjectID == 0 ) 1386 if ( uLastPointedObjectID != 0 )
1495 { 1387 {
1496 if ( uLastPointedObjectID != 0 ) 1388 pFooterString[0] = 0;
1497 { 1389 bForceDrawFooter = 1;
1498 pFooterString[0] = 0; 1390 }
1499 bForceDrawFooter = 1; 1391 uLastPointedObjectID = 0;
1500 }
1501 }
1502 uLastPointedObjectID = pMouse->uPointingObjectID;
1503 return; 1392 return;
1504 } 1393 }
1505 else if ( pCurrentScreen == SCREEN_HOUSE ) 1394 else if ( pCurrentScreen == SCREEN_HOUSE )
1506 { 1395 {
1507 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD 1396 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
1508 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) 1397 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0)
1509 || v16 == -65536 ) 1398 || v16 == -65536 )
1510 { 1399 {
1400 if ( uLastPointedObjectID != 0 )
1401 {
1402 pFooterString[0] = 0;
1403 bForceDrawFooter = 1;
1404 }
1405 uLastPointedObjectID = 0;
1406 return;
1407 }
1408 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4);
1409 GameUI_SetFooterString(pItemGen->GetDisplayName());
1410 pFooterString[0] = 0;
1411 bForceDrawFooter = 1;
1412 uLastPointedObjectID = 0;
1413 return;
1414 }
1415 if ( pY < 350 )
1416 {
1417 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
1418 if ( v14 == 0 || v14 == -65536 || v14 >= 5000 )
1419 {
1511 if ( pMouse->uPointingObjectID == 0 ) 1420 if ( pMouse->uPointingObjectID == 0 )
1512 { 1421 {
1513 if ( uLastPointedObjectID != 0 ) 1422 if ( uLastPointedObjectID != 0 )
1514 { 1423 {
1515 pFooterString[0] = 0; 1424 pFooterString[0] = 0;
1517 } 1426 }
1518 } 1427 }
1519 uLastPointedObjectID = pMouse->uPointingObjectID; 1428 uLastPointedObjectID = pMouse->uPointingObjectID;
1520 return; 1429 return;
1521 } 1430 }
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]; 1431 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1];
1553 GameUI_SetFooterString(pItemGen->GetDisplayName()); 1432 GameUI_SetFooterString(pItemGen->GetDisplayName());
1554 uLastPointedObjectID = 1; 1433 pFooterString[0] = 0;
1555 if ( pMouse->uPointingObjectID == 0 ) 1434 bForceDrawFooter = 1;
1556 { 1435 uLastPointedObjectID = 0;
1557 if ( uLastPointedObjectID != 0 )
1558 {
1559 pFooterString[0] = 0;
1560 bForceDrawFooter = 1;
1561 }
1562 }
1563 uLastPointedObjectID = pMouse->uPointingObjectID;
1564 return; 1436 return;
1565 } 1437 }
1566 } 1438 }
1567 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ 1439 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 ) 1440 && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
1577 { 1449 {
1578 pMessageType3 = (UIMessageType)pButton->field_1C; 1450 pMessageType3 = (UIMessageType)pButton->field_1C;
1579 if ( pMessageType3 == 0 ) // For books 1451 if ( pMessageType3 == 0 ) // For books
1580 { 1452 {
1581 GameUI_SetFooterString(pButton->pButtonName); 1453 GameUI_SetFooterString(pButton->pButtonName);
1582 uLastPointedObjectID = 1; 1454 }
1583 return; 1455 else
1584 } 1456 {
1585 pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0); 1457 pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
1458 }
1586 uLastPointedObjectID = 1; 1459 uLastPointedObjectID = 1;
1587 return; 1460 return;
1588 } 1461 }
1589 break; 1462 break;
1590 case 2://hovering over portraits 1463 case 2://hovering over portraits
1609 break; 1482 break;
1610 case 3: 1483 case 3:
1611 if ( pX >= pButton->uX && pX <= pButton->uZ 1484 if ( pX >= pButton->uX && pX <= pButton->uZ
1612 && pY >= pButton->uY && pY <= pButton->uW ) 1485 && pY >= pButton->uY && pY <= pButton->uW )
1613 { 1486 {
1614 v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; 1487 requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
1615 if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) 1488 if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints )
1616 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" 1489 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here"
1617 else 1490 else
1618 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" 1491 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points"
1619 GameUI_SetFooterString(Str1); 1492 GameUI_SetFooterString(Str1);
1620 uLastPointedObjectID = 1; 1493 uLastPointedObjectID = 1;
1621 return; 1494 return;
1622 } 1495 }
1623 break; 1496 break;
1624 } 1497 }
1625 } 1498 }
1626 } 1499 }
1627 //pMouse->uPointingObjectID = sub_46A99B(); //for software 1500 //pMouse->uPointingObjectID = sub_46A99B(); //for software
1628 if ( pMouse->uPointingObjectID == 0 ) 1501 if ( uLastPointedObjectID != 0 )
1629 { 1502 {
1630 if ( uLastPointedObjectID != 0 ) 1503 pFooterString[0] = 0;
1631 { 1504 bForceDrawFooter = 1;
1632 pFooterString[0] = 0; 1505 }
1633 bForceDrawFooter = 1; 1506 uLastPointedObjectID = 0;
1634 }
1635 }
1636 uLastPointedObjectID = pMouse->uPointingObjectID;
1637 return; 1507 return;
1638 } 1508 }
1639 1509
1640 //----- (0044158F) -------------------------------------------------------- 1510 //----- (0044158F) --------------------------------------------------------
1641 void GameUI_DrawCharacterSelectionFrame() 1511 void GameUI_DrawCharacterSelectionFrame()