newgrf.h
author Darkvater
Sat, 15 Apr 2006 21:27:59 +0000
changeset 3561 2f67415d44aa
parent 3501 0a0c5bcc9a72
child 3628 69646d0924a5
permissions -rw-r--r--
(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.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 1477
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 1477
diff changeset
     2
455
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
     3
#ifndef NEWGRF_H
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
     4
#define NEWGRF_H
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
     5
463
97ec66c280f2 (svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents: 455
diff changeset
     6
#include "sprite.h"
97ec66c280f2 (svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents: 455
diff changeset
     7
#include "station.h"
97ec66c280f2 (svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents: 455
diff changeset
     8
3561
2f67415d44aa (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 {
2f67415d44aa (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;
2f67415d44aa (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;
2f67415d44aa (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;
2f67415d44aa (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;
2f67415d44aa (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;
2f67415d44aa (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
1477
9389baf2bf3c (svn r1981) Typedef some structs and enums
tron
parents: 463
diff changeset
    16
typedef struct GRFFile GRFFile;
455
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    17
struct GRFFile {
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    18
	char *filename;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    19
	uint32 grfid;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    20
	uint16 flags;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    21
	uint16 sprite_offset;
2625
19bf7f695537 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents: 2548
diff changeset
    22
	SpriteID first_spriteset; ///< Holds the first spriteset's sprite offset.
1477
9389baf2bf3c (svn r1981) Typedef some structs and enums
tron
parents: 463
diff changeset
    23
	GRFFile *next;
455
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    24
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    25
	/* A sprite group contains all sprites of a given vehicle (or multiple
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    26
	 * vehicles) when carrying given cargo. It consists of several sprite
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    27
	 * sets.  Group ids are refered as "cargo id"s by TTDPatch
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    28
	 * documentation, contributing to the global confusion.
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    29
	 *
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    30
	 * A sprite set contains all sprites of a given vehicle carrying given
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    31
	 * cargo at a given *stage* - that is usually its load stage. Ie. you
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    32
	 * can have a spriteset for an empty wagon, wagon full of coal,
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    33
	 * half-filled wagon etc.  Each spriteset contains eight sprites (one
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    34
	 * per direction) or four sprites if the vehicle is symmetric. */
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    35
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    36
	int spriteset_start;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    37
	int spriteset_numsets;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    38
	int spriteset_numents;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    39
	int spriteset_feature;
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    40
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    41
	int spritegroups_count;
2444
5998cd7b06e7 (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
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    43
3501
0a0c5bcc9a72 (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;
0a0c5bcc9a72 (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
f7251bd99942 (svn r2871) -Feature/Fix: Per GRF parameter lists
tron
parents: 2342
diff changeset
    46
f7251bd99942 (svn r2871) -Feature/Fix: Per GRF parameter lists
tron
parents: 2342
diff changeset
    47
	uint32 param[0x80];
f7251bd99942 (svn r2871) -Feature/Fix: Per GRF parameter lists
tron
parents: 2342
diff changeset
    48
	uint param_end; /// one more than the highest set parameter
3561
2f67415d44aa (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
2f67415d44aa (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.
455
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    51
};
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    52
1477
9389baf2bf3c (svn r1981) Typedef some structs and enums
tron
parents: 463
diff changeset
    53
extern GRFFile *_first_grffile;
455
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    54
463
97ec66c280f2 (svn r687) Export InitNewGRFFile() and DecodeSpecialSprite() properly.
pasky
parents: 455
diff changeset
    55
2342
aae24c9661ba (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
    56
void LoadNewGRF(uint load_index, uint file_index);
455
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    57
b151d55203bf (svn r665) code fixes for newgrf.c/newgrf.h
dominik
parents: 453
diff changeset
    58
#endif /* NEWGRF_H */