 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
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);
void remove_door(object *op)
Remove non locked doors.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
#define UP_OBJ_FACE
Only thing that changed was the face.
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,...
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
int free_no_drop(object *op)
Check whether the given object is FLAG_NO_DROP.
void object_clear_owner(object *op)
Clears the owner of specified object.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be friendly
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
#define FLAG_CONFUSED
Will also be unable to cast spells.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
uint16_t difficulty
What level the player should be to play here.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
archetype * more
Next part of a linked object.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
object * inv
Pointer to the first object in the inventory.
#define QUERY_FLAG(xyz, p)
int get_random_dir(void)
Returns a random direction (1..8).
#define FLAG_CONTENT_ON_GEN
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 * arch
Pointer to archetype.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
uint16_t attack_movement
What kind of attack movement.
float speed
Frequency of object 'moves' relative to server tick rate.
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.
float speed_left
How much speed is left to spend this round.
struct mapstruct * map
Pointer to the map in which this object is present.
void move_firewall(object *op)
Move for FIREWALL.
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could al...
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 object_handle_death_animation(object *op)
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
#define SET_ANIMATION(ob, newanim)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
int move_player(object *op, int dir)
Move player in the given direction.
int8_t direction
Means the object is moving that way.
tag_t count
Unique object number for this object.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
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,...
static void move_hole(object *op)
Move a HOLE.
#define FOR_ABOVE_PREPARE(op_, it_)
Constructs a loop iterating over all objects above an object.
int rndm(int min, int max)
Returns a number between min and max.
void fix_stopped_item(object *op, mapstruct *map, object *originator)
Put stopped item where stop_item() had found it.
static void generate_monster(object *gen)
Main generator function.
char path[HUGE_BUF]
Filename of the map.
#define FLAG_APPLIED
Object is ready for use by living.
int16_t level
Level of creature or object.
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.
static int generate_monster_arch(object *gen)
Generate a monster from the other_arch field.
object * stop_item(object *op)
An item (ARROW or such) stops moving.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
#define HUGE_BUF
Used for messages - some can be quite long.
method_ret ob_move_on(object *op, object *victim, object *originator)
Makes an object move on top of another one.
#define FLAG_NO_PICK
Object can't be picked up.
Plugin animator file specs[Config] name
#define FLAG_ALIVE
Object can fight (or be fought)
#define INS_ABOVE_FLOOR_ONLY
Put object immediatly above the floor.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
int16_t y
Position in the map for this object.
static event_registration m
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
void object_update(object *op, int action)
object_update() updates the array which represents the map.
uint8_t temp_anim_speed
Ticks between temporary animation-frames.
key_value * object_get_key_value(const object *ob, const char *key)
Search for a field by key.
uint8_t subtype
Subtype of object.
void move_player_mover(object *op)
This function takes a PLAYERMOVER as an argument, and performs the function of a player mover,...
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
uint8_t anim_speed
Ticks between animation-frames.
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 MOVE_WALK
Object walks.
#define FOR_ABOVE_FINISH()
Finishes FOR_ABOVE_PREPARE().
object clone
An object from which to do object_copy()
sstring add_string(const char *str)
This will add 'str' to the hash table.
#define HEAD(op)
Returns the head part of an object.
MoveType move_type
Type of movement this object uses.
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...
#define FLAG_FREED
Object is in the list of free objects.
#define MSG_TYPE_ITEM
Item related information.
int should_director_abort(const object *op, const object *victim)
Check if op should abort moving victim because of it's race or slaying.
int32_t value
How much money it is worth (or contains)
void object_update_speed(object *op)
Updates the speed of an object.
void legacy_remove_force(object *op)
void legacy_animate_trigger(object *op)
uint8_t type
PLAYER, BULLET, etc.
#define INS_NO_MERGE
Don't try to merge with other items.
int16_t dam
How much damage this object does when hitting.
#define FORCE_TRANSFORMED_ITEM
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
#define FLAG_WIZPASS
The wizard can go through walls.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
MoveType move_on
Move types affected moving on to this space.
int32_t food
How much food in stomach.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
void process_object(object *op)
Main object move function.
#define EVENT_TIME
Triggered each time the object can react/move.
void legacy_move_hole(object *op)
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 FLAG_NO_DROP
Object can't be dropped.
int8_t facing
Object is oriented/facing that way.
#define FREE_OBJ_DROP_ABOVE_FLOOR
If FREE_OBJ_FREE_INVENTORY is not set, drop inventory just above ground instead on top.
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...
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
object * object_create_clone(object *asrc)
Create clone from object to another.
#define FLAG_MONSTER
Will attack players.
#define MAP_WIDTH(m)
Map width.
#define P_OUT_OF_MAP
This space is outside the map.
static std::shared_ptr< inja::Environment > env
Rendering environment.
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.
int32_t weight
Attributes of the object.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
void monster_check_apply_all(object *monster)
Calls monster_check_apply() for all inventory objects.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
int move_object(object *op, int dir)
Try to move op in the direction "dir".
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
static void animate_trigger(object *op)
Animate a TRIGGER.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
#define FLAG_REMOVED
Object is not in any map or invenory.
object * fix_stopped_arrow(object *op)
An ARROW stops moving.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
#define FLAG_FRIENDLY
Will help players.
void change_object(object *op)
Replaces op with its other_arch if it has reached its end of life.
sstring name
The name of the object, obviously...
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
#define SCRIPT_FIX_NOTHING
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly 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_.
#define MSG_TYPE_ITEM_REMOVE
Item removed from inv.
int16_t maxsp
Max spell points.
object * env
Pointer to the object which is the environment.
const typedef char * sstring
static int generate_monster_inv(object *gen)
Will generate a monster according to parameters of generator.
void remove_locked_door(object *op)
Same as remove_door() but for locked doors.
sstring skill
Name of the skill this object uses/grants.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
sstring value
Key's value.
#define GENERATE_SPEED(xyz)
static void remove_force(object *op)
Move for FORCE objects.
void object_unset_flag_inv(object *op, int flag)
Desactivate recursively a flag on an object inventory.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define CLEAR_FLAG(xyz, p)
#define MAP_HEIGHT(m)
Map height.
#define NUM_ANIMATIONS(ob)
int16_t duration
Number of moves (see 'speed') spell lasts.
void check_spell_expiry(object *spell)
Checks if player should be warned of soon expiring spell.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
#define FLAG_ANIMATE
The object looks at archetype for faces.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
void object_fix_multipart(object *tmp)
Ensures specified object has its more parts correctly inserted in map.
struct treasurelist * randomitems
Items to be generated.
#define FLAG_SEE_ANYWHERE
The object will be visible behind walls.
int monster_move(object *op)
Main monster processing routine.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
#define MSG_TYPE_ITEM_CHANGE
Item has changed in some way.
char * spellarg
Optional argument when casting obj::spell.
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
Crossfire Architecture the general intention is to enhance the enjoyability and playability of CF In this code
uint8_t state
How the object was last drawn (animation)
uint32_t nrof
Number of objects.
#define PETMOVE
If the upper four bits of attack_movement are set to this number, the monster follows a player until ...
living stats
Str, Con, Dex, etc.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FLAG_CHANGING
Changes to other_arch when anim is done.
uint32_t attacktype
Bitmask of attacks this object does.
object * object_get_player_container(object *op)
Finds the player carrying an object.
const Animations * temp_animation
A temporary animation.
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
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 FLAG_LIFESAVE
Saves a players' life once, then destr.