 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
32 #define SPACE_BLOCK 0.5
43 #define SEE_IN_DARK_LEVELS 2
48 #define LOS_BLOCKED 100
49 #define LOS_NO_DARKNESS 0
79 static void set_block(
int x,
int y,
int bx,
int by) {
84 for (i = 0; i < index; i++) {
85 if (
block[x][y].x[i] == bx
86 &&
block[x][y].y[i] == by)
94 LOG(
llevDebug,
"setblock: added %d %d -> %d %d (%d)\n", x, y, bx, by,
block[x][y].index);
108 static const int block_x[3] = {
128 for (i = 0; i < 3; i++) {
156 l =
FABS(sqrt(d1)*s);
199 for (
int i = 0; i < at->
index; i++) {
200 int dx = at->
x[i], dy = at->
y[i];
238 if (!
block[x][y].index)
303 for (i = 1; i <= 8; i += 1) {
361 int x, y, darklevel, ax, ay, basex, basey, mflags, light_radius, dark_change;
417 if (light_radius == 0)
420 for (ax = basex-light_radius; ax <= basex+light_radius; ax++) {
425 for (ay = basey-light_radius; ay <= basey+light_radius; ay++) {
443 if (light_radius > 0)
445 if (light_radius < 0)
462 for (x = -1; x <= 1; x++) {
463 for (y = -1; y <= 1; y++) {
510 int mapx, mapy, dx, dy, x, y;
571 if (pl->
ob->
map == map)
614 if (pl->
ob->
map == map) {
669 snprintf(
buf,
sizeof(
buf),
"[fixed] ");
671 snprintf(buf2,
sizeof(buf2),
"%2d", x);
672 strncat(
buf, buf2,
sizeof(
buf)-strlen(
buf)-1);
676 snprintf(
buf,
sizeof(
buf),
"[fixed]%2d:", y);
679 strncat(
buf, buf2,
sizeof(
buf)-strlen(
buf)-1);
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
#define MAP_CLIENT_X
This determines the maximum map size the client can request (and thus what the server will send to th...
void make_sure_not_seen(const object *op)
The object which is supposed to be visible through walls has just been removed from the map,...
#define LOS_BLOCKED
Special values for the blocked_los array.
player * next
Pointer to next player, NULL if this is last.
player * first_player
First player.
static void set_wall(player *pl, int x, int y)
This recursively sets the blocked line of sight view.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
uint32_t outdoor
True if an outdoor map.
#define QUERY_FLAG(xyz, p)
static void blinded_sight(player *pl)
Sets all veiwable squares to blocked except for the one the central one that the player occupies.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
object * ob
The object representing the player.
struct mapstruct * map
Pointer to the map in which this object is present.
static void expand_lighted_sight(object *op)
Propagate the light information.
#define MAP_DARKNESS(m)
Map darkness level (0-MAX_DARKNESS)
char path[HUGE_BUF]
Filename of the map.
int ihypot(int a, int b)
Rough estimate of hypot(a, b).
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
#define MSG_TYPE_COMMAND_DEBUG
Various debug type commands.
int16_t y
Position in the map for this object.
static event_registration m
void clear_los(player *pl)
Clears/initialises the los-array associated to the player controlling the object.
uint8_t mapy
How large a map the client wants.
struct player * contr
Pointer to the player which control this object.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
void init_block(void)
initialises the array used by the LOS routines.
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
Array showing what spaces the player can see.
#define FLAG_BLIND
If set, object cannot see (visually)
#define MAX_DARKNESS
Maximum map darkness, there is no practical reason to exceed this.
int has_carried_lights(const object *op)
Checks if op has a light source.
#define SEE_IN_DARK_LEVELS
Number of darkness levels to reduce for FLAG_SEE_IN_DARK (Infravision)
#define GET_MAP_LIGHT(M, X, Y)
Gets map light.
#define MAP_WIDTH(m)
Map width.
#define P_OUT_OF_MAP
This space is outside the map.
static void set_block(int x, int y, int bx, int by)
What this sets is that x,y blocks the view of bx,by This then sets up a relation - for example,...
void print_los(object *op)
Debug-routine which dumps the array which specifies the visible area of a player.
static blocks block[MAP_CLIENT_X][MAP_CLIENT_Y]
#define FLAG_REMOVED
Object is not in any map or invenory.
#define FLAG_WIZ
Object has special privilegies.
#define NDI_UNIQUE
Print immediately, don't buffer.
int8_t glow_radius
indicates the glow radius of the object
sstring name
The name of the object, obviously...
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
static void check_wall(object *op, int x, int y)
Used to initialise the array used by the LOS routines.
#define MAP_HEIGHT(m)
Map height.
mapstruct * tile_map[4]
Adjoining maps.
void update_all_map_los(mapstruct *map)
update all_map_los is like update_all_los() below, but updates everyone on the map,...
static void expand_sight(object *op)
Goes through the array of what the given player is able to see, and expands the visible area a bit,...
#define XRAY_RADIUS
Number of spaces that FLAG_XRAYS (X-Ray) can see through.
void update_all_los(const mapstruct *map, int x, int y)
This function makes sure that update_los() will be called for all players on the given map within the...
#define FLAG_XRAYS
X-ray vision.
socket_struct * socket
Socket information for this player.
void update_los(object *op)
Recalculates the array which specifies what is visible for the given player-object.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define MAX_LIGHT_RADII
Max radii for 'light' object, really large values allow objects that can slow down the game.
void make_sure_seen(const object *op)
The object is supposed to be visible through walls, thus check if any players are nearby,...
@ llevDebug
Only for debugging purposes.
#define SPACE_BLOCK
Distance must be less than this for the object to be blocked.
#define P_BLOCKSVIEW
This spot blocks the player's view.