Mercurial > mm7
changeset 2271:7ffddbe09e55
DrawMessageBox
author | Ritor1 |
---|---|
date | Thu, 13 Mar 2014 23:56:31 +0600 |
parents | fd788d2e9585 |
children | 85296dca37cf |
files | GUIFont.cpp GUIProgressBar.cpp GUIWindow.cpp |
diffstat | 3 files changed, 80 insertions(+), 188 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIFont.cpp Sun Mar 09 22:39:59 2014 +0600 +++ b/GUIFont.cpp Thu Mar 13 23:56:31 2014 +0600 @@ -55,8 +55,6 @@ return pFont; } - - //----- (0044D2FD) -------------------------------------------------------- void GUIFont::_44D2FD_prolly_draw_credits_entry( GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, unsigned __int16 firstColor, unsigned __int16 secondColor, const char *pString, @@ -110,8 +108,6 @@ } } - - //----- (0044D1E7) -------------------------------------------------------- void GUIFont::DrawTextLine( unsigned int uDefaultColor, signed int uX, signed int uY, const char *text, int max_len_pix ) @@ -649,5 +645,5 @@ //----- (00414174) -------------------------------------------------------- void uGameUIFontShadow_initialize() { - uGameUIFontShadow = Color16(0xE6u, 214u, 193u); + uGameUIFontShadow = Color16(0xE6u, 214, 193); } \ No newline at end of file
--- a/GUIProgressBar.cpp Sun Mar 09 22:39:59 2014 +0600 +++ b/GUIProgressBar.cpp Thu Mar 13 23:56:31 2014 +0600 @@ -60,7 +60,7 @@ } while ( v4 <= 5 ); if ( v5 == 5 ) - memset(&field_10, 0, 8u); + memset(&field_10, 0, 8); v7 = rand() % 5 + 1; if ( *(&field_10 + v7) == 1 ) { @@ -125,48 +125,41 @@ //----- (004435CD) -------------------------------------------------------- void GUIProgressBar::Progress() { - unsigned __int8 v1; // al@1 - ++this->uProgressCurrent; - v1 = this->uProgressMax; - if ( this->uProgressCurrent > v1 ) - this->uProgressCurrent = v1; + if ( this->uProgressCurrent > this->uProgressMax ) + this->uProgressCurrent = this->uProgressMax; Draw(); } //----- (004435E2) -------------------------------------------------------- void GUIProgressBar::Release() { - GUIProgressBar *v1; // esi@1 - char v2; // al@5 int v3; // edi@7 - v1 = this; - if ( v1->uType == 1 ) + if ( this->uType == 1 ) { - if ( !v1->pLoadingBg.pPixels ) + if ( !this->pLoadingBg.pPixels ) return; - v2 = v1->uProgressMax; - if ( v1->uProgressCurrent != v2 ) + if ( this->uProgressCurrent != this->uProgressMax ) { - v1->uProgressCurrent = v2 - 1; + this->uProgressCurrent = this->uProgressMax - 1; Progress(); } - free(v1->pLoadingBg.pPixels); - v3 = (int)&v1->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask; - free(v1->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask); - free(v1->pLoadingProgress.pPalette16); - v1->pLoadingProgress.pPalette16 = 0; - v1->pLoadingBg.pPixels = 0; + free(this->pLoadingBg.pPixels); + v3 = (int)&this->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask; + free(this->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask); + free(this->pLoadingProgress.pPalette16); + this->pLoadingProgress.pPalette16 = 0; + this->pLoadingBg.pPixels = 0; } else { - if ( !v1->pBardata.pLevelOfDetail0_prolly_alpha_mask ) + if ( !this->pBardata.pLevelOfDetail0_prolly_alpha_mask ) return; - free(v1->pBardata.pLevelOfDetail0_prolly_alpha_mask); - v3 = (int)&v1->pBardata.pPalette16; - free(v1->pBardata.pPalette16); - v1->pBardata.pLevelOfDetail0_prolly_alpha_mask = 0; + free(this->pBardata.pLevelOfDetail0_prolly_alpha_mask); + v3 = (int)&this->pBardata.pPalette16; + free(this->pBardata.pPalette16); + this->pBardata.pLevelOfDetail0_prolly_alpha_mask = 0; } *(int *)v3 = 0; } @@ -179,7 +172,7 @@ { if (pBardata.pLevelOfDetail0_prolly_alpha_mask) { - pRenderer->Sub01(); + pRenderer->Sub01(); pRenderer->DrawTextureIndexed(80, 122, &pBardata);//прогрессбар для данжей pRenderer->DrawTextureTransparent(100, 146, &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->uTextureID]);
--- a/GUIWindow.cpp Sun Mar 09 22:39:59 2014 +0600 +++ b/GUIWindow.cpp Thu Mar 13 23:56:31 2014 +0600 @@ -80,41 +80,27 @@ uNumMessages = pMessages[0].field_8 != 0; } - //----- (004356B9) -------------------------------------------------------- void GUIMessageQueue::PopMessage(enum UIMessageType *pType, int *pParam, int *a4) { - signed int v4; // edx@1 - GUIMessage *v5; // eax@2 - - v4 = 0; if ( this->uNumMessages ) { - v5 = this->pMessages; *pType = this->pMessages[0].eType; *pParam = this->pMessages[0].param; *a4 = this->pMessages[0].field_8; if ( (signed int)(this->uNumMessages - 1) > 0 ) { - do + for ( uint i = 0; i < (signed int)(this->uNumMessages - 1); ++i ) { - v5->eType = v5[1].eType; - v5->param = v5[1].param; - v5->field_8 = v5[1].field_8; - ++v4; - ++v5; + this->pMessages[i].eType = this->pMessages[i + 1].eType; + this->pMessages[i].param = this->pMessages[i + 1].param; + this->pMessages[i].field_8 = this->pMessages[i + 1].field_8; } - while ( v4 < (signed int)(this->uNumMessages - 1) ); } --this->uNumMessages; } } - - - - - //----- (0041B4E1) -------------------------------------------------------- int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) { @@ -160,9 +146,6 @@ return result; } - - - //----- (0041B438) -------------------------------------------------------- GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) { @@ -343,9 +326,7 @@ case WINDOW_null: return; default: - { break; - } } //v8 = this->pControlsHead; if ( this->pControlsHead ) @@ -373,11 +354,6 @@ uNumVisibleWindows = uNumVisibleWindows - 1; } - - - - - //----- (0041CD3B) -------------------------------------------------------- GUIButton *GUIWindow::GetControl(unsigned int uID) { @@ -647,30 +623,14 @@ void GUIWindow::DrawMessageBox(int arg0) { unsigned int v2; // edi@1 - GUIWindow *v3; // ebx@1 signed int v4; // esi@2 unsigned int v5; // eax@2 - unsigned int v6; // edx@4 - unsigned int v7; // ecx@6 - unsigned int v8; // eax@9 - __int32 v9; // eax@10 - unsigned int v10; // eax@18 - LONG v11; // ecx@18 - unsigned int v12; // edx@18 - unsigned int v13; // eax@18 - const char *v14; // ecx@18 - int v15; // eax@19 unsigned int v16; // esi@19 - const char *v17; // ebx@25 - int v18; // eax@26 - GUIWindow v19; // [sp+Ch] [bp-60h]@18 - POINT a2; // [sp+60h] [bp-Ch]@8 - unsigned int v21; // [sp+68h] [bp-4h]@18 + GUIWindow current_window; // [sp+Ch] [bp-60h]@18 + POINT cursor; // [sp+60h] [bp-Ch]@8 unsigned int v22; // [sp+74h] [bp+8h]@2 - unsigned int v23; // [sp+74h] [bp+8h]@18 v2 = 0; - v3 = this; if ( arg0 ) { v4 = pViewport->uViewportTL_X; @@ -684,108 +644,82 @@ v5 = window->GetWidth(); v22 = window->GetHeight(); } - v6 = this->uFrameX; + pMouse->GetCursorPos(&cursor); if ( (signed int)this->uFrameX >= v4 ) { - v7 = this->uFrameWidth; - if ( (signed int)(v7 + v6) <= (signed int)v5 ) - goto LABEL_9; - v3->uFrameX = v5 - v7; + if ( (signed int)(this->uFrameWidth + this->uFrameX) > (signed int)v5 ) + { + this->uFrameX = v5 - this->uFrameWidth; + this->uFrameY = cursor.y + 30; + } } else { this->uFrameX = v4; + this->uFrameY = cursor.y + 30; } - v3->uFrameY = pMouse->GetCursorPos(&a2)->y + 30; -LABEL_9: - v8 = v3->uFrameY; - if ( (signed int)v8 >= (signed int)v2 ) + + if ( (signed int)this->uFrameY >= (signed int)v2 ) { - if ( (signed int)(v8 + v3->uFrameHeight) <= (signed int)v22 ) - goto LABEL_14; - v9 = pMouse->GetCursorPos(&a2)->y - v3->uFrameHeight - 30; + if ( (signed int)(this->uFrameY + this->uFrameHeight) > (signed int)v22 ) + this->uFrameY = cursor.y - this->uFrameHeight - 30; } else - { - v9 = pMouse->GetCursorPos(&a2)->y + 30; - } - v3->uFrameY = v9; -LABEL_14: - if ( (signed int)v3->uFrameY < (signed int)v2 ) - v3->uFrameY = v2; - if ( (signed int)v3->uFrameX < v4 ) - v3->uFrameX = v4; - v10 = v3->uFrameWidth; - v11 = v3->uFrameX; - v12 = v3->uFrameY; - v21 = v10; - a2.y = v11; - v3->uFrameZ = v10 + v11 - 1; - v13 = v3->uFrameHeight; - v3->uFrameW = v13 + v12 - 1; - memcpy(&v19, v3, sizeof(v19)); - v19.uFrameX += 12; - v19.uFrameWidth -= 24; - v19.uFrameY += 12; - v19.uFrameHeight -= 12; - v19.uFrameZ = v19.uFrameWidth + v19.uFrameX - 1; - v23 = v12; - v19.uFrameW = v19.uFrameHeight + v19.uFrameY - 1; - v14 = v3->Hint; - if ( v14 ) - { - v15 = pFontLucida->CalcTextHeight(v14, &v19, 0, 0); - v12 = v23; - v16 = v15 + 24; - } + this->uFrameY = cursor.y + 30; + if ( (signed int)this->uFrameY < (signed int)v2 ) + this->uFrameY = v2; + if ( (signed int)this->uFrameX < v4 ) + this->uFrameX = v4; + this->uFrameZ = this->uFrameWidth + this->uFrameX - 1; + this->uFrameW = this->uFrameHeight + this->uFrameY - 1; + memcpy(¤t_window, this, sizeof(current_window)); + current_window.uFrameX += 12; + current_window.uFrameWidth -= 24; + current_window.uFrameY += 12; + current_window.uFrameHeight -= 12; + current_window.uFrameZ = current_window.uFrameWidth + current_window.uFrameX - 1; + current_window.uFrameW = current_window.uFrameHeight + current_window.uFrameY - 1; + if ( this->Hint ) + v16 = pFontLucida->CalcTextHeight(this->Hint, ¤t_window, 0, 0) + 24; else - { - v16 = v13; - } + v16 = this->uFrameHeight; if ( (signed int)v16 < 64 ) v16 = 64; - if ( (signed int)(v16 + v12) > 479 ) - v16 = 479 - v12; - DrawPopupWindow(a2.y, v12, v21, v16); - v17 = v3->Hint; - if ( v17 ) - { - v18 = pFontLucida->CalcTextHeight(v17, &v19, 0, 0); - v19.DrawTitleText(pFontLucida, 0, (signed int)(v16 - v18) / 2 - 14, 0, v17, 3); - } + if ( (signed int)(v16 + this->uFrameY) > 479 ) + v16 = 479 - this->uFrameY; + DrawPopupWindow(this->uFrameX, this->uFrameY, this->uFrameWidth, v16); + if ( this->Hint ) + current_window.DrawTitleText(pFontLucida, 0, (signed int)(v16 - pFontLucida->CalcTextHeight(this->Hint, ¤t_window, 0, 0)) / 2 - 14, 0, this->Hint, 3); } - - - //----- (00411B59) -------------------------------------------------------- void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer) { - unsigned int v2; // esi@1 - unsigned int v3; // edi@1 + //unsigned int v2; // esi@1 + //unsigned int v3; // edi@1 FILE *v4; // ebx@1 FILE *v5; // eax@2 char pContainerName[64]; // [sp+Ch] [bp-44h]@1 - unsigned int v7; // [sp+4Ch] [bp-4h]@1 + //unsigned int v7; // [sp+4Ch] [bp-4h]@1 - v2 = uSlot; - v7 = uPlayer; - v3 = uSlot + 1; + //v2 = uSlot; + //v7 = uPlayer; + //v3 = uSlot + 1; sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1); v4 = fopen(pContainerName, "rb"); if ( v4 ) { - pSavegameThumbnails[v2].LoadFromFILE(v4, 0, 1u); + pSavegameThumbnails[uSlot].LoadFromFILE(v4, 0, 1); fclose(v4); } else { - sprintf(pContainerName, "lloyd%d%d.pcx", v7, v3); + sprintf(pContainerName, "lloyd%d%d.pcx", uPlayer, uSlot + 1); v5 = pNew_LOD->FindContainer(pContainerName, 1); if ( v5 ) - pSavegameThumbnails[v2].LoadFromFILE(v5, 0, 0); + pSavegameThumbnails[uSlot].LoadFromFILE(v5, 0, 0); else - *((int *)&pSavegameThumbnails.data()->pPixels + 10 * v2) = 0; + *((int *)&pSavegameThumbnails.data()->pPixels + 10 * uSlot) = 0; } } @@ -900,9 +834,7 @@ pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); } else - { pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); - } return; } if ( current_npc_text ) @@ -925,9 +857,7 @@ pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); } else - { pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); - } return; } for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 ) @@ -964,9 +894,7 @@ pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); } else - { pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); - } return; } v4 = (char *)pDialogueNPCCount - 1; @@ -981,15 +909,11 @@ pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); } else - { pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); - } return; } if ( v4 || !dword_591080 )//на изумрудном острове заходит на корабле пока не выполнены квесты - { SimpleHouseDialog(); - } else { sprintfex( pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], @@ -1058,9 +982,7 @@ pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); } else - { pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); - } } //----- (004B1854) -------------------------------------------------------- @@ -1117,13 +1039,11 @@ this->DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), this, 0, 0)) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); } - - //----- (0044D406) -------------------------------------------------------- void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing ) { - GUIWindow *pWindow; // esi@1 + //GUIWindow *pWindow; // esi@1 unsigned int v8; // ebx@1 char *v9; // eax@1 unsigned int v11; // edi@1 @@ -1132,14 +1052,14 @@ GUIFont *pFont; // [sp+Ch] [bp-4h]@1 const char *Stra; // [sp+24h] [bp+14h]@5 - pWindow = this; + //pWindow = this; pFont = a2; v8 = this->uFrameWidth - uHorizontalMargin; ui_current_text_color = uDefaultColor; v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0); Stra = strtok(v9, "\n"); - v11 = uHorizontalMargin + pWindow->uFrameX; - v12 = uVerticalMargin + pWindow->uFrameY; + v11 = uHorizontalMargin + this->uFrameX; + v12 = uVerticalMargin + this->uFrameY; while ( 1 ) { if ( !Stra ) @@ -1154,8 +1074,6 @@ } // 5C6DB4: using guessed type int ui_current_text_color; - - //----- (0044CE08) -------------------------------------------------------- void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, signed int uFontShadowColor ) { @@ -1202,9 +1120,7 @@ if ( !uX ) uX = 12; if ( a8 ) - { v32 = Str; - } else { v11 = (int)FitTextInAWindow(Str, v10, v9, uX, 0); @@ -1230,7 +1146,7 @@ switch ( (unsigned __int8)v11 ) { case 9u: - strncpy(Dest, &v32[v14 + 1], 3u); + strncpy(Dest, &v32[v14 + 1], 3); Dest[3] = 0; pInString += 3; v29 = atoi(Dest); @@ -1247,14 +1163,14 @@ goto LABEL_36; break; case 0xCu: - strncpy(Dest, &v32[v14 + 1], 5u); + strncpy(Dest, &v32[v14 + 1], 5); Dest[5] = 0; v11 = atoi(Dest); pInString += 5; uFontColor = v11; break; case 0xDu: - strncpy(Dest, &v32[v14 + 1], 3u); + strncpy(Dest, &v32[v14 + 1], 3); Dest[3] = 0; pInString += 3; v18 = atoi(Dest); @@ -1285,24 +1201,11 @@ v12 += v10->pMetrics[v15].uLeftSpacing; v17 = (int)((char *)&v10[1] + v10->font_pixels_offset[v15]); if ( (short)uFontColor ) - pRenderer->DrawText( - v12, - v13, - (unsigned __int8 *)v17, - v16, - LOBYTE(v10->uFontHeight), - v10->pFontPalettes[0], - uFontColor, - uFontShadowColor); + pRenderer->DrawText(v12, v13, (unsigned __int8 *)v17, v16, LOBYTE(v10->uFontHeight), + v10->pFontPalettes[0], uFontColor, uFontShadowColor); else - pRenderer->DrawTextPalette( - v12, - v13, - (unsigned char*)v17, - v16, - LOBYTE(v10->uFontHeight), - v10->pFontPalettes[0], - a7); + pRenderer->DrawTextPalette(v12, v13, (unsigned char*)v17, v16, LOBYTE(v10->uFontHeight), + v10->pFontPalettes[0], a7); LOBYTE(v11) = v30; v12 += v28; if ( (signed int)pInString < (signed int)v30 )