 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
25 static int roll_ob(
object *op,
int dir,
object *pusher);
58 int move_ob(
object *op,
int dir,
object *originator) {
68 for (part = op; part != NULL; part = part->
more) {
88 for (part = op; part != NULL; part = part->
more) {
110 if (old_move_type == 0) {
128 pl->contr->do_los = 1;
133 pl->contr->socket->update_look = 1;
134 pl->contr->socket->look_position = 0;
163 int transfer_ob(
object *op,
int x,
int y,
int randomly,
object *originator) {
204 int teleport(
object *teleporter, uint8_t tele_type,
object *user) {
206 int i, j, k, nrofalt = 0;
207 object *other_teleporter;
219 for (i = -5; i < 6; i++)
220 for (j = -5; j < 6; j++) {
221 if (i == 0 && j == 0)
227 if (tmp->type == tele_type) {
228 altern[nrofalt++] = tmp;
239 other_teleporter = altern[
RANDOM()%nrofalt];
251 for (k = 1; k < 9; k++) {
261 LOG(
llevError,
"Shop mat %s (%d, %d) is in solid rock?\n", other_teleporter->
name, other_teleporter->
x, other_teleporter->
y);
280 return (user == NULL);
297 if (!
roll_ob(op, dir, pusher)) {
299 "You fail to push the %s.",
303 (void)
move_ob(pusher, dir, pusher);
338 for (more = op; more; more = more->
more) {
339 tx = x+more->
x-op->
x;
340 ty = y+more->
y-op->
y;
348 if (tmp->head == op || tmp == op)
380 static int roll_ob(
object *op,
int dir,
object *pusher) {
434 int push_ob(
object *who,
int dir,
object *pusher) {
446 if (who->
more == NULL
492 "You start to attack %s!",
501 "You avoid attacking %s.",
510 "You can't push %s.",
529 "%s tried to push you.",
545 "You pushed %s back.",
566 if (op->
x == x && op->
y == y)
583 if (
move_ob(op, direction, op) == 0)
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
#define FLAG_NEUTRAL
monster is from type neutral
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
#define FLAG_STAND_STILL
NPC will not (ever) move.
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
Returns true if the given coordinate is blocked except by the object passed is not blocking.
uint16_t look_position
Start of drawing of look window.
#define QUERY_FLAG(xyz, p)
static int roll_ob(object *op, int dir, object *pusher)
An object is being pushed, and may push other objects.
void monster_check_doors(object *op, mapstruct *m, int x, int y)
Living creature attempts to open a door.
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
struct mapstruct * map
Pointer to the map in which this object is present.
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(),...
int move_object(object *op, int dir)
Try to move op in the direction "dir".
unsigned char MoveType
Typdef here to define type large enough to hold bitmask of all movement types.
void monster_check_earthwalls(object *op, mapstruct *m, int x, int y)
Living creature attempts to hit an earthwall.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
int8_t direction
Means the object is moving that way.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
static const flag_definition flags[]
Flag mapping.
tag_t count
Unique object number for this object.
@ TRANSPORT
see doc/Developers/objects
uint8_t hide
The object is hidden, not invisible.
#define P_IS_ALIVE
Something alive is on this space.
int16_t level
Level of creature or object.
uint8_t will_apply
See crossfire.doc and What monsters apply.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
Plugin animator file specs[Config] name
int transfer_ob(object *op, int x, int y, int randomly, object *originator)
Move an object (even linked objects) to another spot on the same map.
#define FLAG_ALIVE
Object can fight (or be fought)
uint32_t update_look
If true, we need to send the look window.
int16_t y
Position in the map for this object.
static event_registration m
struct player * contr
Pointer to the player which control this object.
void recursive_roll(object *op, int dir, object *pusher)
An object is pushed by another which is trying to take its place.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
uint32_t run_on
Player should keep moving in dir until run is off.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
#define MOVE_WALK
Object walks.
#define HEAD(op)
Returns the head part of an object.
MoveType move_type
Type of movement this object uses.
static int try_fit(object *op, mapstruct *m, int x, int y)
Checks if an objects fits on a specified spot.
int out_of_map(mapstruct *m, int x, int y)
Return 1 if coordinates X and Y are out of the map M, taking into account tiling.
int teleport(object *teleporter, uint8_t tele_type, object *user)
Teleport an item around a nearby random teleporter of specified type.
uint8_t type
PLAYER, BULLET, etc.
#define FLAG_WIZPASS
The wizard can go through walls.
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define FLAG_CAN_ROLL
Object can be rolled.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
int move_ob(object *op, int dir, object *originator)
Op is trying to move in direction dir.
uint32_t tag_t
Object tag, unique during the whole game.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
int8_t facing
Object is oriented/facing that way.
const Animations * animation
Animation of this item, NULL if not animated.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
#define P_OUT_OF_MAP
This space is outside the map.
#define MAX_BUF
Used for all kinds of things.
#define OB_MOVE_BLOCK(ob1, ob2)
int32_t weight
Attributes of the object.
#define MSG_TYPE_COMMAND_FAILURE
Failed result from command.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int move_to(object *op, int x, int y)
Move an object one square toward a specified destination on the same map.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
void pets_attempt_follow(object *for_owner, int force)
Check pets so they try to follow their master around the world.
#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.
#define FLAG_FRIENDLY
Will help players.
sstring name
The name of the object, obviously...
#define MSG_TYPE_VICTIM_WAS_PUSHED
Player was pushed or attempted pushed.
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_.
#define SOUND_TYPE_GROUND
void monster_npc_call_help(object *op)
A monster calls for help against its enemy.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
#define WILL_APPLY_DOOR
Open non-locked doors.
#define CLEAR_FLAG(xyz, p)
int push_ob(object *who, int dir, object *pusher)
Something is pushing some other object.
void map_newmap_cmd(socket_struct *ns)
Sound related function.
partylist * party
Party this player is part of.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
#define OB_TYPE_MOVE_BLOCK(ob1, type)
Basic macro to see if if ob1 can not move onto a space based on the 'type' move_block parameter Add c...
int object_teleport(object *op, mapstruct *map, int x, int y)
Move the specified object in a free spot around the map's x & y.
socket_struct * socket
Socket information for this player.
living stats
Str, Con, Dex, etc.
object * more
Pointer to the rest of a large body of objects.
#define WILL_APPLY_EARTHWALL
Destroy earthwalls.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FLAG_SLEEP
NPC is sleeping.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int monster_compute_path(object *source, object *target, int default_dir)
Computes a path from source to target.
void player_update_bg_music(object *player)