View Single Post
  #5    
Old January 7th, 2010 (2:15 PM).
Juan Juan is offline
Brazilian with a bad English
     
    Join Date: Jun 2007
    Location: Pindamonhangaba - SP
    Age: 26
    Nature: Adamant
    Posts: 92
    trainerbattle is a command that allows you to use with different parameters.


    Quote:
    trainerbattle byte byte hword pointer1


    trainerbattle byte byte hword pointer1 pointer2

    trainerbattle byte byte hword pointer1 pointer2 pointer3

    Some subroutines called by the command 0x5C





    At least in Fire Red, the maximum that can be used in the first parameter is 10(0x0-0x9).
    And each of them calls a different subroutine.


    Code:
    ROM:08080228
    ROM:08080228 @ ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:08080228
    ROM:08080228
    ROM:08080228 sub_8080228:                            @ CODE XREF: cmd_0x5C+6p
    ROM:08080228                 PUSH    {R4,R5,LR}
    ROM:0808022A                 ADD     R5, R0, #0
    ROM:0808022C                 BL      sub_8080110
    ROM:08080230                 LDR     R4, =0x20386AC
    ROM:08080232                 ADD     R0, R5, #0
    ROM:08080234                 BL      Read8bitsValue
    ROM:08080238                 LSL     R0, R0, #0x18
    ROM:0808023A                 LSR     R0, R0, #0x18
    ROM:0808023C                 STRH    R0, [R4]
    ROM:0808023E                 LDRH    R0, [R4]
    ROM:08080240                 SUB     R0, #1
    ROM:08080242                 CMP     R0, #8
    ROM:08080244                 BHI     loc_8080318     @ 0x0 or > 0x9
    ROM:08080246                 LSL     R0, R0, #2
    ROM:08080248                 LDR     R1, =off_8080258
    ROM:0808024A                 ADD     R0, R0, R1
    ROM:0808024C                 LDR     R0, [R0]
    ROM:0808024E                 MOV     PC, R0
    ROM:0808024E @ ---------------------------------------------------------------------------
    ROM:08080250 dword_8080250:  .long 0x20386AC         @ DATA XREF: sub_8080228+8r
    ROM:08080254 off_8080254:    .long off_8080258       @ DATA XREF: sub_8080228+20r
    ROM:08080254                                         @ 
    ROM:08080258 off_8080258:    .long loc_808028C       @ DATA XREF: sub_8080228:off_8080254o
    ROM:08080258                                         @ 0x1
    ROM:0808025C                 .long loc_808028C       @ 0x2
    ROM:08080260                 .long loc_808027C       @ 0x3
    ROM:08080264                 .long loc_8080284       @ 0x4
    ROM:08080268                 .long loc_80802D8       @ 0x5
    ROM:0808026C                 .long loc_8080294       @ 0x6
    ROM:08080270                 .long loc_80802AC       @ 0x7
    ROM:08080274                 .long loc_8080294       @ 0x8
    ROM:08080278                 .long loc_8080304       @ 0x9
    ROM:0808027C @ ---------------------------------------------------------------------------
    ...
    ...
    ...
    Quote:
    Originally Posted by liuyanghejerry View Post
    this forum will be one of my favorite forum^^
    [2] :D

    Quote:
    Originally Posted by The Doctor View Post
    Hm, ZDG, what script is that executed in?
    In fire red has scripts that use this type of script.


    Quote:
    value
    local
    script type
    script offset
    command
    Code:
    0x0:
    VIRIDIAN FOREST [1.0]
    Person 3
    0x160571
    trainerbattle 0x0 0x66 0x0 0x81722C7 0x81722F9
    
    0x1:
    VIRIDIAN CITY [5.1]
    Person 8
    0x169ECA
    trainerbattle 0x1 0x15E 0x0 0x818F352 0x818F43F 0x8169F04
    
    0x2:
    ROCKET HIDEOUT [1.42]
    Person 5
    0x16120A
    trainerbattle 0x2 0x16A 0x0 0x817503A 0x817505A 0x8161225
    
    0x3:
    MT. MOON [1.3]
    Person 3
    0x1606C2
    trainerbattle 0x3 0xAA 0x0 0x8172B99
    
    
    0x4:
    VICTORY ROAD [1.41]
    Person 11
    0x16115F
    trainerbattle 0x4 0x1E5 0x0 0x8174D0C 0x8174D45 0x8174D96
    
    0x5:
    ROUTE 3 [3.21]
    Person 2
    0x1A957B
    trainerbattle 0x5 0x76 0x0 0x81C15F9 0x8183891
    
    0x6:
    none
    
    0x7:
    ROUTE 8 [3.26]
    Person #12
    0x1AA349
    trainerbattle 0x7 0x1E4 0x0 0x81C19E5 0x81845D0 0x8184616
    
    0x8:
    none
    
    0x9:
    ROUTE 22 [3.41]
    Script 0
    0x16828C
    trainerbattle 0x9 0x149 0x0 0x8188959 0x818DE1A
    OBS: copied from the dump done by HackMew
    __________________
    Reply With Quote