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");
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))
cheatCount = 1;
if ((strcmp(argv[i], "do") == 0) && (cheatCount == 1))

View File

@ -1802,35 +1802,20 @@ void alien_move(Object *alien)
{
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))
if ((aliens[i].classDef == CD_BARRIER) &&
(aliens[i].owner != alien) &&
ship_collision(alien, &aliens[i]))
{
continue;
}
if (ship_collision(alien, &aliens[i]))
{
if ((aliens[i].classDef == CD_BARRIER) &&
(aliens[i].owner != alien))
{
alien->shield--;
alien->hit = 3;
alien->dx *= -1;
alien->dy *= -1;
audio_playSound(SFX_HIT, alien->x, alien->y);
}
alien->shield--;
alien->hit = 3;
alien->dx *= -1;
alien->dy *= -1;
audio_playSound(SFX_HIT, alien->x, alien->y);
}
}
}
// Handle a collision with the player
if ((player.shield > 0) && (alien->shield > 0) && (checkCollisions))
{
if (ship_collision(alien, &player))
// Handle a collision with the player
if ((player.shield > 0) && ship_collision(alien, &player))
{
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_MICRO_HOMING 10
#define RAY_DAMAGE_DELAY 5
#define WARP_SPEED MAX(12, 3 * screen->w / 200)
#define PIXFONT_LINE_HEIGHT 16
#define PIXFONT_W 8

View File

@ -293,7 +293,7 @@ void engine_setMode()
#ifndef NOSOUND
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("Sound and Music will be disabled\n");
@ -358,7 +358,7 @@ void engine_resetLists()
engine.collectableHead->next = NULL;
engine.collectableTail = engine.collectableHead;
r1 = screen_bufferHead->next;
while (r1 != NULL)
{
@ -366,7 +366,7 @@ void engine_resetLists()
r1 = r1->next;
free(r2);
}
screen_bufferHead->next = NULL;
screen_bufferTail = screen_bufferHead;

View File

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