diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-09-09 15:05:48 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-09-09 15:05:48 -0400 |
commit | dd714a763a2c8c6f6fc07743ad16d099fef2037e (patch) | |
tree | 89f0a7de5df8425203d0ae505aa66047a6d172f5 | |
parent | add1b59b63bd00bd481333f6e68940cbc30208fc (diff) |
npc_pal_op_B
-rw-r--r-- | asm/field_effect_helpers.s | 46 | ||||
-rw-r--r-- | include/field_map_obj.h | 1 | ||||
-rw-r--r-- | src/field_effect_helpers.c | 26 |
3 files changed, 26 insertions, 47 deletions
diff --git a/asm/field_effect_helpers.s b/asm/field_effect_helpers.s index c76f846b9..5b58e7aff 100644 --- a/asm/field_effect_helpers.s +++ b/asm/field_effect_helpers.s @@ -6,52 +6,6 @@ .text - thumb_func_start npc_pal_op_B -npc_pal_op_B: @ 8126954 - push {r4,lr} - lsls r1, 24 - lsrs r4, r1, 24 - ldrb r0, [r0, 0x5] - bl GetFieldObjectGraphicsInfo - adds r2, r0, 0 - ldrh r1, [r2, 0x4] - ldr r0, _08126980 @ =0x000011ff - cmp r1, r0 - beq _081269A8 - ldrb r0, [r2, 0xC] - movs r1, 0xF - ands r1, r0 - cmp r1, 0 - bne _08126984 - ldrh r0, [r2, 0x2] - adds r1, r4, 0 - bl npc_load_two_palettes__no_record - b _081269A2 - .align 2, 0 -_08126980: .4byte 0x000011ff -_08126984: - cmp r1, 0xA - bne _08126992 - ldrh r0, [r2, 0x2] - adds r1, r4, 0 - bl npc_load_two_palettes__and_record - b _081269A2 -_08126992: - adds r0, r4, 0 - bl npc_paltag_by_palslot - lsls r0, 16 - lsrs r0, 16 - adds r1, r4, 0 - bl pal_patch_for_npc -_081269A2: - adds r0, r4, 0 - bl sub_807D78C -_081269A8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end npc_pal_op_B - thumb_func_start npc_pal_op_A npc_pal_op_A: @ 81269B0 push {r4,lr} diff --git a/include/field_map_obj.h b/include/field_map_obj.h index 23763aa1a..78cf2c146 100644 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -430,5 +430,6 @@ u8 SpawnSpecialFieldObjectParametrized(u8, u8, u8, s16, s16, u8); void CameraObjectSetFollowedObjectId(u8); u8 sub_805ADDC(u8); u8 obj_unfreeze(struct Sprite *, s16, s16, u8); +u16 npc_paltag_by_palslot(u8); #endif // GUARD_FIELD_MAP_OBJ_H diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index ea3d21710..44403eef8 100644 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -7,6 +7,7 @@ #include "global.h" #include "sprite.h" #include "field_map_obj.h" +#include "field_weather.h" #include "metatile_behavior.h" #include "field_effect_helpers.h" @@ -18,7 +19,7 @@ /*static*/ void sub_81269E0(struct Sprite *); static void npc_pal_op(struct MapObject *mapObject, struct Sprite *sprite); /*static*/ void npc_pal_op_A(struct MapObject *, u8); -/*static*/ void npc_pal_op_B(struct MapObject *, u8); +static void npc_pal_op_B(struct MapObject *, u8); /*static*/ void sub_81275A0(struct Sprite *); /*static*/ void sub_81275C4(struct Sprite *); /*static*/ void sub_8127DA0(struct Sprite *); @@ -121,3 +122,26 @@ static void npc_pal_op(struct MapObject *mapObject, struct Sprite *sprite) npc_pal_op_B(mapObject, sprite->oam.paletteNum); } } + +static void npc_pal_op_B(struct MapObject *mapObject, u8 paletteNum) +{ + const struct MapObjectGraphicsInfo *graphicsInfo; + + graphicsInfo = GetFieldObjectGraphicsInfo(mapObject->graphicsId); + if (graphicsInfo->paletteTag2 != 0x11ff) + { + if (graphicsInfo->paletteSlot == 0) + { + npc_load_two_palettes__no_record(graphicsInfo->paletteTag1, paletteNum); + } + else if (graphicsInfo->paletteSlot == 10) + { + npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, paletteNum); + } + else + { + pal_patch_for_npc(npc_paltag_by_palslot(paletteNum), paletteNum); + } + sub_807D78C(paletteNum); + } +} |