2024-05-14 04:20:20 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "fumocommon.h"
|
|
|
|
#include "terminal.h"
|
|
|
|
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
struct TetraTemplate {
|
2024-05-14 04:20:20 +00:00
|
|
|
u8 *blks;
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
usize wid;
|
|
|
|
usize hgt;
|
2024-05-14 04:20:20 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
struct Tetra {
|
2024-05-15 05:44:13 +00:00
|
|
|
u8 *blks;
|
|
|
|
|
|
|
|
u16 wid;
|
|
|
|
u16 hgt;
|
2024-05-15 22:10:47 +00:00
|
|
|
|
|
|
|
i16 x;
|
|
|
|
i16 y;
|
|
|
|
u8 rot;
|
2024-05-15 05:44:13 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
bool CreateTetra(struct Tetra *tetra, u16 wid, u16 hgt);
|
2024-05-15 05:44:13 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
void FreeTetra(struct Tetra *tetra);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
void TetraSet(struct Tetra *tetra, struct TetraTemplate *template);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
bool TetraIsCollision(struct Tetra *t, struct Tetra *board);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
bool TetraMove(struct Tetra *t, struct Tetra *board, i16 dx, i16 dy);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
bool TetraRotate(struct Tetra *t, struct Tetra *board, i8 dr);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
void TetraOverlay(struct Tetra *t, struct Tetra *board);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-19 06:56:14 +00:00
|
|
|
void TetraTerminalClear(struct Tetra *board, struct Terminal *term, u16 OFS_X, u16 OFS_Y);
|
2024-05-14 04:20:20 +00:00
|
|
|
|
2024-05-19 06:56:14 +00:00
|
|
|
void TetraTerminalDraw(struct Tetra *piece, struct Terminal *term, u16 OFS_X, u16 OFS_Y);
|
|
|
|
|
|
|
|
void TetraTerminalDrawGhost(struct Tetra *t, struct Tetra *board, struct Terminal *term, u16 OFS_X, u16 OFS_Y);
|