changeset 1440:a72236d60edc

m
author Ritor1
date Sat, 27 Jul 2013 09:36:29 +0600
parents 468f434a8d8a
children b67a3e0d6fc3
files Chest.cpp
diffstat 1 files changed, 20 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Mon Jul 22 18:00:58 2013 +0600
+++ b/Chest.cpp	Sat Jul 27 09:36:29 2013 +0600
@@ -43,21 +43,19 @@
 //----- (0042041E) --------------------------------------------------------
 bool Chest::Open( signed int uChestID )
 {
-  //char *v1; // edi@5
   unsigned int v2; // eax@8
   GUIWindow *v3; // eax@15
   int v5; // edx@16
   int v6; // eax@16
-  ODMFace *v7; // eax@19
+  ODMFace *pOdmFace; // eax@19
   int v8; // edx@19
   int v9; // edi@19
   signed int v10; // ebx@19
   int v11; // ecx@19
   int v12; // eax@19
-  BLVFace *v13; // eax@20
+  BLVFace *pBlvFace; // eax@20
   int v14; // ebx@21
   int v15; // edi@21
-  int v16; // ecx@22
   __int64 v17; // qax@22
   double v18; // st7@23
   double v19; // st6@23
@@ -69,14 +67,8 @@
   signed int v25; // ecx@28
   char *v26; // edx@29
   unsigned __int16 v27; // ax@32
-  //SpriteObject a1; // [sp+14h] [bp-B0h]@28
   int v29[4]; // [sp+84h] [bp-40h]@16
-  //int v30; // [sp+88h] [bp-3Ch]@16
-  //int v31; // [sp+8Ch] [bp-38h]@16
-  //int v32; // [sp+90h] [bp-34h]@16
   float v33; // [sp+94h] [bp-30h]@23
-  //char *v34; // [sp+98h] [bp-2Ch]@5
-  int v35; // [sp+9Ch] [bp-28h]@16
   Vec3_int_ pOut; // [sp+A0h] [bp-24h]@28
   int a4; // [sp+ACh] [bp-18h]@1
   int v38; // [sp+B0h] [bp-14h]@21
@@ -84,8 +76,8 @@
   float v40; // [sp+B8h] [bp-Ch]@23
   float v41; // [sp+BCh] [bp-8h]@23
   int sRotY; // [sp+C0h] [bp-4h]@8
+  SpriteObject a1; // [sp+14h] [bp-B0h]@28
 
-  //a4 = uChestID;
   assert(uChestID < 20);
   if ((uChestID <0)&&(uChestID >=20) )
       return false;
@@ -95,14 +87,11 @@
   if (!pIcons_LOD->uNumPrevLoadedFiles)
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
 
-
-  //v1 = (char *)&pChests[uChestID].uFlags;
-  //v34 = v1;
   if (!chest->Initialized())
     Chest::PlaceItems(uChestID);
 
   if ( !uActiveCharacter )
-    return 0;
+    return false;
   *(float *)&sRotY = 0.0;
   v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( !chest->Trapped() || !v2 )
@@ -115,14 +104,12 @@
     v29[3] = 814;
     v5 = rand() % 4;
     v6 = PID_ID(EvtTargetObj);
-    v35 = v5;
     if ( PID_TYPE(EvtTargetObj) == OBJECT_Decoration)
     {
-      v16 = v6;
       v14 = pLevelDecorations[v6].vPosition.x;
       v38 = pLevelDecorations[v6].vPosition.y;
       v17 = pDecorationList->pDecorations[pLevelDecorations[v6].uDecorationDescID].uDecorationHeight;
-      v15 = pLevelDecorations[v16].vPosition.z + (((signed int)v17 - HIDWORD(v17)) >> 1);
+      v15 = pLevelDecorations[v6].vPosition.z + (((signed int)v17 - HIDWORD(v17)) >> 1);
     }
     else
     {
@@ -130,21 +117,21 @@
         goto LABEL_12;
       if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
       {
-        v7 = &pOutdoor->pBModels[EvtTargetObj >> 9].pFaces[(EvtTargetObj >> 3) & 0x3F];
-        v8 = v7->pBoundingBox.y1;
-        v9 = v7->pBoundingBox.z2;
-        v10 = v7->pBoundingBox.x1 + v7->pBoundingBox.x2;
-        v11 = v7->pBoundingBox.y2;
-        v12 = v7->pBoundingBox.z1;
+        pOdmFace = &pOutdoor->pBModels[EvtTargetObj >> 9].pFaces[(EvtTargetObj >> 3) & 0x3F];
+        v8 = pOdmFace->pBoundingBox.y1;
+        v9 = pOdmFace->pBoundingBox.z2;
+        v10 = pOdmFace->pBoundingBox.x1 + pOdmFace->pBoundingBox.x2;
+        v11 = pOdmFace->pBoundingBox.y2;
+        v12 = pOdmFace->pBoundingBox.z1;
       }
       else
       {
-        v13 = &pIndoor->pFaces[v6];
-        v8 = v13->pBounding.y1;
-        v9 = v13->pBounding.z2;
-        v10 = v13->pBounding.x1 + v13->pBounding.x2;
-        v11 = v13->pBounding.y2;
-        v12 = v13->pBounding.z1;
+        pBlvFace = &pIndoor->pFaces[v6];
+        v8 = pBlvFace->pBounding.y1;
+        v9 = pBlvFace->pBounding.z2;
+        v10 = pBlvFace->pBounding.x1 + pBlvFace->pBounding.x2;
+        v11 = pBlvFace->pBounding.y2;
+        v12 = pBlvFace->pBounding.z1;
       }
       v14 = v10 >> 1;
       v38 = (v8 + v11) >> 1;
@@ -176,11 +163,8 @@
     *(int *)&v22[8] = v15;
     *(_QWORD *)v22 = __PAIR__(v38, v14);
     Vec3_int_::Rotate(v21, sRotX, sRotY, *(Vec3_int_ *)v22, &pOut.x, &pOut.z, &pOut.y);
-    v23 = (unsigned int *)(&v29 + v35);
+    v23 = (unsigned int *)(&v29 + v5);
     sub_42F7EB_DropItemAt(*v23, pOut.x, pOut.z, pOut.y, 0, 1, 0, 0x30u, 0);
-    
-    SpriteObject a1; // [sp+14h] [bp-B0h]@28
-    //SpriteObject::SpriteObject(&a1);
 
     a1.stru_24.Reset();
     v24 = *(short *)v23;
@@ -230,7 +214,7 @@
     }
     pIcons_LOD->RemoveTexturesPackFromTextureList();
     dword_507CD8 = 0;
-    return 0;
+    return false;
   }
   chest->SetInitialized(false);//*v1 &= 0xFEu;
   sRotY = 1;
@@ -243,15 +227,12 @@
       pPlayers[uActiveCharacter]->PlaySound(SPEECH_4, 0);
   }
   dword_507CD8 = 0;
-
   pChestWindow = pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Chest, uChestID, 0);
-
   pBtn_ExitCancel = pChestWindow->CreateButton(471, 445, 169,  35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pIcons_LOD->GetTexture(uExitCancelTextureId),   0);// Exit
                     pChestWindow->CreateButton(  7,   8, 460, 343, 1, 0, UIMSG_CHEST_ClickItem,      0, 0, "", 0);
-
   pCurrentScreen = SCREEN_CHEST;
   pEventTimer->Pause();
-  return 1;
+  return true;
 }
 
 //----- (0042092D) --------------------------------------------------------