aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authortheoddone33 <theoddone33@5198baeb-e213-0410-be47-fc2ff85ca46f>2003-01-09 10:13:12 +0000
committertheoddone33 <theoddone33@5198baeb-e213-0410-be47-fc2ff85ca46f>2003-01-09 10:13:12 +0000
commit6f135aab1bf6f8fa9b3cb7b397bb5ac8724c1aaa (patch)
tree2fbbcecaa6a55a0add9cbe5a7efced90f4775f1c /Source
parent1339813cef051daa74110bc53f1037c83d9fc9fb (diff)
downloadblackshades-6f135aab1bf6f8fa9b3cb7b397bb5ac8724c1aaa.tar.gz
Made game fun as opposed to crapulent
git-svn-id: svn://svn.icculus.org/blackshades/trunk@73 5198baeb-e213-0410-be47-fc2ff85ca46f
Diffstat (limited to 'Source')
-rw-r--r--Source/GameLoop.cpp22
-rw-r--r--Source/GameTick.cpp19
-rw-r--r--Source/Support.cpp10
-rw-r--r--Source/Support.h1
4 files changed, 51 insertions, 1 deletions
diff --git a/Source/GameLoop.cpp b/Source/GameLoop.cpp
index 3864842..1bf32be 100644
--- a/Source/GameLoop.cpp
+++ b/Source/GameLoop.cpp
@@ -314,6 +314,7 @@ static void DoSDLKey(Game *g, SDL_Event *event)
int index;
int mask;
+
if (mapinit == 0) {
init_sdlkeymap();
}
@@ -346,6 +347,27 @@ static void ProcessSDLEvents(Game *g)
do {
switch(event.type) {
case SDL_KEYDOWN:
+ if (event.key.keysym.sym == SDLK_RETURN &&
+ event.key.keysym.mod & KMOD_ALT)
+ {
+ SDL_WM_ToggleFullScreen (SDL_GetVideoSurface ());
+ break;
+ }
+ if (event.key.keysym.sym == SDLK_g &&
+ event.key.keysym.mod & KMOD_CTRL)
+ {
+ if (SDL_WM_GrabInput (SDL_GRAB_QUERY) == SDL_GRAB_OFF)
+ {
+ SDL_WM_GrabInput (SDL_GRAB_ON);
+ SDL_ShowCursor (SDL_DISABLE);
+ }
+ else
+ {
+ SDL_WM_GrabInput (SDL_GRAB_OFF);
+ SDL_ShowCursor (SDL_ENABLE);
+ }
+ break;
+ }
case SDL_KEYUP:
DoSDLKey(g, &event);
break;
diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp
index 73dc222..21ddef6 100644
--- a/Source/GameTick.cpp
+++ b/Source/GameTick.cpp
@@ -153,7 +153,6 @@ void Game::Tick(){
mousex=(float)mouseloc.h*640/screenwidth;
mousey=480-(float)mouseloc.v*480/screenheight;
-
oldmouseoverbutton=mouseoverbutton;
@@ -720,6 +719,7 @@ void Game::Tick(){
}
+#if 0 // DDOI
GetMouse(&mouseloc);
if (mouseloc.h>600){MoveMouse(mouseloc.h-500,mouseloc.v,&mouseloc);}
@@ -734,11 +734,17 @@ void Game::Tick(){
GetMouse(&mouseloc);
+#else
+ GetMouseRel(&mouseloc);
+#endif
+
+#if 0 // DDOI
oldmouserotation=(oldmouseloc.h/1.3888)*mousesensitivity;
oldmouserotation2=(oldmouseloc.v/1.3888)*mousesensitivity;
+#endif
mouserotation=(mouseloc.h/1.3888)*mousesensitivity;
@@ -746,6 +752,7 @@ void Game::Tick(){
+#if 0 // DDOI
if(abs(oldmouseloc.h-mouseloc.h)<400)camera.rotation+=mouserotation-oldmouserotation;
if(abs(oldmouseloc.v-mouseloc.v)<200)camera.rotation2+=mouserotation2-oldmouserotation2;
@@ -757,6 +764,16 @@ void Game::Tick(){
if(mouseloc.v-oldmouseloc.v>200)camera.rotation2+=mouserotation2-oldmouserotation2-(300/1.3888*mousesensitivity);
if(mouseloc.v-oldmouseloc.v<-200)camera.rotation2+=mouserotation2-oldmouserotation2+(300/1.3888*mousesensitivity);
+#else
+ if(abs(mouseloc.h)<400)camera.rotation+=mouserotation;
+ if(abs(mouseloc.v)<200)camera.rotation2+=mouserotation2;
+ if(mouseloc.h>400)camera.rotation+=mouserotation-(500/1.3888*mousesensitivity);
+ if(mouseloc.h<-400)camera.rotation+=mouserotation+(500/1.3888*mousesensitivity);
+
+ if(mouseloc.v>200)camera.rotation2+=mouserotation2-(300/1.3888*mousesensitivity);
+
+ if(mouseloc.v<-200)camera.rotation2+=mouserotation2+(300/1.3888*mousesensitivity);
+#endif
diff --git a/Source/Support.cpp b/Source/Support.cpp
index 5038d50..2e37ff4 100644
--- a/Source/Support.cpp
+++ b/Source/Support.cpp
@@ -39,6 +39,16 @@ void GetMouse(Point *p)
p->v = y;
}
+void GetMouseRel(Point *p)
+{
+ int x;
+ int y;
+
+ SDL_GetRelativeMouseState(&x, &y);
+
+ p->h = x;
+ p->v = y;
+}
int Button(void)
{
return (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(1));
diff --git a/Source/Support.h b/Source/Support.h
index 45f225c..7f6e080 100644
--- a/Source/Support.h
+++ b/Source/Support.h
@@ -37,6 +37,7 @@ typedef struct Point
int Random();
void Microseconds(UnsignedWide *microTickCount);
void GetMouse(Point *p);
+void GetMouseRel(Point *p);
void GetKeys(unsigned long *keys);
int Button(void);