tron@2186: /* $Id$ */ tron@2186: belugas@6674: /** @file newgrf.h */ belugas@6674: dominik@455: #ifndef NEWGRF_H dominik@455: #define NEWGRF_H dominik@455: rubidium@8709: #include "town_type.h" peter1138@5228: #include "newgrf_config.h" peter1138@6469: #include "cargotype.h" rubidium@8709: #include "industry_type.h" rubidium@9283: #include "station_type.h" pasky@463: rubidium@6574: enum GrfLoadingStage { peter1138@5228: GLS_FILESCAN, peter1138@5329: GLS_SAFETYSCAN, peter1138@5225: GLS_LABELSCAN, peter1138@5225: GLS_INIT, peter1138@6685: GLS_RESERVE, peter1138@5225: GLS_ACTIVATION, peter1138@5225: GLS_END, rubidium@6574: }; peter1138@5225: rubidium@5838: DECLARE_POSTFIX_INCREMENT(GrfLoadingStage); rubidium@5838: maedhros@7037: enum GrfMiscBit { maedhros@7037: GMB_DESERT_TREES_FIELDS = 0, // Unsupported. maedhros@7037: GMB_DESERT_PAVED_ROADS = 1, maedhros@7037: GMB_FIELD_BOUNDING_BOX = 2, // Unsupported. maedhros@7037: GMB_TRAIN_WIDTH_32_PIXELS = 3, maedhros@7037: GMB_AMBIENT_SOUND_CALLBACK = 4, // Unsupported. maedhros@7037: GMB_CATENARY_ON_3RD_TRACK = 5, // Unsupported. maedhros@7037: }; rubidium@5838: peter1138@9037: enum GrfSpecFeature { peter1138@9037: GSF_TRAIN, peter1138@9037: GSF_ROAD, peter1138@9037: GSF_SHIP, peter1138@9037: GSF_AIRCRAFT, peter1138@9037: GSF_STATION, peter1138@9037: GSF_CANAL, peter1138@9037: GSF_BRIDGE, peter1138@9037: GSF_TOWNHOUSE, peter1138@9037: GSF_GLOBALVAR, peter1138@9037: GSF_INDUSTRYTILES, peter1138@9037: GSF_INDUSTRIES, peter1138@9037: GSF_CARGOS, peter1138@9037: GSF_SOUNDFX, peter1138@9037: GSF_END, peter1138@9037: }; peter1138@9037: rubidium@6574: struct GRFLabel { Darkvater@3561: byte label; Darkvater@3561: uint32 nfo_line; Darkvater@3561: uint32 pos; Darkvater@3561: struct GRFLabel *next; rubidium@6574: }; Darkvater@3561: rubidium@6574: struct GRFFile { dominik@455: char *filename; belugas@8660: bool is_ottdfile; dominik@455: uint32 grfid; dominik@455: uint16 sprite_offset; peter1138@3640: byte grf_version; rubidium@6574: GRFFile *next; dominik@455: dominik@455: /* A sprite group contains all sprites of a given vehicle (or multiple dominik@455: * vehicles) when carrying given cargo. It consists of several sprite dominik@455: * sets. Group ids are refered as "cargo id"s by TTDPatch dominik@455: * documentation, contributing to the global confusion. dominik@455: * dominik@455: * A sprite set contains all sprites of a given vehicle carrying given dominik@455: * cargo at a given *stage* - that is usually its load stage. Ie. you dominik@455: * can have a spriteset for an empty wagon, wagon full of coal, dominik@455: * half-filled wagon etc. Each spriteset contains eight sprites (one dominik@455: * per direction) or four sprites if the vehicle is symmetric. */ dominik@455: peter1138@3707: SpriteID spriteset_start; dominik@455: int spriteset_numsets; dominik@455: int spriteset_numents; dominik@455: int spriteset_feature; dominik@455: dominik@455: int spritegroups_count; peter1138@3865: struct SpriteGroup **spritegroups; dominik@455: peter1138@4656: uint sound_offset; peter1138@4656: peter1138@3768: StationSpec **stations; maedhros@6658: HouseSpec **housespec; belugas@7255: IndustrySpec **industryspec; belugas@7255: IndustryTileSpec **indtspec; tron@2345: tron@2345: uint32 param[0x80]; belugas@6674: uint param_end; ///< one more than the highest set parameter Darkvater@3561: Darkvater@3561: GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array. peter1138@6469: peter1138@6469: uint8 cargo_max; peter1138@6469: CargoLabel *cargo_list; peter1138@6473: uint8 cargo_map[NUM_CARGO]; rubidium@6574: }; dominik@455: tron@1477: extern GRFFile *_first_grffile; dominik@455: frosch@8899: enum ShoreReplacement { frosch@8899: SHORE_REPLACE_NONE, ///< No shore sprites were replaced. frosch@8899: SHORE_REPLACE_ACTION_5, ///< Shore sprites were replaced by Action5. frosch@8899: SHORE_REPLACE_ACTION_A, ///< Shore sprites were replaced by ActionA (using grass tiles for the corner-shores). frosch@8899: SHORE_REPLACE_ONLY_NEW, ///< Only corner-shores were loaded by Action5 (openttd(w/d).grf only). frosch@8899: }; frosch@8899: belugas@7410: struct GRFLoadedFeatures { belugas@7410: bool has_2CC; ///< Set if any vehicle is loaded which uses 2cc (two company colours). belugas@7410: bool has_newhouses; ///< Set if there are any newhouses loaded. belugas@7410: bool has_newindustries; ///< Set if there are any newindustries loaded. frosch@8899: ShoreReplacement shore; ///< It which way shore sprites were replaced. belugas@7265: }; belugas@7265: belugas@7265: /* Indicates which are the newgrf features currently loaded ingame */ belugas@7410: extern GRFLoadedFeatures _loaded_newgrf_features; pasky@463: belugas@8690: void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage); tron@2342: void LoadNewGRF(uint load_index, uint file_index); belugas@6674: void ReloadNewGRFData(); // in openttd.cpp dominik@455: Darkvater@5568: void CDECL grfmsg(int severity, const char *str, ...); Darkvater@5568: maedhros@7037: bool HasGrfMiscBit(GrfMiscBit bit); frosch@9042: bool GetGlobalVariable(byte param, uint32 *value); maedhros@7037: peter1138@9152: StringID MapGRFStringID(uint32 grfid, StringID str); peter1138@9152: dominik@455: #endif /* NEWGRF_H */