More code cleanup.
This commit is contained in:
parent
a806de8513
commit
98a74e0d44
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
||||||
CXXFLAGS ?= -O2 -Wall -g
|
CXXFLAGS ?= -O2 -Wall -g
|
||||||
CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
|
CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
|
||||||
LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
|
LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
|
||||||
OBJS = alien.o audio.o bullet.o cargo.o collectable.o explosions.o game.o globals.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o ship.o shop.o Starfighter.o title.o weapons.o
|
OBJS = alien.o audio.o bullet.o cargo.o collectable.o explosion.o game.o globals.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o ship.o shop.o Starfighter.o title.o weapons.o
|
||||||
|
|
||||||
VERSION = 1.3.2-dev
|
VERSION = 1.3.2-dev
|
||||||
PROG = starfighter
|
PROG = starfighter
|
||||||
|
|
|
@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "bullet.h"
|
#include "bullet.h"
|
||||||
#include "cargo.h"
|
#include "cargo.h"
|
||||||
#include "collectable.h"
|
#include "collectable.h"
|
||||||
#include "explosions.h"
|
#include "explosion.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "graphics.h"
|
#include "graphics.h"
|
||||||
|
|
|
@ -213,7 +213,7 @@ void collectable_explode(collectables *collectable)
|
||||||
audio_playSound(SFX_EXPLOSION, collectable->x);
|
audio_playSound(SFX_EXPLOSION, collectable->x);
|
||||||
|
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
addExplosion(collectable->x + rand() % 25 - rand() % 25,
|
explosion_add(collectable->x + rand() % 25 - rand() % 25,
|
||||||
collectable->y + rand() % 25 - rand() % 25, E_BIG_EXPLOSION);
|
collectable->y + rand() % 25 - rand() % 25, E_BIG_EXPLOSION);
|
||||||
|
|
||||||
player_checkShockDamage(collectable->x, collectable->y);
|
player_checkShockDamage(collectable->x, collectable->y);
|
||||||
|
|
|
@ -25,7 +25,7 @@ The "type" will actually be used as an explosion frame check.
|
||||||
All explosion types have 4 images. The "thinktime" will be used
|
All explosion types have 4 images. The "thinktime" will be used
|
||||||
to change frames on a 21, 14, 7 basis.
|
to change frames on a 21, 14, 7 basis.
|
||||||
*/
|
*/
|
||||||
void addExplosion(float x, float y, int type)
|
void explosion_add(float x, float y, int type)
|
||||||
{
|
{
|
||||||
object *explosion = new object;
|
object *explosion = new object;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void addExplosion(float x, float y, int type)
|
||||||
* This very simply just adds a tiny explosion at the coordinate specified.
|
* This very simply just adds a tiny explosion at the coordinate specified.
|
||||||
* It creates a small engine like effect.
|
* It creates a small engine like effect.
|
||||||
*/
|
*/
|
||||||
void addEngine(object *craft)
|
void explosion_addEngine(object *craft)
|
||||||
{
|
{
|
||||||
if (rand() % 2 == 0)
|
if (rand() % 2 == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -54,65 +54,5 @@ void addEngine(object *craft)
|
||||||
float y = craft->y + craft->engineY;
|
float y = craft->y + craft->engineY;
|
||||||
|
|
||||||
y += RANDRANGE(-3, 3);
|
y += RANDRANGE(-3, 3);
|
||||||
addExplosion(x, y, E_TINY_EXPLOSION);
|
explosion_add(x, y, E_TINY_EXPLOSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isOnScreen(int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
return (x + w > 0) && (x < 800) && (y + h > 0) && (y < 600);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Loops through active explosions and decrements their think time.
|
|
||||||
If their thinktime is divisable by 5, then the frame is changed to
|
|
||||||
the next one up (for example 0->1->2-3). When their think time is 0,
|
|
||||||
the explosion is killed off.
|
|
||||||
*/
|
|
||||||
void doExplosions()
|
|
||||||
{
|
|
||||||
object *prevExplosion = engine.explosionHead;
|
|
||||||
object *explosion = engine.explosionHead;
|
|
||||||
engine.explosionTail = engine.explosionHead;
|
|
||||||
|
|
||||||
while (explosion->next != NULL)
|
|
||||||
{
|
|
||||||
explosion = explosion->next;
|
|
||||||
|
|
||||||
if (explosion->active)
|
|
||||||
{
|
|
||||||
explosion->x += engine.ssx + engine.smx;
|
|
||||||
explosion->y += engine.ssy + engine.smy;
|
|
||||||
|
|
||||||
if (isOnScreen((int)explosion->x, (int)explosion->y, explosion->image[0]->w, explosion->image[0]->h))
|
|
||||||
blit(explosion->image[0], (int)explosion->x, (int)explosion->y);
|
|
||||||
|
|
||||||
if(rand() % 7 == 0)
|
|
||||||
{
|
|
||||||
explosion->thinktime -= 7;
|
|
||||||
|
|
||||||
if(explosion->thinktime < 1)
|
|
||||||
{
|
|
||||||
explosion->active = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
explosion->face++;
|
|
||||||
explosion->image[0] = shape[explosion->face];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (explosion->active)
|
|
||||||
{
|
|
||||||
prevExplosion = explosion;
|
|
||||||
engine.explosionTail = explosion;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
prevExplosion->next = explosion->next;
|
|
||||||
delete explosion;
|
|
||||||
explosion = prevExplosion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,8 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef EXPLOSIONS_H
|
#ifndef EXPLOSIONS_H
|
||||||
#define EXPLOSIONS_H
|
#define EXPLOSIONS_H
|
||||||
|
|
||||||
extern void addExplosion(float x, float y, int type);
|
void explosion_add(float x, float y, int type);
|
||||||
extern void addEngine(object *craft);
|
void explosion_addEngine(object *craft);
|
||||||
extern void doExplosions();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
91
src/game.cpp
91
src/game.cpp
|
@ -460,11 +460,11 @@ static void game_doBullets()
|
||||||
|
|
||||||
if (bullet->id == WT_ROCKET)
|
if (bullet->id == WT_ROCKET)
|
||||||
{
|
{
|
||||||
addExplosion(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
||||||
}
|
}
|
||||||
else if (bullet->id == WT_MICROROCKET)
|
else if (bullet->id == WT_MICROROCKET)
|
||||||
{
|
{
|
||||||
addExplosion(bullet->x, bullet->y, E_TINY_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_TINY_EXPLOSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bullet->flags & WF_AIMED))
|
if ((bullet->flags & WF_AIMED))
|
||||||
|
@ -561,7 +561,7 @@ static void game_doBullets()
|
||||||
bullet->shield = 0;
|
bullet->shield = 0;
|
||||||
audio_playSound(SFX_EXPLOSION, bullet->x);
|
audio_playSound(SFX_EXPLOSION, bullet->x);
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
addExplosion(bullet->x + RANDRANGE(-35, 35),
|
explosion_add(bullet->x + RANDRANGE(-35, 35),
|
||||||
bullet->y + RANDRANGE(-35, 35),
|
bullet->y + RANDRANGE(-35, 35),
|
||||||
E_BIG_EXPLOSION);
|
E_BIG_EXPLOSION);
|
||||||
}
|
}
|
||||||
|
@ -573,9 +573,9 @@ static void game_doBullets()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bullet->id == WT_ROCKET)
|
if (bullet->id == WT_ROCKET)
|
||||||
addExplosion(bullet->x, bullet->y, E_BIG_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_BIG_EXPLOSION);
|
||||||
else
|
else
|
||||||
addExplosion(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ static void game_doBullets()
|
||||||
bullet->shield = 0;
|
bullet->shield = 0;
|
||||||
audio_playSound(SFX_EXPLOSION, bullet->x);
|
audio_playSound(SFX_EXPLOSION, bullet->x);
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
addExplosion(bullet->x + RANDRANGE(-35, 35),
|
explosion_add(bullet->x + RANDRANGE(-35, 35),
|
||||||
bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION);
|
bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,9 +626,9 @@ static void game_doBullets()
|
||||||
audio_playSound(SFX_HIT, player.x);
|
audio_playSound(SFX_HIT, player.x);
|
||||||
|
|
||||||
if (bullet->id == WT_ROCKET)
|
if (bullet->id == WT_ROCKET)
|
||||||
addExplosion(bullet->x, bullet->y, E_BIG_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_BIG_EXPLOSION);
|
||||||
else
|
else
|
||||||
addExplosion(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,14 +643,14 @@ static void game_doBullets()
|
||||||
if (collision(bullet, &cargo[j]))
|
if (collision(bullet, &cargo[j]))
|
||||||
{
|
{
|
||||||
bullet->active = false;
|
bullet->active = false;
|
||||||
addExplosion(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
explosion_add(bullet->x, bullet->y, E_SMALL_EXPLOSION);
|
||||||
audio_playSound(SFX_HIT, cargo[j].x);
|
audio_playSound(SFX_HIT, cargo[j].x);
|
||||||
if (cargo[j].collectType != P_PHOEBE)
|
if (cargo[j].collectType != P_PHOEBE)
|
||||||
{
|
{
|
||||||
cargo[j].active = false;
|
cargo[j].active = false;
|
||||||
audio_playSound(SFX_EXPLOSION, cargo[j].x);
|
audio_playSound(SFX_EXPLOSION, cargo[j].x);
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
addExplosion(cargo[j].x + RANDRANGE(-15, 15),
|
explosion_add(cargo[j].x + RANDRANGE(-15, 15),
|
||||||
cargo[j].y + RANDRANGE(-15, 15),
|
cargo[j].y + RANDRANGE(-15, 15),
|
||||||
E_BIG_EXPLOSION);
|
E_BIG_EXPLOSION);
|
||||||
updateMissionRequirements(M_PROTECT_PICKUP,
|
updateMissionRequirements(M_PROTECT_PICKUP,
|
||||||
|
@ -716,7 +716,7 @@ static void game_doBullets()
|
||||||
{
|
{
|
||||||
audio_playSound(SFX_EXPLOSION, bullet->x);
|
audio_playSound(SFX_EXPLOSION, bullet->x);
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
addExplosion(bullet->x + RANDRANGE(-35, 35),
|
explosion_add(bullet->x + RANDRANGE(-35, 35),
|
||||||
bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION);
|
bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION);
|
||||||
|
|
||||||
player_checkShockDamage(bullet->x, bullet->y);
|
player_checkShockDamage(bullet->x, bullet->y);
|
||||||
|
@ -1008,14 +1008,14 @@ static void game_doAliens()
|
||||||
if ((!(aliens[i].flags & FL_DISABLED)) &&
|
if ((!(aliens[i].flags & FL_DISABLED)) &&
|
||||||
(aliens[i].classDef != CD_ASTEROID) &&
|
(aliens[i].classDef != CD_ASTEROID) &&
|
||||||
(aliens[i].classDef != CD_ASTEROID2))
|
(aliens[i].classDef != CD_ASTEROID2))
|
||||||
addEngine(&aliens[i]);
|
explosion_addEngine(&aliens[i]);
|
||||||
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0))
|
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0))
|
||||||
blit(shipShape[shapeToUse], (int)aliens[i].x,
|
blit(shipShape[shapeToUse], (int)aliens[i].x,
|
||||||
(int)aliens[i].y);
|
(int)aliens[i].y);
|
||||||
if (aliens[i].flags & FL_DISABLED)
|
if (aliens[i].flags & FL_DISABLED)
|
||||||
{
|
{
|
||||||
if ((rand() % 10) == 0)
|
if ((rand() % 10) == 0)
|
||||||
addExplosion(aliens[i].x + (rand() % aliens[i].image[0]->w),
|
explosion_add(aliens[i].x + (rand() % aliens[i].image[0]->w),
|
||||||
aliens[i].y + (rand() % aliens[i].image[0]->h),
|
aliens[i].y + (rand() % aliens[i].image[0]->h),
|
||||||
E_ELECTRICAL);
|
E_ELECTRICAL);
|
||||||
}
|
}
|
||||||
|
@ -1032,7 +1032,7 @@ static void game_doAliens()
|
||||||
{
|
{
|
||||||
blit(aliens[i].image[aliens[i].face], (int)aliens[i].x,
|
blit(aliens[i].image[aliens[i].face], (int)aliens[i].x,
|
||||||
(int)aliens[i].y);
|
(int)aliens[i].y);
|
||||||
addExplosion(aliens[i].x + (rand() % aliens[i].image[0]->w),
|
explosion_add(aliens[i].x + (rand() % aliens[i].image[0]->w),
|
||||||
aliens[i].y + (rand() % aliens[i].image[0]->h),
|
aliens[i].y + (rand() % aliens[i].image[0]->h),
|
||||||
E_BIG_EXPLOSION);
|
E_BIG_EXPLOSION);
|
||||||
}
|
}
|
||||||
|
@ -1293,7 +1293,7 @@ static void game_doPlayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((player.maxShield <= 1) || (player.shield > engine.lowShield))
|
if ((player.maxShield <= 1) || (player.shield > engine.lowShield))
|
||||||
addEngine(&player);
|
explosion_addEngine(&player);
|
||||||
|
|
||||||
shapeToUse = player.face;
|
shapeToUse = player.face;
|
||||||
|
|
||||||
|
@ -1305,7 +1305,7 @@ static void game_doPlayer()
|
||||||
blit(shipShape[shapeToUse], (int)player.x, (int)player.y);
|
blit(shipShape[shapeToUse], (int)player.x, (int)player.y);
|
||||||
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) &&
|
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) &&
|
||||||
(rand() % 5 < 1))
|
(rand() % 5 < 1))
|
||||||
addExplosion(player.x + RANDRANGE(-10, 10),
|
explosion_add(player.x + RANDRANGE(-10, 10),
|
||||||
player.y + RANDRANGE(-10, 20), E_SMOKE);
|
player.y + RANDRANGE(-10, 20), E_SMOKE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1330,7 +1330,7 @@ static void game_doPlayer()
|
||||||
|
|
||||||
engine.keyState[KEY_UP] = engine.keyState[KEY_DOWN] = engine.keyState[KEY_LEFT] = engine.keyState[KEY_RIGHT] = 0;
|
engine.keyState[KEY_UP] = engine.keyState[KEY_DOWN] = engine.keyState[KEY_LEFT] = engine.keyState[KEY_RIGHT] = 0;
|
||||||
if ((rand() % 3) == 0)
|
if ((rand() % 3) == 0)
|
||||||
addExplosion(player.x + RANDRANGE(-10, 10),
|
explosion_add(player.x + RANDRANGE(-10, 10),
|
||||||
player.y + RANDRANGE(-10, 10), E_BIG_EXPLOSION);
|
player.y + RANDRANGE(-10, 10), E_BIG_EXPLOSION);
|
||||||
if (player.shield == -99)
|
if (player.shield == -99)
|
||||||
game_addDebris((int)player.x, (int)player.y, player.maxShield);
|
game_addDebris((int)player.x, (int)player.y, player.maxShield);
|
||||||
|
@ -1415,7 +1415,7 @@ static void game_doDebris()
|
||||||
debris->x += debris->dx;
|
debris->x += debris->dx;
|
||||||
debris->y += debris->dy;
|
debris->y += debris->dy;
|
||||||
|
|
||||||
addExplosion(debris->x + RANDRANGE(-10, 10), debris->y + RANDRANGE(-10, 10), E_BIG_EXPLOSION);
|
explosion_add(debris->x + RANDRANGE(-10, 10), debris->y + RANDRANGE(-10, 10), E_BIG_EXPLOSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debris->thinktime < 1)
|
if (debris->thinktime < 1)
|
||||||
|
@ -1433,6 +1433,59 @@ static void game_doDebris()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Loops through active explosions and decrements their think time.
|
||||||
|
If their thinktime is divisable by 5, then the frame is changed to
|
||||||
|
the next one up (for example 0->1->2-3). When their think time is 0,
|
||||||
|
the explosion is killed off.
|
||||||
|
*/
|
||||||
|
void game_doExplosions()
|
||||||
|
{
|
||||||
|
object *prevExplosion = engine.explosionHead;
|
||||||
|
object *explosion = engine.explosionHead;
|
||||||
|
engine.explosionTail = engine.explosionHead;
|
||||||
|
|
||||||
|
while (explosion->next != NULL)
|
||||||
|
{
|
||||||
|
explosion = explosion->next;
|
||||||
|
|
||||||
|
if (explosion->active)
|
||||||
|
{
|
||||||
|
explosion->x += engine.ssx + engine.smx;
|
||||||
|
explosion->y += engine.ssy + engine.smy;
|
||||||
|
|
||||||
|
blit(explosion->image[0], (int)explosion->x, (int)explosion->y);
|
||||||
|
|
||||||
|
if(rand() % 7 == 0)
|
||||||
|
{
|
||||||
|
explosion->thinktime -= 7;
|
||||||
|
|
||||||
|
if(explosion->thinktime < 1)
|
||||||
|
{
|
||||||
|
explosion->active = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
explosion->face++;
|
||||||
|
explosion->image[0] = shape[explosion->face];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (explosion->active)
|
||||||
|
{
|
||||||
|
prevExplosion = explosion;
|
||||||
|
engine.explosionTail = explosion;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prevExplosion->next = explosion->next;
|
||||||
|
delete explosion;
|
||||||
|
explosion = prevExplosion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Checked during the main game loop. When the game is paused
|
Checked during the main game loop. When the game is paused
|
||||||
it goes into a constant loop checking this routine. If escape is
|
it goes into a constant loop checking this routine. If escape is
|
||||||
|
@ -1735,7 +1788,7 @@ int mainGameLoop()
|
||||||
game_doPlayer();
|
game_doPlayer();
|
||||||
game_doCargo();
|
game_doCargo();
|
||||||
game_doDebris();
|
game_doDebris();
|
||||||
doExplosions();
|
game_doExplosions();
|
||||||
doInfo();
|
doInfo();
|
||||||
|
|
||||||
WRAP_ADD(engine.eventTimer, -1, 0, 60);
|
WRAP_ADD(engine.eventTimer, -1, 0, 60);
|
||||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
extern Game currentGame;
|
extern Game currentGame;
|
||||||
|
|
||||||
extern void newGame();
|
extern void newGame();
|
||||||
|
void game_doExplosions();
|
||||||
extern int mainGameLoop();
|
extern int mainGameLoop();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -244,13 +244,13 @@ void doCutscene(int scene)
|
||||||
unBuffer();
|
unBuffer();
|
||||||
getPlayerInput();
|
getPlayerInput();
|
||||||
doStarfield();
|
doStarfield();
|
||||||
doExplosions();
|
game_doExplosions();
|
||||||
|
|
||||||
for (int i = 0 ; i < 15 ; i++)
|
for (int i = 0 ; i < 15 ; i++)
|
||||||
{
|
{
|
||||||
if (aliens[i].active)
|
if (aliens[i].active)
|
||||||
{
|
{
|
||||||
addEngine(&aliens[i]);
|
explosion_addEngine(&aliens[i]);
|
||||||
if (scene == 0 && i > 0 && (timer % 15) == i) {
|
if (scene == 0 && i > 0 && (timer % 15) == i) {
|
||||||
aliens[i].dx += (drand48() - 0.5) * 0.1;
|
aliens[i].dx += (drand48() - 0.5) * 0.1;
|
||||||
aliens[i].dy += (drand48() - 0.5) * 0.1;
|
aliens[i].dy += (drand48() - 0.5) * 0.1;
|
||||||
|
|
|
@ -155,7 +155,7 @@ void ship_fireRay(object *ship)
|
||||||
}
|
}
|
||||||
player.shield--;
|
player.shield--;
|
||||||
|
|
||||||
addExplosion(player.x, player.y, E_SMALL_EXPLOSION);
|
explosion_add(player.x, player.y, E_SMALL_EXPLOSION);
|
||||||
audio_playSound(SFX_HIT, player.x);
|
audio_playSound(SFX_HIT, player.x);
|
||||||
if (player.shield < 1)
|
if (player.shield < 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -276,11 +276,11 @@ int doTitle()
|
||||||
now = SDL_GetTicks();
|
now = SDL_GetTicks();
|
||||||
|
|
||||||
doStarfield();
|
doStarfield();
|
||||||
doExplosions();
|
game_doExplosions();
|
||||||
|
|
||||||
for (int i = 0 ; i < 15 ; i++)
|
for (int i = 0 ; i < 15 ; i++)
|
||||||
{
|
{
|
||||||
addEngine(&aliens[i]);
|
explosion_addEngine(&aliens[i]);
|
||||||
aliens[i].x += aliens[i].dx;
|
aliens[i].x += aliens[i].dx;
|
||||||
blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
||||||
if (aliens[i].x > 830)
|
if (aliens[i].x > 830)
|
||||||
|
|
Loading…
Reference in New Issue