Command line now can use the mouse input as well (thanks to Felix-The-Ghost and SKB)

conskip fix (thanks to SKB)
new windows binaries

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6926 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
aerkefiende
2012-11-12 21:53:44 +00:00
parent d3af385dad
commit 19f4558112
3 changed files with 18 additions and 7 deletions
+6 -3
View File
@@ -16,7 +16,8 @@ struct console : consolebuffer<cline>
int conskip;
void setconskip(int n)
{
conskip = clamp(conskip + n, 0, conlines.length());
int visible_lines = (int)(min(fullconsole ? ((VIRTH*2 - 2*CONSPAD - 2*FONTH/3)*(fullconsole==1 ? altconsize : fullconsize))/100 : FONTH*consize, (VIRTH*2 - 2*CONSPAD - 2*FONTH/3))/ (CONSPAD + 2*FONTH/3)) - 1;
conskip = clamp(conskip + n, 0, clamp(conlines.length()-visible_lines, 0, conlines.length()));
}
static const int WORDWRAP = 80;
@@ -486,11 +487,13 @@ void consolekey(int code, bool isdown, int cooked)
scrolldoc(4);
break;
case SDL_AC_BUTTON_WHEELUP:
case SDLK_UP:
if(histpos > history.length()) histpos = history.length();
if(histpos > 0) history[--histpos]->restore();
break;
case SDL_AC_BUTTON_WHEELDOWN:
case SDLK_DOWN:
if(histpos + 1 < history.length()) history[++histpos]->restore();
break;
@@ -511,7 +514,7 @@ void consolekey(int code, bool isdown, int cooked)
}
else
{
if(code==SDLK_RETURN)
if(code==SDLK_RETURN || code==SDL_AC_BUTTON_LEFT || code==SDL_AC_BUTTON_MIDDLE)
{
hline *h = NULL;
if(cmdline.buf[0])
@@ -531,7 +534,7 @@ void consolekey(int code, bool isdown, int cooked)
saycommand(NULL);
if(h) h->run();
}
else if(code==SDLK_ESCAPE)
else if(code==SDLK_ESCAPE || code== SDL_AC_BUTTON_RIGHT)
{
histpos = history.length();
saycommand(NULL);
+8
View File
@@ -20,6 +20,14 @@
#include "varray.h"
#include "vote.h"
#include "console.h"
enum
{
SDL_AC_BUTTON_WHEELDOWN = -5,
SDL_AC_BUTTON_WHEELUP = -4,
SDL_AC_BUTTON_RIGHT = -3,
SDL_AC_BUTTON_MIDDLE = -2,
SDL_AC_BUTTON_LEFT = -1
};
#endif
extern sqr *world, *wmip[]; // map data, the mips are sequential 2D arrays in memory
+4 -4
View File
@@ -1045,18 +1045,18 @@ bool menukey(int code, bool isdown, int unicode, SDLMod mod)
else menusel += pagesize;
break;
case SDLK_ESCAPE:
case -3:
case SDL_AC_BUTTON_RIGHT:
if(!curmenu->allowinput) return false;
menuset(menustack.empty() ? NULL : menustack.pop(), false);
return true;
break;
case SDLK_UP:
case -4:
case SDL_AC_BUTTON_WHEELUP:
if(!curmenu->allowinput) return false;
menusel--;
break;
case SDLK_DOWN:
case -5:
case SDL_AC_BUTTON_WHEELDOWN:
if(!curmenu->allowinput) return false;
menusel++;
break;
@@ -1117,7 +1117,7 @@ bool menukey(int code, bool isdown, int unicode, SDLMod mod)
{
if(!curmenu->allowinput || !curmenu->items.inrange(menusel)) return false;
mitem &m = *curmenu->items[menusel];
if(code==SDLK_RETURN || code==SDLK_SPACE || code==-1 || code==-2)
if(code==SDLK_RETURN || code==SDLK_SPACE || code==SDL_AC_BUTTON_LEFT || code==SDL_AC_BUTTON_MIDDLE)
{
m.select();
audiomgr.playsound(S_MENUENTER, SP_HIGHEST);