Adjusted the delay of ray damage, plus some misc code fixes.
This commit is contained in:
parent
281687b1c5
commit
d7dc0844c8
|
@ -1848,7 +1848,6 @@ void alien_move(Object *alien)
|
||||||
player_damage(alien->shield, 0);
|
player_damage(alien->shield, 0);
|
||||||
alien->shield = 0;
|
alien->shield = 0;
|
||||||
audio_playSound(SFX_EXPLOSION, alien->x, alien->y);
|
audio_playSound(SFX_EXPLOSION, alien->x, alien->y);
|
||||||
audio_playSound(SFX_HIT, player.x, player.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alien->classDef == CD_ASTEROID2)
|
if (alien->classDef == CD_ASTEROID2)
|
||||||
|
@ -1856,13 +1855,11 @@ void alien_move(Object *alien)
|
||||||
player_damage(alien->shield, 0);
|
player_damage(alien->shield, 0);
|
||||||
alien->shield = 0;
|
alien->shield = 0;
|
||||||
audio_playSound(SFX_EXPLOSION, alien->x, alien->y);
|
audio_playSound(SFX_EXPLOSION, alien->x, alien->y);
|
||||||
audio_playSound(SFX_HIT, player.x, player.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alien->classDef == CD_BARRIER)
|
if (alien->classDef == CD_BARRIER)
|
||||||
{
|
{
|
||||||
player_damage(1, 0);
|
player_damage(1, 0);
|
||||||
audio_playSound(SFX_HIT, player.x, player.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MAX_HOMING 20
|
#define MAX_HOMING 20
|
||||||
#define MAX_DOUBLE_HOMING (game.difficulty != DIFFICULTY_ORIGINAL ? 15 : 10)
|
#define MAX_DOUBLE_HOMING (game.difficulty != DIFFICULTY_ORIGINAL ? 15 : 10)
|
||||||
#define MAX_MICRO_HOMING 10
|
#define MAX_MICRO_HOMING 10
|
||||||
#define RAY_DAMAGE_DELAY 10
|
#define RAY_DAMAGE_DELAY 5
|
||||||
|
|
||||||
// Object Flags
|
// Object Flags
|
||||||
#define FL_WEAPCO 1
|
#define FL_WEAPCO 1
|
||||||
|
|
|
@ -175,7 +175,7 @@ Show a warning. Used when non-fatal things go wrong.
|
||||||
*/
|
*/
|
||||||
void engine_warn(const char *msg)
|
void engine_warn(const char *msg)
|
||||||
{
|
{
|
||||||
printf("WARNING: %s", msg);
|
printf("WARNING: %s\n", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -184,7 +184,7 @@ never happen.
|
||||||
*/
|
*/
|
||||||
void engine_error(const char *msg)
|
void engine_error(const char *msg)
|
||||||
{
|
{
|
||||||
printf("ERROR: %s\nAborting", msg);
|
printf("ERROR: %s\nAborting\n", msg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -819,8 +819,6 @@ static void game_doBullets()
|
||||||
bullet->shield = 0;
|
bullet->shield = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_playSound(SFX_HIT, player.x, player.y);
|
|
||||||
|
|
||||||
if (bullet->id == WT_ROCKET)
|
if (bullet->id == WT_ROCKET)
|
||||||
explosion_add(bullet->x, bullet->y, SP_BIG_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, SP_BIG_EXPLOSION);
|
||||||
else
|
else
|
||||||
|
|
55
src/player.c
55
src/player.c
|
@ -84,6 +84,12 @@ void player_setTarget(int index)
|
||||||
engine.targetShield /= aliens[index].shield;
|
engine.targetShield /= aliens[index].shield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Attempt to damage the player by ``amount``. If ``delay`` is specified,
|
||||||
|
delay any damage dealt by that number of frames (i.e. require that
|
||||||
|
number of frames of continuous damage before it registers).
|
||||||
|
Return 1 if damage is inflicted, 0 otherwise.
|
||||||
|
*/
|
||||||
void player_damage(int amount, int delay)
|
void player_damage(int amount, int delay)
|
||||||
{
|
{
|
||||||
int oldshield = player.shield;
|
int oldshield = player.shield;
|
||||||
|
@ -100,32 +106,35 @@ void player_damage(int amount, int delay)
|
||||||
(player_damageDelay >= delay))
|
(player_damageDelay >= delay))
|
||||||
{
|
{
|
||||||
player.shield -= amount;
|
player.shield -= amount;
|
||||||
|
|
||||||
|
LIMIT(player.shield, 0, player.maxShield);
|
||||||
|
player.hit = 5; // Damage flash timer
|
||||||
|
audio_playSound(SFX_HIT, player.x, player.y);
|
||||||
|
|
||||||
|
// Damage tiers (not in Classic mode)
|
||||||
|
if ((oldshield > engine.lowShield) &&
|
||||||
|
(player.shield <= engine.lowShield))
|
||||||
|
{
|
||||||
|
info_setLine("!!! WARNING: SHIELD LOW !!!", FONT_RED);
|
||||||
|
if (game.difficulty != DIFFICULTY_ORIGINAL)
|
||||||
|
{
|
||||||
|
player.shield = engine.lowShield;
|
||||||
|
player_damageDelay = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((oldshield > 1) && (player.shield <= 1))
|
||||||
|
{
|
||||||
|
info_setLine("!!! WARNING: SHIELD CRITICAL !!!", FONT_RED);
|
||||||
|
if (game.difficulty != DIFFICULTY_ORIGINAL)
|
||||||
|
{
|
||||||
|
player.shield = 1;
|
||||||
|
player_damageDelay = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player_damageDelay += amount;
|
player_damageDelay += amount;
|
||||||
|
|
||||||
LIMIT(player.shield, 0, player.maxShield);
|
|
||||||
player.hit = 5; // Damage flash timer
|
|
||||||
|
|
||||||
// Damage tiers (not in Classic mode)
|
|
||||||
if ((oldshield > engine.lowShield) &&
|
|
||||||
(player.shield <= engine.lowShield))
|
|
||||||
{
|
|
||||||
info_setLine("!!! WARNING: SHIELD LOW !!!", FONT_RED);
|
|
||||||
if (game.difficulty != DIFFICULTY_ORIGINAL)
|
|
||||||
{
|
|
||||||
player.shield = engine.lowShield;
|
|
||||||
player_damageDelay = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((oldshield > 1) && (player.shield <= 1))
|
|
||||||
{
|
|
||||||
info_setLine("!!! WARNING: SHIELD CRITICAL !!!", FONT_RED);
|
|
||||||
if (game.difficulty != DIFFICULTY_ORIGINAL)
|
|
||||||
{
|
|
||||||
player.shield = 1;
|
|
||||||
player_damageDelay = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,14 +193,7 @@ void ship_fireRay(Object *ship)
|
||||||
(!engine.cheatShield) && (engine.missionCompleteTimer == 0))
|
(!engine.cheatShield) && (engine.missionCompleteTimer == 0))
|
||||||
{
|
{
|
||||||
player_damage(1, RAY_DAMAGE_DELAY);
|
player_damage(1, RAY_DAMAGE_DELAY);
|
||||||
|
|
||||||
explosion_add(player.x, player.y, SP_SMALL_EXPLOSION);
|
explosion_add(player.x, player.y, SP_SMALL_EXPLOSION);
|
||||||
audio_playSound(SFX_HIT, player.x, player.y);
|
|
||||||
if (player.shield < 1)
|
|
||||||
{
|
|
||||||
audio_playSound(SFX_DEATH, player.x, player.y);
|
|
||||||
audio_playSound(SFX_EXPLOSION, player.x, player.y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue