The PokéCommunity Forums Fan Games ROM Hacking Tools, Tutorials & Resources
Tutorial Add animations in Fire Red

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.

Reply
 
Thread Tools
  #1    
Old November 17th, 2009 (8:34 AM). Edited November 26th, 2009 by Juan.
Juan Juan is offline
Brazilian with a bad English
     
    Join Date: Jun 2007
    Location: Pindamonhangaba - SP
    Age: 26
    Nature: Adamant
    Posts: 92
    Documentation(Emerald): here
    Code:
    struct FireRedTileset {
      u8  compressed		//00 = not compressed|| 01 = compressed
      u8  tileset			//00 = main tileset || 01 = secundary tileset
      u16 filler		        //00 00
      u32 *image			//image pointer
      u32 *palette			//pallete pointer
      u32 *block			//block pointer
      u32 *animation		//Animations routine pointer
      u32 *behavior  		//Behavior pointer
    };
    PS: LeafGreen uses the same structure then FireRed.
    Explained by LU-HO.


    Tileset 0:
    Code:
    0x2D4A94:
    
    ROM:082D4A94                 DCB 1                   //Compressed
    ROM:082D4A95                 DCB 0                   //main Tileset
    ROM:082D4A96                 DCW 0                   //0x0
    ROM:082D4A98                 DCD off_8EA1D68         //Image pointer
    ROM:082D4A9C                 DCD off_8EA1B68         //Pallete pointer
    ROM:082D4AA0                 DCD off_829F6C8         //Block pointer
    ROM:082D4AA4                 DCD off_8070155         //Animations routine pointer
    ROM:082D4AA8                 DCD off_82A1EC8         //Behavior pointer
    In this tutorial we will use only the "Animations routine pointer".
    Decompile 0x8070154 (THUMB mode you should call the routines with "offset +1) we have:

    Code:
    ROM:08070154
    ROM:08070154 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:08070154
    ROM:08070154
    ROM:08070154 Tileset0AnimationHeader                 ; DATA XREF: ROM:082D4AA4o
    ROM:08070154                 LDR     R1, =0x3000FAE
    ROM:08070156                 MOV     R0, #0
    ROM:08070158                 STRH    R0, [R1]
    ROM:0807015A                 LDR     R1, =0x3000FB0
    ROM:0807015C                 MOV     R2, 0xA0
    ROM:0807015E                 LSL     R2, R2, #2
    ROM:08070160                 ADD     R0, R2, #0
    ROM:08070162                 STRH    R0, [R1]
    ROM:08070164                 LDR     R1, =0x3000FB8
    ROM:08070166                 LDR     R0, =0x8070121
    ROM:08070168                 STR     R0, [R1]
    ROM:0807016A                 BX      LR
    ROM:0807016A ; End of function Tileset0AnimationHeader
    ROM:0807016A
    ROM:0807016A ; ---------------------------------------------------------------------------
    ROM:0807016C dword_807016C   DCD 0x3000FAE           ; DATA XREF: Tileset0AnimationHeaderr
    ROM:08070170 dword_8070170   DCD 0x3000FB0           ; DATA XREF: Tileset0AnimationHeader+6r
    ROM:08070174 dword_8070174   DCD 0x3000FB8           ; DATA XREF: Tileset0AnimationHeader+10r
    ROM:08070178 dword_8070178   DCD 0x8070121           ; DATA XREF: Tileset0AnimationHeader+12r
    What is important in this routine:
    0x3000FB8 : Local in RAM where it is stored the pointer to the routine of animation.
    0x8070121 : Offset of routine animation + 1 (THUMB)
    Code:
    ROM:08070164                 LDR     R1, =0x3000FB8
    ROM:08070166                 LDR     R0, =0x8070121
    ROM:08070168                 STR     R0, [R1]
    Stores the offset of the routine in RAM

    Now we see a secondary tileset that has animations.

    Tileset 28(Vermilion GYM):
    Code:
    0x2D4A94:
    
    ROM:082D4D34                 DCB 1                   //Compressed
    ROM:082D4D35                 DCB 1                   //Secundary Tileset
    ROM:082D4D36                 DCW 0                   //0x0
    ROM:082D4D38                 DCD off_82841F8         //Image pointer
    ROM:082D4D3C                 DCD off_82849B8         //Pallete pointer
    ROM:082D4D40                 DCD off_82AB888         //Block pointer
    ROM:082D4D44                 DCD off_807031D         //Animations routine pointer
    ROM:082D4D48                 DCD off_82ABD38         //Behavior pointer
    Decompile 0x807031C(807031D - 1) we have:
    Code:
    ROM:0807031C
    ROM:0807031C ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:0807031C
    ROM:0807031C
    ROM:0807031C Tileset28AnimationHeader                ; DATA XREF: ROM:082D4D44o
    ROM:0807031C                 LDR     R1, =0x3000FB2
    ROM:0807031E                 MOV     R0, #0
    ROM:08070320                 STRH    R0, [R1]
    ROM:08070322                 LDR     R1, =0x3000FB4
    ROM:08070324                 MOV     R0, #0xF0
    ROM:08070326                 STRH    R0, [R1]
    ROM:08070328                 LDR     R1, =0x3000FBC
    ROM:0807032A                 LDR     R0, =0x8070305
    ROM:0807032C                 STR     R0, [R1]
    ROM:0807032E                 BX      LR
    ROM:0807032E ; End of function Tileset28AnimationHeader
    ROM:0807032E
    ROM:0807032E ; ---------------------------------------------------------------------------
    ROM:08070330 dword_8070330   DCD 0x3000FB2           ; DATA XREF: Tileset28AnimationHeaderr
    ROM:08070334 dword_8070334   DCD 0x3000FB4           ; DATA XREF: Tileset28AnimationHeader+6r
    ROM:08070338 dword_8070338   DCD 0x3000FBC           ; DATA XREF: Tileset28AnimationHeader+Cr
    ROM:0807033C dword_807033C   DCD 0x8070305           ; DATA XREF: Tileset28AnimationHeader+Er
    What is important in this routine:
    0x3000FBC : Local in RAM where it is stored the pointer to the routine of secundary tileset animation.
    0x8070305 : Offset of routine animation + 1 (THUMB)

    Then:
    0x3000FB8: Location for the pointer to the routine of the main tileset
    0x3000FBC: Location for the pointer to the routine of the secundary tileset

    Then, to add animations tilesets that do not have any, please enter the following routine:
    Main Tileset:
    Code:
    @define AnimationRoutine = Animation Routine Offset + 1
    @thumb
    thumb_code
    
    main:
    	ldr	r1,= #0x3000FAE
    	mov	r0,  #0
    	strh	r0,  [r1]
    	ldr	r1,= #0x3000FB0
    	mov	r2,  #0xA0
    	lsl	r2,  r2, #2
    	add	r0,  r2, #0
    	strh	r0,  [r1]
    	ldr	r1,=  #0x3000FB8
    	ldr	r0,= AnimationRoutine
    	str	r0,  [r1]
    	bx	lr
    Compile and enter the routine in an empty space in ROM.
    Add a pointer to this routine + 1 in the header of the tileset you want.

    But what comes to be 'AnimationRoutine'?

    'AnimationRoutine' is the routine that will 'create' the animation.

    Tileset 0 example:
    Remember this:
    Quote:
    0x8070121 : Offset of routine animation + 1 (THUMB)
    Decompile 0x8070120:
    Code:
    ROM:08070120
    ROM:08070120 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:08070120
    ROM:08070120
    ROM:08070120 Tileset0Main
    ROM:08070120                 PUSH    {R4-R6,LR}
    ROM:08070122                 LSL     R5, R0, #0x10
    ROM:08070124                 LSR     R6, R5, #0x10
    ROM:08070126                 MOV     R0, #7
    ROM:08070128                 AND     R0, R6
    ROM:0807012A                 CMP     R0, #0
    ROM:0807012C                 BNE     loc_8070134
    ROM:0807012E                 LSR     R0, R5, #0x13
    ROM:08070130                 BL      WaterAnimation
    ROM:08070134
    ROM:08070134 loc_8070134                             ; CODE XREF: Tileset0Main+Cj
    ROM:08070134                 MOV     R4, #0xF
    ROM:08070136                 AND     R4, R6
    ROM:08070138                 CMP     R4, #1
    ROM:0807013A                 BNE     loc_8070142
    ROM:0807013C                 LSR     R0, R5, #0x14
    ROM:0807013E                 BL      WaterAnimation2
    ROM:08070142
    ROM:08070142 loc_8070142                             ; CODE XREF: Tileset0Main+1Aj
    ROM:08070142                 CMP     R4, #2
    ROM:08070144                 BNE     loc_807014C
    ROM:08070146                 LSR     R0, R5, #0x14
    ROM:08070148                 BL      FlowerAnimation
    ROM:0807014C
    ROM:0807014C loc_807014C                             ; CODE XREF: Tileset0Main+24j
    ROM:0807014C                 POP     {R4-R6}
    ROM:0807014E                 POP     {R0}
    ROM:08070150                 BX      R0
    ROM:08070150 ; End of function Tileset0Main
    ROM:08070150
    ROM:08070150 ; ---------------------------------------------------------------------------
    
    @
    ROM:080700A4
    ROM:080700A4 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:080700A4
    ROM:080700A4
    ROM:080700A4 FlowerAnimation                         ; CODE XREF: Tileset0Main+28p
    ROM:080700A4                 PUSH    {R4,LR}
    ROM:080700A6                 LSL     R0, R0, #0x10
    ROM:080700A8                 LSR     R0, R0, #0x10
    ROM:080700AA                 LDR     R4, =0x83A7660  ; Image Table pointer
    ROM:080700AC                 MOV     R1, #5
    ROM:080700AE                 BL      sub_81E4684
    ROM:080700B2                 LSL     R0, R0, #0x10
    ROM:080700B4                 LSR     R0, R0, #0xE
    ROM:080700B6                 ADD     R0, R0, R4
    ROM:080700B8                 LDR     R0, [R0]
    ROM:080700BA                 LDR     R1, =0x6003F80  ; RAM Offset
    ROM:080700BC                 MOV     R2, #0x80       ; Animation Size
    ROM:080700BE                 BL      sub_806FF04     ; Subroutine then save the data in the DMA3.
    ROM:080700BE                                         ; Don't change it.
    ROM:080700C2                 POP     {R4}
    ROM:080700C4                 POP     {R0}
    ROM:080700C6                 BX      R0
    ROM:080700C6 ; End of function FlowerAnimation
    ROM:080700C6
    ROM:080700C6 ; ---------------------------------------------------------------------------
    ROM:080700C8 dword_80700C8   DCD 0x83A7660           ; DATA XREF: FlowerAnimation+6r
    ROM:080700CC dword_80700CC   DCD 0x6003F80           ; DATA XREF: FlowerAnimation+16r
    ROM:080700D0
    ROM:080700D0 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:080700D0
    ROM:080700D0
    ROM:080700D0 WaterAnimation2                         ; CODE XREF: Tileset0Main+1Ep
    ROM:080700D0                 PUSH    {LR}
    ROM:080700D2                 LSL     R0, R0, #0x10
    ROM:080700D4                 LDR     R2, =0x83AA654  ; Image Table pointer
    ROM:080700D6                 MOVL    R1, 0x70000
    ROM:080700DA                 AND     R1, R0
    ROM:080700DC                 LSR     R1, R1, #0xE
    ROM:080700DE                 ADD     R1, R1, R2
    ROM:080700E0                 LDR     R0, [R1]
    ROM:080700E2                 LDR     R1, =0x6003400  ; RAM Offset
    ROM:080700E4                 MOVL    R2, 0x600       ; Animation Size
    ROM:080700E8                 BL      sub_806FF04     ; Subroutine then save the data in the DMA3.
    ROM:080700E8                                         ; Don't change it.
    ROM:080700EC                 POP     {R0}
    ROM:080700EE                 BX      R0
    ROM:080700EE ; End of function WaterAnimation2
    ROM:080700EE
    ROM:080700EE ; ---------------------------------------------------------------------------
    ROM:080700F0 dword_80700F0   DCD 0x83AA654           ; DATA XREF: WaterAnimation2+4r
    ROM:080700F4 dword_80700F4   DCD 0x6003400           ; DATA XREF: WaterAnimation2+12r
    ROM:080700F8
    ROM:080700F8 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:080700F8
    ROM:080700F8
    ROM:080700F8 WaterAnimation                          ; CODE XREF: Tileset0Main+10p
    ROM:080700F8                 PUSH    {LR}
    ROM:080700FA                 LSL     R0, R0, #0x10
    ROM:080700FC                 LDR     R2, =0x83AB874  ; Image Table pointer
    ROM:080700FE                 MOVL    R1, 0x70000
    ROM:08070102                 AND     R1, R0
    ROM:08070104                 LSR     R1, R1, #0xE
    ROM:08070106                 ADD     R1, R1, R2
    ROM:08070108                 LDR     R0, [R1]
    ROM:0807010A                 LDR     R1, =0x6003A00  ; RAM Offset
    ROM:0807010C                 MOVL    R2, 0x240       ; Animation Size
    ROM:08070110                 BL      sub_806FF04     ; Subroutine then save the data in the DMA3.
    ROM:08070110                                         ; Don't change it.
    ROM:08070114                 POP     {R0}
    ROM:08070116                 BX      R0
    ROM:08070116 ; End of function WaterAnimation
    ROM:08070116
    ROM:08070116 ; ---------------------------------------------------------------------------
    ROM:08070118 dword_8070118   DCD 0x83AB874           ; DATA XREF: WaterAnimation+4r
    ROM:0807011C dword_807011C   DCD 0x6003A00           ; DATA XREF: WaterAnimation+12r
    To create our own animation routine, we have:
    • Animation offset (can be drawn on TileMolester)
    • RAM offset *

    How to calculate the offset in RAM:
    Flower Animation Example:
    Code:
    ROM:080700BA                 LDR     R1, =0x6003F80  ; RAM Offset
    The RAM offset is 0x6003F80. But why?
    It's simple.
    See the image:

    Offset in RAM is the exact place where the flower tile is stored.

    Routine to add more animations (1 animation):
    Code:
    @thumb
    thumb_code
    main:
    	push {r4-r6, lr}
    	lsl r5, r0, #0x10
    	lsr r6, r5, #0x10
    	mov r0, #7
    	and r0, r6
    	cmp r0, #0
    	bne NoAnimation
    	lsr r0, r5, #0x13
    	bl Animation
    
    NoAnimation:
    	pop {r4-r6}
    	pop {r0}
    	bx r0
    
    
    Animation:
    	...
    More then 1 animation:
    Code:
    @thumb
    thumb_code
    main:
    	push {r4-r6, lr}
    	lsl r5, r0, #0x10
    	lsr r6, r5, #0x10
    	mov r0, #7
    	and r0, r6
    	cmp r0, #0
    	bne NoAnimation1
    	lsr r0, r5, #0x13
    	bl Animation
    
    NoAnimation1:
    	cmp r0, #1
    	bne NoneAnimation
    	bl Animation2
    
    NoneAnimation:
    	pop {r4-r6}
    	pop {r0}
    	bx r0
    
    
    Animation1:
    	...
    
    Animation2:
    	...
    I will not write the whole routine because there is a tutorial on ASM.

    Each animation must contain:
    r0 = Image Table pointer
    r1 = RAM offset
    r2 = size
    And must call the subroutine 0x806FF04.

    Image Table pointer:
    Table of pointers to each frame.

    Credits:
    - LU-HO (TilesetStructure)
    - GBATEK (GBA especifications)
    - Me ([Document]Tile Animations in Pokémon Emerald)
    - Me² (this tutorial ^^)

    OBS: Sorry for my bad english.
    Attached Images
    File Type: png flower1.PNG‎ (37.5 KB, 1377 views) (Save to Dropbox)
    __________________
    Reply With Quote

    Relevant Advertising!

      #2    
    Old November 17th, 2009 (5:06 PM).
    Full Metal's Avatar
    Full Metal Full Metal is offline
    C(++) Developer.
    • Silver Tier
     
    Join Date: Jan 2008
    Location: In my mind.
    Age: 21
    Gender: Male
    Nature: Timid
    Posts: 805
    Send a message via Windows Live Messenger to Full Metal
    this is for things like flowers and waves,etc right?
    __________________

    ★ full metal.

    I like to push it,
    and push it,
    until my luck is over.
    Reply With Quote
      #3    
    Old November 17th, 2009 (5:14 PM). Edited November 17th, 2009 by colcolstyles.
    colcolstyles's Avatar
    colcolstyles colcolstyles is offline
    Yours truly
    • Crystal Tier
     
    Join Date: May 2008
    Location: The Bay Area
    Gender: Male
    Nature: Lonely
    Posts: 1,584
    Quote:
    Originally Posted by Full Metal View Post
    this is for things like flowers and waves,etc right?
    Yup.

    @Juan:
    This is the exact same method that I used. It's good to know that I did it correctly even without a tutorial^^
    Nice work.
    __________________

    Brother of Vrai
    Reply With Quote
      #4    
    Old November 17th, 2009 (5:24 PM).
    Pokepal17's Avatar
    Pokepal17 Pokepal17 is offline
    More cowbell~
    • Silver Tier
     
    Join Date: Oct 2008
    Location: Steeltown
    Age: 22
    Gender: Male
    Nature: Modest
    Posts: 1,511
    Quote:
    Originally Posted by colcolstyles View Post
    Yup.

    @Juan:
    This is pretty the exact same method that I used. It's good to know that I did it correctly even without a tutorial
    Nice work.
    Yeah congratulations.

    And Juan, I think you have just helped out a lot of rom hackers :3 (including me)
    __________________
    Pokémon Stardrop
    Reply With Quote
      #5    
    Old November 18th, 2009 (1:48 AM).
    HackMew's Avatar
    HackMew HackMew is offline
    Mewtwo Strikes Back
    • Crystal Tier
     
    Join Date: Jun 2006
    Posts: 1,314
    Quote:
    Originally Posted by Juan View Post
    Routine to add more animations (1 animation):
    Code:
    @thumb
    thumb_code
    main:
    	push {r4-r6, lr}
    	lsl r5, r0, #0x10
    	lsr r6, r5, #0x10
    	mov r0, #7
    	and r0, r6
    	cmp r0, r0
    	bne NoAnimation
    	lsr r0, r5, #0x13
    	bl Animation
    
    NoAnimation:
    	pop {r4-r6}
    	pop {r0}
    	bx r0
    
    
    Animation:
    	...
    That routine is wrong. You meant to write "cmp r0, #0x0", but you put a cmp r0, r0, instead. And since r0 will always be equal to r0 (obviously), the routine won't work properly. BTW, the routine is unoptimized as well. Here's the fixed and improved version:

    Code:
    @thumb
    thumb_code
    main:
    	push {r4, lr}
    	lsl r4, r0, #0x10
    	lsl r0, r4, #0xD
    	lsr r0, r0, #0x1D
    	cmp r0, #0x0
    	bne return
    
    Animation:
    	lsr r0, r4, #0x13
    	...
    
    return:
    	pop {r4, pc}
    __________________
    Reply With Quote
      #6    
    Old November 18th, 2009 (3:18 AM).
    Juan Juan is offline
    Brazilian with a bad English
       
      Join Date: Jun 2007
      Location: Pindamonhangaba - SP
      Age: 26
      Nature: Adamant
      Posts: 92
      Quote:
      Originally Posted by HackMew View Post
      That routine is wrong. You meant to write "cmp r0, #0x0", but you put a cmp r0, r0, instead. And since r0 will always be equal to r0 (obviously), the routine won't work properly. BTW, the routine is unoptimized as well. Here's the fixed and improved version:
      Typing error ^^
      But, thanks, i will edit :)

      EDIT: Fixed ^^

      Quote:
      Originally Posted by Pokepal17 View Post
      Yeah congratulations.

      And Juan, I think you have just helped out a lot of rom hackers :3 (including me)
      I hope so :)


      Quote:
      Originally Posted by colcolstyles View Post
      Yup.

      @Juan:
      This is the exact same method that I used. It's good to know that I did it correctly even without a tutorial^^
      Nice work.
      Thanks ^^

      Quote:
      Originally Posted by Full Metal View Post
      this is for things like flowers and waves,etc right?
      Yes


      If somebody finds another error, both typographical and explanation, just let me know.
      __________________
      Reply With Quote
        #7    
      Old November 26th, 2009 (7:47 AM).
      Diegoisawesome's Avatar
      Diegoisawesome Diegoisawesome is offline
      Oh god the bees
      • Silver Tier
       
      Join Date: Dec 2007
      Location: :noitacoL
      Age: 20
      Gender: Male
      Nature: Naive
      Posts: 1,032
      I found something in the FlowerAnimation SubRoutine:
      Code:
      ROM:080700A4 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
      ROM:080700A4
      ROM:080700A4
      ROM:080700A4 FlowerAnimation                         ; CODE XREF: Tileset0Main+28p
      ROM:080700A4                 PUSH    {R4,LR}
      ROM:080700A6                 LSL     R0, R0, #0x10
      ROM:080700A8                 LSR     R0, R0, #0x10
      ROM:080700AA                 LDR     R4, =0x83A7660  ; Image Table pointer
      ROM:080700AC                 MOV     R1, #5
      ROM:080700AE                 BL      sub_81E4684
      ROM:080700B2                 LSL     R0, R0, #0x10
      ROM:080700B4                 LSR     R0, R0, #0xE
      ROM:080700B6                 ADD     R0, R0, R4
      ROM:080700B8                 LDR     R0, [R0]
      ROM:080700BA                 LDR     R1, =0x6003F80  ; RAM Offset
      ROM:080700BC                 MOV     R2, #0x80       ; Animation Size
      ROM:080700BE                 BL      sub_806FF04     ; Subroutine then save the data in the DMA3.
      ROM:080700BE                                         ; Don't change it.
      ROM:080700C2                 POP     {R4}
      ROM:080700C4                 POP     {R0}
      ROM:080700C6                 BX      R0
      ROM:080700C6 ; End of function FlowerAnimation
      The bolded number is what governs the frames of the animation. I changed it to 4 in my own ROM, and it skipped frame number 5. I put 6, and there was an extra blank frame added between 5 and 1. This is useful for my hack, as I made a flower animation that has only 4 frames.
      __________________


      My other resources:
      My Website
      diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
      diegoisawesome's Miscellaneous Finds
      The Ruins of Alph Puzzles
      Diego's Miscellaneous Patches
      GBA Intro Manager
      The Secret Sauce: Triple-Layer Tiles
      Reply With Quote
        #8    
      Old November 26th, 2009 (6:45 PM).
      Pokepal17's Avatar
      Pokepal17 Pokepal17 is offline
      More cowbell~
      • Silver Tier
       
      Join Date: Oct 2008
      Location: Steeltown
      Age: 22
      Gender: Male
      Nature: Modest
      Posts: 1,511
      Quote:
      Originally Posted by diegoisawesome View Post
      I found something in the FlowerAnimation SubRoutine:
      Code:
      ROM:080700A4 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
      ROM:080700A4
      ROM:080700A4
      ROM:080700A4 FlowerAnimation                         ; CODE XREF: Tileset0Main+28p
      ROM:080700A4                 PUSH    {R4,LR}
      ROM:080700A6                 LSL     R0, R0, #0x10
      ROM:080700A8                 LSR     R0, R0, #0x10
      ROM:080700AA                 LDR     R4, =0x83A7660  ; Image Table pointer
      ROM:080700AC                 MOV     R1, #5
      ROM:080700AE                 BL      sub_81E4684
      ROM:080700B2                 LSL     R0, R0, #0x10
      ROM:080700B4                 LSR     R0, R0, #0xE
      ROM:080700B6                 ADD     R0, R0, R4
      ROM:080700B8                 LDR     R0, [R0]
      ROM:080700BA                 LDR     R1, =0x6003F80  ; RAM Offset
      ROM:080700BC                 MOV     R2, #0x80       ; Animation Size
      ROM:080700BE                 BL      sub_806FF04     ; Subroutine then save the data in the DMA3.
      ROM:080700BE                                         ; Don't change it.
      ROM:080700C2                 POP     {R4}
      ROM:080700C4                 POP     {R0}
      ROM:080700C6                 BX      R0
      ROM:080700C6 ; End of function FlowerAnimation
      The bolded number is what governs the frames of the animation. I changed it to 4 in my own ROM, and it skipped frame number 5. I put 6, and there was an extra blank frame added between 5 and 1. This is useful for my hack, as I made a flower animation that has only 4 frames.
      Good find, this should make animation adding easier since know we how to change the amount of frames. :3
      __________________
      Pokémon Stardrop
      Reply With Quote
        #9    
      Old November 29th, 2009 (8:03 AM).
      poripori poripori is offline
         
        Join Date: Jan 2009
        Gender:
        Posts: 11
        So is this also for the doors?
        Reply With Quote
          #10    
        Old November 29th, 2009 (10:04 AM).
        colcolstyles's Avatar
        colcolstyles colcolstyles is offline
        Yours truly
        • Crystal Tier
         
        Join Date: May 2008
        Location: The Bay Area
        Gender: Male
        Nature: Lonely
        Posts: 1,584
        Quote:
        Originally Posted by poripori View Post
        So is this also for the doors?
        No, that's different.
        You should download ZodiacDaGreat's Door Manager to do that.
        __________________

        Brother of Vrai
        Reply With Quote
          #11    
        Old November 30th, 2009 (4:34 PM).
        Juan Juan is offline
        Brazilian with a bad English
           
          Join Date: Jun 2007
          Location: Pindamonhangaba - SP
          Age: 26
          Nature: Adamant
          Posts: 92
          Quote:
          Originally Posted by diegoisawesome View Post
          I found something in the FlowerAnimation SubRoutine:
          Code:
          ROM:080700A4 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
          ROM:080700A4
          ROM:080700A4
          ROM:080700A4 FlowerAnimation                         ; CODE XREF: Tileset0Main+28p
          ROM:080700A4                 PUSH    {R4,LR}
          ROM:080700A6                 LSL     R0, R0, #0x10
          ROM:080700A8                 LSR     R0, R0, #0x10
          ROM:080700AA                 LDR     R4, =0x83A7660  ; Image Table pointer
          ROM:080700AC                 MOV     R1, #5
          ROM:080700AE                 BL      sub_81E4684
          ROM:080700B2                 LSL     R0, R0, #0x10
          ROM:080700B4                 LSR     R0, R0, #0xE
          ROM:080700B6                 ADD     R0, R0, R4
          ROM:080700B8                 LDR     R0, [R0]
          ROM:080700BA                 LDR     R1, =0x6003F80  ; RAM Offset
          ROM:080700BC                 MOV     R2, #0x80       ; Animation Size
          ROM:080700BE                 BL      sub_806FF04     ; Subroutine then save the data in the DMA3.
          ROM:080700BE                                         ; Don't change it.
          ROM:080700C2                 POP     {R4}
          ROM:080700C4                 POP     {R0}
          ROM:080700C6                 BX      R0
          ROM:080700C6 ; End of function FlowerAnimation
          The bolded number is what governs the frames of the animation. I changed it to 4 in my own ROM, and it skipped frame number 5. I put 6, and there was an extra blank frame added between 5 and 1. This is useful for my hack, as I made a flower animation that has only 4 frames.
          Yes, r1 seems to be the number of frames.
          But look the other animations, it gets some operations involving r1.
          I do not debug that part out of laziness, I do not know the values that it receives after these operations.
          __________________
          Reply With Quote
            #12    
          Old December 1st, 2009 (12:37 PM).
          ZodiacDaGreat's Avatar
          ZodiacDaGreat ZodiacDaGreat is offline
          Working on a Mobile System
             
            Join Date: Feb 2007
            Location: South Pacific
            Age: 24
            Gender: Male
            Nature: Relaxed
            Posts: 429
            Send a message via ICQ to ZodiacDaGreat
            Quite a interesting tutorial. Nice work Juan, I see you've kept up with ASM.
            This is my contribution for R/S hackers

            Quote:
            @ Tileset Animation Hack
            @ Disassembled By ZodiacDaGreat
            @ ------------------------------------------------------------------

            @ Tileset 0 Animation Routine {Major Tileset}
            @ Routine called by the Tileset Header
            @ ------------------------------------------------------------------
            08072fc4 4905 ldr r1, [$08072fdc] (=$030006c2)
            08072fc6 2000 mov r0, #0x0
            08072fc8 8008 strh r0, [r1, #0x0]
            08072fca 4905 ldr r1, [$08072fe0] (=$030006c4)
            08072fcc 2280 mov r2, #0x80
            08072fce 0052 lsl r2, r2, #0x01
            08072fd0 1c10 add r0, r2, #0x0
            08072fd2 8008 strh r0, [r1, #0x0]
            08072fd4 4903 ldr r1, [$08072fe4] (=$030006cc)
            08072fd6 4804 ldr r0, [$08072fe8] (=$08073015) @ Animation Routine
            08072fd8 6008 str r0, [r1, #0x0]
            08072fda 4770 bx lr

            @ Animation Routine
            @ ------------------------------------------------------------------
            08073014 b530 push {r4,r5,lr}
            08073016 0405 lsl r5, r0, #0x10
            08073018 20f0 mov r0, #0xf0
            0807301a 0300 lsl r0, r0, #0x0c
            0807301c 4028 and r0, r5
            0807301e 0c04 lsr r4, r0, #0x10
            08073020 2c00 cmp r4, #0x0
            08073022 d102 bne $0807302a
            08073024 0d28 lsr r0, r5, #0x14
            08073026 f000 bl $08073070 @ Flower Animation
            0807302a 2c01 cmp r4, #0x1
            0807302c d102 bne $08073034
            0807302e 0d28 lsr r0, r5, #0x14
            08073030 f000 bl $08073098 @ Water Animation
            08073034 2c02 cmp r4, #0x2
            08073036 d102 bne $0807303e
            08073038 0d28 lsr r0, r5, #0x14
            0807303a f000 bl $080730c0 @ Shore-line Sand Animation
            0807303e 2c03 cmp r4, #0x3
            08073040 d102 bne $08073048
            08073042 0d28 lsr r0, r5, #0x14
            08073044 f000 bl $080730e8 @ Waterfall Animation
            08073048 2c04 cmp r4, #0x4
            0807304a d102 bne $08073052
            0807304c 0d28 lsr r0, r5, #0x14
            0807304e f000 bl $0807361c @ Water Animation2
            08073052 bc30 pop {r4,r5}
            08073054 bc01 pop {r0}

            @ Flower Animation
            @ ------------------------------------------------------------------
            08073070 b500 push {lr}
            08073072 0400 lsl r0, r0, #0x10
            08073074 21c0 mov r1, #0xc0
            08073076 0289 lsl r1, r1, #0x0a
            08073078 4001 and r1, r0
            0807307a 4805 ldr r0, [$08073090] (=$08376f24) @ Image Table
            0807307c 0b89 lsr r1, r1, #0x0e
            0807307e 1809 add r1, r1, r0
            08073080 6808 ldr r0, [r1, #0x0]
            08073082 4904 ldr r1, [$08073094] (=$06003f80) @ Location
            08073084 2280 mov r2, #0x80 @ Animation Size
            08073086 f7ff bl $08072e24 @ Animation Function
            0807308a bc01 pop {r0}
            0807308c 4700 bx r0

            @ Water Animation
            @ ------------------------------------------------------------------
            08073098 b500 push {lr}
            0807309a 0400 lsl r0, r0, #0x10
            0807309c 0c00 lsr r0, r0, #0x10
            0807309e 2107 mov r1, #0x7
            080730a0 4008 and r0, r1
            080730a2 4905 ldr r1, [$080730b8] (=$08378d34) @ Image Table
            080730a4 0080 lsl r0, r0, #0x02
            080730a6 1840 add r0, r0, r1
            080730a8 6800 ldr r0, [r0, #0x0]
            080730aa 4904 ldr r1, [$080730bc] (=$06003600) @ Location
            080730ac 22f0 mov r2, #0xf0
            080730ae 0092 lsl r2, r2, #0x02 @ Animation Size
            080730b0 f7ff bl $08072e24 @ Animation Function
            080730b4 bc01 pop {r0}
            080730b6 4700 bx r0

            @ Shore-line Sand Animation
            @ ------------------------------------------------------------------
            080730c0 b500 push {lr}
            080730c2 0400 lsl r0, r0, #0x10
            080730c4 21e0 mov r1, #0xe0
            080730c6 02c9 lsl r1, r1, #0x0b
            080730c8 4001 and r1, r0
            080730ca 4805 ldr r0, [$080730e0] (=$08379614) @ Image Table
            080730cc 0b89 lsr r1, r1, #0x0e
            080730ce 1809 add r1, r1, r0
            080730d0 6808 ldr r0, [r1, #0x0]
            080730d2 4904 ldr r1, [$080730e4] (=$06003a00) @ Location
            080730d4 22a0 mov r2, #0xa0
            080730d6 0052 lsl r2, r2, #0x01 @ Animation Size
            080730d8 f7ff bl $08072e24 @ Animation Function
            080730dc bc01 pop {r0}
            080730de 4700 bx r0

            @ Waterfall Animation
            @ ------------------------------------------------------------------
            080730e8 b500 push {lr}
            080730ea 0400 lsl r0, r0, #0x10
            080730ec 21c0 mov r1, #0xc0
            080730ee 0289 lsl r1, r1, #0x0a
            080730f0 4001 and r1, r0
            080730f2 4805 ldr r0, [$08073108] (=$08379934) @ Image Table
            080730f4 0b89 lsr r1, r1, #0x0e
            080730f6 1809 add r1, r1, r0
            080730f8 6808 ldr r0, [r1, #0x0]
            080730fa 4904 ldr r1, [$0807310c] (=$06003e00) @ Location
            080730fc 22c0 mov r2, #0xc0 @ Animation Size
            080730fe f7ff bl $08072e24 @ Animation Function
            08073102 bc01 pop {r0}
            08073104 4700 bx r0

            @ Water Animation2
            @ ------------------------------------------------------------------
            0807361c b500 push {lr}
            0807361e 0400 lsl r0, r0, #0x10
            08073620 21c0 mov r1, #0xc0
            08073622 0289 lsl r1, r1, #0x0a
            08073624 4001 and r1, r0
            08073626 4805 ldr r0, [$0807363c] (=$08379e44) @ Image Table
            08073628 0b89 lsr r1, r1, #0x0e
            0807362a 1809 add r1, r1, r0
            0807362c 6808 ldr r0, [r1, #0x0]
            0807362e 4904 ldr r1, [$08073640] (=$06003c00) @ Location
            08073630 22a0 mov r2, #0xa0
            08073632 0052 lsl r2, r2, #0x01 @ Animation Size
            08073634 f7ff bl $08072e24 @ Animation Function
            08073638 bc01 pop {r0}
            0807363a 4700 bx r0
            __________________
            Reply With Quote
            Reply
            Quick Reply

            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:31 AM.