Mercurial > mm7
diff mm7_5.cpp @ 1449:27b7ee003c7c
Merge
author | Gloval |
---|---|
date | Tue, 06 Aug 2013 00:56:33 +0400 |
parents | 5a5d0c713d47 8b4f4c723edd |
children | 8ff3c675a726 |
line wrap: on
line diff
--- a/mm7_5.cpp Tue Aug 06 00:52:46 2013 +0400 +++ b/mm7_5.cpp Tue Aug 06 00:56:33 2013 +0400 @@ -16,7 +16,6 @@ #include "Mouse.h" #include "Keyboard.h" #include "GammaControl.h" -#include "stru11.h" #include "mm7_data.h" #include "FactionTable.h" #include "Vis.h" @@ -113,10 +112,10 @@ int v56; // edx@432 int v57; // eax@432 Player *pPlayer; // edx@442 - unsigned int v59; // eax@445 + unsigned int pMapNum; // eax@445 signed int v60; // ST64_4@459 - NPCData *pNPCData2; // eax@467 - unsigned __int64 v62; // kr00_8@467 + //NPCData *pNPCData2; // eax@467 + //unsigned __int64 v62; // kr00_8@467 __int16 v63; // dx@479 unsigned int v64; // eax@486 int v65; // ecx@486 @@ -206,7 +205,7 @@ int v155; // [sp-4h] [bp-600h]@165 int v156; // [sp-4h] [bp-600h]@204 //const char *v157; // [sp-4h] [bp-600h]@444 - unsigned int v158; // [sp-4h] [bp-600h]@449 + //unsigned int v158; // [sp-4h] [bp-600h]@449 //__int16 v159; // [sp-4h] [bp-600h]@550 int v160; // [sp-4h] [bp-600h]@599 const char *v161; // [sp-4h] [bp-600h]@637 @@ -233,7 +232,7 @@ signed int thisb; // [sp+14h] [bp-5E8h]@272 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 - char *thise; // [sp+14h] [bp-5E8h]@445 + char *pMapName; // [sp+14h] [bp-5E8h]@445 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 int thisg; // [sp+14h] [bp-5E8h]@467 int thish; // [sp+14h] [bp-5E8h]@528 @@ -260,7 +259,7 @@ POINT v209; // [sp+78h] [bp-584h]@777 POINT v210; // [sp+80h] [bp-57Ch]@397 POINT v211; // [sp+88h] [bp-574h]@704 - __int64 v212; // [sp+90h] [bp-56Ch]@467 + //__int64 v212; // [sp+90h] [bp-56Ch]@467 int v213; // [sp+98h] [bp-564h]@385 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 char pOut[32]; // [sp+BCh] [bp-540h]@370 @@ -391,7 +390,7 @@ if ( dword_6BE138 == 124 || uMessageParam ) { pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); @@ -409,7 +408,7 @@ continue; case UIMSG_Game_OpenLoadGameDialog: pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); @@ -420,7 +419,7 @@ if ( dword_6BE138 == 132 || uMessageParam ) { pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); @@ -441,7 +440,7 @@ case UIMSG_80: __debugbreak(); pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_OPTIONS; pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); @@ -995,7 +994,7 @@ { if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) { - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1021,7 +1020,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; } } @@ -1032,7 +1031,7 @@ switch ( pCurrentScreen ) { case SCREEN_CASTING: - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( some_active_character ) { uActiveCharacter = some_active_character; @@ -1075,7 +1074,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; case SCREEN_BOOKS: pBooksWindow->Release(); @@ -1107,11 +1106,11 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; case SCREEN_SAVEGAME: case SCREEN_LOADGAME: - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); //crt_deconstruct_ptr_6A0118(); stru_506E40.Release(); break; @@ -1121,7 +1120,7 @@ case SCREEN_CHEST: pWindow2 = pChestWindow; pWindow2->Release(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; pEventTimer->Resume(); @@ -1130,7 +1129,7 @@ __debugbreak(); pWindow2 = ptr_507BC8; pWindow2->Release(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; pEventTimer->Resume(); @@ -1168,9 +1167,9 @@ break; case SCREEN_MENU: pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); stru_506E40.Release(); break; case SCREEN_VIDEO_OPTIONS: @@ -1246,7 +1245,7 @@ case SCREEN_REST://close rest screen if ( dword_506F14 ) { - Rest(_506F18_num_hours_to_sleep); + Rest(_506F18_num_minutes_to_sleep); pParty->pPlayers[3].pConditions[2] = 0i64; pParty->pPlayers[2].pConditions[2] = 0i64; pParty->pPlayers[1].pConditions[2] = 0i64; @@ -1257,8 +1256,8 @@ pTexture_RestUI_CurrentHourglassFrame = 0; pTexture_RestUI_CurrentSkyFrame = 0; pIcons_LOD->SyncLoadedFilesCount(); - pIcons_LOD->_4114F2(); - _506F18_num_hours_to_sleep = 0; + pIcons_LOD->RemoveTexturesPackFromTextureList(); + _506F18_num_minutes_to_sleep = 0; dword_506F14 = 0; dword_507B94 = 1; if ( pGUIWindow_Settings ) @@ -1286,13 +1285,13 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; case SCREEN_E: __debugbreak(); pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_HOUSE; - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); continue; case SCREEN_HOUSE: if ( uDialogueType ) @@ -1307,7 +1306,7 @@ if ( sub_4BD8B5() ) continue; } - sub_4B1D27(); + GetHouseGoodbyeSpeech(); pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); pVideoPlayer->Unload(); pGUIWindow_CurrentMenu = window_SpeakInHouse; @@ -1336,7 +1335,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = true; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; case SCREEN_INPUT_BLV://click escape if ( uCurrentHouse_Animation == 153 ) @@ -1394,7 +1393,7 @@ case SCREEN_CHARACTERS: CharacterUI_ReleaseButtons(); sub_419379(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1420,7 +1419,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = true; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; default: if ( pGUIWindow_Settings ) @@ -1448,7 +1447,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; } if ( pGUIWindow_Settings ) @@ -1476,12 +1475,12 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = true; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; } CharacterUI_ReleaseButtons(); sub_419379(); - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); } if ( pGUIWindow_Settings ) { @@ -1508,7 +1507,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = true; - pIcons_LOD->_4355F7(); + pIcons_LOD->RemoveTexturesFromTextureList(); continue; } if ( !pGUIWindow_Settings )//Draw Menu @@ -1667,7 +1666,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; dword_50CDC8 = 1; sub_42FBDD(); - pNPCData4 = (NPCData *)GetTravelTime(); + //pNPCData4 = (NPCData *)GetTravelTime(); strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); if ( bUnderwater != 1 && pParty->bFlying || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) @@ -1696,11 +1695,11 @@ ++pGameLoadingUI_ProgressBar->uProgressMax; SaveGame(1, 0); pGameLoadingUI_ProgressBar->Progress(); - RestAndHeal(1440 * (signed int)pNPCData4); + RestAndHeal(1440 * (signed int)GetTravelTime()); if ( pParty->uNumFoodRations ) { pParty->RestAndHeal(); - if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 ) + if ( ((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0 ) { pPlayer7 = pParty->pPlayers; do @@ -1711,7 +1710,7 @@ while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); ++pParty->days_played_without_rest; } - Party::TakeFood((unsigned int)pNPCData4); + Party::TakeFood((unsigned int)GetTravelTime()); } else { @@ -1965,26 +1964,25 @@ uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; if ( bRecallingBeacon ) { - if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) ) + if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) ) continue; - v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName; + v173 = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" GameUI_SetFooterString(pTmpBuf.data()); continue; } - v59 = pMapStats->GetMapInfo(pCurrentMapName.data()); - thise = "Not in Map Stats"; - if ( v59 ) - thise = pMapStats->pInfos[v59].pName; - if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) || !v59 ) + pMapNum = pMapStats->GetMapInfo(pCurrentMapName.data()); + pMapName = "Not in Map Stats"; + if ( pMapNum ) + pMapName = pMapStats->pInfos[pMapNum].pName; + if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum ) { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s" + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s" GameUI_SetFooterString(pTmpBuf.data()); continue; } v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; - v158 = (unsigned int)thise; - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s" GameUI_SetFooterString(pTmpBuf.data()); continue; case UIMSG_CloseAfterInstallBeacon: @@ -1999,8 +1997,7 @@ continue; case UIMSG_InstallBeacon: pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; - pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam]; - if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon ) + if ( !pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon ) continue; byte_506360 = 1; pPlayer9->CanCastSpell(uRequiredMana); @@ -2018,38 +2015,30 @@ pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); if ( bRecallingBeacon ) { - if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) + if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) { SaveGame(1, 0); OnMapLeave(); - strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); + strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); dword_6BE364_game_settings_1 |= 1; uGameState = GAME_STATE_2; - _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; - _5B65AC_npcdata_fame_or_other = pNPCData4->fame; - _5B65B0_npcdata_rep_or_other = pNPCData4->rep; - _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); - _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); + _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; + _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; + _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; + _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; + _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; dword_5B65C0 = 1; } else { - pParty->vPosition.x = pNPCData4->uFlags; - pParty->vPosition.y = pNPCData4->fame; - pParty->vPosition.z = pNPCData4->rep; + pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; + pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; + pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; pParty->uFallStartY = pParty->vPosition.z; - pParty->sRotationY = LOWORD(pNPCData4->Location2D); - pParty->sRotationX = HIWORD(pNPCData4->Location2D); + pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; + pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; } pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - //crt_deconstruct_ptr_6A0118(); pBooksWindow->Release(); pGUIWindow_CurrentMenu->Release(); pBooksWindow = 0; @@ -2060,28 +2049,19 @@ sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); SaveScreenshot(a1); LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); - v212 = qword_506350 << 7; - pNPCData2 = pNPCData4; - thisg = 0; - v62 = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); - pNPCData4->pName = (char *)v62; - pNPCData2->uPortraitID = HIDWORD(v62); - pNPCData2->uFlags = pParty->vPosition.x; - pNPCData2->fame = pParty->vPosition.y; - pNPCData2->rep = pParty->vPosition.z; - LOWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationY); - HIWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationX); + pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); + pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x; + pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y; + pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z; + pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY); + pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) continue; - uAction = 0; - while ( _stricmp((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName.data()) ) + for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) { - ++thisg; - uAction += 32; - if ( thisg >= (signed int)pGames_LOD->uNumSubDirs / 2 ) - continue; + if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName.data()) ) + pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; } - HIWORD(pNPCData4->uProfession) = thisg; } continue; case UIMSG_ClickTownInTP: @@ -2199,6 +2179,7 @@ default: if ( uMessageParam != 5 ) { + __debugbreak(); // warning C4700: uninitialized local variable 'v200' used sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); GameUI_SetFooterString(pTmpBuf.data()); continue; @@ -2265,7 +2246,7 @@ GameUI_SetFooterString(pTmpBuf.data()); continue; case UIMSG_ShowFinalWindow: - sprintf(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." + sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment." pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." ModalWindow(pFinalMessage.data(), 196); @@ -2464,7 +2445,7 @@ GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" dword_506F14 = 1; - _506F18_num_hours_to_sleep = 5; + _506F18_num_minutes_to_sleep = 5; continue; case UIMSG_Wait1Hour: if ( dword_506F14 == 2 ) @@ -2476,15 +2457,15 @@ GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" dword_506F14 = 1; - _506F18_num_hours_to_sleep = 60; + _506F18_num_minutes_to_sleep = 60; continue; case UIMSG_RentRoom: dword_506F14 = 2; RestUI_Load(); v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; - _506F18_num_hours_to_sleep = v86; - if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) - _506F18_num_hours_to_sleep = v86 + 720; + _506F18_num_minutes_to_sleep = v86; + if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) // 107 = Emerald Isle tavern + _506F18_num_minutes_to_sleep = v86 + 12 * 60; dword_506F14 = 2; pParty->RestAndHeal(); pParty->days_played_without_rest = 0; @@ -2569,7 +2550,7 @@ pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); else pNPCData4 = (NPCData *)1; - if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) + if ( !_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4) ) pNPCData4 = 0; if ( pNPCData4 ) { @@ -2578,7 +2559,7 @@ HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; v95 = rand(); Rest(v95 % 6 + 60); - _506F18_num_hours_to_sleep = 0; + _506F18_num_minutes_to_sleep = 0; dword_506F14 = 0; /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -2594,7 +2575,7 @@ } } Party::TakeFood(uRestUI_FoodRequiredToRest); - _506F18_num_hours_to_sleep = 480; + _506F18_num_minutes_to_sleep = 480; dword_506F14 = 2; pParty->RestAndHeal(); pParty->days_played_without_rest = 0; @@ -2615,7 +2596,7 @@ (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" v97 = _494820_training_time(pParty->uCurrentHour); dword_506F14 = 1; - _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; + _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute; continue; case UIMSG_HintSelectRemoveQuickSpellBtn: if ( quick_spell_at_page && byte_506550 ) @@ -2667,7 +2648,7 @@ } v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; pPlayers[uActiveCharacter]->uQuickSpell = v99; - stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); + stru_AA1058[uActiveCharacter - 1]._494836(v99, uActiveCharacter); if ( uActiveCharacter ) pPlayer10->PlaySound(SPEECH_12, 0); byte_506550 = 0; @@ -2713,7 +2694,7 @@ if ( uAction >= (signed int)pNPCData4 ) uAction = 0; } - sub_41140B(); + OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); pGUIWindow_CurrentMenu->OpenSpellBook(); v127 = rand() % 2 + 204; @@ -2722,7 +2703,7 @@ case UIMSG_OpenSpellbookPage: if ( pTurnEngine->turn_stage == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) continue; - sub_41140B(); + OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; pGUIWindow_CurrentMenu->OpenSpellBook(); v127 = rand() % 2 + 204; @@ -2746,7 +2727,7 @@ pEventTimer->Resume(); viewparams->bRedrawGameUI = 1; pCurrentScreen = SCREEN_GAME; - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; /*if ( dword_50C9E8 < 40 ) { @@ -2862,9 +2843,9 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); continue; case UIMSG_ClickAwardScrollBar: - dword_50651C = 1; + books_page_number = 1; if ( pMouse->GetCursorPos(&v211)->y > 178 ) - dword_50651C = -1; + books_page_number = -1; continue; case UIMSG_ClickAwardsUpBtn: GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); @@ -3017,8 +2998,8 @@ continue; case UIMSG_ShowStatus_Funds: v174 = (char *)pParty->uNumGoldInBank; - v158 = pParty->uNumGold + pParty->uNumGoldInBank; - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank" + //v158 = pParty->uNumGold + pParty->uNumGoldInBank; + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank" GameUI_SetFooterString(pTmpBuf.data()); continue; case UIMSG_ShowStatus_DateTime: @@ -3435,7 +3416,7 @@ case UIMSG_ChangeGameState: uGameState = GAME_FINISHED; break; - case UIMSG_11: + case UIMSG_ChangeCursor: pMouse->SetCursorBitmap("MICON2"); break; case UIMSG_3A: @@ -3548,7 +3529,7 @@ } if ( pCurrentScreen == SCREEN_LOADGAME ) { - pIcons_LOD->_4114F2(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); //crt_deconstruct_ptr_6A0118(); pTexture_PCX.Release(); pTexture_PCX.Load("title.pcx", 0); @@ -3583,6 +3564,7 @@ break; case UIMSG_PlayerCreationRemoveDownSkill: uPlayerCreationUI_SelectedCharacter = pParam; + __debugbreak(); pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) @@ -3599,13 +3581,10 @@ //----- (00436427) -------------------------------------------------------- double __cdecl get_shading_dist_mist() { - double result; // st7@2 - - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - result = (double)pOutdoorCamera->shading_dist_mist; + if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) + return (double)pOutdoorCamera->shading_dist_mist; else - result = 16192.0; - return result; + return 16192.0; } //----- (0043648F) -------------------------------------------------------- @@ -3626,444 +3605,8 @@ this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; } -//----- (00438526) -------------------------------------------------------- -stru11::stru11() -{ - stru11 *v1; // esi@1 - signed int v2; // eax@1 - char *v3; // edx@1 - - v1 = this; - v2 = 0; - this->cpuid_00000000_eax_numops = 0; - this->cpuid_00000001_eax = 0; - this->cpuid_00000001_edx = 0; - this->field_38 = 0; - this->field_3C = 0; - this->cpuid_80000000_edx = 0; - this->cpuid_80000001_eax = 0; - this->cpuid_80000001_edx = 0; - this->cpuid_80000005_ebx = 0; - this->cpuid_80000005_ecx = 0; - this->cpuid_80000005_edx = 0; - this->cpuid_80000006_ecx = 0; - this->field_AC = 0; - this->uProcessorManufacturer = 0; - LOBYTE(this->cpuid_80000002_registers2[0]) = 0; - v3 = (char *)&this->cpuid_00000002_eax; - do - { - if ( v2 < 3 ) - *((int *)v3 - 9) = 0; - if ( v2 < 4 ) - *(int *)v3 = 0; - if ( v2 < 12 ) - *((int *)v3 + 17) = 0; - if ( v2 < 13 ) - this->pCPUString[v2] = 0; - if ( v2 < 30 ) - *((char *)this->field_40 + v2) = 0; - *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0; - v3 += 4; - } - while ( v2 < 48 ); - CheckCPU(); -} - -//----- (004385B5) -------------------------------------------------------- -void stru11::CheckCPU() -{ - LOG_DECOMPILATION_WARNING(); - /* - int v5; // [sp-4h] [bp-10h]@0 - signed int v6; // [sp+4h] [bp-8h]@1 - signed int v7; // [sp+8h] [bp-4h]@1 - - _CF = 0; - _OF = 0; - _ZF = 1; - _SF = 0; - v7 = 0; - __asm { pushf } - v6 = 3; - if ( v5 != (v5 ^ 0x40000) ) - { - __asm { popf } - v6 = 4; - __asm { pushf } - if ( v5 != (v5 ^ 0x200000) ) - { - v7 = 1; - v6 = 0; - } - } - if ( v6 == 3 ) - { - this->field_AC = 1; - } - else - { - if ( v6 == 4 ) - { - this->field_AC = 2; - } - else - { - if ( v7 ) - { - this->field_AC = 2; - RunCPUID(); - } - else - { - this->field_AC = 0; - } - } - }*/ -} - -//----- (00438659) -------------------------------------------------------- -void stru11::RunCPUID() -{ - __debugbreak(); - /*stru11 *v6; // esi@1 - unsigned int uNumOps; // edi@1 - int uNumExtOps; // edi@16 - char pCyrixString[16]; // [sp+Ch] [bp-60h]@1 - char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1 - char pAMDString[16]; // [sp+2Ch] [bp-40h]@1 - char pIntelString[16]; // [sp+3Ch] [bp-30h]@1 - char pCPUString[16]; // [sp+4Ch] [bp-20h]@1 - stru11 *thisa; // [sp+5Ch] [bp-10h]@1 - char *v35; // [sp+60h] [bp-Ch]@1 - int v36; // [sp+64h] [bp-8h]@1 - int v37; // [sp+68h] [bp-4h]@1 - - thisa = this; - *(int *)pIntelString = *(int *)"GenuineIntel"; - *(int *)&pIntelString[4] = *(int *)"ineIntel"; - *(int *)&pIntelString[8] = *(int *)"ntel"; - pIntelString[12] = aGenuineintel[12]; - *(int *)pAMDString = *(int *)"AuthenticAMD"; - *(int *)&pAMDString[4] = *(int *)"enticAMD"; - *(int *)&pAMDString[8] = *(int *)"cAMD"; - pAMDString[12] = aAuthenticamd[12]; - *(int *)pCyrixString = *(int *)"CyrixInstead"; - *(int *)&pCyrixString[4] = *(int *)"xInstead"; - *(int *)&pCyrixString[8] = *(int *)"tead"; - pCyrixString[12] = aCyrixinstead[12]; - *(int *)pCentaurString = *(int *)"CentaurHauls"; - *(int *)&pCentaurString[4] = *(int *)"aurHauls"; - *(int *)&pCentaurString[8] = *(int *)"auls"; - v37 = 0; - v36 = 0; - pCentaurString[12] = aCentaurhauls[12]; - v35 = pCPUString; - pCPUString[12] = 0; - _EAX = 0; - __asm { cpuid } - v37 = _EAX; - *(int *)pCPUString = _EBX; - *(int *)&pCPUString[4] = _EDX; - *(int *)&pCPUString[8] = _ECX; - v6 = thisa; - uNumOps = _EAX; - thisa->cpuid_00000000_ebx_vendorstr1 = _EBX; - v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4]; - v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8]; - v6->cpuid_00000000_eax_numops = _EAX; - strcpy(v6->pCPUString, pCPUString); - if ( strcmp(pIntelString, pCPUString) ) - { - if ( strcmp(pAMDString, pCPUString) ) - { - if ( strcmp(pCyrixString, pCPUString) ) - { - if ( strcmp(pCentaurString, pCPUString) ) - v6->uProcessorManufacturer = 0; - else - v6->uProcessorManufacturer = 4; - } - else - { - v6->uProcessorManufacturer = 3; - } - } - else - { - v6->uProcessorManufacturer = 2; - } - } - else - { - v6->uProcessorManufacturer = 1; - } - if ( uNumOps >= 1 ) - RunCPUID_op1(); - if ( uNumOps >= 2 ) - RunCPUID_op2(); - _EAX = 0x80000000u; - __asm { cpuid } - if ( !(_EAX & 0x80000000) ) - _EAX = 0x80000000u; - v36 = _EAX; - v6->cpuid_80000000_edx = _EAX; - uNumExtOps = _EAX ^ 0x80000000; - if ( (_EAX ^ 0x80000000u) >= 1 ) - { - _EAX = 0x80000001u; - __asm { cpuid } - thisa = (stru11 *)_EAX; - v35 = (char *)_EDX; - v6->cpuid_80000001_eax = _EAX; - v6->cpuid_80000001_edx = (int)v35; - } - if ( (unsigned int)uNumExtOps >= 4 ) - RunCPUID_ext2_3_4(); - if ( (unsigned int)uNumExtOps >= 5 ) - { - _EAX = 0x80000005u; - __asm { cpuid } - thisa = (stru11 *)_EBX; - v35 = (char *)_ECX; - v36 = _EDX; - v6->cpuid_80000005_ebx = _EBX; - v6->cpuid_80000005_ecx = (int)v35; - v6->cpuid_80000005_edx = v36; - } - if ( (unsigned int)uNumExtOps >= 6 ) - { - _EAX = 0x80000006u; - __asm { cpuid } - v6->cpuid_80000006_ecx = _ECX; - }*/ -} - -//----- (00438821) -------------------------------------------------------- -void stru11::RunCPUID_op1() -{ - __debugbreak(); - /*stru11 *v1; // esi@1 - unsigned int v7; // ecx@1 - int v8; // eax@3 - int v9; // eax@10 - signed int v10; // eax@11 - int v11; // ecx@11 - int v12; // eax@15 - signed int v13; // eax@19 - int v14; // ecx@19 - signed int v15; // eax@25 - int v16; // ecx@25 - signed int v17; // eax@34 - int v18; // ecx@34 - - v1 = this; - _EAX = 1; - __asm { cpuid } - v7 = _EAX; - v1->cpuid_00000001_edx = _EDX; - v1->cpuid_00000001_eax = _EAX; - if ( (_EAX & 0x3000) == 8192 ) - { - LOBYTE(v1->cpuid_80000002_registers2[0]) = 1; - v7 = 0; - } - v8 = (v7 >> 8) & 0xF; - switch ( v8 ) - { - case 4: - v1->field_AC = 2; - break; - case 5: - v1->field_AC = 15; - break; - case 6: - v1->field_AC = 36; - break; - default: - v1->field_AC = 49; - break; - } - v9 = v1->uProcessorManufacturer; - if ( v9 == 1 ) - { - v10 = 0; - v11 = v7 & 0x3FF0; - while ( v11 != dword_4E4948[2 * v10] ) - { - ++v10; - if ( v10 >= 17 ) - return; - } - v12 = dword_4E494C[2 * v10]; - goto LABEL_39; - } - if ( v9 == 2 ) - { - if ( (v7 & 0xF00) == dword_4E49D0[0] ) - { - v12 = dword_4E49D4[0]; - } - else - { - v13 = 1; - v14 = v7 & 0x3FF0; - while ( v14 != dword_4E49D0[2 * v13] ) - { - ++v13; - if ( v13 >= 9 ) - return; - } - v12 = dword_4E49D4[2 * v13]; - } - goto LABEL_39; - } - if ( v9 != 3 ) - { - if ( v9 != 4 ) - return; - v17 = 0; - v18 = v7 & 0x3FF0; - while ( v18 != dword_4E4A40[2 * v17] ) - { - ++v17; - if ( v17 >= 2 ) - return; - } - v12 = dword_4E4A44[2 * v17]; - goto LABEL_39; - } - v15 = 1; - v16 = v7 & 0x3FF0; - while ( v16 != dword_4E4A18[2 * v15] ) - { - ++v15; - if ( v15 >= 5 ) - goto LABEL_30; - } - v1->field_AC = dword_4E4A1C[2 * v15]; -LABEL_30: - v12 = 24; - if ( v1->field_AC == 24 ) - { - if ( _EDX != 1 ) - v12 = (((_EDX != 261) - 1) & 0xA) + 15; -LABEL_39: - v1->field_AC = v12; - }*/ -} - -//----- (00438992) -------------------------------------------------------- -void stru11::RunCPUID_op2() -{ - __debugbreak(); - /* - stru11 *v1; // edi@1 - int v7; // eax@1 - signed int v8; // ecx@2 - unsigned __int8 v9; // al@3 - signed int v10; // ecx@14 - unsigned __int8 v11; // al@15 - int v12; // [sp+Ch] [bp-14h]@1 - int v13; // [sp+10h] [bp-10h]@1 - int v14; // [sp+14h] [bp-Ch]@1 - int v15; // [sp+18h] [bp-8h]@1 - int *v16; // [sp+1Ch] [bp-4h]@1 - - v1 = this; - v16 = &v12; - _EAX = 2; - __asm { cpuid } - v12 = _EAX; - v13 = _EBX; - v14 = _ECX; - v15 = _EDX; - v1->cpuid_00000002_eax = _EAX; - v1->cpuid_00000002_ebx = v13; - v1->cpuid_00000002_ecx = v14; - v1->cpuid_00000002_edx = v15; - v7 = v1->field_AC; - if ( v7 == 40 ) - { - v8 = 0; - while ( 1 ) - { - v9 = *((char *)&v12 + v8); - if ( v9 == 64 ) - { - v1->field_AC = 43; - return; - } - if ( v9 >= 0x41u && v9 <= 0x43u ) - { - v1->field_AC = 41; - return; - } - if ( v9 >= 0x44u && v9 <= 0x45u ) - break; - ++v8; - if ( v8 >= 16 ) - return; - } - v1->field_AC = 42; - } - else - { - if ( v7 == 45 ) - { - v10 = 0; - while ( 1 ) - { - v11 = *((char *)&v12 + v10); - if ( v11 >= 0x40u && v11 <= 0x43u ) - { - v1->field_AC = 46; - return; - } - if ( v11 >= 0x44u && v11 <= 0x45u ) - break; - ++v10; - if ( v10 >= 16 ) - return; - } - v1->field_AC = 47; - } - }*/ -} - -//----- (00438A67) -------------------------------------------------------- -void stru11::RunCPUID_ext2_3_4() -{ - __debugbreak(); - /*stru11 *v1; // edi@1 - stru11 *v17; // eax@1 - int v18[3][4]; // [sp+Ch] [bp-38h]@1 - stru11 *v19; // [sp+3Ch] [bp-8h]@1 - - v1 = this; - v19 = this; - _EAX = 0x80000002u; - __asm { cpuid } - v18[0][0] = _EAX; - *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX); - v18[0][3] = _EDX; - _EAX = 0x80000003u; - __asm { cpuid } - v18[1][0] = _EAX; - *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX); - v18[1][3] = _EDX; - _EAX = 0x80000004u; - __asm { cpuid } - v18[2][0] = _EAX; - *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX); - v18[2][3] = _EDX; - v17 = v19; - memcpy(v1->cpuid_80000002_registers, v18, 0x30u); - memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/ -} - //----- (00438F8F) -------------------------------------------------------- -void __cdecl area_of_effect__damage_evaluate() +void area_of_effect__damage_evaluate() { int v0; // edx@1 char *v1; // esi@2 @@ -4295,7 +3838,7 @@ //----- (0043A97E) -------------------------------------------------------- void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) { - if ( PID_TYPE(a2) == OBJECT_BLVDoor) + if (PID_TYPE(a2) == OBJECT_BLVDoor) { layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; @@ -4552,13 +4095,6 @@ } } -// A750D8: using guessed type __int64 qword_A750D8; - - -// A750D8: using guessed type __int64 qword_A750D8; - - -// A750D8: using guessed type __int64 qword_A750D8; //----- (0043F515) -------------------------------------------------------- void FindBillboardsLightLevels_BLV() @@ -5157,7 +4693,7 @@ v19 = 0; v29 = 0; if ( v17 <= 0 ) - goto LABEL_29; + return 0; do { if ( a3a >= 2 ) @@ -5192,7 +4728,6 @@ while ( v29 < v28 ); result = 1; if ( a3a != 1 ) -LABEL_29: result = 0; return result; } @@ -5292,7 +4827,7 @@ v25 = 0; v16 = dword_4F5B24_ys[1] >= a3; if ( v15 <= 0 ) - goto LABEL_29; + return 0; do { if ( a5a >= 2 ) @@ -5327,7 +4862,6 @@ while ( v25 < v15 ); result = 1; if ( a5a != 1 ) -LABEL_29: result = 0; return result; } @@ -5353,12 +4887,6 @@ return result; } -//----- (0040DEDB) -------------------------------------------------------- -unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) -{ - return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); -} - //----- (0040DEF3) -------------------------------------------------------- unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) { @@ -5617,7 +5145,7 @@ if ( pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE ) { LABEL_116: - GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); + GameUI_DrawItemInfo(&v0->pInventoryItemList[v10]); return; } if ( (signed int)pParty->pPickedItem.uItemID < 200 @@ -5634,7 +5162,7 @@ && pParty->pPickedItem.uItemID != 263 && pParty->pPickedItem.uItemID != 233 ) goto LABEL_116; - v27 = &v0->pInventoryItems[pOut.z]; + v27 = &v0->pInventoryItemList[pOut.z]; v28 = v27->uItemID; v51 = pItemsTable->pItems[v27->uItemID].uEquipType; v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); @@ -5644,14 +5172,22 @@ { v35 = v27->uAttributes; if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } LOWORD(v35) = v35 | 0x210; v27->uAttributes = v35; } else { if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) { v27->UpdateTempBonus(pParty->uTimePlayed); @@ -5662,7 +5198,11 @@ || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v33 >= 500 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; a2.y = (int)v29 << 7; v31 = (double)(signed int)((int)v29 << 7); @@ -5678,7 +5218,11 @@ || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v30 >= 500 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } a2.y = (int)v29 << 7; v27->uSpecEnchantmentType = 40; v31 = (double)a2.y; @@ -5691,7 +5235,9 @@ v27->uAttributes = v32; } _50C9A8_item_enchantment_timer = 256; - goto LABEL_92; + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; } v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; if ( v36 < 0.0 ) @@ -5705,7 +5251,9 @@ v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); v27->uMaxCharges = v37; v27->uNumCharges = (unsigned __int8)v37; - goto LABEL_92; + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; } v14 = v13 - 222; v15 = pParty->pPickedItem.uItemID - 222; @@ -5774,7 +5322,7 @@ LABEL_54: pOut.y = 0; pOut.x = v10 + 1; - v17 = (int)v0->pInventoryIndices; + v17 = (int)v0->pInventoryMatrix; while ( *(int *)v17 != pOut.x ) { ++pOut.y; @@ -5836,9 +5384,9 @@ // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; v20 = v47 + 50 * v15; - v0->pInventoryItems[pOut.z].uItemID = v51; - v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + v0->pInventoryItems[pOut.z].uEnchantmentType) + v0->pInventoryItemList[pOut.z].uItemID = v51; + v0->pInventoryItemList[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + v0->pInventoryItemList[pOut.z].uEnchantmentType) / 2; v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: @@ -5846,9 +5394,16 @@ if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } v0->PlaySound(SPEECH_16, 0); - goto LABEL_91; + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; } if ( v45 ) { @@ -5887,10 +5442,8 @@ if ( v0->CanAct() ) v0->PlaySound(SPEECH_17, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); -LABEL_91: dword_4E455C = 0; } -LABEL_92: pMouse->RemoveHoldingItem(); dword_50CDCC = 1; return; @@ -5903,28 +5456,28 @@ case 0xCAu: case 0xCBu: case 0xCCu: - v0->pInventoryItems[pOut.z].uItemID = 222; + v0->pInventoryItemList[pOut.z].uItemID = 222; break; case 0xCDu: case 0xCEu: case 0xCFu: case 0xD0u: case 0xD1u: - v0->pInventoryItems[pOut.z].uItemID = 223; + v0->pInventoryItemList[pOut.z].uItemID = 223; break; case 0xD2u: case 0xD3u: case 0xD4u: case 0xD5u: case 0xD6u: - v0->pInventoryItems[pOut.z].uItemID = 224; + v0->pInventoryItemList[pOut.z].uItemID = 224; break; case 0xD7u: case 0xD8u: case 0xD9u: case 0xDAu: case 0xDBu: - v0->pInventoryItems[pOut.z].uItemID = 221; + v0->pInventoryItemList[pOut.z].uItemID = 221; break; default: break; @@ -5938,79 +5491,47 @@ } } -//----- (004179BC) -------------------------------------------------------- -void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 ) - { - const char *v2; // ebx@1 - const char *v3; // edi@1 - unsigned int v4; // eax@1 - GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 - POINT v6; // [sp+60h] [bp-8h]@1 - - v2 = a2; - v3 = a1; - memset(&Dst, 0, 0x54u); - Dst.uFrameWidth = 384; - Dst.uFrameHeight = 256; - Dst.uFrameX = 128; - Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; - Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; - Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; - Dst.DrawMessageBox(0); - Dst.uFrameX += 12; - Dst.uFrameWidth -= 24; - Dst.uFrameY += 12; - Dst.uFrameHeight -= 12; - Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; - Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; - v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf.data(), format_4E2D80, v4, v3); - Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); - Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); -} - //----- (00417AD4) -------------------------------------------------------- unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) -{ - int v8; // eax@10 - int v12; // eax@14 - unsigned int yellow; // [sp+Ch] [bp-Ch]@1 - unsigned int red; // [sp+10h] [bp-8h]@1 - unsigned int white; // [sp+14h] [bp-4h]@1 - - white = TargetColor(0xFFu, 0xFFu, 0xFFu); - red = TargetColor(0xFFu, 0, 0); - yellow = TargetColor(0xFFu, 0xFFu, 0); - if ( !(uPlayerClass % 4) ) +{ + switch (uPlayerClass % 4) { - if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) - return white; - if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level - && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level ) + case 0: { - v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType]; - if ( v12 < skill_level ) - return red; + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) + return ui_character_skillinfo_can_learn; + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level && + byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) + { + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level) + return ui_character_skillinfo_cant_learn; + } + return ui_character_skillinfo_can_learn_gm; } - return yellow; - } - if ( (uPlayerClass % 4) == 1 ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) - return white; - if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level ) + break; + + case 1: { - v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType]; - if ( v8 < skill_level) - return red; + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) + return ui_character_skillinfo_can_learn; + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level) + { + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) + return ui_character_skillinfo_cant_learn; + } + return ui_character_skillinfo_can_learn_gm; } - return yellow; + break; + + case 2: + case 3: + { + if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level) + return ui_character_skillinfo_cant_learn; + return ui_character_skillinfo_can_learn; + } + break; } - if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level ) - return red; - } - return white; + assert(false); + return 0; } \ No newline at end of file