The PokéCommunity Forums Fan Games ROM Hacking Research & Development
Development Making Dive Work in FireRed

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!


Reply
 
Thread Tools
  #1    
Old July 19th, 2011 (8:53 AM).
Giga Universe's Avatar
Giga Universe Giga Universe is offline
Working on a tool.
 
Join Date: Aug 2007
Location: South Africa
Age: 23
Gender: Male
Nature: Calm
Posts: 121
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.

Code:
.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...
__________________
Reply With Quote

Relevant Advertising!

  #2    
Old July 19th, 2011 (12:53 PM). Edited July 19th, 2011 by knizz.
knizz's Avatar
knizz knizz is offline
     
    Join Date: Aug 2007
    Gender: Female
    Posts: 192
    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.
    __________________
    Firered IDA 6.6 DB: https://www.dropbox.com/s/d856o3pyndyr5sr/firered.idb
    VBA-M with lua scripting support
    incomplete firered decompilation
    Reply With Quote
      #3    
    Old July 28th, 2011 (12:01 PM). Edited July 29th, 2011 by Teh Blazer.
    Teh Blazer's Avatar
    Teh Blazer Teh Blazer is offline
    Divider of Zero
       
      Join Date: Feb 2009
      Location: 'MERICA
      Age: 23
      Gender: Male
      Nature: Relaxed
      Posts: 777
      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?
      __________________
      Being a hero is overrated anyways
      Reply With Quote
        #4    
      Old July 29th, 2011 (3:45 PM).
      Putin's Avatar
      Putin Putin is offline
      Anspruchsvolle Narr
         
        Join Date: Dec 2010
        Location: Florida
        Gender: Male
        Nature: Brave
        Posts: 52
        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.
        Reply With Quote
          #5    
        Old July 29th, 2011 (4:13 PM).
        Lyzo's Avatar
        Lyzo Lyzo is offline
        On vacation
           
          Join Date: Mar 2007
          Location: The Netherlands
          Age: 23
          Gender: Male
          Nature: Bold
          Posts: 252
          Quote:
          Originally Posted by Putin View Post
          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 ;)
          __________________


          ^^ Thank you The Blueprint !!!
          Reply With Quote
            #6    
          Old July 30th, 2011 (5:11 AM).
          sonic1's Avatar
          sonic1 sonic1 is offline
          ASM is my life now...
             
            Join Date: May 2008
            Location: Portugal
            Age: 23
            Gender: Male
            Nature: Timid
            Posts: 79
            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.
            __________________
            This signature has been disabled.
            over 350px high
            Please review and fix the issues by reading the signature rules.

            You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

            Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
            Reply With Quote
              #7    
            Old October 19th, 2011 (11:46 AM).
            avolonsaber avolonsaber is offline
               
              Join Date: Oct 2010
              Posts: 182
              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!
              Reply With Quote
                #8    
              Old October 19th, 2011 (7:38 PM).
              Missingyep Missingyep is offline
                 
                Join Date: Jul 2010
                Posts: 275
                Quote:
                Originally Posted by sonic1 View Post
                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.
                Reply With Quote
                  #9    
                Old October 20th, 2011 (7:34 AM).
                sonic1's Avatar
                sonic1 sonic1 is offline
                ASM is my life now...
                   
                  Join Date: May 2008
                  Location: Portugal
                  Age: 23
                  Gender: Male
                  Nature: Timid
                  Posts: 79
                  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
                  __________________
                  This signature has been disabled.
                  over 350px high
                  Please review and fix the issues by reading the signature rules.

                  You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

                  Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
                  Reply With Quote
                    #10    
                  Old November 18th, 2011 (7:29 AM). Edited March 18th, 2012 by Hackrex.
                  Hackrex Hackrex is offline
                     
                    Join Date: Aug 2007
                    Gender:
                    Posts: 35
                    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
                    __________________
                    Temporarily not available
                    Reply With Quote
                      #11    
                    Old May 13th, 2012 (12:25 AM).
                    buggy131313 buggy131313 is offline
                       
                      Join Date: May 2012
                      Posts: 2
                      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.
                      Reply With Quote
                        #12    
                      Old October 14th, 2014 (6:21 PM). Edited October 14th, 2014 by Lance32497.
                      Lance32497's Avatar
                      Lance32497 Lance32497 is offline
                      LanceKoijer of Pokemon_Addicts
                         
                        Join Date: Aug 2014
                        Location: Criscanto town-Ginoa Region xD
                        Gender: Male
                        Nature: Adamant
                        Posts: 793
                        Quote:
                        Originally Posted by knizz View Post
                        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?

                        Quote:
                        Originally Posted by knizz View Post
                        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?
                        Reply With Quote
                          #13    
                        Old May 12th, 2016 (7:40 PM).
                        MartinTheHuman MartinTheHuman is offline
                           
                          Join Date: Apr 2015
                          Gender: Male
                          Posts: 49
                          Any progress on this?
                          Reply With Quote
                            #14    
                          Old May 13th, 2016 (6:42 AM).
                          BluRose BluRose is offline
                          blu rass
                             
                            Join Date: Apr 2014
                            Location: hyakkoku city
                            Age: 17
                            Gender: Male
                            Nature: Timid
                            Posts: 738
                            Quote:
                            Originally Posted by MartinTheHuman View Post
                            Any progress on this?
                            It's complete, I believe...
                            __________________
                            am i cool yet
                            Reply With Quote
                              #15    
                            Old August 1st, 2016 (12:32 PM). Edited April 6th, 2017 by Spherical Ice.
                            NicolasLukas NicolasLukas is offline
                               
                              Join Date: Aug 2015
                              Location: Germany
                              Gender: Male
                              Nature: Relaxed
                              Posts: 164
                              So how do you add the HM Dive in Pokemon Firered exactly. I have no idea how do do it. Can anybody help me, please?

                              I have no idea how to make this work properly:(

                              Okay, now it works :D :D :D
                              Yeah!
                              The only problem is the surfing sprite, that´s all.
                              Reply With Quote
                                #16    
                              Old April 7th, 2017 (11:57 AM). Edited March 27th, 2018 by Spherical Ice.
                              Spherical Ice's Avatar
                              Spherical Ice Spherical Ice is online now
                               
                              Join Date: Nov 2007
                              Location: Bristol, UK
                              Age: 20
                              Posts: 5,220

                              FireRed Dive


                              Download and fully extract the .zip file attached to this post.
                              Load firered_dive.asm in your text editor of choice and follow its instructions.

                              The attached download simply contains the file firered_dive.asm (found in the spoiler below and at https://pastebin.com/raw/1yjWuuuz), Lunar IPS, and base.gba (simply a 0xFFFFFF-sized file of just 0xFF bytes -- the .gba extension is just for simplicity's sake as it will mean Lunar IPS lists it by default).


                              Spoiler: firered_dive.asm
                              Code:
                              .thumb
                              .global firered_dive
                              
                              @ FireRed v1.0 HM08 DIVE Port
                              @ Credits: Spherical Ice, Squeetz
                              
                              @ CHANGE THESE:
                              .equ offset, 0x800000 @ ROM address of 0x1D8 bytes of free space
                              .equ OW_MALE_DIVE, 14 @ male player's diving overworld sprite number
                              .equ OW_FEMALE_DIVE, 15 @ female player's diving overworld sprite number
                              .equ FLAG_ALLOW_DIVE, 0x827 @ flag which allows the use of Dive
                              @ YOU MUST CHANGE THE ABOVE VALUES
                              
                              @ INSTALL:
                              @ 1. Change the .equ values above, labelled CHANGE THESE
                              @ 2. If you wish to disable badge checking, follow the DISABLE BADGE CHECKING instructions below
                              @ 3. Save this file
                              @ 4. Assemble this file using the following command:
                              @ thumb firered_dive.s firered_dive.gba
                              @ 5. Create a .IPS patch using Lunar IPS:
                              @ Use the included base.gba file as the base ROM
                              @ Use the newly generated firered_dive.gba file as the modified ROM
                              @ 6. Patch your FireRed v1.0 ROM with the generated .IPS patch
                              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                              
                              @ DISABLE BADGE CHECKS:
                              @ Find and remove the appropriately labelled lines of code below
                              @ Ctrl + F: REMOVE THE FOLLOWING 5 LINES TO DISABLE BADGE CHECK
                              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                              
                              @ MAKE DIVE POSSIBLE IN MAPS:
                              @ Set the second behaviour byte of Dive-able tiles to the value of DIVE_TILE_BYTE below (0x23 by default)
                              @ Set their second behaviour byte of Emerge-able tiles to the value of EMERGE_TILE_BYTE below (0x24 by default)
                              @ Set underwater maps' light level (the Type: field in the Header view on AdvanceMap) to Underwater (0x5)
                              @ Create Emerge map connections to underwater maps leading to their surface maps
                              @ Create Dive map connections to surface maps leading to their underwater maps
                              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                              
                              @ Changing these is optional (they are the default FireRed currently)
                              .equ OW_MALE_WALK, 0 @ male player's normal, walking overworld sprite number
                              .equ OW_MALE_CYCLE, 1 @ male player's cycling overworld sprite number
                              .equ OW_MALE_SURF, 2 @ male player's surfing/"sat down" overworld sprite number
                              .equ OW_MALE_ITEM_0, 3 @ male player's first item usage overworld sprite number
                              .equ OW_MALE_FISH, 4 @ male player's fishing overworld sprite number
                              .equ OW_MALE_ITEM_1, 5 @ male player's second item usage overworld sprite number
                              .equ OW_FEMALE_WALK, 7 @ female player's normal, walking overworld sprite number
                              .equ OW_FEMALE_CYCLE, 8 @ female player's cycling overworld sprite number
                              .equ OW_FEMALE_SURF, 9 @ female player's surfing/"sat down" overworld sprite number
                              .equ OW_FEMALE_ITEM_0, 10 @ female player's first item usage overworld sprite number
                              .equ OW_FEMALE_FISH, 11 @ female player's fishing overworld sprite number
                              .equ OW_FEMALE_ITEM_1, 12 @ female player's second item usage overworld sprite number
                              .equ DIVE_TILE_BYTE, 0x23 @ second behaviour byte value for diving
                              .equ EMERGE_TILE_BYTE, 0x24 @ second behaviour byte value for emerging
                              .equ FLAG_ALLOW_RUN, 0x82F @ flag which allows the use of the Running Shoes
                              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                              
                              @ DO NOT CHANGE THESE VALUES:
                              .equ rom, 0x08000000
                              @ DO NOT CHANGE THE ABOVE VALUES
                              
                              @ Hooks and branches
                              .org 0x5BA30, 0xFF
                                  ldr r0, =(disable_running_underwater + rom + 1)
                                  bx r0
                              .pool
                              
                              .org 0x5C7F4, 0xFF
                                  .word player_overworld_list + rom
                              
                              .org 0x5C826, 0xFF
                                  ldr r1, =(get_gender_from_sprite + rom + 1)
                                  bx r1
                              .pool
                              
                              .org 0x5C9B0, 0xFF
                                  .word walkrun_overworld_list + rom
                              
                              .org 0x5C9BA, 0xFF
                                  cmp r2, #3
                              
                              .org 0x5C9F4, 0xFF
                                  .word walkrun_overworld_list + rom
                              
                              .org 0x6CB30, 0xFF
                                  ldr r0, =(check_for_events + rom + 1)
                                  bx r0
                              .pool
                                  
                              .org 0x6CCCC, 0xFF
                                  ldr r1, =(check_dive + rom + 1)
                                  bx r1
                              .pool
                              
                              .org 0x6DF78, 0xFF
                                  b 0x6DF84
                              
                              .org 0x35B854, 0xFF
                                  .word change_sprite_to_diving + rom + 1
                              
                              .org 0x471EEC, 0xFF
                                  .word player_behaviour_dive + rom + 1
                              
                              .org offset, 0xFF
                              @ New data
                              player_overworld_list:
                                  .byte OW_MALE_WALK, OW_FEMALE_WALK
                                  .byte OW_MALE_CYCLE, OW_FEMALE_CYCLE
                                  .byte OW_MALE_SURF, OW_FEMALE_SURF
                                  .byte OW_MALE_ITEM_0, OW_FEMALE_ITEM_0
                                  .byte OW_MALE_FISH, OW_FEMALE_FISH
                                  .byte OW_MALE_ITEM_1, OW_FEMALE_ITEM_1
                                  .byte OW_MALE_DIVE, OW_FEMALE_DIVE
                              
                              walkrun_overworld_list:
                                  .byte OW_MALE_WALK, 0b00001
                                  .byte OW_MALE_CYCLE, 0b00010
                                  .byte OW_MALE_SURF, 0b01000
                                  .byte OW_MALE_DIVE, 0b10000
                                  .byte OW_FEMALE_WALK, 0b00001
                                  .byte OW_FEMALE_CYCLE, 0b00010
                                  .byte OW_FEMALE_SURF, 0b01000
                                  .byte OW_FEMALE_DIVE, 0b10000
                              
                              @ New code
                              disable_running_underwater:
                              	ldr r6, =(0x02037078) @ walkrun_state
                              	ldrb r1, [r6, #0] @ walkrun->bitfield
                              	mov r0, #16
                              	and r0, r1
                              	cmp r0, #0
                              	bne i_forgot_what_this_label_is
                              	mov r0, #2
                              	and r5, r0
                              	cmp r5, #0
                              	beq cannot_run
                              	ldr r0, =(FLAG_ALLOW_RUN)
                              	ldr r3, =(0x0806E6D0+1) @ flag_check
                              	bl call_via_r3
                              	lsl r0, r0, #24
                              	lsr r0, r0, #24
                              	cmp r0, #0
                              	beq cannot_run
                              	ldr r2, =(0x02036E38) @ npc_states
                              	ldrb r1, [r6, #5]
                              	lsl r0, r1, #3
                              	add r0, r0, r1
                              	lsl r0, r0, #2
                              	add r0, r0, r2
                              	ldrb r0, [r0, #30]
                              	ldr r3, =(0x080BD488+1) @ is_tile_to_run_on
                              	bl call_via_r3
                              	cmp r0, #0
                              	bne cannot_run
                              
                              can_run:
                              	ldr r0, =(0x0805BA5A+1)
                              	bx r0
                              
                              i_forgot_what_this_label_is:
                              	ldr r0, =(0x0805BA9E+1)
                              	bx r0
                              
                              cannot_run:
                              	ldr r0, =(0x0805BA8C+1)
                              	bx r0
                              
                              .pool
                              
                              get_gender_from_sprite:
                                  lsl r0, r0, #24
                                  lsr r0, r0, #24
                                  cmp r0, #OW_MALE_DIVE
                                  beq male
                                  cmp r0, #OW_FEMALE_DIVE
                                  beq female
                                  cmp r0, #OW_FEMALE_FISH
                                  bgt male
                                  cmp r0, #OW_FEMALE_WALK
                                  blt male
                              
                              female:
                                  mov r0, #1
                                  b return_to_x5C838
                                  
                              male:
                                  mov r0, #0
                                  
                              return_to_x5C838:
                                  ldr r1, =(0x0805C838 + 1)
                                  bx r1
                              .pool
                              
                              check_for_events:
                                  mov r0, #0x80
                                  and r0, r1
                                  cmp r0, #0
                                  beq check_aftermove
                                  bl consider_dive_emerging
                                  cmp r0, #1
                                  beq something_happened
                              
                              check_aftermove:
                                  ldrb r1, [r5]
                                  mov r0, #0x40
                                  and r0, r1
                                  cmp r0, #0
                                  beq check_move
                                  ldr r0, =(0x0806CB38 + 1)
                                  bx r0
                                  
                              something_happened:
                                  ldr r0, =(0x0806CB6C + 1)
                                  bx r0
                                  
                              check_move:
                                  ldr r0, =(0x0806CB74 + 1)
                                  bx r0
                              .pool
                              
                              consider_dive_emerging:
                                  push {lr}
                              @ REMOVE THE FOLLOWING 5 LINES TO DISABLE BADGE CHECK 
                                  ldr r0, =(FLAG_ALLOW_DIVE)
                                  ldr r1, =(0x0806E6D0 + 1) @ checkflag
                                  bl call_via_r1
                                  cmp r0, #0
                                  beq no_emerging
                              @ REMOVE THE ABOVE 5 LINES TO DISABLE BADGE CHECK
                                  ldr r0, =(0x02036DFC) @ map_header
                                  ldrb r0, [r0, #23] @ map_header->light_level
                                  cmp r0, #5
                                  bne no_emerging
                                  bl get_block_secondary_role
                                  cmp r0, #EMERGE_TILE_BYTE
                                  bne no_emerging
                                  ldr r0, =(0x081BE3D4) @ emerge_script
                                  ldr r1, =(0x08069AE4 + 1) @ script_start
                                  bl call_via_r1
                                  mov r0, #1
                                  b dive_return
                                  
                              no_emerging:
                                  mov r0, #0
                              
                              dive_return:
                                  pop {r1}
                                  bx r1
                              .pool
                              
                              check_dive:
                                  ldrb r1, [r5]
                                  mov r0, #1
                                  and r0, r1
                                  cmp r0, #0
                                  beq no_dive
                                  bl consider_diving
                                  cmp r0, #1
                                  beq something_happened
                              
                              no_dive:
                                  ldrb r1, [r5]
                                  mov r0, #4
                                  and r0, r1
                                  cmp r0, #0
                                  beq something
                                  ldr r2, =(0x0806CCD6 + 1)
                                  bx r2
                                  
                              something:
                                  ldr r0, =(0x0806CCFC + 1)
                                  bx r0
                              .pool
                                  
                              consider_diving:
                                  push {lr}
                              @ REMOVE THE FOLLOWING 5 LINES TO DISABLE BADGE CHECK
                                  ldr r0, =(FLAG_ALLOW_DIVE)
                                  ldr r1, =(0x0806E6D0 + 1) @ checkflag
                                  bl call_via_r1
                                  cmp r0, #0
                                  beq cant_dive
                              @ REMOVE THE ABOVE 5 LINES TO DISABLE BADGE CHECK
                                  bl get_block_secondary_role
                                  cmp r0, #DIVE_TILE_BYTE
                                  bne cant_dive
                                  ldr r0, =(0x081BE38B) @ dive_script
                                  ldr r1, =(0x08069AE4 + 1) @ script_start
                                  bl call_via_r1
                                  mov r0, #1
                                  b dive_pop
                                  
                              cant_dive:
                                  mov r0, #0
                              
                              dive_pop:
                                  pop {r1}
                                  bx r1
                              .pool
                              
                              get_block_secondary_role:
                                  push {r4, lr}
                                  sub sp, sp, #4
                                  mov r4, sp
                                  add r4, #2
                                  mov r0, sp
                                  mov r1, r4    
                                  ldr r3, =(0x0805C538 + 1) @ player_get_pos_to
                                  bl call_via_r3
                                  mov r0, sp
                                  mov r1, #0
                                  ldsh r0, [r0, r1]
                                  mov r2, #0
                                  ldsh r1, [r4, r2]
                                  lsl r0, r0, #16
                                  asr r0, r0, #16
                                  lsl r1, r1, #16
                                  asr r1, r1, #16
                                  mov r2, #8
                                  ldr r3, =(0x08058F48 + 1) @ cur_mapdata_block_get_field_at
                                  bl call_via_r3
                                  lsl r0, r0, #16
                                  lsr r0, r0, #24
                                  add sp, sp, #4
                                  pop {r4}
                                  pop {r1}
                                  bx r1
                              .pool
                              
                              player_behaviour_dive:
                                  push {r4, lr}
                                  ldr r0, =(0x02037078) @ walkrun_state
                                  ldrb r0, [r0, #5] @ walkrun_state->npcid
                                  lsl r4, r0, #3
                                  add r4, r4, r0
                                  lsl r4, r4, #2
                                  ldr r0, =(0x02036E38) @ npc_states
                                  add r4, r4, r0
                                  mov r0, #6
                                  ldr r3, =(0x0805C808 + 1) @ get_sprite_for_player
                                  bl call_via_r3
                                  add r1, r0, #0
                                  lsl r1, r1, #24
                                  lsr r1, r1, #24
                                  add r0, r4, #0
                                  ldr r3, =(0x081507BC + 1) @ npc_change_sprite_call
                                  bl call_via_r3
                                  ldrb r1, [r4, #24]
                                  lsr r1, r1, #4
                                  add r0, r4, #0
                                  ldr r3, =(0x0805F218 + 1) @ npc_turn
                                  bl call_via_r3
                                  mov r0, #16
                                  ldr r3, =(0x0805C970 + 1) @ change_sprite_bitfield
                                  bl call_via_r3
                                  ldrb r0, [r4, #4]
                                  ldr r3, =(0x080DC6B0 + 1) @ bobbing
                                  bl call_via_r3
                                  strb r0,[r4, #26]
                                  pop {r4}
                                  pop {r0}
                                  bx r0
                              .pool
                              
                              change_sprite_to_diving:
                                  push {lr}
                                  mov r0, #4
                              
                              set:
                                  ldr r1, =(0x08150498 + 1) @ set_player_behaviour
                                  bl call_via_r1
                                  pop {r1}
                              
                              call_via_r1:
                                  bx r1
                              
                              call_via_r3:
                                  bx r3
                              .pool
                              
                              .org 0xFFFFFF, 0xFF
                              .byte 0xFF
                              
                              Attached Files
                              File Type: zip firered_dive.zip‎ (156.4 KB, 14 views) (Save to Dropbox)
                              __________________

                              A Pokemon that is discriminated!
                              Support squirtle and make it everyone's favourite.
                              Reply With Quote
                                #17    
                              Old April 10th, 2017 (9:31 PM). Edited February 5th, 2018 by Mateo.
                              XD XD XD XD XD's Avatar
                              XD XD XD XD XD XD XD XD XD XD is offline
                                 
                                Join Date: Nov 2015
                                Gender: Male
                                Posts: 15
                                it looks like the original, thanks spherical ice :)

                                EDIT: how to insert this at FR? it's complicated :3
                                Reply With Quote
                                  #18    
                                Old March 27th, 2018 (7:58 AM).
                                Spherical Ice's Avatar
                                Spherical Ice Spherical Ice is online now
                                 
                                Join Date: Nov 2007
                                Location: Bristol, UK
                                Age: 20
                                Posts: 5,220
                                Quote:
                                Originally Posted by Spherical Ice View Post

                                FireRed Dive

                                Bumping again, I added a routine which force prevents running when underwater because it was still possible despite B being used for emerging if you started walking first. This is somewhat untested on a clean ROM so confirmation it works would be appreciated. I'm fairly certain it should work fine, though.
                                __________________

                                A Pokemon that is discriminated!
                                Support squirtle and make it everyone's favourite.
                                Reply With Quote
                                  #19    
                                Old May 16th, 2018 (10:24 PM).
                                BirdstarCat13's Avatar
                                BirdstarCat13 BirdstarCat13 is offline
                                Furret-loving Iskallian
                                   
                                  Join Date: Nov 2017
                                  Location: RenSkall island
                                  Gender: Male
                                  Nature: Timid
                                  Posts: 353
                                  Couldn't you just use AdvanceMap? There's an option to create Dive/Emerge connections...
                                  __________________
                                  -------------------------
                                  I hate signatures that are just a line of text without any clear division.
                                  Reply With Quote
                                    #20    
                                  Old May 17th, 2018 (7:27 AM).
                                  Spherical Ice's Avatar
                                  Spherical Ice Spherical Ice is online now
                                   
                                  Join Date: Nov 2007
                                  Location: Bristol, UK
                                  Age: 20
                                  Posts: 5,220
                                  Quote:
                                  Originally Posted by BirdstarCat13 View Post
                                  Couldn't you just use AdvanceMap? There's an option to create Dive/Emerge connections...
                                  The Dive/Emerge connections work in FRLG, but everything else about Dive doesn't work without the work mentioned above.
                                  __________________

                                  A Pokemon that is discriminated!
                                  Support squirtle and make it everyone's favourite.
                                  Reply With Quote
                                    #21    
                                  Old 2 Weeks Ago (9:56 PM).
                                  jbmaster21's Avatar
                                  jbmaster21 jbmaster21 is offline
                                     
                                    Join Date: Jul 2017
                                    Posts: 24
                                    Quote:
                                    Originally Posted by Spherical Ice View Post

                                    FireRed Dive


                                    Download and fully extract the .zip file attached to this post.
                                    Load firered_dive.asm in your text editor of choice and follow its instructions.

                                    The attached download simply contains the file firered_dive.asm (found in the spoiler below and at https://pastebin.com/raw/1yjWuuuz), Lunar IPS, and base.gba (simply a 0xFFFFFF-sized file of just 0xFF bytes -- the .gba extension is just for simplicity's sake as it will mean Lunar IPS lists it by default).


                                    Spoiler: firered_dive.asm
                                    Code:
                                    .thumb
                                    .global firered_dive
                                    
                                    @ FireRed v1.0 HM08 DIVE Port
                                    @ Credits: Spherical Ice, Squeetz
                                    
                                    @ CHANGE THESE:
                                    .equ offset, 0x800000 @ ROM address of 0x1D8 bytes of free space
                                    .equ OW_MALE_DIVE, 14 @ male player's diving overworld sprite number
                                    .equ OW_FEMALE_DIVE, 15 @ female player's diving overworld sprite number
                                    .equ FLAG_ALLOW_DIVE, 0x827 @ flag which allows the use of Dive
                                    @ YOU MUST CHANGE THE ABOVE VALUES
                                    
                                    @ INSTALL:
                                    @ 1. Change the .equ values above, labelled CHANGE THESE
                                    @ 2. If you wish to disable badge checking, follow the DISABLE BADGE CHECKING instructions below
                                    @ 3. Save this file
                                    @ 4. Assemble this file using the following command:
                                    @ thumb firered_dive.s firered_dive.gba
                                    @ 5. Create a .IPS patch using Lunar IPS:
                                    @ Use the included base.gba file as the base ROM
                                    @ Use the newly generated firered_dive.gba file as the modified ROM
                                    @ 6. Patch your FireRed v1.0 ROM with the generated .IPS patch
                                    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                    
                                    @ DISABLE BADGE CHECKS:
                                    @ Find and remove the appropriately labelled lines of code below
                                    @ Ctrl + F: REMOVE THE FOLLOWING 5 LINES TO DISABLE BADGE CHECK
                                    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                    
                                    @ MAKE DIVE POSSIBLE IN MAPS:
                                    @ Set the second behaviour byte of Dive-able tiles to the value of DIVE_TILE_BYTE below (0x23 by default)
                                    @ Set their second behaviour byte of Emerge-able tiles to the value of EMERGE_TILE_BYTE below (0x24 by default)
                                    @ Set underwater maps' light level (the Type: field in the Header view on AdvanceMap) to Underwater (0x5)
                                    @ Create Emerge map connections to underwater maps leading to their surface maps
                                    @ Create Dive map connections to surface maps leading to their underwater maps
                                    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                    
                                    @ Changing these is optional (they are the default FireRed currently)
                                    .equ OW_MALE_WALK, 0 @ male player's normal, walking overworld sprite number
                                    .equ OW_MALE_CYCLE, 1 @ male player's cycling overworld sprite number
                                    .equ OW_MALE_SURF, 2 @ male player's surfing/"sat down" overworld sprite number
                                    .equ OW_MALE_ITEM_0, 3 @ male player's first item usage overworld sprite number
                                    .equ OW_MALE_FISH, 4 @ male player's fishing overworld sprite number
                                    .equ OW_MALE_ITEM_1, 5 @ male player's second item usage overworld sprite number
                                    .equ OW_FEMALE_WALK, 7 @ female player's normal, walking overworld sprite number
                                    .equ OW_FEMALE_CYCLE, 8 @ female player's cycling overworld sprite number
                                    .equ OW_FEMALE_SURF, 9 @ female player's surfing/"sat down" overworld sprite number
                                    .equ OW_FEMALE_ITEM_0, 10 @ female player's first item usage overworld sprite number
                                    .equ OW_FEMALE_FISH, 11 @ female player's fishing overworld sprite number
                                    .equ OW_FEMALE_ITEM_1, 12 @ female player's second item usage overworld sprite number
                                    .equ DIVE_TILE_BYTE, 0x23 @ second behaviour byte value for diving
                                    .equ EMERGE_TILE_BYTE, 0x24 @ second behaviour byte value for emerging
                                    .equ FLAG_ALLOW_RUN, 0x82F @ flag which allows the use of the Running Shoes
                                    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                    
                                    @ DO NOT CHANGE THESE VALUES:
                                    .equ rom, 0x08000000
                                    @ DO NOT CHANGE THE ABOVE VALUES
                                    
                                    @ Hooks and branches
                                    .org 0x5BA30, 0xFF
                                        ldr r0, =(disable_running_underwater + rom + 1)
                                        bx r0
                                    .pool
                                    
                                    .org 0x5C7F4, 0xFF
                                        .word player_overworld_list + rom
                                    
                                    .org 0x5C826, 0xFF
                                        ldr r1, =(get_gender_from_sprite + rom + 1)
                                        bx r1
                                    .pool
                                    
                                    .org 0x5C9B0, 0xFF
                                        .word walkrun_overworld_list + rom
                                    
                                    .org 0x5C9BA, 0xFF
                                        cmp r2, #3
                                    
                                    .org 0x5C9F4, 0xFF
                                        .word walkrun_overworld_list + rom
                                    
                                    .org 0x6CB30, 0xFF
                                        ldr r0, =(check_for_events + rom + 1)
                                        bx r0
                                    .pool
                                        
                                    .org 0x6CCCC, 0xFF
                                        ldr r1, =(check_dive + rom + 1)
                                        bx r1
                                    .pool
                                    
                                    .org 0x6DF78, 0xFF
                                        b 0x6DF84
                                    
                                    .org 0x35B854, 0xFF
                                        .word change_sprite_to_diving + rom + 1
                                    
                                    .org 0x471EEC, 0xFF
                                        .word player_behaviour_dive + rom + 1
                                    
                                    .org offset, 0xFF
                                    @ New data
                                    player_overworld_list:
                                        .byte OW_MALE_WALK, OW_FEMALE_WALK
                                        .byte OW_MALE_CYCLE, OW_FEMALE_CYCLE
                                        .byte OW_MALE_SURF, OW_FEMALE_SURF
                                        .byte OW_MALE_ITEM_0, OW_FEMALE_ITEM_0
                                        .byte OW_MALE_FISH, OW_FEMALE_FISH
                                        .byte OW_MALE_ITEM_1, OW_FEMALE_ITEM_1
                                        .byte OW_MALE_DIVE, OW_FEMALE_DIVE
                                    
                                    walkrun_overworld_list:
                                        .byte OW_MALE_WALK, 0b00001
                                        .byte OW_MALE_CYCLE, 0b00010
                                        .byte OW_MALE_SURF, 0b01000
                                        .byte OW_MALE_DIVE, 0b10000
                                        .byte OW_FEMALE_WALK, 0b00001
                                        .byte OW_FEMALE_CYCLE, 0b00010
                                        .byte OW_FEMALE_SURF, 0b01000
                                        .byte OW_FEMALE_DIVE, 0b10000
                                    
                                    @ New code
                                    disable_running_underwater:
                                    	ldr r6, =(0x02037078) @ walkrun_state
                                    	ldrb r1, [r6, #0] @ walkrun->bitfield
                                    	mov r0, #16
                                    	and r0, r1
                                    	cmp r0, #0
                                    	bne i_forgot_what_this_label_is
                                    	mov r0, #2
                                    	and r5, r0
                                    	cmp r5, #0
                                    	beq cannot_run
                                    	ldr r0, =(FLAG_ALLOW_RUN)
                                    	ldr r3, =(0x0806E6D0+1) @ flag_check
                                    	bl call_via_r3
                                    	lsl r0, r0, #24
                                    	lsr r0, r0, #24
                                    	cmp r0, #0
                                    	beq cannot_run
                                    	ldr r2, =(0x02036E38) @ npc_states
                                    	ldrb r1, [r6, #5]
                                    	lsl r0, r1, #3
                                    	add r0, r0, r1
                                    	lsl r0, r0, #2
                                    	add r0, r0, r2
                                    	ldrb r0, [r0, #30]
                                    	ldr r3, =(0x080BD488+1) @ is_tile_to_run_on
                                    	bl call_via_r3
                                    	cmp r0, #0
                                    	bne cannot_run
                                    
                                    can_run:
                                    	ldr r0, =(0x0805BA5A+1)
                                    	bx r0
                                    
                                    i_forgot_what_this_label_is:
                                    	ldr r0, =(0x0805BA9E+1)
                                    	bx r0
                                    
                                    cannot_run:
                                    	ldr r0, =(0x0805BA8C+1)
                                    	bx r0
                                    
                                    .pool
                                    
                                    get_gender_from_sprite:
                                        lsl r0, r0, #24
                                        lsr r0, r0, #24
                                        cmp r0, #OW_MALE_DIVE
                                        beq male
                                        cmp r0, #OW_FEMALE_DIVE
                                        beq female
                                        cmp r0, #OW_FEMALE_FISH
                                        bgt male
                                        cmp r0, #OW_FEMALE_WALK
                                        blt male
                                    
                                    female:
                                        mov r0, #1
                                        b return_to_x5C838
                                        
                                    male:
                                        mov r0, #0
                                        
                                    return_to_x5C838:
                                        ldr r1, =(0x0805C838 + 1)
                                        bx r1
                                    .pool
                                    
                                    check_for_events:
                                        mov r0, #0x80
                                        and r0, r1
                                        cmp r0, #0
                                        beq check_aftermove
                                        bl consider_dive_emerging
                                        cmp r0, #1
                                        beq something_happened
                                    
                                    check_aftermove:
                                        ldrb r1, [r5]
                                        mov r0, #0x40
                                        and r0, r1
                                        cmp r0, #0
                                        beq check_move
                                        ldr r0, =(0x0806CB38 + 1)
                                        bx r0
                                        
                                    something_happened:
                                        ldr r0, =(0x0806CB6C + 1)
                                        bx r0
                                        
                                    check_move:
                                        ldr r0, =(0x0806CB74 + 1)
                                        bx r0
                                    .pool
                                    
                                    consider_dive_emerging:
                                        push {lr}
                                    @ REMOVE THE FOLLOWING 5 LINES TO DISABLE BADGE CHECK 
                                        ldr r0, =(FLAG_ALLOW_DIVE)
                                        ldr r1, =(0x0806E6D0 + 1) @ checkflag
                                        bl call_via_r1
                                        cmp r0, #0
                                        beq no_emerging
                                    @ REMOVE THE ABOVE 5 LINES TO DISABLE BADGE CHECK
                                        ldr r0, =(0x02036DFC) @ map_header
                                        ldrb r0, [r0, #23] @ map_header->light_level
                                        cmp r0, #5
                                        bne no_emerging
                                        bl get_block_secondary_role
                                        cmp r0, #EMERGE_TILE_BYTE
                                        bne no_emerging
                                        ldr r0, =(0x081BE3D4) @ emerge_script
                                        ldr r1, =(0x08069AE4 + 1) @ script_start
                                        bl call_via_r1
                                        mov r0, #1
                                        b dive_return
                                        
                                    no_emerging:
                                        mov r0, #0
                                    
                                    dive_return:
                                        pop {r1}
                                        bx r1
                                    .pool
                                    
                                    check_dive:
                                        ldrb r1, [r5]
                                        mov r0, #1
                                        and r0, r1
                                        cmp r0, #0
                                        beq no_dive
                                        bl consider_diving
                                        cmp r0, #1
                                        beq something_happened
                                    
                                    no_dive:
                                        ldrb r1, [r5]
                                        mov r0, #4
                                        and r0, r1
                                        cmp r0, #0
                                        beq something
                                        ldr r2, =(0x0806CCD6 + 1)
                                        bx r2
                                        
                                    something:
                                        ldr r0, =(0x0806CCFC + 1)
                                        bx r0
                                    .pool
                                        
                                    consider_diving:
                                        push {lr}
                                    @ REMOVE THE FOLLOWING 5 LINES TO DISABLE BADGE CHECK
                                        ldr r0, =(FLAG_ALLOW_DIVE)
                                        ldr r1, =(0x0806E6D0 + 1) @ checkflag
                                        bl call_via_r1
                                        cmp r0, #0
                                        beq cant_dive
                                    @ REMOVE THE ABOVE 5 LINES TO DISABLE BADGE CHECK
                                        bl get_block_secondary_role
                                        cmp r0, #DIVE_TILE_BYTE
                                        bne cant_dive
                                        ldr r0, =(0x081BE38B) @ dive_script
                                        ldr r1, =(0x08069AE4 + 1) @ script_start
                                        bl call_via_r1
                                        mov r0, #1
                                        b dive_pop
                                        
                                    cant_dive:
                                        mov r0, #0
                                    
                                    dive_pop:
                                        pop {r1}
                                        bx r1
                                    .pool
                                    
                                    get_block_secondary_role:
                                        push {r4, lr}
                                        sub sp, sp, #4
                                        mov r4, sp
                                        add r4, #2
                                        mov r0, sp
                                        mov r1, r4    
                                        ldr r3, =(0x0805C538 + 1) @ player_get_pos_to
                                        bl call_via_r3
                                        mov r0, sp
                                        mov r1, #0
                                        ldsh r0, [r0, r1]
                                        mov r2, #0
                                        ldsh r1, [r4, r2]
                                        lsl r0, r0, #16
                                        asr r0, r0, #16
                                        lsl r1, r1, #16
                                        asr r1, r1, #16
                                        mov r2, #8
                                        ldr r3, =(0x08058F48 + 1) @ cur_mapdata_block_get_field_at
                                        bl call_via_r3
                                        lsl r0, r0, #16
                                        lsr r0, r0, #24
                                        add sp, sp, #4
                                        pop {r4}
                                        pop {r1}
                                        bx r1
                                    .pool
                                    
                                    player_behaviour_dive:
                                        push {r4, lr}
                                        ldr r0, =(0x02037078) @ walkrun_state
                                        ldrb r0, [r0, #5] @ walkrun_state->npcid
                                        lsl r4, r0, #3
                                        add r4, r4, r0
                                        lsl r4, r4, #2
                                        ldr r0, =(0x02036E38) @ npc_states
                                        add r4, r4, r0
                                        mov r0, #6
                                        ldr r3, =(0x0805C808 + 1) @ get_sprite_for_player
                                        bl call_via_r3
                                        add r1, r0, #0
                                        lsl r1, r1, #24
                                        lsr r1, r1, #24
                                        add r0, r4, #0
                                        ldr r3, =(0x081507BC + 1) @ npc_change_sprite_call
                                        bl call_via_r3
                                        ldrb r1, [r4, #24]
                                        lsr r1, r1, #4
                                        add r0, r4, #0
                                        ldr r3, =(0x0805F218 + 1) @ npc_turn
                                        bl call_via_r3
                                        mov r0, #16
                                        ldr r3, =(0x0805C970 + 1) @ change_sprite_bitfield
                                        bl call_via_r3
                                        ldrb r0, [r4, #4]
                                        ldr r3, =(0x080DC6B0 + 1) @ bobbing
                                        bl call_via_r3
                                        strb r0,[r4, #26]
                                        pop {r4}
                                        pop {r0}
                                        bx r0
                                    .pool
                                    
                                    change_sprite_to_diving:
                                        push {lr}
                                        mov r0, #4
                                    
                                    set:
                                        ldr r1, =(0x08150498 + 1) @ set_player_behaviour
                                        bl call_via_r1
                                        pop {r1}
                                    
                                    call_via_r1:
                                        bx r1
                                    
                                    call_via_r3:
                                        bx r3
                                    .pool
                                    
                                    .org 0xFFFFFF, 0xFF
                                    .byte 0xFF
                                    
                                    @spherical ice how do you apply these to a script sorry im new in asm things
                                    Reply With Quote
                                    Reply

                                    Quick Reply

                                    Join the conversation!

                                    Create an account to post a reply in this thread, participate in other discussions, and more!

                                    Create a PokéCommunity Account

                                    Sponsored Links
                                    Thread Tools

                                    Posting Rules
                                    You may not post new threads
                                    You may not post replies
                                    You may not post attachments
                                    You may not edit your posts

                                    BB code is On
                                    Smilies are On
                                    [IMG] code is On
                                    HTML code is Off

                                    Forum Jump


                                    All times are GMT -8. The time now is 11:24 AM.