author | peter1138 |
Tue, 02 May 2006 20:48:27 +0000 | |
changeset 3725 | 1b5ce8c7b51f |
parent 3707 | 2999a89e8abd |
child 3768 | 46d328178509 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
455 | 3 |
#ifndef NEWGRF_H |
4 |
#define NEWGRF_H |
|
5 |
||
463
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
455
diff
changeset
|
6 |
#include "sprite.h" |
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
455
diff
changeset
|
7 |
#include "station.h" |
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
455
diff
changeset
|
8 |
|
3561
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
9 |
typedef struct GRFLabel { |
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
10 |
byte label; |
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
11 |
uint32 nfo_line; |
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
12 |
uint32 pos; |
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
13 |
struct GRFLabel *next; |
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
14 |
} GRFLabel; |
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
15 |
|
3628
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
16 |
typedef struct GRFFile { |
455 | 17 |
char *filename; |
18 |
uint32 grfid; |
|
19 |
uint16 flags; |
|
20 |
uint16 sprite_offset; |
|
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2548
diff
changeset
|
21 |
SpriteID first_spriteset; ///< Holds the first spriteset's sprite offset. |
3640
b73687dd2b62
(svn r4549) - NewGRF: store the grf version from Action 0x08.
peter1138
parents:
3638
diff
changeset
|
22 |
byte grf_version; |
3628
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
23 |
struct GRFFile *next; |
455 | 24 |
|
25 |
/* A sprite group contains all sprites of a given vehicle (or multiple |
|
26 |
* vehicles) when carrying given cargo. It consists of several sprite |
|
27 |
* sets. Group ids are refered as "cargo id"s by TTDPatch |
|
28 |
* documentation, contributing to the global confusion. |
|
29 |
* |
|
30 |
* A sprite set contains all sprites of a given vehicle carrying given |
|
31 |
* cargo at a given *stage* - that is usually its load stage. Ie. you |
|
32 |
* can have a spriteset for an empty wagon, wagon full of coal, |
|
33 |
* half-filled wagon etc. Each spriteset contains eight sprites (one |
|
34 |
* per direction) or four sprites if the vehicle is symmetric. */ |
|
35 |
||
3707
2999a89e8abd
(svn r4650) - NewGRF: use the correct type for _cur_spriteid
peter1138
parents:
3640
diff
changeset
|
36 |
SpriteID spriteset_start; |
455 | 37 |
int spriteset_numsets; |
38 |
int spriteset_numents; |
|
39 |
int spriteset_feature; |
|
40 |
||
41 |
int spritegroups_count; |
|
2444
e618726432a4
(svn r2970) - Newgrf: Allocate spritegroups dynamically; this allows a cargo ID to reference the previous definition of the same cargo ID, instead of causing loops.
peter1138
parents:
2345
diff
changeset
|
42 |
SpriteGroup **spritegroups; |
455 | 43 |
|
3501
cf7d2c33e7fc
(svn r4352) - NewGRF Codechange: dynamically allocate the memory used to store custom station data. This saves us approximately 40KB per GRF file, if there are no stations defined.
peter1138
parents:
2766
diff
changeset
|
44 |
uint num_stations; |
cf7d2c33e7fc
(svn r4352) - NewGRF Codechange: dynamically allocate the memory used to store custom station data. This saves us approximately 40KB per GRF file, if there are no stations defined.
peter1138
parents:
2766
diff
changeset
|
45 |
StationSpec *stations; |
2345 | 46 |
|
47 |
uint32 param[0x80]; |
|
48 |
uint param_end; /// one more than the highest set parameter |
|
3561
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
49 |
|
29c95ab685c0
(svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code.
Darkvater
parents:
3501
diff
changeset
|
50 |
GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array. |
3628
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
51 |
} GRFFile; |
455 | 52 |
|
1477 | 53 |
extern GRFFile *_first_grffile; |
455 | 54 |
|
3628
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
55 |
typedef struct GRFConfig { |
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
56 |
const char *filename; |
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
57 |
uint32 param[0x80]; |
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
58 |
byte num_params; |
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
59 |
|
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
60 |
struct GRFConfig *next; |
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
61 |
} GRFConfig; |
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
62 |
|
bd4a6601e5a2
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3561
diff
changeset
|
63 |
extern GRFConfig *_first_grfconfig; |
3638
6e0b43d905d4
(svn r4546) - NewGRF: add support for Action 0x05, type 0x04: replacement signal graphics. Thanks to Purno for supplying data to test
peter1138
parents:
3628
diff
changeset
|
64 |
extern SpriteID _signal_base; |
463
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
455
diff
changeset
|
65 |
|
2342
c19fb4f2df30
(svn r2868) Change the way NewGRFs are loaded: The loading process i no longer bolted onto the normal graphics loading.
tron
parents:
2186
diff
changeset
|
66 |
void LoadNewGRF(uint load_index, uint file_index); |
455 | 67 |
|
68 |
#endif /* NEWGRF_H */ |