about summary refs log tree commit diff
path: root/src/game/mapres_col.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-15 10:24:49 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-15 10:24:49 +0000
commita2566b3ebd93e0bbc55a920a7be08054a9377f11 (patch)
tree44a4612805d894168fe4b3b4c065fccc1a1686e9 /src/game/mapres_col.cpp
parentac9873056aa1fe529b098f19ff31e9ffa0e016a2 (diff)
downloadzcatch-a2566b3ebd93e0bbc55a920a7be08054a9377f11.tar.gz
zcatch-a2566b3ebd93e0bbc55a920a7be08054a9377f11.zip
cleaned up code structure a bit
Diffstat (limited to 'src/game/mapres_col.cpp')
-rw-r--r--src/game/mapres_col.cpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/game/mapres_col.cpp b/src/game/mapres_col.cpp
deleted file mode 100644
index 046272ca..00000000
--- a/src/game/mapres_col.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
-#include <engine/system.h>
-#include <game/vmath.h>
-#include <game/math.h>
-#include <math.h>
-#include "../engine/interface.h"
-#include "mapres_col.h"
-#include "mapres.h"
-
-/*
-	Simple collision rutines!
-*/
-struct collision
-{
-	int w, h;
-	unsigned char *data;
-};
-
-static collision col;
-static int global_dividor;
-
-int col_init(int dividor)
-{
-	mapres_collision *c = (mapres_collision*)map_find_item(MAPRES_COLLISIONMAP,0);
-	if(!c)
-	{
-		dbg_msg("mapres_col", "failed!");
-		return 0;
-	}
-	col.w = c->width;
-	col.h = c->height;
-	global_dividor = dividor;
-	col.data = (unsigned char *)map_get_data(c->data_index);
-	return col.data ? 1 : 0;
-}
-
-int col_check_point(int x, int y)
-{
-	int nx = x/global_dividor;
-	int ny = y/global_dividor;
-	if(nx < 0 || nx >= col.w || ny >= col.h)
-		return 1;
-	
-	if(y < 0)
-		return 0; // up == sky == free
-	
-	return col.data[ny*col.w+nx];
-}
-
-// TODO: rewrite this smarter!
-bool col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out)
-{
-	float d = distance(pos0, pos1);
-	
-	for(float f = 0; f < d; f++)
-	{
-		float a = f/d;
-		vec2 pos = mix(pos0, pos1, a);
-		if(col_check_point((int)pos.x, (int)pos.y))
-		{
-			if(out)
-				*out = pos;
-			return true;
-		}
-	}
-	if(out)
-		*out = pos1;
-	return false;
-}