OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
tilering.h
Go to the documentation of this file.
1
85
86#ifndef OPENSNES_TILERING_H
87#define OPENSNES_TILERING_H
88
89#include <snes/types.h>
90
92#define TILERING_CHAR_BYTES 32
93
96#define TILERING_STAGING_BYTES(w, h) (((w) + (h)) * TILERING_CHAR_BYTES)
97
100#define TILERING_NONE 0xFFFF
101
106typedef struct {
107 const u8 *header;
108 const u8 *charpal;
109 const u8 *const *char_parts;
110 const u8 *const *map_parts;
112
152
171u16 tileRingInit(TileRing *r, const TileRingMap *map, u16 chr_vram, u16 first_char,
173 u8 FAR *refs, u8 FAR *staging);
174
188
206
222u16 tileRingCost(const TileRing *r, u16 dx, u16 dy);
223
224#endif /* OPENSNES_TILERING_H */
static u16 tilemap[896]
Generated 32x28 tilemap (krom's fixed pattern — see buildTilemap).
Definition main.c:56
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
#define FAR
Place a global in bank $7E WRAM, outside the 8 KB bank-0 band.
Definition types.h:130
FAR u8 refs[640]
Cells of the window showing each slot.
Definition main.c:77
FAR u8 staging[(((33)+(29)) *32)]
The frame's new characters, copied from ROM, sent by one or two DMAs.
Definition main.c:79
FAR u16 slot_of[archipelago_CHARS]
The slot of each map character.
Definition main.c:73
u16 camx
Camera position in map pixels.
Definition main.c:105
u16 camy
Definition main.c:105
FAR u16 char_of[640]
The character of each slot.
Definition main.c:75
The map as opensnes-tilering wrote it: NAME_TILERING_MAP in the generated .inc fills it.
Definition tilering.h:106
const u8 * header
Definition tilering.h:107
const u8 *const * map_parts
Definition tilering.h:110
const u8 * charpal
Definition tilering.h:108
const u8 *const * char_parts
Definition tilering.h:109
One ring: fill it with tileRingInit(); the fields are read-only.
Definition tilering.h:116
u16 cx
Definition tilering.h:134
u16 first_char
Definition tilering.h:125
u16 worst_row
Definition tilering.h:122
u16 cursor
Definition tilering.h:135
u16 width
Definition tilering.h:119
u8 FAR * refs
Definition tilering.h:131
u16 last_entries
Queue entries noted by the last tileRingUpdate() (characters and tilemap).
Definition tilering.h:140
u16 chr_vram
Definition tilering.h:124
u16 resident
Definition tilering.h:136
u16 win_h
Definition tilering.h:121
u16 height
Definition tilering.h:119
u16 last_chars
Characters noted by the last tileRingUpdate().
Definition tilering.h:138
u16 col_buf[32]
Definition tilering.h:150
u16 worst_window
Definition tilering.h:122
u16 slots
Definition tilering.h:126
u16 cy
Definition tilering.h:134
u16 starved
Characters that found no free slot since tileRingInit(): 0 on a healthy run (the ring is smaller than...
Definition tilering.h:143
u16 tilemap
Definition tilering.h:127
u16 filling
Definition tilering.h:148
u16 FAR * char_of
Definition tilering.h:130
u16 worst_col
Definition tilering.h:122
u16 chars
Definition tilering.h:119
u16 win_w
Definition tilering.h:121
u16 refused
Pushes the VRAM queue refused since tileRingInit() (queue full): 0 on a healthy run.
Definition tilering.h:146
const TileRingMap * map
Definition tilering.h:118
u16 row_buf[64]
Definition tilering.h:149
u8 FAR * staging
Definition tilering.h:132
u16 FAR * slot_of
Definition tilering.h:129
u16 rows_per_part
Definition tilering.h:120
u16 tileRingCost(const TileRing *r, u16 dx, u16 dy)
The most characters a frame can bring at a speed.
u16 tileRingUpdate(TileRing *r, u16 camx, u16 camy)
Follow the camera: queue the characters and tilemap the move needs.
u16 tileRingInit(TileRing *r, const TileRingMap *map, u16 chr_vram, u16 first_char, u16 slots, u16 tilemap, u16 FAR *slot_of, u16 FAR *char_of, u8 FAR *refs, u8 FAR *staging)
Set a ring up: no VRAM is written.
void tileRingFill(TileRing *r, u16 camx, u16 camy)
Load the whole window at a camera position: screen off or in force blank.
OpenSNES Standard Types.