You are not logged in.
No problem, hope it works. If not, let me know, and I'll see what else I can come up with.
I am not very active on this forum. I only pop in from time to time.
Offline
1) I seem to recall Danny including a few "ds " lines in there, basically leaving free space in between things to keep from shifting data around when updating routines. You could try removing those. Even if that doesn't fix it, it could come in handy later. Just make sure you don't remove the ones near the top of the file, because those are there to reserve space for the Rom Header which gets written when the rom is compiled. The "ds " lines I'm talking about are near the bottom of home.asm
Hmm, the only "ds" lines I found were:
; copies HP bar and status display tile patterns into VRAM
LoadHpBarAndStatusTilePatterns:: ; 36c0 (0:36c0)
IF GEN_2_GRAPHICS
callba LoadHPBarAndEXPBar
ret
ds $17
ELSE
ld a, [rLCDC]
bit 7, a ; is the LCD enabled?
jr nz, .on
.off
And the one at the top:
SECTION "Header", ROM0 [$104]
; The header is generated by rgbfix.
; The space here is allocated to prevent code from being overwritten.
ds $150 - $104
Offline
You certainly wouldn't want to remove the one from the header section.
The one inside IF GEN_2_GRAPHICS can be removed, since that is just adding blank space at the end of a routine. Assuming you are using the Gen 2 graphics, that would save you some room. If you aren't using Gen 2 graphics, it won't help at all. I was thinking there were a few more in there as well, but it's been a while since I looked at it.
I am not very active on this forum. I only pop in from time to time.
Offline
You certainly wouldn't want to remove the one from the header section.
The one inside IF GEN_2_GRAPHICS can be removed, since that is just adding blank space at the end of a routine. Assuming you are using the Gen 2 graphics, that would save you some room. If you aren't using Gen 2 graphics, it won't help at all. I was thinking there were a few more in there as well, but it's been a while since I looked at it.
The copy.asm and copy2.asm suggestion didn't work either.
How do I go about removing one from the header section?
ds $150 - $104
What do I change/remove from that line?
And yes, I am using the Gen 2 graphics. I'll try removing "ds $17" now.
EDIT: Removing ds $17 didn't free up space either.
Last edited by megamctaco (2015-11-02 03:51:12)
Offline
Do not touch the one in the header, that is there for a reason. It is reserving space for the Rom's header, which will be generated by the compiler. That is why I specifically said NOT to remove that one.
I'll see what else I can come up with.
I am not very active on this forum. I only pop in from time to time.
Offline
Do not touch the one in the header, that is there for a reason. It is reserving space for the Rom's header, which will be generated by the compiler. That is why I specifically said NOT to remove that one.
I'll see what else I can come up with.
Sorry I misread the "wouldn't" as a "would" before! Haha
Offline
Well, it looks like yours has more SECTION headings defined in home.asm than mine does, which basically forces them to start at certain offsets. That's probably what's causing us issues in getting these things to fit. This might get tricky.
Last edited by Luna (2015-11-02 04:24:48)
I am not very active on this forum. I only pop in from time to time.
Offline
Well, it looks like yours has more SECTION headings defined in home.asm than mine does, which basically forces them to start at certain offsets. That's probably what's causing us issues in getting these things to fit. This might get tricky.
Instead of moving things OUT of ROM0... Can't we put the sprites and whatnot elsewhere? Or am I wrong in thinking that?
Offline
The sprites ARE elsewhere. This is just the routine the game calls when it needs to load the player's OW sprites. But yeah, I'm thinking we can try to move this routine out of Bank 0 to make room for those expanded checks and things. I just thought "If we can get rid of stuff that doesn't have to be there in the first place, it would be better".
But yeah, tomorrow after class I'll see what we can do about moving that routine somewhere else.
I am not very active on this forum. I only pop in from time to time.
Offline
Any luck yet?
Offline
Sorry, I had some real-life distractions come up, haven't really messed with it yet. I should be free for a while now though, so I'll take a look around.
Just to see what happens, can you try this:
- Keep the original edits where they are
- Go to home.asm
- comment out Line 815 (SECTION "LoadMonFrontSprite", ROM0[$1665])
See if that lets it compile properly. To my knowledge, there shouldn't be any reason for that SECTION marker to HAVE TO be there, it seem to just be there to preserve an original offset or something. So try commenting it out and see if it will compile with those changes. If it doesn't, or it causes more errors, you can easily restore that heading by removing the ; at the start of the line.
Edit: There are also a couple of similarly added SECTION headings added in home/vcopy.asm which are also just there to preserve the old offsets after routines were changed. You can find these at Line 58 and Line 104 in home/vcopy.asm and try commenting them out as well.
Last edited by Luna (2015-11-04 19:13:47)
I am not very active on this forum. I only pop in from time to time.
Offline
Removing all 3 would only load the intro and title screen to the rom, and then nothing.
Removing only Line 815 (SECTION "LoadMonFrontSprite", ROM0[$1665]) would still give me a ROM0 error.
Removing line 815 and line 104 in vcopy.asm loaded fine, but my overworld sprite couldn't move around much, and even ended up walking on top of a building.
Removing line 815 and line 58 wouldn't compile due to ROM0 error either.
Removing only 58 and 104 still gave me a ROM0 error.
Offline
Removed line 104 and 815 to try again.
Overworld sprite still walked on top of Oak's lab, but once I entered the door and delivered Oak's Parcel and he gave me 5 Pokeballs, I walked out and now everything seems to be working fine.
Offline
When testing these, were you starting a new game or continuing a save? Continuing a save would explain why you got errors that fix themselves after warping.
I am not very active on this forum. I only pop in from time to time.
Offline
When testing these, were you starting a new game or continuing a save? Continuing a save would explain why you got errors that fix themselves after warping.
Continuing a save. I'll try a new game now.
EDIT: Awesome! It works! Cheers for the help!
I'll get around to adding the Hall of Fame sprite today, and hopefully the fishing rod animations work out since I moved them to a separate .asm file.
Last edited by megamctaco (2015-11-05 01:01:42)
Offline
Glad you got it working! And yeah, hopefully the fishing tiles will work as well. Let me know if you run into any more errors and I'll try to help you sort them out.
I am not very active on this forum. I only pop in from time to time.
Offline
Speaking of getting 5 Poké Balls from Oak, how do you program it so he gives them to you immediately after you receive your Pokédex, and before he charges you and your rival with fulfilling his old dream of cataloging the Pokémon of the known (at the time) Pokémon World?
Offline
It quickly *struggled* to change to Red's sprite before crashing.
I removed the following from main.asm
SECTION "fishing animation", ROMX,BANK[$3C]
INCLUDE "engine/overworld/fishing_anim.asm"
And then I put "FishingAnim: ; 707b6 (1c:47b6)" back into player_animations.asm to see if that would work now.
"Unable to load fixed ROMX section into bank $1C"
Offline
Speaking of getting 5 Poké Balls from Oak, how do you program it so he gives them to you immediately after you receive your Pokédex, and before he charges you and your rival with fulfilling his old dream of cataloging the Pokémon of the known (at the time) Pokémon World?
For that, I just added this to scripts\oakslab.asm:
.asm_1d2c8
ld hl, OaksLabAroundWorldText
call PrintText
lb bc, POKE_BALL, 5
call GiveItem
ld hl, OaksLabGivePokeballsText
call PrintText
jr .asm_1d2ed
Making it right above the original:
.asm_1d2d0
CheckAndSetEvent EVENT_GOT_POKEBALLS_FROM_OAK
jr nz, .asm_1d2e7
lb bc, POKE_BALL, 5
call GiveItem
ld hl, OaksLabGivePokeballsText
call PrintText
jr .asm_1d2ed
I probably shouldn't have left the original script in there, but it works fine for me.
Last edited by megamctaco (2015-11-05 01:11:16)
Offline
It quickly *struggled* to change to Red's sprite before crashing.
I removed the following from main.asm
SECTION "fishing animation", ROMX,BANK[$3C] INCLUDE "engine/overworld/fishing_anim.asm"
And then I put "FishingAnim: ; 707b6 (1c:47b6)" back into player_animations.asm to see if that would work now.
"Unable to load fixed ROMX section into bank $1C"
Let's see if we can figure out why it does that.
I see (at least part of) the problem. It calls something that is in bank $1C, and it looks like it would mess up if we tried to "callba" that routine instead of just call it (since it would mess up the pointers we have stored in hl.
So you could try coming down to the end of engine/overworld/fishing_anim.asm and adding this:
LoadAnimSpriteGfx2: ; 71771 (1c:5771)
; Load animated sprite tile patterns into VRAM during V-blank. hl is the address
; of an array of structures that contain arguments for CopyVideoData and a is
; the number of structures in the array.
ld bc, $0
.loop
push af
push bc
push hl
add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hli]
ld h, [hl]
ld l, a
call CopyVideoData
pop hl
pop bc
ld a, $6
add c
ld c, a
pop af
dec a
jr nz, .loop
ret
And then change Line 29 to
call LoadAnimSpriteGfx2
instead of the original,
call LoadAnimSpriteGfx
And see if that works.
Last edited by Luna (2015-11-05 01:20:34)
I am not very active on this forum. I only pop in from time to time.
Offline
And then change Line 29 to
call LoadAnimSpriteGfx2
instead of the original,
call LoadAnimSpriteGfx
And see if that works.
That stops it from crashing, but it still loads Red's tiles for some reason.
Here is the full fishing_anim.asm
FishingAnim: ; 707b6 (1c:47b6)
ld c, 10
call DelayFrames
ld hl, wd736
set 6, [hl] ; reserve the last 4 OAM entries
ld a, [wPlayerGender] ; added gender check
bit 2, a ; added gender check
jr z, .BoySpriteLoad
ld de, GreenSprite
ld hl, vNPCSprites
ld bc, (BANK(GreenSprite) << 8) + $0c
jr .KeepLoadingSpriteStuff
.BoySpriteLoad
ld de, RedSprite ; $4180
ld hl, vNPCSprites
ld bc, (BANK(RedSprite) << 8) + $0c
.KeepLoadingSpriteStuff
call CopyVideoData
ld a, [wPlayerGender] ; added gender check
bit 2, a ; added gender check
jr z, .BoyTiles ; skip loading Green's stuff if you're Red
ld a, $4
ld hl, GreenFishingTiles
jr .ContinueRoutine ; go back to main routine after loading Green's stuff
.BoyTiles ; alternately, load Red's stuff
ld a, $4
ld hl, RedFishingTiles
.ContinueRoutine
call LoadAnimSpriteGfx2
ld a, [wSpriteStateData1 + 2]
ld c, a
ld b, $0
ld hl, FishingRodOAM
add hl, bc
ld de, wOAMBuffer + $9c
ld bc, $4
call CopyData
ld c, 100
call DelayFrames
ld a, [wRodResponse]
and a
ld hl, NoNibbleText
jr z, .done
cp $2
ld hl, NothingHereText
jr z, .done
; there was a bite
; shake the player's sprite vertically
ld b, 10
.loop
ld hl, wSpriteStateData1 + 4 ; player's sprite Y screen position
call .ShakePlayerSprite
ld hl, wOAMBuffer + $9c
call .ShakePlayerSprite
call Delay3
dec b
jr nz, .loop
; If the player is facing up, hide the fishing rod so it doesn't overlap with
; the exclamation bubble that will be shown next.
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction
cp SPRITE_FACING_UP
jr nz, .skipHidingFishingRod
ld a, $a0
ld [wOAMBuffer + $9c], a
.skipHidingFishingRod
ld hl, wEmotionBubbleSpriteIndex
xor a
ld [hli], a ; player's sprite
ld [hl], a ; EXCLAMATION_BUBBLE
predef EmotionBubble
; If the player is facing up, unhide the fishing rod.
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction
cp SPRITE_FACING_UP
jr nz, .skipUnhidingFishingRod
ld a, $44
ld [wOAMBuffer + $9c], a
.skipUnhidingFishingRod
ld hl, ItsABiteText
.done
call PrintText
ld hl, wd736
res 6, [hl] ; unreserve the last 4 OAM entries
call LoadFontTilePatterns
ret
.ShakePlayerSprite
ld a, [hl]
xor $1
ld [hl], a
ret
NoNibbleText: ; 70847 (1c:4847)
TX_FAR _NoNibbleText
db "@"
NothingHereText: ; 7084c (1c:484c)
TX_FAR _NothingHereText
db "@"
ItsABiteText: ; 70851 (1c:4851)
TX_FAR _ItsABiteText
db "@"
FishingRodOAM: ; 70856 (1c:4856)
; specifies how the fishing rod should be drawn on the screen
; first byte = screen y coordinate
; second byte = screen x coordinate
; third byte = tile number
; fourth byte = sprite properties
db $5B, $4C, $FD, $00 ; player facing down
db $44, $4C, $FD, $00 ; player facing up
db $50, $40, $FE, $00 ; player facing left
db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile")
RedFishingTiles: ; 70866 (1c:4866)
dw RedFishingTilesFront
db 2, BANK(RedFishingTilesFront)
dw vNPCSprites + $20
dw RedFishingTilesBack
db 2, BANK(RedFishingTilesBack)
dw vNPCSprites + $60
dw RedFishingTilesSide
db 2, BANK(RedFishingTilesSide)
dw vNPCSprites + $a0
dw RedFishingRodTiles
db 3, BANK(RedFishingRodTiles)
dw vNPCSprites2 + $7d0
GreenFishingTiles: ; newly added table of Green's sprites
dw GreenFishingTilesFront
db 2, BANK(GreenFishingTilesFront)
dw vNPCSprites + $20
dw GreenFishingTilesBack
db 2, BANK(GreenFishingTilesBack)
dw vNPCSprites + $60
dw GreenFishingTilesSide
db 2, BANK(GreenFishingTilesSide)
dw vNPCSprites + $a0
dw RedFishingRodTiles
db 3, BANK(RedFishingRodTiles)
dw vNPCSprites2 + $7d0
LoadAnimSpriteGfx2: ; 71771 (1c:5771)
; Load animated sprite tile patterns into VRAM during V-blank. hl is the address
; of an array of structures that contain arguments for CopyVideoData and a is
; the number of structures in the array.
ld bc, $0
.loop
push af
push bc
push hl
add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hli]
ld h, [hl]
ld l, a
call CopyVideoData
pop hl
pop bc
ld a, $6
add c
ld c, a
pop af
dec a
jr nz, .loop
ret
Offline
Strange, nothing is jumping out at me about that as being out of place.
Comparing it to Red++ the only real differences I'm seeing are the label names and the fact that I'm using "and a" instead of "bit 2, a" since I modified how it's set in the intro a little. So the check is slightly different but your way is how I did it originally so it looks like it aught to still work...
I am not very active on this forum. I only pop in from time to time.
Offline
Ha! Changing it to "and a" actually fixed it! Cool! Cheers again, dude!
Offline
I updated the first post, so that it actually refers to label names and such from modern pokered, and includes the updates I made to this in Red++ after the original post. If anyone finds any new problems with it, let me know.
I am not very active on this forum. I only pop in from time to time.
Offline
In this case, ".NotLeaf1" is supposed to be a label.
There are two main possibilities.
Since labels that begin with a period are local labels (they are only valid in between the global label above and below where the local label is defined) it's possible that you are trying to reference the ".NotLeaf1" local label from outside that region that it is valid.
Second, it's possible that you just forgot to include the ".NotLeaf1" label at all.
Double check engine/oak_speech.asm and around line 99 make sure the label is defined in the local scope that it is referenced.
Offline