Skip to content

Commit 9dd2558

Browse files
lsalzmanNiebsauerbraten
committed
svn r6844
Co-authored-by: Nieb <Nieb@users.noreply.github.com> Co-authored-by: sauerbraten <willing.alexander@googlemail.com>
1 parent 0ad8d47 commit 9dd2558

37 files changed

+453
-318
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ debian: clean
3737

3838
apply-patches: PATCH=patch --strip=0 --remove-empty-files --ignore-whitespace --no-backup-if-mismatch
3939
apply-patches:
40+
$(PATCH) < patches/2020_compat.patch # keeps SVN changes compatible with 2020 edition
4041
$(PATCH) < patches/modconfig.patch
4142
$(PATCH) < patches/modversion.patch
4243
$(PATCH) < patches/moviehud.patch

patches/2020_compat.patch

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
undo the changes to the default crosshair location from r6799
2+
3+
diff --git src/engine/rendergl.cpp src/engine/rendergl.cpp
4+
index f35a1fb..897aecb 100644
5+
--- src/engine/rendergl.cpp
6+
+++ src/engine/rendergl.cpp
7+
@@ -2110,7 +2110,7 @@ void loadcrosshair(const char *name, int i)
8+
if(crosshairs[i] == notexture)
9+
{
10+
name = game::defaultcrosshair(i);
11+
- if(!name) name = "packages/crosshairs/default.png";
12+
+ if(!name) name = "data/crosshair.png";
13+
crosshairs[i] = textureload(name, 3, true);
14+
}
15+
}
16+
@@ -2128,7 +2128,7 @@ ICOMMAND(getcrosshair, "i", (int *i),
17+
if(*i >= 0 && *i < MAXCROSSHAIRS)
18+
{
19+
name = crosshairs[*i] ? crosshairs[*i]->name : game::defaultcrosshair(*i);
20+
- if(!name) name = "packages/crosshairs/default.png";
21+
+ if(!name) name = "data/crosshair.png";
22+
}
23+
result(name);
24+
});
25+
diff --git src/fpsgame/fps.cpp src/fpsgame/fps.cpp
26+
index 7efee42..e170bc9 100644
27+
--- src/fpsgame/fps.cpp
28+
+++ src/fpsgame/fps.cpp
29+
@@ -1165,9 +1165,9 @@ namespace game
30+
{
31+
switch(index)
32+
{
33+
- case 2: return "packages/crosshairs/default_hit.png";
34+
- case 1: return "packages/crosshairs/default_teammate.png";
35+
- default: return "packages/crosshairs/default.png";
36+
+ case 2: return "data/hit.png";
37+
+ case 1: return "data/teammate.png";
38+
+ default: return "data/crosshair.png";
39+
}
40+
}
41+

patches/clientdemo.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ index b59407a..64a92ad 100644
214214
// client
215215
- extern bool connected, remote, demoplayback;
216216
+ extern bool connected, remote, demoplayback, gamepaused;
217-
extern string servinfo;
217+
extern string servdesc;
218218
+ extern int mastermode, gamespeed;
219219
+ extern hashset<teaminfo> teaminfos;
220220
extern vector<uchar> messages;

patches/colors.patch

+34-31
Original file line numberDiff line numberDiff line change
@@ -119,28 +119,30 @@ Index: src/engine/rendertext.cpp
119119
===================================================================
120120
--- src/engine/rendertext.cpp (revision 6518)
121121
+++ src/engine/rendertext.cpp (working copy)
122-
@@ -221,15 +221,15 @@
122+
@@ -221,16 +221,16 @@
123123
else stack[sp] = c;
124124
switch(c)
125125
{
126-
- case '0': color = bvec( 64, 255, 128); break; // green: player talk
127-
- case '1': color = bvec( 96, 160, 255); break; // blue: "echo" command
128-
- case '2': color = bvec(255, 192, 64); break; // yellow: gameplay messages
129-
- case '3': color = bvec(255, 64, 64); break; // red: important errors
130-
- case '4': color = bvec(128, 128, 128); break; // gray
131-
- case '5': color = bvec(192, 64, 192); break; // magenta
132-
- case '6': color = bvec(255, 128, 0); break; // orange
133-
- case '7': color = bvec(255, 255, 255); break; // white
134-
- case '8': color = bvec( 96, 240, 255); break; // cyan
135-
+ case '0': color = bvec::hexcolor(COL_GREEN); break; // player talk
136-
+ case '1': color = bvec::hexcolor(COL_BLUE); break; // "echo" command
137-
+ case '2': color = bvec::hexcolor(COL_YELLOW); break; // gameplay messages
138-
+ case '3': color = bvec::hexcolor(COL_RED); break; // important errors
139-
+ case '4': color = bvec::hexcolor(COL_GRAY); break;
140-
+ case '5': color = bvec::hexcolor(COL_MAGENTA); break;
141-
+ case '6': color = bvec::hexcolor(COL_ORANGE); break;
142-
+ case '7': color = bvec::hexcolor(COL_WHITE); break;
143-
+ case '8': color = bvec::hexcolor(COL_CYAN); break;
126+
- case '0': color = bvec( 64, 255, 128); break; // Green (Player chat)
127+
- case '1': color = bvec( 96, 160, 255); break; // Blue ("echo" Command)
128+
- case '2': color = bvec(255, 192, 64); break; // Yellow (Gameplay Messages)
129+
- case '3': color = bvec(255, 64, 64); break; // Red (Important Errors)
130+
- case '4': color = bvec(128, 128, 128); break; // Grey 50%
131+
- case '5': color = bvec(192, 64, 192); break; // Magenta
132+
- case '6': color = bvec(255, 128, 0); break; // Orange
133+
- case '7': color = bvec(255, 255, 255); break; // White
134+
- case '8': color = bvec( 96, 240, 255); break; // Cyan
135+
- case '9': color = bvec(181, 181, 181); break; // Grey ~70%
136+
+ case '0': color = bvec::hexcolor(COL_GREEN); break; // player chat
137+
+ case '1': color = bvec::hexcolor(COL_BLUE); break; // "echo" command
138+
+ case '2': color = bvec::hexcolor(COL_YELLOW); break; // gameplay messages
139+
+ case '3': color = bvec::hexcolor(COL_RED); break; // important errors
140+
+ case '4': color = bvec::hexcolor(COL_GRAY); break;
141+
+ case '5': color = bvec::hexcolor(COL_MAGENTA); break;
142+
+ case '6': color = bvec::hexcolor(COL_ORANGE); break;
143+
+ case '7': color = bvec::hexcolor(COL_WHITE); break;
144+
+ case '8': color = bvec::hexcolor(COL_CYAN); break;
145+
+ case '9': color = bvec::hexcolor(COL_LIGHTERGRAY); break;
144146
// provided color: everything else
145147
}
146148
gle::color(color, a);
@@ -242,15 +244,15 @@ Index: src/fpsgame/fps.cpp
242244
@@ -943,9 +943,9 @@
243245

244246
VARP(gameclock, 0, 0, 1);
245-
FVARP(gameclockscale, 1e-3f, 0.75f, 1e3f);
247+
FVARP(gameclockscale, 0.5, 1.0, 2.0);
246248
- HVARP(gameclockcolour, 0, 0xFFFFFF, 0xFFFFFF);
247249
+ HVARP(gameclockcolour, 0, COL_WHITE, COL_WHITE);
248250
VARP(gameclockalpha, 0, 255, 255);
249-
- HVARP(gameclocklowcolour, 0, 0xFFC040, 0xFFFFFF);
251+
- HVARP(gameclocklowcolour, 0, 0xFFA050, 0xFFFFFF);
250252
+ HVARP(gameclocklowcolour, 0, COL_ORANGE, COL_WHITE);
251253
VARP(gameclockalign, -1, 0, 1);
252-
FVARP(gameclockx, 0, 0.50f, 1);
253-
FVARP(gameclocky, 0, 0.03f, 1);
254+
FVARP(gameclockx, 0.0, 0.50, 1.0);
255+
FVARP(gameclocky, 0.0, 0.03, 1.0);
254256
@@ -1010,7 +1010,7 @@
255257
int tw, th; text_bounds(label, tw, th);
256258
vec2 textdrawpos = vec2(-tw, -th).div(2);
@@ -441,9 +443,9 @@ Index: src/fpsgame/scoreboard.cpp
441443
string hostname;
442444
if(enet_address_get_host_ip(address, hostname, sizeof(hostname)) >= 0)
443445
{
444-
- if(servinfo[0]) g.titlef("%.25s", 0xFFFF80, NULL, servinfo);
446+
- if(servdesc[0]) g.titlef("%.25s", 0xFFFF80, NULL, servdesc);
445447
- else g.titlef("%s:%d", 0xFFFF80, NULL, hostname, address->port);
446-
+ if(servinfo[0]) g.titlef("%.25s", COL_WHITE, NULL, servinfo);
448+
+ if(servdesc[0]) g.titlef("%.25s", COL_WHITE, NULL, servdesc);
447449
+ else g.titlef("%s:%d", COL_WHITE, NULL, hostname, address->port);
448450
}
449451
}
@@ -699,8 +701,8 @@ Index: src/fpsgame/scoreboard.cpp
699701
else g.poplist();
700702
@@ -475,8 +475,8 @@
701703
VARP(hudscorealign, -1, 0, 1);
702-
FVARP(hudscorex, 0, 0.50f, 1);
703-
FVARP(hudscorey, 0, 0.03f, 1);
704+
FVARP(hudscorex, 0.0, 0.50, 1.0);
705+
FVARP(hudscorey, 0.0, 0.03, 1.0);
704706
- HVARP(hudscoreplayercolour, 0, 0x60A0FF, 0xFFFFFF);
705707
- HVARP(hudscoreenemycolour, 0, 0xFF4040, 0xFFFFFF);
706708
+ HVARP(hudscoreplayercolour, 0, COL_BLUE, COL_WHITE);
@@ -725,10 +727,11 @@ Index: src/p1xbraten/colors.h
725727
===================================================================
726728
--- src/p1xbraten/colors.h (nonexistent)
727729
+++ src/p1xbraten/colors.h (working copy)
728-
@@ -0,0 +1,11 @@
729-
+#define COL_WHITE 0xFFFFFF
730-
+#define COL_GRAY 0xA0A0A0
731-
+#define COL_BACKGROUND 0x9A9A9A
730+
@@ -0,0 +1,12 @@
731+
+#define COL_WHITE 0xFFFFFF
732+
+#define COL_LIGHTERGRAY 0xB5B5B5
733+
+#define COL_GRAY 0xA0A0A0
734+
+#define COL_BACKGROUND 0x9A9A9A
732735
+
733736
+#define COL_RED 0xED2B2C
734737
+#define COL_BLUE 0x1A76FF

patches/demo_info_message.patch

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,41 @@ index ae9528d..0bde4c8 100644
44
+++ src/fpsgame/server.cpp
55
@@ -788,6 +788,7 @@ namespace server
66
}
7-
7+
88
int welcomepacket(packetbuf &p, clientinfo *ci);
99
+ bool demoinfomsg(packetbuf &p);
1010
void sendwelcome(clientinfo *ci);
11-
11+
1212
void setupdemorecord()
1313
@@ -813,6 +814,7 @@ namespace server
14-
14+
1515
packetbuf p(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
1616
welcomepacket(p, NULL);
1717
+ demoinfomsg(p);
1818
writedemo(1, p.buf, p.len);
1919
}
20-
20+
2121
diff --git src/p1xbraten/clientdemo.cpp src/p1xbraten/clientdemo.cpp
2222
index 48e29ec..e5c44f7 100644
2323
--- src/p1xbraten/clientdemo.cpp
2424
+++ src/p1xbraten/clientdemo.cpp
2525
@@ -161,6 +161,8 @@ namespace game {
2626
return 1;
2727
}
28-
28+
2929
+ bool demoinfomsg(packetbuf &p);
3030
+
3131
void setupdemorecord()
3232
{
3333
if(!m_mp(gamemode) || m_edit || m_collect || demo || demorecord) return;
3434
@@ -201,6 +203,7 @@ namespace game {
35-
35+
3636
packetbuf p(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
3737
welcomepacket(p);
3838
+ demoinfomsg(p);
3939
recordpacket(1, p.buf, p.len);
4040
}
41-
41+
4242
diff --git src/p1xbraten/demo_info_message.cpp src/p1xbraten/demo_info_message.cpp
4343
new file mode 100644
4444
index 0000000..5cdab5a
@@ -95,6 +95,6 @@ index 0000000..5cdab5a
9595
+ return hostport;
9696
+ }
9797
+
98-
+ bool demoinfomsg(packetbuf &p) { return _demoinfomsg(p, serverhostport(), servinfo); }
98+
+ bool demoinfomsg(packetbuf &p) { return _demoinfomsg(p, serverhostport(), servdesc); }
9999
+}
100100
+#endif

patches/managed_games.patch

+2-3
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ new file mode 100644
390390
index 0000000..1c1b1d7
391391
--- /dev/null
392392
+++ src/p1xbraten/managed_games.cpp
393-
@@ -0,0 +1,262 @@
393+
@@ -0,0 +1,261 @@
394394
+#include "game.h"
395395
+
396396
+#ifndef STANDALONE
@@ -401,15 +401,14 @@ index 0000000..1c1b1d7
401401
+ conoutf("sending demo to server...");
402402
+ if(!demo) return;
403403
+ stream::offset len = demo->size();
404-
+ if(len > 16*1024*1024) conoutf(CON_ERROR, "demo is too large"); // todo: is 16 MB enough?
404+
+ if(len > 16*1024*1024) conoutf(CON_ERROR, "demo file too large"); // todo: is 16 MB enough?
405405
+ else if(len <= 0) conoutf(CON_ERROR, "could not read demo");
406406
+ else sendfile(-1, 3, demo);
407407
+ conoutf("client demo sent");
408408
+ }
409409
+}
410410
+#endif
411411
+
412-
+
413412
+namespace server {
414413
+
415414
+ void probeforclientdemoupload(packetbuf &p)

patches/new_changes.patch

-24
This file was deleted.

patches/proxy_setip.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ index 3017f57..4aa8d18 100644
1414
case ST_TCPIP: nonlocalclients++; break;
1515
case ST_LOCAL: localclients++; break;
1616
}
17-
+ c->real = ENetAddress{0, 0};
17+
+ c->real.host = 0; c->real.port = 0;
1818
return *c;
1919
}
2020

patches/scoreboard.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ index 0000000..8da7701
206206
+ string hostname;
207207
+ if(enet_address_get_host_ip(address, hostname, sizeof(hostname)) >= 0)
208208
+ {
209-
+ if(servinfo[0]) g.titlef("%.25s", COL_WHITE, NULL, servinfo);
209+
+ if(servdesc[0]) g.titlef("%.25s", COL_WHITE, NULL, servdesc);
210210
+ else g.titlef("%s:%d", COL_WHITE, NULL, hostname, address->port);
211211
+ }
212212
+ }

patches/zenmode.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Index: src/fpsgame/client.cpp
8585
+ conoutf(CON_CHAT + (d->state==CS_SPECTATOR ? CON_NONZEN : 0), "%s:\f0 %s", chatcolorname(d), text);
8686
@@ -1342,3 +1355,3 @@
8787
if(t->state!=CS_DEAD && t->state!=CS_SPECTATOR)
88-
particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, 0x6496FF, 4.0f, -8);
88+
particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, COL_BLUE, 4.0f, -8);
8989
- conoutf(CON_TEAMCHAT, "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
9090
+ conoutf(CON_TEAMCHAT + (t->state==CS_SPECTATOR ? CON_NONZEN : 0), "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
9191
@@ -1400,11 +1413,11 @@

src/engine/3dgui.cpp

+20-2
Original file line numberDiff line numberDiff line change
@@ -920,14 +920,25 @@ struct gui : g3d_gui
920920
}
921921

922922
vec origin, scale, *savedorigin;
923-
float dist;
923+
float dist, modscale;
924924
g3d_callback *cb;
925925
bool gui2d;
926926

927927
static float basescale, maxscale;
928928
static bool passthrough;
929929
static float alpha;
930930
static vec light;
931+
static ivec2 align;
932+
933+
void setalign(int x, int y)
934+
{
935+
align = ivec2(clamp(x, -1, 1), clamp(y, -1, 1));
936+
}
937+
938+
void setscale(float k)
939+
{
940+
modscale = k > 0 ? k : 1.0f;
941+
}
931942

932943
void adjustscale()
933944
{
@@ -936,9 +947,12 @@ struct gui : g3d_gui
936947
else h += (skiny[6]-skiny[3])*SKIN_SCALE;
937948

938949
float aspect = forceaspect ? 1.0f/forceaspect : float(screenh)/float(screenw), fit = 1.0f;
950+
basescale *= modscale;
951+
scale.mul(modscale);
939952
if(w*aspect*basescale>1.0f) fit = 1.0f/(w*aspect*basescale);
940953
if(h*basescale*fit>maxscale) fit *= maxscale/(h*basescale*fit);
941-
origin = vec(0.5f-((w-xsize)/2 - (skinx[2]-skinx[1])*SKIN_SCALE)*aspect*scale.x*fit, 0.5f + (0.5f*h-(skiny[9]-skiny[7])*SKIN_SCALE)*scale.y*fit, 0);
954+
origin = vec(0.5f*(align.x+1)-((w*(align.x+1)-xsize)/2 - (skinx[2]-skinx[1])*SKIN_SCALE)*aspect*scale.x*fit,
955+
0.5f*(align.y+1) + (0.5f*h*(2-(align.y+1)) - (align.y < 0 ? 0.5f : 1.0f)*(skiny[9]-skiny[7])*SKIN_SCALE)*scale.y*fit, 0);
942956
scale = vec(aspect*scale.x*fit, scale.y*fit, 1);
943957
}
944958

@@ -951,6 +965,7 @@ struct gui : g3d_gui
951965
}
952966
basescale = initscale;
953967
if(layoutpass) scale.x = scale.y = scale.z = guifadein ? basescale*min((totalmillis-starttime)/300.0f, 1.0f) : basescale;
968+
else basescale *= modscale;
954969
alpha = allowinput ? 0.80f : 0.60f;
955970
passthrough = scale.x<basescale || !allowinput;
956971
curdepth = -1;
@@ -965,6 +980,8 @@ struct gui : g3d_gui
965980
{
966981
firstlist = nextlist = curlist;
967982
memset(columns, 0, sizeof(columns));
983+
align = ivec2(0, 0);
984+
modscale = 1.0f;
968985
}
969986
else
970987
{
@@ -1156,6 +1173,7 @@ vector<gui::list> gui::lists;
11561173
float gui::basescale, gui::maxscale = 1, gui::hitx, gui::hity, gui::alpha;
11571174
bool gui::passthrough, gui::shouldmergehits = false, gui::shouldautotab = true;
11581175
vec gui::light;
1176+
ivec2 gui::align(0, 0);
11591177
int gui::curdepth, gui::curlist, gui::xsize, gui::ysize, gui::curx, gui::cury;
11601178
int gui::ty, gui::tx, gui::tpos, *gui::tcurrent, gui::tcolor;
11611179
static vector<gui> guis2d, guis3d;

src/engine/animmodel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ template<class MDL, class MESH> struct modelcommands
15881588
template<class F> void modelcommand(F *fun, const char *suffix, const char *args)
15891589
{
15901590
defformatstring(name, "%s%s", MDL::formatname(), suffix);
1591-
addcommand(newstring(name), (void (*)())fun, args);
1591+
addcommand(newstring(name), fun, args);
15921592
}
15931593

15941594
modelcommands()

0 commit comments

Comments
 (0)