Skip to content

Commit

Permalink
svn r6856
Browse files Browse the repository at this point in the history
Co-authored-by: Nieb <Nieb@users.noreply.github.com>
  • Loading branch information
2 people authored and sauerbraten committed Feb 1, 2024
1 parent 99254f3 commit 3dc3a44
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 58 deletions.
2 changes: 1 addition & 1 deletion patches/chat_highlight_words.patch
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Index: src/fpsgame/client.cpp
@@ -1343,6 +1348,7 @@
if(t->state!=CS_DEAD && t->state!=CS_SPECTATOR)
particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, 0x6496FF, 4.0f, -8);
conoutf(CON_TEAMCHAT, "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
conoutf(CON_TEAMCHAT, "\fs\f8[%s]\fr %s: \f8%s", t->state==CS_SPECTATOR ? "spec" : "team", chatcolorname(t), text);
+ if(!hasfocus) loopv(chathighlightwords) if(strstr(text, chathighlightwords[i])) { playsoundname(chathighlightsound); break; }
break;
}
Expand Down
2 changes: 1 addition & 1 deletion patches/colors.patch
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Index: src/fpsgame/client.cpp
if(t->state!=CS_DEAD && t->state!=CS_SPECTATOR)
- particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, 0x6496FF, 4.0f, -8);
+ particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, COL_BLUE, 4.0f, -8);
conoutf(CON_TEAMCHAT, "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
conoutf(CON_TEAMCHAT, "\fs\f8[%s]\fr %s: \f8%s", t->state==CS_SPECTATOR ? "spec" : "team", chatcolorname(t), text);
break;
}
Index: src/fpsgame/collect.h
Expand Down
4 changes: 2 additions & 2 deletions patches/serverlogging.patch
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ Index: src/fpsgame/server.cpp
if(t==cq || t->state.state==CS_SPECTATOR || t->state.aitype != AI_NONE || strcmp(cq->team, t->team)) continue;
sendf(t->clientnum, 1, "riis", N_SAYTEAM, cq->clientnum, text);
}
- if(isdedicatedserver() && cq) logoutf("%s <%s>: %s", colorname(cq), cq->team, text);
+ if(isdedicatedserver() && cq) logoutf("%s (cn %d) <%s>: %s", colorname(cq), cq->clientnum, cq->team, text);
- if(isdedicatedserver() && cq) logoutf("%s <%s>: %s", colorname(cq), ci->state.state==CS_SPECTATOR ? "spec" : cq->team, text);
+ if(isdedicatedserver() && cq) logoutf("%s (cn %d) <%s>: %s", colorname(cq), cq->clientnum, ci->state.state==CS_SPECTATOR ? "spec" : cq->team, text);
break;
}

Expand Down
4 changes: 2 additions & 2 deletions patches/zenmode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ Index: src/fpsgame/client.cpp
@@ -1342,3 +1355,3 @@
if(t->state!=CS_DEAD && t->state!=CS_SPECTATOR)
particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, COL_BLUE, 4.0f, -8);
- conoutf(CON_TEAMCHAT, "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
+ conoutf(CON_TEAMCHAT + (t->state==CS_SPECTATOR ? CON_NONZEN : 0), "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
- conoutf(CON_TEAMCHAT, "\fs\f8[%s]\fr %s: \f8%s", t->state==CS_SPECTATOR ? "spec" : "team", chatcolorname(t), text);
+ conoutf(CON_TEAMCHAT + (t->state==CS_SPECTATOR ? CON_NONZEN : 0), "\fs\f8[%s]\fr %s: \f8%s", t->state==CS_SPECTATOR ? "spec" : "team", chatcolorname(t), text);
@@ -1400,11 +1413,11 @@
if(d->name[0]) // already connected
{
Expand Down
4 changes: 3 additions & 1 deletion src/engine/octaedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void toggleedit(bool force)
cancelsel();
stoppaintblendmap();
keyrepeat(editmode);
editing = entediting = editmode;
editing = editmode;
extern int fullbright;
if(fullbright) { initlights(); lightents(); }
if(!force) game::edittoggled(editmode);
Expand Down Expand Up @@ -298,6 +298,8 @@ cube &blockcube(int x, int y, int z, const block3 &b, int rgrid) // looks up a w
int selchildcount = 0, selchildmat = -1;

ICOMMAND(havesel, "", (), intret(havesel ? selchildcount : 0));
ICOMMAND(selchildcount, "", (), { if(selchildcount < 0) result(tempformatstring("1/%d", -selchildcount)); else intret(selchildcount); });
ICOMMAND(selchildmat, "s", (char *prefix), { if(selchildmat > 0) result(getmaterialdesc(selchildmat, prefix)); });

void countselchild(cube *c, const ivec &cor, int size)
{
Expand Down
4 changes: 2 additions & 2 deletions src/engine/rendermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ void renderellipse(vec &o, float xradius, float yradius, float yaw)
gle::colorf(0.5f, 0.5f, 0.5f);
gle::defvertex();
gle::begin(GL_LINE_LOOP);
loopi(15)
loopi(16)
{
const vec2 &sc = sincos360[i*(360/15)];
const vec2 &sc = sincos360[(i*360+8)/16];
gle::attrib(vec(xradius*sc.x, yradius*sc.y, 0).rotate_around_z((yaw+90)*RAD).add(o));
}
xtraverts += gle::end();
Expand Down
74 changes: 37 additions & 37 deletions src/engine/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void modifyoctaentity(int flags, int id, extentity &e, cube *c, const ivec &cor,
oe.other.removeobj(id);
break;
}
if(oe.mapmodels.empty() && oe.other.empty())
if(oe.mapmodels.empty() && oe.other.empty())
freeoctaentities(c[i]);
}
if(c[i].ext && c[i].ext->ents) c[i].ext->ents->query = NULL;
Expand All @@ -152,7 +152,7 @@ static bool modifyoctaent(int flags, int id, extentity &e)
ivec o, r;
if(!getentboundingbox(e, o, r)) return false;

if(!insideworld(e.o))
if(!insideworld(e.o))
{
int idx = outsideents.find(id);
if(flags&MODOE_ADD)
Expand Down Expand Up @@ -224,7 +224,7 @@ static inline void findents(cube *c, const ivec &o, int size, const ivec &bo, co
loopoctabox(o, size, bo, br)
{
if(c[i].ext && c[i].ext->ents) findents(*c[i].ext->ents, low, high, notspawned, pos, invradius, found);
if(c[i].children && size > octaentsize)
if(c[i].children && size > octaentsize)
{
ivec co(i, o, size);
findents(c[i].children, co, size>>1, bo, br, low, high, notspawned, pos, invradius, found);
Expand Down Expand Up @@ -275,7 +275,7 @@ int entlooplevel = 0;
int efocus = -1, enthover = -1, entorient = -1, oldhover = -1;
bool undonext = true;

VARF(entediting, 0, 0, 1, { if(!entediting) { entcancel(); efocus = enthover = -1; } });
VARF(entediting, 0, 1, 1, { if(!entediting) { entcancel(); efocus = enthover = -1; } });

bool noentedit()
{
Expand Down Expand Up @@ -368,8 +368,8 @@ void attachentity(extentity &e)
if(a->attached) continue;
switch(e.type)
{
case ET_SPOTLIGHT:
if(a->type!=ET_LIGHT) continue;
case ET_SPOTLIGHT:
if(a->type!=ET_LIGHT) continue;
break;

default:
Expand Down Expand Up @@ -479,30 +479,30 @@ void entrotate(int *cw)
);
}

void entselectionbox(const entity &e, vec &eo, vec &es)
void entselectionbox(const entity &e, vec &eo, vec &es)
{
model *m = NULL;
const char *mname = entities::entmodel(e);
if(mname && (m = loadmodel(mname)))
{
{
m->collisionbox(eo, es);
if(es.x > es.y) es.y = es.x; else es.x = es.y; // square
es.z = (es.z + eo.z + 1 + entselradius)/2; // enclose ent radius box and model box
eo.x += e.o.x;
eo.y += e.o.y;
eo.z = e.o.z - entselradius + es.z;
}
}
else if(e.type == ET_MAPMODEL && (m = loadmapmodel(e.attr2)))
{
mmcollisionbox(e, m, eo, es);
es.max(entselradius);
eo.add(e.o);
}
}
else
{
es = vec(entselradius);
eo = e.o;
}
}
eo.sub(es);
es.mul(2);
}
Expand All @@ -527,19 +527,19 @@ void entdrag(const vec &ray)
int d = dimension(entorient),
dc= dimcoord(entorient);

entfocus(entgroup.last(),
entfocus(entgroup.last(),
entselectionbox(e, eo, es);

if(!editmoveplane(e.o, ray, d, eo[d] + (dc ? es[d] : 0), handle, v, entmoving==1))
return;
return;

ivec g(v);
int z = g[d]&(~(sel.grid-1));
g.add(sel.grid/2).mask(~(sel.grid-1));
g[d] = z;

r = (entselsnap ? g[R[d]] : v[R[d]]) - e.o[R[d]];
c = (entselsnap ? g[C[d]] : v[C[d]]) - e.o[C[d]];
c = (entselsnap ? g[C[d]] : v[C[d]]) - e.o[C[d]];
);

if(entmoving==1) makeundoent();
Expand All @@ -554,10 +554,10 @@ void renderentring(const extentity &e, float radius, int axis)
if(radius <= 0) return;
gle::defvertex();
gle::begin(GL_LINE_LOOP);
loopi(15)
loopi(16)
{
vec p(e.o);
const vec2 &sc = sincos360[i*(360/15)];
const vec2 &sc = sincos360[(i*360+8)/16];
p[axis>=2 ? 1 : 0] += radius*sc.x;
p[axis>=1 ? 2 : 1] += radius*sc.y;
gle::attrib(p);
Expand Down Expand Up @@ -644,7 +644,7 @@ void renderentradius(extentity &e, bool color)
vec dir = vec(e.o).sub(e.attached->o).normalize();
float angle = clamp(int(e.attr1), 1, 89);
renderentattachment(e);
renderentcone(*e.attached, dir, radius, angle);
renderentcone(*e.attached, dir, radius, angle);
}
break;

Expand Down Expand Up @@ -673,7 +673,7 @@ void renderentradius(extentity &e, bool color)
}

default:
if(e.type>=ET_GAMESPECIFIC)
if(e.type>=ET_GAMESPECIFIC)
{
if(color) gle::colorf(0, 1, 1);
entities::entradius(e, color);
Expand Down Expand Up @@ -706,7 +706,7 @@ static void renderentbox(const vec &eo, vec es)
}

void renderentselection(const vec &o, const vec &ray, bool entmoving)
{
{
if(noentedit()) return;
vec eo, es;

Expand All @@ -731,8 +731,8 @@ void renderentselection(const vec &o, const vec &ray, bool entmoving)
{
vec a, b;
gle::colorub(20, 20, 20);
(a = eo).x = eo.x - fmod(eo.x, worldsize); (b = es).x = a.x + worldsize; boxs3D(a, b, 1);
(a = eo).y = eo.y - fmod(eo.y, worldsize); (b = es).y = a.x + worldsize; boxs3D(a, b, 1);
(a = eo).x = eo.x - fmod(eo.x, worldsize); (b = es).x = a.x + worldsize; boxs3D(a, b, 1);
(a = eo).y = eo.y - fmod(eo.y, worldsize); (b = es).y = a.x + worldsize; boxs3D(a, b, 1);
(a = eo).z = eo.z - fmod(eo.z, worldsize); (b = es).z = a.x + worldsize; boxs3D(a, b, 1);
}
gle::colorub(150,0,0);
Expand Down Expand Up @@ -810,11 +810,11 @@ void entpush(int *dir)
if(noentedit()) return;
int d = dimension(entorient);
int s = dimcoord(entorient) ? -*dir : *dir;
if(entmoving)
if(entmoving)
{
groupeditpure(e.o[d] += float(s*sel.grid)); // editdrag supplies the undo
}
else
else
groupedit(e.o[d] += float(s*sel.grid));
if(entitysurf==1)
{
Expand All @@ -824,7 +824,7 @@ void entpush(int *dir)
}

VAR(entautoviewdist, 0, 25, 100);
void entautoview(int *dir)
void entautoview(int *dir)
{
if(!haveselent()) return;
static int s = 0;
Expand Down Expand Up @@ -996,7 +996,7 @@ void entcopy()
if(noentedit()) return;
entcopygrid = sel.grid;
entcopybuf.shrink(0);
loopv(entgroup)
loopv(entgroup)
entfocus(entgroup[i], entcopybuf.add(e).o.sub(vec(sel.o)));
}

Expand Down Expand Up @@ -1046,9 +1046,9 @@ void printent(extentity &e, char *buf, int len)
switch(e.type)
{
case ET_PARTICLES:
if(printparticles(e, buf, len)) return;
if(printparticles(e, buf, len)) return;
break;

default:
if(e.type >= ET_GAMESPECIFIC && entities::printent(e, buf, len)) return;
break;
Expand Down Expand Up @@ -1089,9 +1089,9 @@ void enttype(char *type, int *numargs)
{
if(*numargs >= 1)
{
int typeidx = findtype(type);
int typeidx = findtype(type);
if(typeidx != ET_EMPTY) groupedit(e.type = typeidx);
}
}
else entfocus(efocus,
{
result(entities::entname(e.type));
Expand All @@ -1112,7 +1112,7 @@ void entattr(int *attr, int *val, int *numargs)
case 3: e.attr4 = *val; break;
case 4: e.attr5 = *val; break;
}
);
);
}
else entfocus(efocus,
{
Expand All @@ -1134,7 +1134,7 @@ int findentity(int type, int index, int attr1, int attr2)
{
const vector<extentity *> &ents = entities::getents();
if(index > ents.length()) index = ents.length();
else for(int i = index; i<ents.length(); i++)
else for(int i = index; i<ents.length(); i++)
{
extentity &e = *ents[i];
if(e.type==type && (attr1<0 || e.attr1==attr1) && (attr2<0 || e.attr2==attr2))
Expand Down Expand Up @@ -1247,7 +1247,7 @@ void startmap(const char *name)

bool emptymap(int scale, bool force, const char *mname, bool usecfg) // main empty world creation routine
{
if(!force && !editmode)
if(!force && !editmode)
{
conoutf(CON_ERROR, "newmap only allowed in edit mode");
return false;
Expand All @@ -1257,7 +1257,7 @@ bool emptymap(int scale, bool force, const char *mname, bool usecfg) // main

setvar("mapscale", scale<10 ? 10 : (scale>16 ? 16 : scale), true, false);
setvar("mapsize", 1<<worldscale, true, false);

texmru.shrink(0);
freeocta(worldroot);
worldroot = newcubes(F_EMPTY);
Expand Down Expand Up @@ -1336,16 +1336,16 @@ void shrinkmap()
cube *root = worldroot[octant].children;
worldroot[octant].children = NULL;
freeocta(worldroot);
worldroot = root;
worldroot = root;
worldscale--;
worldsize /= 2;
worldsize /= 2;

ivec offset(octant, ivec(0, 0, 0), worldsize);
vector<extentity *> &ents = entities::getents();
loopv(ents) ents[i]->o.sub(vec(offset));

shrinkblendmap(octant);

allchanged();

conoutf("shrunk map to size %d", worldscale);
Expand Down
10 changes: 5 additions & 5 deletions src/fpsgame/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,10 @@ namespace game

bool isspectator(int cn)
{
fpsent *d = getclient(cn);
fpsent *d = cn<0 ? player1 : getclient(cn);
return d && d->state==CS_SPECTATOR;
}
ICOMMAND(isspectator, "i", (int *cn), intret(isspectator(*cn) ? 1 : 0));
ICOMMAND(isspectator, "b", (int *cn), intret(isspectator(*cn) ? 1 : 0));

bool isai(int cn, int type)
{
Expand Down Expand Up @@ -1004,12 +1004,12 @@ namespace game
}

VARP(teamcolorchat, 0, 1, 1);
const char *chatcolorname(fpsent *d) { return teamcolorchat ? teamcolorname(d, NULL) : colorname(d); }
const char *chatcolorname(fpsent *d) { return teamcolorchat && (d!=player1 || d->state!=CS_SPECTATOR) ? teamcolorname(d, NULL) : colorname(d); }

void toserver(char *text) { conoutf(CON_CHAT, "%s:\f0 %s", chatcolorname(player1), text); addmsg(N_TEXT, "rcs", player1, text); if(demorecord) recordmsg(N_TEXT, "rcs", player1, text); }
COMMANDN(say, toserver, "C");

void sayteam(char *text) { conoutf(CON_TEAMCHAT, "\fs\f8[team]\fr %s: \f8%s", chatcolorname(player1), text); addmsg(N_SAYTEAM, "rcs", player1, text); }
void sayteam(char *text) { conoutf(CON_TEAMCHAT, "\fs\f8[%s]\fr %s: \f8%s", player1->state==CS_SPECTATOR ? "spec" : "team", chatcolorname(player1), text); addmsg(N_SAYTEAM, "rcs", player1, text); }
COMMAND(sayteam, "C");

ICOMMAND(servcmd, "C", (char *cmd), addmsg(N_SERVCMD, "rs", cmd));
Expand Down Expand Up @@ -1447,7 +1447,7 @@ namespace game
if(!t || isignored(t->clientnum)) break;
if(t->state!=CS_DEAD && t->state!=CS_SPECTATOR)
particle_textcopy(t->abovehead(), text, PART_TEXT, 2000, COL_BLUE, 4.0f, -8);
conoutf(CON_TEAMCHAT + (t->state==CS_SPECTATOR ? CON_NONZEN : 0), "\fs\f8[team]\fr %s: \f8%s", chatcolorname(t), text);
conoutf(CON_TEAMCHAT + (t->state==CS_SPECTATOR ? CON_NONZEN : 0), "\fs\f8[%s]\fr %s: \f8%s", t->state==CS_SPECTATOR ? "spec" : "team", chatcolorname(t), text);
if(!hasfocus) loopv(chathighlightwords) if(strstr(text, chathighlightwords[i])) { playsoundname(chathighlightsound); break; }
break;
}
Expand Down
Loading

0 comments on commit 3dc3a44

Please sign in to comment.