Guest User

mangos-one liquid

a guest
Mar 7th, 2011
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.38 KB | None | 0 0
  1. ef0ac74b90bfb542d75ce25cbcd535a222031898
  2. diff --git a/contrib/vmap_extractor_v3/vmapextract/vmapexport.cpp b/contrib/vmap_extractor_v3/vmapextract/vmapexport.cpp
  3. index 0b46f40..101ca2c 100644
  4. --- a/contrib/vmap_extractor_v3/vmapextract/vmapexport.cpp
  5. +++ b/contrib/vmap_extractor_v3/vmapextract/vmapexport.cpp
  6. @@ -83,28 +83,6 @@ static const char * GetPlainName(const char * szFileName)
  7.      return szFileName;
  8.  }
  9.  
  10. -// copied from contrib/extractor/System.cpp
  11. -void ReadLiquidTypeTableDBC()
  12. -{
  13. -    printf("Read LiquidType.dbc file...");
  14. -    DBCFile dbc("DBFilesClient\\LiquidType.dbc");
  15. -    if(!dbc.open())
  16. -    {
  17. -        printf("Fatal error: Invalid LiquidType.dbc file format!\n");
  18. -        exit(1);
  19. -    }
  20. -
  21. -    size_t LiqType_count = dbc.getRecordCount();
  22. -    size_t LiqType_maxid = dbc.getRecord(LiqType_count - 1).getUInt(0);
  23. -    LiqType = new uint16[LiqType_maxid + 1];
  24. -    memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16));
  25. -
  26. -    for(uint32 x = 0; x < LiqType_count; ++x)
  27. -        LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
  28. -
  29. -    printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count);
  30. -}
  31. -
  32.  int ExtractWmo()
  33.  {
  34.      char   szLocalFile[1024] = "";
  35. @@ -486,7 +464,6 @@ int main(int argc, char ** argv)
  36.          printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
  37.          return 1;
  38.      }
  39. -    ReadLiquidTypeTableDBC();
  40.  
  41.      // extract data
  42.      if(success)
  43. @@ -527,6 +504,5 @@ int main(int argc, char ** argv)
  44.      }
  45.  
  46.      printf("Extract %s. Work complete. No errors.\n",versionString);
  47. -    delete [] LiqType;
  48.      return 0;
  49.  }
  50. diff --git a/contrib/vmap_extractor_v3/vmapextract/wmo.cpp b/contrib/vmap_extractor_v3/vmapextract/wmo.cpp
  51. index 6a3e940..b1a4b52 100644
  52. --- a/contrib/vmap_extractor_v3/vmapextract/wmo.cpp
  53. +++ b/contrib/vmap_extractor_v3/vmapextract/wmo.cpp
  54. @@ -382,22 +382,13 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
  55.          int LIQU_h[] = {0x5551494C, sizeof(WMOLiquidHeader) + LiquEx_size + hlq->xtiles*hlq->ytiles};// "LIQU"
  56.          fwrite(LIQU_h, 4, 2, output);
  57.  
  58. -        // according to WoW.Dev Wiki:
  59. -        uint32 liquidEntry;
  60. -        if (rootWMO->liquidType & 4)
  61. -            liquidEntry = liquidType;
  62. -        else if (liquidType == 15)
  63. -            liquidEntry = 1; // first entry, generic "Water"
  64. -        else
  65. -            liquidEntry = liquidType + 1;
  66. -        // overwrite material type in header...
  67. -        hlq->type = LiqType[liquidEntry];
  68. -
  69.          /* std::ofstream llog("Buildings/liquid.log", ios_base::out | ios_base::app);
  70.          llog << filename;
  71. -        llog << ":\nliquidEntry: " << liquidEntry << " type: " << hlq->type << " (root:" << rootWMO->liquidType << " group:" << liquidType << ")\n";
  72. +        llog << ":\ntype: " << hlq->type << " (root:" << rootWMO->liquidType << " group:" << liquidType << ")\n";
  73.          llog.close(); */
  74.  
  75. +        hlq->type = ConvertLiquidType(hlq->type, filename);
  76. +
  77.          fwrite(hlq, sizeof(WMOLiquidHeader), 1, output);
  78.          // only need height values, the other values are unknown anyway
  79.          for (uint32 i = 0; i<LiquEx_size/sizeof(WMOLiquidVert); ++i)
  80. @@ -409,6 +400,24 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
  81.      return nColTriangles;
  82.  }
  83.  
  84. +int WMOGroup::ConvertLiquidType(int hlqLiquid, std::string &filename)
  85. +{
  86. +    if (hlqLiquid == 4)                                             // lava in Blackrock Mountain, Blackrock Depths, Blackrock Spire and Old Ironforge
  87. +        return 2;
  88. +
  89. +    filename = filename.substr(0, filename.find_last_of("\\"));     // trim filename
  90. +    filename = filename.substr(filename.find_last_of("\\") + 1);    // trim everything except current wmo path part
  91. +
  92. +    if (hlqLiquid == 3 && filename == "AZ_Blackrock")               // lava in Molten Cire
  93. +        return 2;
  94. +    else if (filename == "KL_OrgrimmarLavaDungeon")                 // lava in Ragefire Chasm
  95. +        return 2;
  96. +    else if (hlqLiquid == 8 && filename == "LD_Stratholme")         // slime in Naxxramas
  97. +        return 3;
  98. +    else
  99. +        return 0;
  100. +}
  101. +
  102.  WMOGroup::~WMOGroup()
  103.  {
  104.      delete [] MOPY;
  105. diff --git a/contrib/vmap_extractor_v3/vmapextract/wmo.h b/contrib/vmap_extractor_v3/vmapextract/wmo.h
  106. index 12979bc..a9edc41 100644
  107. --- a/contrib/vmap_extractor_v3/vmapextract/wmo.h
  108. +++ b/contrib/vmap_extractor_v3/vmapextract/wmo.h
  109. @@ -91,6 +91,7 @@ public:
  110.  
  111.      bool open();
  112.      int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData);
  113. +    int ConvertLiquidType(int hlqLiquid, std::string &filename);
  114.  
  115.  private:
  116.      std::string filename;
  117. diff --git a/src/game/Player.cpp b/src/game/Player.cpp
  118. index ddd9fa0..fc7623d 100644
  119. --- a/src/game/Player.cpp
  120. +++ b/src/game/Player.cpp
  121. @@ -1060,9 +1060,7 @@ void Player::HandleDrowning(uint32 time_diff)
  122.                  uint32 damage = urand(600, 700);
  123.                  if (m_MirrorTimerFlags&UNDERWATER_INLAVA)
  124.                      EnvironmentalDamage(DAMAGE_LAVA, damage);
  125. -                // need to skip Slime damage in Undercity,
  126. -                // maybe someone can find better way to handle environmental damage
  127. -                else if (m_zoneUpdateId != 1497)
  128. +                else
  129.                      EnvironmentalDamage(DAMAGE_SLIME, damage);
  130.              }
  131.          }
Advertisement
Add Comment
Please, Sign In to add comment