View Single Post
Old March 17th, 2013 (11:13 AM). Edited March 17th, 2013 by miksy91.
miksy91's Avatar
miksy91 miksy91 is offline
Dark Energy is back in action! ;)
    Join Date: Oct 2008
    Location: A small country in the North
    Gender: Male
    Nature: Relaxed
    Posts: 1,438
    Originally Posted by karatekid552 View Post
    Edit: I figured out the formula!

    Okay, for moves that are numbered 255 and below, they are stored [move number] [level x 2].

    For moves above 255, they are stored [move number - 255] [level x 2 + 1]

    So, as you can see, if the level byte is odd, it knows to read from the set of moves above 255 and if it is even, it reads from the set of moves below 255. Quite the thought that went into this one!
    Yeah, looking at the pattern like that, it doesn't make much sense. But even so, there is some rational solution to why Gamefreak wanted to program the move learning pattern like that, and I believe that is the fact that Gen III games won't allow the level of the encountered pokemon being higher than 127 (or "100").

    This leaves the highest bit of the level value unused which can be used as part of the move learning routine. Now instead of 8 bits, 9 bits can be used to describe each move, by using the highest bit of the level value as one. This kind of a method allows 512 moves to be stored in the game.

    But you're right about the fact that the pattern doesn't look that user-friendly. But the fact is that it doesn't have to, not while being viewed with a hex editor. Because the original games were programmed by creating a disassembly, a "text document" holding all the in-game data that could be compiled into a rom file using an asm compiler (unless they simply wrote the game using a real programming language, can't really tell). This kind of a game developing method leaves more possibilities into actual game developing, without having to pay attention to all existing structures so much.
    My Rom Hack

    Fixing bugs in a ROM hack
    CP of encountered pokemon in GO

    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