Crossfire Server, Trunk
image.c File Reference
#include "global.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "image.h"
#include "assets.h"
+ Include dependency graph for image.c:

Go to the source code of this file.

Functions

static void do_face (const Face *face)
 
void dump_faces (void)
 
uint8_t find_color (const char *name)
 
int find_smooth (const Face *face, const Face **smoothed)
 
const char * get_colorname (uint8_t index)
 
int get_face_fallback (int faceset, uint16_t imageno)
 
int is_valid_faceset (int fsn)
 

Variables

const Faceblank_face
 
static const char *const colorname []
 
const Faceempty_face
 
const Facesmooth_face
 

Detailed Description

Handles face-related stuff, including the actual face data.

Definition in file image.c.

Function Documentation

◆ do_face()

static void do_face ( const Face face)
static

Definition at line 155 of file image.c.

References Face::name, Face::number, and Face::smoothface.

Referenced by dump_faces().

+ Here is the caller graph for this function:

◆ dump_faces()

void dump_faces ( void  )

Dump all faces to stderr, for debugging purposes.

Definition at line 162 of file image.c.

References do_face(), and faces_for_each().

Referenced by server_dump_faces().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_color()

uint8_t find_color ( const char *  name)

Finds a color by name.

Parameters
namecolor name, case-sensitive.
Returns
the matching color in the coloralias if found, 0 otherwise.
Note
0 will actually be black, so there is no way the calling function can tell if an error occurred or not

Definition at line 74 of file image.c.

References colorname, llevError, LOG(), and give::name.

Referenced by FaceLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_smooth()

int find_smooth ( const Face face,
const Face **  smoothed 
)

Find the smooth face for a given face.

Parameters
facethe face to find the smoothing face for
smoothedreturn value: set to smooth face
Returns
1=smooth face found, 0=no smooth face found

Definition at line 101 of file image.c.

References Face::smoothface.

Referenced by send_smooth().

+ Here is the caller graph for this function:

◆ get_colorname()

const char* get_colorname ( uint8_t  index)

Definition at line 85 of file image.c.

References colorname, and npc_dialog::index.

Referenced by FaceWriter::write().

+ Here is the caller graph for this function:

◆ get_face_fallback()

int get_face_fallback ( int  faceset,
uint16_t  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.

Parameters
facesetfaceset to check
imagenoimage number

Definition at line 132 of file image.c.

References face_info::data, face_sets::faces, face_sets::fallback, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), and face_sets::prefix.

Referenced by esrv_send_face(), get_face_fallback(), process_map(), send_image_sums(), and test_faceset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_valid_faceset()

int is_valid_faceset ( int  fsn)

Checks specified faceset is valid

Parameters
fsnfaceset number

Definition at line 116 of file image.c.

References find_faceset().

Referenced by main(), and set_up_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ blank_face

const Face* blank_face

Following can just as easily be pointers, but it is easier to keep them like this.

Definition at line 35 of file image.c.

Referenced by add_abilities(), animate_object(), artifact_get_face(), Faces::Faces(), knowledge_monster_face(), magic_mapping_mark(), magic_mapping_mark_recursive(), object_clear(), recipe_get_face(), tear_down_wall(), update_position(), and write_rune().

◆ colorname

const char* const colorname[]
static
Initial value:
= {
"black",
"white",
"blue",
"red",
"orange",
"light_blue",
"dark_orange",
"green",
"light_green",
"grey",
"brown",
"yellow",
"khaki"
}

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 45 of file image.c.

Referenced by find_color(), and get_colorname().

◆ empty_face

const Face * empty_face

Definition at line 35 of file image.c.

Referenced by esrv_draw_look(), esrv_send_inventory(), and Faces::Faces().

◆ smooth_face

const Face * smooth_face

Definition at line 35 of file image.c.

Referenced by Faces::Faces(), and send_smooth().