PDA

View Full Version : Development: Making Dive Work in FireRed


Giga Universe
July 19th, 2011, 08:53 AM
Dive doesn't work in FireRed, I'm not sure if the code is there for it to work, but I suppose we could just write some more, as we could then create things like the underground.
I'm not sure if it helps, but I wrote a routine that finds a connection and stores the map and bank of that connection in a variable. You have to tell it what kind of connection to search for though...
0x5 is a 'Dive' connection, and 0x6 is a 'Emerge' connection.

.text
.align 2
.thumb
.thumb_func

main:
push {r0-r5,lr}
ldr r0, mapheader
ldr r0, [r0,#0xC]
ldr r1, [r0]
ldr r0, [r0,#0x4]
ldr r4, variable
ldrh r5, [r4]
mov r2, #0x0
b search

search:
cmp r1, #0x0
beq notfound
ldrb r3, [r0,r2]
cmp r3, r5
beq found
add r2,#0xC
sub r1, #0x1
b search

notfound:
pop {r0-r5,pc}

found:
add r2, #0x8
ldrb r1, [r0,r2]
add r2, #0x1
ldrb r2, [r0,r2]
lsl r3, r1, #0x8
orr r3, r2
strh r3, [r4]
pop {r0-r5,pc}

.align 2

mapheader:
.word 0x02036DFC

variable:
.word 0x020370D0 @Last result

All we need from here is to make it warp, and then we can make a tile behavior for it or something. I have absolutely no idea how to make it warp, so if someone could help there, then I could make this thing work...

knizz
July 19th, 2011, 12:53 PM
From Underwater: call script 081BE3D4
From Overworld: call script 081BE38B

To connect change the hometown-connection to a dive-connection set 08352754 to 05

To disable the check whether you actually have a dive pokemon with you set the 6 bytes 081BE394-081BE399 to 0. This function also decides which pokemon is shown in the black bar. So if you disable it and see a bad egg. That's because of this.

Disable the badge-check for HMs set 0812462E to 0.

There are two ways to warp. The special one is just used when the behaviour of the tile the player is standing on is 0x19 and when the light byte is set to 0x5. Through different ways the execution can reach 0806DFB0. To avoid that you can destroy the bne/beqs. Write 0000 to 0806DF82 and 0806DF9C. This is not a good solution though. I'm sure there is a reason why these if's are there.

I don't know if the warp destination is correct. But the bank and mapnumber are in the variables 7004 and 7005.

Teh Blazer
July 28th, 2011, 12:01 PM
I may not be the brightest Ampharos in the lighthouse, but how would I make sense of this? Do we have to write a script and put this in, and how do we give stuff tile behaviors?

Putin
July 29th, 2011, 03:45 PM
Perhaps this is flawed somehow, but could this not effectively be done using signpost scripts? You'd have to use it sparingly unless you had the space to spare, but then, using too many dive points is kind of obnoxious anyway.

Lyzo
July 29th, 2011, 04:13 PM
Perhaps this is flawed somehow, but could this not effectively be done using signpost scripts? You'd have to use it sparingly unless you had the space to spare, but then, using too many dive points is kind of obnoxious anyway.You could do that, but if you wanted to make big dive areas like in Ruby and Saphire, this would make the game lag. So putting an ASM routine in the tile behaviour, either using JPAN's engine, or... something else :P Is much more efficient.

If you would like to make Dive work in only one part of your game, then your solution would work ;)

sonic1
July 30th, 2011, 05:11 AM
Why don't you locate one of those useless tile behaviour scripts like the ones that are the TV's talking or something and make a 'goto' (like in asm bx r0 xD ) to the diving scripts?

This way it isn't needed JPAN's engine for it to work. And its more easier IMO.

avolonsaber
October 19th, 2011, 11:46 AM
Wow, I was just about to start a thread about this :3

When it comes to ASM hacking Pokemon games I know nothing, in fact, my ASM knowledge is limited at best, and only limited to the Sonic The Hedgehog titles for the Genesis, lol. If you can port various things from one Sonic title to another though, I'm sure someone could port Dive and it's functionality to Fire Red. Sooo, yeah, if anyone is working on this, keep at it!

DavidJCobb
October 19th, 2011, 07:38 PM
Why don't you locate one of those useless tile behaviour scripts like the ones that are the TV's talking or something and make a 'goto' (like in asm bx r0 xD ) to the diving scripts? Those are actually scripts, not ASM.

As for the DIVE functionality, I can tell you guys that the scripts (as in XSE) for it still exist in FireRed. They don't have any identifiable warp calls, so either the warping results from the field move animation commands, or ASM detects when the script ends and warps then.

If the former, then that would explain why the DIVE field move animation crashes when triggered from script: it needs to read values from some location to know where to warp to, and it's not getting valid ones. Figure out how the field move animation works, and it may then be possible to make DIVE fully-functional.

sonic1
October 20th, 2011, 07:34 AM
I know that they were scripts. I was refering to the 'goto' script command.

About DIVE, i already have a fully functional version, and if you watch carefully, the coordinates are the ones of the player when warping.

(Cheap Test): http://www.youtube.com/watch?v=pZiSs0r9yHI

Hackrex
November 18th, 2011, 07:29 AM
Wow, it´s realy working?
for dive you can insert a new tileset (underwater tileset maybe tiles from kyledove). Ok, I try to make it work on a german rom. I hope I´m succesful.
What do I need in the Script? Should I use any special commands?

//Edit1: Ok, it works on a german rom, too.

//Edit2: Ok, I have written a tutorial. I hope you can understand it. If not please tell me and I would explain it. http://www.pokecommunity.com/showthread.php?t=276031

buggy131313
May 13th, 2012, 12:25 AM
Well, another trick is to have Dive at certain spots make you 'wash up' on some other location. Say, a beach that you warp to.

Lance32497
October 14th, 2014, 06:21 PM
From Underwater: call script 081BE3D4
From Overworld: call script 081BE38B
Good Day knizz, about the quoted one, How to call that offsets? So do I need to call it as a script or something? What is the step by step procedure?

To connect change the hometown-connection to a dive-connection set 08352754 to 05
What is 08352754? Is that 0x352754 offset? And 08 refers to a POINTER? Am I right?



And.... Do I need to insert the ASM code given by giga universe?