From e0cac7850cd02ab1c3c2a18a4a3dc8c51f0ecc9f Mon Sep 17 00:00:00 2001 From: onpon4 Date: Sat, 19 Nov 2016 08:51:26 -0500 Subject: [PATCH] Converted the "missfire" messages. Deleted the now empty messages.cpp. --- Makefile | 2 +- src/Starfighter.h | 1 - src/game.cpp | 23 ++++++++++++++++++++--- src/messages.cpp | 40 ---------------------------------------- src/messages.h | 25 ------------------------- 5 files changed, 21 insertions(+), 70 deletions(-) delete mode 100644 src/messages.cpp delete mode 100644 src/messages.h diff --git a/Makefile b/Makefile index a05fcdd..b51a7fc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CXXFLAGS ?= -O2 -Wall -g CXXFLAGS += `pkg-config --cflags 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 colors.o cutscene.o engine.o event.o explosion.o game.o gfx.o intermission.o messages.o misc.o missions.o player.o renderer.o resources.o save.o screen.o ship.o shop.o Starfighter.o title.o weapons.o window.o +OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o cutscene.o engine.o event.o explosion.o game.o gfx.o intermission.o misc.o missions.o player.o renderer.o resources.o save.o screen.o ship.o shop.o Starfighter.o title.o weapons.o window.o VERSION = 1.7-dev PROG = starfighter diff --git a/src/Starfighter.h b/src/Starfighter.h index dba2d90..9350ac0 100644 --- a/src/Starfighter.h +++ b/src/Starfighter.h @@ -49,7 +49,6 @@ along with this program. If not, see . #include "gfx.h" #include "intermission.h" #include "save.h" -#include "messages.h" #include "misc.h" #include "missions.h" #include "player.h" diff --git a/src/game.cpp b/src/game.cpp index 45a4b19..d22194f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -49,6 +49,22 @@ static const char *ursulaPlayerHitMessage[nUrsulaPlayerHitMessage] = { "Dammit, Chris, you made me miss!" }; +static const int nPlayerPhoebeHitMessage = 3; +static const char *playerPhoebeHitMessage[nPlayerPhoebeHitMessage] = { + "OW! I hope that was an accident!", + "Chris, please be more careful!", + "Ouch! What are you shooting at me for?" +}; + +static const int nPlayerUrsulaHitMessage = 5; +static const char *playerUrsulaHitMessage[nPlayerUrsulaHitMessage] = { + "I am NOT your enemy!", + "Hey! Watch it!", + "What are you doing?! Shoot THEM!", + "Open your eyes!", + "Are you blind?!" +}; + void game_init() { @@ -648,9 +664,10 @@ static void game_doBullets() if (bullet->owner == &player) { game.hits++; - if ((aliens[i].classDef == CD_PHOEBE) || - (aliens[i].classDef == CD_URSULA)) - getMissFireMessage(&aliens[i]); + if (aliens[i].classDef == CD_PHOEBE) + setRadioMessage(FS_PHOEBE, playerPhoebeHitMessage[rand() % nPlayerPhoebeHitMessage], 0); + else if (aliens[i].classDef == CD_URSULA) + setRadioMessage(FS_URSULA, playerUrsulaHitMessage[rand() % nPlayerUrsulaHitMessage], 0); } if (!(aliens[i].flags & FL_IMMORTAL)) diff --git a/src/messages.cpp b/src/messages.cpp deleted file mode 100644 index 1dee7c8..0000000 --- a/src/messages.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright (C) 2003 Parallel Realities -Copyright (C) 2011, 2012 Guus Sliepen -Copyright (C) 2015, 2016 Julie Marchant - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "Starfighter.h" - -static const char *missFireMessage[5] = { - "I am NOT your enemy!", - "Hey! Watch it!", - "What are you doing?! Shoot THEM!", - "OW! I hope that was an accident!", - "Open your eyes!", -}; - -void getMissFireMessage(object *ally) -{ - int faceToUse = FS_PHOEBE; - - if (ally == &aliens[ALIEN_PHOEBE]) - faceToUse = FS_PHOEBE; - else - faceToUse = FS_URSULA; - - setRadioMessage(faceToUse, missFireMessage[rand() % 5], 0); -} diff --git a/src/messages.h b/src/messages.h deleted file mode 100644 index 1966a3b..0000000 --- a/src/messages.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (C) 2003 Parallel Realities -Copyright (C) 2011 Guus Sliepen -Copyright (C) 2015, 2016 Julie Marchant - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef MESSAGES_H -#define MESSAGES_H - -extern void getMissFireMessage(object *ally); - -#endif