1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-21 17:17:06 +02:00

It is now possible to define multiple music themes for terrains

This commit is contained in:
Ivan Savenko 2024-07-15 21:46:41 +00:00
parent 9c5d5d7c5a
commit d59744f26f
5 changed files with 30 additions and 17 deletions

View File

@ -97,9 +97,13 @@
},
"music" :
{
"type" : "string",
"description" : "Music filename to play on this terrain on adventure map",
"format" : "musicFile"
"description" : "Music filenames to play on this terrain on adventure map",
"type" : "array",
"minItems" : 1,
"items" : {
"type" : "string",
"format" : "musicFile"
}
},
"sounds" :
{

View File

@ -5,7 +5,7 @@
"moveCost" : 100,
"minimapUnblocked" : [ 82, 56, 8 ],
"minimapBlocked" : [ 57, 40, 8 ],
"music" : "Dirt.mp3",
"music" : [ "Dirt.mp3" ],
"tiles" : "DIRTTL",
"type" : ["SURFACE"],
"shortIdentifier" : "dt",
@ -21,7 +21,7 @@
"moveCost" : 150,
"minimapUnblocked" : [ 222, 207, 140 ],
"minimapBlocked" : [ 165, 158, 107 ],
"music" : "Sand.mp3",
"music" : [ "Sand.mp3" ],
"tiles" : "SANDTL",
"type" : ["SURFACE"],
"shortIdentifier" : "sa",
@ -38,7 +38,7 @@
"moveCost" : 100,
"minimapUnblocked" : [ 0, 65, 0 ],
"minimapBlocked" : [ 0, 48, 0 ],
"music" : "Grass.mp3",
"music" : [ "Grass.mp3" ],
"tiles" : "GRASTL",
"type" : ["SURFACE"],
"shortIdentifier" : "gr",
@ -53,7 +53,7 @@
"moveCost" : 150,
"minimapUnblocked" : [ 181, 199, 198 ],
"minimapBlocked" : [ 140, 158, 156 ],
"music" : "Snow.mp3",
"music" : [ "Snow.mp3" ],
"tiles" : "SNOWTL",
"type" : ["SURFACE"],
"shortIdentifier" : "sn",
@ -68,7 +68,7 @@
"moveCost" : 175,
"minimapUnblocked" : [ 74, 134, 107 ],
"minimapBlocked" : [ 33, 89, 66 ],
"music" : "Swamp.mp3",
"music" : [ "Swamp.mp3" ],
"tiles" : "SWMPTL",
"type" : ["SURFACE"],
"shortIdentifier" : "sw",
@ -83,7 +83,7 @@
"moveCost" : 125,
"minimapUnblocked" : [ 132, 113, 49 ],
"minimapBlocked" : [ 99, 81, 33 ],
"music" : "Rough.mp3",
"music" : [ "Rough.mp3" ],
"tiles" : "ROUGTL",
"type" : ["SURFACE"],
"shortIdentifier" : "rg",
@ -98,7 +98,7 @@
"moveCost" : 100,
"minimapUnblocked" : [ 132, 48, 0 ],
"minimapBlocked" : [ 90, 8, 0 ],
"music" : "Underground.mp3",
"music" : [ "Underground.mp3" ],
"tiles" : "SUBBTL",
"type" : [ "SUB" ],
"shortIdentifier" : "sb",
@ -114,7 +114,7 @@
"moveCost" : 100,
"minimapUnblocked" : [ 74, 73, 74 ],
"minimapBlocked" : [ 41, 40, 41 ],
"music" : "Lava.mp3",
"music" : [ "Lava.mp3" ],
"tiles" : "LAVATL",
"type" : ["SUB", "SURFACE"],
"shortIdentifier" : "lv",
@ -133,7 +133,7 @@
"moveCost" : 100,
"minimapUnblocked" : [ 8, 81, 148 ],
"minimapBlocked" : [ 8, 81, 148 ],
"music" : "Water.mp3",
"music" : [ "Water.mp3" ],
"tiles" : "WATRTL",
"type" : [ "WATER" ],
"shortIdentifier" : "wt",
@ -156,7 +156,7 @@
"moveCost" : -1,
"minimapUnblocked" : [ 0, 0, 0 ],
"minimapBlocked" : [ 0, 0, 0 ],
"music" : "Underground.mp3", // Impossible in H3
"music" : [ "Underground.mp3" ], // Impossible in H3
"tiles" : "ROCKTL",
"type" : [ "ROCK" ],
"shortIdentifier" : "rc",

View File

@ -48,8 +48,8 @@
// Color of terrain on minimap with unpassable objects. RGB triplet, 0-255 range
"minimapBlocked" : [ 150, 100, 50 ],
// Music filename to play on this terrain on adventure map
"music" : "",
// List of music files to play on this terrain on adventure map. At least one file is required
"music" : [ "" ],
"sounds" : {
// List of ambient sounds for this terrain

View File

@ -28,7 +28,16 @@ std::shared_ptr<TerrainType> TerrainTypeHandler::loadFromJson( const std::string
info->identifier = identifier;
info->modScope = scope;
info->moveCost = static_cast<int>(json["moveCost"].Integer());
info->musicFilename = AudioPath::fromJson(json["music"]);
if (json["music"].isVector())
{
for (auto const & entry : json["music"].Vector())
info->musicFilename.push_back(AudioPath::fromJson(entry));
}
else
{
info->musicFilename.push_back(AudioPath::fromJson(json["music"]));
}
info->tilesFilename = AnimationPath::fromJson(json["tiles"]);
info->horseSound = AudioPath::fromJson(json["horseSound"]);
info->horseSoundPenalty = AudioPath::fromJson(json["horseSoundPenalty"]);

View File

@ -67,7 +67,7 @@ public:
ColorRGBA minimapBlocked;
ColorRGBA minimapUnblocked;
std::string shortIdentifier;
AudioPath musicFilename;
std::vector<AudioPath> musicFilename;
AnimationPath tilesFilename;
std::string terrainViewPatterns;
AudioPath horseSound;