Skip to content

Commit

Permalink
add fullconsole.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
sauerbraten committed Dec 16, 2020
1 parent 9cff7a1 commit 2f135c3
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!*
Expand Down
112 changes: 112 additions & 0 deletions patches/fullconsole.patch
Original file line number Diff line number Diff line change
@@ -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<char> &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);
27 changes: 16 additions & 11 deletions src/engine/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions src/fpsgame/scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/shared/iengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/shared/igame.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace game
extern void readgamedata(vector<char> &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);
Expand Down

0 comments on commit 2f135c3

Please sign in to comment.