comparison UI/UiGame.cpp @ 1980:c1c74df0a33e

changing most of auto types to their actual types
author Grumpy7
date Wed, 30 Oct 2013 00:47:37 -0700
parents 211dfe2d8db1
children 5cd26f2c6904
comparison
equal deleted inserted replaced
1979:92dfa0cafbe3 1980:c1c74df0a33e
38 int uTextureID_GameUI_CharSelectionFrame; // 50C98C 38 int uTextureID_GameUI_CharSelectionFrame; // 50C98C
39 39
40 //----- (00421D00) -------------------------------------------------------- 40 //----- (00421D00) --------------------------------------------------------
41 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) 41 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID)
42 { 42 {
43 auto player = &pParty->pPlayers[uPlayerID - 1]; 43 Player* player = &pParty->pPlayers[uPlayerID - 1];
44 if (pParty->pPickedItem.uItemID) 44 if (pParty->pPickedItem.uItemID)
45 { 45 {
46 if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) 46 if (int slot = player->AddItem(-1, pParty->pPickedItem.uItemID))
47 { 47 {
48 memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); 48 memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u);
49 viewparams->bRedrawGameUI = true; 49 viewparams->bRedrawGameUI = true;
50 pMouse->RemoveHoldingItem(); 50 pMouse->RemoveHoldingItem();
51 return; 51 return;
435 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting1; 435 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting1;
436 } 436 }
437 } 437 }
438 else if (pGreetType == 2)//HiredNPC_greet 438 else if (pGreetType == 2)//HiredNPC_greet
439 { 439 {
440 auto prof = pNPCStats->pProfessions + pNPC->uProfession; 440 NPCProfession* prof = &pNPCStats->pProfessions[pNPC->uProfession];
441 441
442 if (pNPC->Hired()) 442 if (pNPC->Hired())
443 pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); 443 pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
444 else 444 else
445 pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); 445 pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
450 // Message window(Окно сообщения)---- 450 // Message window(Окно сообщения)----
451 if (pInString) 451 if (pInString)
452 { 452 {
453 window.uFrameWidth = game_viewport_width; 453 window.uFrameWidth = game_viewport_width;
454 window.uFrameZ = 452; 454 window.uFrameZ = 452;
455 auto font = pFontArrus; 455 GUIFont* font = pFontArrus;
456 pTextHeight = pFontArrus->CalcTextHeight(pInString, &window, 13, 0) + 7; 456 pTextHeight = pFontArrus->CalcTextHeight(pInString, &window, 13, 0) + 7;
457 if ( 352 - pTextHeight < 8 ) 457 if ( 352 - pTextHeight < 8 )
458 { 458 {
459 font = pFontCreate; 459 font = pFontCreate;
460 pTextHeight = pFontCreate->CalcTextHeight(pInString, &window, 13, 0) + 7; 460 pTextHeight = pFontCreate->CalcTextHeight(pInString, &window, 13, 0) + 7;
818 window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0); 818 window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0);
819 819
820 uFramesetIDa = 0; 820 uFramesetIDa = 0;
821 for (uint i = 0; i < 24; ++i) 821 for (uint i = 0; i < 24; ++i)
822 { 822 {
823 auto buff = player->pPlayerBuffs.data() + i; 823 SpellBuff* buff = &player->pPlayerBuffs[i];
824 if (buff->uExpireTime > 0) 824 if (buff->uExpireTime > 0)
825 { 825 {
826 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; 826 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134;
827 window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0); 827 window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0);
828 DrawBuff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic); 828 DrawBuff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic);
848 848
849 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); 849 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
850 pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; 850 pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1;
851 for ( uint i = 0; i < 4; ++i ) 851 for ( uint i = 0; i < 4; ++i )
852 { 852 {
853 auto player = &pParty->pPlayers[i]; 853 Player* player = &pParty->pPlayers[i];
854 pX = 94 * i + 89; 854 pX = 94 * i + 89;
855 if ( i == 0 ) 855 if ( i == 0 )
856 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name 856 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name
857 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0); 857 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0);
858 if ( i == 0 ) 858 if ( i == 0 )
1642 for (uint i = 0; i < 14; ++i) 1642 for (uint i = 0; i < 14; ++i)
1643 { 1643 {
1644 //v2 = byte_4E5DD8[v1]; 1644 //v2 = byte_4E5DD8[v1];
1645 if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) 1645 if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime)
1646 { 1646 {
1647 auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); 1647 Texture* tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]);
1648 //v3 = pTextureIDs_PartyBuffIcons[i]; 1648 //v3 = pTextureIDs_PartyBuffIcons[i];
1649 pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], 1649 pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0],
1650 pPartySpellbuffsUI_XYs[i][1], tex, tex, 1650 pPartySpellbuffsUI_XYs[i][1], tex, tex,
1651 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); 1651 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63);
1652 } 1652 }
1839 unsigned int pColor; 1839 unsigned int pColor;
1840 1840
1841 uCenterX = (uX + uZ) / 2; 1841 uCenterX = (uX + uZ) / 2;
1842 uCenterY = (uY + uW) / 2; 1842 uCenterY = (uY + uW) / 2;
1843 lPitch = pRenderer->uTargetSurfacePitch; 1843 lPitch = pRenderer->uTargetSurfacePitch;
1844 auto bWizardEyeActive = pParty->WizardEyeActive(); 1844 bool bWizardEyeActive = pParty->WizardEyeActive();
1845 auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); 1845 int uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel();
1846 if ( CheckHiredNPCSpeciality(Cartographer) ) 1846 if ( CheckHiredNPCSpeciality(Cartographer) )
1847 { 1847 {
1848 bWizardEyeActive = true; 1848 bWizardEyeActive = true;
1849 uWizardEyeSkillLevel = 2; 1849 uWizardEyeSkillLevel = 2;
1850 } 1850 }
1858 uHeight = uW - uY; 1858 uHeight = uW - uY;
1859 uWidth = uZ - uX; 1859 uWidth = uZ - uX;
1860 1860
1861 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 1861 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
1862 { 1862 {
1863 auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; 1863 uchar* pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
1864 auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; 1864 ushort* pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
1865 v73 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / (signed int)uZoom; 1865 v73 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / (signed int)uZoom;
1866 v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); 1866 v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
1867 uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); 1867 uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
1868 switch (uZoom) 1868 switch (uZoom)
1869 { 1869 {
1896 if (pMapLod0 && bRedrawOdmMinimap) 1896 if (pMapLod0 && bRedrawOdmMinimap)
1897 { 1897 {
1898 assert(uWidth == 137 && uHeight == 117); 1898 assert(uWidth == 137 && uHeight == 117);
1899 //auto pMinimap = (unsigned __int16 *)pOdmMinimap; 1899 //auto pMinimap = (unsigned __int16 *)pOdmMinimap;
1900 1900
1901 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 1901 ushort mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
1902 1902
1903 v29 = v70 >> 16; 1903 v29 = v70 >> 16;
1904 for (int y = 0; y < uHeight; ++y) 1904 for (int y = 0; y < uHeight; ++y)
1905 { 1905 {
1906 auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; 1906 uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth];
1907 for (int x = 0; x < uWidth; ++x) 1907 for (int x = 0; x < uWidth; ++x)
1908 { 1908 {
1909 //*pMinimap++ = pPal[pMapLod0Line[v29]]; 1909 //*pMinimap++ = pPal[pMapLod0Line[v29]];
1910 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; 1910 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]];
1911 v29 = (v70 + x * v73) >> 16; 1911 v29 = (v70 + x * v73) >> 16;
1932 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); 1932 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF);
1933 uNumBlueFacesInBLVMinimap = 0; 1933 uNumBlueFacesInBLVMinimap = 0;
1934 1934
1935 for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i) 1935 for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i)
1936 { 1936 {
1937 auto pOutline = &pIndoor->pMapOutlines->pOutlines[i]; 1937 BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[i];
1938 auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID; 1938 BLVFace* pFace1 = pIndoor->pFaces + pOutline->uFace1ID;
1939 auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID; 1939 BLVFace* pFace2 = pIndoor->pFaces + pOutline->uFace2ID;
1940 //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; 1940 //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes;
1941 //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; 1941 //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes;
1942 if (pFace1->Visible() && pFace2->Visible()) 1942 if (pFace1->Visible() && pFace2->Visible())
1943 { 1943 {
1944 if ( pOutline->uFlags & 1 ) 1944 if ( pOutline->uFlags & 1 )
1961 if (uNumBlueFacesInBLVMinimap < 49) 1961 if (uNumBlueFacesInBLVMinimap < 49)
1962 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; 1962 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i;
1963 } 1963 }
1964 else 1964 else
1965 { 1965 {
1966 auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x); 1966 long long _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x);
1967 auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16); 1967 uint _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16);
1968 auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16); 1968 int _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16);
1969 pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); 1969 pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
1970 pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); 1970 pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
1971 pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); 1971 pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
1972 pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); 1972 pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
1973 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; 1973 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8;
1977 } 1977 }
1978 } 1978 }
1979 1979
1980 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) 1980 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i)
1981 { 1981 {
1982 auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; 1982 BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]];
1983 pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); 1983 pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
1984 pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); 1984 pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
1985 pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); 1985 pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
1986 pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); 1986 pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
1987 pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color); 1987 pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color);
2117 || pCurrentScreen == SCREEN_BOOKS 2117 || pCurrentScreen == SCREEN_BOOKS
2118 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) 2118 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
2119 { 2119 {
2120 if (pParty->TorchlightActive()) 2120 if (pParty->TorchlightActive())
2121 { 2121 {
2122 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); 2122 IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time());
2123 pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); 2123 pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID));
2124 } 2124 }
2125 if (pParty->WizardEyeActive()) 2125 if (pParty->WizardEyeActive())
2126 { 2126 {
2127 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); 2127 IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time());
2128 pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); 2128 pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID));
2129 } 2129 }
2130 } 2130 }
2131 } 2131 }
2132 // 4E28F8: using guessed type int pCurrentScreen; 2132 // 4E28F8: using guessed type int pCurrentScreen;