Skip to content

Commit

Permalink
Added widget fallback icons and party egg icons
Browse files Browse the repository at this point in the history
There is now fallback support for Pokémon icons and item icons.
Additionally, eggs are now represented properly in the party widget.
  • Loading branch information
varkor committed Feb 27, 2016
1 parent 7b1e41a commit 868f4e3
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 8 deletions.
Binary file added battle/images/static/items/fallback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added battle/images/static/pokemon/egg~back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added battle/images/static/pokemon/egg~front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added battle/images/static/pokemon/egg~icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added battle/images/static/pokemon/fallback~icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions battle/scripts/objects/general/pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,14 @@ function pokemon (data, validate) {
contracted = contracted.replace("{animation}", Sprite.shouldAnimate(contracted) ? "animated" : "static");
return contracted;
},
special : function (special) {
return Settings._("paths => Pokemon => special").replace("{special}", special);
},
sprite : function (which, includeFiletype) {
return self.paths.convert(Settings._("paths => Pokemon => image"), includeFiletype, which);
return self.paths.convert(self.egg === null ? Settings._("paths => Pokemon => image") : self.paths.special("egg"), includeFiletype, which);
},
icon : function (includeFiletype) {
return self.paths.convert(Settings._("paths => Pokemon => image"), includeFiletype, "icon");
return [self.egg === null ? Settings._("paths => Pokemon => image") : self.paths.special("egg"), self.paths.special("fallback")].map(path => self.paths.convert(path, includeFiletype, "icon"));
},
cry : function (includeFiletype) {
return self.paths.convert(Settings._("paths => Pokemon => sound"), includeFiletype);
Expand Down
6 changes: 4 additions & 2 deletions battle/scripts/objects/unique/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Settings.addData({
"sounds" : "sounds",
"Pokemon" : {
"image" : "pokemon/{region}/{species}{whichform(e)}{which}{filetype=png}",
"sound" : "pokemon/{region}/{species}{whichmega}{filetype=mp3}"
"sound" : "pokemon/{region}/{species}{whichmega}{filetype=mp3}",
"special" : "pokemon/{special}{which}{filetype=png}"
},
"characters" : {
"image" : "characters/{game}/{who}{filetype=png}"
Expand All @@ -34,7 +35,8 @@ Settings.addData({
"image" : "scenes/{name}{filetype=png}"
},
"items" : {
"image" : "items/{name}{filetype=png}"
"image" : "items/{name}{filetype=png}",
"special" : "items/{special}{filetype=png}"
}
}
}, true);
Expand Down
8 changes: 5 additions & 3 deletions battle/scripts/objects/unique/Widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ Widgets.FlowGrid = {
context.setFontHD("Arial", 10);
context.fillTextHD(poke.name(), position.x + size.width / 2, position.y + size.height - 4);
// Level
context.textBaseline = "top";
context.setFontHD("Arial", 8);
context.fillTextHD("Lv. " + poke.level, position.x + size.width / 2, position.y + 4);
if (poke.egg === null) {
context.textBaseline = "top";
context.setFontHD("Arial", 8);
context.fillTextHD("Lv. " + poke.level, position.x + size.width / 2, position.y + 4);
}
// Health
var radius, startAngle = 3 / 4 * Math.PI, endAngle;
var percentageHealth = poke.health / poke.maximumHealth();
Expand Down
2 changes: 1 addition & 1 deletion battle/scripts/processing/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ forevery(Items, function (category) {
return contracted;
},
icon (includeFiletype) {
return item.paths.convert(Settings._("paths => items => image"), includeFiletype, "icon");
return [Settings._("paths => items => image"), Settings._("paths => items => special").replace("{special}", "fallback")].map(path => item.paths.convert(path), includeFiletype);
}
};
item.fullname = name + (["Berry", "Ball"].contains(item.category) ? " " + item.category : "");
Expand Down

0 comments on commit 868f4e3

Please sign in to comment.