diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-12-24 22:09:56 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-12-24 22:09:56 +0100 |
| commit | 2a85823f96ec4e9fa62905490ac93910187dfefc (patch) | |
| tree | cc3360a19f61b481091e2c161b5aab575cda501c | |
| parent | 03930634b437dc390354accd30563050d681a08d (diff) | |
metal wall texture
| -rw-r--r-- | build/data/imgs/objects/metal_wall_front.png | bin | 0 -> 3237 bytes | |||
| -rw-r--r-- | build/zombies.exe | bin | 2100068 -> 2100107 bytes | |||
| -rw-r--r-- | data/imgs/objects/metal_wall_front.png | bin | 0 -> 3237 bytes | |||
| -rw-r--r-- | include/asset_defs.h | 1 | ||||
| -rw-r--r-- | include/math_helper.h | 2 | ||||
| -rw-r--r-- | include/objects.h | 7 | ||||
| -rw-r--r-- | src/asset_defs.c | 1 | ||||
| -rw-r--r-- | src/map.c | 4 | ||||
| -rw-r--r-- | src/objects.c | 6 |
9 files changed, 15 insertions, 6 deletions
diff --git a/build/data/imgs/objects/metal_wall_front.png b/build/data/imgs/objects/metal_wall_front.png Binary files differnew file mode 100644 index 0000000..98f87ac --- /dev/null +++ b/build/data/imgs/objects/metal_wall_front.png diff --git a/build/zombies.exe b/build/zombies.exe Binary files differindex 3e1bb2c..f93e24b 100644 --- a/build/zombies.exe +++ b/build/zombies.exe diff --git a/data/imgs/objects/metal_wall_front.png b/data/imgs/objects/metal_wall_front.png Binary files differnew file mode 100644 index 0000000..98f87ac --- /dev/null +++ b/data/imgs/objects/metal_wall_front.png diff --git a/include/asset_defs.h b/include/asset_defs.h index 57613de..65161c3 100644 --- a/include/asset_defs.h +++ b/include/asset_defs.h @@ -33,6 +33,7 @@ image* img_icon_molotov; image* img_spawner; image* img_obj_plants; image* img_obj_wall1; +image* img_metal_wall_front; // Throwables image* img_grenade; diff --git a/include/math_helper.h b/include/math_helper.h index 074e73a..31e376c 100644 --- a/include/math_helper.h +++ b/include/math_helper.h @@ -12,7 +12,7 @@ #define DROP_RENDER_DEPTH(_h) renderer->set_render_depth(4 + ceil(_h)); #define BULLET_RENDER_DEPTH(_h) renderer->set_render_depth(5 + ceil(_h)); #define THROWABLE_RENDER_DEPTH(_h) renderer->set_render_depth(3 + ceil(_h)); -#define OBJECT_RENDER_DEPTH(_h) renderer->set_render_depth(5 + ceil(_h)); +#define OBJECT_RENDER_DEPTH(_h) renderer->set_render_depth(50 + ceil(_h)); #define OVERLAY_RENDER_DEPTH() renderer->set_render_depth(100); bool onSegment(vec2f p, vec2f q, vec2f r); diff --git a/include/objects.h b/include/objects.h index 6ad5a10..d30a8f0 100644 --- a/include/objects.h +++ b/include/objects.h @@ -19,9 +19,10 @@ typedef struct t_light_emitter { } light_emitter; typedef enum t_object_type { - OBJECT_NONE = 0, - OBJECT_COBBLESTONEWALL1 = 1, - OBJECT_PLANTBOX1 = 2, + OBJECT_NONE, + OBJECT_COBBLESTONEWALL1, + OBJECT_PLANTBOX1, + OBJECT_METAL_WALL_FRONT, } object_type; typedef struct t_object { diff --git a/src/asset_defs.c b/src/asset_defs.c index c4caf68..a9cddfe 100644 --- a/src/asset_defs.c +++ b/src/asset_defs.c @@ -40,6 +40,7 @@ void load_assets() { img_spawner = assets_load_image_from_file("data/imgs/spawner.png"); img_obj_plants = assets_load_image_from_file("data/imgs/plants.png"); img_obj_wall1 = assets_load_image_from_file("data/imgs/wall1.png"); + img_metal_wall_front = assets_load_image_from_file("data/imgs/objects/metal_wall_front.png"); // Players img_player_running = assets_load_image_from_file("data/imgs/players/player1_running.png"); @@ -207,6 +207,10 @@ void create_empty_map() { } } + for (int x = 0; x < MAP_SIZE_X; x++) { + map_to_load.objects[50+x] = (object){.active = true, .position = (vec3f){x, 0, 0}, .size = (vec3f){1,1,1}, .type = OBJECT_METAL_WALL_FRONT}; + } + map_to_load.objects[0] = (object){.active = true, .position = (vec3f){16, 8, 0}, .size = (vec3f){1,1,2}, .type = OBJECT_PLANTBOX1}; map_to_load.objects[1] = (object){.active = true, .position = (vec3f){0, 0, 0}, .size = (vec3f){1,1,2}, .type = OBJECT_COBBLESTONEWALL1}; diff --git a/src/objects.c b/src/objects.c index c1335fb..46714a4 100644 --- a/src/objects.c +++ b/src/objects.c @@ -45,6 +45,8 @@ image* get_image_from_objecttype(object_type tile) { return img_obj_wall1; case OBJECT_PLANTBOX1: return img_obj_plants; + case OBJECT_METAL_WALL_FRONT: + return img_metal_wall_front; default: return 0; } @@ -61,17 +63,17 @@ void draw_objects_at_row(platform_window* window, int row) { if (!o.active) continue; box box = get_box_of_object(window, o); - /* image* img = get_image_from_objecttype(o.type); if (img) { renderer->render_image(img, box.tl_u.x, box.tl_u.y, box.br_d.x - box.tl_d.x, box.br_d.y - box.tr_u.y); } - */ + /* render_quad_with_outline(box.tl_d, box.tr_d, box.bl_d, box.br_d, rgb(200,200,0)); render_quad_with_outline(box.tl_u, box.tr_u, box.bl_u, box.br_u, rgb(200,200,0)); render_quad_with_outline(box.tl_u, box.tl_d, box.bl_u, box.bl_d, rgb(200,200,0)); render_quad_with_outline(box.bl_u, box.br_u, box.bl_d, box.br_d, rgb(200,200,0)); + */ } } |
