Defines | Functions | Variables

# gfxinit.cpp File Reference

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 "base_media_func.h"`
`#include "table/sprites.h"`
`#include "table/landscape_sprite.h"`

Go to the source code of this file.

## Defines
#define | SET_TYPE "graphics"
## Functions
static uint | LoadGrfFile (const char *filename, uint load_index, int file_index)
static void | LoadSpritesIndexed (int file_index, uint *sprite_id, const SpriteID *index_tbl)
static void | LoadGrfIndexed (const char *filename, const SpriteID *index_tbl, int file_index)
void | CheckExternalFiles ()
| Checks whether the MD5 checksums of the files are correct.
static void | LoadSpriteTables ()
| Actually load the sprite tables.
void | GfxLoadSprites ()
| Initialise and load all the sprites.
## Variables
bool | _palette_remap_grf [MAX_FILE_SLOTS]
| Whether the given NewGRFs must get a palette remap from windows to DOS or not.
static const SpriteID *const | _landscape_spriteindexes []
static const char *const | _graphics_file_names [] = { "base", "logos", "arctic", "tropical", "toyland", "extra" }
| Names corresponding to the GraphicsFileType.

## Detailed Description

Initializing of the (GRF) graphics.

Definition in file gfxinit.cpp.

## Function Documentation

void CheckExternalFiles | ( |  | ) |

Checks whether the MD5 checksums of the files are correct.

Note:
  Also checks sample.cat and other required non-NewGRF GRFs for corruption.

Definition at line 88 of file gfxinit.cpp.

References MD5File::CheckMD5(), MD5File::CR_MATCH, MD5File::CR_MISMATCH, DATA_DIR, DEBUG, MD5File::filename, BaseSet< T, Tnum_files, Tsubdir >::files, BaseSet< T, Tnum_files, Tsubdir >::GetNumInvalid(), BaseMedia< SoundsSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), lastof, MD5File::missing_warning, BaseSet< T, Tnum_files, Tsubdir >::name, BaseSet< SoundsSet, 1, DATA_DIR >::NUM_FILES, BaseSet< GraphicsSet, MAX_GFT, DATA_DIR >::NUM_FILES, seprintf(), and ShowInfoF().

Referenced by BaseMedia< Tbase_set >::SetSet().

void GfxLoadSprites | ( |  | ) |

Initialise and load all the sprites.

Definition at line 212 of file gfxinit.cpp.

References _settings_game, DEBUG, GameSettings::game_creation, GameCreationSettings::landscape, LoadSpriteTables(), and UpdateCursorSize().

Referenced by AfterLoadGame(), GenerateWorld(), and ReloadNewGRFData().

static void LoadSpriteTables | ( |  | ) | `[static]`

Actually load the sprite tables.

Definition at line 131 of file gfxinit.cpp.

References _grfconfig, _palette_remap_grf, _settings_game, ClrBit(), MD5File::filename, BaseSet< T, Tnum_files, Tsubdir >::files, FillGRFDetails(), GRFConfig::flags, GameSettings::game_creation, GCF_INIT_ONLY, BaseMedia< GraphicsSet >::GetUsedSet(), GFT_ARCTIC, GFT_BASE, GFT_EXTRA, GFT_LOGOS, InitializeUnicodeGlyphMap(), GameCreationSettings::landscape, GRFConfig::next, PAL_DOS, PAL_WINDOWS, GRFConfig::palette, and GraphicsSet::palette.

Referenced by GfxLoadSprites().

## Variable Documentation

const SpriteID* const _landscape_spriteindexes[]`[static]`

Initial value:

     {
      _landscape_spriteindexes_1,
      _landscape_spriteindexes_2,
      _landscape_spriteindexes_3,
    }

Definition at line 30 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 26 of file gfxinit.cpp.

Referenced by SpriteLoaderGrf::LoadSprite(), LoadSpriteTables(), and ReadSprite().