compatibility things and medal score basis (thanks to Kirin for the work)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5302 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-07-07 21:09:21 +00:00
parent 7c89ff41c9
commit b9c8230114
3 changed files with 46 additions and 8 deletions
+34 -1
View File
@@ -527,6 +527,39 @@ void damageblend(int n)
damageblendmillis += n*damagescreenfactor;
}
VAR(interms,0,0,1);
void drawmedals(float x, float y, int col, int row, Texture *tex)
{
if(tex)
{
glPushAttrib(GL_COLOR_BUFFER_BIT);
glDisable(GL_BLEND);
drawicon(tex, x, y, 120, col, row, 1/4.0f);
glPopAttrib();
}
}
void drawscores()
{
glPushAttrib(GL_COLOR_BUFFER_BIT);
static Texture *tex = NULL;
if(!tex) tex = textureload("packages/misc/nice_medals.png", 4);
static float time=0;
if(!interms && time != 0.0f) time=0.0f;
if(!interms /*&& !multiplayer(false)*/) return;
time+=((float)(curtime))/1000;
float vw=VIRTW*7/4,vh=VIRTH*7/4;
glLoadIdentity();
glOrtho(0, vw, vh, 0, -1, 1);
int left = vw/4, top = vh/4;
blendbox(left, top, left*3, top*3, true, -1);
top+=10;left+=10;const float txtdx=160,txtdy=30,medalsdy=130;
glColor4f(1,1,1,1);
if(time > 0.3) {drawmedals(left, top, 0, 0, tex); draw_textf("TEST WRITING!!", left+txtdx, top+txtdy); top+=medalsdy;}
if(time > 0.6) {drawmedals(left, top, 0, 1, tex); draw_textf("TEST WRITING!!", left+txtdx, top+txtdy); top+=medalsdy;}
if(time > 0.9) {drawmedals(left, top, 0, 2, tex); draw_textf("TEST WRITING!!", left+txtdx, top+txtdy); top+=medalsdy;}
glPopAttrib();
}
void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater)
{
playerent *p = camera1->type<ENT_CAMERA ? (playerent *)camera1 : player1;
@@ -723,7 +756,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
const int left = (VIRTW*3/2)*4/8, top = (VIRTH*3/2)*3/4;
draw_textf("!TEST BUILD!", left, top);
*/
drawscores();
if(!hidespecthud && spectating && player1->spectatemode!=SM_DEATHCAM)
{
glLoadIdentity();
+9 -6
View File
@@ -124,7 +124,7 @@ struct clientstate : playerstate
projectilestate<8> grenades;
int akimbomillis;
bool scoped;
int flagscore, frags, teamkills, deaths, shotdamage, damage, points;
int flagscore, frags, teamkills, deaths, shotdamage, damage, points, events;
clientstate() : state(CS_DEAD) {}
@@ -147,7 +147,7 @@ struct clientstate : playerstate
grenades.reset();
akimbomillis = 0;
scoped = forced = false;
flagscore = frags = teamkills = deaths = shotdamage = damage = points = 0;
flagscore = frags = teamkills = deaths = shotdamage = damage = points = events = 0;
respawn();
}
@@ -168,7 +168,7 @@ struct savedscore
{
string name;
uint ip;
int frags, flagscore, deaths, teamkills, shotdamage, damage, team, points;
int frags, flagscore, deaths, teamkills, shotdamage, damage, team, points, events;
bool valid, forced;
void save(clientstate &cs, int t)
@@ -181,6 +181,7 @@ struct savedscore
damage = cs.damage;
points = cs.points;
forced = cs.forced;
events = cs.events;
team = t;
valid = true;
}
@@ -195,6 +196,7 @@ struct savedscore
cs.damage = damage;
cs.points = points;
cs.forced = forced;
cs.events = events;
}
};
@@ -202,14 +204,14 @@ struct medals
{
int dpt, lasthit, lastgun, ncovers, nhs;
int combohits, combo, combofrags, combotime, combodamage, ncombos;
int ask, askmillis, linked, linkmillis, linkreason, upmillis;
int ask, askmillis, linked, linkmillis, linkreason, upmillis, flagmillis;
bool updated, combosend;
vec pos, flagpos;
void reset()
{
dpt = lasthit = lastgun = ncovers = nhs = 0;
combohits = combo = combofrags = combotime = combodamage = ncombos = 0;
askmillis = linkmillis = upmillis = 0;
askmillis = linkmillis = upmillis = flagmillis = 0;
linkreason = linked = ask = -1;
updated = combosend = false;
pos = flagpos = vec(-1e10f, -1e10f, -1e10f);
@@ -258,7 +260,7 @@ struct client // server side version of "dynent" type
vec spawnp;
int nvotes;
int input, inputmillis;
int ffire;
int ffire, wn;
gameevent &addevent()
{
@@ -312,6 +314,7 @@ struct client // server side version of "dynent" type
freshgame = false; // don't spawn into running games
mute = spam = lastvc = badspeech = badmillis = nvotes = 0;
input = inputmillis = 0;
wn = -1;
}
void zap()
+3 -1
View File
@@ -1,3 +1,4 @@
// #include "anticheat.h"
inline float pow2(float x)
{
@@ -128,6 +129,7 @@ void flagpoints (client *c, int message)
case FM_PICKUP:
c->md.flagpos.x = c->state.o.x;
c->md.flagpos.y = c->state.o.y;
c->md.flagmillis = servmillis;
if (m_ctf) addpt(c, CTFPICKPT);
break;
case FM_DROP:
@@ -148,7 +150,7 @@ void flagpoints (client *c, int message)
if (m_ctf) {
distance = sqrt(POW2XY(c->state.o,c->md.flagpos));
if (distance > 200) distance = 200;
addpt(c, CTFSCOREPT);
/*if ( validflagscore(distance,c) )*/ addpt(c, CTFSCOREPT);
} else addpt(c, HTFSCOREPT);
break;
case FM_KTFSCORE: