collinsmith / riiablo

Diablo II remade using Java and LibGDX
http://riiablo.com
Apache License 2.0
884 stars 101 forks source link

Crash on select character screen if there is a character with no shield #39

Closed collinsmith closed 5 years ago

collinsmith commented 5 years ago

Crash on character select screen if there is a player without a shield. This selection screen needs to be rewritten to support different player modes too depending on primary weapon. This will require finding the player's weapon class. Currently, it assumes TN 1HS and defaults shield to LIT, but LIT shield doesn't exist and should revert to null for no shield and remove the layer.

collinsmith commented 5 years ago

I copied and reworked some of the code from Player to set the correct weapon class for the player and correct components.

I'd like to standardize this to remove the repeated code where possible in the future, however they are functionally different in that Player works using the player's items, where CharacterPreview works using some data built into the D2S. Not a big concern right now, but any changes will need to be propagated to the other.

No support for ethereal items in this fix -- there is no support for ethereal items in the original game either here, so maybe this can be an enhancement later on.

collinsmith commented 5 years ago

I feel like I should also add that the weapon class doesn't seem to be saved as part of the D2S. I think this is calculated at run time using the RH, LH and SH components exactly like how it's done in the above fix.