diff mm7_1.cpp @ 1048:d36681a9e4f8

Слияние
author Ritor1
date Thu, 23 May 2013 11:17:01 +0600
parents 76ce871b0076 39f42990698f
children b79139c3b5c8
line wrap: on
line diff
--- a/mm7_1.cpp	Thu May 23 11:16:46 2013 +0600
+++ b/mm7_1.cpp	Thu May 23 11:17:01 2013 +0600
@@ -384,7 +384,7 @@
     v10 = pGlobalTXT_LocalizationStrings[57];   // Days
     if ( v19 <= 1 )
       v10 = pGlobalTXT_LocalizationStrings[56]; // Day
-    sprintf(pTmpBuf2, "%d %s ", v19, v10);
+    sprintfex(pTmpBuf2, "%d %s ", v19, v10);
     strcat(pTmpBuf, pTmpBuf2);
   }
   if ( v9 )
@@ -393,7 +393,7 @@
       v11 = pGlobalTXT_LocalizationStrings[109];// Hour
     else
       v11 = pGlobalTXT_LocalizationStrings[110];// Hours
-    sprintf(pTmpBuf2, "%d %s ", v9, v11);
+    sprintfex(pTmpBuf2, "%d %s ", v9, v11);
     strcat(pTmpBuf, pTmpBuf2);
   }
   if ( v17 && !v19 )
@@ -402,7 +402,7 @@
       v12 = pGlobalTXT_LocalizationStrings[437];// Minute
     else
       v12 = pGlobalTXT_LocalizationStrings[436];// Minutes
-    sprintf(pTmpBuf2, "%d %s ", v17, v12);
+    sprintfex(pTmpBuf2, "%d %s ", v17, v12);
     strcat(pTmpBuf, pTmpBuf2);
   }
   if ( v18 && !v9 )
@@ -411,7 +411,7 @@
       v13 = pGlobalTXT_LocalizationStrings[439];// Second
     else
       v13 = pGlobalTXT_LocalizationStrings[438];// Seconds
-    sprintf(pTmpBuf2, "%d %s ", v18, v13);
+    sprintfex(pTmpBuf2, "%d %s ", v18, v13);
     strcat(pTmpBuf, pTmpBuf2);
   }
   a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0);
@@ -434,10 +434,10 @@
 {
   if ( _506F18_num_hours_to_sleep < 6 )
   {
-    pParty->pPlayers[3].pConditions[2] = 0i64;
-    pParty->pPlayers[2].pConditions[2] = 0i64;
-    pParty->pPlayers[1].pConditions[2] = 0i64;
-    pParty->pPlayers[0].pConditions[2] = 0i64;
+    pParty->pPlayers[3].SetAsleep(false);
+    pParty->pPlayers[2].SetAsleep(false);
+    pParty->pPlayers[1].SetAsleep(false);
+    pParty->pPlayers[0].SetAsleep(false);
     if ( _506F18_num_hours_to_sleep )
     {
       Rest(_506F18_num_hours_to_sleep);
@@ -484,6 +484,7 @@
   POINT v3; // [sp+0h] [bp-10h]@2
   POINT a2; // [sp+8h] [bp-8h]@1
 
+  __debugbreak(); // invalid indexing
   if ( pMouse->GetCursorPos(&a2)->y < 350 )
   {
     v0 = pMouse->GetCursorPos(&a2);
@@ -755,127 +756,6 @@
   return 1;
 }
 
-//----- (00421D00) --------------------------------------------------------
-void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID)
-{
-  //unsigned int v1; // esi@1
-  //int v2; // eax@2
-  //Player *v3; // ecx@2
-  //Player *v4; // ecx@5
-  unsigned int v5; // [sp-4h] [bp-10h]@21
-
-  //v1 = uPlayerID;
-  auto player = &pParty->pPlayers[uPlayerID - 1];
-  if (pParty->pPickedItem.uItemID)
-  {
-    //v3 = player;
-    if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID))
-    {
-      memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u);
-      viewparams->bRedrawGameUI = true;
-      pMouse->RemoveHoldingItem();
-      return;
-    }
-
-    if (!player->CanAct())
-    {
-      player = pPlayers[uActiveCharacter];
-    }
-    if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct())
-		player->PlaySound(SPEECH_NoRoom, 0);
-  }
-
-//LABEL_9:
-  if (pCurrentScreen == SCREEN_GAME)
-  {
-    viewparams->bRedrawGameUI = true;
-    if ( uActiveCharacter != uPlayerID )
-      //goto LABEL_27;
-    {
-      if ( pPlayers[uPlayerID]->uTimeToRecovery )
-        return;
-
-      uActiveCharacter = uPlayerID;
-      return;
-    }
-    v5 = 7;
-//LABEL_22:
-    pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5);
-    return;
-  }
-  if ( pCurrentScreen == SCREEN_SPELL_BOOK )
-    return;
-  if ( pCurrentScreen == SCREEN_CHEST )
-  {
-//LABEL_23:
-    viewparams->bRedrawGameUI = true;
-    if ( uActiveCharacter == uPlayerID )
-    {
-      pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-      pCurrentScreen = SCREEN_CHEST_INVENTORY;
-      //goto LABEL_28;
-      uActiveCharacter = uPlayerID;
-      return;
-    }
-//LABEL_27:
-    if ( pPlayers[uPlayerID]->uTimeToRecovery )
-      return;
-    //goto LABEL_28;
-    uActiveCharacter = uPlayerID;
-    return;
-  }
-  if ( pCurrentScreen != SCREEN_HOUSE )
-  {
-    if ( pCurrentScreen == SCREEN_E )
-    {
-//LABEL_28:
-      uActiveCharacter = uPlayerID;
-      return;
-    }
-    if ( pCurrentScreen != SCREEN_CHEST_INVENTORY )
-    {
-      viewparams->bRedrawGameUI = true;
-      uActiveCharacter = uPlayerID;
-      if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 )
-        FillAwardsData();
-      return;
-    }
-    //goto LABEL_23;
-    viewparams->bRedrawGameUI = true;
-    if ( uActiveCharacter == uPlayerID )
-    {
-      pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-      pCurrentScreen = SCREEN_CHEST_INVENTORY;
-      //goto LABEL_28;
-      uActiveCharacter = uPlayerID;
-      return;
-    }
-//LABEL_27:
-    if ( pPlayers[uPlayerID]->uTimeToRecovery )
-      return;
-    //goto LABEL_28;
-    uActiveCharacter = uPlayerID;
-    return;
-  }
-  if ( window_SpeakInHouse->field_40 == 1 )
-    return;
-  viewparams->bRedrawGameUI = true;
-  if ( uActiveCharacter != uPlayerID )
-    //goto LABEL_28;
-    uActiveCharacter = uPlayerID;
-    return;
-  if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6)
-  {
-    __debugbreak(); // fix indexing
-    pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-    v5 = 14;
-    //goto LABEL_22;
-    pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5);
-    return;
-  }
-}
-// 4E28F8: using guessed type int pCurrentScreen;
-// F8B19C: using guessed type int dword_F8B19C;
 
 //----- (00421EA6) --------------------------------------------------------
 void __cdecl OnInventoryLeftClick()
@@ -994,7 +874,7 @@
   unsigned __int16 v5; // dx@14
   signed int v6; // eax@14
   char *v7; // esi@15
-  int *v8; // eax@19
+  //int *v8; // eax@19
   int v9; // eax@19
   unsigned int v10; // eax@19
   int v11; // ecx@21
@@ -1011,7 +891,7 @@
   ItemGen *v22; // esi@62
   unsigned int v23; // eax@62
   SpriteObject a1; // [sp+Ch] [bp-80h]@1
-  POINT v25; // [sp+7Ch] [bp-10h]@3
+  //POINT v25; // [sp+7Ch] [bp-10h]@3
   POINT a2; // [sp+84h] [bp-8h]@3
 
   if ( pRenderer->pRenderD3D )
@@ -1019,8 +899,9 @@
   else
   {
     v1 = pMouse->GetCursorPos(&a2);
-    v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]];
+    v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]];
   }
+
   if ( PID_TYPE(v0) == OBJECT_Item)
   {
     a2.y = (signed int)(unsigned __int16)v0 >> 3;
@@ -1135,8 +1016,9 @@
 			a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
 			a1.uSpriteFrameID = 0;
 			memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
-			v8 = (int *)pMouse->GetCursorPos(&v25);
-			v9 = UnprojectX(*v8);
+
+            extern int UnprojectX(int);
+			v9 = UnprojectX(v1->x);
 			a1.Create(pParty->sRotationY + v9, 184, 200, 0);
 			v10 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE);
 			if (v10 != -1)
@@ -1515,6 +1397,10 @@
   uGameUIFontShadow = TargetColor(v5, v4, v6);
 }
 
+
+
+
+
 //----- (00423AEE) --------------------------------------------------------
 void __cdecl reset_some_strus_flt_2Cs()
 {