changeset 2267:6532bbac1a9e

Слияние
author Ritor1
date Sat, 08 Mar 2014 23:53:09 +0600
parents 01489aec3cb0 (diff) 3d644efae786 (current diff)
children fd788d2e9585
files
diffstat 5 files changed, 236 insertions(+), 343 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Sat Mar 08 17:53:38 2014 +0100
+++ b/Chest.cpp	Sat Mar 08 23:53:09 2014 +0600
@@ -353,19 +353,17 @@
   item_count = 0;
   max_items = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID];
   if ( max_items <= 0 )
-  {
     item_count = -1;
-  }
   else
   {
     while ( pChests[uChestID].igChestItems[item_count].uItemID )
     {
       ++item_count;
       if ( item_count >= max_items )
-          {
-          item_count = -1;
-          break;
-          }
+      {
+        item_count = -1;
+        break;
+      }
     }
   }
   return item_count;
@@ -374,13 +372,12 @@
 //----- (0041FFA2) --------------------------------------------------------
 int Chest::PutItemInChest(int position, ItemGen *put_item, signed int uChestID)
 {
-  int v3; // eax@1
   ItemGen *v4; // edi@1
   int v5; // esi@1
   int result; // eax@11
   unsigned int v7; // eax@12
   int v8; // edx@12
-  Texture *v9; // ecx@12
+  Texture *texture; // ecx@12
   signed int v10; // eax@12
   signed int v11; // edi@14
   unsigned int v12; // esi@14
@@ -397,11 +394,10 @@
   int v23; // [sp+20h] [bp-4h]@19
 
   v21 = 0;
-  v3 = pChests[uChestID].uChestBitmapID;
   v4 = put_item;
-  v5 = pChestWidthsByType[v3] * pChestHeightsByType[v3];
+  v5 = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID];
   Src = put_item;
-  v19 = pChestWidthsByType[v3];
+  v19 = pChestWidthsByType[pChests[uChestID].uChestBitmapID];
   if ( position == -1 )
   {
     item_in_chest_count = CountChestItems(uChestID);
@@ -410,9 +406,7 @@
     for( int _i = 0; _i < v5; _i++)
 	{
       if ( Chest::CanPlaceItemAt(_i, v4->uItemID, pChestWindow->par1C) )
-      {
         v21 = _i;
-      }
     }
     if ( v21 == v5 )
     {
@@ -422,18 +416,18 @@
     }
     v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE);
     HIWORD(v8) = 0;
-    v9 = pIcons_LOD->GetTexture(v7);
-    v10 = v9->uTextureWidth;
-    if ( v10 < 14 )
+    texture = pIcons_LOD->GetTexture(v7);
+    v10 = texture->uTextureWidth;
+    if ( texture->uTextureWidth < 14 )
       v10 = 14;
-    v11 = v9->uTextureHeight;
     v12 = ((v10 - 14) >> 5) + 1;
-    if ( v11 < 14 )
+    v11 = texture->uTextureHeight;
+    if ( texture->uTextureHeight < 14 )
       v11 = 14;
     v13 = ((v11 - 14) >> 5) + 1;
     if ( !areWeLoadingTexture )
     {
-      ((Texture *)v9)->Release();
+      texture->Release();
       pIcons_LOD->SyncLoadedFilesCount();
     }
     if ( v13 > 0 )
@@ -466,62 +460,58 @@
     result = v21 + 1;
   }
   else
-  {
     result = 1;
-  }
   return result;
 }
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (0042013E) --------------------------------------------------------
 void Chest::PlaceItemAt( unsigned int put_cell_pos, unsigned int item_at_cell, signed int uChestID )
-    {
-    int uItemID; // edi@1
-    int v6; // edx@4
-    unsigned int v7; // eax@5
-    Texture *v8; // ecx@5
-    signed int v9; // eax@5
-    signed int v10; // edi@7
-    unsigned int texture_cell_width; // ebx@7
-    int textute_cell_height; // edi@9
-    int chest_cell_row_pos; // edx@12
-    int chest_cell_width; // [sp+10h] [bp-Ch]@11
+{
+  int uItemID; // edi@1
+  int v6; // edx@4
+  unsigned int v7; // eax@5
+  Texture *texture; // ecx@5
+  signed int v9; // eax@5
+  signed int v10; // edi@7
+  unsigned int texture_cell_width; // ebx@7
+  int textute_cell_height; // edi@9
+  int chest_cell_row_pos; // edx@12
+  int chest_cell_width; // [sp+10h] [bp-Ch]@11
 
-    uItemID = pChests[ uChestID].igChestItems[item_at_cell].uItemID;
-    pItemsTable->SetSpecialBonus(&pChests[ uChestID].igChestItems[item_at_cell]);
-    if ( uItemID >= 135 && uItemID <= 159 && !pChests[ uChestID].igChestItems[item_at_cell].uNumCharges)
-        {
-        v6 = rand() % 21 + 10;
-        pChests[ uChestID].igChestItems[item_at_cell].uNumCharges = v6;
-        pChests[ uChestID].igChestItems[item_at_cell].uMaxCharges = v6;
-        }
-    v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    v8 = pIcons_LOD->GetTexture(v7);
-    v9 = v8->uTextureWidth;
-    if ( v9 < 14 )
-        v9 = 14;
-    v10 = v8->uTextureHeight;
-    texture_cell_width = ((v9 - 14) >> 5) + 1;
-    if ( v10 < 14 )
-        v10 = 14;
-    textute_cell_height = ((v10 - 14) >> 5) + 1;
-    if ( !areWeLoadingTexture )
-        {
-        v8->Release();
-        pIcons_LOD->SyncLoadedFilesCount();
-        }
-    chest_cell_width = pChestWidthsByType[pChests[ uChestID].uChestBitmapID];
-    chest_cell_row_pos = 0;
-    for(int i=0; i<textute_cell_height; ++i) 
-        { 
-        for (int j=0; j<texture_cell_width; ++j)
-            {
-            pChests[uChestID].pInventoryIndices[put_cell_pos + chest_cell_row_pos+j]=(signed __int16)-(put_cell_pos+1);
-            } 
-        chest_cell_row_pos += chest_cell_width;
-        }
-    pChests[uChestID].pInventoryIndices[put_cell_pos] = item_at_cell + 1;
-    }
+  uItemID = pChests[ uChestID].igChestItems[item_at_cell].uItemID;
+  pItemsTable->SetSpecialBonus(&pChests[ uChestID].igChestItems[item_at_cell]);
+  if ( uItemID >= 135 && uItemID <= 159 && !pChests[ uChestID].igChestItems[item_at_cell].uNumCharges)
+  {
+    v6 = rand() % 21 + 10;
+    pChests[ uChestID].igChestItems[item_at_cell].uNumCharges = v6;
+    pChests[ uChestID].igChestItems[item_at_cell].uMaxCharges = v6;
+  }
+  v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  texture = pIcons_LOD->GetTexture(v7);
+  v9 = texture->uTextureWidth;
+  if ( texture->uTextureWidth < 14 )
+    v9 = 14;
+  texture_cell_width = ((v9 - 14) >> 5) + 1;
+  v10 = texture->uTextureHeight;
+  if ( texture->uTextureHeight < 14 )
+    v10 = 14;
+  textute_cell_height = ((v10 - 14) >> 5) + 1;
+  if ( !areWeLoadingTexture )
+  {
+    texture->Release();
+    pIcons_LOD->SyncLoadedFilesCount();
+  }
+  chest_cell_width = pChestWidthsByType[pChests[ uChestID].uChestBitmapID];
+  chest_cell_row_pos = 0;
+  for(int i = 0; i < textute_cell_height; ++i) 
+  { 
+    for (int j = 0; j < texture_cell_width; ++j)
+      pChests[uChestID].pInventoryIndices[put_cell_pos + chest_cell_row_pos+j]=(signed __int16)-(put_cell_pos+1);
+    chest_cell_row_pos += chest_cell_width;
+  }
+  pChests[uChestID].pInventoryIndices[put_cell_pos] = item_at_cell + 1;
+}
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (00420284) --------------------------------------------------------
@@ -597,18 +587,16 @@
 //----- (00458B03) --------------------------------------------------------
 void ChestList::ToFile()
 {
-  ChestList *v1; // esi@1
   FILE *v2; // eax@1
   FILE *v3; // edi@1
 
-  v1 = this;
   v2 = fopen("data\\dchest.bin", "wb");
   v3 = v2;
   if ( !v2 )
     Error("Unable to save dchest.bin!");
 
-  fwrite(v1, 4u, 1u, v2);
-  fwrite(v1->pChests, 0x24u, v1->uNumChests, v3);
+  fwrite(this, 4, 1, v2);
+  fwrite(this->pChests, 36, this->uNumChests, v3);
   fclose(v3);
 }
 
@@ -634,7 +622,7 @@
 //----- (00458B9C) --------------------------------------------------------
 int ChestList::FromFileTxt(const char *Args)
 {
-  ChestList *v2; // ebx@1
+  //ChestList *v2; // ebx@1
   __int32 v3; // edi@1
   FILE *v4; // eax@1
   unsigned int v5; // esi@3
@@ -652,11 +640,11 @@
   FILE *File; // [sp+2F4h] [bp-4h]@1
   unsigned int Argsa; // [sp+300h] [bp+8h]@3
 
-  v2 = this;
+  //v2 = this;
   free(this->pChests);
   v3 = 0;
-  v2->pChests = 0;
-  v2->uNumChests = 0;
+  this->pChests = 0;
+  this->uNumChests = 0;
   v4 = fopen(Args, "r");
   File = v4;
   if ( !v4 )
@@ -677,16 +665,16 @@
     v5 = Argsa;
     v3 = 0;
   }
-  v6 = v2->pChests;
-  v2->uNumChests = v5;
+  v6 = this->pChests;
+  this->uNumChests = v5;
   v7 = malloc(36 * v5);
-  v2->pChests = (ChestDesc *)v7;
+  this->pChests = (ChestDesc *)v7;
   if ( v7 == (void *)v3 )
     Error("ChestDescriptionList::load - Out of Memory!");
 
-  memset(v7, v3, 36 * v2->uNumChests);
+  memset(v7, v3, 36 * this->uNumChests);
   v8 = File;
-  v2->uNumChests = v3;
+  this->uNumChests = v3;
   fseek(v8, v3, v3);
   for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
   {
@@ -694,14 +682,14 @@
     memcpy(&v17, txt_file_frametable_parser(&Buf, &v16), sizeof(v17));
 	if ( v17.uPropCount && *v17.pProperties[0] != 47 )
     {
-      strcpy(v2->pChests[v2->uNumChests].pName, v17.pProperties[0]);
+      strcpy(this->pChests[this->uNumChests].pName, v17.pProperties[0]);
       v10 = atoi(v17.pProperties[1]);
       v11 = v17.pProperties[2];
-      v2->pChests[v2->uNumChests].uWidth = v10;
+      this->pChests[this->uNumChests].uWidth = v10;
       v12 = atoi(v11);
       v13 = v17.pProperties[3];
-      v2->pChests[v2->uNumChests].uHeight = v12;
-      v2->pChests[v2->uNumChests++].uTextureID = atoi(v13);
+      this->pChests[this->uNumChests].uHeight = v12;
+      this->pChests[this->uNumChests++].uTextureID = atoi(v13);
     }
   }
   fclose(File);
@@ -714,7 +702,7 @@
     void *v2; // eax@1
     ItemGen *v3; // ebx@1
     unsigned int v4; // eax@1
-    Texture *v5; // ecx@1
+    Texture *texture; // ecx@1
     signed int v6; // eax@1
     signed int v7; // edi@3
     signed int v8; // eax@3
@@ -742,21 +730,23 @@
     //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)];
 	v17 = pChestWidthsByType[pChests[v20].uChestBitmapID];
     v4 = pIcons_LOD->LoadTexture(v3->GetIconName(), TEXTURE_16BIT_PALETTE);
-    v5 = pIcons_LOD->GetTexture(v4);
-    v6 = v5->uTextureWidth;
-    if ( v6 < 14 )
-        v6 = 14;
+    texture = pIcons_LOD->GetTexture(v4);
+
+    v6 = texture->uTextureWidth;
+    if ( texture->uTextureWidth < 14 )
+      v6 = 14;
     v7 = v6 - 14;
-    v8 = v5->uTextureHeight;
     v9 = (v7 >> 5) + 1;
     v18 = v9;
-    if ( v8 < 14 )
-        v8 = 14;
+
+    v8 = texture->uTextureHeight;
+    if ( texture->uTextureHeight < 14 )
+      v8 = 14;
     v10 = ((v8 - 14) >> 5) + 1;
     v21 = v10;
     if ( !areWeLoadingTexture )
     {
-        v5->Release();
+        texture->Release();
         pIcons_LOD->SyncLoadedFilesCount();
         v10 = v21;
     }
@@ -829,9 +819,7 @@
         viewparams->bRedrawGameUI = 1;
       }
       else
-      {
         pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]);
-      }
       sub_420B13(v4, v3);
     }
   }
--- a/Conditions.cpp	Sat Mar 08 17:53:38 2014 +0100
+++ b/Conditions.cpp	Sat Mar 08 23:53:09 2014 +0600
@@ -28,16 +28,14 @@
 bool ConditionProcessor::IsPlayerAffected( Player* inPlayer, int condToCheck, int blockable)
 {
   if ( !blockable )
-  {
     return true;
-  }
   ConditionProcessor* thisProc = &conditionArray[condToCheck];
   if (thisProc->m_IsBlockedByProtFromMagic && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0)
   {
     if (!(thisProc->m_DoesNeedGmProtFromMagic && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill < 4))
     {
       --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
-      if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+      if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1 )
         pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
       return false;
     }
@@ -50,24 +48,18 @@
   for (unsigned int i = 0; i < thisProc->m_equipmentPairs.size() / 2; i++)
   {
     if (thisProc->m_equipmentPairs[i * 2].m_ItemId == (ITEM_TYPE)0)
-    {
       return true;
-    }
     ITEM_TYPE itemId = thisProc->m_equipmentPairs[i * 2].m_ItemId;
     ITEM_EQUIP_TYPE slot = thisProc->m_equipmentPairs[i * 2 + 1].m_EquipSlot;
     if (slot == EQIUP_ANY)
     {
       if (inPlayer->WearsItemAnyWhere(itemId))
-      {
         return false;
-      }
     }
     else
     {
       if (inPlayer->WearsItem(itemId, slot))
-      {
         return false;
-      }
     }
   }
   return true;
--- a/DecalBuilder.cpp	Sat Mar 08 17:53:38 2014 +0100
+++ b/DecalBuilder.cpp	Sat Mar 08 23:53:09 2014 +0600
@@ -32,16 +32,10 @@
       result = 0.0;
   }
   else
-  {
     result = 1.0;
-  }
   return result;
 }
 
-
-
-
-
 //----- (0043B6EF) --------------------------------------------------------
 void BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b)
 {
@@ -53,7 +47,7 @@
   if ( this->uNumBloodsplats == 64 )
     v8 = 0;
   v9 = 5 * (v8 + 1);
-  v10 = &this->std__vector_pBloodsplats[8 * v9 / 0x28u];
+  v10 = &this->std__vector_pBloodsplats[8 * v9 / 40];
   v10->x = x;
   v10->y = y;
   v10->z = z;
@@ -469,12 +463,12 @@
 char DecalBuilder::ApplyDecals_OutdoorFace(ODMFace *pFace)
 {
 	double v8; // st7@12
-	unsigned int v10; // [sp+20h] [bp-1Ch]@1
+	//unsigned int v10; // [sp+20h] [bp-1Ch]@1
 
 	Bloodsplat *pBloodsplat;
 
 	this->uNumDecals = 0;
-	v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
+	//v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
 	if ( !pFace->Indoor_sky() && !pFace->Fluid() )
 	{
 		for(int i = 0; i < pBloodsplatContainer->std__vector_pBloodsplats_size; i++ )
@@ -506,28 +500,28 @@
 bool DecalBuilder::_49BE8A(struct Polygon *a2, Vec3_float_ *_a3, float *a4, RenderVertexSoft *a5, unsigned int uStripType, char a7)
 {
   bool result; // eax@1
-  RenderVertexSoft *v8; // edi@3
-  Vec3_float_ *v9; // ebx@3
-  Bloodsplat *v10; // esi@3
-  float v11; // eax@5
+  //RenderVertexSoft *v8; // edi@3
+  //Vec3_float_ *v9; // ebx@3
+  //Bloodsplat *v10; // esi@3
+  //float v11; // eax@5
   float v12; // eax@6
-  double v13; // st7@13
+  //double v13; // st7@13
   double v14; // st7@19
-  short v15; // eax@20
+  //short v15; // eax@20
   int v16; // eax@22
-  int v17; // edx@24
-  DecalBuilder *v18; // eax@24
+  //int v17; // edx@24
+  //DecalBuilder *v18; // eax@24
   std::string v19; // [sp-18h] [bp-54h]@12
   const char *v20; // [sp-8h] [bp-44h]@12
-  int v21; // [sp-4h] [bp-40h]@12
+  //int v21; // [sp-4h] [bp-40h]@12
   double v22; // [sp+Ch] [bp-30h]@19
   unsigned int v23; // [sp+14h] [bp-28h]@1
-  DecalBuilder *v24; // [sp+18h] [bp-24h]@1
-  int v25; // [sp+1Ch] [bp-20h]@19
+  //DecalBuilder *v24; // [sp+18h] [bp-24h]@1
+  //int v25; // [sp+1Ch] [bp-20h]@19
   float v26; // [sp+20h] [bp-1Ch]@12
   int v27; // [sp+24h] [bp-18h]@12
   float v28; // [sp+28h] [bp-14h]@13
-  float v29; // [sp+2Ch] [bp-10h]@7
+  //float v29; // [sp+2Ch] [bp-10h]@7
   float v30; // [sp+30h] [bp-Ch]@6
   float v31; // [sp+34h] [bp-8h]@6
   bool v32; // [sp+38h] [bp-4h]@2
@@ -535,92 +529,91 @@
 
   this->uNumDecals = 0;
   result = pBloodsplatContainer->std__vector_pBloodsplats_size != 0;
-  v24 = this;
+ // v24 = this;
   v23 = pBloodsplatContainer->std__vector_pBloodsplats_size;
   if ( pBloodsplatContainer->std__vector_pBloodsplats_size )
   {
-    v32 = 0;
+    
     if ( (signed int)pBloodsplatContainer->std__vector_pBloodsplats_size > 0 )
     {
-      v8 = a5;
-      v9 = _a3;
-	  v10 = pBloodsplatContainer->std__vector_pBloodsplats;
-      while ( v32 < (signed int)v23)
+      //v8 = a5;
+      //v9 = _a3;
+	  for ( v32 = 0; v32 < (signed int)v23; ++v32 )
       {
-		if ( uStripType == 4 )
-		{
-		  a3 = v8->vWorldPosition.x;
-		  v11 = v8[3].vWorldPosition.x;
-		  v31 = v11;
-		  v30 = v8[1].vWorldPosition.y;
-		  v12 = v8->vWorldPosition.y;
-		  v29 = v12;
-		}
-		else if ( uStripType == 3 )
+        if ( uStripType == 4 )
+        {
+          a3 = a5->vWorldPosition.x;
+          //v11 = v8[3].vWorldPosition.x;
+          v31 = a5[3].vWorldPosition.x;
+          v30 = a5[1].vWorldPosition.y;
+          v12 = a5->vWorldPosition.y;
+          //v29 = v12;
+        }
+        else if ( uStripType == 3 )
         {
           if ( a7 )
           {
-            a3 = v8->vWorldPosition.x;
-            v31 = v8[2].vWorldPosition.x;
-            v30 = v8[1].vWorldPosition.y;
-            v12 = v8[2].vWorldPosition.y;
-            v29 = v12;
+            a3 = a5->vWorldPosition.x;
+            v31 = a5[2].vWorldPosition.x;
+            v30 = a5[1].vWorldPosition.y;
+            v12 = a5[2].vWorldPosition.y;
+            //v29 = v12;
           }
 		  else
 		  {
-			  a3 = v8[1].vWorldPosition.x;
-			  v11 = v8[2].vWorldPosition.x;
-			  v31 = v11;
-			  v30 = v8[1].vWorldPosition.y;
-			  v12 = v8->vWorldPosition.y;
-			  v29 = v12;
+			  a3 = a5[1].vWorldPosition.x;
+			  //v11 = v8[2].vWorldPosition.x;
+			  v31 = a5[2].vWorldPosition.x;
+			  v30 = a5[1].vWorldPosition.y;
+			  v12 = a5->vWorldPosition.y;
+			  //v29 = v12;
 		  }
         }
 		else
 			MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:434", 0);
-        v21 = uStripType;
-        v13 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
-        v21 = uStripType;
-        v28 = v13;
-        v26 = pGame->pIndoorCameraD3D->GetPolygonMaxZ(v8, uStripType);
-		if ( a3 - v10->radius < v10->x &&
-			v31 + v10->radius > v10->x &&
-			v30 - v10->radius < v10->y &&
-            v29 + v10->radius > v10->y &&
-            v28 - v10->radius < v10->z &&
-            v26 + v10->radius > v10->z )
+        //v21 = uStripType;
+        //v13 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
+        //v21 = uStripType;
+        v28 = pGame->pIndoorCameraD3D->GetPolygonMinZ(a5, uStripType);
+        v26 = pGame->pIndoorCameraD3D->GetPolygonMaxZ(a5, uStripType);
+		if ( a3 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].x &&
+			v31 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].x &&
+			v30 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].y &&
+            v12 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].y &&
+            v28 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].z &&
+            v26 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].z )
         {
-			Vec3_float_::NegDot(&v8->vWorldPosition, v9, a4);
-			v26 = v9->y * v10->y
-				+ v9->z * v10->z
-				+ v9->x * v10->x
+			Vec3_float_::NegDot(&a5->vWorldPosition, _a3, a4);
+			v26 = _a3->y * pBloodsplatContainer->std__vector_pBloodsplats[v32].y
+				+ _a3->z * pBloodsplatContainer->std__vector_pBloodsplats[v32].z
+				+ _a3->x * pBloodsplatContainer->std__vector_pBloodsplats[v32].x
 				+ *a4;
 			v22 = v26 + 6.7553994e15;
-			v25 = LODWORD(v22);
+			//v25 = LODWORD(v22);
 			v14 = (double)SLODWORD(v22);
 			v28 = v14;
-			if ( v14 <= v10->radius )
+			if ( v14 <= pBloodsplatContainer->std__vector_pBloodsplats[v32].radius )
 			{
-				v15 = a2->flags;
+				//v15 = a2->flags;
 				if ( a2->flags & 2 || a2->flags & 0x100 )
 				{
-					v16 = v10->field_1C;
-					if ( !(v16 & 1) )
+					v16 = pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C;
+					if ( !(pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C & 1) )
 					{
 						LOBYTE(v16) = v16 | 1;
-						v10->field_1C = v16;
-						v10->field_20 = pEventTimer->Time();
+						pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C = v16;
+						pBloodsplatContainer->std__vector_pBloodsplats[v32].field_20 = pEventTimer->Time();
 					}
 				}
-				v17 = v32;
-				v10->dot_dist = LODWORD(v28);
-				v18 = v24;
-				v24->std__vector_30B00C[v24->uNumDecals] = v17;
-				++v18->uNumDecals;
+				//v17 = v32;
+				pBloodsplatContainer->std__vector_pBloodsplats[v32].dot_dist = LODWORD(v28);
+				//v18 = this;
+				this->std__vector_30B00C[this->uNumDecals] = v32;
+				++this->uNumDecals;
 			}
         }
-        ++v32;
-        ++v10;
+        //++v32;
+        //++v10;
         result = v32;
       }
     }
--- a/DecorationList.cpp	Sat Mar 08 17:53:38 2014 +0100
+++ b/DecorationList.cpp	Sat Mar 08 23:53:09 2014 +0600
@@ -66,7 +66,6 @@
   unsigned __int8 v25; // of@16
   int j; // edi@17
   const char *v27; // esi@18
-  int v28; // eax@19
   int v29; // eax@21
   int v30; // eax@23
   int v31; // eax@25
@@ -224,10 +223,7 @@
             }
           }
           else
-          {
-            v28 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
-            *(char *)v28 |= 1u;
-          }
+            v2->pDecorations[v2->uNumDecorations].uFlags |= 1;
         }
       }
       ++v2->uNumDecorations;
@@ -239,44 +235,28 @@
 //----- (00458600) --------------------------------------------------------
 void DecorationList::ToFile()
 {
-  DecorationList *v1; // esi@1
   FILE *v2; // eax@1
   FILE *v3; // edi@1
 
-  v1 = this;
   v2 = fopen("data\\ddeclist.bin", "wb");
   v3 = v2;
   if ( !v2 )
     Error("Unable to save ddeclist.bin!");
 
-  fwrite(v1, 4u, 1u, v2);
-  fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3);
+  fwrite(this, 4, 1, v2);
+  fwrite(this->pDecorations, 84, this->uNumDecorations, v3);
   fclose(v3);
 }
 //----- (004488B6) --------------------------------------------------------
 unsigned __int16 DecorationList::GetDecorIdByName(const char *pName)
 {
-  DecorationList *v2; // esi@1
-  signed int uID; // edi@2
-  signed int v4; // ebx@3
-  unsigned __int16 result; // ax@6
-
-  v2 = this;
-  if ( pName && (uID = 1, (signed int)this->uNumDecorations > 1) )
+  if ( pName &&  (signed int)this->uNumDecorations > 1 )
   {
-    v4 = 1;
-    while ( _stricmp(pName, v2->pDecorations[v4].pName) )
+    for ( uint uID = 1; uID < (signed int)this->uNumDecorations; ++uID )
     {
-      ++uID;
-      ++v4;
-      if ( uID >= (signed int)v2->uNumDecorations )
-        return 0;
+      if ( !_stricmp(pName, this->pDecorations[uID].pName) )
+        return uID;
     }
-    result = uID;
   }
-  else
-  {
-    result = 0;
-  }
-  return result;
+  return 0;
 }
\ No newline at end of file
--- a/Events.cpp	Sat Mar 08 17:53:38 2014 +0100
+++ b/Events.cpp	Sat Mar 08 23:53:09 2014 +0600
@@ -282,17 +282,9 @@
 {
   unsigned int v3; // eax@5
   signed int v4; // esi@7
-  //char *v5; // eax@8
   Player *v6; // ecx@8
-  //char *v7; // ebp@8
-  //signed int v8; // edx@10
-  //int v9; // edi@12
-  //ByteArray *v10; // esi@12
   int v11; // eax@14
   char *v12; // eax@15
-  //char *v13; // edi@21
-  int v14; // ebp@21
-  int v15; // edi@21
   const char *v16; // esi@21
   bool v17; // edx@21
   int v18; // ecx@22
@@ -302,11 +294,9 @@
   int v22; // edx@40
   int v23; // eax@40
   unsigned __int16 v24; // ax@45
-  int v25; // eax@54
   LevelDecoration *v26; // eax@55
   int v27; // eax@57
   int v28; // ecx@57
-  //int v29; // edx@58
   int pEventID; // eax@58
   int pNPC_ID; // ecx@58
   int pIndex; // esi@58
@@ -362,11 +352,6 @@
   Player *v82; // esi@201
   int v83; // eax@212
   int v84; // ebp@220
-  signed int v85; // ebp@224
-  char v86; // al@224
-  Player *v87; // esi@227
-  Player *v88; // ecx@231
-  int v89; // ecx@232
   int v90; // eax@243
   const char *v91; // ecx@247
   int v92; // eax@251
@@ -378,26 +363,17 @@
   unsigned int v98; // edx@265
   const char *v99; // esi@267
   int v100; // edx@267
-  //char *v101; // edi@281
   unsigned int v102; // esi@281
   int v103; // edi@284
   int v104; // eax@288
   int v105; // edx@294
   int v106; // [sp-20h] [bp-4C8h]@278
-  signed int v107; // [sp-1Ch] [bp-4C4h]@278
-  unsigned int v108; // [sp-18h] [bp-4C0h]@278
   signed int v109; // [sp-14h] [bp-4BCh]@278
   signed int v110; // [sp-10h] [bp-4B8h]@278
-  int v111; // [sp-Ch] [bp-4B4h]@278
-  // Event *v112; // [sp-8h] [bp-4B0h]@5
   int v113; // [sp-8h] [bp-4B0h]@106
   int v114; // [sp-8h] [bp-4B0h]@117
-  signed int v115; // [sp-8h] [bp-4B0h]@231
-  unsigned int v116; // [sp-8h] [bp-4B0h]@278
   int v117; // [sp-4h] [bp-4ACh]@106
   int v118; // [sp-4h] [bp-4ACh]@117
-  int v119; // [sp-4h] [bp-4ACh]@231
-  int v120; // [sp-4h] [bp-4ACh]@278
   int v121; // [sp-4h] [bp-4ACh]@294
   int curr_seq_num; // [sp+10h] [bp-498h]@4
   //char *v123; // [sp+14h] [bp-494h]@0
@@ -464,7 +440,11 @@
     while ( 1 )
     {
     if ( dword_5B65C4_cancelEventProcessing )
-      goto LABEL_301;
+    {
+      if ( v133 == 1 )
+        OnMapLeave();
+      return;
+    }
     //v8 = v4;
     if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num )
       {
@@ -501,18 +481,18 @@
         //v13 = &pSomeEVT[v9];
         //v14 = (unsigned __int8)v13[5];
         //v15 = (unsigned __int8)v13[6];
-        v14 = _evt->v5;
-        v15 = _evt->v6;
+        //v14 = _evt->v5;
+        //v15 = _evt->v6;
         strcpy(Str, Source);
         v16 = RemoveQuotes(Str);
-		pVideoPlayer->MovieLoop(v16, 0, v14, 1);
+		pVideoPlayer->MovieLoop(v16, 0, _evt->v5, 1);
         if ( !_stricmp(v16, "arbiter good") )
                 {
                   pParty->alignment = PartyAlignment_Good;
           v18 = 0;
           LOBYTE(v17) = 1;
           SetUserInterface(PartyAlignment_Good, v17);
-          if ( !v15 || v128 == 3 )
+          if ( !_evt->v6 || v128 == 3 )
             {
             pCurrentScreen = v128;
             if ( v128 == 3 )
@@ -534,7 +514,7 @@
           pParty->alignment = PartyAlignment_Evil;
           LOBYTE(v17) = 1;
           SetUserInterface(PartyAlignment_Evil, v17);
-          if ( !v15 || v128 == 3 )
+          if ( !_evt->v6 || v128 == 3 )
             {
             pCurrentScreen = v128;
             if ( v128 == 3 )
@@ -556,13 +536,13 @@
           pParty->RestAndHeal();
           pParty->days_played_without_rest = 0;
                 }
-        if ( !v15 || v128 == 3 )
+        if ( !_evt->v6 || v128 == 3 )
           {
           pCurrentScreen = v128;
           if ( v128 == 3 )
             pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
           if ( v128 == 13 )
-            pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
+            pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1);
           }
         ++curr_seq_num;
         v4 = v124;
@@ -577,15 +557,11 @@
         if ( player_choose < 0 )
           goto LABEL_47;
         if ( player_choose <= 3 )
-          {
           v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5];
-          }
         else
           {
           if ( player_choose == 4 )
-            {
             v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5];
-            }
           else
             {
             if ( player_choose == 5 )
@@ -612,8 +588,11 @@
                   break;
                   }
                 }
-              v11 = _evt->v11;
-              goto LABEL_130;
+              //v11 = _evt->v11;
+              curr_seq_num = _evt->v11 - 1;
+              ++curr_seq_num;
+              v4 = v124;
+              break;
               }
 LABEL_47:
             //v10 = (ByteArray *)&v5[v9];
@@ -626,8 +605,10 @@
         v139 = v24 & 0x100;
         if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) )
           {
-          v11 = _evt->v11;
-          goto LABEL_130;
+              curr_seq_num = _evt->v11 - 1;
+              ++curr_seq_num;
+              v4 = v124;
+              break;
           }
         ++curr_seq_num;
         v4 = v124;
@@ -647,9 +628,7 @@
           GameUI_InitializeDialogue(&Dst, false);
           }
         else
-          {
           bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
-          }
         ++curr_seq_num;
         v4 = v124;
 
@@ -657,11 +636,9 @@
         //v7 = "";
         break;
       case EVENT_ChangeEvent:
-        v25 = EVT_DWORD(_evt->v5);
-        if ( v25 )
-          {
+        //v25 = EVT_DWORD(_evt->v5);
+        if ( EVT_DWORD(_evt->v5) )
           stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124;
-          }
         else
           {
           v26 = (LevelDecoration *)activeLevelDecoration;
@@ -812,7 +789,7 @@
               pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
               window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0);
               v48 = window_SpeakInHouse->pControlsHead;
-              if ( v48 )
+              if ( window_SpeakInHouse->pControlsHead )
                 {
                 do
                   {
@@ -852,14 +829,13 @@
           pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
         else if ( _evt->v5 == 5 ) //all players
           {
-          for(int i=0; i<4; ++i)
+          for(int i = 0; i < 4; ++i)
             pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
           }
         else  //random player
           pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
           ++curr_seq_num;
           v4 = v124;
-
           break;
       case EVENT_CharacterAnimation:
         if ( _evt->v5 <= 3u ) //someone
@@ -916,7 +892,7 @@
         }
         else  if ( player_choose == 5 )//all
         {
-          v130=0;
+          v130 = 0;
           for(int i = 1; i < 5; ++i)
           {
             if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
@@ -1029,16 +1005,10 @@
         else  if ( player_choose == 5 )//all
         {
           for(int i = 1; i < 5; ++i)
-          {
             pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-          }
         }
         else if ( player_choose == 6 ) //random
-        {
-          player_choose = rand() % 4;
-          pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-        }
-//substract:
+          pParty->pPlayers[rand() % 4].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         ++curr_seq_num;
         v4 = v124;
         break;
@@ -1058,11 +1028,7 @@
             pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
         else if ( player_choose == 6 ) //random
-        {
-          player_choose = rand() % 4;
-          pPlayer = &pParty->pPlayers[player_choose];
-          pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-        }
+          pParty->pPlayers[rand() % 4].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         ++curr_seq_num;
         v4 = v124;
         break;
@@ -1084,10 +1050,7 @@
             pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
         else if ( player_choose == 6 ) //random
-        {
-          player_choose = rand() % 4;
-          pParty->pPlayers[player_choose].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-        }
+          pParty->pPlayers[rand() % 4].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         v83 = EVT_WORD(_evt->v5);
         if (v83 == 21 ||  // gold well on emerald isle
             v83 == 22 || v83 == 23 || v83 == 24 )
@@ -1102,11 +1065,9 @@
         if ( !entry_line )
           {
           strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
-          v105 = curr_seq_num;
-          v121 = 26;
-LABEL_295:
-          sub_4451A8_press_any_key(uEventID, v105, v121);
-LABEL_301:
+          //v105 = curr_seq_num;
+          //v121 = 26;
+          sub_4451A8_press_any_key(uEventID, curr_seq_num, 26);
           if ( v133 == 1 )
             OnMapLeave();
           return;
@@ -1116,9 +1077,9 @@
           || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) )
           {
           v11 = _evt->v17;
-LABEL_130:
+//LABEL_130:
           //v124 = -1;
-LABEL_131:
+//LABEL_131:
           curr_seq_num = v11 - 1;
           }
         ++curr_seq_num;
@@ -1136,20 +1097,16 @@
                 v4 = v124;
                 break;
       case EVENT_ReceiveDamage:
-        v85 = EVT_DWORD(_evt->v7 );
-        v86 = _evt->v5;
-        if ( (unsigned __int8)v86 <= 3 )
+        if ( (unsigned __int8)_evt->v5 <= 3 )
           {
-          v119 = _evt->v6;
-          v115 = EVT_DWORD(_evt->v7 );
-          v89 = (unsigned __int8)v86;
-          v88 = &pParty->pPlayers[v89];
-          v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
+          //v119 = _evt->v6;
+          //v115 = EVT_DWORD(_evt->v7 );
+          pParty->pPlayers[(unsigned __int8)_evt->v5].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
           ++curr_seq_num;
           v4 = v124;
           break;
           }
-        if ( v86 == 4 )
+        if ( _evt->v5 == 4 )
           {
           if ( !uActiveCharacter )
             {
@@ -1160,21 +1117,14 @@
             //v7 = "";
             break;
             }
-          v119 = _evt->v6;
-          v88 = pPlayers[uActiveCharacter];
-          v115 = EVT_DWORD(_evt->v7 );
-          v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
+          pPlayers[uActiveCharacter]->ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
           ++curr_seq_num;
           v4 = v124;
           break;
           }
-        if ( v86 != 5 )
+        if ( _evt->v5 != 5 )
           {
-          v119 = _evt->v6;
-          v115 = EVT_DWORD(_evt->v7 );
-          v89 = rand() % 4;
-          v88 = &pParty->pPlayers[v89];
-          v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
+          pParty->pPlayers[rand() % 4].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
           ++curr_seq_num;
           v4 = v124;
 
@@ -1182,13 +1132,8 @@
           //v7 = "";
           break;
           }
-        v87 = pParty->pPlayers.data();
-        do
-          {
-          v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6);
-          ++v87;
-          }
-          while ( (signed int)v87 < (signed int)pParty->pHirelings.data() );
+        for ( uint pl_id = 0;pl_id < 4; pl_id++ )
+          pParty->pPlayers[pl_id].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
           ++curr_seq_num;
           v4 = v124;
 
@@ -1249,14 +1194,12 @@
         if ( activeLevelDecoration )
           {
           if ( activeLevelDecoration == (LevelDecoration*)1 )
-            {
             current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
-            }
           if ( canShowMessages == 1 )
             {
             v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
             //LABEL_248:
-            ShowStatusBarString(v91, 2u);
+            ShowStatusBarString(v91, 2);
             }
           }
         else
@@ -1274,17 +1217,15 @@
         //v7 = "";
         break;
       case EVENT_ShowMessage:
-        v92 = EVT_DWORD(_evt->v5 );
+        //v92 = EVT_DWORD(_evt->v5 );
         if ( activeLevelDecoration )
           {
-          v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
+          current_npc_text = pNPCTopics[EVT_DWORD(_evt->v5 )-1].pText;//(&dword_721664)[8 * v92];
           byte_5B0938[0] = 0;
-          current_npc_text = v93;
+          //current_npc_text = v93;
           }
         else
-          {
-          strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]);
-          }
+          strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
         ++curr_seq_num;
         v4 = v124;
 
@@ -1340,7 +1281,11 @@
         break;
       case EVENT_OpenChest:
         if ( !Chest::Open(_evt->v5) )
-          goto LABEL_301;
+		{
+          if ( v133 == 1 )
+            OnMapLeave();
+          return;
+		}
         ++curr_seq_num;
         v4 = v124;
 
@@ -1363,15 +1308,15 @@
           TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
           dword_5C3418 = uEventID;
           dword_5C341C = curr_seq_num + 1;
-          goto LABEL_301;
+          if ( v133 == 1 )
+            OnMapLeave();
+          return;
           }
         _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
         _5B65A8_npcdata_uflags_or_other = v94;
         _5B65B0_npcdata_rep_or_other = v126;
         if ( v129 == -1 )
-          {
           v98 = _5B65B4_npcdata_loword_house_or_other;
-          }
         else
           {
           v98 = v129 & stru_5C6E00->uDoublePiMask;
@@ -1393,13 +1338,6 @@
             if ( _5B65B4_npcdata_loword_house_or_other != -1 )
               pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
             _5B65B4_npcdata_loword_house_or_other = -1;
-            v120 = 0;
-            v116 = 0;
-            v111 = 0;
-            v110 = 0;
-            v109 = -1;
-            v108 = 0;
-            v107 = 0;
             pParty->sRotationX = v95;
             pParty->uFallSpeed = v134;
             dword_5B65C0 = 0;
@@ -1409,8 +1347,7 @@
             _5B65AC_npcdata_fame_or_other = 0;
             _5B65A8_npcdata_uflags_or_other = 0;
             v106 = 232;
-LABEL_280:
-            pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120);
+            pAudioPlayer->PlaySound((SoundID)v106, 0, 0, -1, 0, 0, 0, 0);
             }
           }
         else
@@ -1450,20 +1387,17 @@
         //v7 = "";
         break;
       case EVENT_PlaySound:
-        v120 = 0;
-        v116 = 0;
-        v111 = 0;
         v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
         v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-        v108 = 0;
-        v107 = 0;
         v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-        goto LABEL_280;
+        pAudioPlayer->PlaySound((SoundID)v106, 0, 0, v109, v110, 0, 0, 0);
+        ++curr_seq_num;
+        v4 = v124;
+        break;
       case EVENT_GiveItem:
         item.Reset();
         //v101 = &pSomeEVT[v9];
-        v102 = _evt->v7
-          + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+        v102 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
         pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item);
         if ( v102 )
           item.uItemID = v102;
@@ -1496,9 +1430,12 @@
         //v7 = "";
         break;
       case EVENT_PressAnyKey:
-        v121 = 33;
-        v105 = curr_seq_num + 1;
-        goto LABEL_295;
+        //v121 = 33;
+        //v105 = curr_seq_num + 1;
+        sub_4451A8_press_any_key(uEventID, curr_seq_num + 1, 33);
+        if ( v133 == 1 )
+          OnMapLeave();
+        return;
       case EVENT_Exit:
         if ( v133 == 1 )
               OnMapLeave();
@@ -1515,8 +1452,11 @@
     ++v4;
     v124 = v4;
     if ( v4 >= uSomeEVT_NumEvents )
-       goto LABEL_301;
-    //}
+    {
+      if ( v133 == 1 )
+        OnMapLeave();
+      return;
+    }
     }
   }