Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#51 2015-11-01 23:08:24

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,132/3,512

Re: [Pokered] Adding Gender Selection

No problem, hope it works. If not, let me know, and I'll see what else I can come up with.

Offline

#52 2015-11-02 03:38:23

megamctaco
Member
Registered: 2015-08-23
Post 70/103

Re: [Pokered] Adding Gender Selection

Mateo wrote:

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

#53 2015-11-02 03:41:54

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,133/3,512

Re: [Pokered] Adding Gender Selection

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.

Offline

#54 2015-11-02 03:49:05

megamctaco
Member
Registered: 2015-08-23
Post 71/103

Re: [Pokered] Adding Gender Selection

Mateo wrote:

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

#55 2015-11-02 04:09:19

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,134/3,512

Re: [Pokered] Adding Gender Selection

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.

Offline

#56 2015-11-02 04:12:33

megamctaco
Member
Registered: 2015-08-23
Post 72/103

Re: [Pokered] Adding Gender Selection

Mateo wrote:

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

#57 2015-11-02 04:24:24

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,135/3,512

Re: [Pokered] Adding Gender Selection

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 Mateo (2015-11-02 04:24:48)

Offline

#58 2015-11-02 04:35:13

megamctaco
Member
Registered: 2015-08-23
Post 73/103

Re: [Pokered] Adding Gender Selection

Mateo wrote:

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

#59 2015-11-02 05:17:50

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,136/3,512

Re: [Pokered] Adding Gender Selection

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.

Offline

#60 2015-11-04 12:21:49

megamctaco
Member
Registered: 2015-08-23
Post 74/103

Re: [Pokered] Adding Gender Selection

Any luck yet?

Offline

#61 2015-11-04 19:00:58

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,147/3,512

Re: [Pokered] Adding Gender Selection

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 Mateo (2015-11-04 19:13:47)

Offline

#62 2015-11-05 00:49:41

megamctaco
Member
Registered: 2015-08-23
Post 75/103

Re: [Pokered] Adding Gender Selection

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

#63 2015-11-05 00:54:30

megamctaco
Member
Registered: 2015-08-23
Post 76/103

Re: [Pokered] Adding Gender Selection

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

#64 2015-11-05 00:57:46

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,151/3,512

Re: [Pokered] Adding Gender Selection

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.

Offline

#65 2015-11-05 00:58:17

megamctaco
Member
Registered: 2015-08-23
Post 77/103

Re: [Pokered] Adding Gender Selection

Mateo wrote:

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

#66 2015-11-05 01:03:03

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,152/3,512

Re: [Pokered] Adding Gender Selection

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.

Offline

#67 2015-11-05 01:07:32

Fotomac
Member
Registered: 2015-10-25
Post 56/297

Re: [Pokered] Adding Gender Selection

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

#68 2015-11-05 01:07:55

megamctaco
Member
Registered: 2015-08-23
Post 78/103

Re: [Pokered] Adding Gender Selection

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

#69 2015-11-05 01:10:44

megamctaco
Member
Registered: 2015-08-23
Post 79/103

Re: [Pokered] Adding Gender Selection

Fotomac wrote:

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

#70 2015-11-05 01:18:52

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,154/3,512

Re: [Pokered] Adding Gender Selection

megamctaco wrote:

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 Mateo (2015-11-05 01:20:34)

Offline

#71 2015-11-05 01:32:50

megamctaco
Member
Registered: 2015-08-23
Post 80/103

Re: [Pokered] Adding Gender Selection

Mateo wrote:

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

#72 2015-11-05 01:43:31

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,156/3,512

Re: [Pokered] Adding Gender Selection

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...

Offline

#73 2015-11-05 04:54:25

megamctaco
Member
Registered: 2015-08-23
Post 81/103

Re: [Pokered] Adding Gender Selection

Ha! Changing it to "and a" actually fixed it! Cool! Cheers again, dude!

Offline

#74 2017-08-02 05:01:59

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,500/3,512

Re: [Pokered] Adding Gender Selection

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.

Offline

#75 2017-11-19 01:07:03

TRIFORCE89
Member
Registered: 2013-05-20
Post 15/19

Re: [Pokered] Adding Gender Selection

I'm trying to get this going against pokeyellow, but I am unable to compile. I get the following message:


rgbasm -h -o main.o main.asm
ERROR: main.asm(40) -> engine/oak_speech.asm(99) -> .NotLeaf1(-1):
Macro '.NotLeaf1' not defined
make: *** [main.o] Error 5

What does that mean? How would I define it?

Offline

Board footer

Powered by FluxBB