 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
23 : m_faces(faces), m_animations(animations), m_tracker(tracker)
29 int num_frames = 0, i;
45 if (!strncmp(
buf,
"mina", 4)) {
46 anim->
faces =
static_cast<const Face **
>(malloc(
sizeof(
Face*)*num_frames));
47 for (i = 0; i < num_frames; i++)
48 anim->
faces[i] = faces[i];
50 if (num_frames <= 1) {
51 LOG(
llevDebug,
"anim: %s has less then two faces in %s\n",
52 anim->
name, full_path.c_str());
54 if (num_frames % anim->
facings) {
55 LOG(
llevDebug,
"anim: %s has %d frames: not a multiple of facings (%d) in %s\n",
56 anim->
name, num_frames,
57 anim->
facings, full_path.c_str());
64 }
else if (!strncmp(
buf,
"facings", 7)) {
66 LOG(
llevDebug,
"anim: %s has 0 facings in %s (line %s)\n",
67 anim->
name, full_path.c_str(),
buf);
72 faces[num_frames++] =
face;
82 if (*
buf ==
'#' || *
buf ==
'\0')
84 if (!strncmp(
buf,
"end", 3)) {
95 if (!strncmp(
buf,
"smoothface ", 11)) {
99 char *space = strchr(
buf + 11,
' ');
101 LOG(
llevError,
"Invalid 'smoothface' %s in %s\n",
buf, filename.c_str());
113 if (!strncmp(
buf,
"face ", 5)) {
117 LOG(
llevError,
"'face' within a 'face' in %s\n", filename.c_str());
123 on_face =
static_cast<Face *
>(calloc(1,
sizeof(
Face)));
130 if (!strncmp(
buf,
"animation ", 10)) {
132 LOG(
llevError,
"faces: 'animation' in 'face' block is deprecated in %s\n", filename.c_str());
137 if (on_face == NULL) {
138 LOG(
llevError,
"faces: got line with no face set in %s: %s\n", filename.c_str(),
buf);
139 }
else if (!strncmp(
buf,
"visibility", 10)) {
141 }
else if (!strncmp(
buf,
"magicmap", 8)) {
144 }
else if (!strncmp(
buf,
"is_floor", 8)) {
145 int value = atoi(
buf+9);
149 LOG(
llevError,
"faces: unknown line in file %s: %s\n", filename.c_str(),
buf);
153 LOG(
llevError,
"unfinished face in %s\n", filename.c_str());
sstring name
Face name, as used by archetypes and such.
New face structure - this enforces the notion that data is face by face only - you can not change the...
Face * smoothface
Smoothed face for this, NULL for none.
FaceLoader(Faces *faces, AllAnimations *animations, AssetsTracker *tracker)
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void loadAnimationBlock(BufferReader *reader, const std::string &full_path, const char *animation_name)
virtual void load(BufferReader *reader, const std::string &filename) override
Load assets from the specified reader.
const Face * find_face(const char *name)
Base class to be informed of where an asset is defined.
T * define(const Key &name, T *asset)
Define an asset, erasing an existing one.
sstring add_string(const char *str)
This will add 'str' to the hash table.
virtual void assetDefined(const archetype *asset, const std::string &filename)
Function called when an asset is defined in a file.
uint8_t facings
How many facings (1,2,4,8).
T * get(const Key &name)
Get a named asset.
uint8_t num_animations
How many different faces to animate, size of the faces array.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
AssetsTracker * m_tracker
const Face ** faces
The actual faces for the animation.
uint8_t visibility
How visible is the face compared to other faces, highest wins.
This represents one animation.
uint8_t find_color(const char *name)
Finds a color by name.
if you malloc the data for the buffer
uint8_t magicmap
Color to show this in magic map.
AllAnimations * m_animations
sstring name
Name of the animation sequence.
@ llevDebug
Only for debugging purposes.
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the and treasurelist definitions into a single or trs file and the graphics into a face(metadata) and .tar(bitmaps) file
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.