diff UIRest.cpp @ 955:21cc2b274220

m
author Ritor1
date Thu, 02 May 2013 11:02:48 +0600
parents f3ccfc765502
children e9292c58644a
line wrap: on
line diff
--- a/UIRest.cpp	Mon Apr 29 09:18:19 2013 +0600
+++ b/UIRest.cpp	Thu May 02 11:02:48 2013 +0600
@@ -50,129 +50,71 @@
 
 //----- (0041F6C1) --------------------------------------------------------
 void __cdecl RestUI_Initialize()
-    {
-    Player *v0; // eax@10
+{
+  Player *pPlayer; // eax@10
 
-    if ( !dword_506F14 )
-        pAudioPlayer->StopChannels(-1, -1);
-    if ( pCurrentScreen )
-        {
-        pGUIWindow_CurrentMenu->Release();
-        pCurrentScreen = SCREEN_GAME;
-        viewparams->bRedrawGameUI = 1;
-        }
-    pEventTimer->Pause();
-    if ( dword_506F14 != 2 )
-        GUIWindow::Create(518u, 450u, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0);
-    _506F18_num_hours_to_sleep = 0;
-    dword_506F14 = 0;
-    uRestUI_FoodRequiredToRest = 2;
-    if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-        uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(
-        pParty->vPosition.x,
-        pParty->vPosition.y,
-        pParty->vPosition.z);
-    if ( PartyHasDragon() )
-        {
-        v0 = pParty->pPlayers;//[0].uClass;
-        while ( v0 <= &pParty->pPlayers[3] )
-            {
-            ++v0;
-            if ( v0 > &pParty->pPlayers[3] )
-                break;
-            }
-        if(v0->classType == PLAYER_CLASS_WARLOCK)
-            ++uRestUI_FoodRequiredToRest;
-        }
-    if ( CheckHiredNPCSpeciality(Porter) )
-        --uRestUI_FoodRequiredToRest;
-    if ( CheckHiredNPCSpeciality(QuarterMaster) )
-        uRestUI_FoodRequiredToRest -= 2;
-    if ( CheckHiredNPCSpeciality(Gypsy) )
-        --uRestUI_FoodRequiredToRest;
-    if ( uRestUI_FoodRequiredToRest < 1 )
-        uRestUI_FoodRequiredToRest = 1;
-    if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_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);
-    uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE);
-    uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE);
-    uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE);
-    uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
-    uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
-    LoadActualSkyFrame();
-    pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)16, 0, 0);
-    pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(
-        280u,
-        297u,
-        154u,
-        37u,
-        1,
-        0,
-        UIMSG_ExitRest,
-        0,
-        0,
-        "",
-        (Texture *)(uTextureID_RestUI_restexit != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restexit] : 0),
-        0);
-    pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton(
-        24u,
-        154u,
-        225u,
-        37u,
-        1,
-        0,
-        UIMSG_Rest8Hour,
-        0,
-        0x52u,
-        "",
-        (Texture *)(uTextureID_RestUI_restb4 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb4] : 0),
-        0);
-    pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton(
-        61u,
-        232u,
-        154u,
-        33u,
-        1,
-        0,
-        UIMSG_AlreadyResting,
-        0,
-        0x44u,
-        "",
-        (Texture *)(uTextureID_RestUI_restb1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb1] : 0),
-        0);
-    pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton(
-        61u,
-        264u,
-        154u,
-        33u,
-        1,
-        0,
-        UIMSG_Wait1Hour,
-        0,
-        0x48u,
-        "",
-        (Texture *)(uTextureID_RestUI_restb2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb2] : 0),
-        0);
-    pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton(
-        61u,
-        296u,
-        154u,
-        33u,
-        1,
-        0,
-        UIMSG_Wait5Minutes,
-        0,
-        0x4Du,
-        "",
-        (Texture *)(uTextureID_RestUI_restb3 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb3] : 0),
-        0);
+  if ( !dword_506F14 )
+    pAudioPlayer->StopChannels(-1, -1);
+  if ( pCurrentScreen )
+  {
+    pGUIWindow_CurrentMenu->Release();
+    pCurrentScreen = SCREEN_GAME;
+    viewparams->bRedrawGameUI = 1;
+  }
+  pEventTimer->Pause();
+  if ( dword_506F14 != 2 )
+    GUIWindow::Create(518, 450, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0);
+  _506F18_num_hours_to_sleep = 0;
+  dword_506F14 = 0;
+  uRestUI_FoodRequiredToRest = 2;
+  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+    uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
+  if ( PartyHasDragon() )
+  {
+    pPlayer = pParty->pPlayers;//[0].uClass; this incorrect
+    while ( pPlayer <= &pParty->pPlayers[3] )
+    {
+      ++pPlayer;
+      if ( pPlayer > &pParty->pPlayers[3] )
+        break;
     }
+    if (pPlayer->classType == PLAYER_CLASS_WARLOCK)
+      ++uRestUI_FoodRequiredToRest;
+  }
+  if ( CheckHiredNPCSpeciality(Porter) )
+    --uRestUI_FoodRequiredToRest;
+  if ( CheckHiredNPCSpeciality(QuarterMaster) )
+    uRestUI_FoodRequiredToRest -= 2;
+  if ( CheckHiredNPCSpeciality(Gypsy) )
+    --uRestUI_FoodRequiredToRest;
+  if ( uRestUI_FoodRequiredToRest < 1 )
+    uRestUI_FoodRequiredToRest = 1;
+  if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_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);
+  uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE);
+  uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE);
+  uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE);
+  uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
+  uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
+  LoadActualSkyFrame();
+  pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)16, 0, 0);
+  pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "",
+        (Texture *)(uTextureID_RestUI_restexit != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restexit] : 0), 0);
+  pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton(24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 0x52u, "",
+        (Texture *)(uTextureID_RestUI_restb4 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb4] : 0), 0);
+  pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton(61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 0x44u, "",
+        (Texture *)(uTextureID_RestUI_restb1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb1] : 0), 0);
+  pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton(61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 0x48u, "",
+        (Texture *)(uTextureID_RestUI_restb2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb2] : 0), 0);
+  pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton(61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 0x4Du, "",
+        (Texture *)(uTextureID_RestUI_restb3 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb3] : 0), 0);
+}
 
 //----- (0041FA01) --------------------------------------------------------
 void __cdecl RestUI_Draw()