View Single Post
  #359    
Old March 24th, 2013, 11:03 AM
miksy91's Avatar
miksy91
A GB/C Rom Hacker since 2010
 
Join Date: Oct 2008
Location: A small country in the North
Gender: Male
Nature: Relaxed
Quote:
Originally Posted by cabusao10 View Post
Whoa! You know me even though my account here is too old.
It's kinda obvious, you posted that "emerald hack" thread here as well.

Quote:
Originally Posted by cabusao10 View Post
also im really curious about the how battle simulator works and how BP done, i might try to search it or maybe i could just ask it to you and put it on my hack, if it is only ok to you?
I hacked it so that you're given BP if the money you would be given equals to 0. There is a routine starting at 0F:4FC3 that loads hl with the pointer of a text pointer. First, we load hl with 5009 and in 0F:5009 we've got F0 53. By loading hl with 5009, we would be printing text data from 40:53F0 later on.

At 0F:4FD6 and 0F:4FDC, we've got "jp 3CD6". This routine at $3CD6 is used to print text at 40:hl. So when the processor is about to execute one of those, I use "jp 7F1A" instead to jump to my own new routine.

This one checks whether the values in ram addresses CB65 and CB66 are 0 (this is where given money is stored). If either one of them is not 0, "jp 3CD6". If both are 0, it calls a new routine that is used to give you a certain amount of BP (this depends on the Trainer Number byte) and stores it in D57A where "coins" are originally stored (this is just for convenience, so that I can use "givecoins", "checkcoins" and "takecoins" operations without doing those with assembly). So in this new routine, it loads the amount of given BP to a register pair depending on the Trainer Number value (this works because all simulator battles are of the same Trainer Group).

How much it loads works simply with;

Code:
ld a, [TrainerNo]
ld e, a
ld d, 00
ld hl, $table 
add hl, de
add hl, de
ldi a, [hl]
ld h, [hl]
ld l, a
And next I add the value of hl into D57A by building a counter that checks whether the "ones" go above FF and if so, it increments "tens". And it also sets the maximum value of the counter to 27 0F (9999).


Go ahead and do something similar if you like though. If you want to add the possibility to gain BP from many Trainer Groups, you have to expand the table you load into hl but other than that, this is how it would work.
__________________
My Rom Hack



Hacks I support





Learn how to hack GB/C games:

Check my GameBoy/Color hacking videos in Youtube
-The video set uses Pokemon Silver (U) rom for demonstrations

Last edited by miksy91; March 24th, 2013 at 12:38 PM.
Reply With Quote