|
@@ -2,10 +2,11 @@
|
|
|
|
|
|
#include <general.h>
|
|
|
|
|
|
+#include <map.h>
|
|
|
+#include <pulse.h>
|
|
|
#include <server.h>
|
|
|
#include <conf.h>
|
|
|
-#include <game.h>
|
|
|
-#include <private.h>
|
|
|
+#include <objects.h>
|
|
|
#include <action.h>
|
|
|
#include <erreur.h>
|
|
|
#include <bits/mathcalls.h>
|
|
@@ -29,25 +30,25 @@ static boolean_t is_visible(int team_id, float x, float y)
|
|
|
|
|
|
static boolean_t is_obj_visible(int team_id, int id)
|
|
|
{
|
|
|
- if (gl_objects[id].obj.team_id == team_id)
|
|
|
+ if (glbObjects[id].obj.team_id == team_id)
|
|
|
{
|
|
|
return True;
|
|
|
}
|
|
|
- return is_visible(team_id, gl_objects[id].obj.x, gl_objects[id].obj.y);
|
|
|
+ return is_visible(team_id, glbObjects[id].obj.x, glbObjects[id].obj.y);
|
|
|
}
|
|
|
|
|
|
void set_default_action_r4d2(int r4d2_id)
|
|
|
{
|
|
|
- gl_objects[r4d2_id].r4d2.action.type = act_r4d2_move;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.move.x = gl_objects[r4d2_id].r4d2.x;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.move.y = gl_objects[r4d2_id].r4d2.y;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.type = act_r4d2_move;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.move.x = glbObjects[r4d2_id].r4d2.x;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.move.y = glbObjects[r4d2_id].r4d2.y;
|
|
|
}
|
|
|
|
|
|
void set_default_action_akx(int akx_id)
|
|
|
{
|
|
|
- gl_objects[akx_id].akx.action.type = act_akx_move;
|
|
|
- gl_objects[akx_id].akx.action.act.move.x = gl_objects[akx_id].akx.x;
|
|
|
- gl_objects[akx_id].akx.action.act.move.y = gl_objects[akx_id].akx.y;
|
|
|
+ glbObjects[akx_id].akx.action.type = act_akx_move;
|
|
|
+ glbObjects[akx_id].akx.action.act.move.x = glbObjects[akx_id].akx.x;
|
|
|
+ glbObjects[akx_id].akx.action.act.move.y = glbObjects[akx_id].akx.y;
|
|
|
}
|
|
|
|
|
|
int time_get_left()
|
|
@@ -59,31 +60,31 @@ int error_get()
|
|
|
{
|
|
|
int foo;
|
|
|
|
|
|
- foo = gl_player->error;
|
|
|
- gl_player->error = NONE;
|
|
|
+ foo = glbPlayer->error;
|
|
|
+ glbPlayer->error = NONE;
|
|
|
return foo;
|
|
|
}
|
|
|
|
|
|
int score_get()
|
|
|
{
|
|
|
- return (int)gl_player->score;
|
|
|
+ return (int)glbPlayer->score;
|
|
|
}
|
|
|
|
|
|
static boolean_t validate_object(int obj_id, obj_type_t type)
|
|
|
{
|
|
|
if ((obj_id >= gl_config->nb_objects) || (obj_id < 0))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return False;
|
|
|
}
|
|
|
- if (!is_obj_visible(gl_player->team_id, obj_id))
|
|
|
+ if (!is_obj_visible(glbPlayer->team_id, obj_id))
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return False;
|
|
|
}
|
|
|
- if (gl_objects[obj_id].obj.type != type)
|
|
|
+ if (glbObjects[obj_id].obj.type != type)
|
|
|
{
|
|
|
- gl_player->error = TYPE_ERROR;
|
|
|
+ glbPlayer->error = TYPE_ERROR;
|
|
|
return False;
|
|
|
}
|
|
|
return True;
|
|
@@ -93,12 +94,12 @@ static boolean_t validate_object_nosee(int obj_id, obj_type_t type)
|
|
|
{
|
|
|
if ((obj_id >= gl_config->nb_objects) || (obj_id < 0))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return False;
|
|
|
}
|
|
|
- if (gl_objects[obj_id].obj.type != type)
|
|
|
+ if (glbObjects[obj_id].obj.type != type)
|
|
|
{
|
|
|
- gl_player->error = TYPE_ERROR;
|
|
|
+ glbPlayer->error = TYPE_ERROR;
|
|
|
return False;
|
|
|
}
|
|
|
return True;
|
|
@@ -108,24 +109,24 @@ static boolean_t validate_object_owner(int obj_id, obj_type_t type)
|
|
|
{
|
|
|
if ((obj_id >= gl_config->nb_objects) || (obj_id < 0))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return False;
|
|
|
}
|
|
|
- if (gl_objects[obj_id].obj.team_id != gl_player->team_id)
|
|
|
+ if (glbObjects[obj_id].obj.team_id != glbPlayer->team_id)
|
|
|
{
|
|
|
- if ((gl_objects[obj_id].obj.team_id == 0) && (type == obj_r4d2))
|
|
|
+ if ((glbObjects[obj_id].obj.team_id == 0) && (type == obj_r4d2))
|
|
|
{
|
|
|
- gl_player->error = DESTROYED;
|
|
|
+ glbPlayer->error = DESTROYED;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- gl_player->error = NOT_YOURS;
|
|
|
+ glbPlayer->error = NOT_YOURS;
|
|
|
}
|
|
|
return False;
|
|
|
}
|
|
|
- if (gl_objects[obj_id].obj.type != type)
|
|
|
+ if (glbObjects[obj_id].obj.type != type)
|
|
|
{
|
|
|
- gl_player->error = TYPE_ERROR;
|
|
|
+ glbPlayer->error = TYPE_ERROR;
|
|
|
return False;
|
|
|
}
|
|
|
return True;
|
|
@@ -137,12 +138,12 @@ int r4d2_get_team(int r4d2_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[r4d2_id].obj.team_id == 0)
|
|
|
+ if (glbObjects[r4d2_id].obj.team_id == 0)
|
|
|
{
|
|
|
- gl_player->error = DESTROYED;
|
|
|
+ glbPlayer->error = DESTROYED;
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[r4d2_id].obj.team_id;
|
|
|
+ return glbObjects[r4d2_id].obj.team_id;
|
|
|
}
|
|
|
|
|
|
float r4d2_get_pos_x(int r4d2_id)
|
|
@@ -151,7 +152,7 @@ float r4d2_get_pos_x(int r4d2_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[r4d2_id].obj.x;
|
|
|
+ return glbObjects[r4d2_id].obj.x;
|
|
|
}
|
|
|
|
|
|
float r4d2_get_pos_y(int r4d2_id)
|
|
@@ -160,7 +161,7 @@ float r4d2_get_pos_y(int r4d2_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[r4d2_id].obj.y;
|
|
|
+ return glbObjects[r4d2_id].obj.y;
|
|
|
}
|
|
|
|
|
|
int r4d2_get_status(int r4d2_id)
|
|
@@ -169,7 +170,7 @@ int r4d2_get_status(int r4d2_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[r4d2_id].r4d2.action.type;
|
|
|
+ return glbObjects[r4d2_id].r4d2.action.type;
|
|
|
}
|
|
|
|
|
|
float r4d2_get_speed()
|
|
@@ -206,16 +207,16 @@ int r4d2_move(int r4d2_id, float x, float y)
|
|
|
{
|
|
|
if (!finitef(x) || !finitef(y))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
if (!validate_object_owner(r4d2_id, obj_r4d2))
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- gl_objects[r4d2_id].r4d2.action.type = act_r4d2_move;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.move.x = x;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.move.y = y;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.type = act_r4d2_move;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.move.x = x;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.move.y = y;
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -230,26 +231,26 @@ int r4d2_take_akx(int r4d2_id, int target_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- if (dist(gl_objects[r4d2_id].r4d2.x,
|
|
|
- gl_objects[r4d2_id].r4d2.y,
|
|
|
- gl_objects[target_id].akx.x,
|
|
|
- gl_objects[target_id].akx.y) > DIST_MIN_TAKE)
|
|
|
+ if (map_get_dist(glbObjects[r4d2_id].r4d2.x,
|
|
|
+ glbObjects[r4d2_id].r4d2.y,
|
|
|
+ glbObjects[target_id].akx.x,
|
|
|
+ glbObjects[target_id].akx.y) > DIST_MIN_TAKE)
|
|
|
{
|
|
|
set_default_action_r4d2(r4d2_id);
|
|
|
- gl_player->error = POS_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = POS_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[r4d2_id].r4d2.action.type == act_r4d2_take_akx)
|
|
|
+ if (glbObjects[r4d2_id].r4d2.action.type == act_r4d2_take_akx)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
- gl_objects[r4d2_id].r4d2.action.type = act_r4d2_take_akx;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.take_akx.target_id = target_id;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.take_akx.turn_need =
|
|
|
+ glbObjects[r4d2_id].r4d2.action.type = act_r4d2_take_akx;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.take_akx.target_id = target_id;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.take_akx.turn_need =
|
|
|
gl_config->turn_take_akx;
|
|
|
- if (gl_objects[target_id].akx.team_id != 0)
|
|
|
+ if (glbObjects[target_id].akx.team_id != 0)
|
|
|
{
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.take_akx.turn_need +=
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.take_akx.turn_need +=
|
|
|
gl_config->turn_untake_akx;
|
|
|
}
|
|
|
return 0;
|
|
@@ -267,35 +268,35 @@ int r4d2_take_r4d2(int r4d2_id, int target_id)
|
|
|
}
|
|
|
if (target_id == r4d2_id)
|
|
|
{
|
|
|
- gl_player->error = INVALID_TARGET;
|
|
|
+ glbPlayer->error = INVALID_TARGET;
|
|
|
return -1;
|
|
|
}
|
|
|
- if ((gl_objects[target_id].obj.team_id == 0) ||
|
|
|
- (gl_objects[target_id].obj.team_id > gl_config->nb_players))
|
|
|
+ if ((glbObjects[target_id].obj.team_id == 0) ||
|
|
|
+ (glbObjects[target_id].obj.team_id > gl_config->nb_players))
|
|
|
{
|
|
|
- gl_player->error = DESTROYED;
|
|
|
+ glbPlayer->error = DESTROYED;
|
|
|
return -1;
|
|
|
}
|
|
|
- if (dist(gl_objects[r4d2_id].r4d2.x,
|
|
|
- gl_objects[r4d2_id].r4d2.y,
|
|
|
- gl_objects[target_id].r4d2.x,
|
|
|
- gl_objects[target_id].r4d2.y) > DIST_MIN_TAKE)
|
|
|
+ if (map_get_dist(glbObjects[r4d2_id].r4d2.x,
|
|
|
+ glbObjects[r4d2_id].r4d2.y,
|
|
|
+ glbObjects[target_id].r4d2.x,
|
|
|
+ glbObjects[target_id].r4d2.y) > DIST_MIN_TAKE)
|
|
|
{
|
|
|
set_default_action_r4d2(r4d2_id);
|
|
|
- gl_player->error = POS_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = POS_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[r4d2_id].r4d2.action.type == act_r4d2_take_r4d2)
|
|
|
+ if (glbObjects[r4d2_id].r4d2.action.type == act_r4d2_take_r4d2)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
- gl_objects[r4d2_id].r4d2.action.type = act_r4d2_take_r4d2;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.take_r4d2.target_id = target_id;
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.take_r4d2.turn_need =
|
|
|
+ glbObjects[r4d2_id].r4d2.action.type = act_r4d2_take_r4d2;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.take_r4d2.target_id = target_id;
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.take_r4d2.turn_need =
|
|
|
gl_config->turn_take_r4d2;
|
|
|
- if (gl_objects[target_id].r4d2.team_id != 0)
|
|
|
+ if (glbObjects[target_id].r4d2.team_id != 0)
|
|
|
{
|
|
|
- gl_objects[r4d2_id].r4d2.action.act.take_r4d2.turn_need +=
|
|
|
+ glbObjects[r4d2_id].r4d2.action.act.take_r4d2.turn_need +=
|
|
|
gl_config->turn_untake_r4d2;
|
|
|
}
|
|
|
return 0;
|
|
@@ -312,16 +313,16 @@ static int get_nearest_not(float x, float y, int id, int team_id,
|
|
|
for (cpt = 0 ; cpt < gl_config->nb_objects ; cpt++)
|
|
|
{
|
|
|
if ((cpt != id) &&
|
|
|
- (gl_objects[cpt].obj.team_id != team_id) &&
|
|
|
- (gl_objects[cpt].obj.type == target_type))
|
|
|
+ (glbObjects[cpt].obj.team_id != team_id) &&
|
|
|
+ (glbObjects[cpt].obj.type == target_type))
|
|
|
{
|
|
|
- if ((target_type != obj_r4d2) || (gl_objects[cpt].obj.team_id != 0))
|
|
|
+ if ((target_type != obj_r4d2) || (glbObjects[cpt].obj.team_id != 0))
|
|
|
{
|
|
|
- if (is_obj_visible(gl_player->team_id, cpt))
|
|
|
+ if (is_obj_visible(glbPlayer->team_id, cpt))
|
|
|
{
|
|
|
- dist_temp = dist(x, y,
|
|
|
- gl_objects[cpt].obj.x,
|
|
|
- gl_objects[cpt].obj.y);
|
|
|
+ dist_temp = map_get_dist(x, y,
|
|
|
+ glbObjects[cpt].obj.x,
|
|
|
+ glbObjects[cpt].obj.y);
|
|
|
if (dist_temp < dist_nearest)
|
|
|
{
|
|
|
nearest = cpt;
|
|
@@ -351,16 +352,16 @@ static int get_nearest_plot(float x, float y, int id, int team_id,
|
|
|
for (cpt = 0 ; cpt < gl_config->nb_objects ; cpt++)
|
|
|
{
|
|
|
if ((cpt != id) &&
|
|
|
- (gl_objects[cpt].obj.team_id == team_id) &&
|
|
|
- (gl_objects[cpt].obj.type == target_type))
|
|
|
+ (glbObjects[cpt].obj.team_id == team_id) &&
|
|
|
+ (glbObjects[cpt].obj.type == target_type))
|
|
|
{
|
|
|
- if ((target_type != obj_r4d2) || (gl_objects[cpt].obj.team_id > 0))
|
|
|
+ if ((target_type != obj_r4d2) || (glbObjects[cpt].obj.team_id > 0))
|
|
|
{
|
|
|
- if (is_obj_visible(gl_player->team_id, cpt))
|
|
|
+ if (is_obj_visible(glbPlayer->team_id, cpt))
|
|
|
{
|
|
|
- dist_temp = dist(x, y,
|
|
|
- gl_objects[cpt].obj.x,
|
|
|
- gl_objects[cpt].obj.y);
|
|
|
+ dist_temp = map_get_dist(x, y,
|
|
|
+ glbObjects[cpt].obj.x,
|
|
|
+ glbObjects[cpt].obj.y);
|
|
|
if (dist_temp < dist_nearest)
|
|
|
{
|
|
|
nearest = cpt;
|
|
@@ -376,8 +377,8 @@ static int get_nearest_plot(float x, float y, int id, int team_id,
|
|
|
|
|
|
int get_nearest(int id, int team_id, obj_type_t target_type)
|
|
|
{
|
|
|
- return get_nearest_plot(gl_objects[id].obj.x,
|
|
|
- gl_objects[id].obj.y,
|
|
|
+ return get_nearest_plot(glbObjects[id].obj.x,
|
|
|
+ glbObjects[id].obj.y,
|
|
|
id, team_id, target_type);
|
|
|
}
|
|
|
|
|
@@ -387,7 +388,7 @@ int akx_get_team(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].obj.team_id;
|
|
|
+ return glbObjects[akx_id].obj.team_id;
|
|
|
}
|
|
|
|
|
|
float akx_get_pos_x(int akx_id)
|
|
@@ -396,7 +397,7 @@ float akx_get_pos_x(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].obj.x;
|
|
|
+ return glbObjects[akx_id].obj.x;
|
|
|
}
|
|
|
|
|
|
float akx_get_pos_y(int akx_id)
|
|
@@ -405,7 +406,7 @@ float akx_get_pos_y(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].obj.y;
|
|
|
+ return glbObjects[akx_id].obj.y;
|
|
|
}
|
|
|
|
|
|
int akx_get_status(int akx_id)
|
|
@@ -414,7 +415,7 @@ int akx_get_status(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].akx.action.type;
|
|
|
+ return glbObjects[akx_id].akx.action.type;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -447,17 +448,17 @@ int akx_move(int akx_id, float x, float y)
|
|
|
{
|
|
|
if (!finitef(x) || !finitef(y))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
if (!validate_object_owner(akx_id, obj_akx))
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- gl_objects[akx_id].akx.action.type = act_akx_move;
|
|
|
- gl_objects[akx_id].akx.action.act.move.x = x;
|
|
|
- gl_objects[akx_id].akx.action.act.move.y = y;
|
|
|
- gl_objects[akx_id].akx.change = True;
|
|
|
+ glbObjects[akx_id].akx.action.type = act_akx_move;
|
|
|
+ glbObjects[akx_id].akx.action.act.move.x = x;
|
|
|
+ glbObjects[akx_id].akx.action.act.move.y = y;
|
|
|
+ glbObjects[akx_id].akx.change = True;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -465,24 +466,24 @@ int akx_pulse(int akx_id, float x, float y, float angle)
|
|
|
{
|
|
|
if (!finitef(x) || !finitef(y) || !finitef(angle))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
if (!validate_object_owner(akx_id, obj_akx))
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
+ if (glbObjects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
{
|
|
|
- gl_objects[akx_id].akx.action.act.pulse.x = gl_objects[akx_id].obj.x;
|
|
|
- gl_objects[akx_id].akx.action.act.pulse.y = gl_objects[akx_id].obj.y;
|
|
|
- gl_objects[akx_id].akx.energy = 0;
|
|
|
+ glbObjects[akx_id].akx.action.act.pulse.x = glbObjects[akx_id].obj.x;
|
|
|
+ glbObjects[akx_id].akx.action.act.pulse.y = glbObjects[akx_id].obj.y;
|
|
|
+ glbObjects[akx_id].akx.energy = 0;
|
|
|
}
|
|
|
- gl_objects[akx_id].akx.action.type = act_akx_pulse;
|
|
|
- gl_objects[akx_id].akx.action.act.pulse.new_x = x;
|
|
|
- gl_objects[akx_id].akx.action.act.pulse.new_y = y;
|
|
|
- gl_objects[akx_id].akx.action.act.pulse.new_angle = CLAMP(angle, MIN_ANGLE, MAX_ANGLE);
|
|
|
- gl_objects[akx_id].akx.change = True;
|
|
|
+ glbObjects[akx_id].akx.action.type = act_akx_pulse;
|
|
|
+ glbObjects[akx_id].akx.action.act.pulse.new_x = x;
|
|
|
+ glbObjects[akx_id].akx.action.act.pulse.new_y = y;
|
|
|
+ glbObjects[akx_id].akx.action.act.pulse.new_angle = CLAMP(angle, MIN_ANGLE, MAX_ANGLE);
|
|
|
+ glbObjects[akx_id].akx.change = True;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -492,12 +493,12 @@ float akx_pulse_angle(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
+ if (glbObjects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
{
|
|
|
- gl_player->error = INVALID_TARGET;
|
|
|
+ glbPlayer->error = INVALID_TARGET;
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].akx.action.act.pulse.angle;
|
|
|
+ return glbObjects[akx_id].akx.action.act.pulse.angle;
|
|
|
}
|
|
|
|
|
|
float akx_pulse_destx(int akx_id)
|
|
@@ -506,12 +507,12 @@ float akx_pulse_destx(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
+ if (glbObjects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
{
|
|
|
- gl_player->error = INVALID_TARGET;
|
|
|
+ glbPlayer->error = INVALID_TARGET;
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].akx.action.act.pulse.x;
|
|
|
+ return glbObjects[akx_id].akx.action.act.pulse.x;
|
|
|
}
|
|
|
|
|
|
float akx_pulse_desty(int akx_id)
|
|
@@ -520,12 +521,12 @@ float akx_pulse_desty(int akx_id)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
+ if (glbObjects[akx_id].akx.action.type != act_akx_pulse)
|
|
|
{
|
|
|
- gl_player->error = INVALID_TARGET;
|
|
|
+ glbPlayer->error = INVALID_TARGET;
|
|
|
return -1;
|
|
|
}
|
|
|
- return gl_objects[akx_id].akx.action.act.pulse.y;
|
|
|
+ return glbObjects[akx_id].akx.action.act.pulse.y;
|
|
|
}
|
|
|
|
|
|
int akx_link(int akx_id, int target_id)
|
|
@@ -540,13 +541,13 @@ int akx_link(int akx_id, int target_id)
|
|
|
}
|
|
|
if (target_id == akx_id)
|
|
|
{
|
|
|
- gl_player->error = INVALID_TARGET;
|
|
|
+ glbPlayer->error = INVALID_TARGET;
|
|
|
return -1;
|
|
|
}
|
|
|
- gl_objects[akx_id].akx.change = True;
|
|
|
+ glbObjects[akx_id].akx.change = True;
|
|
|
set_default_action_akx(akx_id);
|
|
|
- gl_objects[akx_id].akx.action.type = act_akx_link;
|
|
|
- gl_objects[akx_id].akx.action.act.link.target_id = target_id;
|
|
|
+ glbObjects[akx_id].akx.action.type = act_akx_link;
|
|
|
+ glbObjects[akx_id].akx.action.act.link.target_id = target_id;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -556,13 +557,13 @@ int map_get_nearest_akx(int id, int team_id)
|
|
|
|
|
|
if (id >= gl_config->nb_objects)
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
nearest = get_nearest(id, team_id, obj_akx);
|
|
|
if (nearest == id)
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return -1;
|
|
|
}
|
|
|
return nearest;
|
|
@@ -574,13 +575,13 @@ int map_get_nearest_akx_plot(float x, float y, int team_id)
|
|
|
|
|
|
if (!finitef(x) || !finitef(y))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
nearest = get_nearest_plot(x, y, -1, team_id, obj_akx);
|
|
|
if (nearest == -1)
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return -1;
|
|
|
}
|
|
|
return nearest;
|
|
@@ -592,13 +593,13 @@ int map_get_nearest_r4d2_plot(float x, float y, int team_id)
|
|
|
|
|
|
if (!finitef(x) || !finitef(y))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
nearest = get_nearest_plot(x, y, -1, team_id, obj_r4d2);
|
|
|
if (nearest == -1)
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return -1;
|
|
|
}
|
|
|
return nearest;
|
|
@@ -610,13 +611,13 @@ int map_get_nearest_r4d2(int id, int team_id)
|
|
|
|
|
|
if (id >= gl_config->nb_objects)
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
nearest = get_nearest(id, team_id, obj_r4d2);
|
|
|
if (nearest == id)
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return -1;
|
|
|
}
|
|
|
return nearest;
|
|
@@ -638,8 +639,8 @@ int count_unit(int team_id, int obj_type)
|
|
|
|
|
|
for (i = 0 ; i < gl_config->nb_objects ; i++)
|
|
|
{
|
|
|
- if ((gl_objects[i].obj.team_id == team_id) &&
|
|
|
- (gl_objects[i].obj.type == obj_type))
|
|
|
+ if ((glbObjects[i].obj.team_id == team_id) &&
|
|
|
+ (glbObjects[i].obj.type == obj_type))
|
|
|
{
|
|
|
cpt++;
|
|
|
}
|
|
@@ -654,7 +655,7 @@ int count_akx(int team_id)
|
|
|
|
|
|
int map_count_my_akx()
|
|
|
{
|
|
|
- return count_akx(gl_player->team_id);
|
|
|
+ return count_akx(glbPlayer->team_id);
|
|
|
}
|
|
|
|
|
|
int count_r4d2(int team_id)
|
|
@@ -674,19 +675,19 @@ float map_get_size_y()
|
|
|
|
|
|
int map_count_my_r4d2()
|
|
|
{
|
|
|
- return count_r4d2(gl_player->team_id);
|
|
|
+ return count_r4d2(glbPlayer->team_id);
|
|
|
}
|
|
|
|
|
|
float map_get_pulse(int team_id, float x, float y)
|
|
|
{
|
|
|
if (!finitef(x) || !finitef(y))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
- if (!is_visible(gl_player->team_id, x, y))
|
|
|
+ if (!is_visible(glbPlayer->team_id, x, y))
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return -1;
|
|
|
}
|
|
|
return get_pulse_team(x, y, team_id);
|
|
@@ -696,22 +697,22 @@ float map_get_pulse_id(int akx_id, float x, float y)
|
|
|
{
|
|
|
if (!finitef(x) || !finitef(y))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
if ((akx_id >= gl_config->nb_objects) || (akx_id < 0))
|
|
|
{
|
|
|
- gl_player->error = NBR_OUT_OF_RANGE;
|
|
|
+ glbPlayer->error = NBR_OUT_OF_RANGE;
|
|
|
return -1;
|
|
|
}
|
|
|
- if (!is_visible(gl_player->team_id, x, y))
|
|
|
+ if (!is_visible(glbPlayer->team_id, x, y))
|
|
|
{
|
|
|
- gl_player->error = NOT_VISIBLE;
|
|
|
+ glbPlayer->error = NOT_VISIBLE;
|
|
|
return -1;
|
|
|
}
|
|
|
- if (gl_objects[akx_id].obj.type != obj_akx)
|
|
|
+ if (glbObjects[akx_id].obj.type != obj_akx)
|
|
|
{
|
|
|
- gl_player->error = TYPE_ERROR;
|
|
|
+ glbPlayer->error = TYPE_ERROR;
|
|
|
return -1;
|
|
|
}
|
|
|
return get_pulse_id(x, y, akx_id);
|