diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index 8e66d273..df1d4d52 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -529,6 +529,7 @@ type: string: string boolean: boolean color: color + image: image nil: nothing # Symbol editor shapes diff --git a/data/magic-default-image.mse-include/artifact.jpg b/data/magic-default-image.mse-include/artifact.jpg new file mode 100644 index 00000000..d18879e0 Binary files /dev/null and b/data/magic-default-image.mse-include/artifact.jpg differ diff --git a/data/magic-default-image.mse-include/black.jpg b/data/magic-default-image.mse-include/black.jpg new file mode 100644 index 00000000..acc5a02e Binary files /dev/null and b/data/magic-default-image.mse-include/black.jpg differ diff --git a/data/magic-default-image.mse-include/blue.jpg b/data/magic-default-image.mse-include/blue.jpg new file mode 100644 index 00000000..0d649e3a Binary files /dev/null and b/data/magic-default-image.mse-include/blue.jpg differ diff --git a/data/magic-default-image.mse-include/colorless.jpg b/data/magic-default-image.mse-include/colorless.jpg new file mode 100644 index 00000000..34d91d64 Binary files /dev/null and b/data/magic-default-image.mse-include/colorless.jpg differ diff --git a/data/magic-default-image.mse-include/green.jpg b/data/magic-default-image.mse-include/green.jpg new file mode 100644 index 00000000..a57ce1c4 Binary files /dev/null and b/data/magic-default-image.mse-include/green.jpg differ diff --git a/data/magic-default-image.mse-include/include b/data/magic-default-image.mse-include/include new file mode 100644 index 00000000..ec7d4057 --- /dev/null +++ b/data/magic-default-image.mse-include/include @@ -0,0 +1,3 @@ +mse version: 0.3.2 +full name: Magic The Gathering, placeholder images +version: 2007.05.09 diff --git a/data/magic-default-image.mse-include/multicolor.jpg b/data/magic-default-image.mse-include/multicolor.jpg new file mode 100644 index 00000000..ce45648f Binary files /dev/null and b/data/magic-default-image.mse-include/multicolor.jpg differ diff --git a/data/magic-default-image.mse-include/red.jpg b/data/magic-default-image.mse-include/red.jpg new file mode 100644 index 00000000..0e016215 Binary files /dev/null and b/data/magic-default-image.mse-include/red.jpg differ diff --git a/data/magic-default-image.mse-include/scripts b/data/magic-default-image.mse-include/scripts new file mode 100644 index 00000000..028c886b --- /dev/null +++ b/data/magic-default-image.mse-include/scripts @@ -0,0 +1,18 @@ + +# default image if there is none +default_image := { + "/magic-default-image.mse-include/" + + if input == "white" then "white.jpg" + else if input == "blue" then "blue.jpg" + else if input == "red" then "red.jpg" + else if input == "black" then "black.jpg" + else if input == "green" then "green.jpg" + else if input == "land 1 color white" then "white.jpg" + else if input == "land 1 color blue" then "blue.jpg" + else if input == "land 1 color red" then "red.jpg" + else if input == "land 1 color black" then "black.jpg" + else if input == "land 1 color green" then "green.jpg" + else if is_artifact() then "artifact.jpg" + else if is_colorless() then "colorless.jpg" + else "multicolor.jpg" +} \ No newline at end of file diff --git a/data/magic-default-image.mse-include/white.jpg b/data/magic-default-image.mse-include/white.jpg new file mode 100644 index 00000000..1254cc22 Binary files /dev/null and b/data/magic-default-image.mse-include/white.jpg differ diff --git a/data/magic-extended-art.mse-style/style b/data/magic-extended-art.mse-style/style index 2ac08f3f..d5a7bf44 100644 --- a/data/magic-extended-art.mse-style/style +++ b/data/magic-extended-art.mse-style/style @@ -3,6 +3,7 @@ game: magic full name: Extended Art short name: Extended Art icon: card-sample.png +position hint: 007 card width: 375 card height: 523 @@ -14,6 +15,7 @@ card dpi: 150 init script: # Load blend scripts for hybrids/multicolors include file: magic-blends.mse-include/blend-scripts + include file: magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -154,6 +156,7 @@ card style: width: 311 height: 376 z index: 1 + default: {default_image(card.card_color)} ############################# Card type diff --git a/data/magic-firepenguinmaster-flip.mse-style/style b/data/magic-firepenguinmaster-flip.mse-style/style index 3944df4d..fda1a5ba 100644 --- a/data/magic-firepenguinmaster-flip.mse-style/style +++ b/data/magic-firepenguinmaster-flip.mse-style/style @@ -3,6 +3,7 @@ game: magic full name: FPM's Flip Magic short name: FPM Flip icon: card-sample.png +position hint: 402 card width: 375 card height: 523 diff --git a/data/magic-firepenguinmaster.mse-style/style b/data/magic-firepenguinmaster.mse-style/style index 712e9040..197c87bf 100644 --- a/data/magic-firepenguinmaster.mse-style/style +++ b/data/magic-firepenguinmaster.mse-style/style @@ -3,6 +3,7 @@ game: magic full name: FPM's Normal Magic short name: FPM Normal icon: card-sample.png +position hint: 401 card width: 375 card height: 523 diff --git a/data/magic-firepenguinmasterpromo.mse-style/style b/data/magic-firepenguinmasterpromo.mse-style/style index f9b32cee..8350b02a 100644 --- a/data/magic-firepenguinmasterpromo.mse-style/style +++ b/data/magic-firepenguinmasterpromo.mse-style/style @@ -3,6 +3,7 @@ game: magic full name: FPM's Promo Magic short name: FPM Promo icon: card-sample.png +position hint: 404 card width: 375 card height: 523 diff --git a/data/magic-firepenguinmastersplit.mse-style/style b/data/magic-firepenguinmastersplit.mse-style/style index 9c285089..bc77d176 100644 --- a/data/magic-firepenguinmastersplit.mse-style/style +++ b/data/magic-firepenguinmastersplit.mse-style/style @@ -3,6 +3,7 @@ game: magic full name: FPM's Split Magic short name: FPM Split icon: card-sample.png +position hint: 403 card width: 523 card height: 375 diff --git a/data/magic-firepenguinmastertokens.mse-style/style b/data/magic-firepenguinmastertokens.mse-style/style index f251336c..b8bcedbd 100644 --- a/data/magic-firepenguinmastertokens.mse-style/style +++ b/data/magic-firepenguinmastertokens.mse-style/style @@ -3,6 +3,7 @@ game: magic full name: FPM's Token Magic short name: FPM Token icon: card-sample.png +position hint: 421 card width: 375 card height: 523 diff --git a/data/magic-new-flip.mse-style/style b/data/magic-new-flip.mse-style/style index b61da316..997eabfa 100644 --- a/data/magic-new-flip.mse-style/style +++ b/data/magic-new-flip.mse-style/style @@ -3,6 +3,7 @@ game: magic short name: Flip Cards full name: Modern flip cards icon: card-sample.png +position hint: 002 card width: 375 card height: 523 @@ -17,6 +18,7 @@ card dpi: 150 init script: # Load blend scripts for hybrids/multicolors include file: magic-blends.mse-include/blend-scripts + include file: magic-default-image.mse-include/scripts # Should hybrids have a grey name? # Not supported (yet) @@ -185,6 +187,7 @@ card style: width: 311 height: 182 z index: 10 + default: {default_image(card.card_color)} ############################# Card type diff --git a/data/magic-new-promo.mse-style/style b/data/magic-new-promo.mse-style/style index e362c472..fd93e6ba 100644 --- a/data/magic-new-promo.mse-style/style +++ b/data/magic-new-promo.mse-style/style @@ -3,6 +3,7 @@ game: magic short name: Promotional full name: Large image icon: card-sample.png +position hint: 004 card width: 375 card height: 523 @@ -13,6 +14,7 @@ card dpi: 150 init script: # Load blend scripts for hybrids/multicolors include file: magic-blends.mse-include/blend-scripts + include file: magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -162,6 +164,7 @@ card style: width: 311 height: 408 z index: 1 + default: {default_image(card.card_color)} ############################# Card type diff --git a/data/magic-new-split.mse-style/style b/data/magic-new-split.mse-style/style index 2557ff60..f199b9cf 100644 --- a/data/magic-new-split.mse-style/style +++ b/data/magic-new-split.mse-style/style @@ -3,6 +3,7 @@ game: magic short name: Split Cards full name: Modern split cards icon: card-sample.png +position hint: 003 card width: 523 card height: 375 @@ -16,6 +17,7 @@ card dpi: 150 init script: # Load blend scripts for hybrids/multicolors include file: magic-blends.mse-include/blend-scripts + include file: magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -185,6 +187,7 @@ card style: width: 216 height: 159 z index: 1 + default: {default_image(card.card_color)} image 2: left: 279 @@ -192,6 +195,7 @@ card style: width: 216 height: 159 z index: 1 + default: {default_image(card.card_color_2)} ############################# Card type diff --git a/data/magic-new.mse-style/style b/data/magic-new.mse-style/style index 460a0527..c89ac4cf 100644 --- a/data/magic-new.mse-style/style +++ b/data/magic-new.mse-style/style @@ -3,6 +3,7 @@ game: magic short name: Modern style full name: After 8th edition icon: card-sample.png +position hint: 001 version: 2007-05-05 depends on: @@ -21,6 +22,7 @@ card dpi: 150 init script: # Load blend scripts for hybrids/multicolors include file: magic-blends.mse-include/blend-scripts + include file: magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -53,6 +55,7 @@ init script: else rgb(0,0,0) } + ############################################################## Extra style options styling field: @@ -125,6 +128,7 @@ card style: right width: 17 top width: 17 bottom width: 18 + #mask: border-mask.png z index: -1 card color: left: 0 @@ -179,6 +183,7 @@ card style: width: 311 height: 228 z index: 1 + default: {default_image(card.card_color)} ############################# Card type diff --git a/data/magic-old-token.mse-style/style b/data/magic-old-token.mse-style/style index 90fc9aef..5e561716 100644 --- a/data/magic-old-token.mse-style/style +++ b/data/magic-old-token.mse-style/style @@ -9,6 +9,7 @@ game: magic short name: Tokens full name: Old style icon: card-sample.png +position hint: 121 card width: 312 card height: 444 diff --git a/data/magic-old.mse-style/style b/data/magic-old.mse-style/style index 04200697..e0663890 100644 --- a/data/magic-old.mse-style/style +++ b/data/magic-old.mse-style/style @@ -9,6 +9,7 @@ game: magic short name: Old style full name: Before 8th edition icon: card-sample.png +position hint: 101 card width: 312 card height: 444 diff --git a/data/magic-planeshifted.mse-style/style b/data/magic-planeshifted.mse-style/style index 1cbd7616..4129319f 100644 --- a/data/magic-planeshifted.mse-style/style +++ b/data/magic-planeshifted.mse-style/style @@ -3,6 +3,7 @@ game: magic short name: Planeshifted full name: Planar Chaos Timeshifts icon: card-sample.png +position hint: 011 card width: 375 card height: 523 diff --git a/data/magic-textless.mse-style/style b/data/magic-textless.mse-style/style index a7cbe49a..d85fb053 100644 --- a/data/magic-textless.mse-style/style +++ b/data/magic-textless.mse-style/style @@ -3,6 +3,7 @@ game: magic short name: Textless full name: Modern style icon: card-sample.png +position hint: 006 card width: 375 card height: 523 diff --git a/data/magic-watermarks.mse-include/watermark-names b/data/magic-watermarks.mse-include/watermark-names new file mode 100644 index 00000000..d1bab6ca --- /dev/null +++ b/data/magic-watermarks.mse-include/watermark-names @@ -0,0 +1,36 @@ +# The watermark choices +# Included by a game file + +choice: none +choice: + name: mana symbol + choice: white + choice: blue + choice: black + choice: red + choice: green + choice: snow +choice: + name: guild symbol + choice: Azorius Senate (W/U) + choice: House Dimir (U/B) + choice: Cult of Rakdos (B/R) + choice: Gruul Clans (R/G) + choice: Selesnya Conclave (G/W) + choice: Orzhov Syndicate (W/B) + choice: The Izzet (U/R) + choice: The Golgari (B/G) + choice: Boros Legion (R/W) + choice: The Simic (G/U) +choice: + name: xander hybrid mana + choice: B/R + choice: U/B + choice: B/G + choice: R/G + choice: G/U + choice: U/R + choice: W/B + choice: G/W + choice: R/W + choice: W/U diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index 1fb112df..c4a19bb4 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -3,6 +3,7 @@ short name: Magic full name: Magic the Gathering icon: card-back.png version: 2007-05-05 +position hint: 1 ############################################################## Functions & filters @@ -618,39 +619,7 @@ card field: type: choice name: watermark icon: stats/watermark.png - choice: none - choice: - name: mana symbol - choice: white - choice: blue - choice: black - choice: red - choice: green - choice: snow - choice: - name: guild symbol - choice: Azorius Senate (W/U) - choice: House Dimir (U/B) - choice: Cult of Rakdos (B/R) - choice: Gruul Clans (R/G) - choice: Selesnya Conclave (G/W) - choice: Orzhov Syndicate (W/B) - choice: The Izzet (U/R) - choice: The Golgari (B/G) - choice: Boros Legion (R/W) - choice: The Simic (G/U) - choice: - name: xander hybrid mana - choice: B/R - choice: U/B - choice: B/G - choice: R/G - choice: G/U - choice: U/R - choice: W/B - choice: G/W - choice: R/W - choice: W/U + include file: magic-watermarks.mse-include/watermark-names description: A watermark for below the textbox, this can be a big mana symbol used on basic lands, or a guild symbol ############################# PT @@ -669,6 +638,7 @@ card field: name: ptsymbols choice: shieldsword editable: false + save value: false show statistics: false card field: type: text @@ -848,39 +818,7 @@ card field: card field: type: choice name: watermark 2 - choice: none - choice: - name: mana symbol - choice: white - choice: blue - choice: black - choice: red - choice: green - choice: snow - choice: - name: xander hybrid mana - choice: B/R - choice: U/B - choice: B/G - choice: R/G - choice: G/U - choice: U/R - choice: W/B - choice: G/W - choice: R/W - choice: W/U - choice: - name: guild symbol - choice: Azorius Senate (W/U) - choice: House Dimir (U/B) - choice: Cult of Rakdos (B/R) - choice: Gruul Clans (R/G) - choice: Selesnya Conclave (G/W) - choice: Orzhov Syndicate (W/B) - choice: The Izzet (U/R) - choice: The Golgari (B/G) - choice: Boros Legion (R/W) - choice: The Simic (G/U) + include file: magic-watermarks.mse-include/watermark-names description: A watermark for below the textbox, this can be a big mana symbol used on basic lands, a special symbol, or a guild symbol card field: type: text @@ -899,6 +837,7 @@ card field: name: ptsymbols 2 choice: shieldsword editable: false + save value: false show statistics: false card field: type: text @@ -1053,25 +992,36 @@ statistics dimension: +############################################################## Add multiple cards + +#set template: +# name: Base set (??? cards) +#set template: +# name: Expansion set (134 cards) +#set template: +# name: 5 color cycle +# field: rarity +#set template: +# name: 3 rarities cycle + ############################################################## Card packs -#pack: -# name: Base set -# pack type: -#pack: -# name: -#pack: -# name: Booster -# pack type: random -# card type: -# amount: 1 -# filter: rarity = "rare" -# card type: -# amount: 3 -# filter: rarity = "uncommon" -# card type: -# amount: 11 -# filter: rarity = "common" +pack type: + name: Starter pack +pack type: + name: Booster pack + card type: + name: Rare + amount: 1 + filter: card.rarity = "rare" + card type: + name: Uncommon + amount: 3 + filter: card.rarity = "uncommon" + card type: + name: Common + amount: 11 + filter: card.rarity = "common" diff --git a/data/vanguard.mse-game/game b/data/vanguard.mse-game/game index 883afdba..17174c49 100644 --- a/data/vanguard.mse-game/game +++ b/data/vanguard.mse-game/game @@ -2,6 +2,7 @@ short name: Vanguard full name: Magic Vanguard icon: card-sample.png +position hint: 2 # Author : Wolfwood # Most stuff is copy/pasted from magic.mse-game diff --git a/data/vs-extended-art.mse-style/style b/data/vs-extended-art.mse-style/style index a8daeb0e..af346327 100644 --- a/data/vs-extended-art.mse-style/style +++ b/data/vs-extended-art.mse-style/style @@ -3,6 +3,7 @@ game: vs short name: Promotional full name: Extended Art Promo icon: card-sample.png +position hint: 2 card width: 375 card height: 523 diff --git a/data/vs-standard.mse-style/style b/data/vs-standard.mse-style/style index d95f5b14..5420413d 100644 --- a/data/vs-standard.mse-style/style +++ b/data/vs-standard.mse-style/style @@ -3,6 +3,7 @@ game: vs short name: Standard full name: Normal VS cards icon: card-sample.png +position hint: 1 card width: 375 card height: 523 diff --git a/data/vs.mse-game/game b/data/vs.mse-game/game index 1b01fc1e..a28525b8 100644 --- a/data/vs.mse-game/game +++ b/data/vs.mse-game/game @@ -1,6 +1,7 @@ mse version: 0.3.1 short name: VS System icon: card-back.png +position hint: 3 ############################################################## Functions & filters ## Copied and Pasted from magic-new.mse-style/style, with a few modifications diff --git a/data/yugioh.mse-game/game b/data/yugioh.mse-game/game index 257bf3c2..a70901c4 100644 --- a/data/yugioh.mse-game/game +++ b/data/yugioh.mse-game/game @@ -1,6 +1,7 @@ mse version: 0.3.1 short name: Yu-Gi-Oh! icon: card-back.png +position hint: 4 ############################################################## Functions & filters ## Copied and Pasted from vs.mse-game, with a few modifications diff --git a/src/data/action/value.cpp b/src/data/action/value.cpp index b66d199e..62769352 100644 --- a/src/data/action/value.cpp +++ b/src/data/action/value.cpp @@ -24,17 +24,24 @@ String ValueAction::getName(bool to_undo) const { // ----------------------------------------------------------------------------- : Simple +/// Swap the value in a Value object with a new one +inline void swap_value(ChoiceValue& a, ChoiceValue ::ValueType& b) { swap(a.value, b); } +inline void swap_value(MultipleChoiceValue& a, MultipleChoiceValue::ValueType& b) { swap(a.value, b); } +inline void swap_value(ColorValue& a, ColorValue ::ValueType& b) { swap(a.value, b); } +inline void swap_value(ImageValue& a, ImageValue ::ValueType& b) { swap(a.filename, b); a.last_update.update(); } +inline void swap_value(SymbolValue& a, SymbolValue ::ValueType& b) { swap(a.filename, b); a.last_update.update(); } +inline void swap_value(TextValue& a, TextValue ::ValueType& b) { swap(a.value, b); a.last_update.update(); } + /// A ValueAction that swaps between old and new values template class SimpleValueAction : public ValueAction { public: - inline SimpleValueAction(const shared_ptr& value, const typename T::ValueType& new_value, typename T::ValueType T::*member) + inline SimpleValueAction(const shared_ptr& value, const typename T::ValueType& new_value) : ValueAction(value), new_value(new_value) - , member(member) {} virtual void perform(bool to_undo) { - swap(static_cast(*valueP).*member, new_value); + swap_value(static_cast(*valueP), new_value); valueP->onAction(*this, to_undo); // notify value } @@ -52,14 +59,13 @@ class SimpleValueAction : public ValueAction { private: typename T::ValueType new_value; - typename T::ValueType T::*member; }; -ValueAction* value_action(const ChoiceValueP& value, const Defaultable& new_value) { return new SimpleValueAction (value, new_value, &ChoiceValue::value); } -ValueAction* value_action(const MultipleChoiceValueP& value, const Defaultable& new_value) { return new SimpleValueAction(value, new_value, &MultipleChoiceValue::value); } -ValueAction* value_action(const ColorValueP& value, const Defaultable& new_value) { return new SimpleValueAction (value, new_value, &ColorValue::value); } -ValueAction* value_action(const ImageValueP& value, const FileName& new_value) { return new SimpleValueAction(value, new_value, &ImageValue::filename); } -ValueAction* value_action(const SymbolValueP& value, const FileName& new_value) { return new SimpleValueAction(value, new_value, &SymbolValue::filename); } +ValueAction* value_action(const ChoiceValueP& value, const Defaultable& new_value) { return new SimpleValueAction (value, new_value); } +ValueAction* value_action(const MultipleChoiceValueP& value, const Defaultable& new_value) { return new SimpleValueAction(value, new_value); } +ValueAction* value_action(const ColorValueP& value, const Defaultable& new_value) { return new SimpleValueAction (value, new_value); } +ValueAction* value_action(const ImageValueP& value, const FileName& new_value) { return new SimpleValueAction(value, new_value); } +ValueAction* value_action(const SymbolValueP& value, const FileName& new_value) { return new SimpleValueAction(value, new_value); } // ----------------------------------------------------------------------------- : Text @@ -74,8 +80,7 @@ TextValueAction::TextValueAction(const TextValueP& value, size_t start, size_t e String TextValueAction::getName(bool to_undo) const { return name; } void TextValueAction::perform(bool to_undo) { - swap(value().value, new_value); - value().last_update.update(); + swap_value(value(), new_value); swap(selection_end, new_selection_end); valueP->onAction(*this, to_undo); // notify value } diff --git a/src/data/field/image.cpp b/src/data/field/image.cpp index 3d37e8b8..d7bfc0e8 100644 --- a/src/data/field/image.cpp +++ b/src/data/field/image.cpp @@ -26,11 +26,13 @@ IMPLEMENT_REFLECTION(ImageField) { IMPLEMENT_REFLECTION(ImageStyle) { REFLECT_BASE(Style); REFLECT_N("mask", mask_filename); + REFLECT_N("default", default_image); } bool ImageStyle::update(Context& ctx) { return Style ::update(ctx) - | mask_filename.update(ctx); + | mask_filename.update(ctx) + | default_image.update(ctx); } // ----------------------------------------------------------------------------- : ImageValue diff --git a/src/data/field/image.hpp b/src/data/field/image.hpp index 2ffede3a..83aa477f 100644 --- a/src/data/field/image.hpp +++ b/src/data/field/image.hpp @@ -12,6 +12,7 @@ #include #include #include