OpenTTD Source 20250331-master-g3c15e0c889
base_media_graphics.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef BASE_MEDIA_GRAPHICS_H
11#define BASE_MEDIA_GRAPHICS_H
12
13#include "base_media_base.h"
14
25
27enum BlitterType : uint8_t {
30};
31
32struct GRFConfig;
33
34template <> struct BaseSetTraits<struct GraphicsSet> {
35 static constexpr size_t num_files = MAX_GFT;
36 static constexpr bool search_in_tars = true;
37 static constexpr std::string_view set_type = "graphics";
38};
39
41struct GraphicsSet : BaseSet<GraphicsSet> {
42private:
43 mutable std::unique_ptr<GRFConfig> extra_cfg;
44public:
47
50
51 bool FillSetDetails(const IniFile &ini, const std::string &path, const std::string &full_filename);
52 GRFConfig *GetExtraConfig() const { return this->extra_cfg.get(); }
54 bool IsConfigurable() const;
55 void CopyCompatibleConfig(const GraphicsSet &src);
56
57 static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir);
58};
59
61class BaseGraphics : public BaseMedia<GraphicsSet> {
62public:
64 struct Ini {
65 std::string name;
66 uint32_t shortname;
67 uint32_t extra_version;
68 std::vector<uint32_t> extra_params;
69 };
70 static inline Ini ini_data;
71};
72
73#endif /* BASE_MEDIA_BASE_H */
Generic functions for replacing base data (graphics, sounds).
BlitterType
Blitter type for base graphics sets.
@ BLT_32BPP
Base set has both 8 bpp and 32 bpp sprites.
@ BLT_8BPP
Base set has 8 bpp sprites only.
GraphicsFileType
Types of graphics in the base graphics set.
@ GFT_TOYLAND
Landscape replacement sprites for toyland.
@ GFT_LOGOS
Logos, landscape icons and original terrain generator sprites.
@ MAX_GFT
We are looking for this amount of GRFs.
@ GFT_EXTRA
Extra sprites that were not part of the original sprites.
@ GFT_ARCTIC
Landscape replacement sprites for arctic.
@ GFT_TROPICAL
Landscape replacement sprites for tropical.
@ GFT_BASE
Base sprites for all climates.
All data/functions related with replacing the base graphics.
Base for all base media (graphics, sounds)
Subdirectory
The different kinds of subdirectories OpenTTD uses.
PaletteType
Palettes OpenTTD supports.
Definition gfx_type.h:340
Values loaded from config file.
uint32_t extra_version
version of the extra GRF
std::vector< uint32_t > extra_params
parameters for the extra GRF
uint32_t shortname
unique key for base set
Defines the traits of a BaseSet type.
Information about a single base set.
Information about GRF, used in the game and (part of it) in savegames.
All data of a graphics set.
std::unique_ptr< GRFConfig > extra_cfg
Parameters for extra GRF.
PaletteType palette
Palette of this graphics set.
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir)
Calculate and check the MD5 hash of the supplied GRF.
Definition gfxinit.cpp:422
BlitterType blitter
Blitter of this graphics set.
GRFConfig & GetOrCreateExtraConfig() const
Return configuration for the extra GRF, or lazily create it.
Definition gfxinit.cpp:377
Ini file that supports both loading and saving.
Definition ini_type.h:88
Structure holding filename and MD5 information about a single file.
ChecksumResult
The result of a checksum check.