From fcfe1edb8c85534fc39744821769d6981d31caa7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20BERNIGAUD?= Date: Wed, 18 May 2011 17:20:42 +0200 Subject: [PATCH] The console key is now easy to configure. (the option will only be shown in debug mode) --- Source/Game.cpp | 3 +++ Source/Game.h | 1 + Source/GameDraw.cpp | 16 ++++++++++++---- Source/GameTick.cpp | 6 +++--- Source/Settings.cpp | 6 ++++++ 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Source/Game.cpp b/Source/Game.cpp index 77b9a5b..0cc5057 100644 --- a/Source/Game.cpp +++ b/Source/Game.cpp @@ -161,6 +161,7 @@ Game::Game() autocam = 0; crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0; + consolekey = 0; oldattackkey = 0; loading = 0; @@ -310,6 +311,8 @@ void Game::setKeySelected_thread() { break; case 8: attackkey=keycode; break; + case 9: consolekey=keycode; + break; default: break; } diff --git a/Source/Game.h b/Source/Game.h index cb08024..fc89b4c 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -280,6 +280,7 @@ class Game bool autocam; unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey; + unsigned short consolekey; bool oldattackkey; static void LoadTexture(const string fileName, GLuint *textureid,int mipmap, bool hasalpha); diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 522681b..19b7f17 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -2278,10 +2278,18 @@ void Game::DrawMenu() { else sprintf (menustring[8], "Attack: _"); startx[8]=10+20; starty[8]=80; - - sprintf (menustring[9], "Back"); - startx[9]=10; - starty[9]=10; + + if(debugmode) { + if(keyselect!=9)sprintf (menustring[9], "Console: %s",Input::keyToChar(consolekey)); + else sprintf (menustring[9], "Console: _"); + startx[9]=10+10; + starty[9]=40; + nummenuitems++; + } + + sprintf (menustring[nummenuitems-1], "Back"); + startx[nummenuitems-1]=10; + starty[nummenuitems-1]=10; } break; case 5: { diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 047c5f1..7d9ec2c 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -5591,11 +5591,11 @@ void Game::MenuTick(){ case 4: if(!waiting) { fireSound(); - if(selected<9 && keyselect==-1) + if(selected