From e656a91736a02badd26b6674081c0adac64dd83c Mon Sep 17 00:00:00 2001 From: darkvater Date: Sun, 14 Nov 2004 16:42:08 +0000 Subject: [PATCH] (svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky) --- engine.c | 1 + engine.h | 21 +++------------------ grfspecial.c | 1 + rail_cmd.c | 1 + sprite.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ station.h | 19 +------------------ station_cmd.c | 1 + ttd.vcproj | 3 +++ unmovable_cmd.c | 1 + 9 files changed, 58 insertions(+), 36 deletions(-) create mode 100644 sprite.h diff --git a/engine.c b/engine.c index 1ec06f0690..c097999187 100644 --- a/engine.c +++ b/engine.c @@ -7,6 +7,7 @@ #include "vehicle.h" #include "news.h" #include "saveload.h" +#include "sprite.h" #define UPDATE_PLAYER_RAILTYPE(e,p) if ((byte)(e->railtype + 1) > p->max_railtype) p->max_railtype = e->railtype + 1; diff --git a/engine.h b/engine.h index 757d5f85a9..550336317c 100644 --- a/engine.h +++ b/engine.h @@ -1,6 +1,8 @@ #ifndef ENGINE_H #define ENGINE_H +#include "sprite.h" + typedef struct RailVehicleInfo { byte image_index; byte flags; /* 1=multihead engine, 2=wagon */ @@ -80,24 +82,6 @@ enum { void StartupEngines(); -struct SpriteGroup { - // XXX: Would anyone ever need more than 16 spritesets? Maybe we should - // use even less, now we take whole 8kb for custom sprites table, oh my! - byte sprites_per_set; // means number of directions - 4 or 8 - - // Loaded = in motion, loading = not moving - // Each group contains several spritesets, for various loading stages - - // XXX: For stations the meaning is different - loaded is for stations - // with small amount of cargo whilst loading is for stations with a lot - // of da stuff. - - byte loaded_count; - uint16 loaded[16]; // sprite ids - byte loading_count; - uint16 loading[16]; // sprite ids -}; - extern byte _global_cargo_id[NUM_LANDSCAPE][NUM_CARGO]; enum { CID_DEFAULT = 29, @@ -173,4 +157,5 @@ extern RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES]; #define ship_vehicle_info(e) _ship_vehicle_info[e - SHIP_ENGINES_INDEX] #define aircraft_vehinfo(e) _aircraft_vehicle_info[e - AIRCRAFT_ENGINES_INDEX] #define road_vehicle_info(e) (&_road_vehicle_info[e - ROAD_ENGINES_INDEX]) + #endif diff --git a/grfspecial.c b/grfspecial.c index 0106f44b2d..dcf55a53ec 100644 --- a/grfspecial.c +++ b/grfspecial.c @@ -7,6 +7,7 @@ #include "fileio.h" #include "engine.h" #include "station.h" +#include "sprite.h" /* TTDPatch extended GRF format codec * (c) Petr Baudis 2004 (GPL'd) diff --git a/rail_cmd.c b/rail_cmd.c index 87f6aead26..2406c800c8 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -7,6 +7,7 @@ #include "town.h" #include "sound.h" #include "station.h" +#include "sprite.h" void ShowTrainDepotWindow(uint tile); diff --git a/sprite.h b/sprite.h new file mode 100644 index 0000000000..cfc51265db --- /dev/null +++ b/sprite.h @@ -0,0 +1,46 @@ +#ifndef SPRITE_H +#define SPRITE_H + + +/* The following describes bunch of sprites to be drawn together in a single 3D + * bounding box. Used especially for various multi-sprite buildings (like + * depots or stations): */ + +typedef struct DrawTileSeqStruct { + int8 delta_x; + int8 delta_y; + int8 delta_z; + byte width,height; + byte unk; // 'depth', just z-size; TODO: rename + uint32 image; +} DrawTileSeqStruct; + +typedef struct DrawTileSprites { + SpriteID ground_sprite; + DrawTileSeqStruct const *seq; +} DrawTileSprites; + +#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++) + + +/* This is for custom sprites: */ + +struct SpriteGroup { + // XXX: Would anyone ever need more than 16 spritesets? Maybe we should + // use even less, now we take whole 8kb for custom sprites table, oh my! + byte sprites_per_set; // means number of directions - 4 or 8 + + // Loaded = in motion, loading = not moving + // Each group contains several spritesets, for various loading stages + + // XXX: For stations the meaning is different - loaded is for stations + // with small amount of cargo whilst loading is for stations with a lot + // of da stuff. + + byte loaded_count; + uint16 loaded[16]; // sprite ids + byte loading_count; + uint16 loading[16]; // sprite ids +}; + +#endif diff --git a/station.h b/station.h index 3f395143f2..1ebe87be66 100644 --- a/station.h +++ b/station.h @@ -1,7 +1,7 @@ #ifndef STATION_H #define STATION_H -#include "engine.h" +#include "sprite.h" #include "vehicle.h" typedef struct GoodsEntry { @@ -93,23 +93,6 @@ void GetAcceptanceAroundTiles(uint *accepts, uint tile, int w, int h); uint GetStationPlatforms(Station *st, uint tile); -typedef struct DrawTileSeqStruct { - int8 delta_x; - int8 delta_y; - int8 delta_z; - byte width,height; - byte unk; // 'depth', just z-size; TODO: rename - uint32 image; -} DrawTileSeqStruct; - -typedef struct DrawTileSprites { - SpriteID ground_sprite; - DrawTileSeqStruct const *seq; -} DrawTileSprites; - -#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++) - - struct StationSpec { uint32 grfid; int localidx; // per-GRFFile station index + 1; SetCustomStation() takes care of this diff --git a/station_cmd.c b/station_cmd.c index a0f1460d4e..40a4137dfc 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -12,6 +12,7 @@ #include "economy.h" #include "player.h" #include "airport.h" +#include "sprite.h" #include "table/directions.h" // FIXME -- need to be embedded into Airport variable. Is dynamically diff --git a/ttd.vcproj b/ttd.vcproj index 5b191325f6..a6639e1bba 100644 --- a/ttd.vcproj +++ b/ttd.vcproj @@ -1159,6 +1159,9 @@ + + diff --git a/unmovable_cmd.c b/unmovable_cmd.c index ec40f26639..f346f51dfe 100644 --- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -7,6 +7,7 @@ #include "station.h" #include "economy.h" #include "town.h" +#include "sprite.h" typedef struct DrawTileUnmovableStruct { uint16 image;