arena intermission hud countdown

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2588 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-09-14 18:13:56 +00:00
parent 0df7b6f666
commit c825ed3e29
5 changed files with 60 additions and 10 deletions
+33 -2
View File
@@ -18,6 +18,7 @@ COMMAND(mode, ARG_1INT);
bool intermission = false;
bool autoteambalance = false;
int arenaintermission = 0;
playerent *player1 = newplayerent(); // our client
vector<playerent *> players; // other clients
@@ -275,6 +276,35 @@ void moveotherplayers()
}
}
void checkarenaintermission()
{
static int lastcnt = -1;
static string s, t;
if(!m_arena || intermission) arenaintermission = 0;
if(!arenaintermission) return;
int cnt = (lastmillis - arenaintermission) / 200;
if(cnt != lastcnt)
{
switch(cnt)
{
case 0:
s_strcpy(s, "5");
hudonlyf(s);
break;
case 25:
hudeditf("fight!");
break;
default:
if(cnt % 5) strcpy(t, ".");
else s_sprintf(t)("%d", 5 - cnt / 5);
s_strcat(s, t);
hudeditf(s);
break;
}
lastcnt = cnt;
}
}
struct scriptsleep { int wait; char *cmd; };
vector<scriptsleep> sleeps;
@@ -315,6 +345,7 @@ void updateworld(int curtime, int lastmillis) // main game update loop
movebounceents();
moveotherplayers();
gets2c();
checkarenaintermission();
// Added by Rick: let bots think
if(m_botmode) BotManager.Think();
@@ -429,13 +460,13 @@ bool tryrespawn()
{
player1->attacking = false;
player1->lastteamchange = 0;
if(m_arena) { hudoutf2("waiting for new round to start..."); return false; }
if(m_arena) { /* hudonlyf("waiting for new round to start..."); */return false; }
respawnself();
player1->weaponswitch(player1->primweap);
player1->lastaction -= weapon::weaponchangetime/2;
return true;
}
else hudoutf2("wait %3.1f seconds to respawn", (respawnmillis-lastmillis)/(float)1000);
else hudonlyf("wait %3.1f seconds to respawn", (respawnmillis-lastmillis)/(float)1000);
}
return false;
}
+7 -5
View File
@@ -324,6 +324,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
player1->state = CS_ALIVE;
findplayerstart(player1, false, arenaspawn);
if(player1->skin!=player1->nextskin) setskin(player1, player1->nextskin);
arenaintermission = 0;
if(m_arena)
{
conoutf("new round starting... fight!");
@@ -585,11 +586,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
int acn = getint(p);
playerent *alive = acn<0 ? NULL : (acn==getclientnum() ? player1 : getclient(acn));
conoutf("arena round is over! next round in 5 seconds...");
if(m_botmode && acn==-2) conoutf("the bots have won the round!");
else if(!alive) conoutf("everyone died!");
else if(m_teammode) conoutf("team %s has won the round!", alive->team);
else if(alive==player1) conoutf("you are the survivor!");
else conoutf("%s is the survivor!", colorname(alive));
if(m_botmode && acn==-2) hudoutf("the bots have won the round!");
else if(!alive) hudoutf("everyone died!");
else if(m_teammode) hudoutf("team %s has won the round!", alive->team);
else if(alive==player1) hudoutf("you are the survivor!");
else hudoutf("%s is the survivor!", colorname(alive));
arenaintermission = lastmillis;
break;
}
+1
View File
@@ -43,6 +43,7 @@ extern int farplane;
extern bool minimap, reflecting, refracting;
extern int stenciling, stencilshadow;
extern bool intermission;
extern int arenaintermission;
extern int maxclients;
extern hashtable<char *, enet_uint32> mapinfo;
extern int hwtexsize;
+2 -1
View File
@@ -459,7 +459,8 @@ extern void pruneundos(int maxremain = 0);
extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater);
extern void loadingscreen(const char *fmt = NULL, ...);
extern void hudoutf(const char *s, ...);
extern void hudoutf2(const char *s, ...);
extern void hudonlyf(const char *s, ...);
extern void hudeditf(const char *s, ...);
extern void show_out_of_renderloop_progress(float bar1, const char *text1, float bar2 = 0, const char *text2 = NULL);
extern void updatedmgindicator(vec &attack);
+17 -2
View File
@@ -262,12 +262,18 @@ void drawradarent(float x, float y, float yaw, int col, int row, float iconsize,
struct hudmessages : consolebuffer
{
void addline(const char *sf) { consolebuffer::addline(sf, false, lastmillis); }
void editlastline(const char *sf)
{
if(!conlines.length()) return;
conlines[0].millis = lastmillis;
s_strcpy(conlines[0].cref, sf);
}
void render()
{
if(!conlines.length()) return;
glLoadIdentity();
glOrtho(0, VIRTW*0.8f, VIRTH*0.8f, 0, -1, 1);
int dispmillis = 3000;
int dispmillis = arenaintermission ? 6000 : 3000;
loopi(min(conlines.length(), 3)) if(lastmillis-conlines[i].millis<dispmillis)
{
cline &c = conlines[i];
@@ -289,7 +295,7 @@ void hudoutf(const char *s, ...)
conoutf(s);
}
void hudoutf2(const char *s, ...)
void hudonlyf(const char *s, ...)
{
s_sprintfdv(sf, s);
string sp;
@@ -298,6 +304,15 @@ void hudoutf2(const char *s, ...)
hudmsgs.addline(s);
}
void hudeditf(const char *s, ...)
{
s_sprintfdv(sf, s);
string sp;
filtertext(sp, sf);
s = sf;
hudmsgs.editlastline(s);
}
bool insideradar(const vec &centerpos, float radius, const vec &o)
{
if(showmap) return !o.reject(centerpos, radius);