Thread: Development: Animating the FireRed titlescreen.
View Single Post
  #36    
Old July 22nd, 2013 (5:16 PM). Edited August 18th, 2013 by karatekid552.
karatekid552's Avatar
karatekid552 karatekid552 is offline
What happens if I push it?....
     
    Join Date: Nov 2012
    Location: Do you really want to know? Really?
    Gender: Male
    Nature: Bold
    Posts: 1,766
    -I just talked to Darthatron about 2 minutes ago and got permission to release this-

    Source Code:

    Code:
    .text
    .align 2
    .thumb
    
    /*This goes at 78BF8*/
    Branch:
            ldr r1, .New_Routine
            bx r1
            pop {r3}
    
    .align 2
    .New_Routine:
            .word 0x08XXXXXX + 1
    XXXXXX is the location you put this at:

    Code:
    .text
    .align 2
    .thumb
    
    Start:
            push {r0-r3}
            ldr r3, .RAM_Address
            ldr r1, .Ani_Table
            ldrb r2, [r3, #0x1]
            lsl r2, #0x3
            add r1, r2
            ldrb r0, [r1, #0x4]
            ldrb r2, [r3]
            cmp r2, r0
            bge LoadFrame
            add r2, #0x1
            strb r2, [r3]
    
            b PressStart
    LoadFrame:
            mov r2, #0x0
            strb r2, [r3]
            ldrb r2, [r1, #0x5]
            strb r2, [r3, #0x1]
            ldr r0, [r1]
            ldr r1, .VRAM_Animated_Image
            swi #0x12
    
    PressStart:
            ldrb r2, [r3, #0x2]
            add r2, #1
            strb r2, [r3, #0x2]
            cmp r2, #0x10
            ble Finish
            mov r2, #0
            strb r2, [r3, #0x2]
    FlashOn:
            ldrb r2, [r3, #0x3]
            cmp r2, #0
            bne FlashOff
            ldr r0, .Start_Image
            ldr r1, .VRAM_Start
            swi #0x12
            mov r2, #1
            strb r2, [r3, #0x3]
            b Finish
    FlashOff:
            ldr r0, .Blank
            ldr r1, .VRAM_Start
            ldr r2, .CPUSET
            swi #0xB
            mov r2, #0
            strb r2, [r3, #0x3]
    
    Finish:
            pop {r0-r3}
    ExitRightNow:
            ldr r1, [r0]
            ldr r0, .Frame_Count
            push {r3}
            ldr r3, .Old_Routine
            bx r3
    
    .align 2
    .Ani_Table:
            .word 0x08YYYYYY
    .RAM_Address:
            .word 0x020370c0
    .VRAM_Animated_Image:
            .word 0x06004000
    .VRAM_Start:
            .word 0x06001D40
    .Frame_Count:
            .word 0x0000FFFF
    .Start_Image: /*An image of the press start, 256 color*/
            .word 0x08BAA550
    .Blank: /*An blank (completely transparent) image the same size as the press start, 256 color*/
            .word 0x08BAA688
    .Old_Routine:
            .word 0x08078C01
    .CPUSET:
            .word 0x05000300

    YYYYYY = a table somewhere with this structure: Word [Pointer to Image]; Byte [Pause Length]; Byte [Next Frame];

    For an example of how this works as is (I modified it in DC) see Liquid Crystal's titlescreen.

    The images basically replace the layer that the charizard is on in FR, so you will need to change the palette for that image to be the palette of your new animated frames. You don't need to change the original image, but you do need to change the .raw and make sure that all of your images use the same .raw. The way to do this is to insert you images all the same size and don't make tilesets. Just create your frames, all with the same dimensions, and insert them. Then create a .raw with one of them and replace the .raw for the charizard with it.

    All credits go to Dathatron.

    I will write a more thorough tutorial when I get around to it....

    Edit:
    Here is a quick mod of the routine so you don't have to worry about the flashing press start.
    Code:
    .text
    .align 2
    .thumb
    
    Start:
            push {r0-r3}
            ldr r3, .RAM_Address
            ldr r1, .Ani_Table
            ldrb r2, [r3, #0x1]
            lsl r2, #0x3
            add r1, r2
            ldrb r0, [r1, #0x4]
            ldrb r2, [r3]
            cmp r2, r0
            bge LoadFrame
            add r2, #0x1
            strb r2, [r3]
    
            b PressStart
    LoadFrame:
            mov r2, #0x0
            strb r2, [r3]
            ldrb r2, [r1, #0x5]
            strb r2, [r3, #0x1]
            ldr r0, [r1]
            ldr r1, .VRAM_Animated_Image
            swi #0x12
    
    Finish:
            pop {r0-r3}
    ExitRightNow:
            ldr r1, [r0]
            ldr r0, .Frame_Count
            push {r3}
            ldr r3, .Old_Routine
            bx r3
    
    .align 2
    .Ani_Table:
            .word 0x08YYYYYY
    .RAM_Address:
            .word 0x020370c0
    .VRAM_Animated_Image:
            .word 0x06004000
    .Frame_Count:
            .word 0x0000FFFF
    .Old_Routine:
            .word 0x08078C01
    .CPUSET:
            .word 0x05000300
    __________________

    Paired with Simba
    Reply With Quote