Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Data Structures | |
struct | bmappair |
Functions | |
static void | check_faceset_fallback (int faceset, int togo) |
static int | compar (const struct bmappair *a, const struct bmappair *b) |
static uint8 | find_color (const char *name) |
unsigned | find_face (const char *name, unsigned error) |
int | find_smooth (uint16 face, uint16 *smoothed) |
void | free_all_images (void) |
void | free_socket_images (void) |
int | get_face_fallback (int faceset, int imageno) |
int | is_valid_faceset (int fsn) |
void | read_bmap_names (void) |
void | read_client_images (void) |
static void | read_face_data (void) |
int | read_smooth (void) |
Variables | |
New_Face * | blank_face |
static const char *const | colorname [] |
New_Face * | empty_face |
face_sets | facesets [MAX_FACE_SETS] |
New_Face * | new_faces |
static int | nroffiles = 0 |
int | nrofpixmaps = 0 |
New_Face * | smooth_face |
static struct bmappair * | xbm = NULL |
Handles face-related stuff, including the actual face data.
Definition in file image.c.
|
static |
Checks fallback are correctly defined. This is a simple recursive function that makes sure the fallbacks are all proper (eg, the fall back to defined sets, and also eventually fall back to 0). At the top level, togo is set to MAX_FACE_SETS. If togo gets to zero, it means we have a loop. This is only run when we first load the facesets.
Definition at line 435 of file image.c.
References face_sets::fallback, llevError, and LOG().
Referenced by read_client_images().
Used for bsearch searching.
Definition at line 106 of file image.c.
References bmappair::name.
Referenced by find_face(), and read_bmap_names().
|
static |
Finds a color by name.
name | color name, case-sensitive. |
Definition at line 123 of file image.c.
References colorname, llevError, and LOG().
Referenced by read_bmap_names(), and read_face_data().
unsigned find_face | ( | const char * | name, |
unsigned | error | ||
) |
This returns an the face number of face 'name'. Number is constant during an invocation, but not necessarily between versions (this is because the faces are arranged in alphabetical order, so if a face is removed or added, all faces after that will now have a different number.
name | face to search for |
error | value to return if face was not found. |
Definition at line 324 of file image.c.
References compar(), bmappair::name, nroffiles, and bmappair::number.
Referenced by cfapi_system_find_face(), init_anim(), read_bmap_names(), read_face_data(), read_smooth(), set_object_face_main(), set_object_face_other(), and transport_type_apply().
Find the smooth face for a given face.
face | the face to find the smoothing face for |
smoothed | return value: set to smooth face |
Definition at line 401 of file image.c.
References nrofpixmaps, and new_face_struct::smoothface.
Referenced by send_smooth().
void free_all_images | ( | void | ) |
Deallocates memory allocated by read_bmap_names() and read_smooth().
Definition at line 418 of file image.c.
References bmappair::name, and nroffiles.
Referenced by cleanup().
void free_socket_images | ( | void | ) |
Frees all faceset information
Definition at line 584 of file image.c.
References MAX_FACE_SETS, and nrofpixmaps.
Referenced by free_all_newserver().
int get_face_fallback | ( | int | faceset, |
int | imageno | ||
) |
This returns the set we will actually use when sending a face. This is used because the image files may be sparse. This function is recursive. imageno is the face number we are trying to send
If face is not found in specified faceset, tries with 'fallback' faceset.
faceset | faceset to check |
imageno | image number |
Definition at line 614 of file image.c.
References get_face_fallback(), llevError, and LOG().
Referenced by esrv_send_face(), get_face_fallback(), process_map(), and send_image_sums().
int is_valid_faceset | ( | int | fsn | ) |
Checks specified faceset is valid
fsn | faceset number |
Definition at line 575 of file image.c.
References FALSE, MAX_FACE_SETS, and TRUE.
Referenced by main(), and set_up_cmd().
void read_bmap_names | ( | void | ) |
This reads the bmaps file to get all the bitmap names and stuff. It only needs to be done once, because it is player independent (ie, what display the person is on will not make a difference.)
Definition at line 198 of file image.c.
References BLANK_FACE_NAME, bmaps_checksum, compar(), Settings::datadir, EMPTY_FACE_NAME, FACE_FLOOR, find_color(), find_face(), llevDebug, llevError, LOG(), new_face_struct::magicmap, MAX_BUF, new_face_struct::name, bmappair::name, nroffiles, nrofpixmaps, new_face_struct::number, bmappair::number, read_face_data(), ROTATE_RIGHT, settings, SMOOTH_FACE_NAME, new_face_struct::smoothface, snprintf(), strdup_local(), strerror_local(), and new_face_struct::visibility.
Referenced by cctk_init_std_archetypes(), and init_library().
void read_client_images | ( | void | ) |
Loads all the image types into memory.
This way, we can easily send them to the client. We should really do something better than abort on any errors - on the other hand, these are all fatal to the server (can't work around them), but the abort just seems a bit messy (exit would probably be better.)
Couple of notes: We assume that the faces are in a continous block. This works fine for now, but this could perhaps change in the future
Function largely rewritten May 2000 to be more general purpose. The server itself does not care what the image data is - to the server, it is just data it needs to allocate. As such, the code is written to do such.
Definition at line 471 of file image.c.
References check_faceset_fallback(), face_info::checksum, close_and_delete(), face_sets::comment, face_info::data, Settings::datadir, face_info::datalen, face_sets::extension, face_sets::faces, face_sets::fallback, face_sets::fullname, HUGE_BUF, llevDebug, llevError, LOG(), MAX_FACE_SETS, MAX_IMAGE_SIZE, nrofpixmaps, open_and_uncompress(), face_sets::prefix, ROTATE_RIGHT, settings, face_sets::size, snprintf(), and strdup_local().
Referenced by init_server(), and main().
|
static |
This reads the lib/faces file, getting color and visibility information. it is called by read_bmap_names().
Definition at line 141 of file image.c.
References Settings::datadir, FACE_FLOOR, find_color(), find_face(), llevDebug, llevError, LOG(), new_face_struct::magicmap, MAX_BUF, settings, snprintf(), strerror_local(), and new_face_struct::visibility.
Referenced by read_bmap_names().
int read_smooth | ( | void | ) |
Reads the smooth file to know how to smooth datas. the smooth file if made of 2 elements lines. lines starting with # are comment the first element of line is face to smooth the next element is the 16x2 faces picture used for smoothing
Definition at line 348 of file image.c.
References Settings::datadir, find_face(), llevDebug, llevError, LOG(), MAX_BUF, settings, new_face_struct::smoothface, snprintf(), and strerror_local().
Referenced by cctk_init_std_archetypes(), and init_library().
New_Face* blank_face |
Following can just as easily be pointers, but it is easier to keep them like this.
Definition at line 66 of file image.c.
Referenced by add_abilities(), animate_object(), CREUtils::artifactNode(), clear_object(), magic_mapping_mark(), magic_mapping_mark_recursive(), tear_down_wall(), update_position(), and write_rune().
|
static |
The only thing this table is used for now is to translate the colorname in the magicmap field of the face into a numeric index that is then sent to the client for magic map commands. The order of this table must match that of the NDI colors in include/newclient.h.
Definition at line 87 of file image.c.
Referenced by find_color().
New_Face * empty_face |
Definition at line 66 of file image.c.
Referenced by esrv_draw_look().
face_sets facesets[MAX_FACE_SETS] |
All facesets
Definition at line 78 of file image.c.
Referenced by esrv_send_face(), CREPixmap::getIcon(), main(), process_map(), send_image_info(), and send_image_sums().
New_Face* new_faces |
Definition at line 38 of file image.c.
Referenced by cfapi_object_set_property(), common_process_projectile(), esrv_send_face(), CREResourcesWindow::fillFaces(), send_image_sums(), set_object_face_main(), set_object_face_other(), transport_type_apply(), and trap_show().
|
static |
nroffiles is the actual number of bitmaps defined.
Definition at line 70 of file image.c.
Referenced by find_face(), free_all_images(), and read_bmap_names().
int nrofpixmaps = 0 |
nrofpixmaps is the number of bitmaps loaded. With the automatic generation of the bmaps file, this is now equal to nroffiles.
Definition at line 76 of file image.c.
Referenced by do_server(), esrv_send_face(), CREResourcesWindow::fillFaces(), find_smooth(), free_socket_images(), init_connection(), main(), read_bmap_names(), read_client_images(), send_image_info(), and send_image_sums().
New_Face * smooth_face |
Definition at line 66 of file image.c.
Referenced by send_smooth().