there is now a player character and the world renders using a cammera

This commit is contained in:
2026-04-09 13:11:55 -07:00
parent 09c310cb4a
commit af639e62c3
47 changed files with 1737 additions and 83 deletions

131
source/game_source/cells.c Normal file
View File

@@ -0,0 +1,131 @@
#include "cells.h"
#include <string.h>
static cell c_wall = {
.id = 1,
.flags = CELL_FLAG_BLOCKING,
.tile = {
.background = {0x00,0x00,0x00},
.forground = {0xee,0xee,0xee},
.simble = L'#'
},
.func = NULL,
};
static cell c_long_grass = {
.id = 7,
.flags = CELL_FLAG_FLAMABLE,
.tile = {
.background = {0x0f, 0x33, 0x0f},
.forground = {0x40, 0xff, 0x40},
.simble = '"',
},
.func = NULL,
};
static cell c_short_grass = {
.id = 8,
.flags = CELL_FLAG_FLAMABLE,
.tile = {
.background = {0x0f, 0x33, 0x0f},
.forground = {0x40, 0xff, 0x40},
.simble = '\'',
},
.func = NULL,
};
static cell c_grass = {
.id = 9,
.flags = CELL_FLAG_FLAMABLE,
.tile = {
.background = {0x0f, 0x33, 0x0f},
.forground = {0x40, 0xff, 0x40},
.simble = ' ',
},
.func = NULL,
};
static cell c_floar = {
.id = 2,
.flags = CELL_FLAG_FLORE,
.tile = {
.background = {0x11,0x11,0x11},
.forground = {0xee,0xee,0xee},
.simble = '.'
},
.func = NULL,
};
static cell c_hard_wall = {
.id = 3,
.flags = CELL_FLAG_DAMAGEABLE | CELL_FLAG_BLOCKING,
.tile = {
.background = {0xcc,0xcc,0xcc},
.forground = {0xee,0xee,0xee},
.simble = '#'
},
.func = NULL,
};
static cell c_soft_wall = {
.id = 4,
.flags = CELL_FLAG_BLOCKING | CELL_FLAG_DAMAGEABLE,
.tile = {
.background = {0xcc,0xcc,0xcc},
.forground = {0xee,0xee,0xee},
.simble = L'#'
},
.func = NULL,
};
static cell c_water = {
.id = 5,
.flags = CELL_FLAG_FLORE | CELL_FLAG_SLIPPERY | CELL_FLAG_UNEVEN,
.tile = {
.background = {0,0,0},
.forground = {0xff,0xff,0xff},
.simble = '~',
},
.func = NULL
};
void f_growth(int x, int y, void* data) {
// every tick spread to the next availbe flore / grass.
}
static cell c_growth = {
.id = 6,
.tile = {
.background = {0x34,0x0c,0x40},
.forground = {0xb0,0x25,0xda},
.simble = '*',
},
.func = f_growth
};
int UpdateCells(cell* cell, int x, int y, void* data) {
if(cell->func != NULL) {
cell->func(x,y,0);
}
return 0;
}
cell* SetCell(cell_id id) {
switch (id) {
case 1:
return &c_wall;
case 2:
return &c_floar;
case 3:
return &c_hard_wall;
case 4:
return &c_soft_wall;
case 5:
return &c_water;
case 6:
return &c_growth;
case 7:
return &c_long_grass;
case 8:
return &c_short_grass;
case 9:
return &c_grass;
}
return 0;
}