Some code cleanup.

This commit is contained in:
Julie Marchant 2019-06-06 09:30:22 -04:00
parent caf963ba19
commit 3f1febc2fc
5 changed files with 15 additions and 34 deletions

View File

@ -112,11 +112,6 @@ int main(int argc, char **argv)
printf("No Audio\n"); printf("No Audio\n");
engine.useAudio = 0; engine.useAudio = 0;
} }
if (strcmp(argv[i], "-mono") == 0)
{
printf("Mono sound output\n");
engine.useAudio = 1;
}
if ((strcmp(argv[i], "humans") == 0) && (cheatCount == 0)) if ((strcmp(argv[i], "humans") == 0) && (cheatCount == 0))
cheatCount = 1; cheatCount = 1;
if ((strcmp(argv[i], "do") == 0) && (cheatCount == 1)) if ((strcmp(argv[i], "do") == 0) && (cheatCount == 1))

View File

@ -1801,21 +1801,10 @@ void alien_move(Object *alien)
if (checkCollisions) if (checkCollisions)
{ {
for (int i = 0 ; i < ALIEN_MAX ; i++) for (int i = 0 ; i < ALIEN_MAX ; i++)
{
if ((alien->flags & FL_LEAVESECTOR) ||
(alien->classDef == CD_DRONE) ||
(alien->classDef == CD_ASTEROID2) ||
(alien->owner == aliens[i].owner) ||
(alien->owner->owner == aliens[i].owner) ||
(aliens[i].shield < 1))
{
continue;
}
if (ship_collision(alien, &aliens[i]))
{ {
if ((aliens[i].classDef == CD_BARRIER) && if ((aliens[i].classDef == CD_BARRIER) &&
(aliens[i].owner != alien)) (aliens[i].owner != alien) &&
ship_collision(alien, &aliens[i]))
{ {
alien->shield--; alien->shield--;
alien->hit = 3; alien->hit = 3;
@ -1824,13 +1813,9 @@ void alien_move(Object *alien)
audio_playSound(SFX_HIT, alien->x, alien->y); audio_playSound(SFX_HIT, alien->x, alien->y);
} }
} }
}
}
// Handle a collision with the player // Handle a collision with the player
if ((player.shield > 0) && (alien->shield > 0) && (checkCollisions)) if ((player.shield > 0) && ship_collision(alien, &player))
{
if (ship_collision(alien, &player))
{ {
if (alien->classDef == CD_ASTEROID) if (alien->classDef == CD_ASTEROID)
{ {

View File

@ -80,6 +80,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 5 #define RAY_DAMAGE_DELAY 5
#define WARP_SPEED MAX(12, 3 * screen->w / 200)
#define PIXFONT_LINE_HEIGHT 16 #define PIXFONT_LINE_HEIGHT 16
#define PIXFONT_W 8 #define PIXFONT_W 8

View File

@ -293,7 +293,7 @@ void engine_setMode()
#ifndef NOSOUND #ifndef NOSOUND
if (engine.useAudio) if (engine.useAudio)
{ {
if (Mix_OpenAudio(44100, AUDIO_S16, engine.useAudio * 2, 1024) < 0) if (Mix_OpenAudio(44100, AUDIO_S16, 2, 1024) < 0)
{ {
printf("Warning: Couldn't set 44100 Hz 16-bit stereo audio - Reason:\n%s\n", Mix_GetError()); printf("Warning: Couldn't set 44100 Hz 16-bit stereo audio - Reason:\n%s\n", Mix_GetError());
printf("Sound and Music will be disabled\n"); printf("Sound and Music will be disabled\n");

View File

@ -418,7 +418,7 @@ void player_leaveSector()
if (engine.done == 2) if (engine.done == 2)
{ {
player.face = 0; player.face = 0;
player.x += 12; player.x += WARP_SPEED;
engine.ssx -= 0.2; engine.ssx -= 0.2;
if (player.x > (2 * screen->w)) if (player.x > (2 * screen->w))
engine.done = 1; engine.done = 1;