summary refs log tree commit diff
path: root/src/GameLoop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GameLoop.cpp')
-rw-r--r--src/GameLoop.cpp129
1 files changed, 5 insertions, 124 deletions
diff --git a/src/GameLoop.cpp b/src/GameLoop.cpp
index eec916c..fe7292f 100644
--- a/src/GameLoop.cpp
+++ b/src/GameLoop.cpp
@@ -161,35 +161,6 @@ void	Game::HandleKeyDown( char theChar )
 
 }
 
-/********************> DoEvent() <*****/
-
-#ifdef OS9
-void	Game::DoEvent( EventRecord *event )
-
-{
-
-	char	theChar;
-
-	switch ( event->what )
-
-	{
-
-		case keyDown:
-
-		case autoKey:
-
-			theChar = event->message & charCodeMask;	// Get the letter of the key pressed from the event message
-
-			HandleKeyDown( theChar );					// Only some key presses are handled here because it is slower and less responsive
-
-			break;
-
-	}
-
-}
-#endif
-
-#ifndef OS9
 static int mapinit = 0;
 static int sdlkeymap[SDLK_LAST];
 
@@ -368,172 +339,82 @@ static void ProcessSDLEvents(Game *g)
 	}
 }
 
-#endif
-
 /********************> EventLoop() <*****/
-
 void	Game::EventLoop( void )
-
 {
-
-#ifdef OS9
-	EventRecord		event;
-#endif
-
 	unsigned char	theKeyMap[16];
-
 	int colaccuracy,i;
-
 	GLfloat oldmult;
-
 	gQuit = false;
-
-	while ( gQuit == false )
-
-	{
-
-#ifdef OS9
-		if ( GetNextEvent( everyEvent, &event ) )
-
-			DoEvent( &event );
-#else
+	while ( gQuit == false ) {
 		ProcessSDLEvents(this);
-#endif
-
 		start=TimerGetTime(&theTimer);
-
 		colaccuracy=sps/framespersecond+1;
-
 		if(colaccuracy>sps){colaccuracy=sps;}
 
 		oldmult=multiplier;
-
 		multiplier/=colaccuracy;
-
-		for(i=0;i<(int)(colaccuracy+.5);i++){
-
+		for(i = 0; i < (int) (colaccuracy+.5); i++)
 			Tick();
-
-		}
-
 		multiplier=oldmult;
-
 		if ( DrawGLScene())
-
-#ifdef OS9
-			aglSwapBuffers( gOpenGLContext );
-#else
-                        SDL_GL_SwapBuffers();
-#endif
-
+			SDL_GL_SwapBuffers();
 		else
-
 			gQuit = true;
-
 		oldmult=multiplier;
 
 		end=TimerGetTime(&theTimer);
-
 		timetaken=end-start;
-
 		framespersecond=600000000/timetaken;
-
 		while(framespersecond>maxfps){
-
 			end=TimerGetTime(&theTimer);
-
 			timetaken=end-start;
-
 			framespersecond=600000000/timetaken;
-
 		}
 
 		multiplier5=multiplier4;
-
 		multiplier4=multiplier3;
-
 		multiplier3=multiplier2;
-
 		multiplier2=1/framespersecond;
-
 		multiplier=(multiplier2+multiplier3+multiplier4+multiplier5)/4;
-
 		if(multiplier>1)multiplier=1;
-
 		if(multiplier<.00001)multiplier=.00001;
-
 		if(visions==1&&mainmenu==0)multiplier/=3;
-
 		if(slomo)multiplier*=.2;
-
 		if(paused)multiplier=0;
 
 		GetKeys( ( unsigned long * )theKeyMap );
-
 		if ( IsKeyDown( theKeyMap, MAC_COMMAND_KEY )&&IsKeyDown( theKeyMap, MAC_Q_KEY )){
-
 			gQuit = true;
-
 			if(score>highscore){
-
 				highscore=score;
-
-#ifdef OS9
-				ofstream opstream(":Data:Highscore");
-#else
 				/* TODO */
 				ofstream opstream("Data/Highscore");
-#endif
-
-		        opstream << highscore;
-
+				opstream << highscore;
 				opstream << "\n";
-
-	        	opstream << beatgame;
-
+				opstream << beatgame;
 				opstream.close();
-
 			}
-
 		}
 
 		if ( IsKeyDown( theKeyMap, MAC_ESCAPE_KEY )){
-
 			alSourcePause(gSourceID[rainsound]);
-
 			mainmenu=1;
-
 			alSourcePlay(gSourceID[souloutsound]);
-
 			flashamount=1;
-
 			flashr=1;flashg=1;flashb=1;
-
 			alSourceStop(gSourceID[visionsound]);
-
 			whichsong=mainmenusong;
-
 			alSourceStop(gSourceID[knifesong]);
-
 			alSourceStop(gSourceID[shootsong]);
-
 			alSourceStop(gSourceID[zombiesong]);
-
 			alSourceStop(gSourceID[mainmenusong]);
-
 			alSourcef(gSourceID[knifesong], AL_MIN_GAIN, 0);
-
 			alSourcef(gSourceID[shootsong], AL_MIN_GAIN, 0);
-
 			alSourcef(gSourceID[zombiesong], AL_MIN_GAIN, 0);
-
 			alSourcef(gSourceID[mainmenusong], AL_MIN_GAIN, 0);
-
 			alSourcePlay(gSourceID[whichsong]);
-
 			alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 1);
-
 		}
-
 	}
 }