summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-09-24 17:40:59 +0000
committerSimon Howard2011-09-24 17:40:59 +0000
commit17d75c2915ec75077e86dbd7a356061961552b53 (patch)
tree07603babcdcae0ef12f3bd9092219ed0f95a8235 /src
parent73f27119add06b37dadc4a62343e1301585a828f (diff)
downloadchocolate-doom-17d75c2915ec75077e86dbd7a356061961552b53.tar.gz
chocolate-doom-17d75c2915ec75077e86dbd7a356061961552b53.tar.bz2
chocolate-doom-17d75c2915ec75077e86dbd7a356061961552b53.zip
Add -testcontrols to Heretic.
Subversion-branch: /branches/v2-branch Subversion-revision: 2396
Diffstat (limited to 'src')
-rw-r--r--src/heretic/d_main.c15
-rw-r--r--src/heretic/doomdef.h3
-rw-r--r--src/heretic/g_game.c20
-rw-r--r--src/heretic/mn_menu.c12
-rw-r--r--src/v_video.c3
5 files changed, 51 insertions, 2 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index 97eb37ed..62e4892e 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -182,6 +182,11 @@ void D_Display(void)
break;
}
+ if (testcontrols)
+ {
+ V_DrawMouseSpeedBox(testcontrols_mousespeed);
+ }
+
if (paused && !MenuActive && !askforquit)
{
if (!netgame)
@@ -774,7 +779,7 @@ static void D_Endoom(void)
// Disable ENDOOM?
- if (!show_endoom)
+ if (!show_endoom || testcontrols)
{
return;
}
@@ -1036,6 +1041,14 @@ void D_DoomMain(void)
free(filename);
}
+ if (M_ParmExists("-testcontrols"))
+ {
+ startepisode = 1;
+ startmap = 1;
+ autostart = true;
+ testcontrols = true;
+ }
+
// Check valid episode and map
if (autostart || netgame)
{
diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h
index b2508335..12290970 100644
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -631,6 +631,9 @@ extern int startepisode;
extern int startmap;
extern boolean autostart;
+extern boolean testcontrols;
+extern int testcontrols_mousespeed;
+
/*
===============================================================================
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index 9b3e3799..ff5a79c3 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -137,6 +137,9 @@ short consistancy[MAXPLAYERS][BACKUPTICS];
char *savegamedir;
byte *savebuffer, *save_p;
+boolean testcontrols = false;
+int testcontrols_mousespeed;
+
//
// controls (have defaults)
@@ -501,6 +504,13 @@ void G_BuildTiccmd(ticcmd_t * cmd)
cmd->angleturn -= mousex * 0x8;
}
+ // No mouse movement in previous frame?
+
+ if (mousex == 0)
+ {
+ testcontrols_mousespeed = 0;
+ }
+
forward += mousey;
mousex = mousey = 0;
@@ -585,6 +595,11 @@ void G_DoLoadLevel(void)
sendpause = sendsave = paused = false;
memset(mousebuttons, 0, sizeof(mousebuttons));
memset(joybuttons, 0, sizeof(joybuttons));
+
+ if (testcontrols)
+ {
+ P_SetMessage(&players[consoleplayer], "PRESS ESCAPE TO QUIT.", false);
+ }
}
static void SetJoyButtons(unsigned int buttons_mask)
@@ -655,6 +670,11 @@ boolean G_Responder(event_t * ev)
}
}
+ if (ev->type == ev_mouse)
+ {
+ testcontrols_mousespeed = abs(ev->data2);
+ }
+
switch (ev->type)
{
case ev_keydown:
diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c
index 930df426..4d394db1 100644
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -1046,6 +1046,18 @@ boolean MN_Responder(event_t * event)
extern void G_CheckDemoStatus(void);
char *textBuffer;
+ if (testcontrols)
+ {
+ if (event->type == ev_quit
+ || (event->type == ev_keydown
+ && (event->data1 == key_menu_activate
+ || event->data1 == key_menu_quit)))
+ {
+ I_Quit();
+ return true;
+ }
+ }
+
// "close" button pressed on window?
if (event->type == ev_quit)
{
diff --git a/src/v_video.c b/src/v_video.c
index 97d40ec0..56207d64 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include "i_system.h"
@@ -766,7 +767,7 @@ void V_DrawMouseSpeedBox(int speed)
// Calculate box position
box_x = SCREENWIDTH - MOUSE_SPEED_BOX_WIDTH - 10;
- box_y = 10;
+ box_y = 15;
V_DrawFilledBox(box_x, box_y,
MOUSE_SPEED_BOX_WIDTH, MOUSE_SPEED_BOX_HEIGHT, bgcolor);