summaryrefslogtreecommitdiff
path: root/src/players.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/players.c')
-rw-r--r--src/players.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/players.c b/src/players.c
index 05da02c..2488693 100644
--- a/src/players.c
+++ b/src/players.c
@@ -140,52 +140,12 @@ int get_my_player_index() {
return -1;
}
-#ifdef MODE_DEBUG
-void draw_debug(platform_window* window) {
- if (is_editing_map) {
- map_info info = get_map_info(window);
- int mouse_tile_y = (_global_mouse.y + _global_camera.y) / info.tile_height;
- int mouse_tile_x = (((_global_mouse.x + _global_camera.x) - (info.px_incline * mouse_tile_y)) / info.tile_width);
-
- if (mouse_tile_x < 0 || mouse_tile_y < 0) return;
- if (mouse_tile_x >= loaded_map.width || mouse_tile_y >= loaded_map.height) return;
-
- tile t = loaded_map.heightmap[mouse_tile_y][mouse_tile_x];
- renderer->render_rectangle_outline(t.tl.x, t.tl.y, t.tr.x - t.tl.x, t.br.y - t.tr.y, 2, rgb(255,0,0));
-
- if (is_left_clicked()) {
- map_to_load.heightmap[mouse_tile_y][mouse_tile_x]++;
- load_mapdata_into_world();
- }
- if (is_right_clicked()) {
- map_to_load.heightmap[mouse_tile_y][mouse_tile_x]--;
- load_mapdata_into_world();
- }
- }
-}
-
-static void take_update_debug(platform_window* window) {
- if (keyboard_is_key_pressed(KEY_F1)) {
- is_editing_map = !is_editing_map;
- log_infox("Editing map: %d", is_editing_map);
- }
-
- if (!is_editing_map) return;
-
- if (keyboard_is_key_down(KEY_LEFT_CONTROL) && keyboard_is_key_pressed(KEY_S)) {
- platform_write_file_content("../data/maps/map1.dat", "wb", (u8*)&map_to_load, sizeof(map_to_load));
- platform_write_file_content("data/maps/map1.dat", "wb", (u8*)&map_to_load, sizeof(map_to_load));
- log_info("Saved map");
- }
-}
-#endif
-
void take_player_input(platform_window* window) {
player* p = get_player_by_id(player_id);
if (!p) return;
#ifdef MODE_DEBUG
- take_update_debug(window);
+ update_editor(window);
#endif
if (keyboard_is_key_down(KEY_W)) {