Maelstrom: Removed the last vestiges of the fastlogic/netlogic split. It's all net, baby. :)

https://github.com/libsdl-org/Maelstrom/commit/47675cf916da9379e4da7782a176e3ff7a90e052

From 47675cf916da9379e4da7782a176e3ff7a90e052 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 9 Nov 2011 02:01:32 -0500
Subject: [PATCH] Removed the last vestiges of the fastlogic/netlogic split.
 It's all net, baby. :)

---
 game/Maelstrom.h         | 40 +++++++++++++++++++--
 game/MaelstromUI.cpp     |  5 +--
 game/Maelstrom_Globals.h | 30 +++++++++++++++-
 game/Makefile.am         |  4 ---
 game/Makefile.in         | 12 +++----
 game/controls.cpp        | 77 +++++++++++++++++++++-------------------
 game/game.cpp            |  3 +-
 game/game.h              |  8 +++++
 game/globals.h           | 52 ---------------------------
 game/init.cpp            |  1 +
 game/lobby.cpp           |  1 +
 game/logic.cpp           | 60 -------------------------------
 game/logic.h             | 44 -----------------------
 game/main.cpp            |  3 +-
 game/make.cpp            |  1 -
 game/netlogic.h          | 69 -----------------------------------
 game/object.cpp          |  2 +-
 game/objects.cpp         |  1 -
 game/player.cpp          | 22 ++++++++++--
 game/player.h            | 21 ++++++++---
 20 files changed, 164 insertions(+), 292 deletions(-)
 delete mode 100644 game/globals.h
 delete mode 100644 game/logic.cpp
 delete mode 100644 game/logic.h
 delete mode 100644 game/netlogic.h

diff --git a/game/Maelstrom.h b/game/Maelstrom.h
index 1df6713a..36f6af0d 100644
--- a/game/Maelstrom.h
+++ b/game/Maelstrom.h
@@ -20,10 +20,13 @@
     slouken@libsdl.org
 */
 
-/* Definitions useful for our sprite world */
-
 #include "rect.h"
 
+#ifndef VERSION
+#define VERSION "4.0.0"
+#endif
+#define	VERSION_STRING		VERSION ".N"
+
 #define SCREEN_WIDTH		640
 #define SCREEN_HEIGHT		480
 
@@ -56,6 +59,7 @@
 #define	SHIELD_WIDTH		55
 #define	INITIAL_BONUS		2000
 
+#define	PLAYER_HITS		3
 #define	ENEMY_HITS		3
 #define	HOMING_HITS		9
 #define	STEEL_SPECIAL		10
@@ -70,6 +74,8 @@
 #define	NOVA_PTS		1000
 #define	STEEL_PTS		100
 #define	ENEMY_PTS		1000
+#define	PLAYER_PTS		1000
+#define	DEFAULT_PTS		0
 
 #define	HOMING_MOVE		6
 #define GRAVITY_MOVE		3
@@ -79,6 +85,25 @@
 #define	NUM_PRIZES		8
 #define	LUCK_ODDS		3
 
+#define	INITIAL_SHIELD		((60/FRAME_DELAY) * 3)
+#define	SAFE_TIME		(120/FRAME_DELAY)
+#define	MAX_SHIELD		((60/FRAME_DELAY) * 5)
+#define	DISPLAY_DELAY		(60/FRAME_DELAY)
+#define	BONUS_DELAY		(30/FRAME_DELAY)
+#define	STAR_DELAY		(30/FRAME_DELAY)
+#define	DEAD_DELAY		(3 * (60/FRAME_DELAY))
+#define	BOOM_MIN		(20/FRAME_DELAY)
+#define	ENEMY_SHOT_DELAY	(10/FRAME_DELAY)
+
+#define	PRIZE_DURATION		(10 * (60/FRAME_DELAY))
+#define	MULT_DURATION		(6 * (60/FRAME_DELAY))
+#define	BONUS_DURATION		(10 * (60/FRAME_DELAY))
+#define	SHOT_DURATION		(1 * (60/FRAME_DELAY))
+#define	POINT_DURATION		(2 * (60/FRAME_DELAY))
+#define	DAMAGED_DURATION	(10 * (60/FRAME_DELAY))
+#define	FREEZE_DURATION		(10 * (60/FRAME_DELAY))
+#define	SHAKE_DURATION		(5 * (60/FRAME_DELAY))
+
 /* ----------------------------------------------------------------- */
 /* -- Structures and typedefs */
 
@@ -101,3 +126,14 @@ typedef	struct {
 	SDL_Texture *sprite[MAX_SPRITE_FRAMES];
 	Uint8 *mask[MAX_SPRITE_FRAMES];
 } Blit, *BlitPtr;
+
+typedef struct {
+	int damage;
+	int x;
+	int y;
+	int xvel;
+	int yvel;
+	int ttl;
+	Rect hitRect;
+} Shot, *ShotPtr;
+
diff --git a/game/MaelstromUI.cpp b/game/MaelstromUI.cpp
index c6a3e0a1..45537be5 100644
--- a/game/MaelstromUI.cpp
+++ b/game/MaelstromUI.cpp
@@ -27,6 +27,7 @@
 #include "controls.h"
 #include "about.h"
 #include "game.h"
+#include "player.h"
 #include "lobby.h"
 #include "MacDialog.h"
 #include "../screenlib/UIElementButton.h"
@@ -305,13 +306,13 @@ UIElementControlButton::HandleEvent(const SDL_Event &event)
 void
 UIElementControlButton::OnMouseDown()
 {
-	SetControl(m_control, 1);
+	OurShip->SetControl(m_control, 1);
 }
 
 void
 UIElementControlButton::OnMouseUp()
 {
-	SetControl(m_control, 0);
+	OurShip->SetControl(m_control, 0);
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/game/Maelstrom_Globals.h b/game/Maelstrom_Globals.h
index f641da9e..fa8fd07f 100644
--- a/game/Maelstrom_Globals.h
+++ b/game/Maelstrom_Globals.h
@@ -38,7 +38,6 @@
 
 #include "myerror.h"
 #include "fastrand.h"
-#include "logic.h"
 #include "scores.h"
 #include "controls.h"
 
@@ -107,6 +106,35 @@ extern MPoint	gThrustOrigins[SHIP_FRAMES];
 extern MPoint	gVelocityTable[SHIP_FRAMES];
 extern StarPtr	gTheStars[MAX_STARS];
 extern Uint32	gStarColors[];
+
+// in game.cpp :
+extern int	gScore;
+extern int	gDisplayed;
+extern int	gGameOn;
+extern int	gPaused;
+extern int	gBoomDelay;
+extern int	gNextBoom;
+extern int	gBoomPhase;
+extern int	gNumRocks;
+extern int	gLastStar;
+extern int	gWhenDone;
+
+extern int	gMultiplierShown;
+extern int	gPrizeShown;
+extern int	gBonusShown;
+extern int	gWhenHoming;
+extern int	gWhenGrav;
+extern int	gWhenDamaged;
+
+extern int	gWhenNova;
+extern int	gShakeTime;
+extern int	gFreezeTime;
+
+extern int	gWave;
+class Object;
+extern Object  *gEnemySprite;
+extern int	gWhenEnemy;
+
 // in controls.cpp :
 extern Controls	controls;
 extern PrefsVariable<int> gSoundLevel;
diff --git a/game/Makefile.am b/game/Makefile.am
index 90bec181..1b8bd0e4 100644
--- a/game/Makefile.am
+++ b/game/Makefile.am
@@ -19,22 +19,18 @@ libgame_a_SOURCES =		\
 	game.h			\
 	gameinfo.cpp		\
 	gameinfo.h		\
-	globals.h		\
 	init.cpp		\
 	init.h			\
 	load.cpp		\
 	load.h			\
 	lobby.cpp		\
 	lobby.h			\
-	logic.cpp		\
-	logic.h			\
 	main.cpp		\
 	main.h			\
 	make.cpp		\
 	make.h			\
 	myerror.cpp		\
 	myerror.h		\
-	netlogic.h		\
 	netplay.cpp		\
 	netplay.h		\
 	object.cpp		\
diff --git a/game/Makefile.in b/game/Makefile.in
index 68258299..fb905083 100644
--- a/game/Makefile.in
+++ b/game/Makefile.in
@@ -50,10 +50,10 @@ libgame_a_LIBADD =
 am_libgame_a_OBJECTS = MacDialog.$(OBJEXT) MaelstromUI.$(OBJEXT) \
 	about.$(OBJEXT) controls.$(OBJEXT) fastrand.$(OBJEXT) \
 	game.$(OBJEXT) gameinfo.$(OBJEXT) init.$(OBJEXT) \
-	load.$(OBJEXT) lobby.$(OBJEXT) logic.$(OBJEXT) main.$(OBJEXT) \
-	make.$(OBJEXT) myerror.$(OBJEXT) netplay.$(OBJEXT) \
-	object.$(OBJEXT) objects.$(OBJEXT) player.$(OBJEXT) \
-	rect.$(OBJEXT) scores.$(OBJEXT)
+	load.$(OBJEXT) lobby.$(OBJEXT) main.$(OBJEXT) make.$(OBJEXT) \
+	myerror.$(OBJEXT) netplay.$(OBJEXT) object.$(OBJEXT) \
+	objects.$(OBJEXT) player.$(OBJEXT) rect.$(OBJEXT) \
+	scores.$(OBJEXT)
 libgame_a_OBJECTS = $(am_libgame_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -203,15 +203,12 @@ libgame_a_SOURCES = \
 	load.h			\
 	lobby.cpp		\
 	lobby.h			\
-	logic.cpp		\
-	logic.h			\
 	main.cpp		\
 	main.h			\
 	make.cpp		\
 	make.h			\
 	myerror.cpp		\
 	myerror.h		\
-	netlogic.h		\
 	netplay.cpp		\
 	netplay.h		\
 	object.cpp		\
@@ -285,7 +282,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lobby.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logic.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myerror.Po@am__quote@
diff --git a/game/controls.cpp b/game/controls.cpp
index 58f89a6a..b10d3a13 100644
--- a/game/controls.cpp
+++ b/game/controls.cpp
@@ -27,7 +27,7 @@
 #include <ctype.h>
 
 #include "Maelstrom_Globals.h"
-#include "load.h"
+#include "player.h"
 #include "../screenlib/UIDialog.h"
 #include "../screenlib/UIElement.h"
 #include "../screenlib/UIElementRadio.h"
@@ -249,23 +249,23 @@ static void HandleEvent(SDL_Event *event)
 			/* X-Axis - rotate right/left */
 			if ( event->jaxis.axis == 0 ) {
 				if ( event->jaxis.value < -8000 ) {
-					SetControl(LEFT_KEY, 1);
-					SetControl(RIGHT_KEY, 0);
+					OurShip->SetControl(LEFT_KEY, 1);
+					OurShip->SetControl(RIGHT_KEY, 0);
 				} else
 				if ( event->jaxis.value > 8000 ) {
-					SetControl(RIGHT_KEY, 1);
-					SetControl(LEFT_KEY, 0);
+					OurShip->SetControl(RIGHT_KEY, 1);
+					OurShip->SetControl(LEFT_KEY, 0);
 				} else {
-					SetControl(LEFT_KEY, 0);
-					SetControl(RIGHT_KEY, 0);
+					OurShip->SetControl(LEFT_KEY, 0);
+					OurShip->SetControl(RIGHT_KEY, 0);
 				}
 			} else
 			/* Y-Axis - accelerate */
 			if ( event->jaxis.axis == 1 ) {
 				if ( event->jaxis.value < -8000 ) {
-					SetControl(THRUST_KEY, 1);
+					OurShip->SetControl(THRUST_KEY, 1);
 				} else {
-					SetControl(THRUST_KEY, 0);
+					OurShip->SetControl(THRUST_KEY, 0);
 				}
 			}
 			break;
@@ -275,17 +275,17 @@ static void HandleEvent(SDL_Event *event)
 		case SDL_JOYBUTTONUP:
 			if ( event->jbutton.state == SDL_PRESSED ) {
 				if ( event->jbutton.button == 0 ) {
-					SetControl(FIRE_KEY, 1);
+					OurShip->SetControl(FIRE_KEY, 1);
 				} else
 				if ( event->jbutton.button == 1 ) {
-					SetControl(SHIELD_KEY, 1);
+					OurShip->SetControl(SHIELD_KEY, 1);
 				}
 			} else {
 				if ( event->jbutton.button == 0 ) {
-					SetControl(FIRE_KEY, 0);
+					OurShip->SetControl(FIRE_KEY, 0);
 				} else
 				if ( event->jbutton.button == 1 ) {
-					SetControl(SHIELD_KEY, 0);
+					OurShip->SetControl(SHIELD_KEY, 0);
 				}
 			}
 			break;
@@ -305,53 +305,56 @@ static void HandleEvent(SDL_Event *event)
 			if ( event->key.state == SDL_PRESSED ) {
 				/* Check for various control keys */
 				if ( key == controls.gFireControl )
-					SetControl(FIRE_KEY, 1);
+					OurShip->SetControl(FIRE_KEY, 1);
 				else if ( key == controls.gTurnRControl )
-					SetControl(RIGHT_KEY, 1);
+					OurShip->SetControl(RIGHT_KEY, 1);
 				else if ( key == controls.gTurnLControl )
-					SetControl(LEFT_KEY, 1);
+					OurShip->SetControl(LEFT_KEY, 1);
 				else if ( key == controls.gShieldControl )
-					SetControl(SHIELD_KEY, 1);
+					OurShip->SetControl(SHIELD_KEY, 1);
 				else if ( key == controls.gThrustControl )
-					SetControl(THRUST_KEY, 1);
+					OurShip->SetControl(THRUST_KEY, 1);
 				else if ( key == controls.gPauseControl )
-					SetControl(PAUSE_KEY, 1);
+					OurShip->SetControl(PAUSE_KEY, 1);
 				else if ( key == controls.gQuitControl )
-					SetControl(ABORT_KEY, 1);
-				else if ( SpecialKey(event->key.keysym.sym) == 0 )
-					/* The key has been handled */;
-				else if ( key == SDLK_F3 ) {
-					/* Special key --
-						Do a screen dump here.
-					 */
-					screen->ScreenDump("ScreenShot",
-								0, 0, 0, 0);
-				}
+					OurShip->SetControl(ABORT_KEY, 1);
 			} else {
 				/* Update control key status */
 				if ( key == controls.gFireControl )
-					SetControl(FIRE_KEY, 0);
+					OurShip->SetControl(FIRE_KEY, 0);
 				else if ( key == controls.gTurnRControl )
-					SetControl(RIGHT_KEY, 0);
+					OurShip->SetControl(RIGHT_KEY, 0);
 				else if ( key == controls.gTurnLControl )
-					SetControl(LEFT_KEY, 0);
+					OurShip->SetControl(LEFT_KEY, 0);
 				else if ( key == controls.gShieldControl )
-					SetControl(SHIELD_KEY, 0);
+					OurShip->SetControl(SHIELD_KEY, 0);
 				else if ( key == controls.gThrustControl )
-					SetControl(THRUST_KEY, 0);
+					OurShip->SetControl(THRUST_KEY, 0);
+				else if ( key == SDLK_F1 ) {
+					/* Special key --
+						Switch displayed player
+					 */
+					RotatePlayerView();
+				} else if ( key == SDLK_F3 ) {
+					/* Special key --
+						Do a screen dump here.
+					 */
+					screen->ScreenDump("ScreenShot",
+								0, 0, 0, 0);
+				}
 			}
 			break;
 
 		case SDL_WINDOWEVENT:
 			if (event->window.event == SDL_WINDOWEVENT_MINIMIZED) {
-				SetControl(MINIMIZE_KEY, 1);
+				OurShip->SetControl(MINIMIZE_KEY, 1);
 			} if (event->window.event == SDL_WINDOWEVENT_RESTORED) {
-				SetControl(MINIMIZE_KEY, 0);
+				OurShip->SetControl(MINIMIZE_KEY, 0);
 			}
 			break;
 
 		case SDL_QUIT:
-			SetControl(ABORT_KEY, 1);
+			OurShip->SetControl(ABORT_KEY, 1);
 			break;
 	}
 }
diff --git a/game/game.cpp b/game/game.cpp
index 1358db99..303d3274 100644
--- a/game/game.cpp
+++ b/game/game.cpp
@@ -30,7 +30,7 @@
 #include "../screenlib/UIElement.h"
 
 // Global variables set in this file...
-Uint32	gScore;
+int	gScore;
 int	gGameOn;
 int	gPaused;
 int	gWave;
@@ -1016,4 +1016,3 @@ static void DoGameOver(void)
 
 }	/* -- DoGameOver */
 
-
diff --git a/game/game.h b/game/game.h
index a0eaf39e..ac8b801f 100644
--- a/game/game.h
+++ b/game/game.h
@@ -23,6 +23,9 @@
 #ifndef _game_h
 #define _game_h
 
+/* ----------------------------------------------------------------- */
+/* -- UI */
+
 class UIElement;
 
 class GamePanelDelegate : public UIPanelDelegate
@@ -64,4 +67,9 @@ class GamePanelDelegate : public UIPanelDelegate
 	UIElement *m_frags;
 };
 
+/* ----------------------------------------------------------------- */
+/* -- Game functions */
+
+extern void NewGame(void);
+
 #endif // _game_h
diff --git a/game/globals.h b/game/globals.h
deleted file mode 100644
index 82d79f6d..00000000
--- a/game/globals.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-    Maelstrom: Open Source version of the classic game by Ambrosia Software
-    Copyright (C) 1997-2011  Sam Lantinga
-
-    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 2 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, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* ----------------------------------------------------------------- */
-/* -- Special logic module variables */
-
-// in game.cc :
-extern int	gScore;
-extern int	gDisplayed;
-extern int	gGameOn;
-extern int	gPaused;
-extern int	gBoomDelay;
-extern int	gNextBoom;
-extern int	gBoomPhase;
-extern int	gNumRocks;
-extern int	gLastStar;
-extern int	gWhenDone;
-
-extern int	gMultiplierShown;
-extern int	gPrizeShown;
-extern int	gBonusShown;
-extern int	gWhenHoming;
-extern int	gWhenGrav;
-extern int	gWhenDamaged;
-
-extern int	gWhenNova;
-extern int	gShakeTime;
-extern int	gFreezeTime;
-
-extern int	gWave;
-extern Object  *gEnemySprite;
-extern int	gWhenEnemy;
-
diff --git a/game/init.cpp b/game/init.cpp
index b2a7d1bc..a0cc31bc 100644
--- a/game/init.cpp
+++ b/game/init.cpp
@@ -29,6 +29,7 @@
 #include "Maelstrom_Globals.h"
 #include "load.h"
 #include "init.h"
+#include "player.h"
 #include "colortable.h"
 #include "fastrand.h"
 #include "MaelstromUI.h"
diff --git a/game/lobby.cpp b/game/lobby.cpp
index 2011279e..33a742f7 100644
--- a/game/lobby.cpp
+++ b/game/lobby.cpp
@@ -31,6 +31,7 @@
 #include "lobby.h"
 #include "protocol.h"
 #include "netplay.h"
+#include "game.h"
 
 // Update the game list every 3 seconds
 #define GLOBAL_SERVER_HOST	"obelix.dreamhost.com"
diff --git a/game/logic.cpp b/game/logic.cpp
deleted file mode 100644
index c6723466..00000000
--- a/game/logic.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-    Maelstrom: Open Source version of the classic game by Ambrosia Software
-    Copyright (C) 1997-2011  Sam Lantinga
-
-    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 2 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, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-#include "Maelstrom_Globals.h"
-#include "object.h"
-#include "player.h"
-#include "globals.h"
-#include "netplay.h"
-
-
-/* Initialize the player sprites */
-int InitPlayerSprites(void)
-{
-	int index;
-
-	OBJ_LOOP(index, MAX_PLAYERS)
-		gPlayers[index] = new Player(index);
-	return(0);
-}
-
-int SpecialKey(SDL_Keycode key)
-{
-	if ( key == SDLK_F1 ) {
-		/* Special key -- switch displayed player */
-		if ( ++gDisplayed == gNumPlayers )
-			gDisplayed = 0;
-		return(0);
-	}
-	return(-1);
-}
-
-void SetControl(unsigned char which, int toggle)
-{
-	QueueKey(toggle ? KEY_PRESS : KEY_RELEASE, which);
-}
-
-int GetScore(void)
-{
-	return gScore;
-}
-
diff --git a/game/logic.h b/game/logic.h
deleted file mode 100644
index 7c6dcee9..00000000
--- a/game/logic.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-    Maelstrom: Open Source version of the classic game by Ambrosia Software
-    Copyright (C) 1997-2011  Sam Lantinga
-
-    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 2 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, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* Game Logic interface routines and variables */
-
-#include "netlogic.h"
-
-/* From logic.cpp */
-extern int  InitPlayerSprites(void);
-extern void SetControl(unsigned char which, int toggle);
-extern int  SpecialKey(SDL_Keycode key);
-extern int GetScore(void);
-
-/* From game.cpp */
-extern void NewGame(void);
-
-/* From about.cpp */
-extern void DoAbout(void);
-
-/* From player.cpp */
-extern Uint8 gPlayerShotColors[];
-extern SDL_Texture *gPlayerShot;
-extern Uint8 gEnemyShotColors[];
-extern SDL_Texture *gEnemyShot;
-
diff --git a/game/main.cpp b/game/main.cpp
index 7873a047..3be8947d 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -37,6 +37,7 @@
 #include "init.h"
 #include "fastrand.h"
 #include "about.h"
+#include "game.h"
 #include "netplay.h"
 #include "main.h"
 
@@ -485,7 +486,7 @@ MainPanelDelegate::OnTick()
 
 	label = m_panel->GetElement<UIElement>("last_score");
 	if (label) {
-		sprintf(text, "%d", GetScore());
+		sprintf(text, "%d", gScore);
 		label->SetText(text);
 	}
 
diff --git a/game/make.cpp b/game/make.cpp
index d76989d2..0a0d7ea9 100644
--- a/game/make.cpp
+++ b/game/make.cpp
@@ -25,7 +25,6 @@
 #include "netplay.h"
 #include "object.h"
 #include "player.h"
-#include "globals.h"
 #include "objects.h"
 #include "shinobi.h"
 
diff --git a/game/netlogic.h b/game/netlogic.h
deleted file mode 100644
index 74158ffe..00000000
--- a/game/netlogic.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-    Maelstrom: Open Source version of the classic game by Ambrosia Software
-    Copyright (C) 1997-2011  Sam Lantinga
-
-    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 2 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, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* Maelstrom version... */
-#ifndef VERSION
-#define VERSION "4.0.0"
-#endif
-#define	VERSION_STRING		VERSION ".N"
-
-#define	ENEMY_SHOT_DELAY	(10/FRAME_DELAY)
-
-#define	INITIAL_SHIELD		((60/FRAME_DELAY) * 3)
-#define	SAFE_TIME		(120/FRAME_DELAY)
-#define	MAX_SHIELD		((60/FRAME_DELAY) * 5)
-#define DISPLAY_DELAY		(60/FRAME_DELAY)
-#define	BONUS_DELAY		(30/FRAME_DELAY)
-#define	STAR_DELAY		(30/FRAME_DELAY)
-#define	DEAD_DELAY		(3 * (60/FRAME_DELAY))
-#define	BOOM_MIN		(20/FRAME_DELAY)
-
-#define PLAYER_HITS		3
-#define VAPOROUS		0
-
-#define PLAYER_PTS		1000
-#define DEFAULT_POINTS		0
-
-#define	PRIZE_DURATION		(10 * (60/FRAME_DELAY))
-#define	MULT_DURATION		(6 * (60/FRAME_DELAY))
-#define	BONUS_DURATION		(10 * (60/FRAME_DELAY))
-#define	SHOT_DURATION		(1 * (60/FRAME_DELAY))
-#define	POINT_DURATION		(2 * (60/FRAME_DELAY))
-#define	DAMAGED_DURATION	(10 * (60/FRAME_DELAY))
-#define	FREEZE_DURATION		(10 * (60/FRAME_DELAY))
-#define	SHAKE_DURATION		(5 * (60/FRAME_DELAY))
-
-
-/* ----------------------------------------------------------------- */
-/* -- Structures and typedefs */
-
-typedef struct {
-	int damage;
-	int x;
-	int y;
-	int xvel;
-	int yvel;
-	int ttl;
-	Rect hitRect;
-	} Shot;
-typedef Shot *ShotPtr;
-
diff --git a/game/object.cpp b/game/object.cpp
index f0833f48..855e5bb4 100644
--- a/game/object.cpp
+++ b/game/object.cpp
@@ -28,7 +28,7 @@
 
 Object::Object(int X, int Y, int Xvec, int Yvec, Blit *blit, int PhaseTime)
 {
-	Points = DEFAULT_POINTS;
+	Points = DEFAULT_PTS;
 
 	Set_Blit(blit);
 	if ( (phasetime=PhaseTime) != NO_PHASE_CHANGE )
diff --git a/game/objects.cpp b/game/objects.cpp
index a04036cf..3a38054a 100644
--- a/game/objects.cpp
+++ b/game/objects.cpp
@@ -26,7 +26,6 @@
 #include "netplay.h"
 #include "object.h"
 #include "player.h"
-#include "globals.h"
 #include "objects.h"
 
 
diff --git a/game/player.cpp b/game/player.cpp
index 9e2be1b8..5a59fbb8 100644
--- a/game/player.cpp
+++ b/game/player.cpp
@@ -24,7 +24,6 @@
 #include "netplay.h"
 #include "object.h"
 #include "player.h"
-#include "globals.h"
 #include "objects.h"
 
 // Define this to be invincible
@@ -649,9 +648,9 @@ Player::ExplodeSound(void)
 }
 
 void
-Player::AbortGame(void)
+Player::SetControl(unsigned char which, int toggle)
 {
-	QueueKey(KEY_PRESS, ABORT_KEY);
+	QueueKey(toggle ? KEY_PRESS : KEY_RELEASE, which);
 }
 
 /* Private functions... */
@@ -732,3 +731,20 @@ Uint8 gPlayerColors[MAX_PLAYERS][3] = {
 
 /* The players!! */
 Player *gPlayers[MAX_PLAYERS];
+
+/* Initialize the player sprites */
+int InitPlayerSprites(void)
+{
+	int index;
+
+	OBJ_LOOP(index, MAX_PLAYERS)
+		gPlayers[index] = new Player(index);
+	return(0);
+}
+
+/* Function to switch the displayed player */
+void RotatePlayerView()
+{
+	if ( ++gDisplayed == gNumPlayers )
+		gDisplayed = 0;
+}
diff --git a/game/player.h b/game/player.h
index 76b687b3..42761203 100644
--- a/game/player.h
+++ b/game/player.h
@@ -21,6 +21,8 @@
 */
 
 #include "protocol.h"
+#include "netplay.h"
+#include "object.h"
 
 /* Special features of the player */
 #define MACHINE_GUNS	0x01
@@ -69,7 +71,7 @@ class Player : public Object {
 	virtual void IncrScore(int score) {
 		Score += score;
 	}
-	virtual unsigned int GetScore(void) {
+	virtual int GetScore(void) {
 		if ( Score < 0 ) {
 			return(0);
 		} else {
@@ -131,7 +133,8 @@ class Player : public Object {
 			screen->FillRect(X, Y, 4, 4, ship_color);
 		}
 	}
-	virtual void AbortGame(void);
+
+	void SetControl(unsigned char which, int toggle);
 
 private:
 	int Index;
@@ -164,8 +167,6 @@ class Player : public Object {
 	int numshots;
 	Uint32 ship_color;
 
-	struct sockaddr_in *myaddr;
-
 	/* Create a new shot */
 	int MakeShot(int offset);
 	/* Rubout a flying shot */
@@ -178,3 +179,15 @@ class Player : public Object {
 /* The Players!! */
 extern Player *gPlayers[MAX_PLAYERS];
 extern Uint8   gPlayerColors[MAX_PLAYERS][3];
+
+/* Their shots! */
+extern Uint8   gPlayerShotColors[];
+extern SDL_Texture *gPlayerShot;
+extern Uint8   gEnemyShotColors[];
+extern SDL_Texture *gEnemyShot;
+
+/* Initialize the player sprites */
+int InitPlayerSprites();
+
+/* Function to switch the displayed player */
+void RotatePlayerView();