changeset 1414:110eac219e5a

ChestUI_WritePointedObjectStatusString
author Nomad
date Sat, 27 Jul 2013 16:32:20 +0200
parents 3881d2f94eb1
children ff495bf260d9
files Chest.cpp UI/UiGame.cpp mm7_1.cpp mm7_2.cpp mm7_data.h
diffstat 5 files changed, 54 insertions(+), 226 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Sat Jul 27 16:09:00 2013 +0200
+++ b/Chest.cpp	Sat Jul 27 16:32:20 2013 +0200
@@ -22,6 +22,7 @@
 #include "ObjectList.h"
 #include "GUIWindow.h"
 #include "Time.h"
+#include "Overlays.h"
 
 #include "mm7_data.h"
 #include "MM7.h"
@@ -195,6 +196,35 @@
   return true;
 }
 
+
+//----- (0042038D) --------------------------------------------------------
+void __cdecl ChestUI_WritePointedObjectStatusString()
+{
+  POINT *v0; // esi@2
+  int v1; // ecx@2
+  const char *v2; // eax@3
+  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);
+    v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]];
+    if ( v1 )
+    {
+      auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C
+                                             + 18 * *((short *)&pChests[0].igChestItems[139].uExpireTime
+                                               + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
+
+      _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 
+		  + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3));
+      v2 = _w->GetDisplayName();
+      GameUI_SetFooterString(v2);
+    }
+  }
+}
+
 //----- (0042092D) --------------------------------------------------------
 void Chest::DrawChestUI(signed int uChestID)
     {
--- a/UI/UiGame.cpp	Sat Jul 27 16:09:00 2013 +0200
+++ b/UI/UiGame.cpp	Sat Jul 27 16:32:20 2013 +0200
@@ -1901,7 +1901,7 @@
   {
     if ( pCurrentScreen == SCREEN_CHEST )
     {
-      sub_42038D();
+      ChestUI_WritePointedObjectStatusString();
       //goto _return;
       if ( pMouse->uPointingObjectID == 0 )
       {
--- a/mm7_1.cpp	Sat Jul 27 16:09:00 2013 +0200
+++ b/mm7_1.cpp	Sat Jul 27 16:32:20 2013 +0200
@@ -135,34 +135,6 @@
   a1->DrawText(a2, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
 }
 
-//----- (0042038D) --------------------------------------------------------
-void __cdecl sub_42038D()
-{
-  POINT *v0; // esi@2
-  int v1; // ecx@2
-  const char *v2; // eax@3
-  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);
-    v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]];
-    if ( v1 )
-    {
-      auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C
-                                             + 18 * *((short *)&pChests[0].igChestItems[139].uExpireTime
-                                               + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
-
-      _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 
-		  + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3));
-      v2 = _w->GetDisplayName();
-      GameUI_SetFooterString(v2);
-    }
-  }
-}
-
 //----- (004226C2) --------------------------------------------------------
 bool PauseGameDrawing()
 {
@@ -435,13 +407,13 @@
 
 
 //----- (00424CD7) --------------------------------------------------------
-signed int __fastcall sr_424CD7(unsigned int uVertexID)
+int sr_424CD7(unsigned int num_vertices)
 {
-  unsigned int v1; // edx@1
+  //unsigned int v1; // edx@1
   signed int v2; // edi@1
   char *v3; // esi@4
   char *v4; // ecx@4
-  unsigned int v5; // eax@4
+  //unsigned int v5; // eax@4
   char *v6; // edx@4
   double v7; // st6@10
   double v8; // st5@10
@@ -451,30 +423,30 @@
   RenderVertexSoft *v12; // edi@22
   char *v13; // eax@22
   double v14; // st6@22
-  signed int result; // eax@24
-  unsigned int v16; // [sp+8h] [bp-28h]@4
+  //signed int result; // eax@24
+  //unsigned int v16; // [sp+8h] [bp-28h]@4
   bool v17; // [sp+Ch] [bp-24h]@6
   char *v18; // [sp+10h] [bp-20h]@4
   char *v19; // [sp+14h] [bp-1Ch]@4
-  signed int v20; // [sp+18h] [bp-18h]@1
+  //signed int v20; // [sp+18h] [bp-18h]@1
   RenderVertexSoft *v21; // [sp+1Ch] [bp-14h]@4
   char *v22; // [sp+20h] [bp-10h]@4
   char *v23; // [sp+24h] [bp-Ch]@4
   char *v24; // [sp+28h] [bp-8h]@4
   char *v25; // [sp+2Ch] [bp-4h]@4
+  
+  if (!num_vertices)
+    return 0;
 
-  __debugbreak();
-  v1 = uVertexID;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  //v1 = uVertexID;
+  memcpy(&array_50AC10[num_vertices], array_50AC10, sizeof(array_50AC10[0]));
   v2 = 0;
-  v20 = 0;
+  //v20 = 0;
   if ( array_50AC10[0].vWorldViewPosition.x >= 8.0 )
     v2 = 1;
-  if ( (signed int)(uVertexID + 1) <= 1 )
-    return 0;
   v3 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v4 = (char *)&array_507D30[0].vWorldViewPosition.y;
-  v5 = v1;
+  //v5 = v1;
   v23 = (char *)&array_507D30[0]._rhw;
   v21 = array_507D30;
   v18 = (char *)&array_507D30[0].vWorldViewPosition.z;
@@ -483,8 +455,10 @@
   v24 = (char *)&array_507D30[0].v;
   v25 = (char *)&array_507D30[0].u;
   v6 = (char *)&array_50AC10[0].v;
-  v16 = v5;
-  do
+  //v16 = v1;
+
+  int out_num_vertices = 0;
+  for (int i = 0; i < num_vertices; ++i)
   {
     v17 = *((float *)v6 + 5) >= 8.0;
     if ( v2 != v17 )
@@ -536,7 +510,7 @@
       v25 += 48;
       v4 += 48;
       v3 += 48;
-      ++v20;
+      ++out_num_vertices;
       v23 += 48;
       v19 = v4;
       v18 = v3;
@@ -549,7 +523,7 @@
       v19 += 48;
       v18 += 48;
       v14 = 1.0 / (*((float *)v6 + 5) + 0.0000001);
-      ++v20;
+      ++out_num_vertices;
       v25 += 48;
       v24 += 48;
       v22 += 48;
@@ -562,11 +536,7 @@
     }
     v2 = v17;
     v6 += 48;
-    --v16;
   }
-  while ( v16 );
-  result = v20;
-  if ( v20 < 3 )
-    return 0;
-  return result;
+
+  return out_num_vertices >= 3 ? out_num_vertices : 0;
 }
--- a/mm7_2.cpp	Sat Jul 27 16:09:00 2013 +0200
+++ b/mm7_2.cpp	Sat Jul 27 16:32:20 2013 +0200
@@ -215,175 +215,6 @@
       assert(false && "Invalid enum value");
   }
   return 0;
-
-
-  /*
-  if ( profession > 39 )
-  {
-    if ( profession != 40 )
-    {
-      if ( profession == 41 )
-      {
-        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-        dword_50C9DC = 195;
-        ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
-        return 0;
-      }
-      if ( profession == 42 )
-      {
-        v32 = 0;
-        v30 = 0;
-        v28 = 133;
-        v26 = 46;
-      }
-      else
-      {
-        if ( profession == 43 )
-        {
-          v32 = 0;
-          v30 = 0;
-          v28 = 133;
-          v26 = 51;
-        }
-        else
-        {
-          if ( profession != 52 )
-            return 0;
-          v32 = 0;
-          v30 = 0;
-          v28 = 133;
-          v26 = 86;
-        }
-      }
-      _42777D_CastSpell_UseWand_ShootArrow(v26, 0, v28, v30, v32);
-      return 0;
-    }
-    v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
-    pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 46080, 3u, 0, v20, 0);
-    pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1u;
-    v31 = 0;
-    v29 = 0;
-    v27 = 0;
-    v25 = 0;
-    v24 = -1;
-    v23 = 0;
-    v22 = 0;
-    v21 = (SoundID)12040;
-LABEL_40:
-    pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31);
-    return 0;
-  }
-  if ( profession == 39 )
-  {
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-    {
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2u);
-      v31 = 0;
-      v29 = 0;
-      v27 = 0;
-      v25 = 0;
-      v24 = -1;
-      v23 = 0;
-      v22 = 0;
-      v21 = (SoundID)203;
-    }
-    else
-    {
-      v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
-      pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 30720, 3u, 1u, v19, 0);
-      pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1u;
-      v31 = 0;
-      v29 = 0;
-      v27 = 0;
-      v25 = 0;
-      v24 = -1;
-      v23 = 0;
-      v22 = 0;
-      v21 = (SoundID)11090;
-    }
-    pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31);
-    return 0;
-  }
-  if ( profession == 10 )
-  {
-    v18 = pParty->pPlayers;
-    do
-    {
-      v18->sHealth = v18->GetMaxHealth();
-      ++v18;
-    }
-    while ( (signed int)v18 < (signed int)pParty->pHirelings );
-    return 0;
-  }
-  if ( profession == 11 )
-  {
-    v7 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pConditions[15];
-    do
-    {
-	  v8 = LODWORD(v7->pConditions[14]);
-	  v9 = HIDWORD(v7->pConditions[14]);
-	  v10 = LODWORD(v7->pConditions[15]);
-      v11 = HIDWORD(v7->pConditions[15]);
-      v12 = LODWORD(v7->pConditions[16]);
-      v13 = HIDWORD(v7->pConditions[16]);
-      v14 = LODWORD(v7->pConditions[19]);
-      v15 = HIDWORD(v7->pConditions[19]);
-      v16 = LODWORD(v7->pConditions[17]);
-      v17 = HIDWORD(v7->pConditions[17]);
-      memset(v7, 0, 0xA0u);
-      LODWORD(v7->pConditions[16]) = v12;
-      HIDWORD(v7->pConditions[16]) = v13;
-      LODWORD(v7->pConditions[15]) = v10;
-      HIDWORD(v7->pConditions[15]) = v11;
-      HIDWORD(v7->pConditions[14]) = v9;
-      LODWORD(v7->pConditions[19]) = v14;
-      HIDWORD(v7->pConditions[19]) = v15;
-      LODWORD(v7->pConditions[17]) = v16;
-      LODWORD(v7->pConditions[14]) = v8;
-      HIDWORD(v7->pConditions[17]) = v17;
-	  v7->sHealth = v7->GetMaxHealth();
-      ++v7;
-    }
-    while ( v7 <= pPlayers[3] );
-    return 0;
-  }
-  if ( profession == 12 )
-  {
-	  v4 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pActiveSkills[8];
-    do
-    {
-	  v5 = LODWORD(v4->pConditions[19]);//*((int *)v4 - 32);
-      v6 = HIDWORD(v4->pConditions[19]);//*((int *)v4 - 31);
-	  memset(v4->pConditions, 0, 0xA0u);
-	  v4->pActiveSkills[8] = v5;
-      v4->pActiveSkills[10] = v6;
-	  v4->sHealth = v4->GetMaxHealth();
-      ++v4;
-    }
-    while ( v4 <= pPlayers[3] );
-    return 0;
-  }
-  if ( profession == 33 )
-  {
-    v1 = 14;
-    if ( pParty->uNumFoodRations >= 0xE )
-      return 1;
-    v3 = 1;
-LABEL_13:
-    Party::GiveFood(v3);
-    if ( pParty->uNumFoodRations > v1 )
-      pParty->uNumFoodRations = v1;
-    return 0;
-  }
-  if ( profession == 34 )
-  {
-    v1 = 14;
-    if ( pParty->uNumFoodRations >= 0xE )
-      return 1;
-    v3 = 2;
-    goto LABEL_13;
-  }
-  return 0;*/
 }
 
 //----- (004BBA85) --------------------------------------------------------
@@ -554,9 +385,6 @@
     pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1);
   }
 }
-// F8B1B4: using guessed type int dword_F8B1B4;
-
-// 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
 
 //----- (004BC109) --------------------------------------------------------
 void __cdecl ArenaFight()
--- a/mm7_data.h	Sat Jul 27 16:09:00 2013 +0200
+++ b/mm7_data.h	Sat Jul 27 16:32:20 2013 +0200
@@ -1130,7 +1130,7 @@
 void __cdecl nullsub_3(); // idb
 void __cdecl LoadActualSkyFrame();
 void __cdecl Sleep6Hours();
-void __cdecl sub_42038D();
+void __cdecl ChestUI_WritePointedObjectStatusString();
 
 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb
 void OnChestLeftClick();
@@ -1146,7 +1146,7 @@
 int __fastcall GetPortalScreenCoord(unsigned int uFaceID);
 signed int __fastcall sr_424579(int uFaceID, struct stru320 *a2);
 bool PortalFrustrum(int pNumVertices, struct BspRenderer_PortalViewportData *a2, struct BspRenderer_PortalViewportData *near_portal, int uFaceID);
-signed int __fastcall sr_424CD7(unsigned int uVertexID); // idb
+int sr_424CD7(unsigned int uVertexID); // idb
 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb
 signed int __fastcall sr_4250FE(unsigned int uVertexID); // idb
 bool sr_42620A(struct RenderVertexSoft *p);