diff UIRest.cpp @ 1033:3a5c8df8381d

* UI cleans and moves * Deleted many junk global variables.
author Nomad
date Tue, 21 May 2013 23:44:51 +0200
parents e865f349aa41
children 5d5c78088274
line wrap: on
line diff
--- a/UIRest.cpp	Tue May 21 14:34:14 2013 +0200
+++ b/UIRest.cpp	Tue May 21 23:44:51 2013 +0200
@@ -47,18 +47,18 @@
 
 
 //----- (0041F6C1) --------------------------------------------------------
-void __cdecl RestUI_Initialize()
+void RestUI_Load()
 {
     Player *v0; // eax@10
 
     if ( !dword_506F14 )
         pAudioPlayer->StopChannels(-1, -1);
-    if ( pCurrentScreen )
-        {
+    if ( pCurrentScreen != SCREEN_GAME)
+    {
         pGUIWindow_CurrentMenu->Release();
         pCurrentScreen = SCREEN_GAME;
-        viewparams->bRedrawGameUI = 1;
-        }
+        viewparams->bRedrawGameUI = true;
+    }
     pEventTimer->Pause();
     if ( dword_506F14 != 2 )
         GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
@@ -87,11 +87,13 @@
         --uRestUI_FoodRequiredToRest;
     if ( uRestUI_FoodRequiredToRest < 1 )
         uRestUI_FoodRequiredToRest = 1;
-    if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 98) )
+    if ( !_strcmpi(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )
         uRestUI_FoodRequiredToRest = 0;
+
     ++pIcons_LOD->uTexturePacksCount;
     if ( !pIcons_LOD->uNumPrevLoadedFiles )
         pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
+
     pCurrentScreen = SCREEN_REST;
     _507CD4_RestUI_hourglass_anim_controller = 0;
     uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE);
@@ -104,16 +106,16 @@
     LoadActualSkyFrame();
 
     pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Rest, 0, 0);
-    pButton_RestUI_Exit          = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest,       0, 0,     "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
-    pButton_RestUI_Main          = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour,      0, 0x52u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
-    pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 0x44u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
-    pButton_RestUI_Wait1Hour     = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour,      0, 0x48u, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
-    pButton_RestUI_Wait5Minutes  = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes,   0, 0x4Du, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
+    pButton_RestUI_Exit          = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest,       0,   0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
+    pButton_RestUI_Main          = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour,      0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
+    pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
+    pButton_RestUI_Wait1Hour     = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour,      0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
+    pButton_RestUI_Wait5Minutes  = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes,   0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
 }
 
 //----- (0041FA01) --------------------------------------------------------
-void __cdecl RestUI_Draw()
-    {
+void RestUI_Draw()
+{
     int live_characters; // esi@1
     unsigned int v3; // eax@15
     //char v4; // al@17
@@ -217,8 +219,5 @@
             Sleep6Hours();
         }
     else
-        {
-        GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn,
-            (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);
-        }
+      GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]); // "Exit Rest"
     }
\ No newline at end of file