Pause button, backspace, added.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ lib_windows/
|
|||||||
stub/
|
stub/
|
||||||
include/
|
include/
|
||||||
save.dat
|
save.dat
|
||||||
|
.aider*
|
||||||
|
|||||||
@@ -101,7 +101,26 @@ void main()
|
|||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
wait(5);
|
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))
|
if(key_pressed(KEY_ESCAPE))
|
||||||
{
|
{
|
||||||
int really_exit = ui_question("", "Really exit?");
|
int really_exit = ui_question("", "Really exit?");
|
||||||
@@ -120,6 +139,7 @@ void main()
|
|||||||
update_fires();
|
update_fires();
|
||||||
update_zombies();
|
update_zombies();
|
||||||
update_bandits();
|
update_bandits();
|
||||||
|
update_boars();
|
||||||
update_flying_creatures();
|
update_flying_creatures();
|
||||||
update_world_drops();
|
update_world_drops();
|
||||||
update_blessings();
|
update_blessings();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const int ZOMBIE_ATTACK_MAX_HEIGHT = 6;
|
|||||||
|
|
||||||
// Boar settings
|
// Boar settings
|
||||||
const int BOAR_HEALTH = 4;
|
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_MIN = 800;
|
||||||
const int BOAR_MOVE_INTERVAL_MAX = 1500;
|
const int BOAR_MOVE_INTERVAL_MAX = 1500;
|
||||||
const int BOAR_ATTACK_INTERVAL = 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 float BOAR_SOUND_VOLUME_STEP = 3.0;
|
||||||
const int BOAR_SIGHT_RANGE = 4;
|
const int BOAR_SIGHT_RANGE = 4;
|
||||||
const int BOAR_CHARGE_SPEED = 500; // ms per tile when charging
|
const int BOAR_CHARGE_SPEED = 500; // ms per tile when charging
|
||||||
|
const int BOAR_SPAWN_CHANCE_PER_HOUR = 30;
|
||||||
|
|
||||||
// Barricade configuration
|
// Barricade configuration
|
||||||
const int BARRICADE_BASE_HEALTH = 100;
|
const int BARRICADE_BASE_HEALTH = 100;
|
||||||
|
|||||||
@@ -50,3 +50,6 @@ timer attack_timer;
|
|||||||
|
|
||||||
// Search state
|
// Search state
|
||||||
bool searching = false;
|
bool searching = false;
|
||||||
|
|
||||||
|
// Pause state
|
||||||
|
bool game_paused = false;
|
||||||
|
|||||||
@@ -403,6 +403,7 @@ void update_time() {
|
|||||||
keep_base_fires_fed();
|
keep_base_fires_fed();
|
||||||
update_incense_burning();
|
update_incense_burning();
|
||||||
attempt_hourly_flying_creature_spawn();
|
attempt_hourly_flying_creature_spawn();
|
||||||
|
attempt_hourly_boar_spawn();
|
||||||
check_scheduled_invasion();
|
check_scheduled_invasion();
|
||||||
attempt_blessing();
|
attempt_blessing();
|
||||||
check_weather_transition();
|
check_weather_transition();
|
||||||
|
|||||||
@@ -1141,18 +1141,20 @@ void update_boar(GameBoar@ boar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update_boars() {
|
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++) {
|
for (uint i = 0; i < boars.length(); i++) {
|
||||||
update_boar(boars[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) {
|
bool damage_boar_at(int pos, int damage) {
|
||||||
for (uint i = 0; i < boars.length(); i++) {
|
for (uint i = 0; i < boars.length(); i++) {
|
||||||
if (boars[i].position == pos) {
|
if (boars[i].position == pos) {
|
||||||
|
|||||||
Reference in New Issue
Block a user