mirror of https://github.com/OpenTTD/OpenTTD
(svn r557) -newgrf: Rename all 'superset' tokens to 'group' and some other small renamings (pasky and octo).
parent
76341a9173
commit
22f627c8e1
40
engine.c
40
engine.c
|
@ -175,7 +175,7 @@ uint32 _engine_refit_masks[256];
|
||||||
struct WagonOverride {
|
struct WagonOverride {
|
||||||
byte *train_id;
|
byte *train_id;
|
||||||
int trains;
|
int trains;
|
||||||
struct SpriteSuperSet superset;
|
struct SpriteGroup group;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct WagonOverrides {
|
static struct WagonOverrides {
|
||||||
|
@ -183,7 +183,7 @@ static struct WagonOverrides {
|
||||||
struct WagonOverride *overrides;
|
struct WagonOverride *overrides;
|
||||||
} _engine_wagon_overrides[256];
|
} _engine_wagon_overrides[256];
|
||||||
|
|
||||||
void SetWagonOverrideSprites(byte engine, struct SpriteSuperSet *superset,
|
void SetWagonOverrideSprites(byte engine, struct SpriteGroup *group,
|
||||||
byte *train_id, int trains)
|
byte *train_id, int trains)
|
||||||
{
|
{
|
||||||
struct WagonOverrides *wos;
|
struct WagonOverrides *wos;
|
||||||
|
@ -195,13 +195,13 @@ void SetWagonOverrideSprites(byte engine, struct SpriteSuperSet *superset,
|
||||||
wos->overrides_count * sizeof(struct WagonOverride));
|
wos->overrides_count * sizeof(struct WagonOverride));
|
||||||
|
|
||||||
wo = &wos->overrides[wos->overrides_count - 1];
|
wo = &wos->overrides[wos->overrides_count - 1];
|
||||||
wo->superset = *superset;
|
wo->group = *group;
|
||||||
wo->trains = trains;
|
wo->trains = trains;
|
||||||
wo->train_id = malloc(trains);
|
wo->train_id = malloc(trains);
|
||||||
memcpy(wo->train_id, train_id, trains);
|
memcpy(wo->train_id, train_id, trains);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct SpriteSuperSet *GetWagonOverrideSpriteSet(byte engine, byte overriding_engine)
|
static struct SpriteGroup *GetWagonOverrideSpriteSet(byte engine, byte overriding_engine)
|
||||||
{
|
{
|
||||||
struct WagonOverrides *wos = &_engine_wagon_overrides[engine];
|
struct WagonOverrides *wos = &_engine_wagon_overrides[engine];
|
||||||
int i;
|
int i;
|
||||||
|
@ -215,7 +215,7 @@ static struct SpriteSuperSet *GetWagonOverrideSpriteSet(byte engine, byte overri
|
||||||
|
|
||||||
for (j = 0; j < wo->trains; j++) {
|
for (j = 0; j < wo->trains; j++) {
|
||||||
if (wo->train_id[j] == overriding_engine)
|
if (wo->train_id[j] == overriding_engine)
|
||||||
return &wo->superset;
|
return &wo->group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -227,44 +227,44 @@ byte _engine_original_sprites[256];
|
||||||
// (It isn't and shouldn't be like this in the GRF files since new cargo types
|
// (It isn't and shouldn't be like this in the GRF files since new cargo types
|
||||||
// may appear in future - however it's more convenient to store it like this in
|
// may appear in future - however it's more convenient to store it like this in
|
||||||
// memory. --pasky)
|
// memory. --pasky)
|
||||||
static struct SpriteSuperSet _engine_custom_sprites[256][NUM_CID];
|
static struct SpriteGroup _engine_custom_sprites[256][NUM_CID];
|
||||||
|
|
||||||
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteSuperSet *superset)
|
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group)
|
||||||
{
|
{
|
||||||
assert(superset->sprites_per_set == 4 || superset->sprites_per_set == 8);
|
assert(group->sprites_per_set == 4 || group->sprites_per_set == 8);
|
||||||
_engine_custom_sprites[engine][cargo] = *superset;
|
_engine_custom_sprites[engine][cargo] = *group;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetCustomEngineSprite(byte engine, uint16 overriding_engine, byte cargo,
|
int GetCustomEngineSprite(byte engine, uint16 overriding_engine, byte cargo,
|
||||||
byte loaded, byte in_motion, byte direction)
|
byte loaded, byte in_motion, byte direction)
|
||||||
{
|
{
|
||||||
struct SpriteSuperSet *superset = &_engine_custom_sprites[engine][cargo];
|
struct SpriteGroup *group = &_engine_custom_sprites[engine][cargo];
|
||||||
int totalsets, spriteset;
|
int totalsets, spriteset;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (overriding_engine != 0xffff) {
|
if (overriding_engine != 0xffff) {
|
||||||
struct SpriteSuperSet *overset;
|
struct SpriteGroup *overset;
|
||||||
|
|
||||||
overset = GetWagonOverrideSpriteSet(engine, overriding_engine);
|
overset = GetWagonOverrideSpriteSet(engine, overriding_engine);
|
||||||
if (overset) superset = overset;
|
if (overset) group = overset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!superset->sprites_per_set && cargo != 29) {
|
if (!group->sprites_per_set && cargo != 29) {
|
||||||
// This superset is empty but perhaps there'll be a default one.
|
// This group is empty but perhaps there'll be a default one.
|
||||||
superset = &_engine_custom_sprites[engine][29];
|
group = &_engine_custom_sprites[engine][29];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!superset->sprites_per_set) {
|
if (!group->sprites_per_set) {
|
||||||
// This superset is empty. This function users should therefore
|
// This group is empty. This function users should therefore
|
||||||
// look up the sprite number in _engine_original_sprites.
|
// look up the sprite number in _engine_original_sprites.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
direction %= 8;
|
direction %= 8;
|
||||||
if (superset->sprites_per_set == 4)
|
if (group->sprites_per_set == 4)
|
||||||
direction %= 4;
|
direction %= 4;
|
||||||
|
|
||||||
totalsets = in_motion ? superset->loaded_count : superset->loading_count;
|
totalsets = in_motion ? group->loaded_count : group->loading_count;
|
||||||
|
|
||||||
// My aim here is to make it possible to visually determine absolutely
|
// My aim here is to make it possible to visually determine absolutely
|
||||||
// empty and totally full vehicles. --pasky
|
// empty and totally full vehicles. --pasky
|
||||||
|
@ -281,7 +281,7 @@ int GetCustomEngineSprite(byte engine, uint16 overriding_engine, byte cargo,
|
||||||
spriteset--;
|
spriteset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = (in_motion ? superset->loaded[spriteset] : superset->loading[spriteset]) + direction;
|
r = (in_motion ? group->loaded[spriteset] : group->loading[spriteset]) + direction;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
engine.h
8
engine.h
|
@ -59,12 +59,12 @@ enum {
|
||||||
void StartupEngines();
|
void StartupEngines();
|
||||||
|
|
||||||
|
|
||||||
struct SpriteSuperSet {
|
struct SpriteGroup {
|
||||||
// XXX: Would anyone ever need more than 16 spritesets? Maybe we should
|
// 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!
|
// 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
|
byte sprites_per_set; // means number of directions - 4 or 8
|
||||||
// Loaded = in motion, loading = not moving
|
// Loaded = in motion, loading = not moving
|
||||||
// Each superset contains several spritesets, for various loading stages
|
// Each group contains several spritesets, for various loading stages
|
||||||
byte loaded_count;
|
byte loaded_count;
|
||||||
uint16 loaded[16]; // sprite ids
|
uint16 loaded[16]; // sprite ids
|
||||||
byte loading_count;
|
byte loading_count;
|
||||||
|
@ -83,8 +83,8 @@ extern byte _local_cargo_id_landscape[NUM_CID];
|
||||||
extern uint32 _engine_refit_masks[256];
|
extern uint32 _engine_refit_masks[256];
|
||||||
|
|
||||||
extern byte _engine_original_sprites[256];
|
extern byte _engine_original_sprites[256];
|
||||||
void SetWagonOverrideSprites(byte engine, struct SpriteSuperSet *superset, byte *train_id, int trains);
|
void SetWagonOverrideSprites(byte engine, struct SpriteGroup *group, byte *train_id, int trains);
|
||||||
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteSuperSet *superset);
|
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group);
|
||||||
// loaded is in percents, overriding_engine 0xffff is none
|
// loaded is in percents, overriding_engine 0xffff is none
|
||||||
int GetCustomEngineSprite(byte engine, uint16 overriding_engine, byte cargo, byte loaded, byte in_motion, byte direction);
|
int GetCustomEngineSprite(byte engine, uint16 overriding_engine, byte cargo, byte loaded, byte in_motion, byte direction);
|
||||||
#define GetCustomVehicleSprite(v, direction) \
|
#define GetCustomVehicleSprite(v, direction) \
|
||||||
|
|
88
grfspecial.c
88
grfspecial.c
|
@ -534,9 +534,9 @@ ignoring:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* A sprite superset contains all sprites of a given vehicle (or multiple
|
/* A sprite group contains all sprites of a given vehicle (or multiple
|
||||||
* vehicles) when carrying given cargo. It consists of several sprite sets.
|
* vehicles) when carrying given cargo. It consists of several sprite sets.
|
||||||
* Superset ids are refered as "cargo id"s by TTDPatch documentation,
|
* Group ids are refered as "cargo id"s by TTDPatch documentation,
|
||||||
* contributing to the global confusion.
|
* contributing to the global confusion.
|
||||||
*
|
*
|
||||||
* A sprite set contains all sprites of a given vehicle carrying given cargo at
|
* A sprite set contains all sprites of a given vehicle carrying given cargo at
|
||||||
|
@ -551,10 +551,10 @@ static int _spriteset_numents;
|
||||||
static int _spriteset_feature;
|
static int _spriteset_feature;
|
||||||
|
|
||||||
static int _spritesset_count;
|
static int _spritesset_count;
|
||||||
static struct SpriteSuperSet *_spritesset;
|
static struct SpriteGroup *_spritesset;
|
||||||
|
|
||||||
/* Action 0x01 */
|
/* Action 0x01 */
|
||||||
static void SpriteNewSet(byte *buf, int len)
|
static void NewSpriteSet(byte *buf, int len)
|
||||||
{
|
{
|
||||||
/* <01> <feature> <num-sets> <num-ent>
|
/* <01> <feature> <num-sets> <num-ent>
|
||||||
*
|
*
|
||||||
|
@ -587,7 +587,7 @@ static void SpriteNewSet(byte *buf, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Action 0x02 */
|
/* Action 0x02 */
|
||||||
static void SpriteNewSuperset(byte *buf, int len)
|
static void NewSpriteGroup(byte *buf, int len)
|
||||||
{
|
{
|
||||||
byte *bufend = buf + len;
|
byte *bufend = buf + len;
|
||||||
|
|
||||||
|
@ -609,17 +609,17 @@ static void SpriteNewSuperset(byte *buf, int len)
|
||||||
uint8 setid;
|
uint8 setid;
|
||||||
uint8 numloaded;
|
uint8 numloaded;
|
||||||
uint8 numloading;
|
uint8 numloading;
|
||||||
struct SpriteSuperSet *superset;
|
struct SpriteGroup *group;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
check_length(len, 5, "SpriteNewSuperset");
|
check_length(len, 5, "SpriteNewGroup");
|
||||||
feature = buf[1];
|
feature = buf[1];
|
||||||
setid = buf[2];
|
setid = buf[2];
|
||||||
numloaded = buf[3];
|
numloaded = buf[3];
|
||||||
numloading = buf[4];
|
numloading = buf[4];
|
||||||
|
|
||||||
if (feature == 4) {
|
if (feature == 4) {
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset: Stations unsupported, skipping.");
|
grfmsg(GMS_WARN, "SpriteNewGroup: Stations unsupported, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,9 +628,9 @@ static void SpriteNewSuperset(byte *buf, int len)
|
||||||
// a semi-futile ask because the great Patchman himself says
|
// a semi-futile ask because the great Patchman himself says
|
||||||
// this is just buggy. It dereferences last (first) byte of
|
// this is just buggy. It dereferences last (first) byte of
|
||||||
// a schedule list pointer of the vehicle and if it's 0xff
|
// a schedule list pointer of the vehicle and if it's 0xff
|
||||||
// it uses superset 01, otherwise it uses superset 00. Now
|
// it uses group 01, otherwise it uses group 00. Now
|
||||||
// if _you_ understand _that_... We just assume it is never
|
// if _you_ understand _that_... We just assume it is never
|
||||||
// 0xff and therefore go for superset 00. --pasky
|
// 0xff and therefore go for group 00. --pasky
|
||||||
uint8 var = buf[4];
|
uint8 var = buf[4];
|
||||||
//uint8 shiftnum = buf[5];
|
//uint8 shiftnum = buf[5];
|
||||||
//uint8 andmask = buf[6];
|
//uint8 andmask = buf[6];
|
||||||
|
@ -638,14 +638,14 @@ static void SpriteNewSuperset(byte *buf, int len)
|
||||||
//uint32 val;
|
//uint32 val;
|
||||||
uint16 def;
|
uint16 def;
|
||||||
|
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset(0x81): Unsupported variable %x. Using default cid.", var);
|
grfmsg(GMS_WARN, "SpriteNewGroup(0x81): Unsupported variable %x. Using default cid.", var);
|
||||||
|
|
||||||
//val = (0xff << shiftnum) & andmask;
|
//val = (0xff << shiftnum) & andmask;
|
||||||
|
|
||||||
//Go for the default.
|
//Go for the default.
|
||||||
if (setid >= _spritesset_count) {
|
if (setid >= _spritesset_count) {
|
||||||
_spritesset_count = setid + 1;
|
_spritesset_count = setid + 1;
|
||||||
_spritesset = realloc(_spritesset, _spritesset_count * sizeof(struct SpriteSuperSet));
|
_spritesset = realloc(_spritesset, _spritesset_count * sizeof(struct SpriteGroup));
|
||||||
}
|
}
|
||||||
buf += 8 + nvar * 4;
|
buf += 8 + nvar * 4;
|
||||||
def = grf_load_word(&buf);
|
def = grf_load_word(&buf);
|
||||||
|
@ -653,27 +653,27 @@ static void SpriteNewSuperset(byte *buf, int len)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (numloaded & 0x80) {
|
} else if (numloaded & 0x80) {
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset(0x%x): Unsupported special superset.", numloaded);
|
grfmsg(GMS_WARN, "SpriteNewGroup(0x%x): Unsupported special group.", numloaded);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_spriteset_start) {
|
if (!_spriteset_start) {
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset: No sprite set to work on! Skipping.");
|
grfmsg(GMS_WARN, "SpriteNewGroup: No sprite set to work on! Skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_spriteset_feature != feature) {
|
if (_spriteset_feature != feature) {
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset: Superset feature %x doesn't match set feature %x! Skipping.", feature, _spriteset_feature);
|
grfmsg(GMS_WARN, "SpriteNewGroup: Group feature %x doesn't match set feature %x! Skipping.", feature, _spriteset_feature);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setid >= _spritesset_count) {
|
if (setid >= _spritesset_count) {
|
||||||
_spritesset_count = setid + 1;
|
_spritesset_count = setid + 1;
|
||||||
_spritesset = realloc(_spritesset, _spritesset_count * sizeof(struct SpriteSuperSet));
|
_spritesset = realloc(_spritesset, _spritesset_count * sizeof(struct SpriteGroup));
|
||||||
}
|
}
|
||||||
superset = &_spritesset[setid];
|
group = &_spritesset[setid];
|
||||||
memset(superset, 0, sizeof(struct SpriteSuperSet));
|
memset(group, 0, sizeof(struct SpriteGroup));
|
||||||
superset->sprites_per_set = _spriteset_numents;
|
group->sprites_per_set = _spriteset_numents;
|
||||||
|
|
||||||
buf += 5;
|
buf += 5;
|
||||||
|
|
||||||
|
@ -681,10 +681,10 @@ static void SpriteNewSuperset(byte *buf, int len)
|
||||||
uint16 spriteset_id = grf_load_word(&buf);
|
uint16 spriteset_id = grf_load_word(&buf);
|
||||||
|
|
||||||
if (_spritesset[setid].loaded_count > 16) {
|
if (_spritesset[setid].loaded_count > 16) {
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset: More than 16 sprites in superset %x, skipping.", setid);
|
grfmsg(GMS_WARN, "SpriteNewGroup: More than 16 sprites in group %x, skipping.", setid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
superset->loaded[superset->loaded_count++]
|
group->loaded[group->loaded_count++]
|
||||||
= _spriteset_start + spriteset_id * _spriteset_numents;
|
= _spriteset_start + spriteset_id * _spriteset_numents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,15 +692,15 @@ static void SpriteNewSuperset(byte *buf, int len)
|
||||||
uint16 spriteset_id = grf_load_word(&buf);
|
uint16 spriteset_id = grf_load_word(&buf);
|
||||||
|
|
||||||
if (_spritesset[setid].loading_count > 16) {
|
if (_spritesset[setid].loading_count > 16) {
|
||||||
grfmsg(GMS_WARN, "SpriteNewSuperset: More than 16 sprites in superset %x, skipping.", setid);
|
grfmsg(GMS_WARN, "SpriteNewGroup: More than 16 sprites in group %x, skipping.", setid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
superset->loading[superset->loading_count++] = _spriteset_start + spriteset_id * _spriteset_numents;
|
group->loading[group->loading_count++] = _spriteset_start + spriteset_id * _spriteset_numents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Action 0x03 */
|
/* Action 0x03 */
|
||||||
static void VehicleMapSpriteSuperset(byte *buf, int len)
|
static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
|
||||||
{
|
{
|
||||||
/* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
|
/* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
|
||||||
* id-list := [<id>] [id-list]
|
* id-list := [<id>] [id-list]
|
||||||
|
@ -710,11 +710,11 @@ static void VehicleMapSpriteSuperset(byte *buf, int len)
|
||||||
* B n-id bits 0-6: how many IDs this definition applies to
|
* B n-id bits 0-6: how many IDs this definition applies to
|
||||||
* bit 7: if set, this is a wagon override definition (see below)
|
* bit 7: if set, this is a wagon override definition (see below)
|
||||||
* B ids the IDs for which this definition applies
|
* B ids the IDs for which this definition applies
|
||||||
* B num-cid number of cargo IDs in this definition
|
* B num-cid number of cargo IDs (sprite group IDs) in this definition
|
||||||
* can be zero, in that case the def-cid is used always
|
* can be zero, in that case the def-cid is used always
|
||||||
* B cargo-type type of this cargo type (e.g. mail=2, wood=7, see below)
|
* B cargo-type type of this cargo type (e.g. mail=2, wood=7, see below)
|
||||||
* W cid cargo ID for this type of cargo
|
* W cid cargo ID (sprite group ID) for this type of cargo
|
||||||
* W def-cid default cargo ID */
|
* W def-cid default cargo ID (sprite group ID) */
|
||||||
/* TODO: Only trains supported now. */
|
/* TODO: Only trains supported now. */
|
||||||
/* TODO: Multiple cargo support could be useful even for trains/cars -
|
/* TODO: Multiple cargo support could be useful even for trains/cars -
|
||||||
* cargo id 0xff is used for showing images in the build train list. */
|
* cargo id 0xff is used for showing images in the build train list. */
|
||||||
|
@ -727,14 +727,14 @@ static void VehicleMapSpriteSuperset(byte *buf, int len)
|
||||||
uint8 cidcount;
|
uint8 cidcount;
|
||||||
int c, i;
|
int c, i;
|
||||||
|
|
||||||
check_length(len, 7, "VehicleMapSpriteSuperset");
|
check_length(len, 7, "VehicleMapSpriteGroup");
|
||||||
feature = buf[1];
|
feature = buf[1];
|
||||||
idcount = buf[2] & 0x7F;
|
idcount = buf[2] & 0x7F;
|
||||||
wagover = buf[2] & 0x80;
|
wagover = buf[2] & 0x80;
|
||||||
cidcount = buf[3 + idcount];
|
cidcount = buf[3 + idcount];
|
||||||
|
|
||||||
if (feature == 4) {
|
if (feature == 4) {
|
||||||
grfmsg(GMS_WARN, "VehicleMapSpriteSuperset: Stations unsupported, skipping.");
|
grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Stations unsupported, skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ static void VehicleMapSpriteSuperset(byte *buf, int len)
|
||||||
// what should we exactly do with that? --pasky
|
// what should we exactly do with that? --pasky
|
||||||
|
|
||||||
if (!_spriteset_start || !_spritesset) {
|
if (!_spriteset_start || !_spritesset) {
|
||||||
grfmsg(GMS_WARN, "VehicleMapSpriteSuperset: No sprite set to work on! Skipping.");
|
grfmsg(GMS_WARN, "VehicleMapSpriteGroup: No sprite set to work on! Skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,10 +758,10 @@ static void VehicleMapSpriteSuperset(byte *buf, int len)
|
||||||
|
|
||||||
for (c = 0; c < cidcount; c++) {
|
for (c = 0; c < cidcount; c++) {
|
||||||
uint8 ctype = grf_load_byte(&bp);
|
uint8 ctype = grf_load_byte(&bp);
|
||||||
uint16 supersetid = grf_load_word(&bp);
|
uint16 groupid = grf_load_word(&bp);
|
||||||
|
|
||||||
if (supersetid >= _spritesset_count) {
|
if (groupid >= _spritesset_count) {
|
||||||
grfmsg(GMS_WARN, "VehicleMapSpriteSuperset: Spriteset %x out of range %x, skipping.", supersetid, _spritesset_count);
|
grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x, skipping.", groupid, _spritesset_count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,9 +770,9 @@ static void VehicleMapSpriteSuperset(byte *buf, int len)
|
||||||
|
|
||||||
if (wagover) {
|
if (wagover) {
|
||||||
// TODO: No multiple cargo types per vehicle yet. --pasky
|
// TODO: No multiple cargo types per vehicle yet. --pasky
|
||||||
SetWagonOverrideSprites(engine, &_spritesset[supersetid], last_engines, last_engines_count);
|
SetWagonOverrideSprites(engine, &_spritesset[groupid], last_engines, last_engines_count);
|
||||||
} else {
|
} else {
|
||||||
SetCustomEngineSprites(engine, ctype, &_spritesset[supersetid]);
|
SetCustomEngineSprites(engine, ctype, &_spritesset[groupid]);
|
||||||
last_engines[i] = engine;
|
last_engines[i] = engine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,22 +780,22 @@ static void VehicleMapSpriteSuperset(byte *buf, int len)
|
||||||
|
|
||||||
{
|
{
|
||||||
byte *bp = buf + 4 + idcount + cidcount * 3;
|
byte *bp = buf + 4 + idcount + cidcount * 3;
|
||||||
uint16 supersetid = grf_load_word(&bp);
|
uint16 groupid = grf_load_word(&bp);
|
||||||
|
|
||||||
for (i = 0; i < idcount; i++) {
|
for (i = 0; i < idcount; i++) {
|
||||||
uint8 engine = buf[3 + i] + _vehshifts[feature];
|
uint8 engine = buf[3 + i] + _vehshifts[feature];
|
||||||
|
|
||||||
// Don't tell me you don't love duplicated code!
|
// Don't tell me you don't love duplicated code!
|
||||||
if (supersetid >= _spritesset_count) {
|
if (groupid >= _spritesset_count) {
|
||||||
grfmsg(GMS_WARN, "VehicleMapSpriteSuperset: Spriteset %x out of range %x, skipping.", supersetid, _spritesset_count);
|
grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x, skipping.", groupid, _spritesset_count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wagover) {
|
if (wagover) {
|
||||||
// TODO: No multiple cargo types per vehicle yet. --pasky
|
// TODO: No multiple cargo types per vehicle yet. --pasky
|
||||||
SetWagonOverrideSprites(engine, &_spritesset[supersetid], last_engines, last_engines_count);
|
SetWagonOverrideSprites(engine, &_spritesset[groupid], last_engines, last_engines_count);
|
||||||
} else {
|
} else {
|
||||||
SetCustomEngineSprites(engine, CID_DEFAULT, &_spritesset[supersetid]);
|
SetCustomEngineSprites(engine, CID_DEFAULT, &_spritesset[groupid]);
|
||||||
last_engines[i] = engine;
|
last_engines[i] = engine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1304,9 +1304,9 @@ void DecodeSpecialSprite(const char *filename, int num, int spriteid, int stage)
|
||||||
#define NUM_ACTIONS 0xF
|
#define NUM_ACTIONS 0xF
|
||||||
static const SpecialSpriteHandler handlers[NUM_ACTIONS] = {
|
static const SpecialSpriteHandler handlers[NUM_ACTIONS] = {
|
||||||
/* 0x0 */ VehicleChangeInfo,
|
/* 0x0 */ VehicleChangeInfo,
|
||||||
/* 0x1 */ SpriteNewSet,
|
/* 0x1 */ NewSpriteSet,
|
||||||
/* 0x2 */ SpriteNewSuperset,
|
/* 0x2 */ NewSpriteGroup,
|
||||||
/* 0x3 */ VehicleMapSpriteSuperset,
|
/* 0x3 */ NewVehicle_SpriteGroupMapping,
|
||||||
/* 0x4 */ VehicleNewName,
|
/* 0x4 */ VehicleNewName,
|
||||||
/* 0x5 */ GraphicsNew,
|
/* 0x5 */ GraphicsNew,
|
||||||
/* 0x6 */ CfgApply,
|
/* 0x6 */ CfgApply,
|
||||||
|
@ -1341,7 +1341,7 @@ void DecodeSpecialSprite(const char *filename, int num, int spriteid, int stage)
|
||||||
|
|
||||||
/* XXX: Action 0x03 is temporarily processed together with actions 0x01
|
/* XXX: Action 0x03 is temporarily processed together with actions 0x01
|
||||||
* and 0x02 before it is fixed to be reentrant (probably storing the
|
* and 0x02 before it is fixed to be reentrant (probably storing the
|
||||||
* superset information in {struct GRFFile}). --pasky */
|
* group information in {struct GRFFile}). --pasky */
|
||||||
|
|
||||||
if (stage == 0) {
|
if (stage == 0) {
|
||||||
/* During initialization, actions 0, 3, 4, 5 and 7 are ignored. */
|
/* During initialization, actions 0, 3, 4, 5 and 7 are ignored. */
|
||||||
|
|
Loading…
Reference in New Issue