view UI/Books/UINotesBooks.cpp @ 1419:9a1adf08f4ed

more label cleaning 2
author zipi
date Sun, 28 Jul 2013 18:54:40 +0100
parents 38df78aba732
children c7489dd19f88
line wrap: on
line source


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <assert.h>

#include "..\..\MM7.h"
#include "..\..\Render.h"
#include "..\..\Mouse.h"
#include "..\UIBooks.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"




//----- (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);
    }





//----- (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];//(&dword_722F10)[4 * v4];
        a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4], 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].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;
                        }
                    }
                }
            ++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].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].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;
        }
    }

    //----- (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 = BuildDialogueString(
         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;
  }
}