diff Outdoor.cpp @ 764:90bcfb56c8f9

sound cleaning
author Gloval
date Sat, 23 Mar 2013 21:39:21 +0400
parents 7f1487b74571
children 777c42590ffc
line wrap: on
line diff
--- a/Outdoor.cpp	Sat Mar 23 17:07:08 2013 +0400
+++ b/Outdoor.cpp	Sat Mar 23 21:39:21 2013 +0400
@@ -527,7 +527,7 @@
   v5 = WorldPosToGridCellX(pParty->vPosition.x);
   v6 = WorldPosToGridCellZ(pParty->vPosition.y);
   v7 = _47ED83(v5, v6 - 1);
-  v8 = pTileTable->pTiles[_47ECC1(v7)].tileset;
+  v8 = pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset;
   if ( v8 )
   {
     v9 = v8 - 1;
@@ -2342,7 +2342,7 @@
 }
 
 //----- (0047ECC1) --------------------------------------------------------
-int OutdoorLocation::_47ECC1(signed int a2)
+int OutdoorLocation::GetTileIdByTileMapId(signed int a2)
 {
   signed int result; // eax@2
   int v3; // eax@3
@@ -2465,101 +2465,43 @@
 }
 
 //----- (0047EE49) --------------------------------------------------------
-int OutdoorLocation::_47EE49(signed int a2, signed int a3, int a4)
-{
+int OutdoorLocation::GetSoundIdByPosition( signed int X_pos, signed int Y_pos, int running )
+    {
   signed int v4; // eax@5
   signed int v5; // eax@7
   int v6; // eax@8
   signed int v8; // eax@9
-  int v9; // eax@12
-  int v10; // eax@13
-  int v11; // eax@14
-  int v12; // eax@16
-  int v13; // eax@17
-  int v14; // eax@18
-  int v15; // eax@19
-  int v16; // eax@20
-  int v17; // eax@21
-  int v18; // eax@28
-  int v19; // eax@29
-  int v20; // eax@30
+  int modif=0;
 
-  if ( a2 < 0 || a2 > 127 || a3 < 0 || a3 > 127 )
+  if ( X_pos < 0 || X_pos > 127 || Y_pos < 0 || Y_pos > 127 )
     v4 = 0;
   else
-    v4 = *(&this->pTerrain.pTilemap[128 * a3] + a2);
-  v5 = _47ECC1(v4);
+    v4 = this->pTerrain.pTilemap[128 * Y_pos + X_pos];
+  v5 = GetTileIdByTileMapId(v4);
+  if (running)
+      modif=-39;
   if ( !v5 )
-  {
-    v6 = -(a4 != 0);
-    LOBYTE(v6) = v6 & 0xD9;
-    return v6 + 92;
-  }
-  v8 = pTileTable->pTiles[v5].tileset;
-  if ( v8 <= 6 )
+    return 92+modif;
+   
+  switch (pTileTable->pTiles[v5].tileset)
   {
-    if ( v8 == Tileset_6 )
-    {
-      v17 = -(a4 != 0);
-      LOBYTE(v17) = v17 & 0xD9;
-      return v17 + 88;
-    }
-    if ( v8 )
-    {
-      v9 = v8 - 1;
-      if ( !v9 )
-      {
-        v15 = -(a4 != 0);
-        LOBYTE(v15) = v15 & 0xD9;
-        return v15 + 97;
-      }
-      v10 = v9 - 1;
-      if ( !v10 )
-      {
-        v14 = -(a4 != 0);
-        LOBYTE(v14) = v14 & 0xD9;
-        return v14 + 91;
-      }
-      v11 = v10 - 1;
-      if ( !v11 )
-      {
-        v13 = -(a4 != 0);
-        LOBYTE(v13) = v13 & 0xD9;
-        return v13 + 90;
-      }
-      if ( v11 == 2 )
-      {
-        v12 = -(a4 != 0);
-        LOBYTE(v12) = v12 & 0xD9;
-        return v12 + 101;
-      }
-LABEL_29:
-      v19 = -(a4 != 0);
-      LOBYTE(v19) = v19 & 0xD9;
-      return v19 + 95;
-    }
-    goto LABEL_20;
+  case 0:  return 93+ modif; 
+  case 1:  return 97+ modif; 
+  case 2:  return 91+ modif;
+  case 3:  return 90+ modif;
+  case 4:  return 101+ modif;
+  case 5:  return 95+ modif;
+  case 6:  return 88+ modif;
+  case 7: return 100+ modif;
+  case 8: return 93+ modif;
+ default:
+     v8=pTileTable->pTiles[v5].tileset;
+     if ( (v8 > 9 && v8 <= 17) || (v8 > 21 && v8 <= 27) )
+        return 96+ modif;
+     else
+        return 95+ modif;
   }
-  if ( v8 != 7 )
-  {
-    if ( v8 != 8 )
-    {
-      if ( v8 > 9 && (v8 <= 17 || v8 > 21 && v8 <= 27) )
-      {
-        v18 = -(a4 != 0);
-        LOBYTE(v18) = v18 & 0xD9;
-        return v18 + 96;
-      }
-      goto LABEL_29;
-    }
-LABEL_20:
-    v16 = -(a4 != 0);
-    LOBYTE(v16) = v16 & 0xD9;
-    return v16 + 93;
-  }
-  v20 = -(a4 != 0);
-  LOBYTE(v20) = v20 & 0xD9;
-  return v20 + 100;
+
 }
 
 //----- (0047EF60) --------------------------------------------------------
@@ -2705,7 +2647,7 @@
         _6807B8_level_decorations_ids[v5] = i;
       }
       if ( v8 && decor->uCog == 20 )
-        LOBYTE(decor->field_2) |= 0x40u;
+        decor->field_2 |= 0x0040u;
       if ( !decor->field_16_event_id )
       {
         if ( decor->IsInteractive() )
@@ -2715,7 +2657,7 @@
             v6 = v1 + 75;
             decor->_idx_in_stru123 = v6;
             if ( !stru_5E4C90._decor_events[v1++] )
-              LOBYTE(decor->field_2) |= 0x20u;
+              decor->field_2 |= 0x0020u;
           }
         }
       }