forked from NotAShelf/rogged
various: upgrade Zig version
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia97044bd7d44c776f217f2223e35ae3b6a6a6964
This commit is contained in:
parent
4bcacb59ac
commit
bb10fb88f0
6 changed files with 45 additions and 35 deletions
13
src/render.c
13
src/render.c
|
|
@ -240,6 +240,11 @@ void render_map(const Map *map, const Tileset *tileset) {
|
|||
Color stairs_color = color_lerp((Color){85, 80, 70, 255}, (Color){180, 160, 100, 255}, light_factor);
|
||||
Color door_color = color_lerp((Color){38, 34, 30, 255}, (Color){120, 92, 58, 255}, light_factor);
|
||||
Color door_handle_color = color_lerp((Color){42, 38, 32, 255}, (Color){145, 122, 82, 255}, light_factor);
|
||||
int is_currently_lit = brightness > 0;
|
||||
if (is_door && !is_currently_lit) {
|
||||
door_color = (Color){30, 27, 24, 255};
|
||||
door_handle_color = (Color){34, 31, 27, 255};
|
||||
}
|
||||
|
||||
switch (map->tiles[y][x]) {
|
||||
case TILE_WALL:
|
||||
|
|
@ -299,11 +304,13 @@ void render_map(const Map *map, const Tileset *tileset) {
|
|||
int open_x = swing_to_left ? x * TILE_SIZE + 1 : x * TILE_SIZE + 13;
|
||||
int px = (int)(closed_x + (open_x - closed_x) * t);
|
||||
int alpha = (int)(255 * (1.0f - t * 0.45f));
|
||||
if (!is_currently_lit)
|
||||
alpha = (int)(alpha * 0.55f);
|
||||
int width = (int)(2 + (1 - t)); // 2px closed, 1px open
|
||||
Color panel_color = door_color;
|
||||
panel_color.a = alpha;
|
||||
DrawRectangle(px, y * TILE_SIZE + 1, width, TILE_SIZE - 2, panel_color);
|
||||
if (t < 0.5f && light_factor > 0.05f) {
|
||||
if (t < 0.5f && is_currently_lit) {
|
||||
int hx = px + (swing_to_left ? -1 : width + 1);
|
||||
Color handle_color = door_handle_color;
|
||||
handle_color.a = alpha;
|
||||
|
|
@ -324,11 +331,13 @@ void render_map(const Map *map, const Tileset *tileset) {
|
|||
int open_y = swing_up ? y * TILE_SIZE + 1 : y * TILE_SIZE + 13;
|
||||
int py = (int)(closed_y + (open_y - closed_y) * t);
|
||||
int alpha = (int)(255 * (1.0f - t * 0.45f));
|
||||
if (!is_currently_lit)
|
||||
alpha = (int)(alpha * 0.55f);
|
||||
int height = (int)(2 + (1 - t)); // 2px closed, 1px open
|
||||
Color panel_color = door_color;
|
||||
panel_color.a = alpha;
|
||||
DrawRectangle(x * TILE_SIZE + 1, py, TILE_SIZE - 2, height, panel_color);
|
||||
if (t < 0.5f && light_factor > 0.05f) {
|
||||
if (t < 0.5f && is_currently_lit) {
|
||||
int hy = py + (swing_up ? -1 : height + 1);
|
||||
Color handle_color = door_handle_color;
|
||||
handle_color.a = alpha;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue