OpenTTD
|
Initializing of the (GRF) graphics. More...
#include "stdafx.h"
#include "fios.h"
#include "newgrf.h"
#include "3rdparty/md5/md5.h"
#include "fontcache.h"
#include "gfx_func.h"
#include "transparency.h"
#include "blitter/factory.hpp"
#include "video/video_driver.hpp"
#include "window_func.h"
#include "base_media_func.h"
#include "table/sprites.h"
#include "safeguards.h"
#include "table/landscape_sprite.h"
Go to the source code of this file.
Macros | |
#define | SET_TYPE "graphics" |
Functions | |
static uint | LoadGrfFile (const char *filename, uint load_index, int file_index) |
Load an old fashioned GRF file. More... | |
static void | LoadGrfFileIndexed (const char *filename, const SpriteID *index_tbl, int file_index) |
Load an old fashioned GRF file to replace already loaded sprites. More... | |
void | CheckExternalFiles () |
Checks whether the MD5 checksums of the files are correct. More... | |
static void | LoadSpriteTables () |
Actually load the sprite tables. More... | |
static bool | SwitchNewGRFBlitter () |
Check blitter needed by NewGRF config and switch if needed. More... | |
void | CheckBlitter () |
Check whether we still use the right blitter, or use another (better) one. More... | |
void | GfxLoadSprites () |
Initialise and load all the sprites. More... | |
Variables | |
bool | _palette_remap_grf [MAX_FILE_SLOTS] |
Whether the given NewGRFs must get a palette remap from windows to DOS or not. More... | |
static const SpriteID *const | _landscape_spriteindexes [] |
Offsets for loading the different "replacement" sprites in the files. More... | |
static const char *const | _graphics_file_names [] = { "base", "logos", "arctic", "tropical", "toyland", "extra" } |
Names corresponding to the GraphicsFileType. | |
Initializing of the (GRF) graphics.
Definition in file gfxinit.cpp.
void CheckBlitter | ( | ) |
Check whether we still use the right blitter, or use another (better) one.
Definition at line 327 of file gfxinit.cpp.
References SwitchNewGRFBlitter().
void CheckExternalFiles | ( | ) |
Checks whether the MD5 checksums of the files are correct.
Definition at line 121 of file gfxinit.cpp.
References BASESET_DIR, GraphicsSet::CheckMD5(), MD5File::CR_MATCH, MD5File::CR_MISMATCH, DEBUG, MD5File::filename, BaseSet< T, Tnum_files, Tsearch_in_tars >::files, BaseSet< T, Tnum_files, Tsearch_in_tars >::GetNumInvalid(), BaseMedia< SoundsSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), lastof, MD5File::missing_warning, BaseSet< T, Tnum_files, Tsearch_in_tars >::name, BaseSet< GraphicsSet, MAX_GFT, true >::NUM_FILES, BaseSet< SoundsSet, 1, true >::NUM_FILES, and seprintf().
Referenced by BaseMedia< GraphicsSet >::SetSet().
void GfxLoadSprites | ( | ) |
Initialise and load all the sprites.
Definition at line 337 of file gfxinit.cpp.
References _settings_game, DEBUG, GameSettings::game_creation, GameCreationSettings::landscape, and SwitchNewGRFBlitter().
Referenced by ReloadNewGRFData().
|
static |
Load an old fashioned GRF file.
filename | The name of the file to open. |
load_index | The offset of the first sprite. |
file_index | The Fio offset to load the file in. |
Definition at line 50 of file gfxinit.cpp.
References BASESET_DIR, DEBUG, FioOpenFile(), FioReadByte(), GetGRFContainerVersion(), LoadNextSprite(), MAX_SPRITES, ReadGRFSpriteOffsets(), and usererror().
Referenced by LoadSpriteTables().
|
static |
Load an old fashioned GRF file to replace already loaded sprites.
filename | The name of the file to open. |
index_tlb | The offsets of each of the sprites. |
file_index | The Fio offset to load the file in. |
Definition at line 87 of file gfxinit.cpp.
References BASESET_DIR, DEBUG, FioOpenFile(), FioReadByte(), GetGRFContainerVersion(), ReadGRFSpriteOffsets(), and usererror().
|
static |
Actually load the sprite tables.
Definition at line 164 of file gfxinit.cpp.
References _palette_remap_grf, _settings_game, MD5File::filename, BaseSet< T, Tnum_files, Tsearch_in_tars >::files, FIRST_GRF_SLOT, GameSettings::game_creation, BaseMedia< GraphicsSet >::GetUsedSet(), GFT_BASE, GFT_LOGOS, GameCreationSettings::landscape, LoadGrfFile(), PAL_DOS, and GraphicsSet::palette.
|
static |
Check blitter needed by NewGRF config and switch if needed.
< 0: no support, 1: do support, 2: both
Definition at line 252 of file gfxinit.cpp.
References _blitter_autodetected, GraphicsSet::blitter, BLT_32BPP, BlitterFactory::GetCurrentBlitter(), and BaseMedia< GraphicsSet >::GetUsedSet().
Referenced by CheckBlitter(), and GfxLoadSprites().
|
static |
Offsets for loading the different "replacement" sprites in the files.
Definition at line 37 of file gfxinit.cpp.
bool _palette_remap_grf[MAX_FILE_SLOTS] |
Whether the given NewGRFs must get a palette remap from windows to DOS or not.
Definition at line 32 of file gfxinit.cpp.
Referenced by LoadSpriteTables().