mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fixed the spectate, join team buttons
This commit is contained in:
parent
d4d1691fea
commit
65c7ab0a40
|
@ -40,7 +40,7 @@ enum
|
|||
};
|
||||
|
||||
static int chat_mode = CHATMODE_NONE;
|
||||
static bool menu_active = false;
|
||||
bool menu_active = false;
|
||||
static bool emoticon_selector_active = false;
|
||||
|
||||
static vec2 mouse_pos;
|
||||
|
@ -48,7 +48,7 @@ static vec2 local_character_pos;
|
|||
static vec2 local_target_pos;
|
||||
static const obj_player_character *local_character = 0;
|
||||
static const obj_player_character *local_prev_character = 0;
|
||||
static const obj_player_info *local_info = 0;
|
||||
const obj_player_info *local_info = 0;
|
||||
static const obj_game *gameobj = 0;
|
||||
|
||||
static struct client_data
|
||||
|
|
|
@ -27,6 +27,11 @@ extern "C" {
|
|||
|
||||
extern data_container *data;
|
||||
|
||||
// abit uglyness
|
||||
extern const obj_player_info *local_info;
|
||||
extern bool menu_active;
|
||||
|
||||
|
||||
//static vec4 gui_color(0.9f,0.78f,0.65f, 0.5f);
|
||||
//static vec4 gui_color(0.78f,0.9f,0.65f, 0.5f);
|
||||
static vec4 gui_color(0.65f,0.78f,0.9f, 0.5f);
|
||||
|
@ -1375,17 +1380,46 @@ static void menu2_render_game(RECT main_view)
|
|||
if(ui2_do_button(&disconnect_button, "Disconnect", 0, &button, ui2_draw_menu_button, 0))
|
||||
client_disconnect();
|
||||
|
||||
ui2_vsplit_l(&main_view, 120.0f, &button, &main_view);
|
||||
static int spectate_button = 0;
|
||||
if(ui2_do_button(&spectate_button, "Spectate", 0, &button, ui2_draw_menu_button, 0))
|
||||
;
|
||||
|
||||
ui2_vsplit_l(&main_view, 10.0f, &button, &main_view);
|
||||
ui2_vsplit_l(&main_view, 120.0f, &button, &main_view);
|
||||
static int change_team_button = 0;
|
||||
if(ui2_do_button(&change_team_button, "Change Team", 0, &button, ui2_draw_menu_button, 0))
|
||||
;
|
||||
|
||||
|
||||
if(local_info)
|
||||
{
|
||||
if(local_info->team != -1)
|
||||
{
|
||||
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, "Spectate", 0, &button, ui2_draw_menu_button, 0))
|
||||
{
|
||||
config.team = -1;
|
||||
menu_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
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 Red", 0, &button, ui2_draw_menu_button, 0))
|
||||
{
|
||||
config.team = 0;
|
||||
menu_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(local_info->team != 1)
|
||||
{
|
||||
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 Blue", 0, &button, ui2_draw_menu_button, 0))
|
||||
{
|
||||
config.team = 1;
|
||||
menu_active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int menu2_render()
|
||||
|
|
|
@ -1590,6 +1590,14 @@ void mods_message(int msg, int client_id)
|
|||
{
|
||||
// Switch team on given client and kill/respawn him
|
||||
players[client_id].set_team(msg_unpack_int());
|
||||
gameobj->on_player_info_change(&players[client_id]);
|
||||
|
||||
// send all info to this client
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(players[i].client_id != -1)
|
||||
send_info(i, -1);
|
||||
}
|
||||
}
|
||||
else if (msg == MSG_CHANGEINFO || msg == MSG_STARTINFO)
|
||||
{
|
||||
|
@ -1735,25 +1743,14 @@ void mods_init()
|
|||
|
||||
if(config.dbg_bots)
|
||||
{
|
||||
/*
|
||||
static int count = 0;
|
||||
if(count >= 0)
|
||||
|
||||
for(int i = 0; i < config.dbg_bots ; i++)
|
||||
{
|
||||
count++;
|
||||
if(count == 10)
|
||||
{*/
|
||||
for(int i = 0; i < config.dbg_bots ; i++)
|
||||
{
|
||||
mods_connected(MAX_CLIENTS-i-1);
|
||||
mods_client_enter(MAX_CLIENTS-i-1);
|
||||
//strcpy(players[MAX_CLIENTS-i-1].name, "(bot)");
|
||||
if(gameobj->gametype != GAMETYPE_DM)
|
||||
players[MAX_CLIENTS-i-1].team = i&1;
|
||||
}
|
||||
/*
|
||||
count = -1;
|
||||
}
|
||||
}*/
|
||||
mods_connected(MAX_CLIENTS-i-1);
|
||||
mods_client_enter(MAX_CLIENTS-i-1);
|
||||
if(gameobj->gametype != GAMETYPE_DM)
|
||||
players[MAX_CLIENTS-i-1].team = i&1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue