*** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@869 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+42
-42
@@ -17,7 +17,7 @@ void setconskip(int n)
|
||||
{
|
||||
conskip += n;
|
||||
if(conskip<0) conskip = 0;
|
||||
};
|
||||
}
|
||||
|
||||
COMMANDN(conskip, setconskip, ARG_1INT);
|
||||
|
||||
@@ -37,8 +37,8 @@ void conline(const char *sf, bool highlight) // add a line to the console
|
||||
else
|
||||
{
|
||||
s_strcpy(cl.cref, sf);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void conoutf(const char *s, ...)
|
||||
{
|
||||
@@ -54,11 +54,11 @@ void conoutf(const char *s, ...)
|
||||
s_strncpy(t, s, visible+1);
|
||||
conline(t, n++!=0);
|
||||
s += visible;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
bool fullconsole = false;
|
||||
void toggleconsole() { fullconsole = !fullconsole; };
|
||||
void toggleconsole() { fullconsole = !fullconsole; }
|
||||
COMMAND(toggleconsole, ARG_NONE);
|
||||
|
||||
void rendercommand(int x, int y)
|
||||
@@ -67,7 +67,7 @@ void rendercommand(int x, int y)
|
||||
int offset = text_width(s, commandpos>=0 ? commandpos+2 : -1);
|
||||
blendbox(x+offset, y, x+offset+char_width(commandpos>=0 ? commandbuf[commandpos] : '_'), y+FONTH, true);
|
||||
draw_text(s, x, y);
|
||||
};
|
||||
}
|
||||
|
||||
void renderconsole() // render buffer taking into account time & scrolling
|
||||
{
|
||||
@@ -87,10 +87,10 @@ void renderconsole() // render buffer taking into
|
||||
{
|
||||
refs[nd++] = conlines[i].cref;
|
||||
if(nd==ndraw) break;
|
||||
};
|
||||
}
|
||||
loopj(nd) draw_text(refs[j], FONTH/3, (FONTH*5/4)*(nd-j-1)+FONTH/3);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// keymap is defined externally in keymap.cfg
|
||||
|
||||
@@ -99,7 +99,7 @@ struct keym
|
||||
int code;
|
||||
char *name, *action;
|
||||
|
||||
~keym() { DELETEA(name); DELETEA(action); };
|
||||
~keym() { DELETEA(name); DELETEA(action); }
|
||||
};
|
||||
vector<keym> keyms;
|
||||
|
||||
@@ -112,7 +112,7 @@ void keymap(char *code, char *key, char *action)
|
||||
km.code = atoi(code);
|
||||
km.name = newstring(key);
|
||||
km.action = newstring(action);
|
||||
};
|
||||
}
|
||||
|
||||
COMMAND(keymap, ARG_3STR);
|
||||
|
||||
@@ -125,9 +125,9 @@ void bindkey(char *key, char *action)
|
||||
if(!keypressed || keyaction!=km.action) delete[] km.action;
|
||||
km.action = newstring(action);
|
||||
return;
|
||||
};
|
||||
}
|
||||
conoutf("unknown key \"%s\"", key);
|
||||
};
|
||||
}
|
||||
|
||||
COMMANDN(bind, bindkey, ARG_2STR);
|
||||
|
||||
@@ -145,12 +145,12 @@ char *addreleaseaction(char *s)
|
||||
ra.key = keypressed;
|
||||
ra.action = newstring(s);
|
||||
return keypressed->name;
|
||||
};
|
||||
}
|
||||
|
||||
void onrelease(char *s)
|
||||
{
|
||||
addreleaseaction(s);
|
||||
};
|
||||
}
|
||||
|
||||
COMMAND(onrelease, ARG_1STR);
|
||||
|
||||
@@ -162,9 +162,9 @@ void saycommand(char *init) // turns input to the comman
|
||||
if(!init) init = "";
|
||||
s_strcpy(commandbuf, init);
|
||||
commandpos = -1;
|
||||
};
|
||||
}
|
||||
|
||||
void mapmsg(char *s) { s_strncpy(hdr.maptitle, s, 128); };
|
||||
void mapmsg(char *s) { s_strncpy(hdr.maptitle, s, 128); }
|
||||
|
||||
COMMAND(saycommand, ARG_VARI);
|
||||
COMMAND(mapmsg, ARG_1STR);
|
||||
@@ -202,10 +202,10 @@ void pasteconsole()
|
||||
commandbuf[commandlen] = '\n';
|
||||
if(commandlen + 1 < _MAXDEFSTR && cbend < &cb[cbsize]) ++commandlen;
|
||||
commandbuf[commandlen] = '\0';
|
||||
};
|
||||
}
|
||||
XFree(cb);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
cvector vhistory;
|
||||
int histpos = 0;
|
||||
@@ -218,8 +218,8 @@ void history(int n)
|
||||
rec = true;
|
||||
execute(vhistory[vhistory.length()-n-1]);
|
||||
rec = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
COMMAND(history, ARG_1INT);
|
||||
|
||||
@@ -243,7 +243,7 @@ void keypress(int code, bool isdown, int cooked)
|
||||
resetcomplete();
|
||||
if(commandpos>=len-1) commandpos = -1;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SDLK_BACKSPACE:
|
||||
{
|
||||
@@ -254,7 +254,7 @@ void keypress(int code, bool isdown, int cooked)
|
||||
if(commandpos>0) commandpos--;
|
||||
else if(!commandpos && len<=1) commandpos = -1;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SDLK_LEFT:
|
||||
if(commandpos>0) commandpos--;
|
||||
@@ -279,7 +279,7 @@ void keypress(int code, bool isdown, int cooked)
|
||||
break;
|
||||
|
||||
case SDLK_v:
|
||||
if(SDL_GetModState()&(KMOD_LCTRL|KMOD_RCTRL)) { pasteconsole(); return; };
|
||||
if(SDL_GetModState()&(KMOD_LCTRL|KMOD_RCTRL)) { pasteconsole(); return; }
|
||||
|
||||
default:
|
||||
resetcomplete();
|
||||
@@ -293,12 +293,12 @@ void keypress(int code, bool isdown, int cooked)
|
||||
{
|
||||
memmove(&commandbuf[commandpos+1], &commandbuf[commandpos], len - commandpos);
|
||||
commandbuf[commandpos++] = cooked;
|
||||
};
|
||||
}
|
||||
commandbuf[len+1] = '\0';
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -309,18 +309,18 @@ void keypress(int code, bool isdown, int cooked)
|
||||
if(vhistory.empty() || strcmp(vhistory.last(), commandbuf))
|
||||
{
|
||||
vhistory.add(newstring(commandbuf)); // cap this?
|
||||
};
|
||||
}
|
||||
histpos = vhistory.length();
|
||||
if(commandbuf[0]=='/') execute(commandbuf);
|
||||
else toserver(commandbuf);
|
||||
};
|
||||
}
|
||||
saycommand(NULL);
|
||||
}
|
||||
else if(code==SDLK_ESCAPE)
|
||||
{
|
||||
saycommand(NULL);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!menukey(code, isdown)) // keystrokes go to menu
|
||||
{
|
||||
@@ -335,8 +335,8 @@ void keypress(int code, bool isdown, int cooked)
|
||||
if(!isdown) execute(ra.action);
|
||||
delete[] ra.action;
|
||||
releaseactions.remove(i--);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
if(isdown)
|
||||
{
|
||||
keyaction = k.action;
|
||||
@@ -344,22 +344,22 @@ void keypress(int code, bool isdown, int cooked)
|
||||
execute(keyaction);
|
||||
keypressed = NULL;
|
||||
if(keyaction!=k.action) delete[] keyaction;
|
||||
};
|
||||
}
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *getcurcommand()
|
||||
{
|
||||
return saycommandon ? commandbuf : NULL;
|
||||
};
|
||||
}
|
||||
|
||||
void writebinds(FILE *f)
|
||||
{
|
||||
loopv(keyms)
|
||||
{
|
||||
if(*keyms[i].action) fprintf(f, "bind \"%s\" [%s]\n", keyms[i].name, keyms[i].action);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user