gui fixes, local player in scoreboard

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1544 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-01-03 11:29:49 +00:00
parent 0b1f05f2e6
commit af8ba0743c
3 changed files with 12 additions and 14 deletions
+8 -11
View File
@@ -156,10 +156,6 @@ struct mitemtextinput : mitemtext
s_strcpy(input.buf, value);
};
virtual ~mitemtextinput() { }
virtual void select() { } // fixme
virtual int width() { return text_width(input.buf) + text_width(text); }
virtual void render(int x, int y, int w)
@@ -242,7 +238,7 @@ struct mitemslider : mitem
blendbox(x+w-sliderwidth, y+FONTH/3, x+w, y+FONTH*2/3, false, -1, &gray);
int offset = cval/(float)range*sliderwidth;
int offset = (int)(cval/((float)range)*sliderwidth);
blendbox(x+w-sliderwidth+offset-FONTH/6, y, x+w-sliderwidth+offset+FONTH/6, y+FONTH, false, -1, sel ? &whitepulse : &white);
}
@@ -263,9 +259,9 @@ struct mitemslider : mitem
void slide(bool right)
{
displaycurvalue();
value += right ? step : -step;
value = min(max_, max(min_, value));
displaycurvalue();
if(action)
{
string v;
@@ -312,8 +308,12 @@ struct mitemkeyinput : mitem
static const char *unknown, *empty;
bool capture;
mitemkeyinput(gmenu *parent, char *text, char *bindcmd, color *bgcolor) : mitem(parent, bgcolor), text(text), bindcmd(bindcmd), keyname(NULL), capture(false)
mitemkeyinput(gmenu *parent, char *text, char *bindcmd, color *bgcolor) : mitem(parent, bgcolor), text(text), bindcmd(bindcmd), keyname(NULL), capture(false){};
~mitemkeyinput()
{
DELETEA(text);
DELETEA(bindcmd);
}
virtual int width() { return text_width(text)+(keyname ? text_width(keyname) : char_width('_')); }
@@ -365,9 +365,7 @@ struct mitemcheckbox : mitem
char *text, *valueexp, *action;
bool checked;
mitemcheckbox(gmenu *parent, char *text, char *value, char *action, color *bgcolor) : mitem(parent, bgcolor), text(text), valueexp(value), action(action), checked(false)
{
}
mitemcheckbox(gmenu *parent, char *text, char *value, char *action, color *bgcolor) : mitem(parent, bgcolor), text(text), valueexp(value), action(action), checked(false) {};
~mitemcheckbox()
{
@@ -397,7 +395,6 @@ struct mitemcheckbox : mitem
{
bool sel = isselection();
const static int boxsize = FONTH;
static color gray(0.2f, 0.2f, 0.2f);
draw_text(text, x, y);
if(isselection()) renderbg(x+w-boxsize, y, boxsize, NULL);
blendbox(x+w-boxsize, y, x+w, y+boxsize, false, -1, &gray);
+2 -1
View File
@@ -551,12 +551,13 @@ bool addscorchmark(vec &o, float radius)
return true;
}
VARP(shotlines, 0, 1, 1);
VARP(shotlinettl, 0, 0, 10000);
VARP(bulletairsound, 0, 1, 1);
void addshotline(dynent *pl, vec &from, vec &to)
{
if(pl == player1) return;
if(pl == player1 || !shotlines) return;
bool fx = shotlinettl > 0 && (player1->isspectating() || !multiplayer(false)); // allow fx only in spect mode and locally
if(rnd(3) && !fx) return; // show all shotlines when fx enabled
+2 -2
View File
@@ -62,13 +62,13 @@ static int scorecmp(const playerent **x, const playerent **y)
void renderscore(void *menu, playerent *d)
{
const char *status = "";
static color localplayerc(0.2f, 0.2f, 0.2f, 0.2f);
if(d->clientrole==CR_MASTER) status = "\f0";
else if(d->clientrole==CR_ADMIN) status = "\f3";
else if(d==player1) status = "\f1";
else if(d->state==CS_DEAD) status = "\f4";
s_sprintfd(lag)("%d", d->plag);
sline &line = scorelines.add();
line.bgcolor = NULL;
line.bgcolor = d==player1 ? &localplayerc : NULL;
string &s = line.s;
if(m_ctf) s_sprintf(s)("%d\t%d\t%d\t%s\t%s\t%d\t%s%s", d->flagscore, d->frags, d->deaths(), d->state==CS_LAGGED ? "LAG" : lag, colorping(d->ping), d->clientnum, status, colorname(d));
else if(m_teammode) s_sprintf(s)("%d\t%d\t%s\t%s\t%d\t%s%s", d->frags, d->deaths(), d->state==CS_LAGGED ? "LAG" : lag, colorping(d->ping), d->clientnum, status, colorname(d));