Pause button, backspace, added.

This commit is contained in:
Storm Dragon
2026-01-21 10:37:14 -05:00
parent bcc0c7db01
commit 7eb62b0d70
6 changed files with 37 additions and 9 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ lib_windows/
stub/
include/
save.dat
.aider*

View File

@@ -101,7 +101,26 @@ void main()
while(true)
{
wait(5);
// Pause toggle
if(key_pressed(KEY_BACK))
{
game_paused = !game_paused;
if (game_paused) {
p.pause_all();
screen_reader_speak("Paused. Press backspace to resume.", true);
} else {
p.resume_all();
screen_reader_speak("Resumed.", true);
}
continue;
}
// Skip all game logic while paused
if (game_paused) {
continue;
}
if(key_pressed(KEY_ESCAPE))
{
int really_exit = ui_question("", "Really exit?");
@@ -120,6 +139,7 @@ void main()
update_fires();
update_zombies();
update_bandits();
update_boars();
update_flying_creatures();
update_world_drops();
update_blessings();

View File

@@ -54,7 +54,7 @@ const int ZOMBIE_ATTACK_MAX_HEIGHT = 6;
// Boar settings
const int BOAR_HEALTH = 4;
const int BOAR_MAX_COUNT = 3;
const int BOAR_MAX_COUNT = 1;
const int BOAR_MOVE_INTERVAL_MIN = 800;
const int BOAR_MOVE_INTERVAL_MAX = 1500;
const int BOAR_ATTACK_INTERVAL = 1500;
@@ -66,6 +66,7 @@ const int BOAR_FOOTSTEP_MAX_DISTANCE = 5;
const float BOAR_SOUND_VOLUME_STEP = 3.0;
const int BOAR_SIGHT_RANGE = 4;
const int BOAR_CHARGE_SPEED = 500; // ms per tile when charging
const int BOAR_SPAWN_CHANCE_PER_HOUR = 30;
// Barricade configuration
const int BARRICADE_BASE_HEALTH = 100;

View File

@@ -50,3 +50,6 @@ timer attack_timer;
// Search state
bool searching = false;
// Pause state
bool game_paused = false;

View File

@@ -403,6 +403,7 @@ void update_time() {
keep_base_fires_fed();
update_incense_burning();
attempt_hourly_flying_creature_spawn();
attempt_hourly_boar_spawn();
check_scheduled_invasion();
attempt_blessing();
check_weather_transition();

View File

@@ -1141,18 +1141,20 @@ void update_boar(GameBoar@ boar) {
}
void update_boars() {
// Only spawn if map is expanded
if (expanded_area_start != -1) {
while (boars.length() < BOAR_MAX_COUNT) {
spawn_boar(expanded_area_start, expanded_area_end);
}
}
for (uint i = 0; i < boars.length(); i++) {
update_boar(boars[i]);
}
}
void attempt_hourly_boar_spawn() {
if (expanded_area_start == -1) return;
if (boars.length() >= BOAR_MAX_COUNT) return;
if (random(1, 100) <= BOAR_SPAWN_CHANCE_PER_HOUR) {
spawn_boar(expanded_area_start, expanded_area_end);
}
}
bool damage_boar_at(int pos, int damage) {
for (uint i = 0; i < boars.length(); i++) {
if (boars[i].position == pos) {