mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
fixed spectator mode freeview
This commit is contained in:
parent
3b086d616a
commit
51a9d23dae
|
@ -20,9 +20,7 @@ void CAMERA::on_render()
|
||||||
//vec2 center;
|
//vec2 center;
|
||||||
zoom = 1.0f;
|
zoom = 1.0f;
|
||||||
|
|
||||||
bool spectate = false;
|
if(gameclient.snap.spectate)
|
||||||
|
|
||||||
if(spectate)
|
|
||||||
center = gameclient.controls->mouse_pos;
|
center = gameclient.controls->mouse_pos;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,8 +157,6 @@ bool CONTROLS::on_mousemove(float x, float y)
|
||||||
{
|
{
|
||||||
mouse_pos += vec2(x, y); // TODO: ugly
|
mouse_pos += vec2(x, y); // TODO: ugly
|
||||||
|
|
||||||
bool spectate = false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
float camera_max_distance = 200.0f;
|
float camera_max_distance = 200.0f;
|
||||||
float follow_factor = config.cl_mouse_followfactor/100.0f;
|
float follow_factor = config.cl_mouse_followfactor/100.0f;
|
||||||
|
@ -167,7 +165,7 @@ bool CONTROLS::on_mousemove(float x, float y)
|
||||||
|
|
||||||
//vec2 camera_offset(0, 0);
|
//vec2 camera_offset(0, 0);
|
||||||
|
|
||||||
if(spectate)
|
if(gameclient.snap.spectate)
|
||||||
{
|
{
|
||||||
if(mouse_pos.x < 200.0f) mouse_pos.x = 200.0f;
|
if(mouse_pos.x < 200.0f) mouse_pos.x = 200.0f;
|
||||||
if(mouse_pos.y < 200.0f) mouse_pos.y = 200.0f;
|
if(mouse_pos.y < 200.0f) mouse_pos.y = 200.0f;
|
||||||
|
|
|
@ -544,6 +544,9 @@ void GAMECLIENT::on_snapshot()
|
||||||
if(p)
|
if(p)
|
||||||
gameclient.snap.local_prev_character = (NETOBJ_CHARACTER *)p;
|
gameclient.snap.local_prev_character = (NETOBJ_CHARACTER *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->team == -1)
|
||||||
|
gameclient.snap.spectate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate team-balance
|
// calculate team-balance
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
const NETOBJ_PLAYER_INFO *info_by_score[MAX_CLIENTS];
|
const NETOBJ_PLAYER_INFO *info_by_score[MAX_CLIENTS];
|
||||||
int num_players;
|
int num_players;
|
||||||
int team_size[2];
|
int team_size[2];
|
||||||
|
bool spectate;
|
||||||
};
|
};
|
||||||
|
|
||||||
SNAPSTATE snap;
|
SNAPSTATE snap;
|
||||||
|
|
|
@ -98,6 +98,9 @@ void PLAYER::on_direct_input(NETOBJ_PLAYER_INPUT *new_input)
|
||||||
spawning = true;
|
spawning = true;
|
||||||
dbg_msg("", "I wanna spawn");
|
dbg_msg("", "I wanna spawn");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!chr && team == -1)
|
||||||
|
view_pos = vec2(new_input->target_x, new_input->target_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHARACTER *PLAYER::get_character()
|
CHARACTER *PLAYER::get_character()
|
||||||
|
|
Loading…
Reference in a new issue