File diff r7167:05d674bf4070 → r7168:156fd244b919
src/newgrf_spritegroup.h
Show inline comments
 
@@ -5,12 +5,25 @@
 
#ifndef NEWGRF_SPRITEGROUP_H
 
#define NEWGRF_SPRITEGROUP_H
 

	
 
#include "town.h"
 
#include "industry.h"
 

	
 
/**
 
 * Gets the value of a so-called newgrf "register".
 
 * @param i index of the register
 
 * @pre i < 0x110
 
 * @return the value of the register
 
 */
 
static inline uint32 GetRegister(uint i)
 
{
 
	assert(i < 0x110);
 
	extern uint32 _temp_store[0x110];
 
	return _temp_store[i];
 
}
 

	
 
struct SpriteGroup;
 

	
 

	
 
/* 'Real' sprite groups contain a list of other result or callback sprite
 
 * groups. */
 
struct RealSpriteGroup {
 
@@ -132,21 +145,29 @@ struct ResultSpriteGroup {
 

	
 
struct TileLayoutSpriteGroup {
 
	byte num_sprites; ///< Number of sprites in the spriteset, used for loading stages
 
	struct DrawTileSprites *dts;
 
};
 

	
 
struct IndustryProductionSpriteGroup {
 
	uint8 version;
 
	uint16 substract_input[3];
 
	uint16 add_output[2];
 
	uint8 again;
 
};
 

	
 
/* List of different sprite group types */
 
enum SpriteGroupType {
 
	SGT_INVALID,
 
	SGT_REAL,
 
	SGT_DETERMINISTIC,
 
	SGT_RANDOMIZED,
 
	SGT_CALLBACK,
 
	SGT_RESULT,
 
	SGT_TILELAYOUT,
 
	SGT_INDUSTRY_PRODUCTION,
 
};
 

	
 
/* Common wrapper for all the different sprite group types */
 
struct SpriteGroup {
 
	SpriteGroupType type;
 

	
 
@@ -154,12 +175,13 @@ struct SpriteGroup {
 
		RealSpriteGroup real;
 
		DeterministicSpriteGroup determ;
 
		RandomizedSpriteGroup random;
 
		CallbackResultSpriteGroup callback;
 
		ResultSpriteGroup result;
 
		TileLayoutSpriteGroup layout;
 
		IndustryProductionSpriteGroup indprod;
 
	} g;
 
};
 

	
 

	
 
SpriteGroup *AllocateSpriteGroup();
 
void InitializeSpriteGroupPool();