diff --git a/assets/enemies.json b/assets/enemies.json index d024b23..3494e77 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -6,7 +6,7 @@ "foreground": [255, 200, 125], "background": [30, 20, 75] }, - {"_type": "Combat", "hp": 200, "max_hp": 200, "damage": 15, "dead": false}, + {"_type": "Combat", "hp": 200, "max_hp": 200, "damage": 50, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "LightSource", "strength": 50, "radius": 1.0}, {"_type": "EnemyConfig", "hearing_distance": 5}, diff --git a/assets/items.json b/assets/items.json index bfbf542..a828f11 100644 --- a/assets/items.json +++ b/assets/items.json @@ -10,7 +10,8 @@ "foreground": [24, 120, 189], "background": [230,120, 120] }, - {"_type": "Sprite", "name": "torch_horizontal_floor"} + {"_type": "Sprite", "name": "torch_horizontal_floor"}, + {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, "SWORD_RUSTY": { @@ -38,7 +39,8 @@ "background": [150, 100, 189] }, {"_type": "Loot", "amount": 10}, - {"_type": "Sprite", "name": "barrel_small"} + {"_type": "Sprite", "name": "barrel_small"}, + {"_type": "Sound", "attack": "pickup", "death": "blank"} ], "inventory_count": 1 }, @@ -53,7 +55,8 @@ "background": [24, 205, 210] }, {"_type": "LightSource", "strength": 60, "radius": 1.8}, - {"_type": "Sprite", "name": "torch_pillar"} + {"_type": "Sprite", "name": "torch_pillar"}, + {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, "POTION_HEALING_SMALL": { @@ -67,7 +70,8 @@ "background": [255, 205, 189] }, {"_type": "Curative", "hp": 200}, - {"_type": "Sprite", "name": "healing_potion_small"} + {"_type": "Sprite", "name": "healing_potion_small"}, + {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, "GRAVE_STONE": { @@ -81,7 +85,8 @@ "background": [24, 205, 189] }, {"_type": "Loot", "amount": 10}, - {"_type": "Sprite", "name": "grave_stone"} + {"_type": "Sprite", "name": "grave_stone"}, + {"_type": "Sound", "attack": "pickup", "death": "blank"} ] } } diff --git a/gui_fsm.cpp b/gui_fsm.cpp index e74c866..bfd6673 100644 --- a/gui_fsm.cpp +++ b/gui_fsm.cpp @@ -79,6 +79,7 @@ namespace gui { if(auto move_to = $main_ui.play_move()) { System::plan_motion(*$level.world, *move_to); run_systems(); + $main_ui.dirty(); state(State::IDLE); } } @@ -172,6 +173,7 @@ namespace gui { switch(ev) { case ATTACK: + $main_ui.dirty(); $status_ui.log("You attack!"); state(State::ATTACKING); break; diff --git a/main_ui.cpp b/main_ui.cpp index 6644c89..3b973ef 100644 --- a/main_ui.cpp +++ b/main_ui.cpp @@ -14,6 +14,10 @@ namespace gui { $window.setFramerateLimit(FRAME_LIMIT); } + void MainUI::dirty() { + $needs_render = true; + } + void MainUI::debug() { auto& dbg = $level.world->get_the(); dbg.FPS = !dbg.FPS; diff --git a/main_ui.hpp b/main_ui.hpp index 8e7b5d3..712fbe3 100644 --- a/main_ui.hpp +++ b/main_ui.hpp @@ -35,6 +35,7 @@ namespace gui { void init(); void draw(); + void dirty(); void generate_map(); void dead_entity(DinkyECS::Entity entity); diff --git a/raycaster.cpp b/raycaster.cpp index 5213ea8..33eaedd 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -273,7 +273,7 @@ void Raycaster::cast_rays() { int tex_y = (int)tex_pos & (texture_height - 1); tex_pos += step; RGBA pixel = texture[texture_height * tex_y + tex_x]; - float light_level = lights[map_y][map_x]; + int light_level = lights[map_y][map_x]; $pixels[pixcoord(x, y)] = new_lighting(pixel, light_level); } @@ -338,7 +338,7 @@ void Raycaster::draw_ceiling_floor() { // floor_x cell_x to find the texture x/y. How? int map_x = int(floor_x); int map_y = int(floor_y); - float light_level = matrix::inbounds(lights, map_x, map_y) ? lights[map_y][map_x] : 30; + int light_level = matrix::inbounds(lights, map_x, map_y) ? lights[map_y][map_x] : 30; // FLOOR color = $floor_texture[texture_width * ty + tx];