Page 4 of 4 FirstFirst ... 234
Results 31 to 35 of 35

Thread: Coordinates to world map location [Complete/Full Source]

  1. #31

    Default Re: Coordinates to world map location

    Yes those two recent codes work fine. Also All that weird stuff in the earlier posts is too advanced for me so thanks for figuring all that out. (AND that I can't figure anything out anyway!! :roll

  2. #32
    Chris (Administrator) Vash's Avatar
    Join Date
    Sep 2007
    Location
    Teh Interwebz
    Posts
    1,992
    Blog Entries
    27

    Default Re: Coordinates to world map location

    I just want to make everybody aware that this topic wasn't deleted, it was just moved to the Staff Only section for the time being. If the code is released I will move this topic back.
    Animal Crossing: City Folk
    ACToolkit - NPC_Tool - PattView

  3. #33
    Super Moderator
    Join Date
    Oct 2007
    Location
    Philippines
    Posts
    98

    Default Re: Coordinates to world map location

    Source code and Formulation

    here is the source code and formulation .. i been busy for a while so i just post it out


    Code:
    [rowSlot] = ((([x] >> 8) - 0x0200)/32) + 1
    [columnSlot] = ((([y] >> 8) - 0x0200)/32) + 1
    [TileNo] = ((((([rowSlot]+16)-1)/16)-1)*4) + ((([columnSlot]+16)-1)/16)
    [SlotNo] = ((([rowSlot] - ((([rowSlot]-1)/16)*16))-1)*16) + ([columnSlot] - ((([columnSlot]-1)/16)*16))
    [FinalAddress] = ((([TileNo]-1) * 256) + ([SlotNo]-1))*2) + 0x021E3124

    Code:
    @--- my trademark
    add r1,pc,#1
    bx r1
    .thumb
    @--- my trademark
    
    @[pointer] = r2
    ldr r2, pointer
    ldr r2,[r2]
    cmp r2,#0
    beq exit
    mov r12,lr
    
    
    @[rowSlot] = r0
    ldr r5,far
    ldr r3,[r2,r5]
    bl checkslot
    mov r0,r1
    
    @[columnSlot] = r1
    sub r5,#8
    ldr r3,[r2,r5]
    bl checkslot
    
    @[TileNo] = r2
    mov r5,r0
    add r5, #16
    bl checke
    sub r2,r4,#1
    lsl r2,#2
    mov r5,r1
    add r5,#16
    bl checke
    add r2,r4
    
    @[SlotNo] = r3
    mov r5,r0
    bl checke
    lsl r3,r4,#4
    sub r3,r0,r3
    sub r3,#1
    lsl r3,#4
    mov r5,r1
    bl checke
    lsl r4,#4
    sub r4,r1,r4
    add r3,r4
    
    @[FinalAddres] = r4
    sub r2,#1
    lsl r2,#8
    sub r3,#1
    add r4,r2,r3
    lsl r4,#1
    ldr r1, map
    add r4,r1
    
    @[texttoItem] = r5
    ldr r1, text
    mov r5,#0x0
    mov r0,#0xC
    mov r2,#0xF
    loop:
    ldrb r3,[r1]
    add r1,#1
    cmp r3,#0x3A
    blt number
    add r3,#9
    number:
    and r3,r2
    lsl r3,r0
    add r5,r3
    sub r0,#0x4 
    bpl loop 
    
    @[write] == OK
    strh r5,[r4]
    bx r12
    
    @[division macro]
    checkslot:
    lsr r3, #8
    mov r1,#1
    mov r4,#0x20
    lsl r4,#4
    sub r3,r4
    div0:
    cmp r3,#32
    blt exit
    cmp r1,#64
    bge exit
    add r1,#1
    sub r3,#32
    b div0
    
    checke:
    sub r5,#1
    mov r4,#0
    div:
    cmp r5,#16
    blt exit
    add r4,#1
    sub r5,#16
    b div
    exit:
    bx lr
    
    .arm
    far:
    .long 0xFFFFFAC0
    pointer:
    .long 0x021C6DEC
    map:
    .long 0x021E3124
    text:
    .long 0x022AF136
    Here is with the DPAD Check
    Code:
    @--- my trademark
    add r1,pc,#1
    bx r1
    .thumb
    @--- my trademark
    
    @[pointer] = r2
    ldr r2, pointer
    ldr r2,[r2]
    cmp r2,#0
    beq exit
    mov r12,lr
    
    
    @[rowSlot] = r0
    ldr r5,far
    ldr r3,[r2,r5]
    bl checkslot
    mov r0,r1
    
    @[columnSlot] = r1
    sub r5,#8
    ldr r3,[r2,r5]
    bl checkslot
    bl notStanding
    
    @[TileNo] = r2
    mov r5,r0
    add r5, #16
    bl checke
    sub r2,r4,#1
    lsl r2,#2
    mov r5,r1
    add r5,#16
    bl checke
    add r2,r4
    
    @[SlotNo] = r3
    mov r5,r0
    bl checke
    lsl r3,r4,#4
    sub r3,r0,r3
    sub r3,#1
    lsl r3,#4
    mov r5,r1
    bl checke
    lsl r4,#4
    sub r4,r1,r4
    add r3,r4
    
    @[FinalAddres] = r4
    sub r2,#1
    lsl r2,#8
    sub r3,#1
    add r4,r2,r3
    lsl r4,#1
    ldr r1, map
    add r4,r1
    
    @[texttoItem] = r5
    ldr r1, text
    mov r5,#0x0
    mov r0,#0xC
    mov r2,#0xF
    loop:
    ldrb r3,[r1]
    add r1,#1
    cmp r3,#0x3A
    blt number
    add r3,#9
    number:
    and r3,r2
    lsl r3,r0
    add r5,r3
    sub r0,#0x4 
    bpl loop 
    
    @[write] == OK
    strh r5,[r4]
    bx r12
    
    @[division macro]
    checkslot:
    lsr r3,#8
    mov r1,#1
    mov r4,#0x20
    lsl r4,#4
    sub r3,r4
    div0:
    cmp r3,#32
    blt exit
    cmp r1,#64
    bge exit
    add r1,#1
    sub r3,#32
    b div0
    
    
    
    checke:
    sub r5,#1
    mov r4,#0
    
    div:
    cmp r5,#16
    blt exit
    add r4,#1
    sub r5,#16
    bge div
    exit:
    bx lr
    
    notStanding:
    ldr r4,button
    ldrb r4,[r4]
    cmp r1,#1
    beq updown
    cmp r1,#64
    beq updown
    mov r5,#0x10
    tst r4,r5
    beq right
    mov r5,#0x20
    tst r4,r5
    beq left
    updown:
    cmp r0,#1
    beq exit
    cmp r0,#64
    beq exit
    mov r5,#0x40
    tst r4,r5
    beq up
    mov r5,#0x80
    tst r4,r5
    beq down
    b exit
    
    right:
    add r1,#1
    b updown
    left:
    sub r1,#1
    b updown
    up:
    sub r0,#1
    b exit
    down:
    add r0,#1
    b exit
    
    .arm
    far:
    .long 0xFFFFFAC0
    button:
    .long 0x04000130
    pointer:
    .long 0x021C6DEC
    map:
    .long 0x021E3124
    text:
    .long 0x022AF136

  4. The Following 2 Users Say Thank You to toenailed For This Useful Post:


  5. #34
    Chris (Administrator) Vash's Avatar
    Join Date
    Sep 2007
    Location
    Teh Interwebz
    Posts
    1,992
    Blog Entries
    27

    Default Re: Coordinates to world map location

    EDIT: Nevermind. Nicely done
    Animal Crossing: City Folk
    ACToolkit - NPC_Tool - PattView

  6. #35

    Default Re: Coordinates to world map location

    Thanks guys me and Itsmegames are learning a lot!

    Remember to always click the thanks button of those who help you! It makes them feel wanted:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •