Commit graph

27 commits

Author SHA1 Message Date
Kurt
ac9bece46e Remove checksum check for Sprite building
Hot path 99.9999% will never be false
2022-09-02 10:29:32 -07:00
Kurt
d8fe34011d Remove some bounds checks, int->byte form oops
https://github.com/kwsch/PKHeX/pull/3575#issuecomment-1229244453
ty @Kermalis !
2022-08-27 12:53:30 -07:00
Kurt
3c232505e5
Refactoring: Narrow some value types (Species, Move, Form) (#3575)
In this pull request I've changed a ton of method signatures to reflect the more-narrow types of Species, Move# and Form; additionally, I've narrowed other large collections that stored lists of species / permitted values, and reworked them to be more performant with the latest API spaghetti that PKHeX provides. Roamer met locations, usually in a range of [max-min]<64, can be quickly checked using a bitflag operation on a UInt64. Other collections (like "Is this from Colosseum or XD") were eliminated -- shadow state is not transferred COLO<->XD, so having a Shadow ID or matching the met location from a gift/wild encounter is a sufficient check for "originated in XD".
2022-08-26 23:43:36 -07:00
Kurt
6441bdadd8
Add specialized struct for Moveset and IV specs (#3572)
`Moveset` struct stores 4 moves, and exposes methods to interact with a moveset.
`IndividualValueSet` stores a 6 IV template (signed).

Performance impact:
* Less allocating on the heap: Moves - (8 bytes member ptr, 20 bytes heap->8 bytes member)
* Less allocating on the heap: IVs - (8 bytes member ptr, 28 bytes heap->8 bytes member)
* No heap pointers, no need to jump to grab data.
* Easy to inline logic for checking if moves are present (no linq usage with temporary collections).

End result is faster ctor times, less memory used, faster program.
2022-08-21 17:34:32 -07:00
Kurt
538d651aef Misc tweaks
Add xmldoc, simplify some expressions
2022-08-05 11:23:28 -07:00
Kurt
9166d0eb64
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves

In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.

The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.

The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.

* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 16:15:27 -07:00
sora10pls
3248b1d5f6 Update sprites with latest changes
Tentacruel: fixed Shiny sprite d7a6f6ee11

LA sprites: matches latest from National Dex Project with minor fixes
2022-08-02 09:27:46 -04:00
Kurt
fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00
Kurt
15a84d9d7e Minor clean 2022-06-11 09:51:43 -07:00
Kurt
a28c1b628e Clamp stripe height to img height
No more out of range settings crashing the logic :)
2022-06-07 23:59:01 -07:00
Kurt
382ea5cd61 Extract move info api 2022-06-04 13:14:50 -07:00
Kurt
5bcccc6d92
HOME 2.0.0: Handle conversion behavior & restrictions (#3506)
* Revises legality checks to account for traveling between the three game islands (PLA/BDSP/SWSH)
* Adds conversion mechanisms between the three formats, as well as flexible conversion options to backfill missing data (thanks GameFreak/ILCA for opting for lossy conversion instead of updating the games).
* Adds API abstractions for HOME data storage format (EKH/PKH format 1, aka EH1/PH1).
* Revises some APIs for better usage:
  - `PKM` now exposes a `Context` to indicate the isolation context for legality purposes.
  - Some method signatures have changed to accept `Context` or `GameVersion` instead of a vague `int` for Generation.
  - Evolution History is now tracked in the Legality parse for specific contexts, rather than only per generation.
2022-05-30 21:43:52 -07:00
Kurt
ecee948107 Add gender sprites for main GUI
Might trickle this out to the other editors that have gender toggles.
2022-04-24 20:28:56 -07:00
sora10pls
7e8e05befb Update noble sprites
With actual detail now!
2022-04-02 10:45:18 -04:00
sora10pls
e02cc2ac93 Legends: Arceus custom sprite updates
Match latest icon dex project
2022-04-02 10:40:19 -04:00
Kurt
d98f8eee9e Show orange line for increased exact exp level
Use encounter (if available) for checking eggs since Met Level isn't accurate.
2022-03-07 21:39:48 -08:00
Kurt
50828fa1bb Change some field types, reduce memory usage 2022-02-28 22:46:59 -08:00
Matt
a98ac6979c
Add custom sprites for Legends: Arceus species/forms (#3441)
* Add custom sprites for Legends: Arceus species/forms

* Update READMEs with credit to new sprites source

Translations for de/es/fr pending.

* Add sprite for Legend Plate Arceus

Now no longer falls back to mugshot if forcing sprites.
2022-02-17 17:46:33 -08:00
Kurt
ea327a5c03
Add all circle Pokémon images; add setting for sprite preference (#3402)
* Add sprite builder toggling for forced-circle sprites

* Add assets for all LA Pokémon sprites

Co-authored-by: sora10pls <17801814+sora10pls@users.noreply.github.com>
2022-02-05 14:54:01 -08:00
Kurt
cb6e2020a4 Update default box display, alpha sprites
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2022-02-04 17:35:54 -08:00
Kurt
e577f18013 Add new sprite pictures
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2022-02-04 17:23:35 -08:00
sora10pls
644addac3d Remove stray pixels from both Hint/Warn assets
Closes #3329
2021-12-18 10:30:16 -05:00
Kurt
aa968f56aa File scoped namespace for drawing projects
Extract color util to separate class as it's not entirely image related.
2021-12-10 00:15:04 -08:00
Kurt
cacd6e9965 More records/sealing 2021-12-05 23:54:59 -08:00
Kurt
ba92024e54 Bump the net5 build to net6 2021-12-04 22:29:32 -08:00
Kurt
852aaa2cbf Fix unintentional recursion
Closes #3315
2021-11-28 08:16:24 -08:00
Kurt
bc809af06c Split PKHeX.Drawing into subprojects
Allows trimmed dll usage by keeping pkm sprites in one project, and all other cosmetic UI stuff in another project
2021-11-27 15:48:08 -08:00