view GUIButton.cpp @ 212:9f349addbe00

Слияние
author Ritor1
date Sat, 16 Feb 2013 22:14:04 +0600
parents 89240115d392
children ea55d6414029
line wrap: on
line source

#include "GUIButton.h"
#include "GUIWindow.h"
#include "GUIFont.h"
#include "Allocator.h"

#include "mm7_data.h"






struct GUIButton *pBtn_CloseBook;
struct GUIButton *pBtn_InstallRemoveSpell;
struct GUIButton *pBtn_Autonotes_Instructors;
struct GUIButton *pBtn_Autonotes_Misc;
struct GUIButton *pBtn_Book_6;
struct GUIButton *pBtn_Book_5;
struct GUIButton *pBtn_Book_4;
struct GUIButton *pBtn_Book_3;
struct GUIButton *pBtn_Book_2;
struct GUIButton *pBtn_Book_1;


struct GUIButton *pPlayerCreationUI_BtnReset;
struct GUIButton *pPlayerCreationUI_BtnOK;
struct GUIButton *pBtn_ExitCancel;
struct GUIButton *pBtn_YES;
struct GUIButton *pPlayerCreationUI_BtnPlus;
struct GUIButton *pPlayerCreationUI_BtnMinus;


struct GUIButton *pButton_RestUI_Main;
struct GUIButton *pButton_RestUI_Exit;
struct GUIButton *pButton_RestUI_Wait5Minutes;
struct GUIButton *pButton_RestUI_WaitUntilDawn;
struct GUIButton *pButton_RestUI_Wait1Hour;


struct GUIButton *pCharacterScreen_ExitBtn;
struct GUIButton *pCharacterScreen_AwardsBtn;
struct GUIButton *pCharacterScreen_InventoryBtn;
struct GUIButton *pCharacterScreen_SkillsBtn;
struct GUIButton *pCharacterScreen_StatsBtn;
struct GUIButton *pCharacterScreen_DollBtn;
struct GUIButton *pCharacterScreen_DetalizBtn;


struct GUIButton *pBtn_NPCRight;
struct GUIButton *pBtn_NPCLeft;
struct GUIButton *pBtn_GameSettings;
struct GUIButton *pBtn_QuickReference;
struct GUIButton *pBtn_CastSpell;
struct GUIButton *pBtn_Rest;
struct GUIButton *pBtn_History;
struct GUIButton *pBtn_Calendar;
struct GUIButton *pBtn_Maps;
struct GUIButton *pBtn_Autonotes;
struct GUIButton *pBtn_Quests;


struct GUIButton *pMainMenu_BtnExit;
struct GUIButton *pMainMenu_BtnCredits;
struct GUIButton *pMainMenu_BtnLoad;
struct GUIButton *pMainMenu_BtnNew;


struct GUIButton *pBtn_Up;
struct GUIButton *pBtn_Down;
struct GUIButton *ptr_507BA4;


struct GUIWindow *pPrimaryWindow;
struct GUIWindow *pChestWindow;
struct GUIWindow *pDialogueWindow;
struct GUIWindow *ptr_507BC0;
struct GUIWindow *pGUIWindow_ScrollWindow;
struct GUIWindow *ptr_507BC8;
struct GUIWindow *pGUIWindow_CurrentMenu;
struct GUIWindow *ptr_507BD0;
struct GUIWindow *pGUIWindow_Settings;
struct GUIWindow *ptr_507BDC;
struct GUIWindow *pGUIWindow_EscMessageWindow;
struct GUIWindow *pBooksWindow;
struct GUIWindow *pGUIWindow2;


struct GUIButton *pBtn_Resume;
struct GUIButton *pBtn_QuitGame;
struct GUIButton *pBtn_GameControls;
struct GUIButton *pBtn_LoadGame;
struct GUIButton *pBtn_SaveGame;
struct GUIButton *pBtn_NewGame;

struct GUIButton *pBtn_SliderRight;
struct GUIButton *pBtn_SliderLeft;


struct GUIButton *pBtnDownArrow;
struct GUIButton *pBtnArrowUp;
struct GUIButton *pBtnCancel;
struct GUIButton *pBtnLoadSlot;


GUIButton *pCreationUI_BtnPressRight2[4];
GUIButton *pCreationUI_BtnPressLeft2[4];
GUIButton *pCreationUI_BtnPressLeft[4];
GUIButton *pCreationUI_BtnPressRight[4];






//----- (0041D0D8) --------------------------------------------------------
void GUIButton::_41D0D8(GUIButton *ptr)
{
  GUIWindow *v1; // eax@2
  GUIButton *v2; // edx@2
  GUIButton *v3; // eax@6

  if ( ptr )
  {
    v1 = ptr->pParent;
    v2 = ptr->pNext;
    if ( ptr == v1->pControlsHead )
    {
      if ( v2 )
      {
        v1->pControlsHead = v2;
        ptr->pNext->pPrev = 0;
      }
      else
      {
        v1->pControlsHead = 0;
        ptr->pParent->pControlsTail = 0;
      }
    }
    else
    {
      v3 = ptr->pPrev;
      if ( v2 )
      {
        v3->pNext = v2;
        ptr->pNext->pPrev = v3;
      }
      else
      {
        v3->pNext = 0;
        ptr->pParent->pControlsTail = v3;
      }
    }
    --ptr->pParent->uNumControls;
    pAllocator->FreeChunk(ptr);
  }
}


//----- (00415180) --------------------------------------------------------
char GUIButton::DrawLabel(const char *edx0, GUIFont *pFont, int a5, int *a9)
{
  const char *v5; // ebx@1
  GUIButton *v6; // esi@1
  int v7; // eax@1

  v5 = edx0;
  v6 = this;
  //strlen(edx0);
  v7 = pFont->GetLineWidth(edx0);
  return pParent->DrawText(
           pFont,
           v6->uX + (signed int)(v6->uWidth - v7) / 2,
           v6->uY + (signed int)(v6->uHeight - LOBYTE(pFont->uFontHeight)) / 2,
           a5,
           v5,
           0,
           0,
           (unsigned int)a9);
}