Mercurial > mm7
diff UIBooks.cpp @ 706:d6236f6a9882
Rough function rearranging to new files
author | Gloval |
---|---|
date | Tue, 19 Mar 2013 21:53:21 +0400 |
parents | d5b16a44d9b3 |
children | af08fc9e29c8 |
line wrap: on
line diff
--- a/UIBooks.cpp Mon Mar 18 21:50:20 2013 +0000 +++ b/UIBooks.cpp Tue Mar 19 21:53:21 2013 +0400 @@ -0,0 +1,1557 @@ +#include <assert.h> + +#include "MM7.h" + +#include "MapInfo.h" +#include "Game.h" +#include "GUIWindow.h" +#include "GUIFont.h" +#include "GUIButton.h" +#include "GUIProgressBar.h" +#include "Party.h" +#include "AudioPlayer.h" +#include "Outdoor.h" +#include "IndoorCamera.h" +#include "Overlays.h" +#include "Monsters.h" +#include "Arcomage.h" +#include "LOD.h" +#include "Actor.h" +#include "Allocator.h" +#include "Events.h" +#include "Viewport.h" +#include "FrameTableInc.h" +#include "Math.h" +#include "SpriteObject.h" +#include "ObjectList.h" +#include "Chest.h" +#include "PaletteManager.h" +#include "DecorationList.h" +#include "SaveLoad.h" +#include "stru123.h" +#include "Time.h" +#include "IconFrameTable.h" +#include "Awards.h" +#include "Autonotes.h" +#include "stru160.h" +#include "stru279.h" +#include "TurnEngine.h" +#include "stru277.h" +#include "Weather.h" +#include "stru272.h" +#include "stru298.h" +#include "StorylineTextTable.h" +#include "Events2D.h" +#include "texts.h" +#include "stru351.h" + +#include "mm7_data.h" + + + + +//----- (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) -------------------------------------------------------- +GUIWindow *__cdecl sub_41140B() +{ + signed int v0; // esi@1 + GUIButton *v1; // eax@3 + GUIButton *v2; // esi@4 + GUIWindow *result; // eax@5 + + v0 = 0; + do + { + dword_5063D8[11+v0]->Release(); + dword_506408[11+v0]->Release(); + --v0; + } + while ( v0 >= -11 ); + pIcons_LOD->_40F9C5(); + 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; + result = pGUIWindow_CurrentMenu; + pGUIWindow_CurrentMenu->uNumControls = 0; + return result; +} + +//----- (00411473) -------------------------------------------------------- +void __cdecl sub_411473() +{ + pTexture_pagemask->Release(); + pTexture_506448->Release(); + pTexture_50643C->Release(); + for (uint i = 0; i < 8; ++i) + { + pSpellBookPagesTextr[i]->Release(); + pTextures_tabs[i][0]->Release(); + pTextures_tabs[i][1]->Release(); + } + pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0); + pIcons_LOD->_4114F2(); +} + + +//----- (00411597) -------------------------------------------------------- +void __cdecl OnCloseSpellook() +{ + pAllocator->FreeChunk(pSpellFont); + pSpellFont = 0; + pAllocator->FreeChunk(pBookFont); + pBookFont = 0; + pAllocator->FreeChunk(pBook2Font); + pBook2Font = 0; + pAllocator->FreeChunk(pAutonoteFont); + pAutonoteFont = 0; + pTexture_mapbordr->Release(); + pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0); + pIcons_LOD->_4114F2(); + dword_506364 = 0; +} +// 506364: using guessed type int dword_506364; + + + + + + + +//----- (00412AF9) -------------------------------------------------------- +void sub_412AF9() + { + int v0; // ecx@1 + + v0 = 0; + if ( uActiveCharacter ) + v0 = pParty->pPlayers[uActiveCharacter-1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2); + pRenderer->DrawTextureIndexed(8u, 8u, pSpellBookPagesTextr[v0]); + pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C); + pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448); +} + +//----- (00412B58) -------------------------------------------------------- +void __cdecl DrawSpellBookContent() +{ + 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; + + sub_412AF9(); + v0 = pPlayers[uActiveCharacter]; + v1 = 11 * v0->lastOpenedSpellbookPage; + v2 = pIcons_LOD->FindTextureByName("Pending"); + v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); + pRenderer->ClearZBuffer(0, 479); + v4 = 1; + if ( __OFSUB__(v1, v1 + 11) ^ 1 ) + { + do + { + if ( *(&v0->_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 ) + { + v7 = v0->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->_4A612A(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos, + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4); + } + } + } + ++v4; + } + while ( v4 + v1 - 1 < v1 + 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 ) + { + v21 = dword_5063D8[v10]; + v12 = v0->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)&v0->pActiveSkills[12]; + v14 = (unsigned int)&v0->pActiveSkills[12]; + v15 = (unsigned int)&v0->pActiveSkills[12]; + v25 = 0; + do + { + if ( *(short *)a2.x ) + { + if ( v0->lastOpenedSpellbookPage == v13 ) + { + pPageTexture = pTextures_tabs[v13][1]; + switch ( v13 ) + { + case 0: + v14 = 406; + v22 = 9; + goto LABEL_27; + case 1: + v14 = 406; + goto LABEL_38; + case 2: + v14 = 406; + v22 = 84; + goto LABEL_27; + case 3: + v14 = 406; + goto LABEL_26; + case 4: + v14 = 407; + goto LABEL_29; + case 5: + v15 = 196; + goto LABEL_34; + case 6: + v15 = 234; + goto LABEL_34; + case 7: + v15 = 272; + goto LABEL_34; + case 8: + v15 = 309; +LABEL_34: + v14 = 405; + break; + default: + break; + } + } + else + { + pPageTexture = pTextures_tabs[v13][0]; + switch ( v13 ) + { + case 0: + v14 = 415; + v22 = 10; + goto LABEL_27; + case 1: + v14 = 415; +LABEL_38: + v22 = 46; + goto LABEL_27; + case 2: + v14 = 415; + v22 = 83; + goto LABEL_27; + case 3: + v14 = 415; +LABEL_26: + v22 = 121; +LABEL_27: + v15 = v22; + break; + case 4: + v14 = 415; +LABEL_29: + v15 = 158; + break; + case 5: + v15 = 196; + goto LABEL_46; + case 6: + v15 = 234; + goto LABEL_46; + case 7: + v15 = 271; + goto LABEL_46; + case 8: + v15 = 307; +LABEL_46: + v14 = 416; + break; + default: + break; + } + } + pRenderer->DrawTextureTransparent(v14, v15, pPageTexture); + v13 = v25; + } + a2.x += 2; + ++v13; + v25 = v13; + } + while ( v13 < 9 ); +} +// 506408: using guessed type int dword_506408[]; +// 50654C: using guessed type int dword_50654C; + +//----- (00412E85) -------------------------------------------------------- +char __cdecl DrawBook_History() +{ + 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 + int 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 ( dword_506548 || !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 ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) + { + 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 = achievedAwardsIndex[dword_506528]; + a1.uFrameWidth = 460; + a1.uFrameX = 8; + a1.uFrameY = 8; + a1.uFrameHeight = 344; + v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[]; + a1.uFrameZ = 467; + a1.uFrameW = 351; + if ( v3 ) + a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, v3, 3u); + } + 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 ( dword_506544 && dword_506528 + awards_count < awards_count2 ) + { + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + v5 = dword_50651C++; + dword_506528 += awards_count; + byte_506130[v5] = awards_count; + } + if ( dword_506548 && dword_50651C ) + { + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + --dword_50651C; + dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; + } + if ( !awards_count || dword_506528 < 1 ) + { + dword_506528 = 0; + dword_50651C = 0; + } + dword_506544 = 0; + v6 = achievedAwardsIndex[dword_506528]; + dword_506548 = 0; + awards_count = 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]); + LOBYTE(v8) = a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0); + ++awards_count; + } + return (char)v8; +} + + +//----- (00413126) -------------------------------------------------------- +void __cdecl DrawBook_Quests() +{ + 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 ( dword_506548 || !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 ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) + { + 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 = 460; + a1.uFrameHeight = 344; + a1.uFrameX = 8; + a1.uFrameY = 8; + a1.uFrameZ = 467; + a1.uFrameW = 351; + a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[174], 3u); + a1.uFrameX = 48; + a1.uFrameY = 70; + a1.uFrameWidth = 360; + a1.uFrameHeight = 264; + a1.uFrameZ = 407; + a1.uFrameW = 333; + if ( dword_506544 && dword_506528 + awards_count < awards_count2 ) + { + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + v2 = dword_50651C++; + dword_506528 += awards_count; + byte_506130[v2] = awards_count; + } + if ( dword_506548 && dword_50651C ) + { + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + --dword_50651C; + dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; + } + if ( !awards_count || (v3 = dword_506528, dword_506528 < 1) ) + { + v3 = 0; + dword_50651C = 0; + dword_506528 = 0; + } + dword_506544 = 0; + dword_506548 = 0; + awards_count = 0; + while ( v3 < awards_count2 ) + { + v4 = achievedAwardsIndex[v3]; + ++awards_count; + v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; + a1.DrawText(pAutonoteFont, 1, 0, 0, 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 __cdecl DrawBook_Autonotes() +{ + 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 ( dword_506548 || !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 ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) + { + 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 ( !dword_506540 ) + { + if ( dword_506568 ) + { + pRenderer->DrawTextureTransparent( + pViewport->uViewportTL_X + 408, + pViewport->uViewportTL_Y + 113, + pTexture_506390); + v2 = 1; + goto LABEL_16; + } + goto LABEL_14; + } + if ( !dword_506568 ) + { +LABEL_14: + v2 = 1; + goto LABEL_15; + } + v2 = 1; + v31 = 1; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); +LABEL_15: + dword_506568 = 0; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); +LABEL_16: + if ( dword_50653C ) + { + if ( dword_506568 != v2 ) + { + v31 = v2; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + } + } + else + { + if ( dword_506568 != v2 ) + { + v26 = pTexture_506388; + v19 = pViewport->uViewportTL_Y + 150; + v3 = pViewport->uViewportTL_X + 408; + goto LABEL_22; + } + } + v26 = pTexture_50638C; + dword_506568 = v2; + v19 = pViewport->uViewportTL_Y + 150; + v3 = pViewport->uViewportTL_X + 399; +LABEL_22: + pRenderer->DrawTextureTransparent(v3, v19, v26); + if ( dword_506538 ) + { + if ( dword_506568 != 2 ) + { + v31 = v2; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + } + } + else + { + if ( dword_506568 != 2 ) + { + v27 = pTexture_506380; + v20 = pViewport->uViewportTL_Y + 188; + v4 = pViewport->uViewportTL_X + 408; + goto LABEL_28; + } + } + v27 = pTexture_506384; + dword_506568 = 2; + v20 = pViewport->uViewportTL_Y + 188; + v4 = pViewport->uViewportTL_X + 397; +LABEL_28: + pRenderer->DrawTextureTransparent(v4, v20, v27); + if ( dword_506534 ) + { + if ( dword_506568 != 3 ) + { + v31 = v2; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + } + } + else + { + if ( dword_506568 != 3 ) + { + v28 = pTexture_506378; + v21 = pViewport->uViewportTL_Y + 226; + v5 = pViewport->uViewportTL_X + 408; + goto LABEL_34; + } + } + v28 = pTexture_50637C; + dword_506568 = 3; + v21 = pViewport->uViewportTL_Y + 226; + v5 = pViewport->uViewportTL_X + 397; +LABEL_34: + pRenderer->DrawTextureTransparent(v5, v21, v28); + if ( dword_506530 ) + { + if ( dword_506568 != 4 ) + { + v31 = v2; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + } + } + else + { + if ( dword_506568 != 4 ) + { + v29 = pTexture_506370; + v22 = pViewport->uViewportTL_Y + 263; + v6 = pViewport->uViewportTL_X + 408; + goto LABEL_40; + } + } + v29 = pTexture_506374; + dword_506568 = 4; + v22 = pViewport->uViewportTL_Y + 264; + v6 = pViewport->uViewportTL_X + 397; +LABEL_40: + pRenderer->DrawTextureTransparent(v6, v22, v29); + if ( dword_50652C ) + { + if ( dword_506568 != 5 ) + { + v31 = v2; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + } + } + else + { + if ( dword_506568 != 5 ) + { + v30 = pTexture_506368; + v23 = pViewport->uViewportTL_Y + 302; + v7 = pViewport->uViewportTL_X + 408; + goto LABEL_46; + } + } + v30 = pTexture_50636C; + dword_506568 = 5; + v23 = pViewport->uViewportTL_Y + 302; + v7 = pViewport->uViewportTL_X + 397; +LABEL_46: + pRenderer->DrawTextureTransparent(v7, v23, v30); + a1.uFrameWidth = 460; + a1.uFrameHeight = 344; + a1.uFrameX = 8; + a1.uFrameY = 8; + a1.uFrameZ = 467; + a1.uFrameW = 467; + a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[154], 3u); + a1.uFrameX = 48; + a1.uFrameY = 70; + a1.uFrameWidth = 360; + a1.uFrameHeight = 264; + a1.uFrameZ = 407; + a1.uFrameW = 333; + if ( v31 ) + { + awards_count2 = 0; + dword_506528 = 0; + dword_50651C = 0; + awards_count = 0; + v8 = 0; + do + { + //if ( dword_72371C[2 * v8] == dword_506568 ) + if ( pAutonoteTxt[v8-1].eType == dword_506568 ) + { + //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 = awards_count++; + achievedAwardsIndex[v9] = (signed __int16)v8; + } + } + } + ++v8; + } + while ( v8 < 196 ); + awards_count2 = awards_count; + } + else + { + if ( dword_506544 ) + { + v10 = awards_count + dword_506528; + if ( awards_count + dword_506528 < awards_count2 ) + { + v11 = dword_50651C++; + byte_506130[v11] = awards_count; + dword_506528 = v10; + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + } + } + if ( dword_506548 && dword_50651C ) + { + --dword_50651C; + dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + } + if ( !awards_count || dword_506528 < 1 ) + { + dword_506528 = 0; + dword_50651C = 0; + } + } + v12 = dword_506528; + dword_50652C = 0; + dword_506544 = 0; + dword_506548 = 0; + awards_count = 0; + dword_506530 = 0; + dword_506534 = 0; + dword_506538 = 0; + dword_50653C = 0; + dword_506540 = 0; + while ( v12 < awards_count2 ) + { + v13 = achievedAwardsIndex[v12]; + ++awards_count; + //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, 0, 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 DrawBook_Maps() + { + + 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 ( dword_506548 || 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 ( dword_506544 || 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 ( dword_506540 ) + { + 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 ( dword_50653C ) + { + 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 ( dword_506538 ) + { + 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 ( dword_506534 ) + { + 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 ( dword_506544 ) + viewparams->CenterOnParty2(); + if ( dword_506548 ) + viewparams->CenterOnParty(); + if ( dword_506540 ) + viewparams->_443219(); + if ( dword_50653C ) + viewparams->_443231(); + if ( dword_506538 ) + viewparams->_44323D(); + if ( dword_506534 ) + viewparams->_443225(); + + if ( dword_506548 | dword_506544 | dword_506540 | dword_50653C | dword_506538 | dword_506534 ) + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + dword_506548 = 0; + dword_506544 = 0; + dword_506534 = 0; + dword_506538 = 0; + dword_50653C = 0; + dword_506540 = 0; + DrawBook_Map_sub(97, 49, 361, 313, 0); + pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); + map_window.uFrameWidth = 460; + map_window.uFrameHeight = 344; + map_window.uFrameX = 8; + map_window.uFrameY = 8; + map_window.uFrameZ = 467; + map_window.uFrameW = 467; + map_id = pMapStats->GetMapInfo(pCurrentMapName); + if ( map_id ) + map_window.DrawTitleText(pBook2Font, -14, 12, 0, 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, 0, 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->Clip_v2(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->field_38; + v86 = viewparams->field_38; + v84 = viewparams->field_3A; + 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; + 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 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); + teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(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->Line2D( + 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->Line2D( + 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, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); + } + result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(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->field_1C_clipx ) + { + if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) + { + v74 = v86; + if ( v5 > 512 ) + { + v96 = v55 + 1; + black = v55 - 1; + pRenderer->Line2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); + pRenderer->Line2D(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->Line2D(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 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(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 ); + } + } + } + + + + +//----- (00413CC6) -------------------------------------------------------- +void __thiscall SellectDrawBook(unsigned int uBook) +{ + enum WindowType pWindowType; // esi@1 + + pWindowType = (enum WindowType)uBook; + pRenderer->DrawTextureIndexed(471u, 445u, (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); + switch ( pWindowType ) + { + case WINDOW_Lloyd: // 177 + DrawLloydBeaconsScreen(); + break; + case WINDOW_TownPortal: //195 + DrawTownPortalScreen(); + break; + case WINDOW_QuestBook: //200 + DrawBook_Quests(); + break; + case WINDOW_AutonotesBook: //201 + DrawBook_Autonotes(); + break; + case WINDOW_MapsBook://202 + DrawBook_Maps(); + break; + case WINDOW_CalendarBook://203 + DrawBook_Calendar(); + break; + case WINDOW_HistoryBook://224 + DrawBook_History(); + break; + } +}