diff mm7_4.cpp @ 431:8c45cac1c5e1

Merge
author Nomad
date Sun, 24 Feb 2013 00:55:51 +0200
parents 58b71c1af7d8 24936a5ff8ca
children 137c59c3dbc4
line wrap: on
line diff
--- a/mm7_4.cpp	Sun Feb 24 00:54:25 2013 +0200
+++ b/mm7_4.cpp	Sun Feb 24 00:55:51 2013 +0200
@@ -14569,66 +14569,57 @@
 
 
 //----- (00444732) --------------------------------------------------------
-char *_444732_GetEventHintString(unsigned int uEventID)
-{
-  signed int v1; // edx@1
-  char *v2; // eax@2
-  int v3; // ebx@4
-  int v4; // esi@4
+char *GetEventHintString(unsigned int uEventID)
+{
+  signed int event_index; // edx@1
+  int event_pos; // esi@4
   char *result; // eax@6
-  int v6; // eax@9
-  char *i; // esi@11
-  int v8; // edx@12
-
-  v1 = 0;
-  if ( (signed int)uLevelEVT_NumEvents <= 0 )
-  {
-LABEL_6:
-    result = 0;
-  }
-  else
-  {
-    v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
+  unsigned int str_index; // eax@9
+  int i; // esi@11
+ _evt_raw*  test_evt;
+ _evt_raw*  last_evt;
+
+  event_index = 0;
+  if ( uLevelEVT_NumEvents <= 0 )
+    return NULL;
+ 
+    //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
     while ( 1 )
     {
-      if ( *((int *)v2 - 2) == uEventID )
-      {
-        v3 = *(int *)v2;
-        v4 = *((int *)v2 + 3);
-        if ( pLevelEVT[*(int *)v2 + 4] == 4 )
+      if ( pLevelEVT_Index[event_index].uEventID == uEventID )
+      {
+		test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT];
+		last_evt=test_evt;
+        event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT;
+        if ( test_evt->_e_type == EVENT_MouseOver )
           break;
       }
-      ++v1;
-      v2 += 12;
-      if ( v1 >= (signed int)uLevelEVT_NumEvents )
-        goto LABEL_6;
-    }
-    if ( pLevelEVT[v4 + 4] == 2 )
-    {
-      v6 = (unsigned __int8)pLevelEVT[v4 + 5]
-         + (((unsigned __int8)pLevelEVT[v4 + 6]
-           + (((unsigned __int8)pLevelEVT[v4 + 7] + ((unsigned __int8)pLevelEVT[v4 + 8] << 8)) << 8)) << 8);
-LABEL_10:
-      //result = (char *)p2DEvents_minus1_::04[13 * v6];
-      result = (char *)p2DEvents[v6 - 1].pName;
+      ++event_index;
+      if ( event_index >= uLevelEVT_NumEvents )
+       return NULL;
+    }
+	test_evt=(_evt_raw*)&pLevelEVT[event_pos];
+    if ( test_evt->_e_type== EVENT_SpeakInHouse )
+    {
+      str_index = EVT_DWORD(test_evt->v5);
+      result = (char *)p2DEvents[str_index - 1].pName;
     }
     else
     {
-      for ( i = (char *)pLevelEVT_Index + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 )
-      {
-        v8 = *((int *)i + 2);
-        if ( pLevelEVT[v8 + 4] == 2 )
-        {
-          v6 = (unsigned __int8)pLevelEVT[v8 + 5]
-             + (((unsigned __int8)pLevelEVT[v8 + 6]
-               + (((unsigned __int8)pLevelEVT[v8 + 7] + ((unsigned __int8)pLevelEVT[v8 + 8] << 8)) << 8)) << 8);
-          if ( (unsigned int)v6 < 0x258 )
-            goto LABEL_10;
-        }
-      }
-      result = &pLevelStr[pLevelStrOffsets[(unsigned __int8)pLevelEVT[v3 + 5]]];
-    }
-  }
+      for ( i = event_index+1; pLevelEVT_Index[i].uEventID  == uEventID; ++i )
+      {
+        event_pos = pLevelEVT_Index[i].uEventOffsetInEVT;
+		test_evt=(_evt_raw*)&pLevelEVT[event_pos];
+        if ( test_evt->_e_type == EVENT_SpeakInHouse )
+        {
+          str_index = EVT_DWORD(test_evt->v5);
+          if ( str_index < 600 )
+            return (char *)p2DEvents[str_index - 1].pName;
+        }
+      }
+      result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]];
+    }
+ 
   return result;
 }