author | belugas |
Mon, 24 Apr 2006 21:10:56 +0000 | |
changeset 3654 | c09872510a61 |
parent 3595 | a0acdb23e662 |
child 3664 | 4f810b1ea216 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
406
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
3 |
#ifndef SPRITE_H |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
4 |
#define SPRITE_H |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
5 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
6 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
7 |
/* The following describes bunch of sprites to be drawn together in a single 3D |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
8 |
* bounding box. Used especially for various multi-sprite buildings (like |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
9 |
* depots or stations): */ |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
10 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
11 |
typedef struct DrawTileSeqStruct { |
408
48da21eb9ff2
(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
|
12 |
int8 delta_x; // 0x80 is sequence terminator |
406
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
13 |
int8 delta_y; |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
14 |
int8 delta_z; |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
15 |
byte width,height; |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
16 |
byte unk; // 'depth', just z-size; TODO: rename |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
17 |
uint32 image; |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
18 |
} DrawTileSeqStruct; |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
19 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
20 |
typedef struct DrawTileSprites { |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
21 |
SpriteID ground_sprite; |
2548
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2491
diff
changeset
|
22 |
const DrawTileSeqStruct* seq; |
406
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
23 |
} DrawTileSprites; |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
24 |
|
3654
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
25 |
/** |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
26 |
* This structure is the same for both Industries and Houses. |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
27 |
* Buildings here reference a general type of construction |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
28 |
*/ |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
29 |
typedef struct DrawBuildingsTileStruct { |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
30 |
SpriteID ground; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
31 |
SpriteID building; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
32 |
byte subtile_x:4; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
33 |
byte subtile_y:4; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
34 |
byte width:4; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
35 |
byte height:4; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
36 |
byte dz; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
37 |
byte draw_proc; /* this allows to specify a special drawing procedure.*/ |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
38 |
} DrawBuildingsTileStruct; |
c09872510a61
(svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents:
3595
diff
changeset
|
39 |
|
408
48da21eb9ff2
(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
|
40 |
// Iterate through all DrawTileSeqStructs in DrawTileSprites. |
406
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
41 |
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++) |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
42 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
43 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
44 |
/* This is for custom sprites: */ |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
45 |
|
408
48da21eb9ff2
(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
|
46 |
|
1477 | 47 |
typedef struct SpriteGroup SpriteGroup; |
408
48da21eb9ff2
(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
|
48 |
|
1477 | 49 |
typedef struct RealSpriteGroup { |
406
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
50 |
byte sprites_per_set; // means number of directions - 4 or 8 |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
51 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
52 |
// Loaded = in motion, loading = not moving |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
53 |
// Each group contains several spritesets, for various loading stages |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
54 |
|
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
55 |
// XXX: For stations the meaning is different - loaded is for stations |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
56 |
// with small amount of cargo whilst loading is for stations with a lot |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
57 |
// of da stuff. |
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
58 |
|
3593
7ec7431c7a94
(svn r4483) - NewGRF: Dynamically allocate memory for 'real' spritegroups. This removes the limit of 16 loading/unloading states, although will result in less memory usage as most of the time the full fixed allocation wasn't used.
peter1138
parents:
2548
diff
changeset
|
59 |
byte loaded_count; ///< Number of loaded groups |
7ec7431c7a94
(svn r4483) - NewGRF: Dynamically allocate memory for 'real' spritegroups. This removes the limit of 16 loading/unloading states, although will result in less memory usage as most of the time the full fixed allocation wasn't used.
peter1138
parents:
2548
diff
changeset
|
60 |
SpriteGroup **loaded; ///< List of loaded groups (can be SpriteIDs or Callback results) |
7ec7431c7a94
(svn r4483) - NewGRF: Dynamically allocate memory for 'real' spritegroups. This removes the limit of 16 loading/unloading states, although will result in less memory usage as most of the time the full fixed allocation wasn't used.
peter1138
parents:
2548
diff
changeset
|
61 |
byte loading_count; ///< Number of loading groups |
7ec7431c7a94
(svn r4483) - NewGRF: Dynamically allocate memory for 'real' spritegroups. This removes the limit of 16 loading/unloading states, although will result in less memory usage as most of the time the full fixed allocation wasn't used.
peter1138
parents:
2548
diff
changeset
|
62 |
SpriteGroup **loading; ///< List of loading groups (can be SpriteIDs or Callback results) |
1477 | 63 |
} RealSpriteGroup; |
406
34cba651d9f8
(svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents:
405
diff
changeset
|
64 |
|
408
48da21eb9ff2
(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
|
65 |
/* Shared by deterministic and random groups. */ |
1477 | 66 |
typedef enum VarSpriteGroupScope { |
408
48da21eb9ff2
(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
|
67 |
VSG_SCOPE_SELF, |
48da21eb9ff2
(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 |
// Engine of consists for vehicles, city for stations. |
48da21eb9ff2
(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
|
69 |
VSG_SCOPE_PARENT, |
1477 | 70 |
} VarSpriteGroupScope; |
408
48da21eb9ff2
(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 |
|
1477 | 72 |
typedef struct DeterministicSpriteGroupRanges DeterministicSpriteGroupRanges; |
408
48da21eb9ff2
(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 |
|
1477 | 74 |
typedef enum DeterministicSpriteGroupOperation { |
75 |
DSG_OP_NONE, |
|
76 |
DSG_OP_DIV, |
|
77 |
DSG_OP_MOD, |
|
78 |
} DeterministicSpriteGroupOperation; |
|
79 |
||
80 |
typedef struct DeterministicSpriteGroupRange DeterministicSpriteGroupRange; |
|
81 |
||
82 |
typedef struct DeterministicSpriteGroup { |
|
408
48da21eb9ff2
(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
|
83 |
// Take this variable: |
1477 | 84 |
VarSpriteGroupScope var_scope; |
408
48da21eb9ff2
(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 |
byte variable; |
2445
6304552c6492
(svn r2971) - Newgrf: Support loading VarAction2 parameter for variables 0x60-0x7F. This parameter isn't used yet.
peter1138
parents:
2436
diff
changeset
|
86 |
byte parameter; ///< Used for variables between 0x60 and 0x7F inclusive. |
408
48da21eb9ff2
(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
|
87 |
|
48da21eb9ff2
(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 |
// Do this with it: |
48da21eb9ff2
(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
|
89 |
byte shift_num; |
48da21eb9ff2
(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
|
90 |
byte and_mask; |
48da21eb9ff2
(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
|
91 |
|
48da21eb9ff2
(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
|
92 |
// Then do this with it: |
1477 | 93 |
DeterministicSpriteGroupOperation operation; |
408
48da21eb9ff2
(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
|
94 |
byte add_val; |
48da21eb9ff2
(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
|
95 |
byte divmod_val; |
915 | 96 |
|
408
48da21eb9ff2
(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
|
97 |
// And apply it to this: |
48da21eb9ff2
(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
|
98 |
byte num_ranges; |
1477 | 99 |
DeterministicSpriteGroupRange *ranges; // Dynamically allocated |
408
48da21eb9ff2
(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
|
100 |
|
48da21eb9ff2
(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
|
101 |
// Dynamically allocated, this is the sole owner |
1477 | 102 |
SpriteGroup *default_group; |
103 |
} DeterministicSpriteGroup; |
|
408
48da21eb9ff2
(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
|
104 |
|
1477 | 105 |
typedef enum RandomizedSpriteGroupCompareMode { |
106 |
RSG_CMP_ANY, |
|
107 |
RSG_CMP_ALL, |
|
108 |
} RandomizedSpriteGroupCompareMode; |
|
109 |
||
110 |
typedef struct RandomizedSpriteGroup { |
|
445
beafc0fb8f12
(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
|
111 |
// Take this object: |
1477 | 112 |
VarSpriteGroupScope var_scope; |
445
beafc0fb8f12
(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
|
113 |
|
beafc0fb8f12
(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
|
114 |
// Check for these triggers: |
1477 | 115 |
RandomizedSpriteGroupCompareMode cmp_mode; |
445
beafc0fb8f12
(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
|
116 |
byte triggers; |
beafc0fb8f12
(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
|
117 |
|
beafc0fb8f12
(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
|
118 |
// Look for this in the per-object randomized bitmask: |
beafc0fb8f12
(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
|
119 |
byte lowest_randbit; |
beafc0fb8f12
(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 |
byte num_groups; // must be power of 2 |
beafc0fb8f12
(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
|
121 |
|
beafc0fb8f12
(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
|
122 |
// Take the group with appropriate index: |
2488
1e98c71e5f6a
(svn r3014) -NewGRF, Codechange: Make all sprite group references be pointers instead of copying the data around.
peter1138
parents:
2445
diff
changeset
|
123 |
SpriteGroup **groups; |
1477 | 124 |
} RandomizedSpriteGroup; |
125 |
||
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1477
diff
changeset
|
126 |
typedef struct CallbackResultSpriteGroup { |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1477
diff
changeset
|
127 |
uint16 result; |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1477
diff
changeset
|
128 |
} CallbackResultSpriteGroup; |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1477
diff
changeset
|
129 |
|
2489
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
130 |
typedef struct ResultSpriteGroup { |
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
131 |
uint16 result; |
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
132 |
byte sprites; |
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
133 |
} ResultSpriteGroup; |
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
134 |
|
1477 | 135 |
typedef enum SpriteGroupType { |
3595
a0acdb23e662
(svn r4486) - NewGRF: Create and use a memory pool to manage sprite groups. This
peter1138
parents:
3593
diff
changeset
|
136 |
SGT_INVALID, |
1477 | 137 |
SGT_REAL, |
138 |
SGT_DETERMINISTIC, |
|
139 |
SGT_RANDOMIZED, |
|
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1477
diff
changeset
|
140 |
SGT_CALLBACK, |
2489
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
141 |
SGT_RESULT, |
1477 | 142 |
} SpriteGroupType; |
445
beafc0fb8f12
(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
|
143 |
|
408
48da21eb9ff2
(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 |
struct SpriteGroup { |
1477 | 145 |
SpriteGroupType type; |
408
48da21eb9ff2
(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
|
146 |
|
48da21eb9ff2
(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
|
147 |
union { |
1477 | 148 |
RealSpriteGroup real; |
149 |
DeterministicSpriteGroup determ; |
|
150 |
RandomizedSpriteGroup random; |
|
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1477
diff
changeset
|
151 |
CallbackResultSpriteGroup callback; |
2489
6fbb72b64e07
(svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.)
peter1138
parents:
2488
diff
changeset
|
152 |
ResultSpriteGroup result; |
408
48da21eb9ff2
(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
|
153 |
} g; |
48da21eb9ff2
(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
|
154 |
}; |
48da21eb9ff2
(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
|
155 |
|
413
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
156 |
struct DeterministicSpriteGroupRange { |
2488
1e98c71e5f6a
(svn r3014) -NewGRF, Codechange: Make all sprite group references be pointers instead of copying the data around.
peter1138
parents:
2445
diff
changeset
|
157 |
SpriteGroup *group; |
413
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
158 |
byte low; |
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
159 |
byte high; |
408
48da21eb9ff2
(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
|
160 |
}; |
48da21eb9ff2
(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
|
161 |
|
413
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
162 |
/* This takes value (probably of the variable specified in the group) and |
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
163 |
* chooses corresponding SpriteGroup accordingly to the given |
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
164 |
* DeterministicSpriteGroup. */ |
2242
512eae2cf006
(svn r2762) Simplify a loop, remove an unused variable and add many consts
tron
parents:
2186
diff
changeset
|
165 |
SpriteGroup *EvalDeterministicSpriteGroup(const DeterministicSpriteGroup *dsg, int value); |
413
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
166 |
/* Get value of a common deterministic SpriteGroup variable. */ |
36f14a6d63d7
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
408
diff
changeset
|
167 |
int GetDeterministicSpriteValue(byte var); |
408
48da21eb9ff2
(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
|
168 |
|
445
beafc0fb8f12
(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
|
169 |
/* This takes randomized bitmask (probably associated with |
beafc0fb8f12
(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
|
170 |
* vehicle/station/whatever) and chooses corresponding SpriteGroup |
beafc0fb8f12
(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
|
171 |
* accordingly to the given RandomizedSpriteGroup. */ |
2242
512eae2cf006
(svn r2762) Simplify a loop, remove an unused variable and add many consts
tron
parents:
2186
diff
changeset
|
172 |
SpriteGroup *EvalRandomizedSpriteGroup(const RandomizedSpriteGroup *rsg, byte random_bits); |
445
beafc0fb8f12
(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
|
173 |
/* Triggers given RandomizedSpriteGroup with given bitmask and returns and-mask |
beafc0fb8f12
(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
|
174 |
* of random bits to be reseeded, or zero if there were no triggers matched |
beafc0fb8f12
(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
|
175 |
* (then they are |ed to @waiting_triggers instead). */ |
2242
512eae2cf006
(svn r2762) Simplify a loop, remove an unused variable and add many consts
tron
parents:
2186
diff
changeset
|
176 |
byte RandomizedSpriteGroupTriggeredBits(const RandomizedSpriteGroup *rsg, byte triggers, byte *waiting_triggers); |
445
beafc0fb8f12
(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
|
177 |
|
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2242
diff
changeset
|
178 |
#endif /* SPRITE_H */ |