tron@2186: /* $Id$ */ tron@2186: rubidium@9111: /** @file newgrf.h Base for the NewGRF implementation. */ belugas@6348: dominik@455: #ifndef NEWGRF_H dominik@455: #define NEWGRF_H dominik@455: rubidium@8213: #include "town_type.h" peter1138@5228: #include "newgrf_config.h" peter1138@6143: #include "cargotype.h" rubidium@8213: #include "industry_type.h" rubidium@8787: #include "station_type.h" pasky@463: rubidium@6248: enum GrfLoadingStage { peter1138@5228: GLS_FILESCAN, peter1138@5329: GLS_SAFETYSCAN, peter1138@5225: GLS_LABELSCAN, peter1138@5225: GLS_INIT, peter1138@6359: GLS_RESERVE, peter1138@5225: GLS_ACTIVATION, peter1138@5225: GLS_END, rubidium@6248: }; peter1138@5225: rubidium@5587: DECLARE_POSTFIX_INCREMENT(GrfLoadingStage); rubidium@5587: maedhros@6541: enum GrfMiscBit { maedhros@6541: GMB_DESERT_TREES_FIELDS = 0, // Unsupported. maedhros@6541: GMB_DESERT_PAVED_ROADS = 1, maedhros@6541: GMB_FIELD_BOUNDING_BOX = 2, // Unsupported. maedhros@6541: GMB_TRAIN_WIDTH_32_PIXELS = 3, maedhros@6541: GMB_AMBIENT_SOUND_CALLBACK = 4, // Unsupported. maedhros@6541: GMB_CATENARY_ON_3RD_TRACK = 5, // Unsupported. maedhros@6541: }; rubidium@5587: peter1138@8541: enum GrfSpecFeature { peter1138@8541: GSF_TRAIN, peter1138@8541: GSF_ROAD, peter1138@8541: GSF_SHIP, peter1138@8541: GSF_AIRCRAFT, peter1138@8541: GSF_STATION, peter1138@8541: GSF_CANAL, peter1138@8541: GSF_BRIDGE, peter1138@8541: GSF_TOWNHOUSE, peter1138@8541: GSF_GLOBALVAR, peter1138@8541: GSF_INDUSTRYTILES, peter1138@8541: GSF_INDUSTRIES, peter1138@8541: GSF_CARGOS, peter1138@8541: GSF_SOUNDFX, peter1138@8541: GSF_END, peter1138@8541: }; peter1138@8541: rubidium@6248: struct GRFLabel { Darkvater@3561: byte label; Darkvater@3561: uint32 nfo_line; rubidium@9390: size_t pos; Darkvater@3561: struct GRFLabel *next; rubidium@6248: }; Darkvater@3561: rubidium@6248: struct GRFFile { dominik@455: char *filename; belugas@8164: bool is_ottdfile; dominik@455: uint32 grfid; dominik@455: uint16 sprite_offset; peter1138@3640: byte grf_version; rubidium@6248: 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@6332: HouseSpec **housespec; belugas@6759: IndustrySpec **industryspec; belugas@6759: IndustryTileSpec **indtspec; tron@2345: tron@2345: uint32 param[0x80]; belugas@6348: 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@6143: peter1138@6143: uint8 cargo_max; peter1138@6143: CargoLabel *cargo_list; peter1138@6147: uint8 cargo_map[NUM_CARGO]; rubidium@6248: }; dominik@455: tron@1477: extern GRFFile *_first_grffile; dominik@455: frosch@8403: enum ShoreReplacement { frosch@8403: SHORE_REPLACE_NONE, ///< No shore sprites were replaced. frosch@8403: SHORE_REPLACE_ACTION_5, ///< Shore sprites were replaced by Action5. frosch@8403: SHORE_REPLACE_ACTION_A, ///< Shore sprites were replaced by ActionA (using grass tiles for the corner-shores). frosch@8403: SHORE_REPLACE_ONLY_NEW, ///< Only corner-shores were loaded by Action5 (openttd(w/d).grf only). frosch@8403: }; frosch@8403: belugas@6914: struct GRFLoadedFeatures { belugas@6914: bool has_2CC; ///< Set if any vehicle is loaded which uses 2cc (two company colours). belugas@6914: bool has_newhouses; ///< Set if there are any newhouses loaded. belugas@6914: bool has_newindustries; ///< Set if there are any newindustries loaded. frosch@8403: ShoreReplacement shore; ///< It which way shore sprites were replaced. belugas@6769: }; belugas@6769: belugas@6769: /* Indicates which are the newgrf features currently loaded ingame */ belugas@6914: extern GRFLoadedFeatures _loaded_newgrf_features; pasky@463: belugas@8194: void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage); tron@2342: void LoadNewGRF(uint load_index, uint file_index); belugas@6348: void ReloadNewGRFData(); // in openttd.cpp dominik@455: Darkvater@5380: void CDECL grfmsg(int severity, const char *str, ...); Darkvater@5380: maedhros@6541: bool HasGrfMiscBit(GrfMiscBit bit); frosch@8546: bool GetGlobalVariable(byte param, uint32 *value); maedhros@6541: peter1138@8656: StringID MapGRFStringID(uint32 grfid, StringID str); peter1138@8656: dominik@455: #endif /* NEWGRF_H */