Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous labels #153

Merged
merged 9 commits into from
Oct 3, 2024
Merged

Miscellaneous labels #153

merged 9 commits into from
Oct 3, 2024

Conversation

Sha0den
Copy link
Contributor

@Sha0den Sha0den commented Sep 8, 2024

I tried to include most (if not all) of the label changes from my poketcg_v2 repository. I also identified some duel constants.

Copy link
Collaborator

@ElectroDeoxys ElectroDeoxys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great stuff! Only one thing I've nitpicked

@@ -1692,7 +1692,7 @@ SendAttackDataToLinkOpponent::
ldh [hTemp_ffa0], a
ret

Func_189d::
LastChanceToNegateFinalDamage::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name doesn't sit right with me, at its core this routine only relates to Transparency, and whether to apply it. My suggestion would be ApplyTransparencyIsApplicable or something along those lines. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for me. I believe I took that label name from Oatspear's hack, and while it makes a lot of sense from a romhacking perspective, I can definitely see that yours is a more accurate description of the current function. While I'm at it, I think I'll also change DeckShuffleAnimation to PlayDeckShuffleAnimation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant ApplyTransparencyIfApplicable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's mostly on me. I thought it sounded weird, but I still copied and pasted what you typed without asking for a clarification. Anyway, it's fixed now.

Copy link
Collaborator

@ElectroDeoxys ElectroDeoxys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how I feel about generalising the names on some routines, for example in this game only Headache can stop Trainer cards from being used. But then there's an argument to be made for consistency with the sequel.

; returns carry if Pokemon in turn holder's Play Area location in register a
; cannot use its Pkmn Power
; input:
; a = play area location offset of the Pokémon to check (PLAY_AREA_* constant)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description is not correct, if register a is non-zero, then status is ignored and only Toxic Gas is considered. It does not have anything to do with Play Area locations. But the current label is also incomplete since it checks for both status and Toxic Gas. Maybe CheckIsIncapableOfUsingPkmnPower? And the routine above may be CheckIsIncapableOfUsingPkmnPower_IgnoreStatus?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm forced to disagree. In almost every instance, a play area location offset gets loaded into the a register before this function is called, even if the specifics of this function only care about whether or not the location is the Arena (because an Active Pokémon's Pokémon Power cannot be used if it is Asleep, Confused, or Paralyzed). I think the labels from poketcg2 are about as accurate as you can get. Plus, your CheckIsIncapableOfUsingPkmnPower_IgnoreStatus label would imply the opposite of what that first function does, which is to set a to 0 (PLAY_AREA_ARENA) so that the Active Pokémon's status gets checked. The only instance of the game intentionally ignoring the status check is when a Pokémon with a Pokémon Power is put onto the Bench; in that singular instance, $01 (PLAY_AREA_BENCH1) is loaded into a before this function is called.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah well spotted, now that I look at it it does make sense

@Sha0den
Copy link
Contributor Author

Sha0den commented Sep 17, 2024

I don't know how I feel about generalising the names on some routines, for example in this game only Headache can stop Trainer cards from being used. But then there's an argument to be made for consistency with the sequel.

For the most part, I agree with what you said about over generalizing label names, but in this particular instance, I feel that the pros outweigh the cons. Using an effect to stop Trainer cards from being played or an Active Pokémon from being able to retreat is fairly common within the Pokémon TCG at large, but the original attacks (Headache and Acid) that are used in this game are somewhat obscure, so a more general label will do a better job of letting the reader know the function's purpose. And as you pointed out, having consistent label names between the 2 disassembly projects would be ideal.

@@ -5,7 +5,7 @@ _PauseMenu_Config:
push af
xor a
ld [wConfigExitSettingsCursorPos], a
ld a, 1
ld a, $01 ; text isn't double-spaced
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than changing this instance to $01, I would rather change most other instances to 1. Or use a constant. It would be tempting to use TRUE but that would feel inverted from the real meaning based on the current name of wLineSeparation. If it were named like eg wSingleSpaced then TRUE would feel more natural. Or we could leave the name alone and make a special SINGLE_SPACED constant instead of using TRUE. Just rambling..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only added those "double-spaced" comments to try to make the updates to that variable easier to understand. I also agree that either of your suggestions would probably be a better idea than my comments. Just tell me what you would prefer, and I'll update the pull request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote would probably be for adding:

DEF DOUBLE_SPACED EQU 0
DEF SINGLE_SPACED EQU 1

and then doing a bunch of:

- 	xor a ; text is double-spaced
+ 	xor a ; DOUBLE_SPACED

and

- 	ld a, $01 ; text isn't double-spaced
+ 	ld a, SINGLE_SPACED

src/home/substatus.asm Outdated Show resolved Hide resolved
@@ -98,14 +98,14 @@ TossCoinATimes_BankB:
CommentedOut_2c086:
ret

Func_2c087:
Serial_TossZeroCoins:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

@@ -3643,7 +3644,7 @@ PickPokedexCards_Unreferenced:
; stores the resulting order in wce1a.
PickPokedexCards:
xor a
ld [wAIPokedexCounter], a ; reset counter ; reset counter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

; input:
; hl = address from which to start copying the data
; de = where to copy the data
CopyListWithFFTerminatorFromHLToDE_Bank5:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is kind of a mouthful compared to the previous name. IMO we could exclude "WithFFTerminator" from the name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one's tricky. I only added the "WithFFTerminator" because there's already a CopyListFromHLToDE in src/engine/menus/deck_configuration.asm (Bank $02), and that function requires a null-terminated list. If you have any suggestions now that you know the problem, I'm all ears.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, good point. It's okay as-is.

If we really wanted to give them better names, I would maybe suggest renaming CopyListFromHLToDE to CopyStringFromHLToDEsince strings are typically null-terminated, then renaming CopyListWithFFTerminatorFromHLToDE to CopyListFromHLToDE since lists are typically ff-terminated. But I'm not totally convinced it's worth it.

src/engine/duel/ai/common.asm Outdated Show resolved Hide resolved
Copy link
Member

@dannye dannye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for taking the time to do this. I'll give @ElectroDeoxys a chance to take one more look.

@dannye dannye merged commit e4cf3fc into pret:master Oct 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants