diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-16 20:31:33 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-16 20:31:33 +0000 |
| commit | 00adf08412cc08733bb289babdc62a1ea95d42d0 (patch) | |
| tree | 0cd538e0f6b5d518f93a49b575ae4b3085389bec /src/game | |
| parent | b03d26b8866e04567f21cee3fcd37a9ca673ea3b (diff) | |
| download | zcatch-00adf08412cc08733bb289babdc62a1ea95d42d0.tar.gz zcatch-00adf08412cc08733bb289babdc62a1ea95d42d0.zip | |
fixed spectate clamping
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/gc_client.cpp | 9 | ||||
| -rw-r--r-- | src/game/g_mapres_col.cpp | 10 | ||||
| -rw-r--r-- | src/game/g_mapres_col.h | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 03b3a24c..4e0219ff 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -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) diff --git a/src/game/g_mapres_col.cpp b/src/game/g_mapres_col.cpp index 4b391204..64a240bf 100644 --- a/src/game/g_mapres_col.cpp +++ b/src/game/g_mapres_col.cpp @@ -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); diff --git a/src/game/g_mapres_col.h b/src/game/g_mapres_col.h index 5d4427ab..a2aeaee5 100644 --- a/src/game/g_mapres_col.h +++ b/src/game/g_mapres_col.h @@ -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); |