Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2015-02-20 06:04:40

ShantyTown
Member
Registered: 2013-12-04
Post 204/344

Mirror Move Problem with New Moves

If you've added new moves past STRUGGLE ($A5), then Mirror Move won't work properly when copying those new moves.  The problem is that W_PLAYERMOVENUM is set to the move's animation id, which is the first byte in the Moves table.  If you borrow animation id's from existing moves, then Mirror Move will copy that existing move instead of your new move.  If you define your own custom animation, then your custom animation has an id value of > $cb because there are non-attack animations at the end of AttackAnimationPointers (which has $cb entries in it).

In short, Mirror Move depends on a move's animation id being equal to the move's id.  If you've added new moves, then you almost certainly did it in a way that violates that assumption.

I'm having a difficult time coming up with a good solution to this...  The best idea I have is to make a lookup table for animation id's greater than $cb to map back to their original move id.

Anyway, I thought I would post this for visibility in case other people run into this.  I'll post my solution once I get it working, too.

Last edited by ShantyTown (2015-02-20 06:08:11)

Offline

#2 2015-02-20 06:20:24

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,981/3,578

Re: Mirror Move Problem with New Moves

Couldn't you just have it check wPlayerSelectedMove instead?

Offline

#3 2015-02-20 06:21:58

comet
Member
Registered: 2012-04-09
Post 531/679

Re: Mirror Move Problem with New Moves

^

Also, non-attack animation constants should all be accounted for, so you should be able to just wedge your new moves in right after Struggle. This still leaves you with under 240 moves, but it sounds like this was already the case.

Last edited by comet (2015-02-20 06:22:42)

Offline

#4 2015-02-20 06:22:08

ShantyTown
Member
Registered: 2013-12-04
Post 205/344

Re: Mirror Move Problem with New Moves

Ah, I just realized the best solution.  Just insert the new move animation pointers before the non-move animations in the AttackAnimationPointers table.  Then, adjust the values of the non-move ids in move_constants.asm to reflect the change in that table.

Offline

#5 2015-02-20 06:23:41

ShantyTown
Member
Registered: 2013-12-04
Post 206/344

Re: Mirror Move Problem with New Moves

Mateo wrote:

Couldn't you just have it check wPlayerSelectedMove instead?

That register contains the move's animation id, which happens to be equal to the move id for all of the normal moves. Yep. :P  I didn't realize that existed.

comet wrote:

Non-attack animation constants should all be accounted for, so you should be able to just wedge your new moves in right after Struggle. This still leaves you with under 240 moves, but it sounds like this was already the case.

Yep!  I agree.  That's the solution.  The important part is wedging them into AttackAnimationPointers.

Last edited by ShantyTown (2015-02-20 06:25:32)

Offline

#6 2015-02-20 06:31:33

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,982/3,578

Re: Mirror Move Problem with New Moves

No, it doesn't contain the animation ID. I just double-checked it. The RAM address wPlayerSelectedMove has the value for Metal Claw, NOT the value for Slash (whose animation ID it stole).

oZB69.jpg

EDIT: Ah, didn't see your edit just now. Oh well haha.

Last edited by Mateo (2015-02-20 06:32:23)

Offline

#7 2015-02-20 06:40:43

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,983/3,578

Re: Mirror Move Problem with New Moves

Maybe I'm missing something (I'm pretty tired right now, after all) but I'm not seeing where it actually does anything with W_PLAYERMOVENUM at all. It loads it to de, but I don't actually see it doing anything with de once it is loaded...

Offline

#8 2015-02-20 06:49:05

ShantyTown
Member
Registered: 2013-12-04
Post 207/344

Re: Mirror Move Problem with New Moves

Mateo wrote:

Maybe I'm missing something (I'm pretty tired right now, after all) but I'm not seeing where it actually does anything with W_PLAYERMOVENUM at all. It loads it to de, but I don't actually see it doing anything with de once it is loaded...

It fails in ReloadMoveData because the a register contains an invalid move id.  It loads something beyond the end of the Moves table.

Offline

#9 2015-02-20 17:16:25

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,984/3,578

Re: Mirror Move Problem with New Moves

I'm gonna try out the wPlayerSelectedMove way because I have too many moves to give them all unique animation IDs and keep the other IDs in tgat table.

Offline

#10 2015-02-20 21:26:14

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 246/450
Website

Re: Mirror Move Problem with New Moves

It fails in ReloadMoveData because the a register contains an invalid move id.

If I undestand this correctly, since the move/animation identifier is shared you would simply put your new attack animation pointer in the position that matches the move constant (e.g. if you put you new move between Substitute and Struggle, your new move's anim pointer would go between substitute's anim and struggles anim). If you don't do that the attack constant and the animation id won't match and will lead to the attack showing an incorrect animation, but this would be the case everytime that move is used, and not just when it's picked by Mirror Move, right?

I'm gonna try out the wPlayerSelectedMove way because I have too many moves to give them all unique animation IDs and keep the other IDs in tgat table.

One of the main differences between wPlayerSelectedMove and and wPlayerUsedMove is that the first is strictly the last selected move. You don't necessarily have to click on the move for wPlayerSelectedMove to store it, and, also, wPlayerSelectedMove isn't cleared between turns or on a switch-out, so it may contain a move that was stored 5 turns ago, whereas wPlayerUsedMove would contain 00 if that was the case. Using wPlayerSelectedMove for Mirror Move could lead to some weird behaviour because of that. (in fact, all the Counter glitches are due to checking wPlayerSelectedMove or similar addresses when determining whether Counter should be succesful).

Last edited by Crystal_ (2015-02-20 21:36:02)

Offline

#11 2015-02-21 00:07:34

ShantyTown
Member
Registered: 2013-12-04
Post 208/344

Re: Mirror Move Problem with New Moves

Crystal_ wrote:

If I undestand this correctly, since the move/animation identifier is shared you would simply put your new attack animation pointer in the position that matches the move constant (e.g. if you put you new move between Substitute and Struggle, your new move's anim pointer would go between substitute's anim and struggles anim). If you don't do that the attack constant and the animation id won't match and will lead to the attack showing an incorrect animation, but this would be the case everytime that move is used, and not just when it's picked by Mirror Move, right?

Yes, that's all correct.

One of the main differences between wPlayerSelectedMove and and wPlayerUsedMove is that the first is strictly the last selected move. You don't necessarily have to click on the move for wPlayerSelectedMove to store it, and, also, wPlayerSelectedMove isn't cleared between turns or on a switch-out, so it may contain a move that was stored 5 turns ago, whereas wPlayerUsedMove would contain 00 if that was the case. Using wPlayerSelectedMove for Mirror Move could lead to some weird behaviour because of that. (in fact, all the Counter glitches are due to checking wPlayerSelectedMove or similar addresses when determining whether Counter should be succesful).

Thanks for clarifying that.  It sounds like the best solution is to wedge the animation pointers into the AttackAnimationPointers table.

Offline

#12 2015-02-21 00:56:45

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,985/3,578

Re: Mirror Move Problem with New Moves

Then I guess my best bet is to put the non-attack animations in their own table because I'm not getting rid of moves and redoing all those learn sets over mirror-move ;)

Offline

#13 2015-02-21 02:31:10

ShantyTown
Member
Registered: 2013-12-04
Post 209/344

Re: Mirror Move Problem with New Moves

Mateo wrote:

Then I guess my best bet is to put the non-attack animations in their own table because I'm not getting rid of moves and redoing all those learn sets over mirror-move ;)

Just delete Mirror Move.  Yeah.

Offline

#14 2015-02-21 02:58:42

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,986/3,578

Re: Mirror Move Problem with New Moves

I mean that seems like a lazy way of doing it too, honestly, but could happen.

Offline

#15 2015-02-21 13:09:46

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 249/450
Website

Re: Mirror Move Problem with New Moves

Ok Mateo, so your prblem comes from the fact that wPlayerUsedMove (which previously took it value from W_PLAYERMOVENUM) stores the animation id rather than the id, so if Mirror Move is used against Metal Claw, it would pick Slash instead?

If that's the cause, you may have Mirror Move check for both wPlayerUsedMove and wPlayerSelectedMove, and have Mirror Move pick the move stored in wPlayerSelectedMove so long as wPlayerUsedMove is non-zero.

Offline

#16 2015-02-21 16:05:13

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,987/3,578

Re: Mirror Move Problem with New Moves

That sounds a lot simpler, and like it would work. I'll give that a try.

EDIT: Yep, got it working. Seems to work the way it's supposed to in battle.

Link to the commit with my changes in case anyone is interested.

Edit 2: Ack, just remembered that was used for Metronome too, better pull those things out of ReloadMoveData and put them in the main function.

Last edited by Mateo (2015-02-21 20:03:07)

Offline

Board footer

Powered by FluxBB