Mac makefile and compile fixes.

This commit is contained in:
Steve 2018-04-30 18:16:52 +01:00
parent 9ae3e4bfc0
commit 9dea8e8822
5 changed files with 29 additions and 8 deletions

21
makefile.mac Normal file
View File

@ -0,0 +1,21 @@
PROG = tbftss
CC = gcc
PREFIX ?= /usr
BIN_DIR ?= $(PREFIX)/bin
DATA_DIR ?= /opt/$(PROG)
LOCALE_DIR = $(PREFIX)/share/locale
SEARCHPATH += src/plat/unix
_OBJS += unixInit.o
include common.mk
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\"
CXXFLAGS += -Wall -Wempty-body -ansi -pedantic -Werror -Wstrict-prototypes -Werror=uninitialized -Warray-bounds
CXXFLAGS += -g
LDFLAGS += `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm
# linking the program.
$(PROG): $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS)

View File

@ -303,7 +303,7 @@ static void faceTarget(Bullet *b)
wantedAngle = (int)getAngle(b->x, b->y, b->target->x, b->target->y) % 360;
if (fabs(wantedAngle - b->angle) > TURN_THRESHOLD)
if (abs(wantedAngle - b->angle) > TURN_THRESHOLD)
{
dir = (wantedAngle - b->angle + 360) % 360 > 180 ? -1 : 1;

View File

@ -46,7 +46,7 @@ static SDL_Texture *shield;
static SDL_Texture *ecm;
static SDL_Texture *boost;
static SDL_Texture *nextGun;
static SDL_Texture *clock;
static SDL_Texture *clockIcon;
static SDL_Texture *objectives;
static int numMessages;
static const char *gunName[BT_MAX];
@ -101,7 +101,7 @@ void initHud(void)
ecm = getTexture("gfx/hud/ecm.png");
boost = getTexture("gfx/hud/boost.png");
nextGun = getTexture("gfx/hud/nextGun.png");
clock = getTexture("gfx/hud/clock.png");
clockIcon = getTexture("gfx/hud/clock.png");
objectives = getTexture("gfx/hud/objectives.png");
}
@ -475,13 +475,13 @@ static void drawObjectives(void)
{
timeRemaining = game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME];
blit(clock, (SCREEN_WIDTH / 2) - 50, 14, 0);
blit(clockIcon, (SCREEN_WIDTH / 2) - 50, 14, 0);
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, (timeRemaining < 11 * FPS) ? colors.red : colors.white, timeToString(timeRemaining, 0));
}
else
{
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, colors.white, timeToString(battle.stats[STAT_TIME], 0));
blit(clock, (SCREEN_WIDTH / 2) - 50, 14, 0);
blit(clockIcon, (SCREEN_WIDTH / 2) - 50, 14, 0);
}
if (game.currentMission->challengeData.killLimit)

View File

@ -510,5 +510,5 @@ static unsigned long hashcode(const char *str)
c = *str++;
}
return abs(hash);
return hash;
}

View File

@ -37,7 +37,7 @@ void initInput(void)
void doKeyDown(SDL_KeyboardEvent *event)
{
if (event->keysym.scancode >= 0 && event->keysym.scancode < MAX_KEYBOARD_KEYS && event->repeat == 0)
if (event->keysym.scancode < MAX_KEYBOARD_KEYS && event->repeat == 0)
{
app.keyboard[event->keysym.scancode] = 1;
app.lastKeyPressed = event->keysym.scancode;
@ -46,7 +46,7 @@ void doKeyDown(SDL_KeyboardEvent *event)
void doKeyUp(SDL_KeyboardEvent *event)
{
if (event->keysym.scancode >= 0 && event->keysym.scancode < MAX_KEYBOARD_KEYS)
if (event->keysym.scancode < MAX_KEYBOARD_KEYS)
{
app.keyboard[event->keysym.scancode] = 0;
}