ghoulslash ghoulslash is offline

Visitor Messages

Showing Visitor Messages 1 to 3 of 3
  1. Touched
    May 2nd, 2017 9:53 AM
    Touched
    I haven't tried it, but the npc_change_sprite function in there changes the palette, so you should be able to use one of those (either pal_path_for_npc or npc_load_two_palettes__and_record). Is that code 100% working? I want to edit my post so other people don't have the same issues.
  2. Touched
    April 30th, 2017 5:31 AM
    Touched
    Sorry for the late reply. You aren't using it incorrectly, my code is just incorrect. Try this instead (I messed up some of the registers).

    Spoiler:

    .align 2
    .thumb

    instant_npc_frame_switch:
    push {r4-r6, lr}
    sub sp, #4

    ldr r4, variables

    @@ Determine npc state id from person id
    ldr r3, saveblock1_mapdata
    ldr r3, [r3]
    ldrb r0, [r4] @ person/local ID from var 0x8000
    ldrb r1, [r3, #5] @ current map
    ldrb r2, [r3, #4] @ current bank
    mov r3, sp
    ldr r5, npc_id_by_local_id_and_map_ret_success
    bl call_via_r5
    cmp r0, #0 @ failure check
    bne instant_npc_frame_switch_return

    @@ Get npc_state
    mov r0, sp
    ldrb r1, [r0] @ npc_id
    lsl r0, r1, #3 @ npc_states + 0x24 * npc_id
    add r0, r1
    lsl r0, #2
    ldr r1, npc_states
    add r6, r0, r1

    @@ Change Sprite
    mov r0, r6 @ npc_state
    ldrb r1, [r4, #2] @ sprite index from var 0x8001
    ldr r5, npc_change_sprite
    bl call_via_r5

    @@ Update direction to prevent graphical artifacts
    mov r0, r6
    ldrb r1, [r0, #0x18] @ npc direction
    lsr r1, #4
    ldr r5, npc_turn
    bl call_via_r5

    instant_npc_frame_switch_return:
    add sp, #4
    pop {r4-r6, pc}

    call_via_r5:
    bx r5

    .align 2
    variables: .word 0x020370B8 @ script var 0x8000
    saveblock1_mapdata: .word 0x03005008
    npc_states: .word 0x02036E38
    npc_change_sprite: .word 0x081507BC + 1
    npc_turn: .word 0x0805F218 + 1
    npc_id_by_local_id_and_map_ret_success: .word 0x0805DF84 + 1
  3. FBI
    April 2nd, 2017 6:59 AM
    FBI
    Sorry for the late reply. Glad you managed to fix it :)

About Me

  • About ghoulslash
    Gender
    Male ♂

Statistics

Total Posts
Activity by Forum
Visitor Messages
Blog
General Information
  • Last Activity: 7 Hours Ago 5:44 PM
  • Join Date: March 11th, 2016
  • Referrals: 0

Friends

Showing Friends 1 to 2 of 2

All times are GMT -8. The time now is 1:17 AM.