Alchemy
Loading...
Searching...
No Matches

vault_itemobj.h

Go to the documentation of this file.
1/// @file
2/// Vault's interiors, before and after the thieves are caught: an item lying on
3/// the floor, drawn as its menu icon (the Bone, at (568, 16, 672)).
4#include "types.h"
5#include "field_obj.h"
6#include "field_event.h"
7
8/// Creates object 22 at the 16.16 position and draws it as the item's icon: the
9/// sprite's own animation is stopped (flags and count 0, 16-colour, palette 0),
10/// the object stays put (motionFlags 0), and the icon's tiles, decoded into
11/// heap block 17, are loaded into the sprite's VRAM block.
12void Vault_PlaceItemIcon(s32 item, s32 fixed_x, s32 fixed_y, s32 fixed_z) {
13 u8 *object;
14 u8 *sprite;
15 u8 *field;
16 u8 *icon;
17 s32 zero;
18 s32 mask;
19
20 zero = 0;
21 object = (u8 *)Engine_ObjectCreate(22, fixed_x, fixed_y, fixed_z);
22 if (object != 0) {
23 sprite = (u8 *)((struct FieldActor *)object)->sprite;
24 field = sprite + 38; // flags, then count
25 *field = zero;
26 field += 1;
27 *field = zero;
28 mask = 33;
29 mask = -mask; // ~32: image.fullColor
30 sprite[5] &= mask;
31 sprite[9] &= 15; // image.palette
32 object[0x55] = zero; // motionFlags
33 object[0x5c] = 1;
34 icon = Engine_HeapAllocate(17, 0x608);
36 icon += 0x400;
37 Engine_VramLoad(sprite[28], 0x80, icon); // sprite->slot
39 }
40}
struct FieldActor * Engine_ObjectCreate(s32, s32, s32, s32)
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_ItemLoadIcon(s32 item)
void Engine_HeapRelease(s32 slot)
s32 Engine_VramLoad(s32 block, s32 size, const void *data)
void * Engine_HeapAllocate(s32 slot, s32 size)
Field objects and actors, and the scene transition styles.
void Vault_PlaceItemIcon(s32 item, s32 fixed_x, s32 fixed_y, s32 fixed_z)
Creates object 22 at the 16.16 position and draws it as the item's icon: the sprite's own animation i...
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned char u8
Definition types.h:11