Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Trying to insert Running Shoes code from Red++ into Yellow.

#1 2016-11-29 01:52:26

SommenRider
Member
Registered: 2016-11-26
Post 2/14

Trying to insert Running Shoes code from Red++ into Yellow.

.moveAhead2
ld hl,wFlags_0xcd60
res 2,[hl]
ld a,[wWalkBikeSurfState]
dec a ; riding a bike?
jr nz,.normalPlayerSpriteAdvancement
ld a,[wd736]
bit 6,a ; jumping a ledge?
jr nz,.normalPlayerSpriteAdvancement
call BikeSpeedup ; if riding a bike and not jumping a ledge
call BikeSpeedup ; added
call BikeSpeedup ; added
jr .notRunning
.normalPlayerSpriteAdvancement
; Make you surf at bike speed
ld a,[wWalkBikeSurfState]
cp a, $02
jr z, .surfFaster
; Add running shoes
ld a, [hJoyHeld] ; Check what buttons are being pressed
and B_BUTTON ; Are you holding B?
jr z, .notRunning ; If you aren't holding B, skip ahead to step normally.
.surfFaster
call BikeSpeedup ; Make you go faster if you were holding B
.notRunning ; Normal code resumes here
call AdvancePlayerSprite
ld a,[wWalkCounter]
and a
jp nz,CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
call StepCountCheck
CheckEvent EVENT_IN_SAFARI_ZONE ; in the safari zone?
jr z, .notSafariZone
callba SafariZoneCheckSteps
ld a, [wSafariZoneGameOver]
and a
jp nz, WarpFound2

Upon make, I get this in cygwin:

rgbasm -h -o main.o main.asm
rgblink -n pokeyellow.sym -o pokeyellow.gbc audio.o main.o text.o wram.o
C:\cygwin64\usr\local\bin\rgblink.exe: ROM0 section too large
Makefile:47: recipe for target 'pokeyellow.gbc' failed
make: *** [pokeyellow.gbc] Error 1

This is apparently the same issue Fotomac experienced here. So what would I need to move out of home.asm?

Offline

#2 2016-11-29 02:53:01

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

Re: Trying to insert Running Shoes code from Red++ into Yellow.

One simple way to save some space in bank 0 is to put Mart data in with the rest of the scripts on their map instead of putting them all together in bank 0 like they are by default. You'll notice that instead of a single file with all mart inventories inside it, Red++ has a folder where each mart has its own .asm file for its inventory. Still simple to find and edit them if you need to change a mart, and frees up precious space in bank 0.

Offline

#3 2016-11-29 07:51:26

SommenRider
Member
Registered: 2016-11-26
Post 3/14

Re: Trying to insert Running Shoes code from Red++ into Yellow.

Is it as simple as just deleting "INCLUDE "data/mart_inventories.asm" from home.asm and splitting them into their own files?

Offline

#4 2016-11-29 12:53:20

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

Re: Trying to insert Running Shoes code from Red++ into Yellow.

Yeah, then just INCLUDE the new files alongside the other scripts for those maps.

Offline

#5 2016-11-29 16:00:56

SommenRider
Member
Registered: 2016-11-26
Post 4/14

Re: Trying to insert Running Shoes code from Red++ into Yellow.

Now it assembles, but the injected code doesn't seem to work - pressing B doesn't speed up, but it's also at the very start of the game. Do I need to already have the bike for the game to be able to call BikeSpeedup at all?

Offline

#6 2016-11-29 16:12:20

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

Re: Trying to insert Running Shoes code from Red++ into Yellow.

You don't need to have the bike for this to work. You are holding B down while walking, not just pressing it once and expecting that to toggle it on and off or something, right? Normal running shoes make you go faster while holding B, but the way you worded it made me think you might be confused.

If that still doesn't work, might be some other difference between red and yellow, I haven't looked at how yellow's version of that routine originally looked. Also, faster surfing might be causing an issue too, since Red++ doesn't have a separate state for Surfing Pikachu, so that might be different.

Last edited by Mateo (2016-11-29 16:13:58)

Offline

#7 2016-11-29 17:32:12

SommenRider
Member
Registered: 2016-11-26
Post 5/14

Re: Trying to insert Running Shoes code from Red++ into Yellow.

Yeah, I'm holding down B. But I think you're right, because here's the original section for R/B vs Yellow (only relevant parts quoted):

Red/Blue wrote:

.moveAhead2
ld hl,wFlags_0xcd60
res 2,[hl]
ld a,[wWalkBikeSurfState]
dec a ; riding a bike?
jr nz,.normalPlayerSpriteAdvancement
ld a,[wd736]
bit 6,a ; jumping a ledge?
jr nz,.normalPlayerSpriteAdvancement
call DoBikeSpeedup
.normalPlayerSpriteAdvancement
call AdvancePlayerSprite
ld a,[wWalkCounter]
and a
jp nz,CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
DoBikeSpeedup::
ld a,[wNPCMovementScriptPointerTableNum]
and a
ret nz
ld a,[wCurMap]
cp ROUTE_17 ; Cycling Road
jr nz,.goFaster
ld a,[hJoyHeld]
and D_UP | D_LEFT | D_RIGHT
ret nz
.goFaster
jp AdvancePlayerSprite

Yellow wrote:

.moveAhead2
ld hl, wFlags_0xcd60
res 2, [hl]
xor a
ld [wd435], a
call DoBikeSpeedup
call AdvancePlayerSprite
ld a, [wWalkCounter]
and a
jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
DoBikeSpeedup::
ld a, [wWalkBikeSurfState]
dec a ; riding a bike?
ret nz
ld a, [wd736]
bit 6, a
ret nz
ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
jr nz, .goFaster
ld a, [hJoyHeld]
and D_UP | D_LEFT | D_RIGHT
ret nz
.goFaster
call AdvancePlayerSprite
ret

So should I be sticking "ld a,[wWalkBikeSurfState]
dec a ; riding a bike?
jr nz,.normalPlayerSpriteAdvancement
ld a,[wd736]
bit 6,a ; jumping a ledge?
jr nz,.normalPlayerSpriteAdvancement" into DoBikeSpeedup?

EDIT: Deleted the extra lines instead from DoBikeSpeedup and it works fine for now! Thanks!

Last edited by SommenRider (2016-11-29 17:39:58)

Offline

#8 2016-11-29 17:53:34

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

Re: Trying to insert Running Shoes code from Red++ into Yellow.

Glad it seems like it is working.

Offline

#9 2016-11-29 18:06:29

SommenRider
Member
Registered: 2016-11-26
Post 6/14

Re: Trying to insert Running Shoes code from Red++ into Yellow.

Would removing the 'xor a' from the original .moveAhead2 affect anything later on, though?

Offline

#10 2016-11-29 19:10:09

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

Re: Trying to insert Running Shoes code from Red++ into Yellow.

It would affect something right then, by not setting "a" to 0 before storing it somewhere in the next line.

Offline

#11 2016-11-29 21:29:46

SommenRider
Member
Registered: 2016-11-26
Post 7/14

Re: Trying to insert Running Shoes code from Red++ into Yellow.

So which is better of these two:

.moveAhead2
ld hl, wFlags_0xcd60
res 2, [hl]
ld a,[wWalkBikeSurfState]
dec a ; riding a bike?
jr nz,.normalPlayerSpriteAdvancement
ld a,[wd736]
bit 6,a ; jumping a ledge?
jr nz,.normalPlayerSpriteAdvancement
xor a
ld [wd435], a
call BikeSpeedup ; if riding a bike and not jumping a ledge
call BikeSpeedup ; added
call BikeSpeedup ; added
jr .notRunning
.normalPlayerSpriteAdvancement
; Make you surf at bike speed
ld a,[wWalkBikeSurfState]
cp a, $02
jr z, .surfFaster
; Add running shoes
ld a, [hJoyHeld] ; Check what buttons are being pressed
and B_BUTTON ; Are you holding B?
jr z, .notRunning ; If you aren't holding B, skip ahead to step normally.
.surfFaster
call BikeSpeedup ; Make you go faster if you were holding B
.notRunning ; Normal code resumes here
call AdvancePlayerSprite
ld a, [wWalkCounter]
and a
jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
BikeSpeedup::
ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
jr nz, .goFaster
ld a, [hJoyHeld]
and D_UP | D_LEFT | D_RIGHT
ret nz
.goFaster
call AdvancePlayerSprite
ret

or

.moveAhead2
ld hl, wFlags_0xcd60
res 2, [hl]
xor a
ld [wd435], a
call BikeSpeedup
call BikeSpeedup
call BikeSpeedup
.normalPlayerSpriteAdvancement
; Make you surf at bike speed
ld a,[wWalkBikeSurfState]
cp a, $02
jr z, .surfFaster
; Add running shoes
ld a, [hJoyHeld] ; Check what buttons are being pressed
and B_BUTTON ; Are you holding B?
jr z, .notRunning ; If you aren't holding B, skip ahead to step normally.
.surfFaster
call BikeSpeedup ; Make you go faster if you were holding B
.notRunning ; Normal code resumes here
call AdvancePlayerSprite
ld a, [wWalkCounter]
and a
jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
BikeSpeedup::
ld a,[wWalkBikeSurfState]
dec a ; riding a bike?
jr nz,.normalPlayerSpriteAdvancement
ld a,[wd736]
bit 6,a ; jumping a ledge?
jr nz,.normalPlayerSpriteAdvancement
ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
jr nz, .goFaster
ld a, [hJoyHeld]
and D_UP | D_LEFT | D_RIGHT
ret nz
.goFaster
call AdvancePlayerSprite
ret

Offline

  • Index
  • → Help/Question
  • → Trying to insert Running Shoes code from Red++ into Yellow.

Board footer

Powered by FluxBB