1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

chr loading

This commit is contained in:
Laserlicht
2024-08-31 12:39:23 +02:00
parent a89a1efa89
commit 46c169d20f
6 changed files with 15 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ enum class CampaignVersion : uint8_t
AB = 5, AB = 5,
SoD = 6, SoD = 6,
WoG = 6, WoG = 6,
// Chr = 7, // Heroes Chronicles, likely identical to SoD, untested Chr = 7,
VCMI = 1, VCMI = 1,
VCMI_MIN = 1, VCMI_MIN = 1,

View File

@@ -392,6 +392,7 @@ void CampaignHandler::readHeaderFromMemory( CampaignHeader & ret, CBinaryReader
{ {
ret.version = static_cast<CampaignVersion>(reader.readUInt32()); ret.version = static_cast<CampaignVersion>(reader.readUInt32());
ui8 campId = reader.readUInt8() - 1;//change range of it from [1, 20] to [0, 19] ui8 campId = reader.readUInt8() - 1;//change range of it from [1, 20] to [0, 19]
if(ret.version != CampaignVersion::Chr)
ret.loadLegacyData(campId); ret.loadLegacyData(campId);
ret.name.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "name")); ret.name.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "name"));
ret.description.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "description")); ret.description.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "description"));

View File

@@ -157,6 +157,7 @@ std::unique_ptr<IMapLoader> CMapService::getMapLoader(std::unique_ptr<CInputStre
case static_cast<int>(EMapFormat::AB) : case static_cast<int>(EMapFormat::AB) :
case static_cast<int>(EMapFormat::ROE) : case static_cast<int>(EMapFormat::ROE) :
case static_cast<int>(EMapFormat::SOD) : case static_cast<int>(EMapFormat::SOD) :
case static_cast<int>(EMapFormat::CHR) :
case static_cast<int>(EMapFormat::HOTA) : case static_cast<int>(EMapFormat::HOTA) :
return std::unique_ptr<IMapLoader>(new CMapLoaderH3M(mapName, modName, encoding, stream.get())); return std::unique_ptr<IMapLoader>(new CMapLoaderH3M(mapName, modName, encoding, stream.get()));
default : default :

View File

@@ -25,6 +25,8 @@ MapFormatFeaturesH3M MapFormatFeaturesH3M::find(EMapFormat format, uint32_t hota
return getFeaturesAB(); return getFeaturesAB();
case EMapFormat::SOD: case EMapFormat::SOD:
return getFeaturesSOD(); return getFeaturesSOD();
case EMapFormat::CHR:
return getFeaturesCHR();
case EMapFormat::WOG: case EMapFormat::WOG:
return getFeaturesWOG(); return getFeaturesWOG();
case EMapFormat::HOTA: case EMapFormat::HOTA:
@@ -107,6 +109,13 @@ MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesSOD()
return result; return result;
} }
MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesCHR()
{
MapFormatFeaturesH3M result = getFeaturesSOD();
return result;
}
MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesWOG() MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesWOG()
{ {
MapFormatFeaturesH3M result = getFeaturesSOD(); MapFormatFeaturesH3M result = getFeaturesSOD();

View File

@@ -21,6 +21,7 @@ public:
static MapFormatFeaturesH3M getFeaturesROE(); static MapFormatFeaturesH3M getFeaturesROE();
static MapFormatFeaturesH3M getFeaturesAB(); static MapFormatFeaturesH3M getFeaturesAB();
static MapFormatFeaturesH3M getFeaturesSOD(); static MapFormatFeaturesH3M getFeaturesSOD();
static MapFormatFeaturesH3M getFeaturesCHR();
static MapFormatFeaturesH3M getFeaturesWOG(); static MapFormatFeaturesH3M getFeaturesWOG();
static MapFormatFeaturesH3M getFeaturesHOTA(uint32_t hotaVersion); static MapFormatFeaturesH3M getFeaturesHOTA(uint32_t hotaVersion);

View File

@@ -19,7 +19,7 @@ enum class EMapFormat : uint8_t
ROE = 0x0e, // 14 ROE = 0x0e, // 14
AB = 0x15, // 21 AB = 0x15, // 21
SOD = 0x1c, // 28 SOD = 0x1c, // 28
// CHR = 0x1d, // 29 Heroes Chronicles, presumably - identical to SoD, untested CHR = 0x1d, // 29
HOTA = 0x20, // 32 HOTA = 0x20, // 32
WOG = 0x33, // 51 WOG = 0x33, // 51
VCMI = 0x64 VCMI = 0x64