fix prompt cursor position

no more 1-char limit on inputcommand prompts
This commit is contained in:
ac-stef
2014-05-14 22:38:29 +02:00
parent d0722dbc27
commit c276c508da
Executable → Regular
+3 -7
View File
@@ -120,18 +120,14 @@ void conoutf(const char *s, ...)
COMMANDF(strstr, "ss", (char *a, char *b) { intret(strstr(a, b) ? 1 : 0); });
/** This is the 1.0.4 function
It will substituted by rendercommand_wip
I am putting this temporarily here because it is very difficult to chat in game with the current cursor behavior,
and chatting in this test period is extremelly important : Brahma */
int rendercommand(int x, int y, int w)
{
defformatstring(s)("# %s", cmdline.buf); /** I changed the symbol here to differentiate from the > (new talk symbol),
and make clear the console changed to the old players (like me) : Brahma */
const char *useprompt = cmdprompt ? cmdprompt : "#";
defformatstring(s)("%s %s", useprompt, cmdline.buf);
int width, height;
text_bounds(s, width, height, w);
y -= height - FONTH;
draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, cmdline.pos>=0 ? cmdline.pos+2 : (int)strlen(s), w);
draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, cmdline.pos>=0 ? cmdline.pos + strlen(useprompt) + 1 : (int)strlen(s), w);
return height;
}