summary refs log tree commit diff
path: root/src/Game.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Game.h')
-rw-r--r--src/Game.h341
1 files changed, 169 insertions, 172 deletions
diff --git a/src/Game.h b/src/Game.h
index 8d3d7fc..154fbc3 100644
--- a/src/Game.h
+++ b/src/Game.h
@@ -1,5 +1,26 @@
-#ifndef _GAME_H_
-#define _GAME_H_
+// Game object
+// Copyright (C) 2002  David Rosen
+// Copyright (C) 2003  Steven Fuller
+// Copyright (C) 2003  Zachary Jack Slater
+// Copyright (C) 2021  Nguyễn Gia Phong
+//
+// This file is part of Black Shades.
+//
+// Black Shades 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.
+//
+// Black Shades 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 Black Shades.  If not, see <https://www.gnu.org/licenses/>.
+
+#ifndef BLACKSHADES_GAME_H
+#define BLACKSHADES_GAME_H
 
 #include <GL/gl.h>
 #include <GL/glu.h>
@@ -30,174 +51,150 @@
 #define max_people 90
 #define max_people_block 20
 
-class Game
-{
-		void saveHighScore();
-		void updateSong();
-		void handleMenu();
-	public:
-		//Eventloop
-  		Boolean	gQuit;
-		float gamespeed;
-		double multiplier2,multiplier3,multiplier4,multiplier5,end,start,timetaken,framespersecond;
-		timer theTimer;
-		float sps;
-		int maxfps;
-
-		//Graphics
-		int screenwidth,screenheight;
-		float viewdistance;
-
-		//GL functions
-		GLvoid ReSizeGLScene(float fov, float near);
-		int DrawGLScene(void);
-		int InitGL(void);
-		void LoadingScreen(float percent);
-
-		//Game Functions
-		void	HandleKeyDown( char theChar );
-		void	EventLoop( void );
-		void 	Tick();
-		void 	Splat(int k);
-		void 	InitGame();
-		void 	Dispose();
-
-		//Mouse
-		Point mouseloc;
-		Point oldmouseloc;
-
-		float mouserotation,mouserotation2;
-		float oldmouserotation,oldmouserotation2;
-		float mousesensitivity;
-		float usermousesensitivity;
-
-		//keyboard
-
-		bool tabkeydown;
-
-		//Project Specific
-		int cityrotation[num_blocks][num_blocks];
-		int citytype[num_blocks][num_blocks];
-		int citypeoplenum[num_blocks][num_blocks];
-		bool drawn[num_blocks][num_blocks];
-		int onblockx,onblocky;
-		bool cubetest;
-		bool disttest;
-		bool oldbutton;
-
-		bool initialized;
-
-		float flashamount;
-		float flashr,flashg,flashb;
-
-		int enemystate;
-
-		int cycle;
-
-		bool whacked;
-
-		float losedelay;
-
-		XYZ bodycoords;
-
-		FRUSTUM frustum;
-		Model blocks[4];
-		Model blockwalls[4];
-		Model blockcollide[4];
-		Model blocksimplecollide[4];
-		Model blockroofs[4];
-		Model blockocclude;
-		Model sidewalkcollide;
-		Model street;
-		Model Bigstreet;
-		Model path;
-		Model blocksimple;
-		XYZ boundingpoints[8];
-		Files files;
-		Text text;
-		int goodkills;
-		int badkills;
-		int civkills;
-		int machinegunsoundloop;
-
-		bool lasersight;
-		bool debug;
-		bool vblsync;
-
-		bool blur;
-		bool blurness;
-
-		bool paused;
-
-		int mainmenu;
-
-		bool reloadtoggle;
-
-		bool aimtoggle;
-
-		Point olddrawmouse;
-
-		XYZ vipgoal;
-
-		XYZ aimer[2];
-
-		double eqn[4];
-
-		float oldrot,oldrot2;
-
-		XYZ lastshot[2];
-		bool zoom;
-		bool oldzoom;
-
-		int numpeople;
-		float spawndelay;
-
-		bool customlevels;
-
-		bool musictoggle;
-
-		float psychicpower;
-
-		int type;
-
-		bool slomokeydown;
-
-		int mouseoverbutton;
-		int oldmouseoverbutton;
-
-		Person person[max_people];
-
-		GLuint 				personspritetextureptr;
-		GLuint 				deadpersonspritetextureptr;
-		GLuint 				scopetextureptr;
-		GLuint 				flaretextureptr;
-
-		bool killedinnocent;
-		bool gameinprogress;
-		bool beatgame;
-		bool mainmenuness;
-		int murderer;
-		float timeremaining;
-		int whichsong;
-		int oldscore;
-		int highscore;
-		int score;
-		int mission;
-		int nummissions;
-		int numpossibleguns;
-		int possiblegun[6];
-		int evilprobability;
-		float difficulty;
-		bool azertykeyboard;
-		bool oldvisionkey;
-
-		~Game() {
-			glDeleteTextures( 1, (const GLuint *)personspritetextureptr );
-			glDeleteTextures( 1, (const GLuint *)deadpersonspritetextureptr );
-			glDeleteTextures( 1, (const GLuint *)scopetextureptr );
-			glDeleteTextures( 1, (const GLuint *)flaretextureptr );
-		}
-
+class Game {
+	void saveHighScore();
+	void updateSong();
+	void handleMenu();
+public:
+	// Event loop
+	Boolean	gQuit;
+	float gamespeed;
+	double multiplier2, multiplier3, multiplier4, multiplier5;
+	double end, start, timetaken, framespersecond;
+	timer theTimer;
+	float sps;
+	int maxfps;
+
+	// Graphics
+	int screenwidth, screenheight;
+	float viewdistance;
+
+	// Mouse
+	Point mouseloc;
+	Point oldmouseloc;
+	float mouserotation,mouserotation2;
+	float oldmouserotation,oldmouserotation2;
+	float mousesensitivity;
+	float usermousesensitivity;
+
+	// Keyboard
+	bool tabkeydown;
+
+	// Project specific
+	int cityrotation[num_blocks][num_blocks];
+	int citytype[num_blocks][num_blocks];
+	int citypeoplenum[num_blocks][num_blocks];
+	bool drawn[num_blocks][num_blocks];
+	int onblockx, onblocky;
+	bool cubetest;
+	bool disttest;
+	bool oldbutton;
+
+	bool initialized;
+
+	float flashamount;
+	float flashr,flashg,flashb;
+
+	int enemystate;
+	int cycle;
+	bool whacked;
+	float losedelay;
+	XYZ bodycoords;
+
+	FRUSTUM frustum;
+	Model blocks[4];
+	Model blockwalls[4];
+	Model blockcollide[4];
+	Model blocksimplecollide[4];
+	Model blockroofs[4];
+	Model blockocclude;
+	Model sidewalkcollide;
+	Model street;
+	Model Bigstreet;
+	Model path;
+	Model blocksimple;
+	XYZ boundingpoints[8];
+	Files files;
+	Text text;
+	int goodkills;
+	int badkills;
+	int civkills;
+	int machinegunsoundloop;
+
+	bool lasersight;
+	bool debug;
+	bool vblsync;
+
+	bool blur;
+	bool blurness;
+
+	bool paused;
+	int mainmenu;
+
+	bool reloadtoggle;
+	bool aimtoggle;
+
+	Point olddrawmouse;
+	XYZ vipgoal;
+	XYZ aimer[2];
+
+	double eqn[4];
+	float oldrot, oldrot2;
+
+	XYZ lastshot[2];
+	bool zoom;
+	bool oldzoom;
+
+	int numpeople;
+	float spawndelay;
+
+	bool customlevels;
+	bool musictoggle;
+	float psychicpower;
+	int type;
+	bool slomokeydown;
+
+	int mouseoverbutton;
+	int oldmouseoverbutton;
+
+	Person person[max_people];
+
+	GLuint personspritetextureptr;
+	GLuint deadpersonspritetextureptr;
+	GLuint scopetextureptr;
+	GLuint flaretextureptr;
+
+	bool killedinnocent;
+	bool gameinprogress;
+	bool beatgame;
+	bool mainmenuness;
+	int murderer;
+	float timeremaining;
+	int whichsong;
+	int oldscore;
+	int highscore;
+	int score;
+	int mission;
+	int nummissions;
+	int numpossibleguns;
+	int possiblegun[6];
+	int evilprobability;
+	float difficulty;
+	bool azertykeyboard;
+	bool oldvisionkey;
+
+	// GL functions
+	GLvoid ReSizeGLScene(float fov, float near);
+	int DrawGLScene();
+	int InitGL();
+	void LoadingScreen(float percent);
+
+	// Game functions
+	void HandleKeyDown(char theChar);
+	void EventLoop();
+	void Tick();
+	void Splat(int k);
+	void InitGame();
+	~Game();
 };
-
-#endif
+#endif // BLACKSHADES_GAME_H