Mercurial > mm7
view UIBooks.cpp @ 1242:30df39a3aa92
Merge
author | Gloval |
---|---|
date | Mon, 10 Jun 2013 00:09:36 +0400 |
parents | 8c02e6f74b29 |
children |
line wrap: on
line source
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <assert.h> #include "MM7.h" #include "Mouse.h" #include "MapInfo.h" #include "GUIWindow.h" #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" //----- (00411150) -------------------------------------------------------- void BookUI_DrawTownPortalMap() { //signed int v0; // edi@1 //__int16 v1; // dx@8 //POINT *v2; // edi@17 int v3; // edi@17 //__int16 v4; // dx@24 GUIWindow v6; // [sp+Ch] [bp-64h]@1 //POINT v7; // [sp+60h] [bp-10h]@17 POINT a2; // [sp+68h] [bp-8h]@17 pRenderer->ClearZBuffer(0, 479); pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook); pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); v6.uFrameX = game_viewport_x; v6.uFrameY = game_viewport_y; v6.uFrameWidth = game_viewport_width; v6.uFrameHeight = game_viewport_height; v6.uFrameZ = game_viewport_z; v6.uFrameW = game_viewport_w; const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE, PARTY_QUEST_FOUNTAIN_PIERPONT, PARTY_QUEST_FOUNTAIN_NIGHON, PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE, PARTY_QUEST_FOUNTAIN_CELESTIA, PARTY_QUEST_FOUNTAIN_THE_PIT}; for (uint i = 0; i < 6; ++i) { if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i])) pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTexture_TownPortalIcons[i], i + 1); } /* v0 = 0; do { if ( !v0 ) { v1 = 206; LABEL_14: if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) ) goto LABEL_16; goto LABEL_15; } if ( v0 == 1 ) { v1 = 208; goto LABEL_14; } if ( v0 == 2 ) { v1 = 207; goto LABEL_14; } if ( v0 == 3 ) { v1 = 211; goto LABEL_14; } if ( v0 == 4 ) { v1 = 209; goto LABEL_14; } if ( v0 == 5 ) { v1 = 210; goto LABEL_14; } LABEL_15: pRenderer->DrawMaskToZBuffer( pTownPortalBook_xs[v0], pTownPortalBook_ys[v0], *(&pTexture_TownPortalHarmn + v0), v0 + 1); LABEL_16: ++v0; } while ( v0 < 6 );*/ pMouse->GetCursorPos(&a2); //v2 = pMouse->GetCursorPos(&a2); v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; if (v3) { if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1])) pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]); } v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); /* if ( !v3 ) // Town Portal { v6.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); // "Town Portal" return; } if ( v3 == 1 ) { v4 = 206; LABEL_30: if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) ) goto LABEL_31; v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); // "Town Portal" return; } if ( v3 == 2 ) { v4 = 208; goto LABEL_30; } if ( v3 == 3 ) { v4 = 207; goto LABEL_30; } if ( v3 == 4 ) { v4 = 211; goto LABEL_30; } if ( v3 == 5 ) { v4 = 209; goto LABEL_30; } if ( v3 == 6 ) { v4 = 210; goto LABEL_30; } LABEL_31: pRenderer->DrawTextureIndexed(word_4E1D3A[v3], pTownPortalBook_xs[v3 + 5], *(&pTex_tab_an_6b__zoom_on + v3)); v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/ } // 4E1D3A: using guessed type __int16 word_4E1D3A[]; //----- (00413CC6) -------------------------------------------------------- void BookUI_Draw(WindowType book) { pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); switch (book) { case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; case WINDOW_MapsBook: BookUI_Map_Draw(); break; case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; case WINDOW_JournalBook: BookUI_Journal_Draw(); break; case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break; } } //----- (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" } //----- (00413D6F) -------------------------------------------------------- void BookUI_Calendar_Draw() { unsigned int v0; // esi@1 //char *v1; // eax@5 int v2; // ecx@5 char *v3; // eax@6 GUIWindow a1; // [sp+Ch] [bp-60h]@5 unsigned int v6; // [sp+60h] [bp-Ch]@1 //int v7; // [sp+64h] [bp-8h]@1 //int a5; // [sp+68h] [bp-4h]@1 static unsigned int pDayMoonPhase[28] = // 4E1B18 { 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1 }; v0 = pParty->uCurrentHour; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); if ( (signed int)v0 <= 12 ) { if ( !v0 ) v0 = 12; } else { v0 -= 12; } a1.uFrameX = game_viewport_x; a1.uFrameY = game_viewport_y; a1.uFrameWidth = game_viewport_width; a1.uFrameHeight = game_viewport_height; a1.uFrameZ = game_viewport_z; a1.uFrameW = game_viewport_w; a1.DrawTitleText(pBook2Font, 0, 0x16u, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia" v2 = 0; if ( pParty->uCurrentHour >= 12 ) { if ( pParty->uCurrentHour >= 24 ) v2=0; else v2=1; } sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s", pGlobalTXT_LocalizationStrings[526], // "Time" v0, pParty->uCurrentMinute, aAMPMNames[v2], GetDayPart()); a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0); sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[56], // "Day" pParty->uDaysPlayed + 1, aDayNames[pParty->uDaysPlayed % 7]); a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0); sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[146], // "Month" pParty->uCurrentMonth + 1, aMonthNames[pParty->uCurrentMonth]); a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0); sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year" a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0); sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon" a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0); v6 = pMapStats->GetMapInfo(pCurrentMapName.data()); if ( v6 ) v3 = pMapStats->pInfos[v6].pName; else v3 = "Unknown"; sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location" a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0); } //----- (0041192C) -------------------------------------------------------- void InitializeBookTextures() { //signed int v0; // ebp@3 //Texture **v1; // ebx@3 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); pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); //v0 = 1; static const char *texNames[9] = // 004E24EC { "SBFB00", "SBAB00", "SBWB00", "SBEB00", "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" }; pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); for (uint i = 0; i < 9; ++i) { pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); 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); 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); pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); } //----- (00411300) -------------------------------------------------------- void LoadSpellbook(unsigned int spell_school) { //unsigned int v1; // esi@1 Player *pPlayer; // ecx@1 char v3; // al@1 //int v4; // edi@5 //Texture *result; // eax@6 //unsigned char *v6; // edi@7 //unsigned int v7; // eax@7 //unsigned __int8 v8; // sf@8 //unsigned __int8 v9; // of@8 char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 //Texture *v11; // [sp+20h] [bp-8h]@5 //int v12; // [sp+24h] [bp-4h]@5 byte_506550 = 0; //v1 = uID; pPlayer = pPlayers[uActiveCharacter]; v3 = pPlayer->uQuickSpell; if ( v3 && (unsigned __int8)v3 / 11 == spell_school ) quick_spell_at_page = (unsigned __int8)v3 - 11 * spell_school; else quick_spell_at_page = 0; for (uint i = 1; i < 12; ++i) { if (pPlayer->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) { sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); dword_506408[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); dword_5063D8[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); } } } //----- (0041140B) -------------------------------------------------------- void sub_41140B() { signed int v0; // esi@1 GUIButton *v1; // eax@3 GUIButton *v2; // esi@4 v0 = 0; do { dword_5063D8[11+v0]->Release(); dword_506408[11+v0]->Release(); --v0; } while ( v0 >= -11 ); pIcons_LOD->SyncLoadedFilesCount(); v1 = pGUIWindow_CurrentMenu->pControlsHead; if ( v1 ) { do { v2 = v1->pNext; pAllocator->FreeChunk(v1); v1 = v2; } while ( v2 ); } pGUIWindow_CurrentMenu->pControlsHead = 0; pGUIWindow_CurrentMenu->pControlsTail = 0; pGUIWindow_CurrentMenu->uNumControls = 0; } //----- (00411473) -------------------------------------------------------- void sub_411473() { pTexture_pagemask->Release(); pTexture_506448->Release(); pTexture_50643C->Release(); for (uint i = 0; i < 9; ++i) { pSpellBookPagesTextr[i]->Release(); pTextures_tabs[i][0]->Release(); pTextures_tabs[i][1]->Release(); } pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); pIcons_LOD->_4114F2(); } //----- (00411597) -------------------------------------------------------- void OnCloseSpellBook() { 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->_4114F2(); dword_506364 = 0; } //----- (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 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); if ( BtnUp_flag || !dword_506528 ) { v13 = pTex_tab_an_6a__zoom_off; v11 = pViewport->uViewportTL_Y + 2; v0 = pViewport->uViewportTL_X + 407; } else { v13 = pTex_tab_an_6b__zoom_on; v11 = pViewport->uViewportTL_Y + 1; v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v11, v13); if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) { v14 = pTex_tab_an_7a__zoot_off; v12 = pViewport->uViewportTL_Y + 38; v1 = pViewport->uViewportTL_X + 407; } else { v14 = pTex_tab_an_7b__zoot_on; v12 = pViewport->uViewportTL_Y + 38; v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v12, v14); if ( !byte_5C6D50[dword_506528] ) { v2 = achieved_awards[dword_506528]; 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); } 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 && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); v5 = dword_50651C++; dword_506528 += num_achieved_awards; byte_506130[v5] = num_achieved_awards; } if ( BtnUp_flag && dword_50651C ) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); --dword_50651C; dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; } if ( !num_achieved_awards || dword_506528 < 1 ) { dword_506528 = 0; dword_50651C = 0; } BtnDown_flag = 0; v6 = achieved_awards[dword_506528]; 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 = BuilDialogueString( pStorylineText->StoreLine[v6].pText, uActiveCharacter - 1, 0, 0, 0, (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); if ( v7 ) { v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]); a1.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, ui_book_journal_text_shadow); ++num_achieved_awards; } } //----- (00413126) -------------------------------------------------------- void BookUI_Questbook_Draw() { unsigned int v0; // eax@3 unsigned int v1; // eax@7 int v2; // ecx@11 int v3; // ebx@16 int v4; // eax@19 const char *v5; // edi@19 int v6; // eax@19 unsigned int v7; // edi@19 unsigned int v8; // [sp-8h] [bp-68h]@3 unsigned int v9; // [sp-8h] [bp-68h]@7 Texture *v10; // [sp-4h] [bp-64h]@3 Texture *v11; // [sp-4h] [bp-64h]@7 GUIWindow a1; // [sp+Ch] [bp-54h]@9 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); if ( BtnUp_flag || !dword_506528 ) { v10 = pTex_tab_an_6a__zoom_off; v8 = pViewport->uViewportTL_Y + 2; v0 = pViewport->uViewportTL_X + 407; } else { v10 = pTex_tab_an_6b__zoom_on; v8 = pViewport->uViewportTL_Y + 1; v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v8, v10); if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) { v11 = pTex_tab_an_7a__zoot_off; v9 = pViewport->uViewportTL_Y + 38; v1 = pViewport->uViewportTL_X + 407; } else { v11 = pTex_tab_an_7b__zoot_on; v9 = pViewport->uViewportTL_Y + 38; v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v9, v11); a1.uFrameWidth = game_viewport_width; a1.uFrameHeight = game_viewport_height; a1.uFrameX = game_viewport_x; a1.uFrameY = game_viewport_y; a1.uFrameZ = game_viewport_z; a1.uFrameW = game_viewport_w; a1.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" a1.uFrameX = 48; a1.uFrameY = 70; a1.uFrameWidth = 360; a1.uFrameHeight = 264; a1.uFrameZ = 407; a1.uFrameW = 333; if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); v2 = dword_50651C++; dword_506528 += num_achieved_awards; byte_506130[v2] = num_achieved_awards; } if ( BtnUp_flag && dword_50651C ) { pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); --dword_50651C; dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; } if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) ) { v3 = 0; dword_50651C = 0; dword_506528 = 0; } BtnDown_flag = 0; BtnUp_flag = 0; num_achieved_awards = 0; while ( v3 < num_achieved_awards_2 ) { v4 = achieved_awards[v3]; ++num_achieved_awards; v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0); v7 = a1.uFrameY + v6; if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight ) break; pRenderer->DrawTextureTransparent(100, v7 + 12, pSpellBookPagesTextr_10); ++v3; a1.uFrameY = v7 + 24; } } //----- (0041338E) -------------------------------------------------------- void BookUI_Autonotes_Draw() { unsigned int v0; // eax@3 unsigned int v1; // eax@7 signed int v2; // ebp@11 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 v17; // [sp-8h] [bp-70h]@3 unsigned int v18; // [sp-8h] [bp-70h]@7 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 *v24; // [sp-4h] [bp-6Ch]@3 Texture *v25; // [sp-4h] [bp-6Ch]@7 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 GUIWindow a1; // [sp+14h] [bp-54h]@46 v31 = 0; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); if ( BtnUp_flag || !dword_506528 ) { v24 = pTex_tab_an_6a__zoom_off; v17 = pViewport->uViewportTL_Y + 2; v0 = pViewport->uViewportTL_X + 407; } else { v24 = pTex_tab_an_6b__zoom_on; v17 = pViewport->uViewportTL_Y + 1; v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v17, v24); if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) { v25 = pTex_tab_an_7a__zoot_off; v18 = pViewport->uViewportTL_Y + 38; v1 = pViewport->uViewportTL_X + 407; } else { v25 = pTex_tab_an_7b__zoot_on; v18 = pViewport->uViewportTL_Y + 38; v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v18, v25); if ( !Book_PageBtn3_flag )//Potions_page_flag { if (_506568_autonote_type != AUTONOTE_POTION_RECEPIE) { pRenderer->DrawTextureTransparent( pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTexture_506390); v2 = 1; goto LABEL_16; } goto LABEL_14; } if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE) { LABEL_14: v2 = 1; goto LABEL_15; } v2 = 1; v31 = 1; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); LABEL_15: _506568_autonote_type = AUTONOTE_POTION_RECEPIE; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); LABEL_16: if ( Book_PageBtn4_flag )//Fontains_page_flag { if ( _506568_autonote_type != v2 ) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); } } else { if ( _506568_autonote_type != v2 ) { v26 = pTexture_506388; v19 = pViewport->uViewportTL_Y + 150; v3 = pViewport->uViewportTL_X + 408; goto LABEL_22; } } v26 = pTexture_50638C; _506568_autonote_type = v2; v19 = pViewport->uViewportTL_Y + 150; v3 = pViewport->uViewportTL_X + 399; LABEL_22: pRenderer->DrawTextureTransparent(v3, v19, v26); if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag { if ( _506568_autonote_type != AUTONOTE_OBELISK) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); } } else { if ( _506568_autonote_type != AUTONOTE_OBELISK) { v27 = pTexture_506380; v20 = pViewport->uViewportTL_Y + 188; v4 = pViewport->uViewportTL_X + 408; goto LABEL_28; } } v27 = pTexture_506384; _506568_autonote_type = AUTONOTE_OBELISK; v20 = pViewport->uViewportTL_Y + 188; v4 = pViewport->uViewportTL_X + 397; LABEL_28: pRenderer->DrawTextureTransparent(v4, v20, v27); if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag { if ( _506568_autonote_type != AUTONOTE_SEER) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); } } else { if ( _506568_autonote_type != AUTONOTE_SEER) { v28 = pTexture_506378; v21 = pViewport->uViewportTL_Y + 226; v5 = pViewport->uViewportTL_X + 408; goto LABEL_34; } } v28 = pTexture_50637C; _506568_autonote_type = AUTONOTE_SEER; v21 = pViewport->uViewportTL_Y + 226; v5 = pViewport->uViewportTL_X + 397; LABEL_34: pRenderer->DrawTextureTransparent(v5, v21, v28); if ( Autonotes_Misc_page_flag ) { if ( _506568_autonote_type != AUTONOTE_MISC) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); } } else { if ( _506568_autonote_type != AUTONOTE_MISC) { v29 = pTexture_506370; v22 = pViewport->uViewportTL_Y + 263; v6 = pViewport->uViewportTL_X + 408; goto LABEL_40; } } v29 = pTexture_506374; _506568_autonote_type = AUTONOTE_MISC; v22 = pViewport->uViewportTL_Y + 264; v6 = pViewport->uViewportTL_X + 397; LABEL_40: pRenderer->DrawTextureTransparent(v6, v22, v29); if ( Autonotes_Instructors_page_flag ) { if ( _506568_autonote_type != AUTONOTE_TEACHER) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); } } else { if ( _506568_autonote_type != AUTONOTE_TEACHER) { v30 = pTexture_506368; v23 = pViewport->uViewportTL_Y + 302; v7 = pViewport->uViewportTL_X + 408; goto LABEL_46; } } v30 = pTexture_50636C; _506568_autonote_type = AUTONOTE_TEACHER; v23 = pViewport->uViewportTL_Y + 302; v7 = pViewport->uViewportTL_X + 397; LABEL_46: pRenderer->DrawTextureTransparent(v7, v23, v30); a1.uFrameWidth = game_viewport_width; a1.uFrameHeight = game_viewport_height; a1.uFrameX = game_viewport_x; a1.uFrameY = game_viewport_y; a1.uFrameZ = game_viewport_z; a1.uFrameW = game_viewport_w; a1.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" a1.uFrameX = 48; a1.uFrameY = 70; a1.uFrameWidth = 360; a1.uFrameHeight = 264; a1.uFrameZ = 407; a1.uFrameW = 333; if ( v31 ) { num_achieved_awards_2 = 0; dword_506528 = 0; dword_50651C = 0; num_achieved_awards = 0; v8 = 0; do { //if ( dword_72371C[2 * v8] == dword_506568 ) if ( pAutonoteTxt[v8-1].eType == _506568_autonote_type ) { //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; v32 = (char *)pAutonoteTxt[v8-1].pText; if ( (short)v8 ) { if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) { v9 = num_achieved_awards++; achieved_awards[v9] = (AwardType)v8; } } } ++v8; } while ( v8 < 196 ); num_achieved_awards_2 = num_achieved_awards; } else { if ( BtnDown_flag ) { v10 = num_achieved_awards + dword_506528; if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 ) { v11 = dword_50651C++; byte_506130[v11] = num_achieved_awards; dword_506528 = v10; pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); } } if ( BtnUp_flag && dword_50651C ) { --dword_50651C; dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); } if ( !num_achieved_awards || dword_506528 < 1 ) { dword_506528 = 0; dword_50651C = 0; } } v12 = dword_506528; Autonotes_Instructors_page_flag = 0; BtnDown_flag = 0; BtnUp_flag = 0; num_achieved_awards = 0; 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 < num_achieved_awards_2 ) { v13 = achieved_awards[v12]; ++num_achieved_awards; //v14 = (&dword_723718_autonote_related)[8 * v13]; v14 = pAutonoteTxt[v13-1].pText; //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13-1].pText, 0, 0, 0); v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0); v16 = a1.uFrameY + v15; if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight ) break; pRenderer->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10); ++v12; a1.uFrameY = v16 + 24; } } //----- (00413980) -------------------------------------------------------- void BookUI_Map_Draw() { int v6; // eax@31 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; } 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; } 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; } 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; } 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; } 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; } else { buttnTxtr = pTexture_50637C; textrY = pViewport->uViewportTL_Y + 226; textrX = pViewport->uViewportTL_X + 397; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( BtnDown_flag ) viewparams->CenterOnParty2(); if ( BtnUp_flag ) viewparams->CenterOnParty(); if ( Book_PageBtn3_flag ) viewparams->_443219(); if ( Book_PageBtn4_flag ) viewparams->_443231(); if ( Book_PageBtn5_flag ) viewparams->_44323D(); if ( Book_PageBtn6_flag ) viewparams->_443225(); if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag ) pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); BtnUp_flag = 0; BtnDown_flag = 0; Book_PageBtn6_flag = 0; Book_PageBtn5_flag = 0; Book_PageBtn4_flag = 0; Book_PageBtn3_flag = 0; DrawBook_Map_sub(97, 49, 361, 313, 0); pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); map_window.uFrameWidth = game_viewport_width; map_window.uFrameHeight = game_viewport_height; map_window.uFrameX = game_viewport_x; map_window.uFrameY = game_viewport_y; map_window.uFrameZ = game_viewport_z; map_window.uFrameW = game_viewport_w; map_id = pMapStats->GetMapInfo(pCurrentMapName.data()); if ( map_id ) map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3); map_window.uFrameX = 0; sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d" map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0); } //----- (00442955) -------------------------------------------------------- void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) { int v5; // ebx@1 int v6; // edi@1 BLVMapOutlines *v7; // eax@8 unsigned __int8 v8; // zf@8 unsigned __int8 v9; // sf@8 int v10; // esi@10 unsigned int v11; // edx@11 __int16 v12; // cx@12 signed int v13; // eax@15 int v14; // eax@16 Vec3_short_ *v15; // ecx@16 int v16; // edx@16 int v17; // ecx@16 Vec3_short_ *v18; // eax@16 int v19; // ecx@16 int v20; // eax@16 signed int v21; // esi@18 int v22; // ecx@21 BLVMapOutline *v23; // ecx@21 Vec3_short_ *v24; // edx@21 Vec3_short_ *v25; // eax@21 int v26; // ecx@21 unsigned __int16 *v27; // edi@21 int v28; // edx@21 int v29; // eax@21 double v30; // st7@23 signed __int64 v31; // qax@23 unsigned short *v32; // edx@23 int textr_width; // esi@23 signed int v34; // eax@23 signed int v35; // ecx@23 int v36; // esi@27 int v37; // ecx@27 int v38; // edx@31 unsigned int v39; // eax@33 short *v40; // esi@33 short *v41; // edi@33 unsigned __int8 v42; // cf@33 unsigned int v43; // ecx@33 short *v44; // edi@33 short *v45; // esi@33 int v46; // ecx@33 signed int v47; // esi@38 signed int v48; // ecx@38 int v49; // eax@38 signed int v50; // edx@55 unsigned int v51; // ecx@55 int result; // eax@72 int v53; // eax@75 int v54; // esi@75 int v55; // eax@75 __int16 v56; // si@85 double v57; // st7@85 int v58; // ebx@85 signed __int64 v59; // qax@85 signed int v60; // edi@85 signed __int64 v61; // qax@85 signed int v62; // ebx@85 signed int v63; // esi@85 int v64; // eax@87 unsigned int v65; // ebx@95 unsigned short *v66; // edx@95 unsigned __int16 *v67; // esi@96 int v68; // edi@98 unsigned __int16 v69; // cx@99 unsigned int v70; // [sp-10h] [bp-48074h]@80 unsigned int v71; // [sp-Ch] [bp-48070h]@80 unsigned int v72; // [sp-8h] [bp-4806Ch]@80 signed int v73; // [sp-4h] [bp-48068h]@59 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23 int v76; // [sp+4800Ch] [bp-58h]@23 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1 int v81; // [sp+48020h] [bp-44h]@23 unsigned __int16* render16_data; unsigned char* texture8_data; unsigned char* curr_line; int scale_increment; int scaled_posX; int scaled_posY; int stepX_r; int stepY_r; unsigned int teal; // [sp+48028h] [bp-3Ch]@8 int v84; // [sp+4802Ch] [bp-38h]@1 int screenCenter_X; // [sp+48030h] [bp-34h]@1 int v86; // [sp+48034h] [bp-30h]@1 int v87; // [sp+48038h] [bp-2Ch]@16 unsigned int v88; // [sp+4803Ch] [bp-28h]@16 int black; // [sp+48040h] [bp-24h]@8 int screenCenterY; // [sp+48044h] [bp-20h]@1 unsigned int i; // [sp+48048h] [bp-1Ch]@9 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 signed int screenWidth; // [sp+48054h] [bp-10h]@8 unsigned int v95; // [sp+48058h] [bp-Ch]@16 int v96; // [sp+4805Ch] [bp-8h]@10 const void *v97; // [sp+48060h] [bp-4h]@16 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 int a5a; // [sp+48070h] [bp+Ch]@86 tl_x = tl_x; tl_y = tl_y; screenCenter_X = (signed int)(tl_x + br_x) >> 1; screenCenterY = (signed int)(tl_y + br_y) >> 1; surfPitch = pRenderer->uTargetSurfacePitch; pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); v5 = viewparams->field_2C; v6 = viewparams->sViewCenterX; v86 = viewparams->sViewCenterX; v84 = viewparams->sViewCenterY; if ( viewparams->field_2C != 384 ) { if ( viewparams->field_2C == 768 ) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) v5 = 680; } } else { v6 = viewparams->indoor_center_x; v86 = viewparams->indoor_center_x; v84 = viewparams->indoor_center_y; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) v5 = viewparams->field_2C - 34; } if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { screenWidth = br_x - tl_x + 1; screenHeight = br_y - tl_y + 1; render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); v32 = map_texture_16; textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16; v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); v76 = textr_width; scaled_posY = stepY_r >> 16; //nearest neiborhood scaling if ( texture8_data) { for(uint i=0; i<screenHeight;++i) { curr_line=&texture8_data[scaled_posY*textr_width]; stepX_r=teal; for(uint j=0; j<screenWidth;++j) { scaled_posX=stepX_r>>16; map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; stepX_r+=scale_increment; } stepY_r+=scale_increment; scaled_posY=stepY_r>>16; } } //move visible square to render for(uint i=0; i<screenHeight;++i) { if ( screenWidth > 0 ) { memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); } } } else { black = TargetColor(0, 0, 0); teal = TargetColor(0, 0xFFu, 0xFFu); v7 = pIndoor->pMapOutlines; uNumBlueFacesInBLVMinimap = 0; v8 = pIndoor->pMapOutlines->uNumOutlines == 0; v9 = pIndoor->pMapOutlines->uNumOutlines < 0; screenWidth = 0; if ( !(v9 | v8) ) { i = 0; do { v10 = (int)((char *)v7 + i + 4); v96 = pIndoor->pFaces[*(short *)((char *)v7 + i + 8)].uAttributes; if ( !(BYTE1(v96) & 0x20 || (v11 = pIndoor->pFaces[*(short *)((char *)v7 + i + 10)].uAttributes, BYTE1(v11) & 0x20) )) { v12 = *(short *)((char *)v7 + i + 14); if ( !(v12 & 1) ) { if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) { v96 = (signed int)screenWidth >> 3; v13 = screenWidth; *(short *)(v10 + 10) = v12 | 1; pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); } } if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1) { v14 = *(short *)v10; v88 = v5; v15 = &pIndoor->pVertices[v14]; v16 = v15->x; v17 = v15->y - v84; v93 = (unsigned __int16 *)(v16 - v6); screenHeight = v17; v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; v19 = v18->x; v20 = v18->y - v84; v95 = v19 - v6; v97 = (const void *)v20; v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16; v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; pRenderer->RasterLine2D( screenCenter_X + v88, screenCenterY - v87, screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), screenCenterY - screenHeight, black); v7 = pIndoor->pMapOutlines; } } ++screenWidth; i += 12; } while ( screenWidth < (signed int)v7->uNumOutlines ); } v21 = 0; if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) { while ( 1 ) { v22 = pBlueFacesInBLVMinimapIDs[v21]; v87 = v5; v23 = &v7->pOutlines[v22]; v24 = &pIndoor->pVertices[v23->uVertex1ID]; v25 = &pIndoor->pVertices[v23->uVertex2ID]; v26 = v25->x; v27 = (unsigned __int16 *)(v24->x - v86); v28 = v24->y - v84; v29 = v25->y - v84; v93 = v27; screenHeight = v28; v97 = (const void *)v29; v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; pRenderer->RasterLine2D( screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), screenCenterY - v95, teal); ++v21; if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) break; v7 = pIndoor->pMapOutlines; } v6 = v86; } } v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3; v81 = pParty->vPosition.y - v84; v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); v48 = 1; v49 = screenCenterY - (int)v97 - 3; if ( v47 >= (signed int)tl_x ) { if ( v47 > (signed int)br_x ) { if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x ) v48 = 0; v47 = br_x; } } else { if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x ) v48 = 0; v47 = tl_x; } if ( v49 >= (signed int)tl_y ) { if ( v49 > br_y ) { if ( screenCenterY - (signed int)v97 - 6 > br_y ) v48 = 0; v49 = br_y; } } else { if ( screenCenterY - (signed int)v97 < (signed int)tl_y ) v48 = 0; v49 = tl_y; } if ( v48 == 1 ) { v50 = 0; v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; if ( (signed int)(pParty->sRotationY & stru_5C6E00->uDoublePiMask) >= 128 ) { if ( (signed int)v51 > 384 ) { if ( (signed int)v51 >= 640 ) { if ( (signed int)v51 > 896 ) { if ( (signed int)v51 >= 1152 ) { if ( (signed int)v51 > 1408 ) { if ( (signed int)v51 >= 1664 ) { if ( (signed int)v51 <= 1920 ) v73 = 7; } else { v73 = 6; } } else { v73 = 5; } } else { v73 = 4; } } else { v73 = 3; } } else { v73 = 2; } if( (signed int)v51 <=1920) v50 = v73; } else v50 = 1; } pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); } result = TargetColor(0xFFu, 0xFFu, 0xFFu); v95 = 0; v86 = result; if ( (signed int)uNumLevelDecorations > 0 ) { screenWidth = (unsigned int)&pLevelDecorations[0].vPosition; do { if ( *(char *)(screenWidth - 2) & 8 ) { v53 = *(int *)(screenWidth + 4) - v84; v93 = (unsigned __int16 *)(*(int *)screenWidth - v6); screenHeight = v53; v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); v55 = screenCenterY - (int)v97; if ( v54 >= pRenderer->raster_clip_x ) { if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) { v74 = v86; if ( v5 > 512 ) { v96 = v55 + 1; black = v55 - 1; pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); pRenderer->RasterLine2D(v54, black, v54, v96, v86); ++v54; v74 = v86; v72 = v96; v71 = v54; v70 = black; } else { v72 = screenCenterY - (int)v97; v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; v70 = screenCenterY - (int)v97; } pRenderer->RasterLine2D(v54, v70, v71, v72, v74); } } } ++v95; result = v95; screenWidth += 32; } while ( (signed int)v95 < (signed int)uNumLevelDecorations ); } if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { screenCenterY = br_x - tl_x + 1; v95 = br_y - tl_y + 1; v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; black = (1 << (v56 + 16)) / v5; v57 = (double)(1 << (16 - v56)); v58 = 22528 / (v5 / 384); v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57); v60 = (int)v59 << 16; v97 = (const void *)((int)v59 << 16); v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); pPalette_16 = (unsigned __int16 *)(v60 >> 16); v62 = (int)v61 << 16; teal = v60 >> 16; v63 = (signed __int16)v61; a4a = map_texture_16; result = TargetColor(0xCu, 0xCu, 0xCu); screenCenter_X = 0; for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X ) { a5a = 0; if ( screenCenterY > 0 ) { v96 = (v63 - 80) / 4; v64 = teal; do { v81 = (v64 - 80) / 4; if ( !pOutdoor->_47F04C(v81, v96) ) { if ( pOutdoor->_47F097(v81, v96) ) { if ( !((a5a + screenCenter_X) % 2) ) *a4a = i; } else { *a4a = 0; } } ++a4a; v97 = (char *)v97 + black; v64 = (signed int)v97 >> 16; ++a5a; } while ( a5a < screenCenterY ); } v62 += black; v97 = (const void *)v60; a4a += screenCenterY - a5a; v63 = v62 >> 16; ++screenCenter_X; teal = (unsigned int)pPalette_16; } v65 = v95; v66 = map_texture_16; if ( (signed int)v95 > 0 ) { v67 = v77; result = 2 * (surfPitch - screenCenterY); do { if ( screenCenterY > 0 ) { v68 = screenCenterY; do { v69 = *(short *)v66; if ( !*(short *)v66 || v69 == (short)i ) *v67 = v69; ++v66; ++v67; --v68; } while ( v68 ); } v67 = (unsigned __int16 *)((char *)v67 + result); --v65; } while ( v65 ); } } } //----- (00412AF9) -------------------------------------------------------- static void BookUI_Spellbook_DrawCurrentSchoolBackground() { int v0; // ecx@1 v0 = 0; if ( uActiveCharacter ) v0 = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2); pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[v0]); pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C); pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448); } //----- (00412B58) -------------------------------------------------------- void DrawSpellBookContent(Player *player) { //Player *v0; // ebx@1 int v1; // ebp@1 //unsigned int v2; // eax@1 Texture *v3; // edi@1 int v4; // esi@1 Texture *v5; // eax@3 Texture *v6; // edx@5 int v7; // eax@8 int v8; // eax@11 POINT *v9; // esi@13 int v10; // eax@13 Texture *v11; // edx@14 int v12; // eax@15 signed int v13; // ecx@18 unsigned int v14; // esi@18 unsigned int v15; // edi@18 Texture *pPageTexture; // eax@21 unsigned int v17; // [sp-Ch] [bp-2Ch]@8 unsigned int v18; // [sp-Ch] [bp-2Ch]@15 unsigned int v19; // [sp-8h] [bp-28h]@8 unsigned int v20; // [sp-8h] [bp-28h]@15 Texture *v21; // [sp-4h] [bp-24h]@15 signed int v22; // [sp-4h] [bp-24h]@22 Texture *v23; // [sp+10h] [bp-10h]@5 POINT a2; // [sp+18h] [bp-8h]@13 POINT v24; int v25; static unsigned int texture_tab_coord1[9][2]= {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; static unsigned int texture_tab_coord0[9][2]= {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} }; BookUI_Spellbook_DrawCurrentSchoolBackground(); //v0 = pPlayers[uActiveCharacter]; v1 = 11 * player->lastOpenedSpellbookPage; //v2 = pIcons_LOD->FindTextureByName("Pending"); v3 = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); pRenderer->ClearZBuffer(0, 479); v4 = 1; if ( __OFSUB__(v1, v1 + 11) ^ 1 ) { do { if ( *(&player->_guilds_member_bits[v1 + 63] + v4) ) { v5 = (Texture *)dword_506408[v4]; if ( v5 != v3 ) { if ( quick_spell_at_page == v4 ) { v6 = dword_5063D8[v4]; v23 = dword_5063D8[v4]; } else { v23 = dword_506408[v4]; v6 = v5; } if ( v6->pLevelOfDetail0_prolly_alpha_mask ) { v7 = player->lastOpenedSpellbookPage; // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos; v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos; if ( BYTE1(v6->pBits) & 2 ) pRenderer->DrawTextureTransparent(v17, v19, v6); else pRenderer->DrawTextureIndexed(v17, v19, v6); pRenderer->DrawMaskToZBuffer(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos, pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4); } } } ++v4; } while ( v4 - 1 < 11 ); } v9 = pMouse->GetCursorPos(&a2); v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF; if ( v10 ) { v11 = dword_5063D8[v10]; if ( v11->pLevelOfDetail0_prolly_alpha_mask ) { v21 = dword_5063D8[v10]; v12 = player->lastOpenedSpellbookPage; // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos; v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos; if ( BYTE1(v11->pBits) & 2 ) pRenderer->DrawTextureTransparent(v18, v20, v21); else pRenderer->DrawTextureIndexed(v18, v20, v21); } } v13 = 0; a2.x = (LONG)&player->pActiveSkills[12]; v14 = (unsigned int)&player->pActiveSkills[12]; v15 = (unsigned int)&player->pActiveSkills[12]; v25 = 0; do { if ( *(short *)a2.x ) { if ( player->lastOpenedSpellbookPage == v13 ) { pPageTexture = pTextures_tabs[v13][1]; v14=texture_tab_coord1[v13][0]; v15=texture_tab_coord1[v13][1]; } else { pPageTexture = pTextures_tabs[v13][0]; v14=texture_tab_coord0[v13][0]; v15=texture_tab_coord0[v13][1]; } pRenderer->DrawTextureTransparent(v14, v15, pPageTexture); v13 = v25; } a2.x += 2; ++v13; v25 = v13; } while ( v13 < 9 ); }