# HG changeset patch # User Ritor1 # Date 1376201373 -21600 # Node ID b330df6a2183231ad51fedaea75e18c0d40cd814 # Parent f682c853200d5761a75e6f55fec877bcd909d347# Parent bfe342ae0c1f2a60bc53fb2fd25359b1f18c537f Слияние diff -r f682c853200d -r b330df6a2183 Actor.cpp --- a/Actor.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/Actor.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -2322,7 +2322,7 @@ v8 = 30; if ( !pParty->bTurnBasedModeOn ) pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v8 * 2.133333333333333)); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); result = 1; } return result; @@ -4049,7 +4049,7 @@ double v42; // st7@176 double v43; // st6@176 //bool v44; // eax@189 - bool v45; // eax@192 + int v45; // eax@192 unsigned __int8 v46; // cl@197 double v47; // st7@206 //double v48; // st7@207 @@ -4149,14 +4149,14 @@ pPlayer->ReceiveDamage(v4, DMGT_5); } } - if (pTurnEngine->field_1C) - --pTurnEngine->field_1C; + if (pTurnEngine->pending_actions) + --pTurnEngine->pending_actions; } } if (pParty->bTurnBasedModeOn) { - pTurnEngine->_405E14(); + pTurnEngine->AITurnBasedAction(); return; } diff -r f682c853200d -r b330df6a2183 Actor.h --- a/Actor.h Sun Aug 11 12:09:09 2013 +0600 +++ b/Actor.h Sun Aug 11 12:09:33 2013 +0600 @@ -14,7 +14,7 @@ { void LootActor(struct Actor *pActor); int which_player_would_attack(struct Actor *pActor); - bool special_ability_use_check(struct Actor *pActor, int a2); + int special_ability_use_check(struct Actor *pActor, int a2); int _427102(struct Actor *pActor, signed int a2); int PlayerHitOrMiss(struct Player *pPlayer, struct Actor *pActor, int a3, int a4); bool _4273BB(struct Actor *pActor, struct Actor *a2, int a3, int a4); diff -r f682c853200d -r b330df6a2183 CastSpellInfo.cpp --- a/CastSpellInfo.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/CastSpellInfo.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -430,7 +430,7 @@ //v649 = pPlayer; pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; pPlayer->SetRecoveryTime(sRecoveryTime); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); @@ -478,7 +478,7 @@ pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; } break; } @@ -511,7 +511,7 @@ LOBYTE(pSpellSprite.uAttributes) |= 4u; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; break; } case SPELL_FIRE_TORCH_LIGHT: @@ -594,7 +594,7 @@ LOBYTE(pSpellSprite.uAttributes) |= 4u; v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; break; } @@ -751,7 +751,7 @@ LOBYTE(pSpellSprite.uAttributes) |= 0x40u; v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; break; } @@ -786,7 +786,7 @@ LOBYTE(pSpellSprite.uAttributes) |= 4u; v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; break; } @@ -826,7 +826,7 @@ LOBYTE(pSpellSprite.uAttributes) |= 4u; v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; } break; @@ -973,7 +973,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; break; } @@ -1393,7 +1393,7 @@ pSpellSprite.uAttributes = 4; if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; j = rand() % 1024 - 512; k = rand() % 1024 - 512; } @@ -1540,7 +1540,7 @@ pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; v188 += _v726 / (amount - 1); } LODWORD(v727) = 1; @@ -1710,7 +1710,7 @@ pSpellSprite.uAttributes = 4; if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; v721 = rand() % 1024 - 512; v218 = rand(); v14 = a2-- == 1; @@ -1799,7 +1799,7 @@ LOBYTE(pSpellSprite.uAttributes) |= 4u; v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; } else { @@ -1834,7 +1834,7 @@ pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; v227 += _v733 / (amount - 1); } while ( v227 <= _y ); @@ -2209,7 +2209,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; break; } @@ -2246,7 +2246,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; LODWORD(v727) = 1; break; } @@ -3718,7 +3718,7 @@ pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; v596 += _v726 / (amount - 1); } while ( v596 <= (signed int)y ); @@ -4010,7 +4010,7 @@ pParty->field_16140 = v2; ++pPlayer->uNumArmageddonCasts; if ( pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + ++pTurnEngine->pending_actions; auto _v726 = 50; do { @@ -4046,7 +4046,7 @@ pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; pPlayer->SetRecoveryTime(v645); if ( !some_active_character ) - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } else { @@ -4386,7 +4386,7 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); + pGUIWindow_Settings = pCastSpellInfo[result].GetCastSpellInInventoryWindow(); unk_50C9A0 = 1; some_active_character = uActiveCharacter; sub_421B2C_PlaceInInventory_or_DropPickedItem(); diff -r f682c853200d -r b330df6a2183 CastSpellInfo.h --- a/CastSpellInfo.h Sun Aug 11 12:09:09 2013 +0600 +++ b/CastSpellInfo.h Sun Aug 11 12:09:33 2013 +0600 @@ -19,7 +19,7 @@ void _427D48(unsigned int uPlayerID); unsigned int PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int sound_id); - struct GUIWindow *sub_4219BE(); + struct GUIWindow *GetCastSpellInInventoryWindow(); void _427E01_cast_spell(); __int16 spellnum; diff -r f682c853200d -r b330df6a2183 GUIButton.cpp --- a/GUIButton.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/GUIButton.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -208,25 +208,25 @@ } } //----- (00419220) -------------------------------------------------------- -void __cdecl sub_419220() +void __cdecl CreateAwardsScrollBar() { - GUIButton *i; // eax@2 + GUIButton *pButton; // eax@2 if ( !dword_507CBC ) { dword_507CBC = 1; - for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) { - if ( i->msg == UIMSG_InventoryLeftClick ) + if ( pButton->msg == UIMSG_InventoryLeftClick ) { - dword_50698C_uX = i->uX; - dword_506988_uY = i->uY; - dword_506984_uZ = i->uZ; - dword_506980_uW = i->uW; - i->uW = 0; - i->uZ = 0; - i->uY = 0; - i->uX = 0; + dword_50698C_uX = pButton->uX; + dword_506988_uY = pButton->uY; + dword_506984_uZ = pButton->uZ; + dword_506980_uW = pButton->uW; + pButton->uW = 0; + pButton->uZ = 0; + pButton->uY = 0; + pButton->uX = 0; } } pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, diff -r f682c853200d -r b330df6a2183 GUIFont.cpp --- a/GUIFont.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/GUIFont.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -385,11 +385,10 @@ //----- (0044C6C2) -------------------------------------------------------- -char* GUIFont::_44C6C2( const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5 ) - { +char* GUIFont::GetPageTop( const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5 ) +{ int text_height; // edi@1 char *text_str; // ebx@3 - int i; unsigned char c; // cl@4 int text_length; @@ -399,35 +398,33 @@ return 0; text_str = FitTextInAWindow(pInString, this, pWindow, uX, 0); text_length = strlen(text_str); - for (i=0; i= (signed int)(a5 * pWindow->uFrameHeight) ) - return &text_str[i+1]; - break; - case '\f': //Form Feed, page eject 0C 12 - i += 5; - break; - case '\t': // Horizontal tab 09 - case '\r': //Carriage Return 0D 13 - i += 3; - break; - } - if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) ) - break; - } + case '\n': //Line Feed 0A 10: + text_height = text_height + (uFontHeight - 3); + if ( text_height >= (signed int)(a5 * (pWindow->uFrameHeight - (uFontHeight - 3))) ) + return &text_str[i]; + break; + case '\f': //Form Feed, page eject 0C 12 + i += 5; + break; + case '\t': // Horizontal tab 09 + case '\r': //Carriage Return 0D 13 + i += 3; + break; } - return &text_str[i]; + if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) ) + break; + } + } + return &text_str[0]; } - - //----- (0044C62E) -------------------------------------------------------- int GUIFont::GetStringHeight2( GUIFont *secondFont, const char *text_str, GUIWindow* pWindow, int startX, int a6 ) { @@ -469,41 +466,40 @@ //----- (0044C59D) -------------------------------------------------------- int GUIFont::CalcTextHeight( const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5 ) - { - int uAllHeght; - int uStringLen; - unsigned char c; - char *test_string; +{ + int uAllHeght; + int uStringLen; + unsigned char c; + char *test_string; - if (!pString) - return 0; - uAllHeght = uFontHeight - 3; - test_string = FitTextInAWindow(pString, this, pWindow, uXOffset, 0); - uStringLen = strlen(pString); - for (int i = 0; i < uStringLen; ++i) - { - c = test_string[i]; - if (IsCharValid(c)) - { - switch (c) - { - case '\n': //Line Feed 0A 10: - uAllHeght+= uFontHeight - 3; - break; - case '\f': //Form Feed, page eject 0C 12 - i += 5; - break; - case '\t': // Horizontal tab 09 - case '\r': //Carriage Return 0D 13 - if (a5 != 1) - i += 3; - break; - } - } - } - return uAllHeght; - } - + if (!pString) + return 0; + uAllHeght = uFontHeight - 6; + test_string = FitTextInAWindow(pString, this, pWindow, uXOffset, 0); + uStringLen = strlen(pString); + for (int i = 0; i < uStringLen; ++i) + { + c = test_string[i]; + if (IsCharValid(c)) + { + switch (c) + { + case '\n': //Line Feed 0A 10: + uAllHeght += uFontHeight - 3; + break; + case '\f': //Form Feed, page eject 0C 12 + i += 5; + break; + case '\t': // Horizontal tab 09 + case '\r': //Carriage Return 0D 13 + if (a5 != 1) + i += 3; + break; + } + } + } + return uAllHeght; +} //----- (0044C51E) -------------------------------------------------------- int GUIFont::GetLineWidth(const char *pString) @@ -553,106 +549,103 @@ return position; else return 0; - } //----- (0044C768) -------------------------------------------------------- char * FitTextInAWindow( const char *pInString, GUIFont *pFont, GUIWindow *pWindow, signed int uX, int a5 ) - { - unsigned char c; - int uInStrLen; - char digits[4]; - int possible_transition_point; - int string_pixel_Width; - int start_pixel_offset; +{ + unsigned char c; + int uInStrLen; + char digits[4]; + int possible_transition_point; + int string_pixel_Width; + int start_pixel_offset; - if (!pInString) - { - MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); - return 0; - } - uInStrLen = strlen(pInString); - strcpy(&temp_string[0], pInString); - if (uInStrLen==0) - return &temp_string[0]; + if (!pInString) + { + MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); + return 0; + } + uInStrLen = strlen(pInString); + strcpy(&temp_string[0], pInString); + if (uInStrLen == 0) + return &temp_string[0]; - start_pixel_offset=string_pixel_Width=uX; - possible_transition_point=0; - for(int i=0; iIsCharValid(c)) - { - switch (c) - { - case '\t': // Horizontal tab 09 - { - strncpy(digits, &temp_string[i+1],3); - digits[3]=0; - string_pixel_Width= atoi(digits)+uX; - i+=3; - break; - } - case '\n': //Line Feed 0A 10 - { - string_pixel_Width=start_pixel_offset; - possible_transition_point=i; - break; - } - case '\f': //Form Feed, page eject 0C 12 - { - i+=5; - break; - } - case '\r': //Carriage Return 0D 13 - { - if (!a5) - return (char*)pInString; - break; - } - case ' ' : - { - string_pixel_Width+=pFont->pMetrics[c].uWidth; - possible_transition_point=i; - break; - } - default: - - if ((string_pixel_Width+pFont->pMetrics[c].uWidth+ pFont->pMetrics[c].uLeftSpacing+ - pFont->pMetrics[c].uRightSpacing)uFrameWidth) - { - if(i>possible_transition_point) - string_pixel_Width+=pFont->pMetrics[c].uLeftSpacing; - string_pixel_Width+=pFont->pMetrics[c].uWidth; - if (ipMetrics[c].uRightSpacing; - } - else - { - temp_string[possible_transition_point]='\n'; - string_pixel_Width=start_pixel_offset; - if (i>possible_transition_point) - { - for(int j=possible_transition_point;jIsCharValid(c)) - { - if(j>possible_transition_point) - string_pixel_Width+=pFont->pMetrics[c].uLeftSpacing; - string_pixel_Width+=pFont->pMetrics[c].uWidth; - if (jpMetrics[c].uRightSpacing; - - } - } - } - } - } - } - } - return &temp_string[0]; - } + start_pixel_offset = string_pixel_Width=uX; + possible_transition_point = 0; + for ( int i = 0; i < uInStrLen; ++i ) + { + c = temp_string[i]; + if (pFont->IsCharValid(c)) + { + switch (c) + { + case '\t': // Horizontal tab 09 + { + strncpy(digits, &temp_string[i + 1],3); + digits[3] = 0; + string_pixel_Width = atoi(digits)+uX; + i += 3; + break; + } + case '\n': //Line Feed 0A 10 ( ) + { + string_pixel_Width = start_pixel_offset; + possible_transition_point = i; + break; + } + case '\f': //Form Feed, page eject 0C 12 + { + i += 5; + break; + } + case '\r': //Carriage Return 0D 13 + { + if ( !a5 ) + return (char*)pInString; + break; + } + case ' ':// + { + string_pixel_Width += pFont->pMetrics[c].uWidth; + possible_transition_point = i; + break; + } + default: + if ((string_pixel_Width + pFont->pMetrics[c].uWidth + pFont->pMetrics[c].uLeftSpacing + + pFont->pMetrics[c].uRightSpacing) < pWindow->uFrameWidth )// + { + if ( i > possible_transition_point ) + string_pixel_Width += pFont->pMetrics[c].uLeftSpacing; + string_pixel_Width += pFont->pMetrics[c].uWidth; + if (i < uInStrLen) + string_pixel_Width += pFont->pMetrics[c].uRightSpacing; + } + else// + { + temp_string[possible_transition_point] ='\n'; + string_pixel_Width = start_pixel_offset; + if ( i > possible_transition_point ) + { + for ( int j = possible_transition_point; j < i; ++j ) + { + c = temp_string[j]; + if (pFont->IsCharValid(c)) + { + if ( j > possible_transition_point ) + string_pixel_Width += pFont->pMetrics[c].uLeftSpacing; + string_pixel_Width += pFont->pMetrics[c].uWidth; + if ( j < i ) + string_pixel_Width += pFont->pMetrics[c].uRightSpacing; + } + } + } + } + } + } + } + return &temp_string[0]; +} //----- (00414162) -------------------------------------------------------- void uGameUIFontMain_initialize() { diff -r f682c853200d -r b330df6a2183 GUIFont.h --- a/GUIFont.h Sun Aug 11 12:09:09 2013 +0600 +++ b/GUIFont.h Sun Aug 11 12:09:33 2013 +0600 @@ -24,7 +24,7 @@ int GetLineWidth(const char *pString); int CalcTextHeight(const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5); int GetStringHeight2(GUIFont *secondFont, const char *text_str, GUIWindow* pWindow, int startX, int a6); - char* _44C6C2(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5); + char* GetPageTop(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5); void DrawTextLineToBuff(int uColor, int a3, unsigned short* uX_buff_pos, const char *text, int line_width); void DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *text, int max_len_pix); void _44D2FD_prolly_draw_credits_entry(GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, diff -r f682c853200d -r b330df6a2183 GUIWindow.cpp --- a/GUIWindow.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/GUIWindow.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -403,77 +403,56 @@ //----- (00411BFC) -------------------------------------------------------- void GUIWindow::InitializeBookView() { - GUIWindow *v1; // ebp@1 - signed int v2; // ecx@8 - __int64 *v3; // ebp@9 - char *v4; // ecx@10 - char *v5; // eax@12 - int v6; // eax@12 - __int64 v7; // qax@12 - unsigned int v8; // esi@12 - GUIButton *v9; // eax@19 - signed int v10; // esi@19 - int v11; // eax@24 - int v12; // eax@27 - int i; // esi@28 - char *v14; // ebp@29 - int v15; // eax@31 - //unsigned int v16; // esi@35 - Player *v17; // esi@38 + char *pString; // eax@12 + int pTextHeight; // eax@12 + //__int64 page_count; // qax@12 + unsigned int page_count; // esi@12 unsigned __int16 v18; // ax@38 - unsigned int v19; // edi@43 - unsigned int v20; // edi@45 - void *v21; // esi@45 signed int max_beacons; // [sp+10h] [bp-5Ch]@38 - char *v25; // [sp+14h] [bp-58h]@21 - GUIWindow v26; // [sp+18h] [bp-54h]@8 + GUIWindow journal_window; // [sp+18h] [bp-54h]@8 - v1 = this; pAudioPlayer->StopChannels(-1, -1); InitializeBookFonts(); - v1->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close + this->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close pCurrentScreen = SCREEN_BOOKS; full_num_items_in_book = 0; books_primary_item_per_page = 0; books_page_number = 0; num_achieved_awards = 0; - switch (v1->par1C) - { - case WINDOW_LloydsBeacon:{ + switch (this->par1C) + { + case WINDOW_LloydsBeacon: + { byte_506360 = 0; pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE); pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); pTexture_LloydBeacons[1] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); + pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); + pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon - pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon - - v17 = &pParty->pPlayers[_506348_current_lloyd_playerid]; + pBtn_Book_1 = this->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon + pBtn_Book_2 = this->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon max_beacons = 1; - v18 = v17->pActiveSkills[PLAYER_SKILL_WATER]; + v18 = pParty->pPlayers[_506348_current_lloyd_playerid].pActiveSkills[PLAYER_SKILL_WATER]; if ( v18 & 0x100 || (v18 & 0x80) ) max_beacons = 5; else if ( v18 & 0x40 ) max_beacons = 3; - - //__debugbreak(); // warning C4700: uninitialized local variable 'v19' used - for (int i =0; i< max_beacons; ++i) + for ( int i = 0; i < max_beacons; ++i ) CreateButton(pLloydsBeaconsPreviewXs[i], pLloydsBeaconsPreviewYs[i], 92, 68, 1, 180, UIMSG_InstallBeacon, i, 0, "", 0); - for (int i =0; i< 5; ++i) - { - if (v17->pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed) - LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1); - else - memset(&v17->pInstalledBeacons[i], 0, sizeof(LloydBeacon)); - } - } - break; + for ( int i = 0; i < 5; ++i ) + { + if (pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed) + LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1); + else + memset(&pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i], 0, sizeof(LloydBeacon)); + } + } + break; case WINDOW_TownPortal: { @@ -487,8 +466,8 @@ static int pTownPortalBook_ws[6] = { 80, 66, 68, 72, 67, 74}; static int pTownPortalBook_hs[6] = { 55, 56, 65, 67, 67, 59}; - for (uint i = 0; i < 6; ++i) - v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr); + for ( uint i = 0; i < 6; ++i ) + this->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr); } break; @@ -497,202 +476,184 @@ { pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE); pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, - pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, + pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); + pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); + pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); + pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); + pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, + pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" - pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, - pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, + pTex_book_button1_on, 0); + pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, + pTex_book_button2_on->uTextureHeight, pTex_book_button2_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" - pTex_tab_an_7b__zoot_on, 0); + pTex_book_button2_on, 0); num_achieved_awards = 0; memset(achieved_awards.data(), 0, 4000); - for ( i = books_primary_item_per_page; i < 512; ++i ) - { - // v14 = (char *)pQuestTable[i];//(&dword_722F10)[4 * i]; - if ( _449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i] ) - { - achieved_awards[num_achieved_awards] = (AwardType)i; - ++num_achieved_awards; - } - } - v12 = num_achieved_awards; + for ( uint i = books_primary_item_per_page; i < 512; ++i ) + { + if ( _449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i] ) + { + achieved_awards[num_achieved_awards] = (AwardType)i; + ++num_achieved_awards; + } + } + full_num_items_in_book = num_achieved_awards; num_achieved_awards = 0; - full_num_items_in_book = v12; - } - break; + } + break; - - case WINDOW_AutonotesBook: - { + case WINDOW_AutonotesBook: + { pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pTexture_506394 = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); - pTexture_506390 = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); - pTexture_50638C = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); - pTexture_506388 = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); - pTexture_506384 = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); - pTexture_506380 = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); - pTexture_50637C = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); - pTexture_506378 = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); - pTexture_506374 = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); - pTexture_506370 = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); - pTexture_50636C = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); - pTexture_506368 = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); + pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); + pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); + pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); + pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); + pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); + pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); + pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); + pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); + pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); + pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); + pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); + pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); + pTex_book_button7_on = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); + pTex_book_button7_off = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); + pTex_book_button8_on = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); + pTex_book_button8_off = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" - pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" - pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" + pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_book_button1_on, 0); + pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button2_on, 0); + pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTex_book_button3_on, 0); // "Potion Notes" + pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTex_book_button4_on, 0); // "Fountain Notes" + pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTex_book_button5_on, 0); // "Obelisk Notes" + pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTex_book_button6_on, 0); // "Seer Notes" + pBtn_Autonotes_Misc = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTex_book_button7_on, 0); // "Miscellaneous Notes" + pBtn_Autonotes_Instructors = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTex_book_button8_on, 0); // "Instructors" num_achieved_awards = 0; - for ( i = books_primary_item_per_page; i < 196; ++i ) - if ( _506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] ) - { - if ( i ) - { - if ( _449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText ) - { + for ( uint i = books_primary_item_per_page; i < 196; ++i ) + { + if ( _506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] ) + { + if ( i ) + { + if ( _449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText ) + { + achieved_awards[num_achieved_awards] = (AwardType)i; + ++num_achieved_awards; + } + } + } + } + full_num_items_in_book = num_achieved_awards; + num_achieved_awards = 0; + } + break; - achieved_awards[num_achieved_awards] = (AwardType)i; - ++num_achieved_awards; - } - } - } - - } - break; - - case WINDOW_MapsBook: - { + case WINDOW_MapsBook: + { dword_506364 = 1; pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); - pTexture_506394 = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); - pTexture_506390 = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); - pTexture_50638C = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); - pTexture_506388 = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); - pTexture_506384 = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); - pTexture_506380 = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); - pTexture_50637C = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); - pTexture_506378 = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); + pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); + pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); + pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); + pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); + pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); + pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); + pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); + pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); + pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); + pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); + pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); + pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, + pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_book_button1_on, 0);// "Zoom In" + pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, + UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_book_button2_on, 0);// "Zoom Out" + pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, + pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, + pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, + pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" - } - break; + } + break; - case WINDOW_CalendarBook: - { + case WINDOW_CalendarBook: + { pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE); pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE); pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE); pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE); - } - break; + } + break; - case WINDOW_JournalBook: - { + case WINDOW_JournalBook: + { pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); + pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); + pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); + pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); + pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, - pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, - UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, - pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, - pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); + pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, + pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, 1, 0, + UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button1_on, 0); + pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on->uTextureHeight, + pTex_book_button2_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, + pGlobalTXT_LocalizationStrings[193], pTex_book_button2_on, 0); num_achieved_awards = 0; - v26.uFrameX = 48; - v26.uFrameY = 70; - v26.uFrameWidth = 360; - v26.uFrameHeight = 264; - v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3; - v26.uFrameZ = 407; - v26.uFrameHeight = v2 * 264 / v2; - v26.uFrameW = v26.uFrameHeight + 69; + journal_window.uFrameX = 48; + journal_window.uFrameY = 70; + journal_window.uFrameWidth = 360; + journal_window.uFrameHeight = 264; + journal_window.uFrameZ = 407; + journal_window.uFrameHeight = (LOBYTE(pAutonoteFont->uFontHeight) - 3) * 264 / LOBYTE(pAutonoteFont->uFontHeight) - 3; + journal_window.uFrameW = journal_window.uFrameHeight + 69; memset(&achieved_awards, 0, 4000); - memset(byte_5C6D50.data(), 0, 0x64u); + memset(Journal_limitation_factor.data(), 0, 100); if ( books_primary_item_per_page < 29 ) + { + for ( int i = books_primary_item_per_page; i < books_primary_item_per_page + 31; i++ ) + { + if ( pParty->field_3C.field_4F0[2 * i] > 0 ) { - v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * books_primary_item_per_page]; - for(int i = books_primary_item_per_page+1; i < books_primary_item_per_page + 31; i++) - { - v4 = pStorylineText->StoreLine[i].pText; - if ( *v3 ) - { - if ( v4 ) - { - v5 = BuildDialogueString(v4, uActiveCharacter - 1, 0, 0, 0, v3); - v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0); - v7 = (v6 - 3) / (signed int)v26.uFrameHeight; - v8 = v7 + 1; - if ( (signed int)v7 + 1 > 0 ) - { - memset32((char *)&achieved_awards + 4 * num_achieved_awards , i, v8); - do - { - LODWORD(v7) = num_achieved_awards++; - byte_5C6D50[(int)v7] = BYTE4(v7); - ++HIDWORD(v7); - } - while ( SHIDWORD(v7) < (signed int)v8 ); - } - } - } - ++i; - ++v3; - } + if ( pStorylineText->StoreLine[i + 1].pText ) + { + pString = BuildDialogueString(pStorylineText->StoreLine[i + 1].pText, uActiveCharacter - 1, 0, 0, 0, (__int64 *)&pParty->field_3C.field_4F0[2 * i]); + pTextHeight = pAutonoteFont->CalcTextHeight(pString, &journal_window, 1, 0); + page_count = ((pTextHeight - (pAutonoteFont->uFontHeight - 3)) / (signed int)journal_window.uFrameHeight) + 1; + memset32((char *)&achieved_awards[num_achieved_awards] , i + 1, page_count); + for ( uint j = 0; j <= page_count - 1; ++j ) + Journal_limitation_factor[num_achieved_awards++] = j; + } } - - } - break; + } } - + full_num_items_in_book = num_achieved_awards; + num_achieved_awards = 0; + } + break; + } } - - - //----- (00415551) -------------------------------------------------------- void GUIWindow::DrawMessageBox(int arg0) { diff -r f682c853200d -r b330df6a2183 Game.cpp --- a/Game.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/Game.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -479,7 +479,7 @@ if ( pParty->bTurnBasedModeOn == 1 ) { - pTurnEngine->End(1); + pTurnEngine->End(true); pParty->bTurnBasedModeOn = 0; } //pHealth = &pParty->pPlayers[0].sHealth;//193C diff -r f682c853200d -r b330df6a2183 Items.h --- a/Items.h Sun Aug 11 12:09:09 2013 +0600 +++ b/Items.h Sun Aug 11 12:09:33 2013 +0600 @@ -23,10 +23,10 @@ ITEM_IDENTIFIED = 0x1, ITEM_BROKEN = 0x2, ITEM_TEMP_BONUS = 0x8, - ITEM_AURA_EFFECT_RED = 0x10, - ITEM_AURA_EFFECT_BLUE = 0x20, - ITEM_AURA_EFFECT_GREEN = 0x40, - ITEM_AURA_EFFECT_PURPLE = 0x80, + ITEM_AURA_EFFECT_RED = 0x10,//16 + ITEM_AURA_EFFECT_BLUE = 0x20,//32 + ITEM_AURA_EFFECT_GREEN = 0x40,//64 + ITEM_AURA_EFFECT_PURPLE = 0x80,//128 ITEM_STOLEN = 0x100, ITEM_ENCHANTED = 0x200, }; @@ -67,7 +67,8 @@ ITEM_DEVIL_ICHOR = 0xD6, ITEM_OOZE_ECTOPLASM_BOTTLE = 0xD9, ITEM_POTION_BOTTLE = 0xDC, - ITEM_SPELLBOOK_FIRE_STRIKE = 0x191, + ITEM_SPELLBOOK_TORCHLIGHT = 400,//0x190 + ITEM_SPELLBOOK_FIRE_STRIKE = 401,//0x191, ITEM_SPELLBOOK_AIR_FEATHER_FALL = 0x19C, ITEM_SPELLBOOK_WATER_POISON_SPRAY = 0x1A7, ITEM_SPELLBOOK_EARTH_SLOW = 0x1B2, @@ -79,7 +80,7 @@ ITEM_SPELLBOOK_LIGHT_LIGHT_BOLT = 0x1DD, ITEM_SPELLBOOK_LIGHT_SUN_BURST = 0x1E6, ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION = 0x1E7, - ITEM_ARTIFACT_PUCK = 0x1F4, + ITEM_ARTIFACT_PUCK = 500,//0x1F4, ITEM_ARTICACT_GOVERNONS_ARMOR = 504,//1F8 ITEM_ARTIFACT_YORUBA = 505,//1F9 ITEM_ARTIFACT_SPLITTER = 506,//1FA diff -r f682c853200d -r b330df6a2183 Player.cpp --- a/Player.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/Player.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -5842,7 +5842,7 @@ { pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; thisb->SetRecoveryTime(100); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } else { @@ -6138,7 +6138,7 @@ { pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; thisb->SetRecoveryTime(100); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } else { @@ -6259,7 +6259,7 @@ { pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; thisb->SetRecoveryTime(100); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } else { @@ -7047,7 +7047,7 @@ || var_type > VAR_History_28 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), - v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, + v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), v23) ) return; @@ -7092,12 +7092,12 @@ { v20 = pPlayers[currPlayerId + 1]; v20->PlaySound(SPEECH_96, 0); - v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; + //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; - _506568_autonote_type = v21; + _506568_autonote_type = pAutonoteTxt[var_value].eType; DrawPlayerBuffAnimBasedOnCondition(currPlayerId); } - _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); + _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1); PlaySoundBasedOnCondition(currPlayerId); return; } @@ -7890,11 +7890,11 @@ v23 = pPlayers[uPlayerIdx + 1]; v34 = 1; v23->PlaySound(SPEECH_96, 0); - v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; + //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; - _506568_autonote_type = v24; - } - _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); + _506568_autonote_type = pAutonoteTxt[val].eType; + } + _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); v3 = 1; LABEL_173: if ( v34 != 1 ) diff -r f682c853200d -r b330df6a2183 Render.cpp --- a/Render.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/Render.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -7842,7 +7842,7 @@ } //----- (004A63E6) -------------------------------------------------------- -void Render::_4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) +void Render::DrawAura(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) { Texture *v8; // eax@2 Texture *v9; // ebx@4 diff -r f682c853200d -r b330df6a2183 Render.h --- a/Render.h Sun Aug 11 12:09:09 2013 +0600 +++ b/Render.h Sun Aug 11 12:09:33 2013 +0600 @@ -344,7 +344,7 @@ void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5); void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal); void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture); - void _4A63E6(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); + void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4); void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture); diff -r f682c853200d -r b330df6a2183 SpriteObject.cpp --- a/SpriteObject.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/SpriteObject.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -1064,7 +1064,7 @@ if (pSpriteObjects[uLayingItemID].uAttributes & 4 ) { pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB; - --pTurnEngine->field_1C; + --pTurnEngine->pending_actions; } } } diff -r f682c853200d -r b330df6a2183 Texture.cpp --- a/Texture.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/Texture.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -30,22 +30,22 @@ std::array pTexture_LloydBeacons; Texture *pTexture_50635C; -Texture *pTexture_506368; -Texture *pTexture_50636C; -Texture *pTexture_506370; -Texture *pTexture_506374; -Texture *pTexture_506378; -Texture *pTexture_50637C; -Texture *pTexture_506380; -Texture *pTexture_506384; -Texture *pTexture_506388; -Texture *pTexture_50638C; -Texture *pTexture_506390; -Texture *pTexture_506394; -Texture *pTex_tab_an_7a__zoot_off; -Texture *pTex_tab_an_6a__zoom_off; -Texture *pTex_tab_an_7b__zoot_on; -Texture *pTex_tab_an_6b__zoom_on; +Texture *pTex_book_button8_off; +Texture *pTex_book_button8_on; +Texture *pTex_book_button7_off; +Texture *pTex_book_button7_on; +Texture *pTex_book_button6_off; +Texture *pTex_book_button6_on; +Texture *pTex_book_button5_off; +Texture *pTex_book_button5_on; +Texture *pTex_book_button4_off; +Texture *pTex_book_button4_on; +Texture *pTex_book_button3_off; +Texture *pTex_book_button3_on; +Texture *pTex_book_button2_off; +Texture *pTex_book_button1_off; +Texture *pTex_book_button2_on; +Texture *pTex_book_button1_on; std::array pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit std::array SBPageCSpellsTextureList; std::array SBPageSSpellsTextureList; diff -r f682c853200d -r b330df6a2183 Texture.h --- a/Texture.h Sun Aug 11 12:09:09 2013 +0600 +++ b/Texture.h Sun Aug 11 12:09:33 2013 +0600 @@ -128,22 +128,22 @@ extern std::array pSavegameThumbnails; extern std::array pTexture_LloydBeacons; extern struct Texture *pTexture_50635C; -extern struct Texture *pTexture_506368; -extern struct Texture *pTexture_50636C; -extern struct Texture *pTexture_506370; -extern struct Texture *pTexture_506374; -extern struct Texture *pTexture_506378; -extern struct Texture *pTexture_50637C; -extern struct Texture *pTexture_506380; -extern struct Texture *pTexture_506384; -extern struct Texture *pTexture_506388; -extern struct Texture *pTexture_50638C; -extern struct Texture *pTexture_506390; -extern struct Texture *pTexture_506394; -extern struct Texture *pTex_tab_an_7a__zoot_off; -extern struct Texture *pTex_tab_an_6a__zoom_off; -extern struct Texture *pTex_tab_an_7b__zoot_on; -extern struct Texture *pTex_tab_an_6b__zoom_on; +extern struct Texture *pTex_book_button8_off; +extern struct Texture *pTex_book_button8_on; +extern struct Texture *pTex_book_button7_off; +extern struct Texture *pTex_book_button7_on; +extern struct Texture *pTex_book_button6_off; +extern struct Texture *pTex_book_button6_on; +extern struct Texture *pTex_book_button5_off; +extern struct Texture *pTex_book_button5_on; +extern struct Texture *pTex_book_button4_off; +extern struct Texture *pTex_book_button4_on; +extern struct Texture *pTex_book_button3_off; +extern struct Texture *pTex_book_button3_on; +extern struct Texture *pTex_book_button2_off; +extern struct Texture *pTex_book_button1_off; +extern struct Texture *pTex_book_button2_on; +extern struct Texture *pTex_book_button1_on; extern std::array pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit extern std::array SBPageCSpellsTextureList; diff -r f682c853200d -r b330df6a2183 TurnEngine.cpp --- a/TurnEngine.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/TurnEngine.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -24,15 +24,15 @@ { int active_actors; - TurnBased_QueueElem *v7; // eax@16 - TurnBased_QueueElem *v8; // ecx@18 + TurnBased_QueueElem *current_top; // eax@16 + TurnBased_QueueElem *test_element; // ecx@18 TurnBased_QueueElem temp_elem; int i,j; unsigned int p_type; unsigned int p_id; active_actors = this->uActorQueueSize; - + //set non active actors in queue initiative that not allow them to paticipate for( i=0; ipPlayers[p_id].CanAct() ) { --active_actors; - pQueue[i].field_4 = 1001; + pQueue[i].actor_initiative = 1001; } } } @@ -62,28 +62,28 @@ { for( i=0; ifield_4 < v7->field_4 || - ((v8->field_4 == v7->field_4) && + test_element=&pQueue[j]; + if ( test_element->actor_initiative < current_top->actor_initiative || // if less initiative -> top + ((test_element->actor_initiative == current_top->actor_initiative) && ( - ((PID_TYPE(v8->uPackedID) == OBJECT_Player) && (PID_TYPE(v7->uPackedID) == OBJECT_Actor)) || - ((PID_TYPE(v8->uPackedID) == PID_TYPE(v7->uPackedID)) && (PID_ID(v8->uPackedID) < PID_ID(v7->uPackedID))) + ((PID_TYPE(test_element->uPackedID) == OBJECT_Player) && (PID_TYPE(current_top->uPackedID) == OBJECT_Actor)) || //player preferable + ((PID_TYPE(test_element->uPackedID) == PID_TYPE(current_top->uPackedID)) && (PID_ID(test_element->uPackedID) < PID_ID(current_top->uPackedID))) //less id preferable ) ) ) - { - memcpy(&temp_elem,v7,sizeof(TurnBased_QueueElem)); - memcpy(v7,v8, sizeof(TurnBased_QueueElem)); - memcpy(v8, &temp_elem, sizeof(TurnBased_QueueElem)); + { //swap + memcpy(&temp_elem,current_top,sizeof(TurnBased_QueueElem)); + memcpy(current_top,test_element, sizeof(TurnBased_QueueElem)); + memcpy(test_element, &temp_elem, sizeof(TurnBased_QueueElem)); } } } } uActorQueueSize = active_actors; - if ( PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player) + if ( PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player) //we have player at queue top { uActiveCharacter = PID_ID(pQueue[0].uPackedID)+1; field_18 |= TE_PLAYER_TURN; @@ -95,15 +95,15 @@ } for(i=0; ipPlayers[PID_ID(pQueue[i].uPackedID)].uTimeToRecovery = (signed __int64)((double)pQueue[i].field_4 * 0.46875); + if ( PID_TYPE(pQueue[i].uPackedID) == OBJECT_Player) //set recovery times + pParty->pPlayers[PID_ID(pQueue[i].uPackedID)].uTimeToRecovery = (unsigned __int16)((double)pQueue[i].actor_initiative * 0.46875); } } //----- (0040471C) -------------------------------------------------------- -void stru262_TurnBased::_40471C() +void stru262_TurnBased::ApplyPlayerAction() { if ( pParty->bTurnBasedModeOn == 1 ) { @@ -118,9 +118,7 @@ int v3; // esi@1 unsigned int actor_id; // esi@7 - Actor *pActor; // edi@7 unsigned int v8; // edx@10 - signed int v16; // qax@19 int v17; // edx@22 AIDirection v30; // [sp+Ch] [bp-68h]@10 AIDirection v31; // [sp+28h] [bp-4Ch]@10 @@ -133,7 +131,7 @@ int i,j; int temp; - pTurnEngine->field_18 &= ~TE_FLAG_2; + pTurnEngine->field_18 &= ~TE_HAVE_PENDING_ACTIONS; pEventTimer->TrackGameTime(); pAudioPlayer->StopChannels(-1, -1); pAudioPlayer->PlaySound(SOUND_207, 0, 0, -1, 0, 0, 0, 0); @@ -141,9 +139,9 @@ dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength; dword_50C994 = 0; - this->field_10 = 100; - this->field_0 = 0; - this->field_8 = 64; + this->turn_initiative = 100; + this->turns_count = 0; + this->ai_turn_timer = 64; this->turn_stage = 1; this->uActorQueueSize = 0; @@ -152,7 +150,7 @@ if ( pParty->pPlayers[v3].CanAct() ) { this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Player,v3); - this->pQueue[this->uActorQueueSize].field_C = 2; + this->pQueue[this->uActorQueueSize].AI_action_type = TE_AI_PURSUE; this->pQueue[this->uActorQueueSize].uActionLength = 0; pParty->pTurnBasedPlayerRecoveryTimes[this->uActorQueueSize] = 0; ++this->uActorQueueSize; @@ -174,7 +172,7 @@ memcpy(&v30, &v31, sizeof(AIDirection)); Actor::AI_StandOrBored(actor_id, 4, 32, &v30); this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Actor,actor_id); - this->pQueue[this->uActorQueueSize].field_C = 2; + this->pQueue[this->uActorQueueSize].AI_action_type = TE_AI_PURSUE; this->pQueue[this->uActorQueueSize].uActionLength = 0; ++this->uActorQueueSize; } @@ -184,14 +182,12 @@ a_players_count=0; for ( v40b = 0; v40b < this->uActorQueueSize; ++v40b ) { - //v13 = PID_TYPE(this->pQueue[0].uPackedID); + //set initial initiative for turn actors if ( PID_TYPE(this->pQueue[v40b].uPackedID) == OBJECT_Player ) { if ( pPlayers[PID_ID(this->pQueue[v40b].uPackedID) + 1]->uTimeToRecovery != 0 ) { - //v33 = pPlayers[(this->pQueue[0].uPackedID >> 3) + 1]->uTimeToRecovery; - v16 = (signed int)((double)pPlayers[PID_ID(this->pQueue[v40b].uPackedID) + 1]->uTimeToRecovery * 0.46875); - this->pQueue[v40b].field_4 = v16; + this->pQueue[v40b].actor_initiative = (signed int)((double)pPlayers[PID_ID(this->pQueue[v40b].uPackedID) + 1]->uTimeToRecovery * 0.46875); } else { @@ -203,15 +199,15 @@ { v17 = rand() % 99; if ( v17 < 33 ) - this->pQueue[v40b].field_4 = 1; + this->pQueue[v40b].actor_initiative = 1; else - this->pQueue[v40b].field_4= (v17 >= 66)? 5 : 3; + this->pQueue[v40b].actor_initiative= (v17 >= 66)? 5 : 3; } else - { - this->pQueue[v40b].field_4 = 666; + { //fot non player and actor + this->pQueue[v40b].actor_initiative = 666; } - this->pQueue[v40b].field_4 += 16; + this->pQueue[v40b].actor_initiative += 16; } if ( a_players_count > 0 ) @@ -238,7 +234,7 @@ for (i=0; ipQueue[activ_players[i]].field_4 = i+2; + this->pQueue[activ_players[i]].actor_initiative = i+2; } } this->SortTurnQueue(); @@ -274,18 +270,18 @@ objID = PID_ID(pQueue[i].uPackedID); if ( objType == OBJECT_Player ) { - pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)pQueue[i].field_4 * 2.133333333333333); + pPlayers[objID + 1]->uTimeToRecovery = (unsigned __int16)((double)pQueue[i].actor_initiative * 2.133333333333333); } else if ( objType == OBJECT_Actor ) { - pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)pQueue[i].field_4 * 2.133333333333333); + pActors[objID].pMonsterInfo.uRecoveryTime = (unsigned __int16)((double)pQueue[i].actor_initiative * 2.133333333333333); } } pAudioPlayer->StopChannels(-1, -1); if ( bPlaySound != 0 ) pAudioPlayer->PlaySound(SOUND_206, 0, 0, -1, 0, 0, 0, 0); - pTurnEngine->field_18 &= ~TE_FLAG_2; + pTurnEngine->field_18 &= ~TE_HAVE_PENDING_ACTIONS; pEventTimer->StopGameTime(); dword_50C994 = 0; dword_50C998_turnbased_icon_1A = 0; @@ -294,7 +290,7 @@ // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; //----- (00405E14) -------------------------------------------------------- -void stru262_TurnBased::_405E14() +void stru262_TurnBased::AITurnBasedAction() { AIDirection *v6; // esi@21 int v7; // eax@21 @@ -331,7 +327,7 @@ memcpy(&v15, v6, sizeof(AIDirection)); memcpy(&v14, &v15, sizeof(AIDirection)); v7 = curr_actor->uAIState; - if(v7==AIState::Dying) + if(v7==Dying) { curr_actor->uCurrentActionTime = 0; curr_actor->uCurrentActionLength = 0; @@ -348,50 +344,44 @@ if ( turn_stage == 1 ) { - if ( field_8 == 64 ) + if ( ai_turn_timer == 64 ) + ActorAISetMovementDecision(); + else if ( ai_turn_timer > 0 ) + ActorAIDoAdditionalMove(); + else { - _406A63(); + ActorAIStopMovement(); + turn_initiative = 100; } - else if ( field_8 > 0 ) - { - _406B9F(); - } - else - { - _406AFE(); - field_10 = 100; - } - field_8 -= pEventTimer->uTimeElapsed; + ai_turn_timer -= pEventTimer->uTimeElapsed; } else if ( turn_stage == 2 ) { - if ( !(field_18 & TE_FLAG_1) ) + if ( field_18 == TE_FLAG_1) { - if ( field_10 == 100 ) + if ( turn_initiative == 100 ) { StartTurn(); - _40652A(); + SetAIRecoveryTimes(); + return; } - if ( field_10 > 0 || pQueue[0].field_4 <= 0 ) + if ( turn_initiative > 0 || pQueue[0].actor_initiative <= 0 ) { _4065B0(); - _40652A(); + SetAIRecoveryTimes(); } } - else - NextTurn(); + NextTurn(); } else if ( turn_stage == 3 ) { - if ( uActionPointsLeft <= 0 || field_18 & TE_FLAG_8 ) - { + if ( (uActionPointsLeft > 0) && (field_18 == TE_FLAG_8) ) + ActorAIChooseNewTargets(); + else + { field_18 &= ~TE_FLAG_8; turn_stage = 1; - field_8 = 64; - } - else - { - _406FA8(); + ai_turn_timer = 64; } } } @@ -402,7 +392,8 @@ { int player_num, actor_num, i, j; - field_1C = 0; + pending_actions = 0; + //add player to queue if he can act for(player_num=0; player_num<4; ++player_num) { for(j=0; j 0)) - break; - _40680F(i); - } + StepTurnQueue(); + for(i=0; i 0)) + break; + AI_Action_(i); + } } // 4F75D8: using guessed type int ai_arrays_size; @@ -477,13 +468,13 @@ uActiveCharacter = 0; viewparams->bRedrawGameUI = 1; - if ( field_1C ) + if ( pending_actions ) { - pTurnEngine->field_18 |= TE_FLAG_2; + pTurnEngine->field_18 |= TE_HAVE_PENDING_ACTIONS; return; } - pTurnEngine->field_18 &= ~TE_FLAG_2; - if ( pQueue[0].field_4 <= 0 ) + pTurnEngine->field_18 &= ~TE_HAVE_PENDING_ACTIONS; + if ( pQueue[0].actor_initiative <= 0 ) return; v13 = 0; @@ -505,7 +496,7 @@ { v13 = 1; } - else if ( ai_state == 4 )// Dying + else if ( ai_state == AIState::Dying )// Dying { curr_actor->uAIState = AIState::Dead; curr_actor->uCurrentActionTime = 0; @@ -514,7 +505,7 @@ } else { - if ( ai_state == 8 ) //Stunned + if ( ai_state == AIState::Stunned ) //Stunned Actor::AI_StandOrBored(PID_ID(pQueue[i].uPackedID), ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)], 32, 0); } } @@ -527,7 +518,8 @@ } } - field_18 &= ~TE_FLAG_1; + field_18 &= ~TE_FLAG_1; + //set all actors to stay for (i=0; iuTimePlayed += 213i64; _494035_timed_effects__water_walking_damage__etc(); @@ -552,14 +545,14 @@ } //----- (004063A1) -------------------------------------------------------- - int stru262_TurnBased::_4063A1() + int stru262_TurnBased::StepTurnQueue() { int v9; // dx@12 int j; SortTurnQueue(); viewparams->bRedrawGameUI = 1; - if ( pQueue[0].field_4 ) + if ( pQueue[0].actor_initiative!=0 ) { if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player) { @@ -567,33 +560,36 @@ { for (j=0; j 0); + while (pQueue[0].actor_initiative != 0); } else { + if ( pQueue[0].actor_initiative>0 ) + { v9 = pActors[PID_ID(pQueue[0].uPackedID)].uAIState; if (!(v9 == AIState::Dying || v9 == AIState::Dead || v9 == AIState::Disabled || v9 == AIState::Removed)) { - do + do { for (j=0; j 0); + while (pQueue[0].actor_initiative > 0); + } } } } @@ -603,17 +599,10 @@ //----- (00406457) -------------------------------------------------------- void stru262_TurnBased::_406457( int a2 ) { - stru262_TurnBased *v2; // esi@1 - signed int v3; // eax@1 signed int v4; // ecx@2 - char *v5; // edx@2 signed int v6; // eax@2 - int result; // eax@11 - int v8; // edx@13 - int v9; // ecx@14 - char v10; // zf@15 int i; - + v6=0; if ( PID_TYPE(pQueue[a2].uPackedID) == OBJECT_Player) { v4 = PID_ID(pQueue[a2].uPackedID); @@ -629,30 +618,30 @@ v6 = pMonsterStats->pInfos[pActors[PID_ID(pQueue[a2].uPackedID)].pMonsterInfo.uID].uRecoveryTime; } - pQueue[a2].field_4 = v6; + pQueue[a2].actor_initiative = v6; SortTurnQueue(); if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player) uActiveCharacter = PID_ID(pQueue[0].uPackedID) + 1; else uActiveCharacter = 0; viewparams->bRedrawGameUI = 1; - if (pQueue[0].field_4 > 0) + if (pQueue[0].actor_initiative > 0) { - while(field_10 > 0) + while(turn_initiative > 0) { for (i=0; ipInfos[monster->pMonsterInfo.uID].uRecoveryTime; + pQueue[i].actor_initiative = pMonsterStats->pInfos[monster->pMonsterInfo.uID].uRecoveryTime; if (monster->pActorBuffs[7].uExpireTime > 0) - pQueue[i].field_4*=2; + pQueue[i].actor_initiative*=2; } } } @@ -684,19 +673,19 @@ int i; SortTurnQueue(); - if (pQueue[0].field_4 <= 0) + if (pQueue[0].actor_initiative <= 0) { for (i=0; i 0) ) + if ((PID_TYPE(pQueue[i].uPackedID)==OBJECT_Player)|| (pQueue[i].actor_initiative > 0) ) break; if ((pQueue[i].uActionLength<=0) && (PID_TYPE(pQueue[i].uPackedID)==OBJECT_Actor)) - _40680F(i); + AI_Action_(i); } } else { - _4063A1(); + StepTurnQueue(); if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player) uActiveCharacter = PID_ID(pQueue[0].uPackedID) + 1; else @@ -705,35 +694,17 @@ } for (i=0; ipMonsterInfo.uHostilityType == 4 && v22 && (signed int)v9 < 5120 ) { v14 = stru_50C198.special_ability_use_check(v5, actor_id); - v21->field_C = 0; + v21->AI_action_type = TE_AI_STAND; switch (v14) { case 1: if ( v5->pMonsterInfo.uMissleAttack2Type ) { Actor::AI_MissileAttack2(actor_id, v22, &v18); - v21->field_C = 1; + v21->AI_action_type = TE_AI_RANGED_ATTACK; } break; case 2: if(v5->pMonsterInfo.uSpell1ID) { Actor::AI_SpellAttack1(actor_id, v22, &v18); - v21->field_C = 1; + v21->AI_action_type = TE_AI_RANGED_ATTACK; } break; case 3: if(v5->pMonsterInfo.uSpell2ID) { Actor::AI_SpellAttack2(actor_id, v22, &v18); - v21->field_C = 1; + v21->AI_action_type = TE_AI_RANGED_ATTACK; } break; @@ -914,25 +880,25 @@ if ( v5->pMonsterInfo.uMissleAttack1Type ) { Actor::AI_MissileAttack1(actor_id, v22, &v18); - v21->field_C = 1; + v21->AI_action_type = TE_AI_RANGED_ATTACK; } } - if (!v21->field_C) + if (!v21->AI_action_type) if ( (double)v20 < 307.2) { Actor::AI_MeleeAttack(actor_id, v22, &v18); - v21->field_C = 3; + v21->AI_action_type = TE_AI_MELEE_ATTACK; } else { Actor::AI_Stand(actor_id, v22, 64, &v18); - v21->field_C = 0; + v21->AI_action_type = TE_AI_STAND; } } else { Actor::AI_Stand(actor_id, v22, 64, &v18); - v21->field_C = 0; + v21->AI_action_type = TE_AI_STAND; } v21->uActionLength = v5->uCurrentActionLength; } @@ -940,7 +906,7 @@ } //----- (00406A63) -------------------------------------------------------- -void stru262_TurnBased::_406A63() +void stru262_TurnBased::ActorAISetMovementDecision() { AIDirection a3; // [sp+8h] [bp-44h]@5 @@ -948,7 +914,7 @@ unsigned int target_pid; // [sp+40h] [bp-Ch]@5 int i; - this->field_8 = 64; + this->ai_turn_timer = 64; dword_50C994 = 0; uActiveCharacter = 0; for (i=0; iuAIState = AIState::Dead; v6->UpdateAnimation(); } - if ( !ActorTurn(i) ) + if ( !ActorMove(i) ) Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), v13, 32, &v9); } } @@ -1034,164 +1000,131 @@ } //----- (00406D10) -------------------------------------------------------- -bool stru262_TurnBased::ActorTurn(signed int a2) +bool stru262_TurnBased::ActorMove(signed int queue_position) { int v2; // ecx@1 //int v3; // ecx@2 Actor *actor; // ebx@2 - //unsigned __int16 v5; // dx@2 - int *v6; // esi@7 - TurnBased_QueueElem *v7; // edi@7 - int v8; // eax@7 + AIDirection *v9; // esi@10 int v10; // eax@10 - unsigned int v11; // ecx@10 + int v11; // ecx@10 unsigned __int8 pHostileType; // al@12 - unsigned __int8 v13; // sf@16 - unsigned __int8 v14; // of@16 - unsigned int v15; // edx@22 - unsigned int v16; // ecx@23 - TurnBased_QueueElem *v17; // eax@25 - double v18; // st7@33 - double v19; // st6@33 AIDirection a3; // [sp+Ch] [bp-48h]@10 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 - int v27; // [sp+44h] [bp-10h]@33 - unsigned int v28; // [sp+48h] [bp-Ch]@10 + int v28; // [sp+48h] [bp-Ch]@10 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 unsigned int uActorID; // [sp+50h] [bp-4h]@2 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 // __debugbreak();// - v2 = pQueue[a2].uPackedID; + v2 = pQueue[queue_position].uPackedID; if (PID_TYPE(v2) == OBJECT_Player) return 0; uActorID = PID_ID(v2); //uActorID = v3; actor = &pActors[uActorID]; //v5 = v4->uAIState; - if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) + if ( actor->uAIState == AIState::Dead || actor->uAIState == AIState::Dying || + actor->uAIState == AIState::Removed|| actor->uAIState == AIState::Disabled || + actor->uAIState == AIState::Summoned ) return 1; - v6 = &ai_near_actors_targets_pid[uActorID]; - v7 = &pTurnEngine->pQueue[a2]; - v8 = *v6; - v29 = &pTurnEngine->pQueue[a2]; - a2a = v8; + v29 = &pTurnEngine->pQueue[queue_position]; + a2a = ai_near_actors_targets_pid[uActorID]; Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); - if ( actor->pMonsterInfo.uHostilityType && !*v6 ) + if ( actor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[uActorID] ) actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); + v9 = Actor::GetDirectionInfo(pQueue[queue_position].uPackedID, ai_near_actors_targets_pid[uActorID], &a3, 0); v10 = actor->uActorRadius; - memcpy(&a3, v9, sizeof(a3)); - memcpy(&pDir, &a3, sizeof(pDir)); + memcpy(&a3, v9, sizeof(AIDirection)); + memcpy(&pDir, &a3, sizeof(AIDirection)); v11 = a3.uDistance - v10; v28 = a3.uDistance - v10; - if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) + if ( v28 < 0 ) { v11 = 0; v28 = 0; } pHostileType = actor->pMonsterInfo.uHostilityType; - if ( pHostileType == 1 ) - { - if ( (double)(signed int)v28 >= 307.2 ) - goto LABEL_21; - actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; - goto LABEL_21; - } - if ( pHostileType == 2 ) - { - v14 = __OFSUB__(v11, 1024); - v13 = ((v11 - 1024) & 0x80000000u) != 0; - } - else + + switch (pHostileType) { - if ( pHostileType != 3 ) - goto LABEL_21; - v14 = __OFSUB__(v11, 2560); - v13 = ((v11 - 2560) & 0x80000000u) != 0; + case 1: + if ( (double)v28 < 307.2 ) + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + break; + case 2: + if ( v28 < 1024 ) + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + break; + case 3: + if ( v28 < 2560 ) + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + break; } - if ( v13 ^ v14 ) + + if ( actor->pActorBuffs[4].uExpireTime > 0 ) { - actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; - } -LABEL_21: - if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) - { - if ( (signed int)v11 < 10240 ) + if (v11 < 10240 ) { Actor::AI_Flee(uActorID, a2a, 0, &pDir); - v29->field_C = 4; - v29->uActionLength = actor->uCurrentActionLength; - return 1; + v29->AI_action_type = 4; } - Actor::AI_4032B2(uActorID, a2a, 1024, 0); - v29->field_C = 2; + else + { + Actor::AI_4032B2(uActorID, a2a, 1024, 0); + v29->AI_action_type = TE_AI_PURSUE; + } + v29->uActionLength = actor->uCurrentActionLength; return 1; } - if ( actor->pMonsterInfo.uHostilityType != 4 ) - goto LABEL_46; + + if ( actor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long ) + { if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) { if ( actor->pMonsterInfo.uAIType == 1 ) { if ( actor->pMonsterInfo.uMovementType == 5 ) - { Actor::AI_Stand(uActorID, a2a, 32, 0); - v29->field_C = 4; - v29->uActionLength = actor->uCurrentActionLength; - return 1; - } - Actor::AI_Flee(uActorID, a2a, 32, 0); - v29->field_C = 4; + else + Actor::AI_Flee(uActorID, a2a, 32, 0); + v29->AI_action_type = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uAIType == 2 ) { - v27 = actor->sCurrentHP; - v18 = (double)v27; - v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; - if ( v19 > v18 && (signed int)v11 < 10240 ) + + if (((double)actor->pMonsterInfo.uHP * 0.2) > (double)actor->sCurrentHP && (v11 < 10240 ) ) { if ( actor->pMonsterInfo.uMovementType == 5 ) - { Actor::AI_Stand(uActorID, a2a, 32, 0); - v29->field_C = 4; - v29->uActionLength = actor->uCurrentActionLength; - return 1; - } - Actor::AI_Flee(uActorID, a2a, 32, 0); - v29->field_C = 4; + else + Actor::AI_Flee(uActorID, a2a, 32, 0); + v29->AI_action_type = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; } - goto LABEL_39; } if ( actor->pMonsterInfo.uAIType == 3 ) { - v27 = actor->sCurrentHP; - v18 = (double)v27; - v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; - if ( v19 > v18 && (signed int)v11 < 10240 ) + + if ( ((double)actor->pMonsterInfo.uHP * 0.1) > (double)actor->sCurrentHP && (v11 < 10240 )) { if ( actor->pMonsterInfo.uMovementType == 5 ) - { Actor::AI_Stand(uActorID, a2a, 32, 0); - v29->field_C = 4; - v29->uActionLength = actor->uCurrentActionLength; - return 1; - } - Actor::AI_Flee(uActorID, a2a, 32, 0); - v29->field_C = 4; + else + Actor::AI_Flee(uActorID, a2a, 32, 0); + v29->AI_action_type = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; } - goto LABEL_39; + } } -LABEL_39: + if ( (double)(signed int)v28 < 307.2 ) return 0; if ( (signed int)v11 < 5120 ) @@ -1200,51 +1133,38 @@ Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir); else Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307); - v29->field_C = 2; - v29->uActionLength = actor->uCurrentActionLength; - return 1; - } -LABEL_46: - if ( actor->pMonsterInfo.uMovementType == 0 ) - { - Actor::AI_4032B2(uActorID, a2a, 1024, 32); - v29->field_C = 2; - v29->uActionLength = actor->uCurrentActionLength; - return 1; - } - if ( actor->pMonsterInfo.uMovementType == 1 ) - { - Actor::AI_4032B2(uActorID, a2a, 2560, 32); - v29->field_C = 2; + v29->AI_action_type = TE_AI_PURSUE; v29->uActionLength = actor->uCurrentActionLength; return 1; } - if ( actor->pMonsterInfo.uMovementType == 2 ) - { - Actor::AI_4032B2(uActorID, a2a, 5120, 32); - v29->field_C = 2; - v29->uActionLength = actor->uCurrentActionLength; - return 1; } - if ( actor->pMonsterInfo.uMovementType == 4 ) + switch(actor->pMonsterInfo.uMovementType) { - Actor::AI_4032B2(uActorID, a2a, 10240, 32); - v29->field_C = 2; - v29->uActionLength = actor->uCurrentActionLength; - return 1; + case 0: + Actor::AI_4032B2(uActorID, a2a, 1024, 32); + break; + case 1: + Actor::AI_4032B2(uActorID, a2a, 2560, 32); + break; + case 2: + Actor::AI_4032B2(uActorID, a2a, 5120, 32); + break; + case 4: + Actor::AI_4032B2(uActorID, a2a, 10240, 32); + break; + case 5: + Actor::AI_Stand(uActorID, a2a, 32, 0); + break; + default: + return 1; } - if ( actor->pMonsterInfo.uMovementType == 5 ) - { - Actor::AI_Stand(uActorID, a2a, 32, 0); - v29->field_C = 2; - v29->uActionLength = actor->uCurrentActionLength; - return 1; - } + v29->AI_action_type = TE_AI_PURSUE; + v29->uActionLength = actor->uCurrentActionLength; return 1; } //----- (00406FA8) -------------------------------------------------------- -void stru262_TurnBased::_406FA8() +void stru262_TurnBased::ActorAIChooseNewTargets() { Actor *curr_acror; // ebx@4 AIDirection a3; // [sp+Ch] [bp-6Ch]@8 diff -r f682c853200d -r b330df6a2183 TurnEngine.h --- a/TurnEngine.h Sun Aug 11 12:09:09 2013 +0600 +++ b/TurnEngine.h Sun Aug 11 12:09:33 2013 +0600 @@ -4,11 +4,21 @@ enum TURN_ENGINE_FLAGS { TE_FLAG_1 =1, - TE_FLAG_2 =2, + TE_HAVE_PENDING_ACTIONS =2, TE_PLAYER_TURN =4, TE_FLAG_8 =8 }; +enum TURN_ENGINE_AI_ACTION + { + TE_AI_STAND =0, + TE_AI_RANGED_ATTACK =1, + TE_AI_PURSUE =2, + TE_AI_MELEE_ATTACK =3, + TE_AI_FLEE =4 + }; + + /* 299 */ #pragma pack(push, 1) @@ -17,14 +27,14 @@ inline TurnBased_QueueElem() { uPackedID = 0; - field_4 = 0; + actor_initiative = 0; uActionLength = 0; - field_C = 0; + AI_action_type = 0; } int uPackedID; - int field_4; + int actor_initiative; //act first who have less int uActionLength; - int field_C; + int AI_action_type; }; #pragma pack(pop) @@ -34,44 +44,44 @@ { inline stru262_TurnBased() { - field_0 = 0; + turns_count = 0; turn_stage = 0; - field_8 = 0; + ai_turn_timer = 0; uActorQueueSize = 0; - field_10 = 0; + turn_initiative = 0; uActionPointsLeft = 0; field_18 = 0; - field_1C = 0; + pending_actions = 0; } void SortTurnQueue(); - void _40471C(); + void ApplyPlayerAction(); void Start(); void End(bool bPlaySound); - void _405E14(); + void AITurnBasedAction(); void StartTurn(); void NextTurn(); - int _4063A1(); + int StepTurnQueue(); void _406457(int a2); - void _40652A(); + void SetAIRecoveryTimes(); void _4065B0(); - void AIRangedAttacks(unsigned int queue_index); - void _40680F(int queue_index); - void _406A63(); - void _406AFE(); - void _406B9F(); - bool ActorTurn(signed int a2); - void _406FA8(); + void AIAttacks(unsigned int queue_index); + void AI_Action_(int queue_index); + void ActorAISetMovementDecision(); + void ActorAIStopMovement(); + void ActorAIDoAdditionalMove(); + bool ActorMove(signed int a2); + void ActorAIChooseNewTargets(); - int field_0; + int turns_count; int turn_stage; - int field_8; + int ai_turn_timer; int uActorQueueSize; //c - int field_10; + int turn_initiative; int uActionPointsLeft; //14 int field_18; - int field_1C; + int pending_actions; TurnBased_QueueElem pQueue[504]; //20 }; #pragma pack(pop) diff -r f682c853200d -r b330df6a2183 UI/Books/UIMapBook.cpp --- a/UI/Books/UIMapBook.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -108,13 +108,13 @@ pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3); if ( bRecallingBeacon ) { - pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on); - v19 = pTex_tab_an_6a__zoom_off; + pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on); + v19 = pTex_book_button1_off; } else { - pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off); - v19 = pTex_tab_an_6b__zoom_on; + pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off); + v19 = pTex_book_button1_on; } pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); uNumMaxBeacons = 1; @@ -192,90 +192,40 @@ void BookUI_Map_Draw() { unsigned int map_id; // eax@35 - Texture *buttnTxtr; // [sp-4h] [bp-DCh]@3 char party_coord[120]; // [sp+Ch] [bp-CCh]@37 GUIWindow map_window; // [sp+84h] [bp-54h]@35 - unsigned int textrX, textrY; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); - if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 ) - { - buttnTxtr = pTex_tab_an_6a__zoom_off; - textrY = pViewport->uViewportTL_Y + 2; - textrX = pViewport->uViewportTL_X + 408; - } + if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )//Button 1 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - { - buttnTxtr = pTex_tab_an_6b__zoom_on; - textrY = pViewport->uViewportTL_Y + 1; - textrX = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 ) - { - buttnTxtr = pTex_tab_an_7a__zoot_off; - textrY = pViewport->uViewportTL_Y + 38; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + + if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )//Button 2 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - { - buttnTxtr = pTex_tab_an_7b__zoot_on; - textrY = pViewport->uViewportTL_Y + 38; - textrX = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn3_flag ) - { - buttnTxtr = pTexture_506390; - textrY = pViewport->uViewportTL_Y + 113; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + + if ( Book_PageBtn3_flag )//Button 3 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); else - { - buttnTxtr = pTexture_506394; - textrY = pViewport->uViewportTL_Y + 113; - textrX = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn4_flag ) - { - buttnTxtr = pTexture_506388; - textrY = pViewport->uViewportTL_X + 150; - textrX = pViewport->uViewportTL_Y + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + + if ( Book_PageBtn4_flag )//Button 4 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); else - { - buttnTxtr = pTexture_50638C; - textrY = pViewport->uViewportTL_X + 150; - textrX = pViewport->uViewportTL_Y + 399; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn5_flag ) - { - buttnTxtr = pTexture_506380; - textrY = pViewport->uViewportTL_Y + 188; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + + if ( Book_PageBtn5_flag )//Button 5 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); else - { - buttnTxtr = pTexture_506384; - textrY = pViewport->uViewportTL_Y + 188; - textrX = pViewport->uViewportTL_X + 397; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( Book_PageBtn6_flag ) - { - buttnTxtr = pTexture_506378; - textrY = pViewport->uViewportTL_Y + 226; - textrX = pViewport->uViewportTL_X + 408; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + + if ( Book_PageBtn6_flag )//Button 6 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); else - { - buttnTxtr = pTexture_50637C; - textrY = pViewport->uViewportTL_Y + 226; - textrX = pViewport->uViewportTL_X + 397; - } - pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + if ( BtnDown_flag ) viewparams->CenterOnParty2(); if ( BtnUp_flag ) diff -r f682c853200d -r b330df6a2183 UI/Books/UINotesBooks.cpp --- a/UI/Books/UINotesBooks.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/UI/Books/UINotesBooks.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -4,7 +4,6 @@ #endif #include - #include "..\..\MM7.h" #include "..\..\Render.h" #include "..\..\Mouse.h" @@ -14,33 +13,27 @@ #include "..\..\GUIFont.h" #include "..\..\Party.h" #include "..\..\AudioPlayer.h" -//#include "..\Outdoor.h" #include "..\..\LOD.h" #include "..\..\Allocator.h" #include "..\..\Viewport.h" -//#include "..\Math.h" #include "..\..\Awards.h" #include "..\..\Autonotes.h" #include "..\..\StorylineTextTable.h" #include "..\..\texts.h" -// #include "..\..\mm7_data.h" - - - //----- (00413D3C) -------------------------------------------------------- static const char *GetDayPart() - { - if (pParty->uCurrentHour <= 4) - return pGlobalTXT_LocalizationStrings[567]; // "Night" - else if (pParty->uCurrentHour == 5) - return pGlobalTXT_LocalizationStrings[55]; // "Dawn" - else if (pParty->uCurrentHour == 20) - return pGlobalTXT_LocalizationStrings[566]; // "Dusk" - else - return pGlobalTXT_LocalizationStrings[56]; // "Day" - } +{ + if ( pParty->uCurrentHour > 5 && pParty->uCurrentHour < 20 ) + return pGlobalTXT_LocalizationStrings[56]; // "Day" + else if ( pParty->uCurrentHour == 5 ) + return pGlobalTXT_LocalizationStrings[55]; // "Dawn" + else if ( pParty->uCurrentHour == 20 ) + return pGlobalTXT_LocalizationStrings[566]; // "Dusk" + else + return pGlobalTXT_LocalizationStrings[567]; // "Night" +} //----- (00413D6F) -------------------------------------------------------- void BookUI_Calendar_Draw() @@ -118,15 +111,16 @@ pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up( ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_tab_an_6a__zoom_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )//Bookmark Down( ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_tab_an_7a__zoot_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + //for title questbook_window.uFrameWidth = game_viewport_width; questbook_window.uFrameHeight = game_viewport_height; questbook_window.uFrameX = game_viewport_x; @@ -135,19 +129,20 @@ questbook_window.uFrameW = game_viewport_w; questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" + //for other text questbook_window.uFrameX = 48; questbook_window.uFrameY = 70; questbook_window.uFrameWidth = 360; questbook_window.uFrameHeight = 264; questbook_window.uFrameZ = 407; questbook_window.uFrameW = 333; - if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down + if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down( ) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); books_primary_item_per_page += num_achieved_awards; books_num_items_per_page[books_page_number++] = num_achieved_awards; } - if ( BtnUp_flag && books_page_number )//Click Bookmark Up + if ( BtnUp_flag && books_page_number )//Click Bookmark Up( ) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); --books_page_number; @@ -164,8 +159,7 @@ for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) { ++num_achieved_awards; - //v5 = pQuestTable[achieved_awards[v3]];//(&dword_722F10)[4 * v4]; - questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); + questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); if ( (signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight ) break; @@ -177,166 +171,143 @@ //----- (0041338E) -------------------------------------------------------- void BookUI_Autonotes_Draw() { - unsigned int v3; // eax@18 - unsigned int v4; // eax@24 - unsigned int v5; // eax@30 - unsigned int v6; // eax@36 - unsigned int v7; // eax@42 - signed int v8; // ebp@47 - int v9; // eax@52 - int v10; // eax@56 - int v11; // edx@57 - int v12; // ebp@64 - int v13; // eax@65 - const char *v14; // edi@65 - int v15; // eax@65 - unsigned int v16; // edi@65 - unsigned int v19; // [sp-8h] [bp-70h]@18 - unsigned int v20; // [sp-8h] [bp-70h]@24 - unsigned int v21; // [sp-8h] [bp-70h]@30 - unsigned int v22; // [sp-8h] [bp-70h]@36 - unsigned int v23; // [sp-8h] [bp-70h]@42 - Texture *v26; // [sp-4h] [bp-6Ch]@18 - Texture *v27; // [sp-4h] [bp-6Ch]@24 - Texture *v28; // [sp-4h] [bp-6Ch]@30 - Texture *v29; // [sp-4h] [bp-6Ch]@36 - Texture *v30; // [sp-4h] [bp-6Ch]@42 - signed __int16 v31; // [sp+10h] [bp-58h]@1 - char *v32; // [sp+10h] [bp-58h]@49 + int pTextHeight; // eax@65 + bool change_flag; // [sp+10h] [bp-58h]@1 GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 - v31 = 0; + change_flag = false; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); if ( BtnUp_flag || !books_primary_item_per_page ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_tab_an_6a__zoom_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_tab_an_7a__zoot_off); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); if ( Book_PageBtn3_flag )//Potions_page_flag { if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again( ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); else//press() { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_POTION_RECEPIE; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); } } else { if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default( ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); else//Potions_page not active( ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTexture_506390); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); } if ( Book_PageBtn4_flag )//Fontains_page_flag { if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTexture_50638C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_STAT_HINT; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTexture_50638C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); } } else { if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTexture_50638C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTexture_506388); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); } if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag { if ( _506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTexture_506384); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_OBELISK; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTexture_506384); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); } } else { if ( _506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTexture_506384); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTexture_506380); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); } if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag { if ( _506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTexture_50637C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_SEER; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTexture_50637C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); } } else { if ( _506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTexture_50637C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTexture_506378); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); } if ( Autonotes_Misc_page_flag ) { if ( _506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTexture_506374); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_MISC; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTexture_506374); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); } } else { if ( _506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTexture_506374); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTexture_506370); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); } if ( Autonotes_Instructors_page_flag ) { if ( _506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTexture_50636C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); else { - v31 = 1; + change_flag = true; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_TEACHER; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTexture_50636C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); } } else { if ( _506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTexture_50636C); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTexture_506368); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); } + //for title autonotes_window.uFrameWidth = game_viewport_width; autonotes_window.uFrameHeight = game_viewport_height; autonotes_window.uFrameX = game_viewport_x; @@ -345,171 +316,117 @@ autonotes_window.uFrameW = game_viewport_w; autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" + //for other text autonotes_window.uFrameX = 48; autonotes_window.uFrameY = 70; autonotes_window.uFrameWidth = 360; autonotes_window.uFrameHeight = 264; autonotes_window.uFrameZ = 407; autonotes_window.uFrameW = 333; - if ( v31 ) + if ( change_flag )//change bookmark( ) { full_num_items_in_book = 0; books_primary_item_per_page = 0; books_page_number = 0; num_achieved_awards = 0; - v8 = 0; - do + for ( uint i = 1; i <= 195; ++i ) { - //if ( dword_72371C[2 * v8] == dword_506568 ) - if ( pAutonoteTxt[v8].eType == _506568_autonote_type ) + if ( pAutonoteTxt[i].eType == _506568_autonote_type ) { - //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; - v32 = (char *)pAutonoteTxt[v8].pText; - if ( (short)v8 ) - { - if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) - { - v9 = num_achieved_awards++; - achieved_awards[v9] = (AwardType)v8; - } - } + if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText ) + achieved_awards[num_achieved_awards++] = (AwardType)i; } - ++v8; } - while ( v8 < 196 ); full_num_items_in_book = num_achieved_awards; } - else + else//not change bookmark( ) { - if ( BtnDown_flag ) + if ( BtnDown_flag )// press Down bookmark( ) { - v10 = num_achieved_awards + books_primary_item_per_page; if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book ) { - v11 = books_page_number++; - books_num_items_per_page[v11] = num_achieved_awards; - books_primary_item_per_page = v10; + books_num_items_per_page[books_page_number++] = num_achieved_awards; + books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page; pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); } } - if ( BtnUp_flag && books_page_number ) + if ( BtnUp_flag && books_page_number )// press Up bookmark( ) { --books_page_number; books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); } - if ( !num_achieved_awards || books_primary_item_per_page < 1 ) + if ( !num_achieved_awards || !books_primary_item_per_page )// 0 0 { books_primary_item_per_page = 0; books_page_number = 0; } } - v12 = books_primary_item_per_page; - Autonotes_Instructors_page_flag = 0; + BtnUp_flag = 0; BtnDown_flag = 0; - BtnUp_flag = 0; - num_achieved_awards = 0; + Book_PageBtn3_flag = 0;//Potions_page_flag + Book_PageBtn4_flag = 0;//Fontains_page_flag + Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag + Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag Autonotes_Misc_page_flag = 0; - Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag - Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag - Book_PageBtn4_flag = 0;//Fontains_page_flag - Book_PageBtn3_flag = 0;//Potions_page_flag - while ( v12 < full_num_items_in_book ) + Autonotes_Instructors_page_flag = 0; + num_achieved_awards = 0; + for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) { - v13 = achieved_awards[v12]; ++num_achieved_awards; - //v14 = (&dword_723718_autonote_related)[8 * v13]; - v14 = pAutonoteTxt[v13].pText; - //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); - autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13].pText, 0, 0, 0); - v15 = pAutonoteFont->CalcTextHeight(v14, &autonotes_window, 1, 0); - v16 = autonotes_window.uFrameY + v15; - if ( (signed int)(autonotes_window.uFrameY + v15) > (signed int)autonotes_window.uFrameHeight ) + autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0); + pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0); + if ( (signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight ) break; - pRenderer->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10); - ++v12; - autonotes_window.uFrameY = v16 + 24; + pRenderer->DrawTextureTransparent(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); + autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; } } //----- (00412E85) -------------------------------------------------------- void BookUI_Journal_Draw() { - unsigned int v0; // eax@3 - unsigned int v1; // eax@7 - int v2; // eax@10 - const char *v3; // eax@10 - signed int v4; // ecx@12 - int v5; // ecx@14 - int v6; // eax@21 - int v7; // esi@21 - char *v8; // eax@21 - char* v9; // eax@22 - unsigned int v11; // [sp-8h] [bp-64h]@3 - unsigned int v12; // [sp-8h] [bp-64h]@7 - Texture *v13; // [sp-4h] [bp-60h]@3 - Texture *v14; // [sp-4h] [bp-60h]@7 - GUIWindow a1; // [sp+8h] [bp-54h]@10 + char *pDialogueString; // eax@21 + char* pStringOnPage; // eax@22 + GUIWindow journal_window; // [sp+8h] [bp-54h]@10 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); if ( BtnUp_flag || !books_primary_item_per_page ) - { - v13 = pTex_tab_an_6a__zoom_off; - v11 = pViewport->uViewportTL_Y + 2; - v0 = pViewport->uViewportTL_X + 407; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else - { - v13 = pTex_tab_an_6b__zoom_on; - v11 = pViewport->uViewportTL_Y + 1; - v0 = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(v0, v11, v13); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) - { - v14 = pTex_tab_an_7a__zoot_off; - v12 = pViewport->uViewportTL_Y + 38; - v1 = pViewport->uViewportTL_X + 407; - } + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else - { - v14 = pTex_tab_an_7b__zoot_on; - v12 = pViewport->uViewportTL_Y + 38; - v1 = pViewport->uViewportTL_X + 398; - } - pRenderer->DrawTextureTransparent(v1, v12, v14); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); - if ( !byte_5C6D50[books_primary_item_per_page] ) + if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title { - v2 = achieved_awards[books_primary_item_per_page]; - a1.uFrameWidth = game_viewport_width; - a1.uFrameX = game_viewport_x; - a1.uFrameY = game_viewport_y; - a1.uFrameHeight = game_viewport_height; - v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[]; - a1.uFrameZ = game_viewport_z; - a1.uFrameW = game_viewport_w; - if ( v3 ) - a1.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, v3, 3); + journal_window.uFrameWidth = game_viewport_width; + journal_window.uFrameX = game_viewport_x; + journal_window.uFrameY = game_viewport_y; + journal_window.uFrameHeight = game_viewport_height; + journal_window.uFrameZ = game_viewport_z; + journal_window.uFrameW = game_viewport_w; + if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle ) + journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, (const char *)pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); } - a1.uFrameX = 48; - a1.uFrameY = 70; - a1.uFrameWidth = 360; - a1.uFrameHeight = 264; - v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3; - a1.uFrameZ = 407; - a1.uFrameHeight = v4 * 264 / v4; - a1.uFrameW = a1.uFrameHeight + 69; - if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book ) + //for other text + journal_window.uFrameX = 48; + journal_window.uFrameY = 70; + journal_window.uFrameWidth = 360; + journal_window.uFrameHeight = 264; + journal_window.uFrameZ = 407; + journal_window.uFrameW = journal_window.uFrameHeight + 69; + if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Press bookmark next page { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - v5 = books_page_number++; books_primary_item_per_page += num_achieved_awards; - books_num_items_per_page[v5] = num_achieved_awards; + books_num_items_per_page[books_page_number++] = num_achieved_awards; } - if ( BtnUp_flag && books_page_number ) + if ( BtnUp_flag && books_page_number )//Press bookmark previous page { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); --books_page_number; @@ -521,17 +438,15 @@ books_page_number = 0; } BtnDown_flag = 0; - v6 = achieved_awards[books_primary_item_per_page]; BtnUp_flag = 0; num_achieved_awards = 0; - //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); - v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); - v8 = BuildDialogueString(pStorylineText->StoreLine[v6].pText, uActiveCharacter - 1, 0, 0, 0, (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); - if ( v7 ) + pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1, + 0, 0, 0, (__int64 *)&pParty->field_3C._s_times[achieved_awards[books_primary_item_per_page] + 21]); + if ( achieved_awards[books_primary_item_per_page] ) { - v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[books_primary_item_per_page]); - a1.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, ui_book_journal_text_shadow); + pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]); + journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)pStringOnPage, 0, + journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); ++num_achieved_awards; } } - diff -r f682c853200d -r b330df6a2183 UI/Books/UISpellBook.cpp --- a/UI/Books/UISpellBook.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/UI/Books/UISpellBook.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -3,7 +3,6 @@ #endif #include - #include "..\..\MM7.h" #include "..\..\Render.h" #include "..\..\Mouse.h" @@ -16,10 +15,8 @@ #include "..\..\Allocator.h" #include "..\..\Viewport.h" #include "..\..\texts.h" -// #include "..\..\mm7_data.h" - std::array spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak //----- (00411300) -------------------------------------------------------- @@ -46,36 +43,30 @@ } } - - //----- (00411597) -------------------------------------------------------- void OnCloseBook() - { - pAllocator->FreeChunk(pSpellFont); - pSpellFont = nullptr; - pAllocator->FreeChunk(pBookFont); - pBookFont = nullptr; - pAllocator->FreeChunk(pBook2Font); - pBook2Font = nullptr; - pAllocator->FreeChunk(pAutonoteFont); - pAutonoteFont = nullptr; - pTexture_mapbordr->Release(); - pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); - pIcons_LOD->RemoveTexturesPackFromTextureList(); - dword_506364 = 0; - } - - +{ + pAllocator->FreeChunk(pSpellFont); + pSpellFont = nullptr; + pAllocator->FreeChunk(pBookFont); + pBookFont = nullptr; + pAllocator->FreeChunk(pBook2Font); + pBook2Font = nullptr; + pAllocator->FreeChunk(pAutonoteFont); + pAutonoteFont = nullptr; + pTexture_mapbordr->Release(); + pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); + pIcons_LOD->RemoveTexturesPackFromTextureList(); + dword_506364 = 0; +} //----- (00412AF9) -------------------------------------------------------- static void BookUI_Spellbook_DrawCurrentSchoolBackground() { - int v0; // ecx@1 - - v0 = 0; + int pTexID = 0; if ( uActiveCharacter ) - v0 = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2); - pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[v0]); + pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage; + pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[pTexID]); pRenderer->DrawTextureIndexed(476, 450, pSBQuickSpellBtnTextr); pRenderer->DrawTextureIndexed(561, 450, pSpellBookCloseBtnTextr); } diff -r f682c853200d -r b330df6a2183 UI/UIBooks.cpp --- a/UI/UIBooks.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/UI/UIBooks.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -3,9 +3,7 @@ #endif #include - #include "..\MM7.h" - #include "UIBooks.h" #include "..\Render.h" #include "..\GUIWindow.h" @@ -13,15 +11,8 @@ #include "..\AudioPlayer.h" #include "..\LOD.h" #include "..\Allocator.h" - - #include "..\mm7_data.h" - - - - - //----- (00413CC6) -------------------------------------------------------- void BookUI_Draw(WindowType book) { @@ -39,29 +30,19 @@ } } - - - - - - //----- (0041192C) -------------------------------------------------------- void InitializeBookTextures() { - pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); - //v0 = 1; static const char *texNames[9] = // 004E24EC { @@ -70,28 +51,23 @@ }; pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); - for (uint i = 0; i < 9; ++i) + for ( uint i = 0; i < 9; ++i ) { pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); - - sprintf(pTmpBuf.data(), "tab%da", i+1); + sprintf(pTmpBuf.data(), "tab%da", i + 1); pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - sprintf(pTmpBuf.data(), "tab%db", i+1); + sprintf(pTmpBuf.data(), "tab%db", i + 1); pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); } } - - //----- (00411AAA) -------------------------------------------------------- void InitializeBookFonts() { pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); @@ -100,14 +76,10 @@ pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); } - - - //----- (0041140B) -------------------------------------------------------- void OnCloseSpellBookPage() { GUIButton *pNextButton; // esi@4 - for ( uint i = 1; i <= 11; i++ ) { SBPageCSpellsTextureList[i]->Release(); @@ -135,7 +107,7 @@ pTexture_pagemask->Release(); pSpellBookCloseBtnTextr->Release(); pSBQuickSpellBtnTextr->Release(); - for (uint i = 0; i < 9; ++i) + for ( uint i = 0; i < 9; ++i ) { pSpellBookPagesTextr[i]->Release(); pTextures_tabs[i][0]->Release(); @@ -144,11 +116,3 @@ pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); pIcons_LOD->RemoveTexturesPackFromTextureList(); } - - - - - - - - diff -r f682c853200d -r b330df6a2183 UI/UICharacter.cpp --- a/UI/UICharacter.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/UI/UICharacter.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -3,11 +3,8 @@ #endif #include - #include - #include "..\MM7.h" - #include "..\MapInfo.h" #include "..\Game.h" #include "..\GUIWindow.h" @@ -23,7 +20,6 @@ #include "..\Awards.h" #include "..\CastSpellInfo.h" #include "..\texts.h" - #include "..\mm7_data.h" #include "..\Mouse.h" #include "..\Allocator.h" @@ -31,7 +27,6 @@ int bRingsShownInCharScreen; // 5118E0 - unsigned int ui_mainmenu_copyright_color; unsigned int ui_character_tooltip_header_default_color; @@ -91,7 +86,6 @@ unsigned int ui_house_player_cant_interact_color; - void set_default_ui_skin() { ui_mainmenu_copyright_color = TargetColor(255, 255, 255); @@ -186,11 +180,6 @@ ui_house_player_cant_interact_color = TargetColor(255, 255, 155); } - - - - - std::array papredoll_dbrds; unsigned int papredoll_drhs[4]; unsigned int papredoll_dlhus[4]; @@ -207,7 +196,6 @@ int paperdoll_helm_texture[2][16]; //511698 int paperdoll_belt_texture[4][7]; //511718 - const int paperdoll_Weapon[4][16][2] = {//4E4C30 {{128, 205}, {30, 144}, {88, 85}, {0, 0}, {0, 0}, {0, 0}, {17, 104}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, {{131, 201}, {38, 158}, {98, 87}, {0, 0}, {0, 0}, {0, 0}, {21, 100}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, @@ -215,8 +203,6 @@ {{123, 216}, {35, 184}, {98, 119}, {0, 0}, {0, 0}, {0, 0}, { 0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, }; - - const int paperdoll_Boot[4][7][2] = //4E5490 { 0xE, 0x11D, 0xD, 0x11D, 0xC, 0x10A, 0xA, 0xFF, 0xD, 0xF9, 0xD, 0x137, 0xC, 0x10E, @@ -384,9 +370,6 @@ const int pMagicSkills[9] = {PLAYER_SKILL_FIRE, PLAYER_SKILL_AIR, PLAYER_SKILL_WATER, PLAYER_SKILL_EARTH, PLAYER_SKILL_SPIRIT, PLAYER_SKILL_MIND, PLAYER_SKILL_BODY, PLAYER_SKILL_LIGHT, PLAYER_SKILL_DARK}; - - - //----- (00421626) -------------------------------------------------------- GUIWindow *CharacterUI_Initialize(unsigned int _this) { @@ -448,35 +431,30 @@ } //----- (004219BE) -------------------------------------------------------- -GUIWindow *CastSpellInfo::sub_4219BE() +GUIWindow *CastSpellInfo::GetCastSpellInInventoryWindow() { - GUIWindow *v2; // ebx@1 + GUIWindow *CS_inventory_window; // ebx@1 pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); bRingsShownInCharScreen = 0; CharacterUI_LoadPaperdollTextures(); pCurrentScreen = SCREEN_CASTING; - v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, (int)this, 0); - pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, + CS_inventory_window = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, (int)this, 0); + pCharacterScreen_ExitBtn = CS_inventory_window->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79], // Close pIcons_LOD->GetTexture(papredoll_dbrds[2]), pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); - v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); - pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - - v2->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - v2->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - v2->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - v2->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + CS_inventory_window->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); + pCharacterScreen_DollBtn = CS_inventory_window->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - return v2; -} - + CS_inventory_window->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + CS_inventory_window->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + CS_inventory_window->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + CS_inventory_window->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - - - + return CS_inventory_window; +} static int CharacterUI_SkillsTab_Draw__DrawSkillTable(Player *player, int x, int y, const int *skill_list, int skill_list_size, int right_margin, const char *skill_group_name) { @@ -486,7 +464,7 @@ pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf.data(), 0, 0, 0); int num_skills_drawn = 0; - for (uint i = 0; i < skill_list_size; ++i) + for (int i = 0; i < skill_list_size; ++i) { auto skill = (PLAYER_SKILL_TYPE)skill_list[i]; for (uint j = 0; j < pGUIWindow_CurrentMenu->uNumControls; ++j) @@ -540,7 +518,6 @@ if (!skill_mastery_color) skill_mastery_color = ui_character_header_text_color; - sprintfex(pTmpBuf.data(), "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, skill_level_str, skill_color, right_margin, skill_level); pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0); } @@ -556,8 +533,6 @@ return y_offset; } - - //----- (00419719) -------------------------------------------------------- void CharacterUI_SkillsTab_Draw(Player *player) { @@ -585,40 +560,13 @@ y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pMiscSkills, 12, 177, pGlobalTXT_LocalizationStrings[143]); //"Misc" } - - - - - - - - - //----- (0041A000) -------------------------------------------------------- void CharacterUI_AwardsTab_Draw(Player *player) { - //unsigned int v1; // esi@1 - //unsigned int v2; // ebx@1 - //unsigned int award_texture_id; // eax@1 - unsigned int result; // eax@1 - int v5; // eax@15 - char *v6; // ebx@15 - int v7; // eax@23 - int v8; // eax@24 - int v9; // eax@25 - //int v10; // eax@27 - int v11; // eax@32 - int v12; // eax@33 - int v13; // eax@34 - //signed int v14; // eax@43 - //unsigned int v15; // eax@43 - //int v16; // eax@43 - //int v17; // [sp-4h] [bp-D4h]@16 - char Source[100]; // [sp+Ch] [bp-C4h]@1 - GUIWindow a1; // [sp+70h] [bp-60h]@1 - //unsigned int v20; // [sp+C4h] [bp-Ch]@15 - //int v21; // [sp+C8h] [bp-8h]@14 - //int v22; // [sp+CCh] [bp-4h]@40 + unsigned int result; // eax@1 + char *v6; // ebx@15 + char Source[100]; // [sp+Ch] [bp-C4h]@1 + GUIWindow awards_window; // [sp+70h] [bp-60h]@1 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE)); sprintfex(pTmpBuf.data(), "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color); @@ -628,12 +576,12 @@ pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); result = books_primary_item_per_page; - a1.uFrameX = 12; - a1.uFrameY = 48; - a1.uFrameWidth = 424; - a1.uFrameHeight = 290; - a1.uFrameZ = 435; - a1.uFrameW = 337; + awards_window.uFrameX = 12; + awards_window.uFrameY = 48; + awards_window.uFrameWidth = 424; + awards_window.uFrameHeight = 290; + awards_window.uFrameZ = 435; + awards_window.uFrameW = 337; if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) result = books_primary_item_per_page++ + 1; if (BtnUp_flag && result) @@ -642,70 +590,60 @@ books_primary_item_per_page = result; } - if ( books_page_number < 0 ) - { - result += num_achieved_awards; - books_primary_item_per_page = result; - if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book ) - { - result = full_num_items_in_book - num_achieved_awards; - books_primary_item_per_page = result; - } - } - else if ( books_page_number > 0 ) - { - result -= num_achieved_awards; - books_primary_item_per_page = result; - if ( (result & 0x80000000u) != 0 ) - { - result = 0; - books_primary_item_per_page = result; - } - } - //LABEL_14: - BtnDown_flag = 0; - BtnUp_flag = 0; - num_achieved_awards = 0; - books_page_number = 0; - - - for (uint i = result; i < full_num_items_in_book; ++i) + if ( books_page_number < 0 ) + { + result += num_achieved_awards; + books_primary_item_per_page = result; + if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book ) { - v5 = achieved_awards[i]; - v6 = (char *)pAwards[v5].pText;//(char *)dword_723E80_award_related[v20 / 4]; + result = full_num_items_in_book - num_achieved_awards; + books_primary_item_per_page = result; + } + } + else if ( books_page_number > 0 ) + { + result -= num_achieved_awards; + books_primary_item_per_page = result; + if ( (result & 0x80000000u) != 0 ) + { + result = 0; + books_primary_item_per_page = result; + } + } + BtnDown_flag = 0; + BtnUp_flag = 0; + num_achieved_awards = 0; + books_page_number = 0; - pTmpBuf[0] = 0; - switch (v5) - { - case Award_Arena_PageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaPageWins); break; - case Award_Arena_SquireWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaSquireWins); break; - case Award_Arena_KnightWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaKnightWins); break; - case Award_Arena_LordWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaLordWins); break; - case Award_ArcomageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageWins); break; - case Award_ArcomageLoses: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageLoses); break; - case Award_Deaths: sprintf(pTmpBuf.data(), v6, pParty->uNumDeaths); break; - case Award_BountiesCollected: sprintf(pTmpBuf.data(), v6, pParty->uNumBountiesCollected); break; - case Award_Fine: sprintf(pTmpBuf.data(), v6, pParty->uFine); break; - case Award_PrisonTerms: sprintf(pTmpBuf.data(), v6, pParty->uNumPrisonTerms); break; - } + for ( int i = result; i < full_num_items_in_book; ++i) + { + v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4]; + pTmpBuf[0] = 0; + switch (achieved_awards[i]) + { + case Award_Arena_PageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaPageWins); break; + case Award_Arena_SquireWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaSquireWins); break; + case Award_Arena_KnightWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaKnightWins); break; + case Award_Arena_LordWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaLordWins); break; + case Award_ArcomageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageWins); break; + case Award_ArcomageLoses: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageLoses); break; + case Award_Deaths: sprintf(pTmpBuf.data(), v6, pParty->uNumDeaths); break; + case Award_BountiesCollected: sprintf(pTmpBuf.data(), v6, pParty->uNumBountiesCollected); break; + case Award_Fine: sprintf(pTmpBuf.data(), v6, pParty->uFine); break; + case Award_PrisonTerms: sprintf(pTmpBuf.data(), v6, pParty->uNumPrisonTerms); break; + } - if (*pTmpBuf.data()) - v6 = pTmpBuf.data(); - - - a1.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[v5].uPriority % 6], v6, 0, 0, 0); - a1.uFrameY = pFontArrus->CalcTextHeight(v6, &a1, 0, 0) + a1.uFrameY + 4; - if (a1.uFrameY > a1.uFrameHeight) - break; + if (*pTmpBuf.data()) + v6 = pTmpBuf.data(); - ++num_achieved_awards; - } - } + awards_window.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[achieved_awards[i]].uPriority % 6], v6, 0, 0, 0); + awards_window.uFrameY = pFontArrus->CalcTextHeight(v6, &awards_window, 0, 0) + awards_window.uFrameY + 8; + if (awards_window.uFrameY > awards_window.uFrameHeight) + break; - - - - + ++num_achieved_awards; + } +} //----- (0041A2C1) -------------------------------------------------------- unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) @@ -715,15 +653,12 @@ return ((signed int)(uNumPixels - 14) >> 5) + 1; } - - //----- (0041A556) -------------------------------------------------------- void draw_leather() { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); } - //----- (0041ABFD) -------------------------------------------------------- void CharacterUI_CharacterScreen_Draw(Player *player) { @@ -755,7 +690,7 @@ case WINDOW_CharacterWindow_Awards: // awards CharacterUI_ReleaseButtons(); sub_419379(); - sub_419220(); + CreateAwardsScrollBar(); CharacterUI_AwardsTab_Draw(player); pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, @@ -783,155 +718,22 @@ //----- (0043CC7C) -------------------------------------------------------- void CharacterUI_DrawPaperdoll(Player *player) { - //signed int pSex; // eax@1 - unsigned int v6; // ecx@9 - int v7; // ecx@10 - unsigned int pMainHandNum4; // eax@14 - ItemGen *item_MainHand4; // eax@15 - int v10; // edx@15 - unsigned int pX_MainHand4; // edi@15 - unsigned int v14; // ebx@18 - Texture *v16; // ebp@27 - double v17; // st7@29 - int v18; // edi@30 - char *v19; // eax@30 - unsigned int pBowNum; // eax@37 - ItemGen *itemBow; // edi@38 - int pX_Bow; // ebx@38 - double v28; // st7@51 - char *v30; // eax@54 - unsigned int pCloakNum; // eax@59 - ItemGen *item_Cloak; // edx@60 - int v33; // eax@65 - int v34; // eax@74 - int v35; // ebx@74 - LODFile_IconsBitmaps *v38; // ecx@78 - Texture *v39; // edi@85 - double v40; // st7@87 - int v41; // edi@88 - unsigned int pArmorNum; // eax@93 - ItemGen *item_Armor; // edx@94 - int v45; // eax@98 - int v48; // ebx@106 - LODFile_IconsBitmaps *v50; // ecx@110 - Texture *v51; // edi@117 - double v52; // st7@119 - int v53; // edi@120 - char *v55; // eax@122 - unsigned int pBootNum; // eax@127 - ItemGen *item_Boot; // edi@128 + ItemGen *item; // edi@38 + int item_X; // ebx@38 + int index; // eax@65 int v59; // ebx@129 - int v60; // ecx@132 - Texture *v63; // edi@145 - double v64; // st7@147 - int v65; // edi@148 - char *v66; // eax@148 - unsigned int pMainHandNum; // edx@155 - int v70; // edx@156 - unsigned int pBeltNum; // eax@160 - ItemGen *item_Belt; // edi@161 - int v73; // edx@163 unsigned int v75; // ebx@170 - Texture *v77; // edi@181 - double v78; // st7@183 - int v79; // edi@184 - char *v80; // eax@184 - unsigned int pMainHandNum2; // eax@192 - int v83; // eax@193 int pArmorShoulderNum; // eax@197 - int v87; // eax@197 - int v88; // eax@198 - int v89; // eax@199 int v94; // ebx@214 - int v95; // eax@214 - char *v96; // edi@226 - double v97; // st7@228 - int v98; // edi@229 - char *v99; // eax@229 - int pX_ArmorShoulder; // eax@237 - int pY_ArmorShoulder; // ecx@237 - int v106; // edx@238 - int v107; // edx@239 - int v108; // edx@240papredoll_flying_feet - int v109; // edi@250 - char *v110; // edx@250 - unsigned int pCloakCollarNum; // eax@259 - ItemGen *item_CloakCollar; // eax@260 - int v114; // eax@265 - int v116; // ebx@274 - double v118; // st7@286 - int v119; // edi@287 - char *v120; // eax@287 - unsigned int v122; // edi@295 - int pHelmNum; // ebx@297 - ItemGen *item_Helm; // edi@298 - int v125; // ecx@303 - unsigned int v127; // ebx@314 - Texture *v129; // edi@325 - double v130; // st7@327 - int v131; // edi@328 - char *v132; // eax@328 - unsigned int pMainHandNum3; // eax@335 - ItemGen *item_MainHand3; // eax@336 - unsigned int v138; // ebx@339 - Texture *v140; // edi@348 - double v141; // st7@350 - int v142; // edi@351 - char *v143; // eax@351 - unsigned int pShieldNum; // eax@358 - ItemGen *item_Shield; // eax@359 - int v149; // edx@359 - int pX_Shield; // ebx@362 - int v151; // ecx@363 - int v152; // ecx@364 - unsigned int v153; // eax@370 - Texture *v157; // ebp@381 - double v158; // st7@383 - char *v160; // eax@386 - unsigned int pMainHandNum5; // eax@393 - ItemGen *item_MainHand5; // eax@394 - char *v166; // [sp-8h] [bp-54h]@16 - const char *v167; // [sp-8h] [bp-54h]@23 - const char *v168; // [sp-8h] [bp-54h]@43 - const char *v169; // [sp-8h] [bp-54h]@79 - const char *v170; // [sp-8h] [bp-54h]@111 - const char *v171; // [sp-8h] [bp-54h]@141 - const char *v172; // [sp-8h] [bp-54h]@177 - const char *v173; // [sp-8h] [bp-54h]@222 - const char *v178; // [sp-8h] [bp-54h]@242 - const char *v179; // [sp-8h] [bp-54h]@280 - const char *v180; // [sp-8h] [bp-54h]@321 - char *v181; // [sp-8h] [bp-54h]@337 - const char *v182; // [sp-8h] [bp-54h]@344 - const char *v183; // [sp-8h] [bp-54h]@375 - signed int v186; // [sp-4h] [bp-50h]@202 - signed int v191; // [sp-4h] [bp-50h]@266 - signed int v192; // [sp-4h] [bp-50h]@304 - int pY_MainHand4; // [sp+10h] [bp-3Ch]@15 - int pY_Bow; // [sp+10h] [bp-3Ch]@38 - unsigned int pY_Cloak; // [sp+10h] [bp-3Ch]@74 - unsigned int pY_Armor; // [sp+10h] [bp-3Ch]@106 - int pY_Boot; // [sp+10h] [bp-3Ch]@129 - int pY_Belt; // [sp+10h] [bp-3Ch]@168 - unsigned int pY_shoulder; // [sp+10h] [bp-3Ch]@216 - unsigned int pY_CloakCollar; // [sp+10h] [bp-3Ch]@274 - int pY_Helm; // [sp+10h] [bp-3Ch]@312 - int pY_MainHand3; // [sp+10h] [bp-3Ch]@336 - int pY_Shield; // [sp+10h] [bp-3Ch]@362 - Texture *a2b; // [sp+14h] [bp-38h]@49 - int pX_Cloak; // [sp+14h] [bp-38h]@74 - int pX_Armor; // [sp+14h] [bp-38h]@106 - int pX_Boot; // [sp+14h] [bp-38h]@129 - int pX_Belt; // [sp+14h] [bp-38h]@168 - int pX_shoulder; // [sp+14h] [bp-38h]@214 - int pX_CloakCollar; // [sp+14h] [bp-38h]@274 - Texture *a2i; // [sp+14h] [bp-38h]@284 - int pX_Helm; // [sp+14h] [bp-38h]@312 - int pX_MainHand3; // [sp+14h] [bp-38h]@336 - int pBodyComplection; // [sp+24h] [bp-28h]@6 - unsigned int pBowTextureNum; // [sp+2Ch] [bp-20h]@38 - signed int v245; // [sp+34h] [bp-18h]@361 - signed int IsDwarf; // [sp+40h] [bp-Ch]@4 + unsigned int v127; // ebx@314 + unsigned int v153; // eax@370 + char *v166; // [sp-8h] [bp-54h]@16 + const char *container; // [sp-8h] [bp-54h]@79 + char *v181; // [sp-8h] [bp-54h]@337 + int item_Y; // [sp+10h] [bp-3Ch]@38 + int pBodyComplection; // [sp+24h] [bp-28h]@6 + signed int v245; // [sp+34h] [bp-18h]@361 + signed int IsDwarf; // [sp+40h] [bp-Ch]@4 pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); if (player->GetRace() == CHARACTER_RACE_DWARF) @@ -960,760 +762,735 @@ pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); - v6 = player->pEquipment.uMainHand; - if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItemList[v6-1], pItemsTable->pItems[v7].uEquipType != 1) - && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], - pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); - pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( pMainHandNum4 ) + // ... + if ( !player->pEquipment.uMainHand + || ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].uItemID].uEquipType != EQUIP_MAIN_HAND) + && (pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].uItemID].uSkillType != PLAYER_SKILL_SPEAR + || pPlayers[uPlayerID]->pEquipment.uShield) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], + pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); + //-----------------------------------------------------(Hand/)--------------------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { - item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum4 - 1]; - pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX; - pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY; - if ( item_MainHand4->uItemID == 64 ) //blaster + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; + if ( item->uItemID == 64 ) //blaster v166 = "item64v1"; else - v166 = pItemsTable->pItems[item_MainHand4->uItemID].pIconName; - v14 = pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE); - if ( !( item_MainHand4->uAttributes & 0xF0 ) ) + v166 = pItemsTable->pItems[item->uItemID].pIconName; + if ( !( item->uAttributes & 0xF0 ) ) { - v18 = v14 + 1; - v19 = (char *)pIcons_LOD->GetTexture(v14); - if ( item_MainHand4->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)v19); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); else { - if ( item_MainHand4->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)v19); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); else - pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)v19); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); } } - if ( item_MainHand4->uAttributes & 0xF0 ) + if ( item->uAttributes & 0xF0 ) { - if ( ( item_MainHand4->uAttributes & 0xF0) == 16 ) - v167 = "sptext01"; - if ( ( item_MainHand4->uAttributes & 0xF0) == 32 ) - v167 = "sp28a"; - if ( (item_MainHand4->uAttributes & 0xF0) == 64 ) - v167 = "sp30a"; - if ( (item_MainHand4->uAttributes & 0xF0) == 128 ) - v167 = "sp91a"; - v16 = pIcons_LOD->LoadTexturePtr(v167, TEXTURE_16BIT_PALETTE); + if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_MainHand4->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v17 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, pIcons_LOD->GetTexture(v14), v16, (signed __int64)v17, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)v19, pMainHandNum4); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), pPlayers[uPlayerID]->pEquipment.uMainHand); } } else// { - pBowNum = pPlayers[uPlayerID]->pEquipment.uBow; // - if ( pBowNum ) + //----------------(Bow/ )------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uBow ) { - itemBow = &pPlayers[uPlayerID]->pInventoryItemList[pBowNum - 1]; - pX_Bow = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[itemBow->uItemID].uEquipX; - pY_Bow = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[itemBow->uItemID].uEquipY; - pBowTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[itemBow->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( !(itemBow->uAttributes & 0xF0) )// + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uBow - 1]; + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[item->uItemID].uEquipY; + if ( !(item->uAttributes & 0xF0) )// { - if ( itemBow->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum)); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE))); else { - v30 = (char *)pIcons_LOD->GetTexture(pBowTextureNum); - if ( !(itemBow->uAttributes & 1) )// - pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)v30); + if ( !(item->uAttributes & 1) )// + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE))); else // - pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)v30); + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE))); } } else { - if ( (itemBow->uAttributes & 0xF0) == 16 ) - v168 = "sptext01"; - if ( (itemBow->uAttributes & 0xF0) == 32 ) - v168 = "sp28a"; - if ( (itemBow->uAttributes & 0xF0) == 64 ) - v168 = "sp30a"; - if ( (itemBow->uAttributes & 0xF0) == 128 ) - v168 = "sp91a"; - a2b = pIcons_LOD->LoadTexturePtr(v168, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - itemBow->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v28 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), a2b, (signed __int64)v28, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), pBowNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)), + pPlayers[uPlayerID]->pEquipment.uBow); } - pCloakNum = pPlayers[uPlayerID]->pEquipment.uCloak;// - if ( pCloakNum ) + //-----------------------------(Cloak/)--------------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uCloak ) { - item_Cloak = &pPlayers[uPlayerID]->pInventoryItemList[pCloakNum - 1]; - switch ( item_Cloak->uItemID ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uCloak - 1]; + switch ( item->uItemID ) { case ITEM_RELIC_TWILIGHT: - v33 = 5; + index = 5; break; case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: - v33 = 6; + index = 6; break; case ITEM_RARE_SUN_CLOAK: - v33 = 7; + index = 7; break; case ITEM_RARE_MOON_CLOAK: - v33 = 8; + index = 8; break; case ITEM_RARE_VAMPIRES_CAPE: - v33 = 9; + index = 9; break; default: - v33 = item_Cloak->uItemID - 105; + index = item->uItemID - 105; break; } - if ( v33 >= 0 && v33 < 10 ) + if ( index >= 0 && index < 10 ) { - v35 = paperdoll_cloak_texture[pBodyComplection][v33];//Texture_Cloak - pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][v33][0]; - pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][v33][1]; - if ( !(item_Cloak->uAttributes & 0xF0) ) + item_X = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][index][1]; + if ( !(item->uAttributes & 0xF0) ) { - v41 = v35 + 1; - if ( item_Cloak->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35)); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index])); else - pRenderer->DrawTextureTransparent(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35)); + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index])); } else { - if ( (item_Cloak->uAttributes & 0xF0) == 16 ) - v169 = "sptext01"; - if ( (item_Cloak->uAttributes & 0xF0) == 32 ) - v169 = "sp28a"; - if ( (item_Cloak->uAttributes & 0xF0) != 64 ) - v169 = "sp30a"; - if ( (item_Cloak->uAttributes & 0xF0) == 128 ) - v169 = "sp91a"; - v39 = pIcons_LOD->LoadTexturePtr(v169, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Cloak->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v40 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), v39, (signed __int64)v40, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), pCloakNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), + pPlayers[uPlayerID]->pEquipment.uCloak); } } - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,// - pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); - pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// - if ( pArmorNum ) + //-------------------------------(Paperdoll/)------------------------------------------- + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); + //-------------------------------(Armor/)----------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uArmor ) { - item_Armor = &pPlayers[uPlayerID]->pInventoryItemList[pArmorNum - 1]; - switch ( item_Armor->uItemID ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1]; + switch ( item->uItemID ) { - case 504: - v45 = 15; + case ITEM_ARTICACT_GOVERNONS_ARMOR: + index = 15; break; case ITEM_ARTIFACT_YORUBA: - v45 = 14; + index = 14; break; case ITEM_RELIC_HARECS_LEATHER: - v45 = 13; + index = 13; break; case ITEM_ELVEN_CHAINMAIL: - v45 = 16; + index = 16; break; default: - v45 = item_Armor->uItemID - 66; + index = item->uItemID - 66; break; } - if ( v45 >= 0 && v45 < 17 ) + if ( index >= 0 && index < 17 ) { - pX_Armor = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][v45][0]; - pY_Armor = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][v45][1]; - v48 = paperdoll_armor_texture[pBodyComplection][v45][0]; - if ( !(item_Armor->uAttributes & 0xF0) ) + item_X = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][index][1]; + if ( !(item->uAttributes & 0xF0) ) { - v53 = v48 + 1; - if ( item_Armor->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48)); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0])); else { - v55 = (char *)&pIcons_LOD->pTextures[v48]; - if ( !(item_Armor->uAttributes & 1) ) - pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)v55); + if ( !(item->uAttributes & 1) ) + pRenderer->DrawTransparentGreenShade(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]]); else - pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)v55); + pRenderer->DrawTextureTransparent(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]]); } } else { - if ( (item_Armor->uAttributes & 0xF0) == 16 ) - v170 = "sptext01"; - if ( (item_Armor->uAttributes & 0xF0) == 32 ) - v170 = "sp28a"; - if ( (item_Armor->uAttributes & 0xF0) == 64 ) - v170 = "sp30a"; - if ( (item_Armor->uAttributes & 0xF0) == 128 ) - v170 = "sp91a"; - v51 = pIcons_LOD->LoadTexturePtr(v170, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Armor->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v52 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48), v51, (signed __int64)v52, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } - if ( pPlayers[uPlayerID]->pEquipment.uMainHand // + //--------------------------------(Shoulder/)--------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uMainHand && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND || pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && - !pPlayers[uPlayerID]->pEquipment.uShield) ) + !pPlayers[uPlayerID]->pEquipment.uShield) )// { - v94 = paperdoll_armor_texture[pBodyComplection][v45][2]; - if ( v94 == pIcons_LOD->FindTextureByName("pending") ) + v94 = paperdoll_armor_texture[pBodyComplection][index][2]; + if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") ) { - v94 = paperdoll_armor_texture[pBodyComplection][v45][1]; - pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0]; - pY_shoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1]; + v94 = paperdoll_armor_texture[pBodyComplection][index][1]; + item_X = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][index][1]; } else { - pX_shoulder = pPaperdoll_BodyX + dword_4E5270[v45][0]; - pY_shoulder = pPaperdoll_BodyY + dword_4E5270[v45][1]; + item_X = pPaperdoll_BodyX + dword_4E5270[index][0]; + item_Y = pPaperdoll_BodyY + dword_4E5270[index][1]; } - if ( !(item_Armor->uAttributes & 0xF0) ) + if ( !(item->uAttributes & 0xF0) ) { - v98 = v94 + 1; - v99 = (char *)pIcons_LOD->GetTexture(v94); - if ( item_Armor->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)v99); + //v98 = v94 + 1; + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); else { - if ( item_Armor->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)v99); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94)); else - pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)v99); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); } } else { - if ( v94 != pIcons_LOD->FindTextureByName("pending") ) + if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") ) { - if ( item_Armor->uAttributes & 0xF0 ) + if ( item->uAttributes & 0xF0 ) { - if ( (item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) - v173 = "sptext01"; - if ( (item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) - v173 = "sp28a"; - if ( ( item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) - v173 = "sp30a"; - if ( (item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) - v173 = "sp91a"; - v96 = (char *)pIcons_LOD->LoadTexturePtr(v173, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Armor->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v97 = (double)GetTickCount(); - pRenderer->_4A63E6(pX_shoulder, pY_shoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); } } } } - else + else// { - v94 = paperdoll_armor_texture[pBodyComplection][v45][1]; - if ( v94 != pIcons_LOD->FindTextureByName("pending") ) + //v94 = paperdoll_armor_texture[pBodyComplection][index][1]; + if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") ) { - pX_ArmorShoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0]; - pY_ArmorShoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1]; - if ( !(item_Armor->uAttributes & 0xF0) ) + item_X = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][index][1]; + if ( !(item->uAttributes & 0xF0) ) { - v109 = v94 + 1; - v110 = (char *)pIcons_LOD->GetTexture(v94); - if ( item_Armor->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2])); else { - if ( item_Armor->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2])); else - pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2])); } } else { - if ( (item_Armor->uAttributes & 0xF0) == 16 ) - v178 = "sptext01"; - if ( (item_Armor->uAttributes & 0xF0) == 32 ) - v178 = "sp28a"; - if ( (item_Armor->uAttributes & 0xF0) == 64 ) - v178 = "sp30a"; - if ( (item_Armor->uAttributes & 0xF0) == 128 ) - v178 = "sp91a"; - v96 = (char *)pIcons_LOD->LoadTexturePtr(v178, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Armor->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v97 = (double)GetTickCount(); - pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } } } + if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)v55, pArmorNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]], + pPlayers[uPlayerID]->pEquipment.uArmor); } } - pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;// - if ( pBootNum ) + //----------------------------------(End of Armor/ )------------------------------------------ + //----------------------------------(Boot/)-------------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uBoot ) { - item_Boot = &pPlayers[uPlayerID]->pInventoryItemList[pBootNum - 1]; - switch ( item_Boot->uItemID ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uBoot - 1]; + switch ( item->uItemID ) { - case 529: - v60 = 5; + case ITEM_ARTIFACT_HERMES_SANDALS: + index = 5; v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace]; break; - case 512: - v60 = 6; + case ITEM_ARTIFACT_LEAGUE_BOOTS: + index = 6; v59 = paperdoll_boots_texture[pBodyComplection][5]; break; default: - v60 = item_Boot->uItemID - 115; - v59 = paperdoll_boots_texture[pBodyComplection][v60]; + index = item->uItemID - 115; + v59 = paperdoll_boots_texture[pBodyComplection][index]; break; } - if ( v60 >= 0 && v60 < 7 ) + if ( index >= 0 && index < 7 ) { - pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][v60][0]; - pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][v60][1]; - if ( !(item_Boot->uAttributes & 0xF0) ) + item_X = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][index][1]; + if ( !(item->uAttributes & 0xF0) ) { - v65 = v59 + 1; - v66 = (char *)pIcons_LOD->GetTexture(v59); - if ( item_Boot->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)v66); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v59)); else { - if ( item_Boot->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)v66); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v59)); else - pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)v66); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v59)); } } else { - if ( (item_Boot->uAttributes & 0xF0) == 16 ) - v171 = "sptext01"; - if ( (item_Boot->uAttributes & 0xF0) == 32 ) - v171 = "sp28a"; - if ( (item_Boot->uAttributes & 0xF0) == 64 ) - v171 = "sp30a"; - if ( (item_Boot->uAttributes & 0xF0) == 128 ) - v171 = "sp91a"; - v63 = pIcons_LOD->LoadTexturePtr(v171, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Boot->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v64 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Boot, pY_Boot, pIcons_LOD->GetTexture(v59), v63, (signed __int64)v64, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v59), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)v66, pBootNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v59), pPlayers[uPlayerID]->pEquipment.uBoot); } } - pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) - && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], - pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); - pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// - if ( pBeltNum ) - { - item_Belt = &pPlayers[uPlayerID]->pInventoryItemList[pBeltNum - 1]; - switch ( item_Belt->uItemID ) + //--------------------------------------------(Hand/)------------------------------------------------------ + if ( !pPlayers[uPlayerID]->pEquipment.uMainHand + || ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].uItemID].uEquipType != EQUIP_MAIN_HAND) + && (pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].uItemID].uSkillType != PLAYER_SKILL_SPEAR + || pPlayers[uPlayerID]->pEquipment.uShield) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); + //--------------------------------------------(Belt/)------------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uBelt ) + { + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uBelt - 1]; + switch ( item->uItemID ) { case ITEM_RILIC_TITANS_BELT: - v73 = 5; + index = 5; break; case ITEM_ARTIFACT_HEROS_BELT: - v73 = 6; + index = 6; break; default: - v73 = item_Belt->uItemID - 100; + index = item->uItemID - 100; break; } - if ( v73 >= 0 && v73 < 7 ) + if ( index >= 0 && index < 7 ) { - pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][v73][0]; - pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][v73][1]; - if ( IsDwarf != 1 || v73 == 5 ) - v75 = paperdoll_belt_texture[pBodyComplection][v73]; + item_X = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][index][1]; + if ( IsDwarf != 1 || index == 5 ) + v75 = paperdoll_belt_texture[pBodyComplection][index]; else - v75 = paperdoll_belt_texture[pBodyComplection - 2][v73]; - if ( !(item_Belt->uAttributes & 0xF0) ) + v75 = paperdoll_belt_texture[pBodyComplection - 2][index]; + if ( !(item->uAttributes & 0xF0) ) { - v79 = v75 + 1; - v80 = (char *)pIcons_LOD->GetTexture(v75); - if ( item_Belt->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Belt, pY_Belt, (Texture *)v80); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); else { - if ( item_Belt->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_Belt, pY_Belt, (Texture *)v80); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v75)); else - pRenderer->DrawTransparentGreenShade(pX_Belt, pY_Belt, (Texture *)v80); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Belt, pY_Belt, (Texture *)v80, pBeltNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v75), pPlayers[uPlayerID]->pEquipment.uBelt); } else { - if ( (item_Belt->uAttributes & 0xF0) == 16 ) - v172 = "sptext01"; - if ( (item_Belt->uAttributes & 0xF0) == 32 ) - v172 = "sp28a"; - if ( (item_Belt->uAttributes & 0xF0) == 64 ) - v172 = "sp30a"; - if ( (item_Belt->uAttributes & 0xF0) == 128 ) - v172 = "sp91a"; - v77 = pIcons_LOD->LoadTexturePtr(v172, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Belt->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v78 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Belt, pY_Belt, pIcons_LOD->GetTexture(v75), v77, (signed __int64)v78, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v75), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); } } } - pMainHandNum2 = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( pMainHandNum2 ) + //---------------------------------------------(Hand2/2)-------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { - v83 = pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum2 - 1].uItemID; - if ( pItemsTable->pItems[v83].uEquipType == 1 - || pItemsTable->pItems[v83].uSkillType == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) + if ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].uItemID].uEquipType == EQUIP_MAIN_HAND + || pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].uItemID].uSkillType == PLAYER_SKILL_SPEAR + && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], - pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); + pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); } - pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;// - if ( pCloakCollarNum ) + //----------------------------------------------(Cloak collar/ )------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uCloak ) { - item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItemList[pCloakCollarNum - 1]; - switch ( item_CloakCollar->uItemID ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uCloak - 1]; + switch ( item->uItemID ) { - case 525: - v114 = 5; + case ITEM_RELIC_TWILIGHT: + index = 5; break; - case 530: - v114 = 6; + case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: + index = 6; break; - case 547: - v114 = 7; + case ITEM_RARE_SUN_CLOAK: + index = 7; break; - case 548: - v114 = 8; + case ITEM_RARE_MOON_CLOAK: + index = 8; break; - case 550: - v114 = 9; + case ITEM_RARE_VAMPIRES_CAPE: + index = 9; break; default: - v114 = item_CloakCollar->uItemID - 105; + index = item->uItemID - 105; } - if ( v114 >= 0 && v114 < 10 ) + if ( index >= 0 && index < 10 ) { - v116 = paperdoll_cloak_collar_texture[pBodyComplection][v114]; - pX_CloakCollar = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][v114][0]; - pY_CloakCollar = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][v114][1]; - if ( v116 != pIcons_LOD->FindTextureByName("pending") ) + item_X = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][index][1]; + if ( paperdoll_cloak_collar_texture[pBodyComplection][index] != pIcons_LOD->FindTextureByName("pending") ) { - if ( !(item_CloakCollar->uAttributes & 0xF0) ) + if ( !(item->uAttributes & 0xF0) ) { - v119 = v116 + 1; - v120 = (char *)pIcons_LOD->GetTexture(v116); - if ( item_CloakCollar->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)v120); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); else - pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)v120); + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)v120, pCloakCollarNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), + pPlayers[uPlayerID]->pEquipment.uCloak); } else { - if ( (item_CloakCollar->uAttributes & 0xF0) == 16 ) - v179 = "sptext01"; - if ( (item_CloakCollar->uAttributes & 0xF0) == 32 ) - v179 = "sp28a"; - if ( (item_CloakCollar->uAttributes & 0xF0) == 64 ) - v179 = "sp30a"; - if ( (item_CloakCollar->uAttributes & 0xF0) == 128 ) - v179 = "sp91a"; - a2i = pIcons_LOD->LoadTexturePtr(v179, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_CloakCollar->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v118 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, pIcons_LOD->GetTexture(v116), a2i, (signed __int64)v118, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } } } } + //--------------------------------------------(Beards/)------------------------------------------------------- if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) { - v122 = papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace]; - if ( v122 != pIcons_LOD->FindTextureByName("Pending") ) + if ( papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] != pIcons_LOD->FindTextureByName("Pending") ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 24], pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 23], - pIcons_LOD->GetTexture(v122)); + pIcons_LOD->GetTexture(papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace])); } - pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;// - if ( pHelmNum ) + //--------------------------------------------(Helm/)------------------------------------------------------------ + if ( pPlayers[uPlayerID]->pEquipment.uHelm ) { - item_Helm = &pPlayers[uPlayerID]->pInventoryItemList[pHelmNum-1]; - switch ( item_Helm->uItemID ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uHelm - 1]; + switch ( item->uItemID ) { - case 521: - v125 = 11; + case ITEM_RELIC_TALEDONS_HELM: + index = 11; break; - case 522: - v125 = 12; + case ITEM_RELIC_SCHOLARS_CAP: + index = 12; break; - case 523: - v125 = 13; + case ITEM_RELIC_PHYNAXIAN_CROWN: + index = 13; break; - case 532: - v125 = 14; + case ITEM_ARTIFACT_MINDS_EYE: + index = 14; break; - case 544: - v125 = 15; + case ITEM_RARE_SHADOWS_MASK: + index = 15; break; default: - v125 = item_Helm->uItemID - 89; + index = item->uItemID - 89; } - if ( v125 >= 0 && v125 < 16 ) + if ( index >= 0 && index < 16 ) { - pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][v125][0]; - pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][v125][1]; - if ( IsDwarf != 1 || item_Helm->uItemID != 92 ) - v127 = paperdoll_helm_texture[player->GetSexByVoice()][v125]; + item_X = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][index][1]; + if ( IsDwarf != 1 || item->uItemID != 92 ) + v127 = paperdoll_helm_texture[player->GetSexByVoice()][index]; else v127 = papredoll_dbrds[11]; - if ( item_Helm->uAttributes & 0xF0 ) + if ( item->uAttributes & 0xF0 ) { - if ( (item_Helm->uAttributes & 0xF0) == 16 ) - v180 = "sptext01"; - if ( (item_Helm->uAttributes & 0xF0) == 32 ) - v180 = "sp28a"; - if ( (item_Helm->uAttributes & 0xF0) == 64 ) - v180 = "sp30a"; - if ( (item_Helm->uAttributes & 0xF0) == 128 ) - v180 = "sp91a"; - v129 = pIcons_LOD->LoadTexturePtr(v180, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Helm->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v130 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Helm, pY_Helm, pIcons_LOD->GetTexture(v127), v129, (signed __int64)v130, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v127), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); } else { - v131 = v127 + 1; - v132 = (char *)pIcons_LOD->GetTexture(v127); - if ( item_Helm->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Helm, pY_Helm, (Texture *)v132); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); else { - if ( item_Helm->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_Helm, pY_Helm, (Texture *)v132); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v127)); else - pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)v132); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); } } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)v132, pHelmNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v127), pPlayers[uPlayerID]->pEquipment.uHelm); } } - pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand - if ( pMainHandNum3 ) + //------------------------------------------------(Hand3/3)------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { - item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum3 - 1]; - pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX; - pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY; - if ( item_MainHand3->uItemID == 64 ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; + if ( item->uItemID == 64 ) v181 = "item64v1"; else - v181 = pItemsTable->pItems[item_MainHand3->uItemID].pIconName; - v138 = pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE); - if ( !(item_MainHand3->uAttributes & 0xF0) ) + v181 = pItemsTable->pItems[item->uItemID].pIconName; + if ( !(item->uAttributes & 0xF0) ) { - v142 = v138 + 1; - v143 = (char *)pIcons_LOD->GetTexture(v138); - if ( item_MainHand3->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)v143); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); else { - if ( item_MainHand3->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)v143); + if ( item->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); else - pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)v143); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); } } else { - if ( (item_MainHand3->uAttributes & 0xF0) == 16 ) - v182 = "sptext01"; - if ( (item_MainHand3->uAttributes & 0xF0) == 32 ) - v182 = "sp28a"; - if ( (item_MainHand3->uAttributes & 0xF0) == 64 ) - v182 = "sp30a"; - if ( (item_MainHand3->uAttributes & 0xF0) == 128 ) - v182 = "sp91a"; - v140 = pIcons_LOD->LoadTexturePtr(v182, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_MainHand3->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v141 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, pIcons_LOD->GetTexture(v138), v140, (signed __int64)v141, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)v143, pMainHandNum3); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), + pPlayers[uPlayerID]->pEquipment.uMainHand); } - pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// - if ( pShieldNum ) + //--------------------------------------------------(Shield/)--------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uShield ) { - item_Shield = &pPlayers[uPlayerID]->pInventoryItemList[pShieldNum - 1]; - v149 = pItemsTable->pItems[item_Shield->uItemID].uSkillType; - if ( v149 == 2 || v149 == 1 ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uShield - 1]; + if ( pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_DAGGER + || pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_SWORD ) { - v151 = item_Shield->uItemID - 400; - pX_Shield = 596; + //v151 = item->uItemID - 400; + item_X = 596; v245 = 1; - switch ( item_Shield->uItemID ) + switch ( item->uItemID ) { case 400: - pY_Shield = 86; + item_Y = 86; break; case 403: - pY_Shield = 28; + item_Y = 28; break; case 415: - pX_Shield = 595; - pY_Shield = 33; + item_X = 595; + item_Y = 33; break; default: - pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX; - pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY; + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; break; } } else { v245 = 0; - pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX; - pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY; + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; } - v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_Shield->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( !(item_Shield->uAttributes & 0xF0) ) + v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + if ( !(item->uAttributes & 0xF0) ) { - if ( item_Shield->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153)); + if ( item->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v153)); else { - v160 = (char *)pIcons_LOD->GetTexture(v153); - if ( !(item_Shield->uAttributes & 1) ) - pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)v160); + //v160 = (char *)pIcons_LOD->GetTexture(v153); + if ( !(item->uAttributes & 1) ) + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v153)); else - pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)v160); + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v153)); } } else { - if ( (item_Shield->uAttributes & 0xF0) == 16 ) - v183 = "sptext01"; - if ( (item_Shield->uAttributes & 0xF0) == 32 ) - v183 = "sp28a"; - if ( (item_Shield->uAttributes & 0xF0) == 64 ) - v183 = "sp30a"; - if ( (item_Shield->uAttributes & 0xF0) == 128 ) - v183 = "sp91a"; - v157 = pIcons_LOD->LoadTexturePtr(v183, TEXTURE_16BIT_PALETTE); + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED ) + container = "sptext01"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE ) + container = "sp28a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN ) + container = "sp30a"; + if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE ) + container = "sp91a"; _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Shield->uAttributes &= 0xFFFFFF0Fu; + item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } - v158 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), v157, (signed __int64)v158, 0, 255); + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v153), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); if ( v245 ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1])); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), pShieldNum); + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v153), pPlayers[uPlayerID]->pEquipment.uShield); } } + //--------------------------------------------------------(RightHand/ )-------------------------------------------------- pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1])); - pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( pMainHandNum5 ) + //--------------------------------------------------------(LeftHand/ )---------------------------------------------------- + if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { - item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum5 - 1]; - if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || - pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == PLAYER_SKILL_SPEAR && - !pPlayers[uPlayerID]->pEquipment.uShield ) + item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; + if ( pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_MAIN_HAND + || pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_SPEAR + && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1])); @@ -1723,12 +1500,6 @@ pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));// } - - - - - - //----- (0041A2D1) -------------------------------------------------------- void CharacterUI_InventoryTab_Draw(Player *player, bool a2) { @@ -1796,7 +1567,7 @@ ptr_50C9A4 = 0; } - pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255); + pRenderer->DrawAura(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255); ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); } else @@ -1841,7 +1612,7 @@ item->uAttributes &= 0xFFFFFF0F; ptr_50C9A4 = 0; } - pRenderer->_4A63E6(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255); + pRenderer->DrawAura(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255); } else { diff -r f682c853200d -r b330df6a2183 mm7_2.cpp --- a/mm7_2.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/mm7_2.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -6422,7 +6422,7 @@ v5 = pSpriteObjects[uLayingItemID].uAttributes; if ( v5 & 4 ) { - --pTurnEngine->field_1C; + --pTurnEngine->pending_actions; pSpriteObjects[uLayingItemID].uAttributes = v5 & 0xFFFB; } } diff -r f682c853200d -r b330df6a2183 mm7_4.cpp --- a/mm7_4.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/mm7_4.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -1906,459 +1906,378 @@ //----- (00495461) -------------------------------------------------------- char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) { - unsigned __int8 v6; // bl@1 Player *pPlayer; // ebx@3 - //NPCData *v9; // eax@4 - //size_t v10; // eax@6 - char *v11; // esi@7 - //int v12; // edx@7 - //ItemGen *v13; // edi@7 - //char v14; // cl@8 - //char *v15; // ecx@10 - //int v16; // edx@10 + char *pText; // esi@7 int v17; // eax@10 signed __int64 v18; // qax@18 - unsigned int v19; // edi@32 unsigned __int8 *v20; // ebx@32 int v21; // ecx@34 - __int16 v22; // ax@34 - int v23; // edx@39 - int v24; // eax@39 - int v25; // eax@45 - float *v26; // esi@68 - float v27; // ST18_4@68 - signed int v28; // eax@68 + int pReputation; // eax@45 int v29; // eax@68 - float v30; // ST18_4@72 - signed int v31; // eax@72 - float v32; // ST18_4@74 - signed int v33; // eax@74 - double v34; // st7@75 - float v35; // ST18_4@76 - signed int v36; // eax@76 - float *v37; // esi@78 - float v38; // ST18_4@78 - int v39; // eax@78 - float v40; // ST18_4@82 - int v41; // eax@82 - float v42; // ST18_4@83 - int v43; // eax@83 - float v44; // ST18_4@85 - int v45; // eax@85 - const char *v46; // eax@86 - unsigned int v47; // eax@87 - float v48; // ST18_4@97 - __int64 v49; // ST14_8@107 - int v50; // eax@107 - int v51; // eax@108 - Player *v52; // eax@109 - int v53; // [sp-4h] [bp-13Ch]@107 - int v54; // [sp+0h] [bp-138h]@107 __int16 v55[56]; // [sp+10h] [bp-128h]@34 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 - stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 char a1[100]; // [sp+B8h] [bp-80h]@3 - unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 - //size_t v60; // [sp+120h] [bp-18h]@3 - //Player *v61; // [sp+124h] [bp-14h]@3 - //char *Str; // [sp+128h] [bp-10h]@1 int v63; // [sp+12Ch] [bp-Ch]@32 - //int v64; // [sp+130h] [bp-8h]@6 - //NPCData *v65; // [sp+134h] [bp-4h]@6 - //int packed; - - - v6 = uPlayerID; - //Str = lpsz; - if ( IsBadStringPtrA(lpsz, 1u) ) + if ( IsBadStringPtrA(lpsz, 1) ) return "Invalid String Passed"; a1[0] = 0; - pPlayer = &pParty->pPlayers[v6]; - v59 = TargetColor(255, 255, 155); - //v61 = pPlayer; + pPlayer = &pParty->pPlayers[uPlayerID]; memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); NPCData *npc = nullptr; if ( dword_5C35D4 ) - { - //__debugbreak(); // fix npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1 - } else npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); - //v65 = v9; - //v10 = 0; - //v64 = 0; - //int i = 0; - //if ( (signed int)v60 > 0 ) - v11 = a4; - + //pText = a4; auto len = strlen(lpsz); for (int i = 0, dst = 0; i < len; ++i) { - //v12 = v64; - //v13 = a3; - //while ( 1 ) - //{ char c = lpsz[i]; if (c != '%') pTmpBuf2[dst++] = c; else { - //v15 = &lpsz[v12 + 1]; - //v16 = (unsigned __int8)lpsz[v12 + 2]; - //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; - //v17 = packed - 528;// 10 * '0' + '0' v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0'; switch ( v17 ) { - case 1: - v11 = npc->pName; - goto _continue_strcat; - case 2: - v11 = pPlayer->pName; - goto _continue_strcat; - case 3: - case 4: - v11 = a1; - goto _continue_strcat; - case 5: - v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; - v11 = pGlobalTXT_LocalizationStrings[397];// "evening" - if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) - { - if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) - { - if ( v18 < 20 ) - v11 = pGlobalTXT_LocalizationStrings[396];// "day" - } - else - { - v11 = pGlobalTXT_LocalizationStrings[395];// "morning" - } - } - goto _continue_strcat; - case 6: - if ( pPlayer->uSex ) - v11 = pGlobalTXT_LocalizationStrings[387];// "lady" - else - v11 = pGlobalTXT_LocalizationStrings[385];// "sir" - goto _continue_strcat; - case 7: - if ( pPlayer->uSex ) - v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" - else - v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" - goto _continue_strcat; - case 8: - v19 = 0; - v63 = 0; - v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; - do - { - if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) - { - v21 = v63; - v22 = word_4EE150[v19]; - ++v63; - v55[v21] = v22; - } - ++v19; - } - while ( v19 < 28 ); - if ( v63 ) + case 1:// + strcat(pTmpBuf2.data(), npc->pName); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 2: + strcat(pTmpBuf2.data(), pPlayer->pName); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 3: + case 4: + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 5: + v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; + pText = pGlobalTXT_LocalizationStrings[397];// "evening" + if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) + { + if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) { - v23 = rand() % v63; - v24 = dword_A74CDC; - if ( dword_A74CDC == -1 ) - { - v24 = v23; - dword_A74CDC = v23; - } - v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; - } - else - { - v11 = (char *)pNPCTopics[55].pText; - } - //pPlayer = v61; - //v13 = a3; - goto _continue_strcat; - case 9: - if ( npc->uSex ) - v11 = pGlobalTXT_LocalizationStrings[384];// "her" - else - v11 = pGlobalTXT_LocalizationStrings[383];// "his" - goto _continue_strcat; - case 10: - if ( pPlayer->uSex ) - v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" - else - v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" - goto _continue_strcat; - case 11: - v25 = GetPartyReputation(); - if ( v25 >= 25 ) - { - v11 = pGlobalTXT_LocalizationStrings[379]; - } - else - { - if ( v25 < 6 ) - { - if ( v25 >= -5 ) - { - v11 = pGlobalTXT_LocalizationStrings[399]; - } - else - { - if ( v25 < -24 ) - v11 = pGlobalTXT_LocalizationStrings[434]; - else - v11 = pGlobalTXT_LocalizationStrings[402]; - } - } - else - { - v11 = pGlobalTXT_LocalizationStrings[392]; - } - } - goto _continue_strcat; - case 12: - v25 = npc->rep; - if ( v25 >= 25 ) - { - v11 = pGlobalTXT_LocalizationStrings[379]; + if ( v18 < 20 ) + pText = pGlobalTXT_LocalizationStrings[396];// "day" } else { - if ( v25 < 6 ) + pText = pGlobalTXT_LocalizationStrings[395];// "morning" + } + } + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 6: + if ( pPlayer->uSex ) + pText = pGlobalTXT_LocalizationStrings[387];// "lady" + else + pText = pGlobalTXT_LocalizationStrings[385];// "sir" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 7: + if ( pPlayer->uSex ) + pText = pGlobalTXT_LocalizationStrings[389];// "Lady" + else + pText = pGlobalTXT_LocalizationStrings[386];// "Sir" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 8: + v63 = 0; + v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; + for ( uint i = 0; i < 28; ++i ) + { + if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) + { + v21 = v63; + ++v63; + v55[v63] = word_4EE150[i]; + } + } + if ( v63 ) + { + if ( dword_A74CDC == -1 ) + dword_A74CDC = rand() % v63; + pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; + } + else + pText = (char *)pNPCTopics[55].pText; + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 9: + if ( npc->uSex ) + pText = pGlobalTXT_LocalizationStrings[384];// "her" + else + pText = pGlobalTXT_LocalizationStrings[383];// "his" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 10: + if ( pPlayer->uSex ) + pText = pGlobalTXT_LocalizationStrings[389];// "Lady" + else + pText = pGlobalTXT_LocalizationStrings[388];// "Lord" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 11: + pReputation = GetPartyReputation(); + if ( pReputation >= 25 ) + pText = pGlobalTXT_LocalizationStrings[379]; + else//v25 < 25 + { + if ( pReputation < 6 ) + { + if ( pReputation >= -5 )//6 >= v25 >= -5 + pText = pGlobalTXT_LocalizationStrings[399]; + else// v25 < -5 { - if ( v25 >= -5 ) - { - v11 = pGlobalTXT_LocalizationStrings[399]; - } - else - { - if ( v25 < -24 ) - v11 = pGlobalTXT_LocalizationStrings[434]; - else - v11 = pGlobalTXT_LocalizationStrings[402]; - } + if ( pReputation < -24 )//-24 > v25 + pText = pGlobalTXT_LocalizationStrings[434]; + else// -5 > v25 > -24 + pText = pGlobalTXT_LocalizationStrings[402]; } + } + else//25 > v25 > 6 + pText = pGlobalTXT_LocalizationStrings[392]; + } + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 12: + pReputation = npc->rep; + if ( pReputation >= 25 ) + pText = pGlobalTXT_LocalizationStrings[379]; + else + { + if ( pReputation < 6 ) + { + if ( pReputation >= -5 ) + pText = pGlobalTXT_LocalizationStrings[399]; else { - v11 = pGlobalTXT_LocalizationStrings[392]; + if ( pReputation < -24 ) + pText = pGlobalTXT_LocalizationStrings[434]; + else + pText = pGlobalTXT_LocalizationStrings[402]; } } - goto _continue_strcat; - case 13: - v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); - goto _continue_strcat; - case 14: - { - if ( npc->uSex ) - v11 = pGlobalTXT_LocalizationStrings[391];// "sister" - else - v11 = pGlobalTXT_LocalizationStrings[390];// "brother" - goto _continue_strcat; - } - - case 15: - { - v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" -_continue_strcat: - strcat(pTmpBuf2.data(), v11); - dst = strlen(pTmpBuf2.data()); - //v64 += 2; - i += 2; - } - break; - - case 16: - { - if ( npc->uSex ) - v11 = pGlobalTXT_LocalizationStrings[391];// "sister" else - v11 = pGlobalTXT_LocalizationStrings[390];// "brother" - goto _continue_strcat; - } - case 17: - { - auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; - if (!pay_percentage) - pay_percentage = 1; - - sprintf(a1, "%lu", pay_percentage); - v11 = a1; - goto _continue_strcat; + pText = pGlobalTXT_LocalizationStrings[392]; } - - case 18: - case 19: - case 20: - case 21: - case 22: - case 26: -_continue_strncpy: - strncpy(a1, lpsz + i + 1, 2); - v51 = atoi(a1); - sprintf(a1, "%lu", v51); - v11 = a1; - goto _continue_strcat; - - case 23: - { - v47 = pMapStats->GetMapInfo(pCurrentMapName.data()); - if ( v47 ) - v11 = pMapStats->pInfos[v47].pName; - else - v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" - goto _continue_strcat; - } - case 24: - { - v46 = a3->GetDisplayName(); - sprintfex(a1, format_4E2D80, v59, v46); - v11 = a1; - goto _continue_strcat; - } - - - case 25: - { - v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; - v38 = *v37; - v39 = a3->GetValue(); - v29 = pPlayer->GetBaseBuyingPrice(v39, v38); + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 13: + strcat(pTmpBuf2.data(), sub_495366(pPlayer->pName[0], pPlayer->uSex)); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 14: + if ( npc->uSex ) + pText = pGlobalTXT_LocalizationStrings[391];// "sister" + else + pText = pGlobalTXT_LocalizationStrings[390];// "brother" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 15: + strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 16: + if ( npc->uSex ) + pText = pGlobalTXT_LocalizationStrings[391];// "sister" + else + pText = pGlobalTXT_LocalizationStrings[390];// "brother" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 17:// + { + auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; + if ( !pay_percentage ) + pay_percentage = 1; + sprintf(a1, "%lu", pay_percentage); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + case 18: + case 19: + case 20: + case 21: + case 22: + case 26: + strncpy(a1, lpsz + i + 1, 2); + sprintf(a1, "%lu", atoi(a1)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 23: + if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) + pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())].pName; + else + pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" + strcat(pTmpBuf2.data(), pText); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 24:// + sprintfex(a1, format_4E2D80, TargetColor(255, 255, 155), a3->GetDisplayName()); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 25: + v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); switch ( a5 ) - { - case 3: - v44 = *v37; - v45 = a3->GetValue(); - v29 = pPlayer->GetBaseSellingPrice(v45, v44); - break; - case 4: - v29 = pPlayer->GetBaseIdentifyPrice(*v37); - break; - case 5: - v42 = *v37; - v43 = a3->GetValue(); - v29 = pPlayer->GetBaseRepairPrice(v43, v42); - break; - case 6: - v40 = *v37; - v41 = a3->GetValue(); - v29 = pPlayer->GetBaseSellingPrice(v41, v40) / 2; + { + case 3: + v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + break; + case 4: + v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + break; + case 5: + v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + break; + case 6: + v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; + break; + } + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 27:// + v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + if ( a5 == 3 ) + { + v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + if (a3->Broken()) + v29 = 1; + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; break; } - goto _continue_sprintf; - } - - case 27: - { - v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; - v27 = *v26; - v28 = a3->GetValue(); - v29 = pPlayer->GetBuyingPrice(v28, v27); - if ( a5 == 3 ) - { - v35 = *v26; - v36 = a3->GetValue(); - v29 = pPlayer->GetPriceSell(v36, v35); - if (a3->Broken()) - v29 = 1; - goto _continue_sprintf; - } - if ( a5 != 4 ) - { - if ( a5 == 5 ) - { - v32 = *v26; - v33 = a3->GetValue(); - v29 = pPlayer->GetPriceRepair(v33, v32); - } - else - { - if ( a5 == 6 ) + if ( a5 != 4 ) { - v30 = *v26; - v31 = a3->GetValue(); - v29 = pPlayer->GetPriceSell(v31, v30) / 2; - if (a3->Broken()) - v29 = 1; - if (!v29) - v29 = 1; - goto _continue_sprintf; + if ( a5 == 5 ) + v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); + else + { + if ( a5 == 6 ) + { + v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; + if (a3->Broken()) + v29 = 1; + if (!v29) + v29 = 1; + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + } + sprintfex(a1, "%lu", v29); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; } - } -_continue_sprintf: - sprintfex(a1, "%lu", v29); - v11 = a1; - goto _continue_strcat; - } - v34 = *v26; - - v48 = v34; - v29 = pPlayer->GetPriceIdentification(v48); - goto _continue_sprintf; - } - - case 28: - { - //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; - v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; - goto _continue_strcat; - } - + sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + case 28:// + strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; case 29: - { - //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; - v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; - v48 = v34; - v29 = pPlayer->GetPriceIdentification(v48); - goto _continue_sprintf; - } - + sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; case 30: - { - if ( !a6 ) - goto _continue_strcat; - sub_493F79(&v57, *a6); - v54 = v57.field_18_expire_year; - v53 = v57.field_C_expire_day + 1; - v50 = v57.field_14_exprie_month; - sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); - v11 = a1; - goto _continue_strcat; - } - + if ( !a6 ) + { + strcat(pTmpBuf2.data(), a4); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + sub_493F79(&v56, *a6); + sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; case 31: case 32: case 33: case 34: - v52 = &pParty->pPlayers[v17 - 31]; - v11 = v52->pName; - goto _continue_strcat; - + strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; default: if ( v17 <= 50 || v17 > 70 ) - goto _continue_strncpy; + { + strncpy(a1, lpsz + i + 1, 2); + sprintf(a1, "%lu", atoi(a1)); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } if ( v17 - 51 >= 20 ) - goto _continue_strcat; - v49 = pParty->field_3C._s_times[v17-51]; - - sub_493F79(&v56, v49); - v54 = v56.field_18_expire_year; - v53 = v56.field_C_expire_day + 1; - v50 = v56.field_14_exprie_month; - sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); - v11 = a1; - goto _continue_strcat; + { + strcat(pTmpBuf2.data(), a4); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; + } + sub_493F79(&v56, pParty->field_3C._s_times[v17-51]); + sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); + strcat(pTmpBuf2.data(), a1); + dst = strlen(pTmpBuf2.data()); + i += 2; + break; } } } diff -r f682c853200d -r b330df6a2183 mm7_5.cpp --- a/mm7_5.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/mm7_5.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -1038,7 +1038,7 @@ uActiveCharacter = pParty->GetNextActiveCharacter(); some_active_character = 0; if ( pParty->bTurnBasedModeOn ) - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); dword_50C9D0 = 0; dword_50C9D4 = 0; dword_50C9D8 = 0; @@ -2006,7 +2006,7 @@ v60 = sRecoveryTime; pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; pPlayer9->SetRecoveryTime(v60); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } else { @@ -2410,7 +2410,7 @@ } if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3 ) continue; - if ( !(pTurnEngine->field_18 & TE_FLAG_2) ) + if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) ) { if ( pActors[uMessageParam].uAIState == 5 ) stru_50C198.LootActor(&pActors[uMessageParam]); @@ -2429,7 +2429,7 @@ } if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3 ) continue; - if ( !(pTurnEngine->field_18 & TE_FLAG_2) ) + if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) ) _42ECB5_PlayerAttacksActor(); continue; case UIMSG_ExitRest: @@ -2930,7 +2930,7 @@ case UIMSG_ClickAwardsBtn: sub_419379(); CharacterUI_ReleaseButtons(); - sub_419220(); + CreateAwardsScrollBar(); pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); FillAwardsData(); diff -r f682c853200d -r b330df6a2183 mm7_6.cpp --- a/mm7_6.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/mm7_6.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -671,8 +671,8 @@ } //----- (0042704B) -------------------------------------------------------- -bool stru319::special_ability_use_check(Actor *pActor, int a2) -{ +int stru319::special_ability_use_check( struct Actor *pActor, int a2 ) + { stru319 *v3; // edi@1 signed int v4; // ebx@5 signed int v5; // edi@5 @@ -688,7 +688,7 @@ return 2; if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) return 3; - return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; + return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance?1:0; } //----- (00427102) -------------------------------------------------------- @@ -1334,7 +1334,7 @@ int main_hand_idx = player->pEquipment.uMainHand; if (player->HasItemEquipped(EQUIP_MAIN_HAND)) v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType; - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } switch (v34) @@ -2151,7 +2151,7 @@ if ( !pParty->bTurnBasedModeOn ) pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); pCastSpellInfo.data()->_427D48(uActiveCharacter); - pTurnEngine->_40471C(); + pTurnEngine->ApplyPlayerAction(); } } break; diff -r f682c853200d -r b330df6a2183 mm7_data.cpp --- a/mm7_data.cpp Sun Aug 11 12:09:09 2013 +0600 +++ b/mm7_data.cpp Sun Aug 11 12:09:33 2013 +0600 @@ -1086,7 +1086,7 @@ std::array pFinalMessage; // idb std::array pTmpBuf; std::array pTmpBuf2; -std::array byte_5C6D50; // weak +std::array Journal_limitation_factor; // weak int ui_current_text_color; // weak __int64 qword_5C6DF0; // weak int dword_5C6DF8; // weak diff -r f682c853200d -r b330df6a2183 mm7_data.h --- a/mm7_data.h Sun Aug 11 12:09:09 2013 +0600 +++ b/mm7_data.h Sun Aug 11 12:09:33 2013 +0600 @@ -734,7 +734,7 @@ extern std::array pFinalMessage; // idb extern std::array pTmpBuf; extern std::array pTmpBuf2; -extern std::array byte_5C6D50; // weak +extern std::array Journal_limitation_factor; // weak extern int ui_current_text_color; // weak extern __int64 qword_5C6DF0; // weak extern int dword_5C6DF8; // weak @@ -1118,7 +1118,7 @@ unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2); signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx); // idb void FillAwardsData(); -void sub_419220(); +void CreateAwardsScrollBar(); void sub_419379(); unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); struct GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey); // idb @@ -1135,7 +1135,7 @@ void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb void OnChestLeftClick(); void __cdecl GameUI_WritePointedObjectStatusString(); -struct GUIWindow *__thiscall sub_4219BE(void *a4); +//struct GUIWindow *__thiscall GetCastSpellInInventoryWindow(void *a4); bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem(); void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb void OnInventoryLeftClick();