# HG changeset patch # User Gloval # Date 1371244937 -14400 # Node ID 2929c4406d2ca53213e57293091d9ac4b7062b22 # Parent 33e360a9b4bf431af5552d8ef0661132d22b8bc9 guiwindow funcs cleanup diff -r 33e360a9b4bf -r 2929c4406d2c GUIWindow.cpp --- a/GUIWindow.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/GUIWindow.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -29,8 +29,36 @@ #include "mm7_data.h" +typedef struct _RGBColor + { + unsigned char R; + unsigned char B; + unsigned char G; + }RGBColor; +std::array spell_tooltip_colors={{ + {0x96, 0xD4, 0xFF}, + {0xFF, 0x80, 0x00}, + {0xFF, 0xFF, 0x9B}, + {0xE1, 0xE1, 0xE1}, + {0x80, 0x80, 0x80}, + {0x96, 0xD4, 0xFF}, + {0xFF, 0x55, 0x00}, + {0x96, 0xD4, 0xFF}, + {0xFF, 0x55, 0x00}, + {0xE1, 0xE1, 0xE1}, + {0xFF, 0x55, 0x00}, + {0x96, 0xD4, 0xFF}, + {0xEB, 0x0F, 0xFF}, + {0xFF, 0x80, 0x00}, + {0x96, 0xD4, 0xFF}, + {0x80, 0x80, 0x80}, + {0xFF, 0x55, 0x00}, + {0x00, 0x80, 0xFF}, + {0x00, 0x80, 0xFF}, + {0x96, 0xD4, 0xFF}}}; + int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb struct GUIWindow *pWindow_MainMenu; @@ -46,11 +74,11 @@ //----- (004141CA) -------------------------------------------------------- -void ModalWindow(const char *pStr, int a4) -{ +void ModalWindow( const char *pStrHint, int a4 ) + { pEventTimer->Pause(); dword_506F0C[0] = pCurrentScreen; - ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr); + ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, pStrHint); pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; } // 4E28F8: using guessed type int pCurrentScreen; @@ -180,79 +208,41 @@ //----- (0041D73D) -------------------------------------------------------- void GUIWindow::_41D73D_draw_buff_tooltip() { - GUIFont *v1; // esi@1 - GUIWindow *v2; // edi@1 - SpellBuff *v3; // eax@1 - unsigned int v4; // eax@5 - int v5; // ecx@5 - unsigned int v6; // eax@5 - unsigned int v7; // ecx@5 - char *v8; // ebx@7 - unsigned int v9; // eax@8 - unsigned int v10; // ecx@8 - __int64 v11; // ST28_8@11 - int v12; // esi@11 - const char *v13; // ST0C_4@11 - unsigned int v14; // eax@11 - char **v16; // [sp+14h] [bp-10h]@7 - GUIFont *a2; // [sp+18h] [bp-Ch]@1 - SpellBuff *v18; // [sp+1Ch] [bp-8h]@7 - int v19; // [sp+20h] [bp-4h]@1 - int v20; // [sp+20h] [bp-4h]@7 + + __int64 remaing_time; // ST28_8@11 + unsigned short text_color; + int Y_pos; // esi@11 + int string_count; // [sp+20h] [bp-4h]@7 + + + string_count = 0; + for (int i=0; i<20; ++i) + if ( pParty->pPartyBuffs[i].uExpireTime > 0i64 ) + ++string_count; - v1 = pFontComic; - v2 = this; - a2 = pFontComic; - v19 = 0; - v3 = pParty->pPartyBuffs; - do + uFrameHeight = pFontArrus->uFontHeight + 72; + uFrameHeight += (string_count - 1) * pFontArrus->uFontHeight; + uFrameZ = uFrameWidth + uFrameX - 1; + uFrameW = uFrameY + uFrameHeight - 1; + DrawMessageBox(0); + DrawTitleText(pFontArrus, 0, 12, 0, pGlobalTXT_LocalizationStrings[451], 3u); + if ( !string_count ) + DrawTitleText(pFontComic, 0, 40, 0, pGlobalTXT_LocalizationStrings[153], 3u); + + GetTickCount(); + string_count = 0; + for (int i=0; i<20; ++i) { - if ( (signed __int64)v3->uExpireTime > 0 ) - ++v19; - ++v3; + if ( pParty->pPartyBuffs[i].uExpireTime>0i64 )//!!! + { + remaing_time = pParty->pPartyBuffs[i].uExpireTime- pParty->uTimePlayed;//!!! + Y_pos = string_count * pFontComic->uFontHeight + 40; + text_color = TargetColor(spell_tooltip_colors[i].R, spell_tooltip_colors[i].G, spell_tooltip_colors[i].B); + DrawText(pFontComic, 52, Y_pos, text_color, aSpellNames[i], 0, 0, 0); + sub_41D20D_buff_remaining_time_string(Y_pos, this, remaing_time, pFontComic); + ++string_count; + } } - while ( (signed int)v3 < (signed int)pParty->pPlayers ); - v4 = LOBYTE(pFontArrus->uFontHeight) + 72; - this->uFrameHeight = v4; - v5 = v4 + (v19 - 1) * LOBYTE(pFontArrus->uFontHeight); - v6 = v2->uFrameWidth; - v2->uFrameHeight = v5; - v7 = v2->uFrameHeight; - v2->uFrameZ = v6 + v2->uFrameX - 1; - v2->uFrameW = v2->uFrameY + v7 - 1; - v2->DrawMessageBox(0); - v2->DrawTitleText(pFontArrus, 0, 0xCu, 0, pGlobalTXT_LocalizationStrings[451], 3u); - if ( !v19 ) - v2->DrawTitleText(v1, 0, 0x28u, 0, pGlobalTXT_LocalizationStrings[153], 3u); - v20 = 0; - GetTickCount(); - v8 = &_4E2B21_buff_spell_tooltip_colors[1]; - v16 = aSpellNames.data(); - v18 = pParty->pPartyBuffs; - do - { - v9 = LODWORD(v18->uExpireTime); - v10 = HIDWORD(v18->uExpireTime); - if ( (v10 & 0x80000000u) == 0 && ((signed int)v10 > 0 || v9) )//!!! - { - v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;//!!! - v12 = v20 * LOBYTE(v1->uFontHeight) + 40; - v13 = *v16; - ++v20; - v14 = TargetColor( - (unsigned __int8)*(v8 - 1), - (unsigned __int8)*v8, - (unsigned __int8)v8[1]); - v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0); - sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2); - v1 = a2; - } - ++v18; - ++v16; - v8 += 3; - } - while ( (signed int)v18 < (signed int)pParty->pPlayers ); - } @@ -1206,7 +1196,8 @@ //----- (0044D406) -------------------------------------------------------- -void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing ) +void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, + const char *pInString, unsigned int uLineSpacing ) { GUIWindow *pWindow; // esi@1 unsigned int v8; // ebx@1 @@ -1383,7 +1374,7 @@ pRenderer->DrawTextPalette( v12, v13, - v17, + (unsigned char*)v17, v16, LOBYTE(v10->uFontHeight), v10->pFontPalettes[0], @@ -1409,11 +1400,11 @@ //----- (0044CB4F) -------------------------------------------------------- -int GUIWindow::DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8) -{ - GUIFont *pFont; // edi@1 +int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text ) + { + int pLineWidth; // ebx@1 - int v11; // esi@3 + int text_width; // esi@3 unsigned __int8 v12; // cl@7 signed int v13; // esi@19 signed int v14; // ebx@19 @@ -1423,11 +1414,11 @@ int v18; // ecx@23 int v19; // ecx@24 unsigned int v20; // ecx@26 - int v21; // eax@28 + unsigned char* v21; // eax@28 int v22; // ebx@34 int v23; // eax@34 int v24; // ebx@36 - char Str; // [sp+Ch] [bp-20h]@34 + char Str[6]; // [sp+Ch] [bp-20h]@34 char v26; // [sp+Fh] [bp-1Dh]@34 char v27; // [sp+11h] [bp-1Bh]@35 int v28; // [sp+20h] [bp-Ch]@17 @@ -1437,144 +1428,114 @@ size_t Str1b; // [sp+40h] [bp+14h]@19 const char *Sourcea; // [sp+44h] [bp+18h]@20 int v34; // [sp+48h] [bp+1Ch]@26 + int i; - pFont = a2; + pWindow = this; - pNumLen = strlen(Str1); - pLineWidth = pFont->GetLineWidth(Str1); - if ( pLineWidth < Source ) + pNumLen = strlen(text); + pLineWidth = pFont->GetLineWidth(text); + if ( pLineWidth < rect_width ) { - pWindow->DrawText(pFont, uX, uY, uColor, Str1, 0, 0, 0); + pWindow->DrawText(pFont, uX, uY, uColor, text, 0, 0, 0); return pLineWidth; } - strcpy(pTmpBuf2.data(), Str1); - v11 = 0; - if ( a8 ) + strcpy(pTmpBuf2.data(), text); + text_width = 0; + if ( reverse_text ) _strrev(pTmpBuf2.data()); Str1a = 0; - if ( (signed int)pNumLen > 0 ) - { - do + for (i=0; i= Source ) + if ( text_width >= rect_width ) break; - if ( pFont->IsCharValid(v12 = pTmpBuf2[Str1a]) ) + v12 = pTmpBuf2[i]; + if ( pFont->IsCharValid(v12) ) { - if ( v12 < 9u ) - { - if ( (signed int)Str1a > 0 ) - v11 += pFont->pMetrics[v12].uLeftSpacing; - v11 += *((int *)&pFont->cFirstChar + 3 * v12 + 9); - if ( (signed int)Str1a < (signed int)pNumLen ) - v11 += pFont->pMetrics[v12].uRightSpacing; - goto LABEL_16; - } - if ( v12 > 0xAu )//10 - { - if ( v12 == 12 ) + switch (v12) { - Str1a += 5; - } - else - { - if ( v12 != 13 ) - { - if ( (signed int)Str1a > 0 ) - v11 += pFont->pMetrics[v12].uLeftSpacing; - v11 += *((int *)&pFont->cFirstChar + 3 * v12 + 9); - if ( (signed int)Str1a < (signed int)pNumLen ) - v11 += pFont->pMetrics[v12].uRightSpacing; - } - } - } + case '\t':// Horizontal tab 09 + case '\n': //Line Feed 0A 10 + case '\r': //Form Feed, page eject 0C 12 + break; + case '\f': //Carriage Return 0D 13 + i += 5; + break; + default: + if ( i > 0 ) + text_width += pFont->pMetrics[v12].uLeftSpacing; + text_width += pFont->pMetrics[v12].uWidth; + if ( i < pNumLen ) + text_width += pFont->pMetrics[v12].uRightSpacing; + } } -LABEL_16: - ++Str1a; } - while ( (signed int)Str1a < (signed int)pNumLen ); - } - pTmpBuf2[Str1a - 1] = 0; + pTmpBuf2[i - 1] = 0; + + pNumLen = strlen(pTmpBuf2.data()); v28 = pFont->GetLineWidth(pTmpBuf2.data()); - if ( a8 ) + if ( reverse_text ) _strrev(pTmpBuf2.data()); - Str1b = 0; + v13 = uX + pWindow->uFrameX; v14 = uY + pWindow->uFrameY; - if ( (signed int)pNumLen > 0 ) + for (i=0; iIsCharValid(v15 = pTmpBuf2[Str1b]) ) + v15 = pTmpBuf2[i]; + if ( pFont->IsCharValid(v15) ) { - v16 = v15; - v17 = v15 - 9; - if ( v17 )//>0 - { - v18 = v17 - 1; - if ( v18 )//>0 + switch (v12) + { + case '\t':// Horizontal tab 09 + { + strncpy(Str, &pTmpBuf2[i+1], 3); + Str[3] = 0; + // atoi(Str); + i += 3; + break; + } + case '\n': //Line Feed 0A 10 + { + v24 = pFont->uFontHeight; + v13 = uX; + uY = uY + pFont->uFontHeight - 3; + v14 = uY+pFont->uFontHeight - 3; + break; + } + case '\r': //Form Feed, page eject 0C 12 { - v19 = v18 - 2; - if ( v19 )//>0 - { - if ( v19 == 1 )//v15 == 13 - { - strncpy(&Str, Sourcea, 3u); - v26 = 0; - Str1b += 3; - Sourcea += 3; - v22 = atoi(&Str); - v23 = pFont->GetLineWidth(&pTmpBuf2[Str1b]); - v13 = pWindow->uFrameZ - v23 - v22; - v14 = uY; - } - else//v15 > 13 - { - v20 = *((int *)&pFont->cFirstChar + 3 * v16 + 9); - v34 = *((int *)&pFont->cFirstChar + 3 * v16 + 9); - if ( (signed int)Str1b > 0 ) - v13 += pFont->pMetrics[v16].uLeftSpacing; - v21 = (int)((char *)&pFont[1] + pFont->font_pixels_offset[v16]); - if ( (short)uColor ) - pRenderer->DrawText(v13, v14, (unsigned __int8 *)v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], uColor, 0); - else - pRenderer->DrawTextPalette(v13, v14, v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], 0); - v13 += v34; - if ( (signed int)Str1b < (signed int)pNumLen ) - v13 += pFont->pMetrics[(unsigned __int8)pTmpBuf2[Str1b]].uRightSpacing; - } - } - else//v15 == 12 - { - strncpy(&Str, Sourcea, 5u); - v27 = 0; - Str1b += 5; - Sourcea += 5; - uColor = atoi(&Str); - } + strncpy(Str, &pTmpBuf2[i+1], 5); + Str[5] = 0; + i += 5; + uColor = atoi(Str); + break; + } + case '\f': //Carriage Return 0D 13 + { + strncpy(Str, &pTmpBuf2[i+1], 3); + Str[3] = 0; + i += 3; + v23 = pFont->GetLineWidth(&pTmpBuf2[i]); + v13 = pWindow->uFrameZ - v23 - atoi(Str); + v14 = uY; + break; } - else//v15 == 10 - { - v24 = LOBYTE(pFont->uFontHeight); - v13 = uX; - uY = uY + v24 - 3; - v14 = v24 + uY - 3; - } - } - else//v15 == 9 - { - strncpy(&Str, Sourcea, 3u); - v26 = 0; - atoi(&Str); - Str1b += 3; - Sourcea += 3; - } + default: + v20 = pFont->pMetrics[v15].uWidth; + if ( i > 0 ) + v13 += pFont->pMetrics[v15].uLeftSpacing; + v21 = &pFont->pFontData[pFont->font_pixels_offset[v15]]; + if ( uColor ) + pRenderer->DrawText(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], uColor, 0); + else + pRenderer->DrawTextPalette(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], 0); + v13 += v20; + if ( i < (signed int)pNumLen ) + v13 += pFont->pMetrics[v15].uRightSpacing; + } } - ++Str1b; - ++Sourcea; - } - while ( (signed int)Str1b < (signed int)pNumLen ); + + } return v28; } @@ -1597,25 +1558,23 @@ pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON"); pButton->pParent = this; - pButton->uX = uX + this->uFrameX; - v13 = uY + this->uFrameY; + pButton->uWidth = uWidth; pButton->uHeight = uHeight; - pButton->uY = v13; - pButton->uWidth = uWidth; + if ( a6 == 2 && !uHeight ) pButton->uHeight = uWidth; - v14 = pButton->uX; + pButton->uButtonType = a6; - v15 = v14 + uWidth - 1; - pButton->uZ = v15; - v17 = pButton->uY; + pButton->uX = uX + this->uFrameX; + pButton->uY = uY + this->uFrameY; + pButton->uZ = pButton->uX + uWidth - 1; + pButton->uW = pButton->uY + uHeight - 1; pButton->field_2C_is_pushed = 0; - pButton->uW = v17 + uHeight - 1; pButton->field_1C = a7; pButton->msg = msg; pButton->msg_param = msg_param; pButton->uHotkey = uHotkey; - strlen(pName); + //strlen(pName); strcpy(pButton->pButtonName, pName); va_start(texturs_ptr, pName); while (NULL!=(pTextures=va_arg(texturs_ptr, Texture *))) @@ -1637,20 +1596,15 @@ } //----- (00459C2B) -------------------------------------------------------- -void GUIWindow::DrawFlashingInputCursor(signed int a3, int a4, GUIFont *a2) -{ - signed int v4; // esi@1 - GUIWindow *v5; // edi@1 - - v4 = a3; - v5 = this; +void GUIWindow::DrawFlashingInputCursor( signed int uX, int uY, struct GUIFont *a2 ) + { if ( GetTickCount() % 1000 > 500 ) - DrawText(a2, v4, a4, 0, "_", 0, 0, 0); + DrawText(a2, uX, uY, 0, "_", 0, 0, 0); } //----- (0041C432) -------------------------------------------------------- -GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, WindowType eWindowType, int pButton, int a5) -{ +GUIWindow * GUIWindow::Create( unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint ) + { unsigned int uNextFreeWindowID; // ebp@1 //int *v8; // eax@1 //GUIWindow *pWindow; // esi@4 @@ -1679,15 +1633,16 @@ auto pWindow = &pWindowList[uNextFreeWindowID]; pWindow->uFrameWidth = uWidth; + pWindow->uFrameHeight = uHeight; + + pWindow->uFrameX = uX; + pWindow->uFrameY = uY; pWindow->uFrameZ = uX + uWidth - 1; pWindow->uFrameW = uY + uHeight - 1; + pWindow->ptr_1C = (void *)pButton; - pWindow->Hint = (char *)a5; - //v10 = uNumVisibleWindows; - pWindow->uFrameX = uX; - //++v10; - pWindow->uFrameY = uY; - pWindow->uFrameHeight = uHeight; + pWindow->Hint = hint; + pWindow->eWindowType = eWindowType; pWindow->receives_keyboard_input = false; ++uNumVisibleWindows; @@ -1699,10 +1654,11 @@ { switch (eWindowType) { - case WINDOW_Book: + case WINDOW_Book: { pWindow->InitializeBookView(); break; - case WINDOW_Dialogue: + } + case WINDOW_Dialogue: { pMainScreenNum = pCurrentScreen; pCurrentScreen = SCREEN_NPC_DIALOGUE; pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" @@ -1794,8 +1750,8 @@ pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); } break; - - case WINDOW_ChangeLocation: + } + case WINDOW_ChangeLocation: { pMainScreenNum = pCurrentScreen; pCurrentScreen = SCREEN_CHANGE_LOCATION; pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области @@ -1803,16 +1759,19 @@ pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); break; - - case WINDOW_SpellBook: // окно книги заклов + } + case WINDOW_SpellBook: {// окно книги заклов InitializeBookTextures(); pWindow->OpenSpellBook(); break; - case WINDOW_GreetingNPC: // окно приветствия НПС + } + case WINDOW_GreetingNPC: {// окно приветствия НПС pMainScreenNum = pCurrentScreen; pKeyActionMap->EnterText(0, 15, pWindow); pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG; break; + } + } return pWindow; } @@ -1842,7 +1801,7 @@ if ( v26 || !dword_591080 ) v27 = HouseNPCData[v26 +1 - (dword_591080 != 0)]->pName; else - v27 = (char *)p2DEvents[pButton - 1].pProprieterName; + v27 = (char*)p2DEvents[pButton - 1].pProprieterName; v30 = v27; v29 = (char*)pGlobalTXT_LocalizationStrings[435]; } @@ -1879,7 +1838,6 @@ return pWindow; } if (eWindowType == WINDOW_Scroll) - //goto LABEL_62; { pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); diff -r 33e360a9b4bf -r 2929c4406d2c GUIWindow.h --- a/GUIWindow.h Thu Jun 13 23:41:42 2013 +0400 +++ b/GUIWindow.h Sat Jun 15 01:22:17 2013 +0400 @@ -253,21 +253,21 @@ /* 298 */ enum WindowType: unsigned __int32 { - WINDOW_null = 0, - WINDOW_MainMenu = 1, - WINDOW_OptionsButtons = 3, + WINDOW_null = 0, + WINDOW_MainMenu = 1, + WINDOW_OptionsButtons = 3, WINDOW_CharacterRecord = 4, - WINDOW_Options = 6, - WINDOW_8 = 8, - WINDOW_Book = 9, - WINDOW_Dialogue = 10, + WINDOW_Options = 6, + WINDOW_8 = 8, + WINDOW_Book = 9, + WINDOW_Dialogue = 10, WINDOW_QuickReference = 12, - WINDOW_F = 15, - WINDOW_Rest = 16, + WINDOW_F = 15, + WINDOW_Rest = 16, WINDOW_ChangeLocation = 17, - WINDOW_SpellBook = 0x12, - WINDOW_GreetingNPC = 19, - WINDOW_Chest = 0x14, + WINDOW_SpellBook = 18, + WINDOW_GreetingNPC = 19, + WINDOW_Chest = 20, WINDOW_22 = 0x16, WINDOW_SaveLoadButtons = 23, WINDOW_MainMenu_Load = 0x18, @@ -326,8 +326,8 @@ GUIButton *CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, struct Texture *pTextures, ...); - void DrawFlashingInputCursor(signed int a3, int a4, struct GUIFont *a2); - int DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8); + void DrawFlashingInputCursor(signed int uX, int uY, struct GUIFont *a2); + int DrawTextInRect(GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text); void DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor); void DrawTitleText(GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing); void DrawCurrentTime(__int64 a2); @@ -340,7 +340,7 @@ void _41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5); void _41D73D_draw_buff_tooltip(); - static GUIWindow *Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eType, int a4, int a5); + static GUIWindow *Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint); unsigned int uFrameX; unsigned int uFrameY; @@ -363,7 +363,7 @@ int numVisibleWindows; int receives_keyboard_input_2; // 0 no input 1 currently typing 2 enter pressed 3 escape pressed int receives_keyboard_input; - char *Hint; + const char *Hint; GUIButton *pControlsHead; GUIButton *pControlsTail; }; @@ -464,7 +464,7 @@ -void ModalWindow(const char *pStr, int a4); +void ModalWindow(const char *pStrHint, int a4); diff -r 33e360a9b4bf -r 2929c4406d2c Render.cpp --- a/Render.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/Render.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -9566,8 +9566,8 @@ } //----- (004A6AB1) -------------------------------------------------------- -void Render::DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8) -{ +void Render::DrawTextPalette( int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8 ) + { int v8; // edi@2 unsigned int v9; // esi@2 unsigned __int16 *v10; // eax@2 @@ -9600,14 +9600,14 @@ v8 = a5; v9 = a6; v10 = &pTargetSurface[x + y * uTargetSurfacePitch]; - v11 = (unsigned char *)a4; - v25 = a4; + v11 = (unsigned char *)font_pixels; + v25 = (int)font_pixels; if ( this->bClip ) { v12 = this->uClipX; if ( a2 < (signed int)v12 ) { - v25 = v12 - a2 + a4; + v25 = v12 - a2 + (int)font_pixels; v10 += v12 - a2; v8 = a5 + a2 - v12; } diff -r 33e360a9b4bf -r 2929c4406d2c Render.h --- a/Render.h Thu Jun 13 23:41:42 2013 +0400 +++ b/Render.h Sat Jun 15 01:22:17 2013 +0400 @@ -349,7 +349,7 @@ void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4); void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture); void _4A6A68(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height); - void DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8); + void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8); void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor); void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16); int _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7); diff -r 33e360a9b4bf -r 2929c4406d2c UIMainMenu.cpp --- a/UIMainMenu.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/UIMainMenu.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -313,7 +313,7 @@ pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a2.uFrameHeight, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1, pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth); free(pString); - pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr); + pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, ptr); pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 0x1Bu, "", 0); pCurrentScreen = SCREEN_CREATORS; SetCurrentMenuID(MENU_CREDITSPROC); diff -r 33e360a9b4bf -r 2929c4406d2c UIPopup.cpp --- a/UIPopup.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/UIPopup.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -2160,7 +2160,7 @@ } if ( pWindow.Hint ) { - pHint = pWindow.Hint; + pHint = (char*)pWindow.Hint; pWindow.Hint = 0; pWindow.uFrameWidth = 384; pWindow.uFrameHeight = 256; diff -r 33e360a9b4bf -r 2929c4406d2c UIRest.cpp --- a/UIRest.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/UIRest.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -192,5 +192,6 @@ Sleep6Hours(); } else - GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" + GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, + (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" } \ No newline at end of file diff -r 33e360a9b4bf -r 2929c4406d2c UITransition.cpp --- a/UITransition.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/UITransition.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -100,7 +100,7 @@ LABEL_19: strcpy(sHouseName.data(), v21); LABEL_20: - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName.data()); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) if ( pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].uRoomSoundId ) PlayHouseSound(anim_id, HouseSound_Greeting); @@ -139,7 +139,7 @@ sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" else strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit" - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName.data()); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, sHouseName.data()); } diff -r 33e360a9b4bf -r 2929c4406d2c mm7_5.cpp --- a/mm7_5.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/mm7_5.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -728,7 +728,7 @@ } v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v19); - GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); + GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); continue; } @@ -739,7 +739,7 @@ { v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v21); - GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); + GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); continue; } @@ -768,7 +768,7 @@ --uMusicVolimeMultiplier; if ( (char)uMusicVolimeMultiplier < 1 ) uMusicVolimeMultiplier = 0; - GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); + GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); @@ -779,7 +779,7 @@ ++uMusicVolimeMultiplier; if ( (char)uMusicVolimeMultiplier > 9 ) uMusicVolimeMultiplier = 9; - GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); + GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); @@ -798,7 +798,7 @@ --uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier < 1 ) uSoundVolumeMultiplier = 0; - GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); + GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); continue; @@ -811,7 +811,7 @@ //v168 = 1; v24 = 435; //v154 = (int)pBtn_SliderRight; - GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); + GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); continue; @@ -840,7 +840,7 @@ --uVoicesVolumeMultiplier; if ( (char)uVoicesVolumeMultiplier < 1 ) uVoicesVolumeMultiplier = 0; - GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); + GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); if ( !uVoicesVolumeMultiplier ) continue; pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); @@ -851,7 +851,7 @@ ++uVoicesVolumeMultiplier; if ( (char)uVoicesVolumeMultiplier > 8 ) uVoicesVolumeMultiplier = 9; - GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); + GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); if ( !uVoicesVolumeMultiplier ) continue; pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); @@ -1514,7 +1514,7 @@ if ( !pGUIWindow_Settings )//Draw Menu { dword_6BE138 = -1; - GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1); + GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, (char *)1); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pCurrentScreen = SCREEN_MENU; @@ -1948,7 +1948,7 @@ case UIMSG_OnCastTownPortal: pAudioPlayer->StopChannels(-1, -1); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, (char *)uMessageParam); continue; case UIMSG_OnCastLloydsBeacon: @@ -2136,7 +2136,7 @@ _5B65B8_npcdata_hiword_house_or_other = v66; InitializeActors(); } - v67 = pGUIWindow_CurrentMenu->Hint; + v67 = (char*)pGUIWindow_CurrentMenu->Hint; if ( v67 ) *((int *)v67 + 17) = 1; else @@ -2455,7 +2455,7 @@ _42ECB5_PlayerAttacksActor(); continue; case UIMSG_ExitRest: - GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" + GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" continue; case UIMSG_Wait5Minutes: if ( dword_506F14 == 2 ) @@ -2465,7 +2465,7 @@ continue; } GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, - (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" + (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" dword_506F14 = 1; _506F18_num_hours_to_sleep = 5; continue; @@ -2477,7 +2477,7 @@ continue; } GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, - (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" + (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" dword_506F14 = 1; _506F18_num_hours_to_sleep = 60; continue; @@ -2615,7 +2615,7 @@ continue; } GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, - (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" + (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; @@ -3011,7 +3011,7 @@ default: continue; } - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); continue; case UIMSG_SelectCharacter: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3336,7 +3336,7 @@ } while (player->GetSexByVoice() != pSex); pButton = pCreationUI_BtnPressLeft2[pParam]; - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); player->PlaySound(SPEECH_PickMe, 0); break; @@ -3348,7 +3348,7 @@ } while (player->GetSexByVoice() != pSex); pButton = pCreationUI_BtnPressRight2[pParam]; - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); player->PlaySound(SPEECH_PickMe, 0); break; @@ -3366,7 +3366,7 @@ pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; uPlayerCreationUI_SelectedCharacter = v25; - GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], 1); + GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1); pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); pPlayer->PlaySound(SPEECH_PickMe, 0); break; @@ -3382,17 +3382,17 @@ pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; uPlayerCreationUI_SelectedCharacter = v21; - GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], 1); + GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1); pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); pPlayer->PlaySound(SPEECH_PickMe, 0); break; case UIMSG_PlayerCreationClickPlus: - GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, 1); + GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1); pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); break; case UIMSG_PlayerCreationClickMinus: - GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, 1); + GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1); pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); break; @@ -9539,7 +9539,7 @@ { GUIWindow *pWindow; // esi@4 //unsigned int pWindowType; // eax@4 - char *pHint; // edx@66 + const char *pHint; // edx@66 GUIButton *pButtonPtr_1C; // ebp@79 char *pHint1; // edx@80 int v26; // eax@98 diff -r 33e360a9b4bf -r 2929c4406d2c mm7_data.cpp --- a/mm7_data.cpp Thu Jun 13 23:41:42 2013 +0400 +++ b/mm7_data.cpp Sat Jun 15 01:22:17 2013 +0400 @@ -484,7 +484,7 @@ std::array pHealthBarPos = {{22, 137, 251, 366}}; std::array pManaBarPos = {{102, 217, 331, 447}}; -std::array _4E2B21_buff_spell_tooltip_colors; + std::array monster_popup_y_offsets = {{ -20, 20, 0, -40, 0, 0, 0, 0, 0, 0, -50, diff -r 33e360a9b4bf -r 2929c4406d2c mm7_data.h --- a/mm7_data.h Thu Jun 13 23:41:42 2013 +0400 +++ b/mm7_data.h Sat Jun 15 01:22:17 2013 +0400 @@ -432,7 +432,7 @@ //extern int pMagicSkills[9]; extern std::array pHealthBarPos; extern std::array pManaBarPos; -extern std::array _4E2B21_buff_spell_tooltip_colors; +//extern std::array _4E2B21_buff_spell_tooltip_colors; extern std::array monster_popup_y_offsets; // weak extern unsigned char hourglass_icon_idx; // weak