diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/gc_client.cpp | 43 | ||||
| -rw-r--r-- | src/game/client/gc_menu.cpp | 16 | ||||
| -rw-r--r-- | src/game/server/gs_server.cpp | 1 |
3 files changed, 55 insertions, 5 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 4e0219ff..a641dcfa 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -1882,7 +1882,42 @@ void render_goals(float x, float y, float w) sprintf(buf, "Score Limit: %d", gameobj->score_limit); gfx_pretty_text(x+40, y, 32, buf, -1); } +} + +void render_spectators(float x, float y, float w) +{ + char buffer[1024*4]; + int count = 0; + float h = 120.0f; + + strcpy(buffer, "Spectators: "); + gfx_blend_normal(); + gfx_texture_set(-1); + gfx_quads_begin(); + gfx_setcolor(0,0,0,0.5f); + draw_round_rect(x-10.f, y-10.f, w, h, 10.0f); + gfx_quads_end(); + + for(int i = 0; i < snap_num_items(SNAP_CURRENT); i++) + { + SNAP_ITEM item; + const void *data = snap_get_item(SNAP_CURRENT, i, &item); + + if(item.type == OBJTYPE_PLAYER_INFO) + { + const obj_player_info *info = (const obj_player_info *)data; + if(info->team == -1) + { + if(count) + strcat(buffer, ", "); + strcat(buffer, client_datas[info->clientid].name); + count++; + } + } + } + + gfx_pretty_text(x+10, y, 32, buffer, (int)w-20); } void render_scoreboard(float x, float y, float w, int team, const char *title) @@ -1987,7 +2022,7 @@ void render_scoreboard(float x, float y, float w, int team, const char *title) const obj_player_info *info = players[i]; // make sure that we render the correct team - if(team != -1 && info->team != team) + if(team == -1 || info->team != team) continue; char buf[128]; @@ -2910,11 +2945,11 @@ void render_game() { gfx_mapscreen(0, 0, width, height); - float w = 550.0f; + float w = 650.0f; if (gameobj && gameobj->gametype == GAMETYPE_DM) { - render_scoreboard(width/2-w/2, 150.0f, w, -1, 0); + render_scoreboard(width/2-w/2, 150.0f, w, 0, 0); //render_scoreboard(gameobj, 0, 0, -1, 0); } else @@ -2937,7 +2972,7 @@ void render_game() } render_goals(width/2-w/2, 150+600+25, w); - + render_spectators(width/2-w/2, 150+600+25+50+25, w); } } diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp index e25342dd..915b40c7 100644 --- a/src/game/client/gc_menu.cpp +++ b/src/game/client/gc_menu.cpp @@ -1638,7 +1638,21 @@ static void menu2_render_game(RECT main_view) } } - if(gameobj->gametype != GAMETYPE_DM) + if(gameobj->gametype == GAMETYPE_DM) + { + if(local_info->team != 0) + { + ui2_vsplit_l(&main_view, 10.0f, &button, &main_view); + ui2_vsplit_l(&main_view, 120.0f, &button, &main_view); + static int spectate_button = 0; + if(ui2_do_button(&spectate_button, "Join Game", 0, &button, ui2_draw_menu_button, 0)) + { + config.cl_team = 0; + menu_active = false; + } + } + } + else { if(local_info->team != 0) { diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp index cd1803f7..24c36eb6 100644 --- a/src/game/server/gs_server.cpp +++ b/src/game/server/gs_server.cpp @@ -1958,6 +1958,7 @@ void mods_init() mods_client_enter(MAX_CLIENTS-i-1); if(gameobj->gametype != GAMETYPE_DM) players[MAX_CLIENTS-i-1].team = i&1; + players[MAX_CLIENTS-i-1].team = -1; } } } |