42 for (i = 1; i < 9; i += 2)
68 for (i = 1; i < 9; i += 2) {
100 object *op, *head = NULL;
108 if (gen->
map == NULL) {
118 LOG(
llevError,
"Generator (%s) has no inventory in generate_monster_inv?\n", gen->
name);
121 qty =
rndm(0, qty-1);
178 if (gen->
map == NULL) {
225 int8_t children, max_children;
227 const char *code, *value;
235 max_children = (int8_t)strtol(value, NULL, 10);
236 if (max_children < 1)
248 if (value && value == code) {
255 if (children >= max_children+1)
264 }
else if (gen->
name) {
285 if (value && did_gen) {
286 int limit = atoi(value), num_generated = 0;
290 num_generated = atoi(value);
292 if (num_generated++ >= limit) {
299 snprintf(buf,
sizeof(buf),
"%d", num_generated);
321 if (op->
env != NULL) {
325 "You regain your senses.");
331 if (op->
env != NULL && op->
inv != NULL) {
332 object *inv = op->
inv;
350 "Your %s recovers its original form.",
368 if (op->
env != NULL) {
464 object *payload = op->
inv;
534 if (op->
skill != NULL)
647 LOG(
llevInfo,
"change_object: Failed to find a spot to put changing multipart object\n");
716 LOG(
llevError,
"move_player_mover: mover not in a map at undefinite location!");
729 && (victim->move_type&op->
move_type || !victim->move_type)) {
730 victim =
HEAD(victim);
741 LOG(
llevError,
"move_player_mover: Trying to push player off the map! map=%s (%d, %d)\n", m->
path, op->
x, op->
y);
750 nextmover->speed_left = -.99;
756 if (victim->type ==
PLAYER) {
764 victim->contr->fire_on = 0;
765 victim->speed_left = -
FABS(victim->speed);
783 if (victim->speed_left < -5.0)
784 victim->speed_left = -5.0;
797 if (getenv(
"CF_DEBUG_PROCESS")) {
850 if (used_up_message != NULL) {
853 "The %s %s.", op->
name, used_up_message->
value);
#define FLAG_NO_DROP
Object can't be dropped.
void change_object(object *op)
Replaces op with its other_arch if it has reached its end of life.
uint16_t attack_movement
What kind of attack movement.
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 MSG_TYPE_ITEM_CHANGE
Item has changed in some way.
#define MOVE_WALK
Object walks.
#define UP_OBJ_FACE
Only thing that changed was the face.
#define MSG_TYPE_ITEM
Item related information.
Spell-related defines: spellpath, subtypes, ...
int move_player(object *op, int dir)
Move player in the given direction.
struct archetype * arch
Pointer to archetype.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
void object_unset_flag_inv(object *op, int flag)
Desactivate recursively a flag on an object inventory.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
key_value * object_get_key_value(const object *ob, const char *key)
Search for a field by key.
int8_t direction
Means the object is moving that way.
#define FABS(x)
Decstations have trouble with fabs()...
int rndm(int min, int max)
Returns a number between min and max.
void object_handle_death_animation(object *op)
int free_no_drop(object *op)
Check whether the given object is FLAG_NO_DROP.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define FLAG_FRIENDLY
Will help players.
int get_random_dir(void)
Returns a random direction (1..8).
void fix_stopped_item(object *op, mapstruct *map, object *originator)
Put stopped item where stop_item() had found it.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
#define HUGE_BUF
Used for messages - some can be quite long.
#define SET_ANIMATION(ob, newanim)
sstring slaying
Which race to do double damage to.
sstring add_string(const char *str)
Share a string.
int32_t value
How much money it is worth (or contains)
#define MAP_HEIGHT(m)
Map height.
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could al...
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
#define FLAG_CONFUSED
Will also be unable to cast spells.
int16_t y
Position in the map for this object.
void check_spell_expiry(object *spell)
Checks if player should be warned of soon expiring spell.
#define FLAG_SEE_ANYWHERE
The object will be visible behind walls.
int16_t duration
Number of moves (see 'speed') spell lasts.
MoveType move_on
Move types affected moving on to this space.
int monster_move(object *op)
Main monster processing routine.
#define MSG_TYPE_ITEM_REMOVE
Item removed from inv.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects...
void process_object(object *op)
Main object move function.
Global type definitions and header inclusions.
#define PETMOVE
If the upper four bits of attack_movement are set to this number, the monster follows a player until ...
uint8_t temp_anim_speed
Ticks between temporary animation-frames.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
uint8_t anim_speed
Ticks between animation-frames.
void move_player_mover(object *op)
This function takes a PLAYERMOVER as an argument, and performs the function of a player mover...
#define FLAG_REMOVED
Object is not in any map or invenory.
int32_t weight
Attributes of the object.
void legacy_animate_trigger(object *op)
void make_sure_seen(const object *op)
The object is supposed to be visible through walls, thus check if any players are nearby...
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
object * object_create_clone(object *asrc)
Create clone from object to another.
#define SCRIPT_FIX_NOTHING
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
int16_t level
Level of creature or object.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
#define FLAG_ALIVE
Object can fight (or be fought)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
static int generate_monster_inv(object *gen)
Will generate a monster according to parameters of generator.
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
This function inserts the object in the two-way linked list which represents what is on a map...
static int generate_monster_arch(object *gen)
Generate a monster from the other_arch field.
float speed
Frequency of object 'moves' relative to server tick rate.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
char path[HUGE_BUF]
Filename of the map.
void legacy_move_hole(object *op)
#define FOR_ABOVE_FINISH()
Finishes FOR_ABOVE_PREPARE().
object * env
Pointer to the object which is the environment.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
#define QUERY_FLAG(xyz, p)
void monster_check_apply_all(object *monster)
Calls monster_check_apply() for all inventory objects.
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
void object_fix_multipart(object *tmp)
Ensures specified object has its more parts correctly inserted in map.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define FLAG_CHANGING
Changes to other_arch when anim is done.
#define FOR_ABOVE_PREPARE(op_, it_)
Constructs a loop iterating over all objects above an object.
int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
static void generate_monster(object *gen)
Main generator function.
method_ret ob_move_on(object *op, object *victim, object *originator)
Makes an object move on top of another one.
#define P_OUT_OF_MAP
This space is outside the map.
uint8_t state
How the object was last drawn (animation)
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
static void remove_force(object *op)
Move for FORCE objects.
int16_t dam
How much damage this object does when hitting.
#define HEAD(op)
Returns the head part of an object.
#define INS_ABOVE_FLOOR_ONLY
Put object immediatly above the floor.
int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator...
living stats
Str, Con, Dex, etc.
#define GENERATE_SPEED(xyz)
const Animations * temp_animation
A temporary animation.
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
void remove_locked_door(object *op)
Same as remove_door() but for locked doors.
float speed_left
How much speed is left to spend this round.
object * stop_item(object *op)
An item (ARROW or such) stops moving.
void legacy_remove_force(object *op)
struct mapstruct * map
Pointer to the map in which this object is present.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
int8_t facing
Object is oriented/facing that way.
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
struct treasurelist * randomitems
Items to be generated.
#define FLAG_ANIMATE
The object looks at archetype for faces.
Object structure, the core of Crossfire.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
#define INS_NO_MERGE
Don't try to merge with other items.
static event_registration m
#define NUM_ANIMATIONS(ob)
MoveType move_type
Type of movement this object uses.
sstring name
The name of the object, obviously...
#define MAP_WIDTH(m)
Map width.
Only for debugging purposes.
uint32_t nrof
Number of objects.
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 animate_trigger(object *op)
Animate a TRIGGER.
#define CLEAR_FLAG(xyz, p)
uint8_t type
PLAYER, BULLET, etc.
#define FLAG_APPLIED
Object is ready for use by living.
int move_object(object *op, int dir)
Try to move op in the direction "dir".
sstring value
Key's value.
char * spellarg
Optional argument when casting obj::spell.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
void object_update_speed(object *op)
Updates the speed of an object.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
object * inv
Pointer to the first object in the inventory.
#define EVENT_TIME
Triggered each time the object can react/move.
object * fix_stopped_arrow(object *op)
An ARROW stops moving.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
#define FORCE_TRANSFORMED_ITEM
sstring skill
Name of the skill this object uses/grants.
static void move_hole(object *op)
Move a HOLE.
int16_t maxsp
Max spell points.
uint32_t attacktype
Bitmask of attacks this object does.
void object_clear_owner(object *op)
Clears the owner of specified object.
#define FLAG_MONSTER
Will attack players.
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Execute an event on the specified object.
#define NDI_UNIQUE
Print immediately, don't buffer.
archetype * more
Next part of a linked object.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
#define FREE_OBJ_DROP_ABOVE_FLOOR
If FREE_OBJ_FREE_INVENTORY is not set, drop inventory just above ground instead on top...
int32_t food
How much food in stomach.
uint8_t subtype
Subtype of object.
uint16_t difficulty
What level the player should be to play here.
object * object_get_player_container(object *op)
Finds the player carrying an object.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
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...
int8_t wc
Weapon Class, lower WC increases probability of hitting.
int should_director_abort(const object *op, const object *victim)
Check if op should abort moving victim because of it's race or slaying.
void object_update(object *op, int action)
object_update() updates the array which represents the map.
tag_t count
Unique object number for this object.
#define FLAG_NO_PICK
Object can't be picked up.
#define FLAG_WIZPASS
The wizard can go through walls.
void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
Inserts an object into its map.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Searches for any objects with a matching type variable at the given map and coordinates.
#define FLAG_CONTENT_ON_GEN
Use
object clone
An object from which to do object_copy()
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
void remove_door(object *op)
Remove non locked doors.
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
#define FLAG_FREED
Object is in the list of free objects.
void move_firewall(object *op)
Move for FIREWALL.