diff Outdoor.cpp @ 2472:e42e01ff1526

goto cleaning
author zipi
date Mon, 18 Aug 2014 18:17:20 +0100
parents b054ea5daf45
children 0a0c6d75aabe
line wrap: on
line diff
--- a/Outdoor.cpp	Mon Aug 18 22:24:00 2014 +0600
+++ b/Outdoor.cpp	Mon Aug 18 18:17:20 2014 +0100
@@ -1734,25 +1734,35 @@
       {
         v62 = pBitmaps_LOD->LoadTexture(texFilename);
 //        v63 = (ODMFace *)pFilename;
-        goto LABEL_68;
+		pBModels[i].pFaces[j].uTextureID = v62;
+		//v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0;
+		//v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36);
+		if ((signed __int16)v62 != -1)
+			pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1);
+		//goto LABEL_69;
+		//goto LABEL_68;
       }
-      //v61 = pTextureFrameTable->FindTextureByName(texFilename);
-      pBModels[i].pFaces[j].uTextureID = pTextureFrameTable->FindTextureByName(texFilename);
-      if (!pBModels[i].pFaces[j].uTextureID)
-      {
-        v62 = pBitmaps_LOD->LoadTexture(texFilename);
-        //v63 = (ODMFace *)pFilename;
-        pBModels[i].pFaces[j].uAttributes &= ~FACE_DONT_CACHE_TEXTURE;
-LABEL_68:
-        pBModels[i].pFaces[j].uTextureID = v62;
-        //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0;
-        //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36);
-        if ((signed __int16)v62 != -1)
-          pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1);
-        goto LABEL_69;
-      }
-      pTextureFrameTable->LoadAnimationSequenceAndPalettes(pBModels[i].pFaces[j].uTextureID);
-LABEL_69:
+	  else
+	  {
+		  //v61 = pTextureFrameTable->FindTextureByName(texFilename);
+		  pBModels[i].pFaces[j].uTextureID = pTextureFrameTable->FindTextureByName(texFilename);
+		  if (!pBModels[i].pFaces[j].uTextureID)
+		  {
+			  v62 = pBitmaps_LOD->LoadTexture(texFilename);
+			  //v63 = (ODMFace *)pFilename;
+			  pBModels[i].pFaces[j].uAttributes &= ~FACE_DONT_CACHE_TEXTURE;
+			  //LABEL_68:
+			  pBModels[i].pFaces[j].uTextureID = v62;
+			  //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0;
+			  //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36);
+			  if ((signed __int16)v62 != -1)
+				  pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1);
+			  //goto LABEL_69;
+		  }
+		  else
+			  pTextureFrameTable->LoadAnimationSequenceAndPalettes(pBModels[i].pFaces[j].uTextureID);
+	  }
+//LABEL_69:
       if (pBModels[i].pFaces[j].sCogTriggeredID)
       {
         if (pBModels[i].pFaces[j].HasEventHint())
@@ -1924,52 +1934,57 @@
 
   if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000)
     pNumItems = 0x1BAF800;
-  if ( Str2 )
-  {
-    memset(Dst, 0, 0x3C8u);
-    memset(Src, 0, 0x3C8u);
-    goto LABEL_112;
-  }
-  //v81 = ddm.uLastRepawnDay;
-  if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)
+
+  if (Str2 || ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay))
   {
-    memcpy(Dst, pSrc, 0x3C8u);
-    memcpy(Src, pSrc + 968, 0x3C8u);
-LABEL_112:
-    free(pSrcMem);
-
-    ddm.uLastRepawnDay = (int)File;
-    if (Str2 == 0)
-      ++ddm.uNumRespawns;
-    v108 = 0;
-    *thisa = 1;
-    v39 = pGames_LOD->FindContainer(Str, 0);
-    fread(&header, 0x10, 1u, v39);
-    //pFilename = (char *)header.uCompressedSize;
-    //pDestLen = header.uDecompressedSize;
-    //v82 = malloc(header.uDecompressedSize);
-    pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
-    //v149 = v82;
-    if (header.uCompressedSize == header.uDecompressedSize)
-      fread(pSrcMem, header.uDecompressedSize, 1, v39);
-    else if (header.uCompressedSize < header.uDecompressedSize)
-    {
-      void* compressedMem = malloc(header.uCompressedSize);
-      fread(compressedMem, header.uCompressedSize, 1u, v39);
-
-      uint actualDecompressedSize = header.uDecompressedSize;
-      zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize);
-      free(compressedMem);
-    }
-    else
-      MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
-
-    pSrc = pSrcMem + 40;
-    goto LABEL_120;
-
+
+	  if (Str2)
+	  {
+		  memset(Dst, 0, 0x3C8u);
+		  memset(Src, 0, 0x3C8u);
+		  //goto LABEL_112;
+	  }
+	  //v81 = ddm.uLastRepawnDay;
+	  if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)
+	  {
+		  memcpy(Dst, pSrc, 0x3C8u);
+		  memcpy(Src, pSrc + 968, 0x3C8u);
+	  }
+	  //LABEL_112:
+		  free(pSrcMem);
+
+		  ddm.uLastRepawnDay = (int)File;
+		  if (Str2 == 0)
+			  ++ddm.uNumRespawns;
+		  v108 = 0;
+		  *thisa = 1;
+		  v39 = pGames_LOD->FindContainer(Str, 0);
+		  fread(&header, 0x10, 1u, v39);
+		  //pFilename = (char *)header.uCompressedSize;
+		  //pDestLen = header.uDecompressedSize;
+		  //v82 = malloc(header.uDecompressedSize);
+		  pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
+		  //v149 = v82;
+		  if (header.uCompressedSize == header.uDecompressedSize)
+			  fread(pSrcMem, header.uDecompressedSize, 1, v39);
+		  else if (header.uCompressedSize < header.uDecompressedSize)
+		  {
+			  void* compressedMem = malloc(header.uCompressedSize);
+			  fread(compressedMem, header.uCompressedSize, 1u, v39);
+
+			  uint actualDecompressedSize = header.uDecompressedSize;
+			  zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize);
+			  free(compressedMem);
+		  }
+		  else
+			  MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
+
+		  pSrc = pSrcMem + 40;
+		  //goto LABEL_120;
   }
-  *thisa = 0;
-LABEL_120:
+  else
+	*thisa = 0;
+//LABEL_120:
   //v108 = (int)".odm";
   //v83 = strlen(pContainer);
   //strcpy((char *)v141 + v83, (const char *)v108);