AI_Global.h
Go to the documentation of this file.00001 #ifndef AI_GLOBAL_H
00002 #define AI_GLOBAL_H
00003
00004
00005 #include <stdio.h>
00006 #include <windows.h>
00007 #include "math/AI_Vector.h"
00008
00009
00010 #define ai_index unsigned short
00011 #define ai_dword unsigned int
00012
00013
00014 #define ai_log(s) MessageBox(0,s,"AI Message", MB_OK | MB_ICONWARNING)
00015
00016 #ifdef _DEBUG
00017 #include <crtdbg.h>
00018 #define ai_assert(b) _ASSERT(b)
00019 #define ai_assert2(b,s) if(!(b)) ai_log(s); _ASSERT(b);
00020 #else
00021 #define ai_assert(b)
00022 #define ai_assert2(b,s)
00023 #endif
00024
00025 #define ai_new(type) new type
00026 #define ai_delete(ptr) delete ptr
00027 #define ai_new_array(type, size) new type[size]
00028 #define ai_delete_array(ptr) delete[] ptr
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 static inline float ai_getDeterminant(const AI_Vector2 &v0, const AI_Vector2 &v1, const AI_Vector2 &v2 )
00039 {
00040 AI_Vector2 v_f1 = v0 - v1;
00041 AI_Vector2 v_f3 = v2 - v1;
00042
00043 return (v_f3.x*v_f1.y - v_f3.y*v_f1.x);
00044 }
00045
00046 static inline bool ai_isInRange( const AI_Vector3 &v_a, const AI_Vector3 &v_b, const float f_range )
00047 {
00048 float f_x_d = v_a.x - v_b.x;
00049 float f_y_d = v_a.z - v_b.z;
00050 return (f_range*f_range >= f_x_d*f_x_d + f_y_d*f_y_d);
00051 }
00052
00053
00054
00055 #define AI_WAY_TOLERANCE 0.0001f
00056 #define AI_PIVOT_MAX_LEADING 1.0f
00057 #define AI_PIVOT_MAX_DISTANCE 1.5f
00058 #define AI_AUTO_ENABLE_CHECK 0.2
00059 #define AI_WANDER_DEVIATION_SPEED AI_QUARTERPI
00060
00061
00062 #define AI_STR_TOO_MANY_TRI_EDGES "Too many edges for one triangle! Each triangle must have exactly three edges."
00063 #define AI_STR_TOO_MANY_VERTICES "Too many vertices! Maximum allowed number of vertices is 65535!"
00064 #define AI_STR_TOO_MANY_TRIANGLES "Too many triangles! Maximum allowed number of triangles is 65535!"
00065 #define AI_STR_TOO_MANY_EDGES "Too many edges! Maximum allowed number of edges is 65535!"
00066 #define AI_STR_NO_VERTEX "Unknown vertex number!"
00067 #define AI_STR_NO_TRIANGLE "Unknown triangle number!"
00068 #define AI_STR_WRONG_BORDER_EDGES "Wrong number of edges! Exactly two border edges can share one vertex."
00069
00070 #define AI_STR_TOO_HIGH_STATE_INDEX "Too high state index."
00071 #define AI_STR_FILLED_INDEX "The item of this index allready filled."
00072
00073 #define AI_STR_AGENT_ISNT_IN_WORLD "Agent must be added into the world before he is set as a pivot."
00074
00075 #endif