2024-05-07 22:10:15 +00:00
|
|
|
#include "fumocommon.h"
|
|
|
|
#include "fumoengine.h"
|
2024-05-15 22:10:47 +00:00
|
|
|
#include "terminal.h"
|
2024-05-14 04:20:20 +00:00
|
|
|
#include "tetra.h"
|
2024-05-07 22:10:15 +00:00
|
|
|
|
2024-05-08 22:07:31 +00:00
|
|
|
#define BINDS_N 12
|
2024-05-07 22:10:15 +00:00
|
|
|
|
|
|
|
|
2024-05-10 07:38:08 +00:00
|
|
|
enum FumotrisControls {
|
2024-05-07 22:10:15 +00:00
|
|
|
LEFT,
|
|
|
|
RIGHT,
|
|
|
|
SOFT_DROP,
|
|
|
|
HARD_DROP,
|
|
|
|
ROTATE_CCW,
|
|
|
|
ROTATE_CW,
|
|
|
|
ROTATE_180,
|
|
|
|
SWAP,
|
|
|
|
ESC,
|
2024-05-10 07:38:08 +00:00
|
|
|
|
2024-05-07 22:10:15 +00:00
|
|
|
VSCROLL,
|
|
|
|
HSCROLL,
|
2024-05-10 07:38:08 +00:00
|
|
|
|
2024-05-07 22:10:15 +00:00
|
|
|
MOUSE
|
|
|
|
};
|
|
|
|
|
2024-05-08 22:07:31 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
u16 CONTROLS[BINDS_N] = {
|
2024-05-10 07:38:08 +00:00
|
|
|
LEFT,
|
|
|
|
RIGHT,
|
|
|
|
SOFT_DROP,
|
|
|
|
HARD_DROP,
|
|
|
|
ROTATE_CCW,
|
|
|
|
ROTATE_CW,
|
|
|
|
ROTATE_180,
|
|
|
|
SWAP,
|
|
|
|
ESC,
|
|
|
|
|
|
|
|
VSCROLL,
|
|
|
|
HSCROLL,
|
|
|
|
|
|
|
|
MOUSE,
|
|
|
|
};
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
u16 CODES[BINDS_N] = {
|
2024-05-10 07:38:08 +00:00
|
|
|
0x25,
|
|
|
|
0x27,
|
|
|
|
0x28,
|
|
|
|
0x20,
|
|
|
|
'Z',
|
|
|
|
'X',
|
|
|
|
'A',
|
|
|
|
'C',
|
|
|
|
0x1B,
|
|
|
|
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
u16 TYPES[BINDS_N] = {
|
2024-05-10 07:38:08 +00:00
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
BUTTON,
|
|
|
|
|
|
|
|
AXIS,
|
|
|
|
AXIS,
|
|
|
|
|
|
|
|
JOYSTICK
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate I = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[16]) {
|
2024-05-14 04:20:20 +00:00
|
|
|
0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
1, 1, 1, 1,
|
|
|
|
0, 0, 0, 0
|
|
|
|
},
|
|
|
|
.wid = 4,
|
|
|
|
.hgt = 4
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate O = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[4]) {
|
|
|
|
2, 2,
|
|
|
|
2, 2
|
2024-05-14 04:20:20 +00:00
|
|
|
},
|
|
|
|
.wid = 2,
|
|
|
|
.hgt = 2
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate T = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[9]) {
|
|
|
|
0, 3, 0,
|
|
|
|
3, 3, 3,
|
2024-05-14 04:20:20 +00:00
|
|
|
0, 0, 0
|
|
|
|
},
|
|
|
|
.wid = 3,
|
|
|
|
.hgt = 3
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate S = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[9]) {
|
|
|
|
0, 4, 4,
|
|
|
|
4, 4, 0,
|
2024-05-14 04:20:20 +00:00
|
|
|
0, 0, 0
|
|
|
|
},
|
|
|
|
.wid = 3,
|
|
|
|
.hgt = 3
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate Z = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[9]) {
|
|
|
|
5, 5, 0,
|
|
|
|
0, 5, 5,
|
2024-05-14 04:20:20 +00:00
|
|
|
0, 0, 0
|
|
|
|
},
|
|
|
|
.wid = 3,
|
|
|
|
.hgt = 3
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate J = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[9]) {
|
|
|
|
6, 0, 0,
|
|
|
|
6, 6, 6,
|
2024-05-14 04:20:20 +00:00
|
|
|
0, 0, 0
|
|
|
|
},
|
|
|
|
.wid = 3,
|
|
|
|
.hgt = 3
|
2024-05-07 22:10:15 +00:00
|
|
|
};
|
|
|
|
|
2024-05-14 04:20:20 +00:00
|
|
|
struct TetraTemplate L = {
|
2024-05-15 22:10:47 +00:00
|
|
|
.blks = (u8[9]) {
|
|
|
|
0, 0, 7,
|
|
|
|
7, 7, 7,
|
2024-05-14 04:20:20 +00:00
|
|
|
0, 0, 0
|
|
|
|
},
|
|
|
|
.wid = 3,
|
|
|
|
.hgt = 3
|
2024-05-15 22:10:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TetraTemplate *templates[7] = { &I, &O, &T, &S, &Z, &J, &L };
|