fixed spectate clamping

This commit is contained in:
Magnus Auvinen 2007-12-16 20:31:33 +00:00
parent b03d26b886
commit 00adf08412
3 changed files with 20 additions and 1 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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);