Now that `pokemon.gender` matches what it says it does (genderless is
now 'N' and not ''), all the rendering code needs to be updated. I made
them all pixelated while I was at it.
`Battle#getPokemon` has always been a huge mess, due to being designed
to get Pokemon in a variety of situations with different levels of
incomplete information provided by a PO replay.
For context: we haven't supported PO replays in around 9 years.
So today, I finally tracked down all the current uses of `getPokemon`.
They are now four different functions:
1. `getSwitchedPokemon`
- Get or create a Pokemon when one switches in.
2. `rememberTeamPreviewPokemon`
- Create a Pokemon because it was revealed during Team Preview.
3. `getPokemon`
- Get a Pokemon that did something recently
4. `findCorrespondingPokemon`
- Find a Pokemon to track PP use for a switch-in option tooltip
They share basically zero code and should never have been the same
function in the first place.
Now that `getPokemon` is no longer a mess, `newPokemon` and the
`Pokemon` constructor can be rearranged and more strongly typed. One
fewer `Object.assign`!
The themes would not play because we were tracking what theme to set
to with BattleSound.bgmNum. When loading a new bgm, BattleSound.setBgm
will simply return if the existing bgm (BattleSound.bgm) is the same
as the one were trying to set the bgm to.
ensureMinEVs doesn't mutate template.id (template is immutable) so
there's no reason to continue checking it. While this is hardly a
huge efficiency boost the compactness of the previous code is hardly
worth preserving over it (though this whole block could be turned
into a method and then `return` could be used to retain the
compactness).
This adds the BOM to all HTTP pages as per the HTML5 spec and ensures
all pages use UTF-8 as their meta charset (which is still kept for
compatibility with older browsers).
Last time we built the desktop client, in 2015, NW.js was called
node-webkit.
Since then:
- NW.js has added NaCl and some other things, ballooning the installer
from 30 MB to 120 MB. (The NaCl stuff on Windows seems to be
deletable, helping keep its installed size slightly smaller.)
(If anyone wants to make a custom build without NaCl, that'd help me
a lot)
- NW.js also has a lot more files, and NSIS makes adding/removing files
annoying enough that I wrote a script to automate it for me.
- Apple has made Gatekeeper requirements a lot stricter, requiring
setting up entitlements, Hardened Runtime, notarization, and
stapling, (in addition to just signing in 2015). I documented the
process because there are zero online guides for it right now.
But on the other hand, this update hopefully fixes the crashes that
the old desktop client has. It also fixes:
- the Chrome bold emoji bug is gone
- MP3 is no longer under patent, allowing us to have only MP3 files for
everything
- honestly I don't think we use any other Chrome feature added in the
last four years