From 03a994ee9bfd93f9532195edf7efc1ef18b6a408 Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Mon, 5 Jul 2010 19:26:08 +0000 Subject: [PATCH] whois check for admin role (some redundancy now), commenting the interesting but unused lss code (to avoid a annoying warning about '>' bool comparison), and transparency for vote icons (again, thanks for Kirin for the help) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5290 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clients2c.cpp | 2 +- source/src/renderhud.cpp | 23 +++++++++++++---------- source/src/server.cpp | 8 ++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 38fad4a9..3389e5ba 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -1104,7 +1104,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) int cn = getint(p); playerent *pl = cn == getclientnum() ? player1 : getclient(cn); int ip = getint(p); - if((ip>>24&0xFF) > 0) conoutf("WHOIS %2d: %-16s\t%d.%d.%d.%d", cn, pl ? colorname(pl) : "", ip&0xFF, ip>>8&0xFF, ip>>16&0xFF, ip>>24&0xFF); // full IP + if((ip>>24&0xFF) > 0 || player1->clientrole==CR_ADMIN) conoutf("WHOIS %2d: %-16s\t%d.%d.%d.%d", cn, pl ? colorname(pl) : "", ip&0xFF, ip>>8&0xFF, ip>>16&0xFF, ip>>24&0xFF); // full IP else conoutf("WHOIS client %d:\n\f5name\t%s\n\f5IP\t%d.%d.%d.x", cn, pl ? colorname(pl) : "", ip&0xFF, ip>>8&0xFF, ip>>16&0xFF); // censored IP break; } diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 1d28e556..1eb5f237 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -7,7 +7,13 @@ void drawicon(Texture *tex, float x, float y, float s, int col, int row, float t if(tex && tex->xs == tex->ys) quad(tex->id, x, y, s, ts*col, ts*row, ts); } -VARP(equiptransparency, 0, 1, 1); // ft: 2010jun12 : seems it's not needed - the opaque/orig items.png works with it on or off - delete if no graphics guy has any objection +VARP(transparency, 0, 1, 1); // ft: 2010jun12 : seems it's not needed - the opaque/orig items.png works with it on or off - delete if no graphics guy has any objection + +inline void turn_on_transparency() +{ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4ub(255, 255, 255, 255); +} void drawequipicon(float x, float y, int col, int row, float blend) { @@ -15,14 +21,10 @@ void drawequipicon(float x, float y, int col, int row, float blend) if(!tex) tex = textureload("packages/misc/items.png", 4); if(tex) { - if(blend||equiptransparency) glEnable(GL_BLEND); - if(equiptransparency) - { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4ub(255, 255, 255, 255); - } + if(blend||transparency) glEnable(GL_BLEND); + if(transparency) turn_on_transparency(); drawicon(tex, x, y, 120, col, row, 1/4.0f); - if(blend||equiptransparency) glDisable(GL_BLEND); + if(blend||transparency) glDisable(GL_BLEND); } } @@ -64,9 +66,10 @@ void drawvoteicon(float x, float y, int col, int row, bool noblend) if(!tex) tex = textureload("packages/misc/voteicons.png", 3); if(tex) { - if(noblend) glDisable(GL_BLEND); + if(noblend||transparency) glDisable(GL_BLEND); + if(transparency) turn_on_transparency(); drawicon(tex, x, y, 240, col, row, 1/2.0f); - if(noblend) glEnable(GL_BLEND); + if(noblend||transparency) glEnable(GL_BLEND); } } diff --git a/source/src/server.cpp b/source/src/server.cpp index 859e7927..42bd0056 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1106,9 +1106,9 @@ void arenacheck() } //#define LMS_CLEARATROUNDSTART -#define LMS_ITEMMAXAGE 2 +//#define LMS_ITEMMAXAGE 2 -void lmscheck() // spawn random item class once per round +/*void lmscheck() // spawn random item class once per round { const int types[] = { I_CLIPS, I_AMMO, I_GRENADE, I_GRENADE, I_HEALTH, I_HELMET, I_ARMOUR, I_AKIMBO }, types_n = sizeof(types) / sizeof(types[0]); // double probability for grenades ;) static bool cleared = false, announced = false, spawned = false; @@ -1177,7 +1177,7 @@ void lmscheck() // spawn random item class once per round } spawned = true; } -} +}*/ #define SPAMREPEATINTERVAL 20 // detect doubled lines only if interval < 20 seconds #define SPAMMAXREPEAT 3 // 4th time is SPAM @@ -1305,7 +1305,7 @@ bool serverpickup(int i, int sender) // server side item pickup, acknowl client *cl = clients[sender]; if(cl->type==ST_TCPIP) { - if(cl->state.state!=CS_ALIVE || !cl->state.canpickup(e.type) || ( m_arena && !free_items(sender) ) ) return false; + if( cl->state.state!=CS_ALIVE || !cl->state.canpickup(e.type) || ( m_arena && !free_items(sender) ) ) return false; vec v(e.x, e.y, cl->state.o.z); float dist = cl->state.o.dist(v); if(dist > 10 && !m_demo) // <2.5 would be normal, LAG may increase the value