ddnet/src/game/game.h

61 lines
1.1 KiB
C
Raw Normal View History

#include <engine/system.h>
#include <game/math.h>
2007-05-22 15:03:32 +00:00
#include <math.h>
#include "../engine/interface.h"
2007-05-22 15:03:32 +00:00
#include "mapres_col.h"
2007-08-22 21:13:33 +00:00
#include "game_protocol.h"
inline vec2 get_direction(int angle)
2007-05-22 15:03:32 +00:00
{
float a = angle/256.0f;
return vec2(cosf(a), sinf(a));
2007-05-22 15:03:32 +00:00
}
inline float get_angle(vec2 dir)
2007-05-22 15:03:32 +00:00
{
float a = atan(dir.y/dir.x);
if(dir.x < 0)
a = a+pi;
2007-05-22 15:03:32 +00:00
return a;
}
2007-07-21 19:03:50 +00:00
#define LERP(a,b,t) (a + (b-a) * t)
#define min(a, b) ( a > b ? b : a)
#define max(a, b) ( a > b ? a : b)
2007-07-13 21:22:45 +00:00
inline bool col_check_point(float x, float y) { return col_check_point((int)x, (int)y) != 0; }
inline bool col_check_point(vec2 p) { return col_check_point(p.x, p.y); }
2007-05-22 15:03:32 +00:00
struct mapres_spawnpoint
{
int x, y;
int type;
};
struct mapres_item
{
int x, y;
int type;
};
enum
{
MAPRES_SPAWNPOINT=1,
MAPRES_ITEM=2,
MAPRES_SPAWNPOINT_RED=2,
MAPRES_SPAWNPOINT_BLUE=3,
MAPRES_FLAGSTAND_RED=4,
MAPRES_FLAGSTAND_BLUE=5,
2007-05-22 15:03:32 +00:00
ITEM_NULL=0,
ITEM_WEAPON_GUN=0x00010001,
ITEM_WEAPON_SHOTGUN=0x00010002,
ITEM_WEAPON_ROCKET=0x00010003,
ITEM_WEAPON_SNIPER=0x00010004,
ITEM_WEAPON_HAMMER=0x00010005,
2007-07-15 13:25:10 +00:00
ITEM_HEALTH =0x00020001,
ITEM_ARMOR=0x00030001,
2007-05-22 15:03:32 +00:00
ITEM_NINJA=0x00040001,
};