Fix up building menu a bit.
This commit is contained in:
@@ -15,6 +15,7 @@ sound_pool p(100);
|
||||
#include "src/save_system.nvgt"
|
||||
#include "src/base_system.nvgt"
|
||||
#include "src/time_system.nvgt"
|
||||
#include "src/weather.nvgt"
|
||||
#include "src/audio_utils.nvgt"
|
||||
#include "src/creature_audio.nvgt"
|
||||
#include "src/notify.nvgt"
|
||||
@@ -62,12 +63,20 @@ void main()
|
||||
p.pan_step = AUDIO_PAN_STEP; // Panning strength for scaled tile distances
|
||||
|
||||
show_window("Draugnorak");
|
||||
init_flying_creature_configs();
|
||||
|
||||
bool game_started = false;
|
||||
while (!game_started) {
|
||||
int selection = run_main_menu();
|
||||
|
||||
if (selection == 0) {
|
||||
// Check if save file exists and confirm before overwriting
|
||||
if (has_save_game()) {
|
||||
int confirm = ui_question("", "Save found. Are you sure you want to start a new game?");
|
||||
if (confirm != 1) {
|
||||
continue; // Return to main menu
|
||||
}
|
||||
}
|
||||
start_new_game();
|
||||
screen_reader_speak("New game started.", true);
|
||||
game_started = true;
|
||||
@@ -95,7 +104,7 @@ void main()
|
||||
|
||||
if(key_pressed(KEY_ESCAPE))
|
||||
{
|
||||
int really_exit = ui_question("Draugnorak", "Really exit?");
|
||||
int really_exit = ui_question("", "Really exit?");
|
||||
if (really_exit == 1) {
|
||||
exit();
|
||||
}
|
||||
@@ -104,12 +113,15 @@ void main()
|
||||
// Time & Environment updates
|
||||
update_time();
|
||||
update_crossfade();
|
||||
update_weather();
|
||||
update_environment();
|
||||
update_snares();
|
||||
update_streams();
|
||||
update_fires();
|
||||
update_zombies();
|
||||
update_bandits();
|
||||
update_flying_creatures();
|
||||
update_world_drops();
|
||||
update_blessings();
|
||||
update_notifications();
|
||||
|
||||
@@ -144,6 +156,7 @@ void main()
|
||||
check_inventory_keys(x);
|
||||
check_action_menu(x);
|
||||
check_crafting_menu(x, BASE_END);
|
||||
check_altar_menu(x);
|
||||
check_equipment_menu();
|
||||
check_quest_menu();
|
||||
check_quick_slot_keys();
|
||||
|
||||
@@ -216,15 +216,44 @@ void run_buildings_menu() {
|
||||
screen_reader_speak("Buildings.", true);
|
||||
|
||||
int selection = 0;
|
||||
string[] options = {
|
||||
"Firepit (9 Stones)",
|
||||
"Fire (2 Sticks, 1 Log) [Requires Firepit]",
|
||||
"Herb Garden (9 Stones, 3 Vines, 2 Logs) [Base Only]",
|
||||
"Storage (6 Logs, 9 Stones, 8 Vines) [Base Only]",
|
||||
"Pasture (8 Logs, 20 Vines) [Base Only]",
|
||||
"Stable (10 Logs, 15 Stones, 10 Vines) [Base Only]",
|
||||
"Altar (9 Stones, 3 Sticks) [Base Only]"
|
||||
};
|
||||
string[] options;
|
||||
int[] building_types;
|
||||
|
||||
// Firepit and Fire are always available
|
||||
options.insert_last("Firepit (9 Stones)");
|
||||
building_types.insert_last(0);
|
||||
options.insert_last("Fire (2 Sticks, 1 Log) [Requires Firepit]");
|
||||
building_types.insert_last(1);
|
||||
|
||||
// Only show herb garden if not already built in base
|
||||
if (get_herb_garden_at_base() == null) {
|
||||
options.insert_last("Herb Garden (9 Stones, 3 Vines, 2 Logs) [Base Only]");
|
||||
building_types.insert_last(2);
|
||||
}
|
||||
|
||||
// Only show storage if none built yet
|
||||
if (world_storages.length() == 0) {
|
||||
options.insert_last("Storage (6 Logs, 9 Stones, 8 Vines) [Base Only]");
|
||||
building_types.insert_last(3);
|
||||
}
|
||||
|
||||
// Only show pasture if not built
|
||||
if (world_pastures.length() == 0) {
|
||||
options.insert_last("Pasture (8 Logs, 20 Vines) [Base Only]");
|
||||
building_types.insert_last(4);
|
||||
}
|
||||
|
||||
// Only show stable if not built
|
||||
if (world_stables.length() == 0) {
|
||||
options.insert_last("Stable (10 Logs, 15 Stones, 10 Vines) [Base Only]");
|
||||
building_types.insert_last(5);
|
||||
}
|
||||
|
||||
// Only show altar if not built
|
||||
if (world_altars.length() == 0) {
|
||||
options.insert_last("Altar (9 Stones, 3 Sticks) [Base Only]");
|
||||
building_types.insert_last(6);
|
||||
}
|
||||
|
||||
while(true) {
|
||||
wait(5);
|
||||
@@ -247,13 +276,14 @@ void run_buildings_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
if (selection == 0) craft_firepit();
|
||||
else if (selection == 1) craft_campfire();
|
||||
else if (selection == 2) craft_herb_garden();
|
||||
else if (selection == 3) craft_storage();
|
||||
else if (selection == 4) craft_pasture();
|
||||
else if (selection == 5) craft_stable();
|
||||
else if (selection == 6) craft_altar();
|
||||
int building = building_types[selection];
|
||||
if (building == 0) craft_firepit();
|
||||
else if (building == 1) craft_campfire();
|
||||
else if (building == 2) craft_herb_garden();
|
||||
else if (building == 3) craft_storage();
|
||||
else if (building == 4) craft_pasture();
|
||||
else if (building == 5) craft_stable();
|
||||
else if (building == 6) craft_altar();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user