sprite.h
author hackykid
Wed, 01 Jun 2005 11:34:37 +0000
changeset 1883 3b02000cfbe0
parent 1477 2174a73b11c9
child 2186 461a2aff3486
permissions -rw-r--r--
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
- Feature: [newgrf] Implement the 'refit capacity' callback.
406
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     1
#ifndef SPRITE_H
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     2
#define SPRITE_H
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     3
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     4
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     5
/* The following describes bunch of sprites to be drawn together in a single 3D
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     6
 * bounding box. Used especially for various multi-sprite buildings (like
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     7
 * depots or stations): */
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     8
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     9
typedef struct DrawTileSeqStruct {
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    10
	int8 delta_x; // 0x80 is sequence terminator
406
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    11
	int8 delta_y;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    12
	int8 delta_z;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    13
	byte width,height;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    14
	byte unk; // 'depth', just z-size; TODO: rename
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    15
	uint32 image;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    16
} DrawTileSeqStruct;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    17
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    18
typedef struct DrawTileSprites {
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    19
	SpriteID ground_sprite;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    20
	DrawTileSeqStruct const *seq;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    21
} DrawTileSprites;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    22
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    23
// Iterate through all DrawTileSeqStructs in DrawTileSprites.
406
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    24
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    25
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    26
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    27
/* This is for custom sprites: */
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    28
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    29
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    30
typedef struct SpriteGroup SpriteGroup;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    31
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    32
typedef struct RealSpriteGroup {
406
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    33
	// XXX: Would anyone ever need more than 16 spritesets? Maybe we should
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    34
	// use even less, now we take whole 8kb for custom sprites table, oh my!
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    35
	byte sprites_per_set; // means number of directions - 4 or 8
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    36
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    37
	// Loaded = in motion, loading = not moving
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    38
	// Each group contains several spritesets, for various loading stages
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    39
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    40
	// XXX: For stations the meaning is different - loaded is for stations
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    41
	// with small amount of cargo whilst loading is for stations with a lot
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    42
	// of da stuff.
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    43
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    44
	byte loaded_count;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    45
	uint16 loaded[16]; // sprite ids
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    46
	byte loading_count;
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    47
	uint16 loading[16]; // sprite ids
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    48
} RealSpriteGroup;
406
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    49
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    50
/* Shared by deterministic and random groups. */
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    51
typedef enum VarSpriteGroupScope {
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    52
	VSG_SCOPE_SELF,
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    53
	// Engine of consists for vehicles, city for stations.
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    54
	VSG_SCOPE_PARENT,
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    55
} VarSpriteGroupScope;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    56
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    57
typedef struct DeterministicSpriteGroupRanges DeterministicSpriteGroupRanges;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    58
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    59
typedef enum DeterministicSpriteGroupOperation {
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    60
	DSG_OP_NONE,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    61
	DSG_OP_DIV,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    62
	DSG_OP_MOD,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    63
} DeterministicSpriteGroupOperation;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    64
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    65
typedef struct DeterministicSpriteGroupRange DeterministicSpriteGroupRange;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    66
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    67
typedef struct DeterministicSpriteGroup {
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    68
	// Take this variable:
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    69
	VarSpriteGroupScope var_scope;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    70
	byte variable;
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    71
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    72
	// Do this with it:
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    73
	byte shift_num;
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    74
	byte and_mask;
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    75
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    76
	// Then do this with it:
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    77
	DeterministicSpriteGroupOperation operation;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    78
	byte add_val;
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    79
	byte divmod_val;
915
013cb2d74800 (svn r1402) Trim trailing whitespace
tron
parents: 445
diff changeset
    80
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    81
	// And apply it to this:
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    82
	byte num_ranges;
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    83
	DeterministicSpriteGroupRange *ranges; // Dynamically allocated
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    84
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    85
	// Dynamically allocated, this is the sole owner
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    86
	SpriteGroup *default_group;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    87
} DeterministicSpriteGroup;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
    88
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    89
typedef enum RandomizedSpriteGroupCompareMode {
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    90
	RSG_CMP_ANY,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    91
	RSG_CMP_ALL,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    92
} RandomizedSpriteGroupCompareMode;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    93
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    94
typedef struct RandomizedSpriteGroup {
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
    95
	// Take this object:
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    96
	VarSpriteGroupScope var_scope;
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
    97
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
    98
	// Check for these triggers:
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
    99
	RandomizedSpriteGroupCompareMode cmp_mode;
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   100
	byte triggers;
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   101
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   102
	// Look for this in the per-object randomized bitmask:
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   103
	byte lowest_randbit;
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   104
	byte num_groups; // must be power of 2
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   105
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   106
	// Take the group with appropriate index:
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   107
	SpriteGroup *groups;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   108
} RandomizedSpriteGroup;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   109
1883
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1477
diff changeset
   110
typedef struct CallbackResultSpriteGroup {
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1477
diff changeset
   111
	uint16 result;
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1477
diff changeset
   112
} CallbackResultSpriteGroup;
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1477
diff changeset
   113
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   114
typedef enum SpriteGroupType {
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   115
	SGT_REAL,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   116
	SGT_DETERMINISTIC,
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   117
	SGT_RANDOMIZED,
1883
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1477
diff changeset
   118
	SGT_CALLBACK,
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   119
} SpriteGroupType;
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   120
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   121
struct SpriteGroup {
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   122
	SpriteGroupType type;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   123
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   124
	union {
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   125
		RealSpriteGroup real;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   126
		DeterministicSpriteGroup determ;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   127
		RandomizedSpriteGroup random;
1883
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1477
diff changeset
   128
		CallbackResultSpriteGroup callback;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   129
	} g;
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   130
};
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   131
413
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   132
struct DeterministicSpriteGroupRange {
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   133
	SpriteGroup group;
413
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   134
	byte low;
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   135
	byte high;
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   136
};
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   137
413
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   138
/* This takes value (probably of the variable specified in the group) and
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   139
 * chooses corresponding SpriteGroup accordingly to the given
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   140
 * DeterministicSpriteGroup. */
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   141
struct SpriteGroup *EvalDeterministicSpriteGroup(struct DeterministicSpriteGroup *dsg, int value);
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   142
/* Get value of a common deterministic SpriteGroup variable. */
36afcda97345 (svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents: 408
diff changeset
   143
int GetDeterministicSpriteValue(byte var);
408
63a8c0505aab (svn r605) -newgrf: Framework for supporting variational spritegroups . Deterministic only at the moment, but random ones support shouldn't be that difficult now It doesn't do anything, but makes these actions actually possible (pasky).
darkvater
parents: 406
diff changeset
   144
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   145
/* This takes randomized bitmask (probably associated with
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   146
 * vehicle/station/whatever) and chooses corresponding SpriteGroup
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   147
 * accordingly to the given RandomizedSpriteGroup. */
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   148
SpriteGroup *EvalRandomizedSpriteGroup(RandomizedSpriteGroup *rsg, byte random_bits);
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   149
/* Triggers given RandomizedSpriteGroup with given bitmask and returns and-mask
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   150
 * of random bits to be reseeded, or zero if there were no triggers matched
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   151
 * (then they are |ed to @waiting_triggers instead). */
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 915
diff changeset
   152
byte RandomizedSpriteGroupTriggeredBits(RandomizedSpriteGroup *rsg, byte triggers, byte *waiting_triggers);
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 426
diff changeset
   153
406
29f813f556a6 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
   154
#endif