*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@472 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2006-11-05 17:41:27 +00:00
parent 7d429be232
commit 1802cace77
35 changed files with 960 additions and 620 deletions
+19 -18
View File
@@ -31,28 +31,29 @@ void conline(const char *sf, bool highlight) // add a line to the console
{
cl.cref[0] = '\f';
cl.cref[1] = 0;
strcat_s(cl.cref, sf);
s_strcat(cl.cref, sf);
}
else
{
strcpy_s(cl.cref, sf);
s_strcpy(cl.cref, sf);
};
puts(cl.cref);
};
void conoutf(const char *s, ...)
{
sprintf_sdv(sf, s);
s_sprintfdv(sf, s);
puts(sf);
s = sf;
int n = 0;
while(strlen(s)>WORDWRAP) // cut strings to fit on screen
int n = 0, visible;
while((visible = text_visible(s, VIRTW*4/3 - FONTH))) // cut strings to fit on screen
{
const char *newline = (const char *)memchr(s, '\n', visible);
if(newline) visible = newline+1-s;
string t;
strn0cpy(t, s, WORDWRAP+1);
s_strncpy(t, s, visible+1);
conline(t, n++!=0);
s += WORDWRAP;
s += visible;
};
conline(s, n!=0);
};
void renderconsole() // render buffer taking into account time & scrolling
@@ -66,7 +67,7 @@ void renderconsole() // render buffer taking into
};
loopj(nd)
{
draw_text(refs[j], FONTH/3, (FONTH/4*5)*(nd-j-1)+FONTH/3, 2);
draw_text(refs[j], FONTH/3, (FONTH/4*5)*(nd-j-1)+FONTH/3);
};
};
@@ -89,7 +90,7 @@ void bindkey(char *key, char *action)
for(char *x = key; *x; x++) *x = toupper(*x);
loopi(numkm) if(strcmp(keyms[i].name, key)==0)
{
strcpy_s(keyms[i].action, action);
s_strcpy(keyms[i].action, action);
return;
};
conoutf("unknown key \"%s\"", key);
@@ -103,10 +104,10 @@ void saycommand(char *init) // turns input to the comman
setscope(false);
if(!editmode) keyrepeat(saycommandon);
if(!init) init = "";
strcpy_s(commandbuf, init);
s_strcpy(commandbuf, init);
};
void mapmsg(char *s) { strn0cpy(hdr.maptitle, s, 128); };
void mapmsg(char *s) { s_strncpy(hdr.maptitle, s, 128); };
COMMAND(saycommand, ARG_VARI);
COMMAND(mapmsg, ARG_1STR);
@@ -122,7 +123,7 @@ void pasteconsole()
if(!IsClipboardFormatAvailable(CF_TEXT)) return;
if(!OpenClipboard(NULL)) return;
char *cb = (char *)GlobalLock(GetClipboardData(CF_TEXT));
strcat_s(commandbuf, cb);
s_strcat(commandbuf, cb);
GlobalUnlock(cb);
CloseClipboard();
#else
@@ -185,11 +186,11 @@ void keypress(int code, bool isdown, int cooked)
};
case SDLK_UP:
if(histpos) strcpy_s(commandbuf, vhistory[--histpos]);
if(histpos) s_strcpy(commandbuf, vhistory[--histpos]);
break;
case SDLK_DOWN:
if(histpos<vhistory.length()) strcpy_s(commandbuf, vhistory[histpos++]);
if(histpos<vhistory.length()) s_strcpy(commandbuf, vhistory[histpos++]);
break;
case SDLK_TAB:
@@ -201,7 +202,7 @@ void keypress(int code, bool isdown, int cooked)
default:
resetcomplete();
if(cooked) { char add[] = { cooked, 0 }; strcat_s(commandbuf, add); };
if(cooked) { char add[] = { cooked, 0 }; s_strcat(commandbuf, add); };
};
}
else
@@ -231,7 +232,7 @@ void keypress(int code, bool isdown, int cooked)
loopi(numkm) if(keyms[i].code==code) // keystrokes go to game, lookup in keymap and execute
{
string temp;
strcpy_s(temp, keyms[i].action);
s_strcpy(temp, keyms[i].action);
execute(temp, isdown);
return;
};