Alchemy
Loading...
Searching...
No Matches

colosso_item_icon.h

Go to the documentation of this file.
1/// @file
2/// Colosso Log, River and Wall, and Crossbone Isle's platform rooms: an actor
3/// drawn as an item's menu icon, such as the two items at a Colosso course's
4/// finish or the Red Key on Crossbone Isle.
5#include "battle.h"
6#include "debug.h"
7#include "field.h"
8#include "game.h"
9#include "graphics.h"
10#include "menu.h"
11#include "minigame.h"
12#include "sound.h"
13#include "system.h"
14#include "resource.h"
15#include "field_obj.h"
16#include "field_event.h"
17#include "animspr.h"
18#include "mem.h"
19#include "dma.h"
20#include "io_reg.h"
21
22/// Replaces the picture of actor id, when it has a sprite of its own, with the
23/// icon of item: the icon's tiles, decoded into heap block 17, are loaded into
24/// the sprite's VRAM block and its animation is stopped.
26 struct FieldActor *obj;
27 s32 one;
28 struct AnimationObject *spr;
29 s32 base;
30 s32 tile;
31 s32 none;
32
33 obj = Object_GetById(id);
34 if (obj != 0) {
35 one = obj->spriteStorageKind;
36 if (one == 1) {
37 spr = (struct AnimationObject *)obj->sprite;
38 base = (s32)Runtime_AllocateHeapBlock(17, 0x608);
39 none = 0;
40 base += 0x400;
41 Dma_Fill32(none, (void *)base, 0x80);
43 tile = Engine_VramLoad(spr->slot, 128, (const void *)base);
45 obj->retainSpriteCache = one;
47 spr->entries[0] = (void *)none;
48 spr->count = none;
49 spr->image.fullColor = none;
50 spr->image.tile = tile;
51 spr->dirty = none;
52 spr->flags = none;
53 }
54 }
55}
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void ResourceMetadata_ClearRecord(struct AnimationEntry *record)
Zeroes one animation layer (struct AnimationEntry); does nothing for NULL.
Definition animation.c:499
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
void ItemIcon_LoadTilesFar(s32 item)
The engine calls the debug menus import, and their palette swatch tiles.
DMA channel registers, and the DMA and CPU fills.
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
Definition dma.h:30
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
s32 Engine_VramLoad(s32 block, s32 size, const void *data)
Field objects and actors, and the scene transition styles.
The screen blend's globals and the graphics routines.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
Definition heap.c:47
The hardware's I/O registers and their bits, as pret names them.
The heaps: allocating and freeing blocks.
void Runtime_ReleaseHeapBlock(s32 slot)
The reel game's title lettering.
void Colosso_ShowItemIcon(s32 id, s32 item)
Replaces the picture of actor id, when it has a sprite of its own, with the icon of item: the icon's ...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
struct AnimationSpritePart image
Definition animspr.h:109
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
Definition animspr.h:128
u8 slot
VRAM cache entry holding its tiles.
Definition animspr.h:112
struct AnimationEntry * entries[4]
its layers; empty ones null
Definition animspr.h:130
u8 count
layers in use, up to the last one present
Definition animspr.h:129
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
Definition animspr.h:125
u16 fullColor
256 colours; set for both parts when created
Definition animspr.h:94
u16 tile
first sprite tile in VRAM
Definition animspr.h:99
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
u8 retainSpriteCache
Nonzero keeps its sprite's VRAM cache entry while sprites are suspended or it is off screen (ObjectSy...
Definition field_obj.h:96
u8 spriteStorageKind
Zero hides sprites; one draws a single sprite, two draws a group.
Definition field_obj.h:78
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
signed int s32
Definition types.h:14