author | miham |
Tue, 12 Dec 2006 18:19:33 +0000 | |
changeset 5327 | ea7fb3e7d54c |
parent 5234 | 91b7def5e4b2 |
child 5329 | 2b117d8652f0 |
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 "station.h" |
5228
c4a780348f66
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5225
diff
changeset
|
7 |
#include "newgrf_config.h" |
463
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
455
diff
changeset
|
8 |
|
5225
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
9 |
typedef enum GrfLoadingStage { |
5228
c4a780348f66
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5225
diff
changeset
|
10 |
GLS_FILESCAN, |
5225
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
11 |
GLS_LABELSCAN, |
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
12 |
GLS_INIT, |
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
13 |
GLS_ACTIVATION, |
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
14 |
GLS_END, |
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
15 |
} GrfLoadingStage; |
52ddcedcc6f7
(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.
peter1138
parents:
5210
diff
changeset
|
16 |
|
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
|
17 |
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
|
18 |
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
|
19 |
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
|
20 |
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
|
21 |
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
|
22 |
} 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
|
23 |
|
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
|
24 |
typedef struct GRFFile { |
455 | 25 |
char *filename; |
26 |
uint32 grfid; |
|
27 |
uint16 sprite_offset; |
|
3640
b73687dd2b62
(svn r4549) - NewGRF: store the grf version from Action 0x08.
peter1138
parents:
3638
diff
changeset
|
28 |
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
|
29 |
struct GRFFile *next; |
455 | 30 |
|
31 |
/* A sprite group contains all sprites of a given vehicle (or multiple |
|
32 |
* vehicles) when carrying given cargo. It consists of several sprite |
|
33 |
* sets. Group ids are refered as "cargo id"s by TTDPatch |
|
34 |
* documentation, contributing to the global confusion. |
|
35 |
* |
|
36 |
* A sprite set contains all sprites of a given vehicle carrying given |
|
37 |
* cargo at a given *stage* - that is usually its load stage. Ie. you |
|
38 |
* can have a spriteset for an empty wagon, wagon full of coal, |
|
39 |
* half-filled wagon etc. Each spriteset contains eight sprites (one |
|
40 |
* per direction) or four sprites if the vehicle is symmetric. */ |
|
41 |
||
3707
2999a89e8abd
(svn r4650) - NewGRF: use the correct type for _cur_spriteid
peter1138
parents:
3640
diff
changeset
|
42 |
SpriteID spriteset_start; |
455 | 43 |
int spriteset_numsets; |
44 |
int spriteset_numents; |
|
45 |
int spriteset_feature; |
|
46 |
||
47 |
int spritegroups_count; |
|
3865
a0bf688e6f85
(svn r4901) - Codechange: change 'SpriteGroup *' to 'struct SpriteGroup *' within StationSpec and GRFFile struct declarations. Now only code which actually references those pointers needs to know about the SpriteGroup struct. Remove some unnecessary lingering header dependencies.
peter1138
parents:
3775
diff
changeset
|
48 |
struct SpriteGroup **spritegroups; |
455 | 49 |
|
4656
acffecd6f484
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
3865
diff
changeset
|
50 |
uint sound_offset; |
acffecd6f484
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
3865
diff
changeset
|
51 |
|
3768
46d328178509
(svn r4760) - Newstations: change the way custom stations are allocated when loading from GRF, as the current way was flawed (reallocing memory which is referenced elsewhere)
peter1138
parents:
3707
diff
changeset
|
52 |
StationSpec **stations; |
2345 | 53 |
|
54 |
uint32 param[0x80]; |
|
55 |
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
|
56 |
|
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
|
57 |
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
|
58 |
} GRFFile; |
455 | 59 |
|
1477 | 60 |
extern GRFFile *_first_grffile; |
455 | 61 |
|
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
|
62 |
extern SpriteID _signal_base; |
5210
dc52acfad05c
(svn r7325) -Feature: Add support for action 5 type 0x0D, coast sprites.
peter1138
parents:
4742
diff
changeset
|
63 |
extern SpriteID _coast_base; |
4742
d5a2d3da5002
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4656
diff
changeset
|
64 |
extern bool _have_2cc; |
463
91bcad840bcd
(svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents:
455
diff
changeset
|
65 |
|
5228
c4a780348f66
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5225
diff
changeset
|
66 |
void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage); |
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
|
67 |
void LoadNewGRF(uint load_index, uint file_index); |
455 | 68 |
|
69 |
#endif /* NEWGRF_H */ |