Freeciv-3.2
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "capability.h"
#include "fcintl.h"
#include "log.h"
#include "registry.h"
#include "string_vector.h"
#include "game.h"
#include "citydlg_common.h"
#include "client_main.h"
#include "dialogs.h"
#include "gui_tilespec.h"
#include "mapview.h"
#include "sprite.h"
#include "themespec.h"
#include "speclist.h"
#include "spechash.h"
Go to the source code of this file.
Data Structures | |
struct | specfile |
struct | small_sprite |
struct | theme |
Variables | |
struct theme * | active_theme = NULL |
Definition at line 1037 of file themespec.c.
#define ADD_SPRITE_FULL | ( | s | ) | ADD_SPRITE(s, TRUE, FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET) |
Definition at line 1045 of file themespec.c.
#define ADD_SPRITE_SIMPLE | ( | s | ) | ADD_SPRITE(s, TRUE, 0, 0) |
Definition at line 1044 of file themespec.c.
#define FULL_TILE_X_OFFSET ((t->normal_tile_width - t->full_tile_width) / 2) |
Definition at line 1034 of file themespec.c.
#define FULL_TILE_Y_OFFSET (t->normal_tile_height - t->full_tile_height) |
Definition at line 1035 of file themespec.c.
Definition at line 925 of file themespec.c.
Definition at line 933 of file themespec.c.
Definition at line 948 of file themespec.c.
#define SET_SPRITE_OPT | ( | field, | |
tag | |||
) | t->sprites.field = theme_load_sprite(t, tag) |
Definition at line 945 of file themespec.c.
Definition at line 128 of file themespec.c.
#define small_sprite_hash_iterate_end HASH_ITERATE_END |
Definition at line 131 of file themespec.c.
#define small_sprite_list_iterate | ( | list, | |
pitem | |||
) | TYPED_LIST_ITERATE(struct small_sprite, list, pitem) |
Definition at line 116 of file themespec.c.
#define small_sprite_list_iterate_end LIST_ITERATE_END |
Definition at line 118 of file themespec.c.
Definition at line 62 of file themespec.c.
Definition at line 87 of file themespec.c.
#define specfile_list_iterate_end LIST_ITERATE_END |
Definition at line 89 of file themespec.c.
#define SPECHASH_IDATA_TYPE struct small_sprite * |
Definition at line 122 of file themespec.c.
#define SPECHASH_IKEY_COMP genhash_str_comp_func |
Definition at line 124 of file themespec.c.
#define SPECHASH_IKEY_COPY genhash_str_copy_func |
Definition at line 125 of file themespec.c.
#define SPECHASH_IKEY_FREE genhash_str_free_func |
Definition at line 126 of file themespec.c.
Definition at line 121 of file themespec.c.
#define SPECHASH_IKEY_VAL genhash_str_val_func |
Definition at line 123 of file themespec.c.
#define SPECHASH_TAG small_sprite |
Definition at line 120 of file themespec.c.
Definition at line 83 of file themespec.c.
#define SPECLIST_TAG small_sprite |
Definition at line 83 of file themespec.c.
Definition at line 84 of file themespec.c.
#define SPECLIST_TYPE struct small_sprite |
Definition at line 84 of file themespec.c.
#define THEMESPEC_SDL3_CAPSTR "+Freeciv-3.2-sdl3-themespec duplicates_ok" |
Definition at line 50 of file themespec.c.
#define THEMESPEC_SUFFIX ".themespec" |
Definition at line 69 of file themespec.c.
|
static |
Checks options in filename match what we require and support. Die if not. 'which' should be "themespec" or "spec".
Definition at line 256 of file themespec.c.
Returns a static list of themes available on the system by searching all data directories for files matching THEMESPEC_SUFFIX. The list is NULL-terminated.
Definition at line 200 of file themespec.c.
Loads the given graphics file (found in the data path) into a newly allocated sprite.
Definition at line 456 of file themespec.c.
Referenced by theme_ensure_big_sprite(), and theme_load_sprite().
Scan all sprites declared in the given specfile. This means that the positions of the sprites in the big_sprite are saved in the small_sprite structs.
Definition at line 530 of file themespec.c.
Return theme's default font size.
Definition at line 177 of file themespec.c.
Ensure that the big sprite of the given spec file is loaded.
Definition at line 485 of file themespec.c.
Frees any internal buffers which are created by theme_load_sprite. Should be called after the last (for a given period of time) theme_load_sprite call. This saves a fair amount of memory, but it will take extra time the next time we start loading sprites again.
Definition at line 974 of file themespec.c.
Return the path within the data directories where the font file can be found. (It is left up to the GUI code to load and unload this file.)
Definition at line 169 of file themespec.c.
Free resources allocated for the theme.
Definition at line 317 of file themespec.c.
Free all sprites for the theme.
Definition at line 1065 of file themespec.c.
Frees the themespec toplevel data, in preparation for re-reading it.
See themespec_read_toplevel().
Definition at line 294 of file themespec.c.
struct theme_background_system * theme_get_background_system | ( | const struct theme * | t | ) |
Return the theme's background system.
Definition at line 1114 of file themespec.c.
struct theme_color_system * theme_get_color_system | ( | const struct theme * | t | ) |
Return the theme's color system.
Definition at line 1122 of file themespec.c.
Return the name of the given theme.
Definition at line 160 of file themespec.c.
Loads the sprite. If the sprite is already loaded a reference counter is increased. Can return NULL if the sprite couldn't be loaded.
Definition at line 855 of file themespec.c.
Load the tiles; requires themespec_read_toplevel() called previously. Leads to tile_sprites being allocated and filled with pointers to sprites. Also sets up and populates sprite_hash, and calls func to initialize 'sprites' structure.
Definition at line 990 of file themespec.c.
struct sprite * theme_lookup_sprite_tag_alt | ( | struct theme * | t, |
enum log_level | level, | ||
const char * | tag, | ||
const char * | alt, | ||
const char * | what, | ||
const char * | name | ||
) |
Lookup sprite to match tag, or else to match alt if don't find, or else return NULL, and emit log message.
Definition at line 1000 of file themespec.c.
Initialize 'sprites' structure based on hardwired tags which the client always requires.
Definition at line 958 of file themespec.c.
Initialize.
Definition at line 185 of file themespec.c.
Finds and reads the toplevel themespec file based on given name. Sets global variables, including tile sizes and full names for intro files.
Definition at line 721 of file themespec.c.
Unload all sprites from theme sprite hash (the hash itself is left intact).
Definition at line 1051 of file themespec.c.
Unloads the sprite. Decrease the reference counter. If the last reference is removed the sprite is freed.
Definition at line 904 of file themespec.c.
Gets full filename for themespec file, based on input name. Returned data is allocated, and freed by user as required. Input name may be null, in which case uses default. Falls back to default if can't find specified name; dies if can't find default.
Definition at line 233 of file themespec.c.
Returns the correct name of the gfx file (with path and extension) Must be free'd when no longer used
Definition at line 690 of file themespec.c.
Read a new themespec in from scratch.
Unlike the initial reading code, which reads pieces one at a time, this gets rid of the old data and reads in the new all at once. If the new theme fails to load the old theme may be reloaded; otherwise the client will exit. If a NULL name is given the current theme will be reread.
It will also call the necessary functions to redraw the graphics.
Definition at line 376 of file themespec.c.
Read a new themespec in when first starting the game.
Call this function with the (guessed) name of the theme, when starting the client.
Definition at line 334 of file themespec.c.
Definition at line 154 of file themespec.c.