mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed spectate clamping
This commit is contained in:
parent
b03d26b886
commit
00adf08412
|
@ -2323,7 +2323,14 @@ void render_game()
|
|||
int x, y;
|
||||
inp_mouse_relative(&x, &y);
|
||||
mouse_pos += vec2(x, y);
|
||||
if(!spectate)
|
||||
if(spectate)
|
||||
{
|
||||
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.x > col_width()*32-200.0f) mouse_pos.x = col_width()*32-200.0f;
|
||||
if(mouse_pos.y > col_height()*32-200.0f) mouse_pos.y = col_height()*32-200.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
float l = length(mouse_pos);
|
||||
if(l > 600.0f)
|
||||
|
|
|
@ -19,6 +19,16 @@ struct collision
|
|||
static collision col;
|
||||
static int global_dividor;
|
||||
|
||||
int col_width()
|
||||
{
|
||||
return col.w;
|
||||
}
|
||||
|
||||
int col_height()
|
||||
{
|
||||
return col.h;
|
||||
}
|
||||
|
||||
int col_init(int dividor)
|
||||
{
|
||||
mapres_collision *c = (mapres_collision*)map_find_item(MAPRES_COLLISIONMAP,0);
|
||||
|
|
|
@ -10,4 +10,6 @@ struct mapres_collision
|
|||
|
||||
int col_init(int dividor);
|
||||
int col_check_point(int x, int y);
|
||||
int col_width();
|
||||
int col_height();
|
||||
bool col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out);
|
||||
|
|
Loading…
Reference in a new issue