From 908a6059acae86ef272b300b8d6f8f12762d5e2b Mon Sep 17 00:00:00 2001 From: Julie Marchant Date: Thu, 23 May 2019 11:02:48 -0400 Subject: [PATCH] Finished C conversion! Hoorah! Note: Autoconf files must be cleaned up and regenerated to ensure proper compilation. --- configure.ac | 3 +- src/Makefile.am | 55 ++++++++++++------------ src/{Starfighter.cpp => Starfighter.c} | 0 src/{alien.cpp => alien.c} | 0 src/{audio.cpp => audio.c} | 0 src/{bullet.cpp => bullet.c} | 0 src/{cargo.cpp => cargo.c} | 0 src/{collectable.cpp => collectable.c} | 0 src/{colors.cpp => colors.c} | 0 src/{cutscene.cpp => cutscene.c} | 0 src/defs.c | 26 +++++++++++ src/defs.h | 8 ++-- src/{engine.cpp => engine.c} | 0 src/{event.cpp => event.c} | 0 src/{explosion.cpp => explosion.c} | 0 src/{game.cpp => game.c} | 0 src/{gfx.cpp => gfx.c} | 0 src/{info.cpp => info.c} | 0 src/{intermission.cpp => intermission.c} | 4 +- src/{mission.cpp => mission.c} | 0 src/{player.cpp => player.c} | 0 src/{radio.cpp => radio.c} | 0 src/{renderer.cpp => renderer.c} | 0 src/{save.cpp => save.c} | 0 src/{screen.cpp => screen.c} | 0 src/{ship.cpp => ship.c} | 0 src/{shop.cpp => shop.c} | 0 src/{title.cpp => title.c} | 0 src/{weapons.cpp => weapons.c} | 0 src/{window.cpp => window.c} | 0 30 files changed, 60 insertions(+), 36 deletions(-) rename src/{Starfighter.cpp => Starfighter.c} (100%) rename src/{alien.cpp => alien.c} (100%) rename src/{audio.cpp => audio.c} (100%) rename src/{bullet.cpp => bullet.c} (100%) rename src/{cargo.cpp => cargo.c} (100%) rename src/{collectable.cpp => collectable.c} (100%) rename src/{colors.cpp => colors.c} (100%) rename src/{cutscene.cpp => cutscene.c} (100%) create mode 100644 src/defs.c rename src/{engine.cpp => engine.c} (100%) rename src/{event.cpp => event.c} (100%) rename src/{explosion.cpp => explosion.c} (100%) rename src/{game.cpp => game.c} (100%) rename src/{gfx.cpp => gfx.c} (100%) rename src/{info.cpp => info.c} (100%) rename src/{intermission.cpp => intermission.c} (99%) rename src/{mission.cpp => mission.c} (100%) rename src/{player.cpp => player.c} (100%) rename src/{radio.cpp => radio.c} (100%) rename src/{renderer.cpp => renderer.c} (100%) rename src/{save.cpp => save.c} (100%) rename src/{screen.cpp => screen.c} (100%) rename src/{ship.cpp => ship.c} (100%) rename src/{shop.cpp => shop.c} (100%) rename src/{title.cpp => title.c} (100%) rename src/{weapons.cpp => weapons.c} (100%) rename src/{window.cpp => window.c} (100%) diff --git a/configure.ac b/configure.ac index c2e415e..c7e1f28 100644 --- a/configure.ac +++ b/configure.ac @@ -9,12 +9,11 @@ AC_PREREQ([2.69]) AC_INIT([Project: Starfighter], [1.8-dev], [onpon4@riseup.net], [starfighter]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) -AC_CONFIG_SRCDIR([src/Starfighter.cpp]) +AC_CONFIG_SRCDIR([src/Starfighter.c]) AC_CONFIG_HEADERS([config.h]) PKG_PROG_PKG_CONFIG # Checks for programs. -AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL diff --git a/src/Makefile.am b/src/Makefile.am index cff325c..7c1590d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,60 +6,61 @@ bin_PROGRAMS = starfighter starfighter_CPPFLAGS = $(STARFIGHTER_CFLAGS) -DDATADIR=\"$(pkgdatadir)\" -Wall -starfighter_CXXFLAGS = $(SDL_CFLAGS) +starfighter_CFLAGS = $(SDL_CFLAGS) -lm starfighter_LDADD = $(SDL_LIBS) starfighter_SOURCES = \ - Starfighter.cpp \ - alien.cpp \ + Starfighter.c \ + alien.c \ alien.h \ - audio.cpp \ + audio.c \ audio.h \ - bullet.cpp \ + bullet.c \ bullet.h \ - cargo.cpp \ + cargo.c \ cargo.h \ - collectable.cpp \ + collectable.c \ collectable.h \ - colors.cpp \ + colors.c \ colors.h \ - cutscene.cpp \ + cutscene.c \ cutscene.h \ + defs.c \ defs.h \ - engine.cpp \ + engine.c \ engine.h \ - event.cpp \ + event.c \ event.h \ - explosion.cpp \ + explosion.c \ explosion.h \ - game.cpp \ + game.c \ game.h \ - gfx.cpp \ + gfx.c \ gfx.h \ - info.cpp \ + info.c \ info.h \ - intermission.cpp \ + intermission.c \ intermission.h \ - mission.cpp \ + mission.c \ mission.h \ - player.cpp \ + player.c \ player.h \ - radio.cpp \ + radio.c \ radio.h \ - renderer.cpp \ + renderer.c \ renderer.h \ - save.cpp \ + save.c \ save.h \ - screen.cpp \ + screen.c \ screen.h \ - ship.cpp \ + ship.c \ ship.h \ - shop.cpp \ + shop.c \ shop.h \ structs.h \ - title.cpp \ + title.c \ title.h \ - weapons.cpp \ + weapons.c \ weapons.h \ - window.cpp \ + window.c \ window.h diff --git a/src/Starfighter.cpp b/src/Starfighter.c similarity index 100% rename from src/Starfighter.cpp rename to src/Starfighter.c diff --git a/src/alien.cpp b/src/alien.c similarity index 100% rename from src/alien.cpp rename to src/alien.c diff --git a/src/audio.cpp b/src/audio.c similarity index 100% rename from src/audio.cpp rename to src/audio.c diff --git a/src/bullet.cpp b/src/bullet.c similarity index 100% rename from src/bullet.cpp rename to src/bullet.c diff --git a/src/cargo.cpp b/src/cargo.c similarity index 100% rename from src/cargo.cpp rename to src/cargo.c diff --git a/src/collectable.cpp b/src/collectable.c similarity index 100% rename from src/collectable.cpp rename to src/collectable.c diff --git a/src/colors.cpp b/src/colors.c similarity index 100% rename from src/colors.cpp rename to src/colors.c diff --git a/src/cutscene.cpp b/src/cutscene.c similarity index 100% rename from src/cutscene.cpp rename to src/cutscene.c diff --git a/src/defs.c b/src/defs.c new file mode 100644 index 0000000..859129b --- /dev/null +++ b/src/defs.c @@ -0,0 +1,26 @@ +/* +Copyright (C) 2003 Parallel Realities +Copyright (C) 2011, 2012 Guus Sliepen +Copyright (C) 2012, 2015-2019 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 . +*/ + +const char * const systemNames[] = {"Spirit", "Eyananth", "Mordor", "Sol"}; + +const char * const systemBackground[] = { + "gfx/spirit.jpg", "gfx/eyananth.jpg", "gfx/mordor.jpg", "gfx/sol.jpg" +}; + +const int rate2reload[6] = {15, 15, 13, 11, 9, 7}; diff --git a/src/defs.h b/src/defs.h index 930bb1f..eaf0191 100644 --- a/src/defs.h +++ b/src/defs.h @@ -758,12 +758,10 @@ enum { DIFFICULTY_MAX }; -const char * const systemNames[] = {"Spirit", "Eyananth", "Mordor", "Sol"}; +extern const char * const systemNames[]; -const char * const systemBackground[] = { - "gfx/spirit.jpg", "gfx/eyananth.jpg", "gfx/mordor.jpg", "gfx/sol.jpg" -}; +extern const char * const systemBackground[]; -const int rate2reload[6] = {15, 15, 13, 11, 9, 7}; +extern const int rate2reload[6]; #endif diff --git a/src/engine.cpp b/src/engine.c similarity index 100% rename from src/engine.cpp rename to src/engine.c diff --git a/src/event.cpp b/src/event.c similarity index 100% rename from src/event.cpp rename to src/event.c diff --git a/src/explosion.cpp b/src/explosion.c similarity index 100% rename from src/explosion.cpp rename to src/explosion.c diff --git a/src/game.cpp b/src/game.c similarity index 100% rename from src/game.cpp rename to src/game.c diff --git a/src/gfx.cpp b/src/gfx.c similarity index 100% rename from src/gfx.cpp rename to src/gfx.c diff --git a/src/info.cpp b/src/info.c similarity index 100% rename from src/info.cpp rename to src/info.c diff --git a/src/intermission.cpp b/src/intermission.c similarity index 99% rename from src/intermission.cpp rename to src/intermission.c index 7669555..0bad28f 100644 --- a/src/intermission.cpp +++ b/src/intermission.c @@ -639,8 +639,8 @@ static int intermission_showSystem(float pos, int selectable) gfx_drawCircle(screen->w / 2, h / 2, i, screen, darkGrey); - r.x = int(screen->w / 2 + (sinf(pos) * i)); - r.y = int(h / 2 + (cosf(pos) * i)); + r.x = (int)(screen->w / 2 + (sinf(pos) * i)); + r.y = (int)(h / 2 + (cosf(pos) * i)); r.w = h / 50; r.h = h / 50; diff --git a/src/mission.cpp b/src/mission.c similarity index 100% rename from src/mission.cpp rename to src/mission.c diff --git a/src/player.cpp b/src/player.c similarity index 100% rename from src/player.cpp rename to src/player.c diff --git a/src/radio.cpp b/src/radio.c similarity index 100% rename from src/radio.cpp rename to src/radio.c diff --git a/src/renderer.cpp b/src/renderer.c similarity index 100% rename from src/renderer.cpp rename to src/renderer.c diff --git a/src/save.cpp b/src/save.c similarity index 100% rename from src/save.cpp rename to src/save.c diff --git a/src/screen.cpp b/src/screen.c similarity index 100% rename from src/screen.cpp rename to src/screen.c diff --git a/src/ship.cpp b/src/ship.c similarity index 100% rename from src/ship.cpp rename to src/ship.c diff --git a/src/shop.cpp b/src/shop.c similarity index 100% rename from src/shop.cpp rename to src/shop.c diff --git a/src/title.cpp b/src/title.c similarity index 100% rename from src/title.cpp rename to src/title.c diff --git a/src/weapons.cpp b/src/weapons.c similarity index 100% rename from src/weapons.cpp rename to src/weapons.c diff --git a/src/window.cpp b/src/window.c similarity index 100% rename from src/window.cpp rename to src/window.c