npc_paltag_by_palslot

This commit is contained in:
scnorton 2017-09-12 17:35:08 -04:00
parent 9286c93c8a
commit c8696f1552
2 changed files with 21 additions and 66 deletions

View File

@ -5,69 +5,6 @@
.text
thumb_func_start npc_paltag_by_palslot
npc_paltag_by_palslot: @ 808F360
push {r4-r6,lr}
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x9
bhi _0808F39C
ldr r1, =gUnknown_0850BE38
ldr r0, =gUnknown_020375B4
ldrb r0, [r0]
lsls r0, 2
adds r0, r1
ldr r1, [r0]
lsls r0, r2, 1
b _0808F390
.pool
_0808F384:
adds r1, r4, 0x4
adds r1, r2, r1
ldr r0, =gUnknown_020375B4
ldrb r0, [r0]
ldr r1, [r1]
lsls r0, 1
_0808F390:
adds r0, r1
ldrh r0, [r0]
b _0808F3CE
.pool
_0808F39C:
movs r3, 0
ldr r0, =gUnknown_0850BD78
ldrh r1, [r0]
ldr r2, =0x000011ff
adds r4, r0, 0
cmp r1, r2
beq _0808F3CC
adds r6, r4, 0
ldr r0, =gUnknown_020375B6
ldrh r1, [r0]
adds r5, r2, 0
_0808F3B2:
lsls r2, r3, 3
adds r0, r2, r6
ldrh r0, [r0]
cmp r0, r1
beq _0808F384
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r4
ldrh r0, [r0]
cmp r0, r5
bne _0808F3B2
_0808F3CC:
ldr r0, =0x000011ff
_0808F3CE:
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end npc_paltag_by_palslot
thumb_func_start FieldObjectCB_NoMovement1
FieldObjectCB_NoMovement1: @ 808F3E0
push {lr}

View File

@ -1659,12 +1659,12 @@ void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 action)
}
}
void npc_paltag_set_load(u8 a0)
void npc_paltag_set_load(u8 palSlot)
{
gpu_pal_allocator_reset__manage_upper_four();
gUnknown_020375B6 = 0x11ff;
gUnknown_020375B4 = a0;
if (a0 == 1)
gUnknown_020375B4 = palSlot;
if (palSlot == 1)
{
pal_patch_for_npc_range(gUnknown_0850BE38[gUnknown_020375B4], 0, 6);
gReservedSpritePaletteCount = 8;
@ -1674,3 +1674,21 @@ void npc_paltag_set_load(u8 a0)
pal_patch_for_npc_range(gUnknown_0850BE38[gUnknown_020375B4], 0, 10);
}
}
u16 npc_paltag_by_palslot(u8 palSlot)
{
u8 i;
if (palSlot < 10)
{
return gUnknown_0850BE38[gUnknown_020375B4][palSlot];
}
for (i = 0; gUnknown_0850BD78[i].tag != 0x11ff; i ++)
{
if (gUnknown_0850BD78[i].tag == gUnknown_020375B6)
{
return gUnknown_0850BD78[i].data[gUnknown_020375B4];
}
}
return 0x11ff;
}