diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 9579aacd..b87aebd4 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -18,6 +18,7 @@ COMMAND(mode, ARG_1INT); bool intermission = false; bool autoteambalance = false; +int arenaintermission = 0; playerent *player1 = newplayerent(); // our client vector 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 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; } diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 350f1405..33de92d9 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -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; } diff --git a/source/src/cube.h b/source/src/cube.h index b0f21110..81a53acc 100644 --- a/source/src/cube.h +++ b/source/src/cube.h @@ -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 mapinfo; extern int hwtexsize; diff --git a/source/src/protos.h b/source/src/protos.h index a7e6e74a..ad5f1149 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -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); diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 9ba54ac8..3588c5e6 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -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