diff --git a/Makefile b/Makefile index 8e32009..bf233c1 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,12 @@ apply-patches: $(PATCH) < patches/scoreboard.patch $(PATCH) < patches/macos_builds.patch $(PATCH) < patches/hudfragmessages.patch + $(PATCH) < patches/fullconsole.patch unix2dos src/vcpp/sauerbraten.vcxproj undo-patches: dos2unix src/vcpp/sauerbraten.vcxproj + $(PATCH) --reverse < patches/fullconsole.patch $(PATCH) --reverse < patches/hudfragmessages.patch $(PATCH) --reverse < patches/macos_builds.patch $(PATCH) --reverse < patches/scoreboard.patch diff --git a/README.md b/README.md index 3104b45..c561367 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,13 @@ a.k.a. Features - `hudfragmessagefilter`: bitfield filter var (like confilter), e.g. 0x3800 shows all players' frags, suicides, and teamkills Until a GUI menu for configuring hud frag messages exists, configure your normal console to show the frags you want to see as hud messages, then execute `/hudfragmessagefilter $confilter` to copy those settings for hud frag messages. You can then change your normal console filter back. + +### [fullconsole.patch](./patches/fullconsole.patch) + + - removes the guiskin background of fullconsole + - improves interplay of scoreboard and fullconsole + - `fullconsize` is deprecated and unused, instead the console always takes up all available space + ## Installation The latest builds are always at https://github.com/sauerbraten/p1xbraten/releases/latest. *You do not need to download anything but the correct executable in order to run this client mod!* diff --git a/patches/fullconsole.patch b/patches/fullconsole.patch new file mode 100644 index 0000000..000a180 --- /dev/null +++ b/patches/fullconsole.patch @@ -0,0 +1,112 @@ +Index: src/engine/console.cpp +=================================================================== +--- src/engine/console.cpp (revision 6479) ++++ src/engine/console.cpp (working copy) +@@ -48,7 +48,10 @@ + } + + VAR(fullconsole, 0, 0, 1); +-ICOMMAND(toggleconsole, "", (), { fullconsole ^= 1; }); ++ICOMMAND(toggleconsole, "", (), { ++ fullconsole ^= 1; ++ if(fullconsole) game::showscores(false); ++}); + + int rendercommand(int x, int y, int w) + { +@@ -67,7 +70,7 @@ + VARP(miniconwidth, 0, 40, 100); + VARP(confade, 0, 30, 60); + VARP(miniconfade, 0, 30, 60); +-VARP(fullconsize, 0, 75, 100); ++VARP(fullconsize, 0, 75, 100); // unused + HVARP(confilter, 0, 0x7FFFFFF, 0x7FFFFFF); + HVARP(fullconfilter, 0, 0x7FFFFFF, 0x7FFFFFF); + HVARP(miniconfilter, 0, 0, 0x7FFFFFF); +@@ -140,18 +143,20 @@ + + int renderconsole(int w, int h, int abovehud) // render buffer taking into account time & scrolling + { +- int conpad = fullconsole ? 0 : FONTH/4, +- conoff = fullconsole ? FONTH : FONTH/3, +- conheight = min(fullconsole ? ((h*fullconsize/100)/FONTH)*FONTH : FONTH*consize, h - 2*(conpad + conoff)), ++ int conpad = FONTH/4, ++ conoff = FONTH/3, + conwidth = w - 2*(conpad + conoff) - (fullconsole ? 0 : game::clipconsole(w, h)); + +- extern void consolebox(int x1, int y1, int x2, int y2); +- if(fullconsole) consolebox(conpad, conpad, conwidth+conpad+2*conoff, conheight+conpad+2*conoff); ++ if(fullconsole) ++ { ++ drawconlines(conskip, 0, conwidth, abovehud, conpad+conoff, fullconfilter); ++ return abovehud; ++ } + +- int y = drawconlines(conskip, fullconsole ? 0 : confade, conwidth, conheight, conpad+conoff, fullconsole ? fullconfilter : confilter); +- if(!fullconsole && (miniconsize && miniconwidth)) +- drawconlines(miniconskip, miniconfade, (miniconwidth*(w - 2*(conpad + conoff)))/100, min(FONTH*miniconsize, abovehud - y), conpad+conoff, miniconfilter, abovehud, -1); +- return fullconsole ? conheight + 2*(conpad + conoff) : y; ++ int conheight = min(FONTH*consize, h - 2*(conpad + conoff)); ++ int y = drawconlines(conskip, confade, conwidth, conheight, conpad+conoff, confilter); ++ if(miniconsize && miniconwidth) drawconlines(miniconskip, miniconfade, (miniconwidth*(w - 2*(conpad + conoff)))/100, min(FONTH*miniconsize, abovehud - y), conpad+conoff, miniconfilter, abovehud, -1); ++ return y; + } + + // keymap is defined externally in keymap.cfg +Index: src/fpsgame/scoreboard.cpp +=================================================================== +--- src/fpsgame/scoreboard.cpp (revision 6479) ++++ src/fpsgame/scoreboard.cpp (working copy) +@@ -461,14 +461,25 @@ + scoreboard.render(); + } + +- VARFN(scoreboard, showscoreboard, 0, 0, 1, scoreboard.show(showscoreboard!=0)); +- ++ int wasfullconsole = 0; + void showscores(bool on) + { ++ if(on && !wasfullconsole) ++ { ++ wasfullconsole = fullconsole; ++ fullconsole = 0; ++ } ++ if(!on) ++ { ++ if(!fullconsole && wasfullconsole) fullconsole = 1; ++ wasfullconsole = 0; ++ } ++ extern int showscoreboard; + showscoreboard = on ? 1 : 0; + scoreboard.show(on); + } + ICOMMAND(showscores, "D", (int *down), showscores(*down!=0)); ++ VARFN(scoreboard, showscoreboard, 0, 0, 1, showscores(showscoreboard!=0)); + + VARP(hudscore, 0, 0, 1); + FVARP(hudscorescale, 1e-3f, 1.0f, 1e3f); +Index: src/shared/iengine.h +=================================================================== +--- src/shared/iengine.h (revision 6479) ++++ src/shared/iengine.h (working copy) +@@ -199,6 +199,8 @@ + CON_TAG_MASK = (0x7FFF << CON_TAG_SHIFT) + }; + ++extern int fullconsole; ++ + extern void conoutf(const char *s, ...) PRINTFARGS(1, 2); + extern void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3); + extern void conoutf(int type, int tag, const char *s, ...) PRINTFARGS(3, 4); +Index: src/shared/igame.h +=================================================================== +--- src/shared/igame.h (revision 6479) ++++ src/shared/igame.h (working copy) +@@ -80,6 +80,7 @@ + extern void readgamedata(vector &extras); + extern int clipconsole(int w, int h); + extern void g3d_gamemenus(); ++ extern void showscores(bool on); + extern const char *defaultcrosshair(int index); + extern int selectcrosshair(vec &color); + extern void lighteffects(dynent *d, vec &color, vec &dir); diff --git a/src/engine/console.cpp b/src/engine/console.cpp index d6e83a1..e68535b 100644 --- a/src/engine/console.cpp +++ b/src/engine/console.cpp @@ -48,7 +48,10 @@ void conoutfv(int type, const char *fmt, va_list args) } VAR(fullconsole, 0, 0, 1); -ICOMMAND(toggleconsole, "", (), { fullconsole ^= 1; }); +ICOMMAND(toggleconsole, "", (), { + fullconsole ^= 1; + if(fullconsole) game::showscores(false); +}); int rendercommand(int x, int y, int w) { @@ -67,7 +70,7 @@ VARP(miniconsize, 0, 5, 100); VARP(miniconwidth, 0, 40, 100); VARP(confade, 0, 30, 60); VARP(miniconfade, 0, 30, 60); -VARP(fullconsize, 0, 75, 100); +VARP(fullconsize, 0, 75, 100); // unused HVARP(confilter, 0, 0x7FFFFFF, 0x7FFFFFF); HVARP(fullconfilter, 0, 0x7FFFFFF, 0x7FFFFFF); HVARP(miniconfilter, 0, 0, 0x7FFFFFF); @@ -140,18 +143,20 @@ int drawconlines(int conskip, int confade, int conwidth, int conheight, int cono int renderconsole(int w, int h, int abovehud) // render buffer taking into account time & scrolling { - int conpad = fullconsole ? 0 : FONTH/4, - conoff = fullconsole ? FONTH : FONTH/3, - conheight = min(fullconsole ? ((h*fullconsize/100)/FONTH)*FONTH : FONTH*consize, h - 2*(conpad + conoff)), + int conpad = FONTH/4, + conoff = FONTH/3, conwidth = w - 2*(conpad + conoff) - (fullconsole ? 0 : game::clipconsole(w, h)); - extern void consolebox(int x1, int y1, int x2, int y2); - if(fullconsole) consolebox(conpad, conpad, conwidth+conpad+2*conoff, conheight+conpad+2*conoff); + if(fullconsole) + { + drawconlines(conskip, 0, conwidth, abovehud, conpad+conoff, fullconfilter); + return abovehud; + } - int y = drawconlines(conskip, fullconsole ? 0 : confade, conwidth, conheight, conpad+conoff, fullconsole ? fullconfilter : confilter); - if(!fullconsole && (miniconsize && miniconwidth)) - drawconlines(miniconskip, miniconfade, (miniconwidth*(w - 2*(conpad + conoff)))/100, min(FONTH*miniconsize, abovehud - y), conpad+conoff, miniconfilter, abovehud, -1); - return fullconsole ? conheight + 2*(conpad + conoff) : y; + int conheight = min(FONTH*consize, h - 2*(conpad + conoff)); + int y = drawconlines(conskip, confade, conwidth, conheight, conpad+conoff, confilter); + if(miniconsize && miniconwidth) drawconlines(miniconskip, miniconfade, (miniconwidth*(w - 2*(conpad + conoff)))/100, min(FONTH*miniconsize, abovehud - y), conpad+conoff, miniconfilter, abovehud, -1); + return y; } // keymap is defined externally in keymap.cfg diff --git a/src/fpsgame/scoreboard.cpp b/src/fpsgame/scoreboard.cpp index 145bf8c..bfd974e 100644 --- a/src/fpsgame/scoreboard.cpp +++ b/src/fpsgame/scoreboard.cpp @@ -450,14 +450,25 @@ namespace game scoreboard.render(); } - VARFN(scoreboard, showscoreboard, 0, 0, 1, scoreboard.show(showscoreboard!=0)); - + int wasfullconsole = 0; void showscores(bool on) { + if(on && !wasfullconsole) + { + wasfullconsole = fullconsole; + fullconsole = 0; + } + if(!on) + { + if(!fullconsole && wasfullconsole) fullconsole = 1; + wasfullconsole = 0; + } + extern int showscoreboard; showscoreboard = on ? 1 : 0; scoreboard.show(on); } ICOMMAND(showscores, "D", (int *down), showscores(*down!=0)); + VARFN(scoreboard, showscoreboard, 0, 0, 1, showscores(showscoreboard!=0)); VARP(hudscore, 0, 0, 1); FVARP(hudscorescale, 1e-3f, 1.0f, 1e3f); @@ -472,7 +483,7 @@ namespace game void drawhudscore(int w, int h) { int numgroups = groupplayers(); - if(!numgroups) return; + if(numgroups<2) return; scoregroup *g = groups[0]; int score = INT_MIN, score2 = INT_MIN; diff --git a/src/shared/iengine.h b/src/shared/iengine.h index 32b1957..e4417ea 100644 --- a/src/shared/iengine.h +++ b/src/shared/iengine.h @@ -199,6 +199,8 @@ enum CON_TAG_MASK = (0x7FFF << CON_TAG_SHIFT) }; +extern int fullconsole; + extern void conoutf(const char *s, ...) PRINTFARGS(1, 2); extern void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3); extern void conoutf(int type, int tag, const char *s, ...) PRINTFARGS(3, 4); diff --git a/src/shared/igame.h b/src/shared/igame.h index 113ca17..b1843c4 100644 --- a/src/shared/igame.h +++ b/src/shared/igame.h @@ -80,6 +80,7 @@ namespace game extern void readgamedata(vector &extras); extern int clipconsole(int w, int h); extern void g3d_gamemenus(); + extern void showscores(bool on); extern const char *defaultcrosshair(int index); extern int selectcrosshair(vec &color); extern void lighteffects(dynent *d, vec &color, vec &dir);