Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#51 2015-05-25 05:41:10

Mmmmmm
Member
From: West Virginia
Registered: 2015-05-17
Post 6/259

Re: Simple Questions & Answers

Working perfectly now.

The only thing left to figure out is the Pokédex: The entry works when selected, and it appears in the new and alphabetical Pokédex orders, but I can't get it to show up in the old Pokédex. I've looked through engine/pokedex.asm but I'm not seeing anything that stops the listing at 251.

Offline

#52 2015-05-25 06:10:24

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

Re: Simple Questions & Answers

NUM_POKEMON is the only thing I see.

Offline

#53 2015-05-25 06:16:21

Mmmmmm
Member
From: West Virginia
Registered: 2015-05-17
Post 7/259

Re: Simple Questions & Answers

NUM_POKEMON is in constants/pokemon_constants.asm, right? If so I already changed that before I noticed this problem, so I don't think that's the cause.

Offline

#54 2015-05-26 12:02:01

FroggestSpirit
Member
Registered: 2012-03-12
Post 260/299
Website

Re: Simple Questions & Answers

How much free space do we have in the pokered disassembly and pokecrystal respectively? I'm talking adding extra data to the save files


This isn't easy to say, but…
Music and ASM hacker

Offline

#55 2015-05-28 21:53:49

Urnighter
Member
Registered: 2015-01-17
Post 71/123

Re: Simple Questions & Answers

So I added 14 pokemon in and 13 work fine, but Riolu's sprite is all messed up. The left half is fine but the right half is scrambled.

I'm sure that it is listed as 6x6 in every location. What else could cause this?

Offline

#56 2015-05-29 10:40:17

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

Re: Simple Questions & Answers

base stats?

Offline

#57 2015-05-29 15:40:54

Urnighter
Member
Registered: 2015-01-17
Post 72/123

Re: Simple Questions & Answers

Nah. I did 13 right (I know all of the loactions), it's something else.

It is however the only 6x6 I added. Is there anything different I have to deal with that I wouldn't have had to do with the 7x7s?

I can post git.diff when I get home.

Offline

#58 2015-05-29 22:46:25

Urnighter
Member
Registered: 2015-01-17
Post 73/123

Re: Simple Questions & Answers

Offline

#59 2015-05-30 23:05:31

Urnighter
Member
Registered: 2015-01-17
Post 74/123

Re: Simple Questions & Answers

BattleCommand1d: ; 362e3
; statdown

    ld [LoweredStat], a

    call Function36391
    jp nz, .Mist

    ld hl, EnemyStatLevels
    ld a, [hBattleTurn]
    and a
    jr z, .GetStatLevel
    ld hl, PlayerStatLevels

.GetStatLevel
; Attempt to lower the stat.
    ld a, [LoweredStat]
    and $f
    ld c, a
    ld b, 0
    add hl, bc
    ld b, [hl]
    dec b
    jp z, .CantLower

; Sharply lower the stat if applicable.
    ld a, [LoweredStat]
    and $f0
    jr z, .ComputerMiss
    dec b
    jr nz, .ComputerMiss
    inc b

Is this where I would have to edit to change the maximum number of times a stat can be increased or decreased from 6 to 2? What would I do?

Offline

#60 2015-05-30 23:31:57

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 270/431
Website

Re: Simple Questions & Answers

Stat levels are stored as values between 1 (-6) and 13 (+6). You want them to range only between 5 (-2) and 9 (+2).

Notice how

.GetStatLevel
; Attempt to lower the stat.
    ld a, [LoweredStat]
    and $f
    ld c, a
    ld b, 0
    add hl, bc
    ld b, [hl]
    dec b
    jp z, .CantLower

reads the stat level from hl, decrements it, and makes the move miss on 0 (jump to .CantLower). This means that the stat level has to be 1 (-6) for the move to miss. Change it so that it branches when b is 4 instead of when it's 0 (hint: load b into a, compare a to 4).

Then

; Sharply lower the stat if applicable.
    ld a, [LoweredStat]
    and $f0
    jr z, .ComputerMiss
    dec b
    jr nz, .ComputerMiss
    inc b

deals with stat down moves that lower the stat two levels. The last inc b is there so that if you were at -5 and are targeted with a sharply lowering move, you don't end up at 0 (-7), but at -7 + 1 = -6.  That should also be changed to reflect that you want it to cap at -2.

The stat up function is Function361ef. Find what makes the stat up moves fail when the stat level is 13 or 0x0d (+6), and change that to 9 (+2).

Last edited by Crystal_ (2015-05-30 23:33:50)

Offline

#61 2015-06-03 19:47:54

~Red
Member
Registered: 2010-10-16
Post 249/276

Re: Simple Questions & Answers

Ugh, is there a graphical tool or simpler way to edit the tileblock data of a tileset without doing it in raw data? (Using the Dissassembly)

Last edited by ~Red (2015-06-03 19:48:05)

Offline

#62 2015-06-03 21:44:03

Urnighter
Member
Registered: 2015-01-17
Post 76/123

Re: Simple Questions & Answers

Crystal_ wrote:

Stat levels are stored as values between 1 (-6) and 13 (+6). You want them to range only between 5 (-2) and 9 (+2).

Notice how

.GetStatLevel
; Attempt to lower the stat.
    ld a, [LoweredStat]
    and $f
    ld c, a
    ld b, 0
    add hl, bc
    ld b, [hl]
    dec b
    jp z, .CantLower

reads the stat level from hl, decrements it, and makes the move miss on 0 (jump to .CantLower). This means that the stat level has to be 1 (-6) for the move to miss. Change it so that it branches when b is 4 instead of when it's 0 (hint: load b into a, compare a to 4).

Then

; Sharply lower the stat if applicable.
    ld a, [LoweredStat]
    and $f0
    jr z, .ComputerMiss
    dec b
    jr nz, .ComputerMiss
    inc b

deals with stat down moves that lower the stat two levels. The last inc b is there so that if you were at -5 and are targeted with a sharply lowering move, you don't end up at 0 (-7), but at -7 + 1 = -6.  That should also be changed to reflect that you want it to cap at -2.

I really appreciate the answer, but I'm very noob can't fully interpret it.

In the first case I understand the explanation but not how to carry it out. I changed it to...

.GetStatLevel
; Attempt to lower the stat.
    ld a, [LoweredStat]
    and $f
    ld c, a
    ld b, a
    cp 4
    add hl, bc
    ld b, [hl]
    dec b
    jp z, .CantLower

But as I anticipated that didn't work. I imagine it stems from my overall lack of knowledge on what most of those abbreviations are doing. What is c, and why is it loading into a? what is [hl]? Is there anywhere else I should go to learn about it?

As for the second case, I understand what it's doing, but why would I change it? Would it's function still not serve the same purpose but now bump from -3 to -2 instead of -7 to -6? Why would I have to alter it?

If these questions are too basic for you to bother answering I'm open to learning through another source you recommend.

Offline

#63 2015-06-04 08:23:24

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 271/431
Website

Re: Simple Questions & Answers

Let's go instruction by instruction to figure out what's going on here:

.GetStatLevel
; Attempt to lower the stat.
ld a, [LoweredStat]
and $f
ld c, a
ld b, 0
add hl, bc
ld b, [hl]
dec b
jp z, .CantLower
; Sharply lower the stat if applicable.
ld a, [LoweredStat]
and $f0
jr z, .ComputerMiss
dec b
jr nz, .ComputerMiss
inc b
inc b
.GetStatLevel
; Attempt to lower the stat.
ld a, [LoweredStat]

This loads the stat identifier into register a. This is a value between 0x00 and 0x0F for an attack that lowers the stat one level (e.g. 0x00 for Attack stat, 0x01 for Defense...), and a value higher than ox10 otherwise.

and $f

Since we only want to deal with attacks that lower the stat one level, we want to ignore the 4 highest bits.  and $f translates to and %00001111 in binary meaning that this would make the highest four bits or register a become 0 no matter the value they had.

ld c, a
ld b, 0

This loads register a into register c and 0 into register b. This way, the value of register pair bc becomes equal to register a.

add hl, bc

We add bc to hl. hl originally pointed to the first stat level (Attack) and this operation will make sure it'll end up pointing to the corresponding stat level. For example for Defense, bc would be $0001, and adding that to hl would make it point to the Defense stat.

ld b, [hl]

We load the content of hl (the stat level it points to into b). This could be any number betweed 0x01 (-6) and 0x0d (+6)

dec b
jp z, .CantLower

Since we don't want the stat level to go lower than 0x01 (-6), we decrement b and test if it's 0 with the conditional jump. If b is 0 during the conditional jump it means it was 0x01 before the dec b instruction. If it's 0, the flag z will be set, causing the jump to be followed.

ld a, [LoweredStat]
and $f0

We now need to take care of moves that sharply lower the stat, since we've only decreased the stat level by 1 so far (provided target was at -5 at least). The and %11110000 (and $f0) is used to find out whether the move was a sharply lowering move. If it is, this instruction will output a non-zero value because [LoweredStat] contained a value with some of the highest bits set. So in this case, we still need to lower the stat once again.

jr z, .ComputerMiss


Again, if it's z or zero, we have nothing else to do here so we branch ahead.

dec b
jr nz, .ComputerMiss

Else we decrement again and do the same check we did before to make sure we don't go below -6. We branch ahead if we are not already at -6

inc b

If we did go below -6, we increment it by 1 to go back to -6.

(...)
ld [hl], b

register b will eventually be saved to [hl] to update the stat level in memory.


So this is what we can do:

.GetStatLevel
; Attempt to lower the stat.
ld a, [LoweredStat]
and $f
ld c, a
ld b, 0
add hl, bc
ld b, [hl]
dec b
ld a, b
cp 4
jp z, .CantLower
; Sharply lower the stat if applicable.
ld a, [LoweredStat]
and $f0
jr z, .ComputerMiss
dec b
ld a, b
cp 4
jr nz, .ComputerMiss
inc b

Let's say the stat we're trying to lower is already at -2 or 0x05. When we decrement it with dec b it'd become 4, and 4 compared to 4 through the cp instruction will set the z flag. This will cause the jp z, .CantLower to be followed, and the jr nz, .ComputerMiss to be skipped (so the inc b is executed and the stat level becomes 5 again).

Let's see if you can figure out how to do the stat up effect.

Last edited by Crystal_ (2015-06-04 08:26:24)

Offline

#64 2015-06-06 01:03:47

Mmmmmm
Member
From: West Virginia
Registered: 2015-05-17
Post 8/259

Re: Simple Questions & Answers

I've been attempting to expand the amount of TMs. What I've done so far is change the number of TMs in wram.asm to 52, change ITEM_C3 and ITEM_DC to TMs since they're within the TM list so I assumed it would be the easiest to test with, removed the scripts that skip ITEM_C3 and ITEM_DC, and added moves to the TM and HM list.

The odd thing that's happening is the number of TMs doesn't seem to change. TM29 and beyond remain TM29 and beyond, TM05 to ITEM_DC (it's between 28 and 29) are one less than they should be, and TM01 to ITEM_C3 (which is between 04 and 05) are two less than they should be. This results in TM02 being TM00 and TM01 being TMP5 (which I assume is 255).

TM00 and TMP5 do not appear in the bag when taken.

Additionally, if you pick up an HM it says it's also two less than it should be, but in the bag itself the HMs are the proper number (so HMP5 is HM01, etc.).

I'm at a complete loss at what's causing this since all the scripts I found that determine TM and HM number or name start at TM_01, and as I said, the item slots that were used are after TM_01 in the index.


EDIT: I figured out what was causing the problem, I didn't comment out the actual skip function, and part of the code that skips those items has you ignore that part outside of those two items, so it ran the "skip" code for every item, which consisted of moving the items back by a number.

Now I have a different problem in that, even though TM51 and TM52 appear as such when you get the item from the ground or an NPC, they're still HM01 and HM02 in the item listing, and even though you can get HM06 and HM07 from the overworld, they don't exist in the pack after you take them.

Last edited by Mmmmmm (2015-06-06 05:31:31)

Offline

#65 2015-06-07 21:50:24

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 272/431
Website

Re: Simple Questions & Answers

You may want to check out GetTMHMNumber and GetNumberedTMHM in main.asm, and possibly the functions between d3c4 and d407 too.

Offline

#66 2015-06-08 02:45:45

Mmmmmm
Member
From: West Virginia
Registered: 2015-05-17
Post 9/259

Re: Simple Questions & Answers

Oh, I figured out the issue on my own, sorry for not saying so. It was around there, yes; there was a static address subtracting 50 TMs instead of checking for the number of TMs.

Offline

#67 2015-06-13 18:52:06

Urnighter
Member
Registered: 2015-01-17
Post 77/123

Re: Simple Questions & Answers

I'm still not really sure what I'm doing.

inc b
    ld a, $d
    cp b

@line 6044 and line 6051 seems to be what I need to deal with.

ld [hl], b
    push hl
    ld a, c
    cp $5
    jr nc, .asm_36268

And this seems to be what causes the move to fail.

Can I have an explanation of what $d and $5 are?
Also, since you used cp 4 to make it reset to 5 above, wouldn't I use cp 10 to make it reset to 9? But isn't cp 10 equal to 1.0?

Offline

#68 2015-06-13 22:08:09

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 274/431
Website

Re: Simple Questions & Answers

ld [hl], b
    push hl
    ld a, c
    cp $5
    jr nc, .asm_36268
And this seems to be what causes the move to fail.

That's not where you should be at. What register c contains there is NOT the stat level, but the stat id (attack, defense...) as you can see from around 20 lines above, when it was loaded:

ld a, [LoweredStat]
    and $f
    ld c, a

And $5 is accuracy. Everything between that portion of code and .asm_36268 is stuff that updates the stat value (1-999) based on the stat level, which is not necessary if the stat we are dealing with is accuracy or evasion, as these two don't have any value. So that jr nc instruction makes sure we skip all that for accuracy and evasion stats.

This is the part you will have to change:

ld b, [hl]
    inc b
    ld a, $d
    cp b
    jp c, Function36270
    ld a, [LoweredStat]
    and $f0
    jr z, .asm_3622b ; 0x36222 $7
    inc b
    ld a, $d
    cp b
    jr nc, .asm_3622b ; 0x36228 $1
    ld b, a

Last edited by Crystal_ (2015-06-13 22:10:48)

Offline

#69 2015-06-20 16:57:49

Urnighter
Member
Registered: 2015-01-17
Post 78/123

Re: Simple Questions & Answers

So school's out! I finally have lots of time to put into this hack.

So to start I finally got around to capping stat buffing. And I think I did it?

ld b, [hl]
    dec b
    dec b
    dec b
    ld a, $d
    cp b
    jp c, Function36270
    ld a, [LoweredStat]
    and $f0
    jr z, .asm_3622b ; 0x36222 $7
    dec b
    dec b
    dec b
    ld a, $d
    cp b
    jr nc, .asm_3622b ; 0x36228 $1
    ld b, a

This is clearly an ugly solution but I'm not sure what all of the commands mean so using a bunch of "dec b" was the only way I could figure out how to cp to 10. Will this work? It seems to based on a couple minutes of testing.


Anyways, next issue. When a move has 0 PP I can still select it, and doing so causes the game to crash? Any ideas on how I managed this?

Offline

#70 2015-06-20 19:06:50

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 276/431
Website

Re: Simple Questions & Answers

You can't decrement b carelessly there because in the moment the game jumps to asm_3622b the value at b is saved to the stat mod address, causing the stat mod to drop one level for each dec b. Not to mention they should be inc b instead, since the way you've done it the game will branch to Function36270 when the stat mod is initially 17 or higher (that would technically be +10). I bet the reason you thought it was working fine was because you got the stat up move to miss in your third use which is when the stat mod underflowed to around 253. 253-3 is much higher than 14, so it branched to Function36270 and missed.

If you want to take the route of incrementing b thrice you'll have to make use of push/pop bc to save the original value in the stack, although you can also get away with saving it to d or e and getting it back later. Whatever you do, b should contain the correct value of the stat mod before being loaded into hl at line 6129.

Last edited by Crystal_ (2015-06-20 19:07:54)

Offline

#71 2015-06-20 23:46:05

Urnighter
Member
Registered: 2015-01-17
Post 79/123

Re: Simple Questions & Answers

So initial idea is

ld b, [hl]
inc b
ld b, d
inc d
inc d
inc d
ld a, $d
cp d
jp c, Function36270
ld a, [LoweredStat]
and $f0
jr z, .asm_3622b ; 0x36222 $7
inc b
ld b, d
inc d
inc d
inc d
ld a, $d
cp d
jr nc, .asm_3622b ; 0x36228 $1
ld b, a
.asm_3622b
ld b, d
ld [hl], b

But I don't think that will work. I'm not sure I want to go the route with "inc"ing b three times.

I understand that my goal is to cp that stat value to +3 (10) and in that event set it back to 9 and jump to the message that says the stat wont go any higher. Wouldn't the simplest way be to load a into b and cp it to 10 just like you did in the first example?

Thanks again for being so informative.

Offline

#72 2015-06-20 23:55:27

Urnighter
Member
Registered: 2015-01-17
Post 80/123

Re: Simple Questions & Answers

Also, a question for Comet (or Crystal if you can answer it)

How do fish.asm's "FishGroup's" correspond to routes? For instance, fish group 6 features level 5 qwilfish that can be obtained with an old rod, yet bulbapedia suggests level 5 qwilfish don't exist in the wild. Is Fish group 6 corresponding with the swarms on route 32 and suggesting that bulbapedia has made an error? Is there a way to know what fish groups correspond with which routes?

Offline

#73 2015-06-21 08:58:42

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 277/431
Website

Re: Simple Questions & Answers

ld b, d

This loads d into b, not b into d. What you want to do the first time is ld d, b to save d into b, and finally ld b, d to get the value back on register b.

I understand that my goal is to cp that stat value to +3 (10) and in that event set it back to 9 and jump to the message that says the stat wont go any higher. Wouldn't the simplest way be to load a into b and cp it to 10 just like you did in the first example?

Yes, it is the easiest way. You only need to change the ld a, $d to ld a, $9.

; load the stat mod into register b
    ld b, [hl]

; increment it
    inc b

; load $9 into register a compare it to register b 
    ld a, $9
    cp b

; carry flag will be set for values of b equal or higher than $a (10)
    jp c, Function36270

; check if the move raises the stat two levels
    ld a, [LoweredStat]
    and $f0

; if it does not, we don't have to increment the stat again so we branch ahead
    jr z, .asm_3622b ; 0x36222 $7

; increment b again
    inc b

; compare to $9 again
    ld a, $9
    cp b

; it's fine if the stat didn't go past $9
    jr nc, .asm_3622b ; 0x36228 $1

; if we reached this point is because the stat was initially at $8 (+1) and the move attepted to increment it two levels
; we want the stat at $9 (+2) in this case, so we load the value of a into b, which is $9 as per loaded three instructions ago
    ld b, a

.asm_3622b
; we are done now, so we save the updated stat mod value into memory
    ld [hl], b
;   (...)

How do fish.asm's "FishGroup's" correspond to routes? For instance, fish group 6 features level 5 qwilfish that can be obtained with an old rod, yet bulbapedia suggests level 5 qwilfish don't exist in the wild. Is Fish group 6 corresponding with the swarms on route 32 and suggesting that bulbapedia has made an error? Is there a way to know what fish groups correspond with which routes?

Bulbapedia only gives information about Pokemon that appear in tall grass or by surfing.

The fishing group is determined by a value that ranges bewteen 1 and 12 in the map header of each map. This number is identifies the fishing table that applies to said map.

The fishing group is the seventh argument of a map header entry:

map_header: MACRO
; label, tileset, permission, location, music, time of day, fishing group
\1_MapHeader:
db BANK(\1_SecondMapHeader), \2, \3
dw \1_SecondMapHeader
db \4, \5, \6, \7
ENDM

For example:

map_header DarkCaveBlackthornEntrance, $1e, 4, DARK_CAVE, MUSIC_DARK_CAVE, 20, 3

The Dark Cave map will load fishing Pokemon from table 3.

map_header DragonsDen1F, $18, 4, DRAGONS_DEN, MUSIC_DRAGONS_DEN, 18, 5

The Dragon's Den map will load fishing Pokemon from table 5.

Last edited by Crystal_ (2015-06-21 08:59:59)

Offline

#74 2015-06-21 14:21:59

Urnighter
Member
Registered: 2015-01-17
Post 82/123

Re: Simple Questions & Answers

Thank you for that explanation. I followed it. However, in testing it seems that moves such as harden and growth that raise a stat one stage are capped at one use?

That fishing information is great. It's interesting the game structured it like that, I would have thought each route was unique. Also bulbapedia definitely gives fishing too, along with headbutt trees.
http://bulbapedia.bulbagarden.net/wiki/Johto_Route_32

Do you have any idea why certain stone evolutions don't appear as "ABLE" on the menu? When I select the stone I am able to select the pokemon, Murkrow for example with moon stone, and evolve it to honchkrow, but Murkrow still says "NOT ABLE" when I select the moon stone.

Last edited by Urnighter (2015-06-21 16:49:34)

Offline

#75 2015-06-22 13:53:31

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 280/431
Website

Re: Simple Questions & Answers

It's got to be related to Function50268. Track it down and see what goes wrong for the new Pokemon, that's all I can say because I can't find out what could be the cause at first glance.

Offline

Board footer

Powered by FluxBB