mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
get_berry_tree_graphics
This commit is contained in:
parent
9b98055ecc
commit
823f8d6a0c
@ -5,83 +5,6 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
thumb_func_start get_berry_tree_graphics
|
|
||||||
@ void get_berry_tree_graphics(npc_state *npcState, struct obj *obj)
|
|
||||||
get_berry_tree_graphics: @ 808E5F4
|
|
||||||
push {r4-r7,lr}
|
|
||||||
adds r5, r0, 0
|
|
||||||
adds r7, r1, 0
|
|
||||||
ldrb r0, [r5, 0x1]
|
|
||||||
movs r1, 0x20
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r5, 0x1]
|
|
||||||
adds r4, r7, 0
|
|
||||||
adds r4, 0x3E
|
|
||||||
ldrb r0, [r4]
|
|
||||||
movs r1, 0x4
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r4]
|
|
||||||
ldrb r0, [r5, 0x1D]
|
|
||||||
bl GetStageByBerryTreeId
|
|
||||||
lsls r0, 24
|
|
||||||
lsrs r6, r0, 24
|
|
||||||
cmp r6, 0
|
|
||||||
beq _0808E680
|
|
||||||
ldrb r1, [r5, 0x1]
|
|
||||||
movs r0, 0x21
|
|
||||||
negs r0, r0
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r5, 0x1]
|
|
||||||
ldrb r1, [r4]
|
|
||||||
movs r0, 0x5
|
|
||||||
negs r0, r0
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4]
|
|
||||||
ldrb r0, [r5, 0x1D]
|
|
||||||
bl GetBerryTypeByBerryTreeId
|
|
||||||
subs r0, 0x1
|
|
||||||
lsls r0, 24
|
|
||||||
lsrs r4, r0, 24
|
|
||||||
subs r0, r6, 0x1
|
|
||||||
lsls r0, 24
|
|
||||||
lsrs r6, r0, 24
|
|
||||||
cmp r4, 0x2B
|
|
||||||
bls _0808E648
|
|
||||||
movs r4, 0
|
|
||||||
_0808E648:
|
|
||||||
ldr r0, =gBerryTreeFieldObjectGraphicsIdTablePointers
|
|
||||||
lsls r4, 2
|
|
||||||
adds r0, r4, r0
|
|
||||||
ldr r0, [r0]
|
|
||||||
adds r0, r6
|
|
||||||
ldrb r1, [r0]
|
|
||||||
adds r0, r5, 0
|
|
||||||
bl FieldObjectSetGraphicsId
|
|
||||||
ldr r0, =gBerryTreePicTablePointers
|
|
||||||
adds r0, r4, r0
|
|
||||||
ldr r0, [r0]
|
|
||||||
str r0, [r7, 0xC]
|
|
||||||
ldr r0, =gBerryTreePaletteSlotTablePointers
|
|
||||||
adds r4, r0
|
|
||||||
ldr r0, [r4]
|
|
||||||
adds r0, r6
|
|
||||||
ldrb r1, [r0]
|
|
||||||
lsls r1, 4
|
|
||||||
ldrb r2, [r7, 0x5]
|
|
||||||
movs r0, 0xF
|
|
||||||
ands r0, r2
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r7, 0x5]
|
|
||||||
adds r0, r7, 0
|
|
||||||
adds r1, r6, 0
|
|
||||||
bl StartSpriteAnim
|
|
||||||
_0808E680:
|
|
||||||
pop {r4-r7}
|
|
||||||
pop {r0}
|
|
||||||
bx r0
|
|
||||||
.pool
|
|
||||||
thumb_func_end get_berry_tree_graphics
|
|
||||||
|
|
||||||
thumb_func_start GetFieldObjectGraphicsInfo
|
thumb_func_start GetFieldObjectGraphicsInfo
|
||||||
@ FieldObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8 graphicsId)
|
@ FieldObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8 graphicsId)
|
||||||
GetFieldObjectGraphicsInfo: @ 808E694
|
GetFieldObjectGraphicsInfo: @ 808E694
|
||||||
|
17
include/berry.h
Normal file
17
include/berry.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// Created by Scott Norton on 9/8/17.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef POKEEMERALD_BERRY_H
|
||||||
|
#define POKEEMERALD_BERRY_H
|
||||||
|
|
||||||
|
#define NUM_BERRIES 44
|
||||||
|
|
||||||
|
extern const u8 *const gBerryTreeFieldObjectGraphicsIdTablePointers[NUM_BERRIES];
|
||||||
|
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[NUM_BERRIES];
|
||||||
|
extern const u8 *const gBerryTreePaletteSlotTablePointers[NUM_BERRIES];
|
||||||
|
|
||||||
|
u8 GetStageByBerryTreeId(u8);
|
||||||
|
u8 GetBerryTypeByBerryTreeId(u8);
|
||||||
|
|
||||||
|
#endif //POKEEMERALD_BERRY_H
|
@ -4,6 +4,7 @@
|
|||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "rom4.h"
|
#include "rom4.h"
|
||||||
|
#include "berry.h"
|
||||||
#include "field_player_avatar.h"
|
#include "field_player_avatar.h"
|
||||||
#include "event_data.h"
|
#include "event_data.h"
|
||||||
#include "rom_818CFC8.h"
|
#include "rom_818CFC8.h"
|
||||||
@ -978,3 +979,28 @@ void PlayerObjectTurn(struct PlayerAvatar *playerAvatar, u8 direction)
|
|||||||
{
|
{
|
||||||
FieldObjectTurn(&gMapObjects[playerAvatar->mapObjectId], direction);
|
FieldObjectTurn(&gMapObjects[playerAvatar->mapObjectId], direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_berry_tree_graphics(struct MapObject *mapObject, struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
u8 berryStage;
|
||||||
|
u8 berryId;
|
||||||
|
|
||||||
|
mapObject->mapobj_bit_13 = TRUE;
|
||||||
|
sprite->invisible = TRUE;
|
||||||
|
berryStage = GetStageByBerryTreeId(mapObject->trainerRange_berryTreeId);
|
||||||
|
if (berryStage != 0)
|
||||||
|
{
|
||||||
|
mapObject->mapobj_bit_13 = FALSE;
|
||||||
|
sprite->invisible = FALSE;
|
||||||
|
berryId = GetBerryTypeByBerryTreeId(mapObject->trainerRange_berryTreeId) - 1;
|
||||||
|
berryStage -= 1;
|
||||||
|
if (berryId >= NUM_BERRIES)
|
||||||
|
{
|
||||||
|
berryId = 0;
|
||||||
|
}
|
||||||
|
FieldObjectSetGraphicsId(mapObject, gBerryTreeFieldObjectGraphicsIdTablePointers[berryId][berryStage]);
|
||||||
|
sprite->images = gBerryTreePicTablePointers[berryId];
|
||||||
|
sprite->oam.paletteNum = gBerryTreePaletteSlotTablePointers[berryId][berryStage];
|
||||||
|
StartSpriteAnim(sprite, berryStage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user