Crossfire Server  1.75.0
AnimationWriter.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2020 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "AnimationWriter.h"
14 
16  stringbuffer_append_printf(buf, "animation %s\n", anim->name);
17  if (anim->facings != 0) {
18  stringbuffer_append_printf(buf, "facings %d\n", anim->facings);
19  }
20  for (uint8_t face = 0; face < anim->num_animations; face++) {
21  stringbuffer_append_string(buf, anim->faces[face]->name);
22  stringbuffer_append_string(buf, "\n");
23  }
24  stringbuffer_append_string(buf, "mina\n");
25 }
This represents one animation.
Definition: face.h:25
uint8_t num_animations
How many different faces to animate, size of the faces array.
Definition: face.h:27
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
virtual void write(const Animations *anim, StringBuffer *buf)
Write the specified asset to the StringBuffer.
uint8_t facings
How many facings (1,2,4,8).
Definition: face.h:28
const Face ** faces
The actual faces for the animation.
Definition: face.h:30
sstring name
Name of the animation sequence.
Definition: face.h:26
StringBuffer * buf
Definition: readable.cpp:1563
A buffer that will be expanded as content is added to it.
sstring name
Face name, as used by archetypes and such.
Definition: face.h:19