From 305e9fb05d7a3b1aa0315c99a70d46df2e6cea3d Mon Sep 17 00:00:00 2001 From: Layla Marchant Date: Tue, 26 May 2020 12:42:00 -0400 Subject: [PATCH] Restored original charge cannon behavior for Classic difficulty. --- configure.ac | 2 +- src/bullet.c | 9 ++++++++- src/game.c | 20 ++++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index bb3b3a3..457ad6e 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ # information. This file is offered as-is, without any warranty. AC_PREREQ([2.69]) -AC_INIT([Project: Starfighter], [2.1.1], [diligentcircle@riseup.net], [starfighter]) +AC_INIT([Project: Starfighter], [2.2], [diligentcircle@riseup.net], [starfighter]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AC_CONFIG_SRCDIR([src/Starfighter.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/src/bullet.c b/src/bullet.c index 8db22be..3a46fcf 100644 --- a/src/bullet.c +++ b/src/bullet.c @@ -33,6 +33,7 @@ void bullet_add(Object *theWeapon, Object *attacker, int y, int dy) Object *bullet; int imageIndex; int tempX, tempY, steps; + int min_damage; bullet = malloc(sizeof(*bullet)); if (bullet == NULL) @@ -96,11 +97,17 @@ void bullet_add(Object *theWeapon, Object *attacker, int y, int dy) if (bullet->id == WT_CHARGER) { if (game.difficulty == DIFFICULTY_ORIGINAL) + { bullet->damage = attacker->ammo[1]; + min_damage = 50; + } else + { bullet->damage = attacker->ammo[1] / 2; + min_damage = 15; + } - if (bullet->damage < 15) + if (bullet->damage < min_damage) { bullet->damage = 1; bullet->id = WT_PLASMA; diff --git a/src/game.c b/src/game.c index d63f0c8..134fda1 100644 --- a/src/game.c +++ b/src/game.c @@ -760,11 +760,23 @@ static void game_doBullets() if (bullet->id == WT_CHARGER) { - bullet->damage -= old_shield; - if (bullet->damage <= 0) + if (game.difficulty == DIFFICULTY_ORIGINAL) + { + bullet->shield -= old_shield; + if (bullet->shield < 0) + bullet->active = 0; + } + else + { + bullet->damage -= old_shield; + if (bullet->damage <= 0) + { + bullet->active = 0; + bullet->shield = 0; + } + } + if (!bullet->active) { - bullet->active = 0; - bullet->shield = 0; audio_playSound(SFX_EXPLOSION, bullet->x, bullet->y); for (int i = 0 ; i < 10 ; i++) explosion_add(bullet->x + RANDRANGE(-35, 35),