view GUIButton.cpp @ 166:87c503d426e0

11.12.2012
author Ritor1
date Tue, 11 Dec 2012 17:23:17 +0600
parents 8b8875f5b359
children 90a9c828c2a6
line wrap: on
line source

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

#include "mm7_data.h"






struct GUIButton *ptr_5064F4;
struct GUIButton *ptr_5064F8;
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 *ptr_5076F4;
struct GUIButton *ptr_5076FC;
struct GUIButton *pPlayerCreationUI_BtnPlus;
struct GUIButton *pPlayerCreationUI_BtnMinus;


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


struct GUIButton *ptr_50767C;
struct GUIButton *pCharacterScreen_AwardsBtn;
struct GUIButton *pCharacterScreen_InventoryBtn;
struct GUIButton *pCharacterScreen_SkillsBtn;
struct GUIButton *pCharacterScreen_StatsBtn;
struct GUIButton *ptr_507690;
struct GUIButton *ptr_507694;


struct GUIButton *ptr_5079E8;
struct GUIButton *ptr_5079EC;
struct GUIButton *ptr_5079F0;
struct GUIButton *ptr_5079F4;
struct GUIButton *ptr_5079F8;
struct GUIButton *ptr_5079FC;
struct GUIButton *ptr_507A00;
struct GUIButton *dword_507A04;
struct GUIButton *ptr_507A08;
struct GUIButton *ptr_507A0C;
struct GUIButton *ptr_507A10;


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


struct GUIButton *ptr_507B9C;
struct GUIButton *ptr_507BA0;
struct GUIButton *ptr_507BA4;


struct GUIWindow *pGUIWindow0;
struct GUIWindow *ptr_507BB8;
struct GUIWindow *pDialogueWindow;
struct GUIWindow *ptr_507BC0;
struct GUIWindow *ptr_507BC4;
struct GUIWindow *ptr_507BC8;
struct GUIWindow *pGUIWindow_CurrentMenu;
struct GUIWindow *ptr_507BD0;
struct GUIWindow *pGUIWindow_Settings;
struct GUIWindow *ptr_507BDC;
struct GUIWindow *ptr_507BE0;
struct GUIWindow *pGUIWindow2;


struct GUIButton *ptr_50C9B0;
struct GUIButton *ptr_50C9B4;
struct GUIButton *pyt_50C9B8;
struct GUIButton *ptr_50C9BC;
struct GUIButton *ptr_50C9C0;
struct GUIButton *ptr_50C9C4;
struct GUIButton *ptr_50C9C8;
struct GUIButton *ptr_50C9CC;


struct GUIButton *ptr_69BD58;
struct GUIButton *ptr_69BD5C;
struct GUIButton *ptr_69BD60;
struct GUIButton *ptr_69BD64;


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