Updates to mines.
This commit is contained in:
parent
daa8eff104
commit
3bf73b5d70
|
@ -51,6 +51,9 @@ CC BY-NC-SA 3.0, with the following attribution: Copyright 2015-2016, Stephen J
|
||||||
* 251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg - fusion-gun_flash0_by_OnlyTheGhosts.wav, by OnlyTheGhosts - https://freesound.org/people/OnlyTheGhosts/sounds/251431/
|
* 251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg - fusion-gun_flash0_by_OnlyTheGhosts.wav, by OnlyTheGhosts - https://freesound.org/people/OnlyTheGhosts/sounds/251431/
|
||||||
* 172591__timbre__zapitydooda.ogg - d1clsstf.wav, by wildweasel - https://freesound.org/people/wildweasel/sounds/39030/
|
* 172591__timbre__zapitydooda.ogg - d1clsstf.wav, by wildweasel - https://freesound.org/people/wildweasel/sounds/39030/
|
||||||
* 39030__wildweasel__d1clsstf.ogg - push_button_switch_07.wav, by joedeshon - https://freesound.org/people/joedeshon/sounds/139061/
|
* 39030__wildweasel__d1clsstf.ogg - push_button_switch_07.wav, by joedeshon - https://freesound.org/people/joedeshon/sounds/139061/
|
||||||
|
* 254174__kwahmah-02__s.ogg - s.wav, by kwahmah_02 - https://freesound.org/people/kwahmah_02/sounds/254174/
|
||||||
|
* 172870__escortmarius__carbidexplosion.ogg - carbidexplosion.wav, by escortmarius - https://freesound.org/people/escortmarius/sounds/172870/
|
||||||
|
|
||||||
|
|
||||||
### MUSIC
|
### MUSIC
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 988 B |
Binary file not shown.
Binary file not shown.
|
@ -312,6 +312,26 @@ void addMineExplosion(void)
|
||||||
e->x -= e->size / 2;
|
e->x -= e->size / 2;
|
||||||
e->y -= e->size / 2;
|
e->y -= e->size / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e = malloc(sizeof(Effect));
|
||||||
|
|
||||||
|
memset(e, 0, sizeof(Effect));
|
||||||
|
battle.effectTail->next = e;
|
||||||
|
battle.effectTail = e;
|
||||||
|
|
||||||
|
e->type = EFFECT_HALO;
|
||||||
|
e->x = self->x;
|
||||||
|
e->y = self->y;
|
||||||
|
e->size = 32;
|
||||||
|
e->scaleAmount = 2;
|
||||||
|
e->texture = haloTexture;
|
||||||
|
|
||||||
|
e->r = 255;
|
||||||
|
e->g = 255;
|
||||||
|
e->b = 255;
|
||||||
|
e->a = 128;
|
||||||
|
|
||||||
|
e->health = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLargeExplosion(void)
|
void addLargeExplosion(void)
|
||||||
|
|
|
@ -23,6 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void think(void);
|
static void think(void);
|
||||||
static void die(void);
|
static void die(void);
|
||||||
static void lookForFighters(void);
|
static void lookForFighters(void);
|
||||||
|
static void doSplashDamage(void);
|
||||||
|
|
||||||
|
static SDL_Texture *mineWarning;
|
||||||
|
static SDL_Texture *mineNormal;
|
||||||
|
|
||||||
Entity *spawnMine(void)
|
Entity *spawnMine(void)
|
||||||
{
|
{
|
||||||
|
@ -30,16 +34,22 @@ Entity *spawnMine(void)
|
||||||
|
|
||||||
mine->type = ET_MINE;
|
mine->type = ET_MINE;
|
||||||
mine->health = mine->maxHealth = 1;
|
mine->health = mine->maxHealth = 1;
|
||||||
|
mine->systemPower = SYSTEM_POWER;
|
||||||
mine->texture = getTexture("gfx/entities/mine.png");
|
mine->texture = getTexture("gfx/entities/mine.png");
|
||||||
mine->action = think;
|
mine->action = think;
|
||||||
mine->die = die;
|
mine->die = die;
|
||||||
mine->flags = EF_TAKES_DAMAGE+EF_SHORT_RADAR_RANGE;
|
mine->flags = EF_TAKES_DAMAGE+EF_SHORT_RADAR_RANGE+EF_NO_TARGET;
|
||||||
|
|
||||||
|
mineNormal = getTexture("gfx/entities/mine.png");
|
||||||
|
mineWarning = getTexture("gfx/entities/mineWarning.png");
|
||||||
|
|
||||||
return mine;
|
return mine;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void think(void)
|
static void think(void)
|
||||||
{
|
{
|
||||||
|
self->texture = mineNormal;
|
||||||
|
|
||||||
self->angle += 0.1;
|
self->angle += 0.1;
|
||||||
|
|
||||||
if (self->angle >= 360)
|
if (self->angle >= 360)
|
||||||
|
@ -48,13 +58,13 @@ static void think(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
lookForFighters();
|
lookForFighters();
|
||||||
}
|
|
||||||
|
|
||||||
static void die(void)
|
if (self->systemPower < SYSTEM_POWER && SDL_GetTicks() % 150 < 75)
|
||||||
{
|
{
|
||||||
addMineExplosion();
|
playBattleSound(SND_MINE_WARNING, self->x, self->y);
|
||||||
|
|
||||||
self->alive = ALIVE_DEAD;
|
self->texture = mineWarning;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lookForFighters(void)
|
static void lookForFighters(void)
|
||||||
|
@ -62,13 +72,63 @@ static void lookForFighters(void)
|
||||||
Entity *e, **candidates;
|
Entity *e, **candidates;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
candidates = getAllEntsWithin(self->x - (self->w / 2) - DAMAGE_RANGE, self->y - (self->h / 2) - DAMAGE_RANGE, self->w + DAMAGE_RANGE, self->h + DAMAGE_RANGE, self);
|
||||||
|
|
||||||
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
|
{
|
||||||
|
if (e->health > 0 && e->type == ET_FIGHTER && getDistance(self->x, self->y, e->x, e->y) <= TRIGGER_RANGE)
|
||||||
|
{
|
||||||
|
self->systemPower--;
|
||||||
|
|
||||||
|
if (self->systemPower <= 0)
|
||||||
|
{
|
||||||
|
self->health = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self->systemPower = SYSTEM_POWER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void die(void)
|
||||||
|
{
|
||||||
|
addMineExplosion();
|
||||||
|
|
||||||
|
doSplashDamage();
|
||||||
|
|
||||||
|
playBattleSound(SND_EXPLOSION_5, self->x, self->y);
|
||||||
|
|
||||||
|
self->alive = ALIVE_DEAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void doSplashDamage(void)
|
||||||
|
{
|
||||||
|
Entity *e, **candidates;
|
||||||
|
int i, dist;
|
||||||
|
float damage, percent;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, self);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
{
|
{
|
||||||
if (e->health > 0 && e->type == ET_FIGHTER && getDistance(self->x, self->y, e->x, e->y) <= 128)
|
if (e->health > 0 && e->type == ET_FIGHTER)
|
||||||
{
|
{
|
||||||
self->health = 0;
|
dist = getDistance(self->x, self->y, e->x, e->y);
|
||||||
|
|
||||||
|
if (dist <= DAMAGE_RANGE)
|
||||||
|
{
|
||||||
|
percent = dist;
|
||||||
|
percent /= DAMAGE_RANGE;
|
||||||
|
percent = 1 - percent;
|
||||||
|
|
||||||
|
damage = 100;
|
||||||
|
damage *= percent;
|
||||||
|
|
||||||
|
damageFighter(e, damage, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
|
||||||
|
#define TRIGGER_RANGE 150
|
||||||
|
#define DAMAGE_RANGE 255
|
||||||
|
#define SYSTEM_POWER 75
|
||||||
|
|
||||||
extern Entity *spawnEntity(void);
|
extern Entity *spawnEntity(void);
|
||||||
extern SDL_Texture *getTexture(char *filename);
|
extern SDL_Texture *getTexture(char *filename);
|
||||||
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||||
extern void addMineExplosion(void);
|
extern void addMineExplosion(void);
|
||||||
|
extern void damageFighter(Entity *e, int amount, long flags);
|
||||||
|
extern void playBattleSound(int id, int x, int y);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
|
|
|
@ -480,7 +480,7 @@ static void selectTarget(void)
|
||||||
|
|
||||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||||
{
|
{
|
||||||
if (e->active && e != player && (e->flags & EF_TAKES_DAMAGE) && e->side != player->side && e->alive == ALIVE_ALIVE && e->systemPower > 0 && i < MAX_SELECTABLE_TARGETS)
|
if (e->active && e != player && (e->flags & EF_TAKES_DAMAGE) && (!(e->flags & EF_NO_TARGET)) && e->side != player->side && e->alive == ALIVE_ALIVE && e->systemPower > 0 && i < MAX_SELECTABLE_TARGETS)
|
||||||
{
|
{
|
||||||
dist = getDistance(self->x, self->y, e->x, e->y);
|
dist = getDistance(self->x, self->y, e->x, e->y);
|
||||||
if (dist < closest)
|
if (dist < closest)
|
||||||
|
|
|
@ -98,6 +98,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define EF_ROPED_ATTACHED (2 << 15)
|
#define EF_ROPED_ATTACHED (2 << 15)
|
||||||
#define EF_NO_KILL_INC (2 << 16)
|
#define EF_NO_KILL_INC (2 << 16)
|
||||||
#define EF_SHORT_RADAR_RANGE (2 << 17)
|
#define EF_SHORT_RADAR_RANGE (2 << 17)
|
||||||
|
#define EF_NO_TARGET (2 << 18)
|
||||||
|
|
||||||
#define AIF_NONE 0
|
#define AIF_NONE 0
|
||||||
#define AIF_FOLLOWS_PLAYER (2 << 0)
|
#define AIF_FOLLOWS_PLAYER (2 << 0)
|
||||||
|
@ -228,6 +229,7 @@ enum
|
||||||
SND_EXPLOSION_2,
|
SND_EXPLOSION_2,
|
||||||
SND_EXPLOSION_3,
|
SND_EXPLOSION_3,
|
||||||
SND_EXPLOSION_4,
|
SND_EXPLOSION_4,
|
||||||
|
SND_EXPLOSION_5,
|
||||||
SND_GET_ITEM,
|
SND_GET_ITEM,
|
||||||
SND_MISSILE,
|
SND_MISSILE,
|
||||||
SND_INCOMING,
|
SND_INCOMING,
|
||||||
|
@ -238,6 +240,7 @@ enum
|
||||||
SND_POWER_DOWN,
|
SND_POWER_DOWN,
|
||||||
SND_BOOST,
|
SND_BOOST,
|
||||||
SND_RADIO,
|
SND_RADIO,
|
||||||
|
SND_MINE_WARNING,
|
||||||
SND_GUI_CLICK,
|
SND_GUI_CLICK,
|
||||||
SND_GUI_SELECT,
|
SND_GUI_SELECT,
|
||||||
SND_GUI_CLOSE,
|
SND_GUI_CLOSE,
|
||||||
|
|
|
@ -112,11 +112,13 @@ static void loadSounds(void)
|
||||||
sounds[SND_EXPLOSION_2] = loadSound("sound/207322__animationisaac__short-explosion.ogg");
|
sounds[SND_EXPLOSION_2] = loadSound("sound/207322__animationisaac__short-explosion.ogg");
|
||||||
sounds[SND_EXPLOSION_3] = loadSound("sound/254071__tb0y298__firework-explosion.ogg");
|
sounds[SND_EXPLOSION_3] = loadSound("sound/254071__tb0y298__firework-explosion.ogg");
|
||||||
sounds[SND_EXPLOSION_4] = loadSound("sound/47252__nthompson__bad-explosion.ogg");
|
sounds[SND_EXPLOSION_4] = loadSound("sound/47252__nthompson__bad-explosion.ogg");
|
||||||
|
sounds[SND_EXPLOSION_5] = loadSound("sound/172870__escortmarius__carbidexplosion.ogg");
|
||||||
sounds[SND_JUMP] = loadSound("sound/276912__pauldihor__transform.ogg");
|
sounds[SND_JUMP] = loadSound("sound/276912__pauldihor__transform.ogg");
|
||||||
sounds[SND_ECM] = loadSound("sound/251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg");
|
sounds[SND_ECM] = loadSound("sound/251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg");
|
||||||
sounds[SND_MAG_HIT] = loadSound("sound/172591__timbre__zapitydooda.ogg");
|
sounds[SND_MAG_HIT] = loadSound("sound/172591__timbre__zapitydooda.ogg");
|
||||||
sounds[SND_POWER_DOWN] = loadSound("sound/39030__wildweasel__d1clsstf.ogg");
|
sounds[SND_POWER_DOWN] = loadSound("sound/39030__wildweasel__d1clsstf.ogg");
|
||||||
sounds[SND_SELECT_WEAPON] = loadSound("sound/329359__bassoonrckr__reed-guillotine.ogg");
|
sounds[SND_SELECT_WEAPON] = loadSound("sound/329359__bassoonrckr__reed-guillotine.ogg");
|
||||||
|
sounds[SND_MINE_WARNING] = loadSound("sound/254174__kwahmah-02__s.ogg");
|
||||||
|
|
||||||
sounds[SND_GUI_CLICK] = loadSound("sound/257786__xtrgamr__mouse-click.ogg");
|
sounds[SND_GUI_CLICK] = loadSound("sound/257786__xtrgamr__mouse-click.ogg");
|
||||||
sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg");
|
sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg");
|
||||||
|
|
Loading…
Reference in New Issue