Create submodules for assets-cg and assets-fx
This commit is contained in:
parent
70e2291348
commit
adcea66e87
|
@ -0,0 +1,6 @@
|
|||
[submodule "assets-cg"]
|
||||
path = assets-cg
|
||||
url = https://gitea.planet-casio.com/KikooDX/jtmm2-assets-cg
|
||||
[submodule "assets-fx"]
|
||||
path = assets-fx
|
||||
url = https://gitea.planet-casio.com/KikooDX/jtmm2-assets-fx
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 09b5adf91b66e0a35096fcbfd6885938afa118d8
|
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
|
@ -0,0 +1 @@
|
|||
Subproject commit 58c131401c021ac3aaabc23b7387f9143769072c
|
Binary file not shown.
Before Width: | Height: | Size: 359 B |
|
@ -1,20 +1,37 @@
|
|||
#ifndef _DEF_TILES
|
||||
#define _DEF_TILES
|
||||
#define TILE_AT(x, y) (x + y * 8)
|
||||
|
||||
typedef unsigned char Tile; /* the tile ID */
|
||||
typedef unsigned char Tile_flags; /* the tile properties (bitmask) */
|
||||
|
||||
/* define flags */
|
||||
#define F_VISIBLE 0b1
|
||||
#define F_SOLID 0b10
|
||||
#define F_SOLID 0b1
|
||||
#define F_SLIPPERY 0b10
|
||||
|
||||
/* define properties */
|
||||
#define P_AIR (0)
|
||||
#define P_BASE (F_VISIBLE | F_SOLID)
|
||||
#define P_UNKNOWN (F_VISIBLE)
|
||||
#define P_BASE (F_SOLID)
|
||||
#define P_UNKNOWN (0)
|
||||
|
||||
enum {
|
||||
ID_AIR,
|
||||
ID_BASE,
|
||||
ID_AIR = TILE_AT(0, 0),
|
||||
ID_BASE_0 = TILE_AT(1, 0),
|
||||
ID_BASE_1 = TILE_AT(2, 0),
|
||||
ID_BASE_2 = TILE_AT(3, 0),
|
||||
ID_BASE_3 = TILE_AT(4, 0),
|
||||
ID_BASE_4 = TILE_AT(1, 1),
|
||||
ID_BASE_5 = TILE_AT(2, 1),
|
||||
ID_BASE_6 = TILE_AT(3, 1),
|
||||
ID_BASE_7 = TILE_AT(4, 1),
|
||||
ID_BASE_8 = TILE_AT(1, 2),
|
||||
ID_BASE_9 = TILE_AT(2, 2),
|
||||
ID_BASE_10 = TILE_AT(3, 2),
|
||||
ID_BASE_11 = TILE_AT(4, 2),
|
||||
ID_BASE_12 = TILE_AT(1, 3),
|
||||
ID_BASE_13 = TILE_AT(2, 3),
|
||||
ID_BASE_14 = TILE_AT(3, 3),
|
||||
ID_BASE_15 = TILE_AT(4, 3),
|
||||
};
|
||||
|
||||
Tile_flags tile_get_flags(Tile tile);
|
||||
|
|
|
@ -6,7 +6,7 @@ local function create_random_level(width, height, layers)
|
|||
io.write(height, "\n")
|
||||
for i = 1, layers, 1 do
|
||||
for r = 1, width * height, 1 do
|
||||
io.write(math.floor(math.random() * 1.5)) --random 0 (2/3) or 1 (1/3)
|
||||
io.write(math.ceil(math.random() * 4) * math.floor(math.random() * 1.5))
|
||||
io.write("\n")
|
||||
end
|
||||
if i ~= layers then
|
||||
|
|
|
@ -17,6 +17,8 @@ void level_draw(const Level *level, Camera *camera) {
|
|||
}
|
||||
|
||||
void layer_draw(const Level *level, Camera *camera, uint layer_id) {
|
||||
/* Include tileset. */
|
||||
extern bopti_image_t img_tileset;
|
||||
const Tile *layer = level->layers[layer_id];
|
||||
#ifdef FX9860G
|
||||
const int color = C_LIGHT;
|
||||
|
@ -39,10 +41,12 @@ void layer_draw(const Level *level, Camera *camera, uint layer_id) {
|
|||
for (int x = start_x; x < end_x; ++x) {
|
||||
const Tile tile = layer[x + y * level->width];
|
||||
if (tile) {
|
||||
Vec tl = {
|
||||
const Vec tl = {
|
||||
(x * TILE_SIZE / VEC_PRECISION - camera->offset.x) * SCALE,
|
||||
(y * TILE_SIZE / VEC_PRECISION - camera->offset.y) * SCALE };
|
||||
drect(tl.x, tl.y, tl.x + TILE_PX_SIZE, tl.y + TILE_PX_SIZE, color);
|
||||
dsubimage(tl.x, tl.y, &img_tileset,
|
||||
tile * TILE_PX_SIZE, 0 * TILE_PX_SIZE,
|
||||
TILE_PX_SIZE, TILE_PX_SIZE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
19
src/tiles.c
19
src/tiles.c
|
@ -3,7 +3,24 @@
|
|||
Tile_flags tile_get_flags(Tile tile) {
|
||||
switch (tile) {
|
||||
case ID_AIR: return P_AIR; break;
|
||||
case ID_BASE: return P_BASE; break;
|
||||
case ID_BASE_0:
|
||||
case ID_BASE_1:
|
||||
case ID_BASE_2:
|
||||
case ID_BASE_3:
|
||||
case ID_BASE_4:
|
||||
case ID_BASE_5:
|
||||
case ID_BASE_6:
|
||||
case ID_BASE_7:
|
||||
case ID_BASE_8:
|
||||
case ID_BASE_9:
|
||||
case ID_BASE_10:
|
||||
case ID_BASE_11:
|
||||
case ID_BASE_12:
|
||||
case ID_BASE_13:
|
||||
case ID_BASE_14:
|
||||
case ID_BASE_15:
|
||||
return P_BASE;
|
||||
break;
|
||||
default: return P_UNKNOWN; break;
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue