Tiberian Sun tiles are now loaded.

This commit is contained in:
Justin Marshall
2020-06-30 11:52:05 -07:00
parent 4844f4eaa7
commit 9808598a07
14 changed files with 839 additions and 1586 deletions
+3
View File
@@ -1258,6 +1258,9 @@ void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& p_min, cons
if ((col & IM_COL32_A_MASK) == 0)
return;
if (user_texture_id == NULL)
return;
const bool push_texture_id = _TextureIdStack.empty() || user_texture_id != _TextureIdStack.back();
if (push_texture_id)
PushTextureID(user_texture_id);
+149 -833
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -647,9 +647,9 @@ GroundType Ground[LAND_COUNT];
** These are the names of the theaters.
*/
TheaterDataType const Theaters[THEATER_COUNT] = {
{"TEMPERATE","TEMPERAT","TEM"},
{"SNOW","SNOW","SNO"},
{"INTERIOR","INTERIOR","INT"},
{"TEMPERATE","TEMPERAT","TEM", "ISOSNO.PAL"},
{"SNOW","SNOW","SNO", "ISOSNO.PAL"},
{"INTERIOR","INTERIOR","INT", "ISOSNO.PAL"},
};
+123 -128
View File
@@ -1785,21 +1785,21 @@ typedef enum TemplateType : unsigned short {
TEMPLATE_SHORE39,
TEMPLATE_SHORE40,
TEMPLATE_SHORE41,
TEMPLATE_SHORE42,
TEMPLATE_SHORE43,
TEMPLATE_SHORE44,
TEMPLATE_SHORE45,
TEMPLATE_SHORE46,
TEMPLATE_SHORE47,
TEMPLATE_SHORE48,
TEMPLATE_SHORE49,
TEMPLATE_SHORE50,
TEMPLATE_SHORE51,
TEMPLATE_SHORE52,
TEMPLATE_SHORE53,
TEMPLATE_SHORE54,
TEMPLATE_SHORE55,
TEMPLATE_SHORE56,
//TEMPLATE_SHORE42,
//TEMPLATE_SHORE43,
//TEMPLATE_SHORE44,
//TEMPLATE_SHORE45,
//TEMPLATE_SHORE46,
//TEMPLATE_SHORE47,
//TEMPLATE_SHORE48,
//TEMPLATE_SHORE49,
//TEMPLATE_SHORE50,
//TEMPLATE_SHORE51,
//TEMPLATE_SHORE52,
//TEMPLATE_SHORE53,
//TEMPLATE_SHORE54,
//TEMPLATE_SHORE55,
//TEMPLATE_SHORE56,
TEMPLATE_SHORECLIFF01,
TEMPLATE_SHORECLIFF02,
TEMPLATE_SHORECLIFF03,
@@ -1828,92 +1828,86 @@ typedef enum TemplateType : unsigned short {
TEMPLATE_SHORECLIFF26,
TEMPLATE_SHORECLIFF27,
TEMPLATE_SHORECLIFF28,
TEMPLATE_SHORECLIFF29,
TEMPLATE_SHORECLIFF30,
TEMPLATE_SHORECLIFF31,
TEMPLATE_SHORECLIFF32,
TEMPLATE_SHORECLIFF33,
TEMPLATE_SHORECLIFF34,
TEMPLATE_SHORECLIFF35,
TEMPLATE_SHORECLIFF36,
TEMPLATE_SHORECLIFF37,
TEMPLATE_SHORECLIFF38,
TEMPLATE_BOULDER1,
TEMPLATE_BOULDER2,
TEMPLATE_BOULDER3,
TEMPLATE_BOULDER4,
TEMPLATE_BOULDER5,
TEMPLATE_BOULDER6,
TEMPLATE_PATCH01,
TEMPLATE_PATCH02,
TEMPLATE_PATCH03,
TEMPLATE_PATCH04,
TEMPLATE_PATCH07,
TEMPLATE_PATCH08,
TEMPLATE_PATCH13,
TEMPLATE_PATCH14,
TEMPLATE_PATCH15,
TEMPLATE_RIVER01,
TEMPLATE_RIVER02,
TEMPLATE_RIVER03,
TEMPLATE_RIVER04,
TEMPLATE_RIVER05,
TEMPLATE_RIVER06,
TEMPLATE_RIVER07,
TEMPLATE_RIVER08,
TEMPLATE_RIVER09,
TEMPLATE_RIVER10,
TEMPLATE_RIVER11,
TEMPLATE_RIVER12,
TEMPLATE_RIVER13,
TEMPLATE_FALLS1,
TEMPLATE_FALLS1A,
TEMPLATE_FALLS2,
TEMPLATE_FALLS2A,
TEMPLATE_FORD1,
TEMPLATE_FORD2,
//TEMPLATE_SHORECLIFF29,
//TEMPLATE_SHORECLIFF30,
//TEMPLATE_SHORECLIFF31,
//TEMPLATE_SHORECLIFF32,
//TEMPLATE_SHORECLIFF33,
//TEMPLATE_SHORECLIFF34,
//TEMPLATE_SHORECLIFF35,
//TEMPLATE_SHORECLIFF36,
//TEMPLATE_SHORECLIFF37,
//TEMPLATE_SHORECLIFF38,
//TEMPLATE_BOULDER1,
//TEMPLATE_BOULDER2,
//TEMPLATE_BOULDER3,
//TEMPLATE_BOULDER4,
//TEMPLATE_BOULDER5,
//TEMPLATE_BOULDER6,
//TEMPLATE_PATCH01,
//TEMPLATE_PATCH02,
//TEMPLATE_PATCH03,
//TEMPLATE_PATCH04,
//TEMPLATE_PATCH07,
//TEMPLATE_PATCH08,
//TEMPLATE_PATCH13,
//TEMPLATE_PATCH14,
//TEMPLATE_PATCH15,
//TEMPLATE_RIVER01,
//TEMPLATE_RIVER02,
//TEMPLATE_RIVER03,
//TEMPLATE_RIVER04,
//TEMPLATE_RIVER05,
//TEMPLATE_RIVER06,
//TEMPLATE_RIVER07,
//TEMPLATE_RIVER08,
//TEMPLATE_RIVER09,
//TEMPLATE_RIVER10,
//TEMPLATE_RIVER11,
//TEMPLATE_RIVER12,
//TEMPLATE_RIVER13,
TEMPLATE_BRIDGE1,
TEMPLATE_BRIDGE1D,
TEMPLATE_BRIDGE2,
TEMPLATE_BRIDGE2D,
TEMPLATE_SLOPE01,
TEMPLATE_SLOPE02,
TEMPLATE_SLOPE03,
TEMPLATE_SLOPE04,
TEMPLATE_SLOPE05,
TEMPLATE_SLOPE06,
TEMPLATE_SLOPE07,
TEMPLATE_SLOPE08,
TEMPLATE_SLOPE09,
TEMPLATE_SLOPE10,
TEMPLATE_SLOPE11,
TEMPLATE_SLOPE12,
TEMPLATE_SLOPE13,
TEMPLATE_SLOPE14,
TEMPLATE_SLOPE15,
TEMPLATE_SLOPE16,
TEMPLATE_SLOPE17,
TEMPLATE_SLOPE18,
TEMPLATE_SLOPE19,
TEMPLATE_SLOPE20,
TEMPLATE_SLOPE21,
TEMPLATE_SLOPE22,
TEMPLATE_SLOPE23,
TEMPLATE_SLOPE24,
TEMPLATE_SLOPE25,
TEMPLATE_SLOPE26,
TEMPLATE_SLOPE27,
TEMPLATE_SLOPE28,
TEMPLATE_SLOPE29,
TEMPLATE_SLOPE30,
TEMPLATE_SLOPE31,
TEMPLATE_SLOPE32,
TEMPLATE_SLOPE33,
TEMPLATE_SLOPE34,
TEMPLATE_SLOPE35,
TEMPLATE_SLOPE36,
TEMPLATE_SLOPE37,
TEMPLATE_SLOPE38,
//TEMPLATE_SLOPE01,
//TEMPLATE_SLOPE02,
//TEMPLATE_SLOPE03,
//TEMPLATE_SLOPE04,
//TEMPLATE_SLOPE05,
//TEMPLATE_SLOPE06,
//TEMPLATE_SLOPE07,
//TEMPLATE_SLOPE08,
//TEMPLATE_SLOPE09,
//TEMPLATE_SLOPE10,
//TEMPLATE_SLOPE11,
//TEMPLATE_SLOPE12,
//TEMPLATE_SLOPE13,
//TEMPLATE_SLOPE14,
//TEMPLATE_SLOPE15,
//TEMPLATE_SLOPE16,
//TEMPLATE_SLOPE17,
//TEMPLATE_SLOPE18,
//TEMPLATE_SLOPE19,
//TEMPLATE_SLOPE20,
//TEMPLATE_SLOPE21,
//TEMPLATE_SLOPE22,
//TEMPLATE_SLOPE23,
//TEMPLATE_SLOPE24,
//TEMPLATE_SLOPE25,
//TEMPLATE_SLOPE26,
//TEMPLATE_SLOPE27,
//TEMPLATE_SLOPE28,
//TEMPLATE_SLOPE29,
//TEMPLATE_SLOPE30,
//TEMPLATE_SLOPE31,
//TEMPLATE_SLOPE32,
//TEMPLATE_SLOPE33,
//TEMPLATE_SLOPE34,
//TEMPLATE_SLOPE35,
//TEMPLATE_SLOPE36,
//TEMPLATE_SLOPE37,
//TEMPLATE_SLOPE38,
TEMPLATE_ROAD01,
TEMPLATE_ROAD02,
TEMPLATE_ROAD03,
@@ -2165,26 +2159,26 @@ inline TemplateType operator++(TemplateType &n) { n = (TemplateType)(((int)n) +
*/
typedef enum TerrainType : char {
TERRAIN_NONE=-1,
TERRAIN_TREE1,
TERRAIN_TREE2,
TERRAIN_TREE3,
TERRAIN_TREE5,
TERRAIN_TREE6,
TERRAIN_TREE7,
TERRAIN_TREE8,
TERRAIN_TREE10,
TERRAIN_TREE11,
TERRAIN_TREE12,
TERRAIN_TREE13,
TERRAIN_TREE14,
TERRAIN_TREE15,
TERRAIN_TREE16,
TERRAIN_TREE17,
TERRAIN_CLUMP1,
TERRAIN_CLUMP2,
TERRAIN_CLUMP3,
TERRAIN_CLUMP4,
TERRAIN_CLUMP5,
//TERRAIN_TREE1,
//TERRAIN_TREE2,
//TERRAIN_TREE3,
//TERRAIN_TREE5,
//TERRAIN_TREE6,
//TERRAIN_TREE7,
//TERRAIN_TREE8,
//TERRAIN_TREE10,
//TERRAIN_TREE11,
//TERRAIN_TREE12,
//TERRAIN_TREE13,
//TERRAIN_TREE14,
//TERRAIN_TREE15,
//TERRAIN_TREE16,
//TERRAIN_TREE17,
//TERRAIN_CLUMP1,
//TERRAIN_CLUMP2,
//TERRAIN_CLUMP3,
//TERRAIN_CLUMP4,
//TERRAIN_CLUMP5,
TERRAIN_ICE01,
TERRAIN_ICE02,
@@ -2192,17 +2186,17 @@ typedef enum TerrainType : char {
TERRAIN_ICE04,
TERRAIN_ICE05,
TERRAIN_BOXES01,
TERRAIN_BOXES02,
TERRAIN_BOXES03,
TERRAIN_BOXES04,
TERRAIN_BOXES05,
TERRAIN_BOXES06,
TERRAIN_BOXES07,
TERRAIN_BOXES08,
TERRAIN_BOXES09,
TERRAIN_MINE,
//TERRAIN_BOXES01,
//TERRAIN_BOXES02,
//TERRAIN_BOXES03,
//TERRAIN_BOXES04,
//TERRAIN_BOXES05,
//TERRAIN_BOXES06,
//TERRAIN_BOXES07,
//TERRAIN_BOXES08,
//TERRAIN_BOXES09,
//
//TERRAIN_MINE,
TERRAIN_COUNT,
TERRAIN_FIRST=0
@@ -2966,6 +2960,7 @@ typedef struct {
char Name[16];
char Root[10];
char Suffix[4];
char *IsoPalette;
} TheaterDataType;
+4 -2
View File
@@ -231,9 +231,11 @@ void DisplayClass::One_Time(void)
/*
** Load the generic transparent icon set.
*/
TransIconset = MFCD::Retrieve("TRANS.ICN");
// jmarshall
TransIconsetHD = Load_Stamp("TRANS_ICON", TransIconset);
// TransIconset = MFCD::Retrieve("TRANS.ICN");
//// jmarshall
// TransIconsetHD = Load_Stamp("TRANS_ICON", TransIconset);
//// jmarshall end
// jmarshall end
#ifndef NDEBUG
+4 -4
View File
@@ -23,12 +23,12 @@ struct Image_t {
int renderheight[MAX_IMAGE_SHAPES];
bool perFrameRenderDimen;
int numFrames;
void* IconMapPtr;
uint8_t* ScratchBuffer;
struct IsoTile* isoTileInfo;
};
__forceinline Image_t::Image_t() {
IconMapPtr = NULL;
isoTileInfo = NULL;
numAnimFrames = 0;
ScratchBuffer = NULL;
perFrameRenderDimen = false;
@@ -43,9 +43,9 @@ __forceinline Image_t::~Image_t() {
}
Image_t* Image_LoadImage(const char* name, bool loadAnims = false, bool loadHouseColor = false);
Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsigned char* data, unsigned char *remap = NULL);
Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsigned char* data, unsigned char *remap = NULL, unsigned char *palette = NULL);
Image_t* Find_Image(const char* name);
void Image_Add8BitImage(Image_t* image, int HouseId, int ShapeID, int Width, int Height, unsigned char* data, unsigned char* remap);
void Image_Add8BitImage(Image_t* image, int HouseId, int ShapeID, int Width, int Height, unsigned char* data, unsigned char* remap, unsigned char* palette = NULL);
bool Image_Add32BitImage(const char* name, Image_t* image, int HouseId, int ShapeID, int frameId);
Image_t* Image_CreateBlankImage(const char* name, int width, int height);
+9
View File
@@ -3072,6 +3072,15 @@ static void Init_Bootstrap_Mixfiles(void)
assert(ok);
#endif //WIN32
// Isometric Files
new MFCD("cache.mix", &FastKey, MIX_FILE_TS);
{
bool ok = MFCD::Cache("cache.mix");
assert(ok);
}
// jmarshall end
RequiredCD = temp;
}
+388 -386
View File
@@ -74,116 +74,116 @@ static short const _List1111[] = {0, 1, MAP_CELL_W, MAP_CELL_W+1, REFRESH_EOL};
static short const _List111000010110[] = {0, 1, 2, MAP_CELL_W+3, MAP_CELL_W*2+1, MAP_CELL_W*2+2, REFRESH_EOL};
static TerrainTypeClass const Mine(
TERRAIN_MINE,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"MINE",
TXT_ORE_MINE,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes01(
TERRAIN_BOXES01,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES01",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes02(
TERRAIN_BOXES02,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES02",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes03(
TERRAIN_BOXES03,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES03",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes04(
TERRAIN_BOXES04,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES04",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes05(
TERRAIN_BOXES05,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES05",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes06(
TERRAIN_BOXES06,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES06",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes07(
TERRAIN_BOXES07,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES07",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes08(
TERRAIN_BOXES08,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES08",
TXT_CRATES,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Boxes09(
TERRAIN_BOXES09,
THEATERF_INTERIOR,
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"BOXES09",
TXT_CRATES,
(short const *)_List10,
NULL
);
//static TerrainTypeClass const Mine(
// TERRAIN_MINE,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "MINE",
// TXT_ORE_MINE,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes01(
// TERRAIN_BOXES01,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES01",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes02(
// TERRAIN_BOXES02,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES02",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes03(
// TERRAIN_BOXES03,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES03",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes04(
// TERRAIN_BOXES04,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES04",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes05(
// TERRAIN_BOXES05,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES05",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes06(
// TERRAIN_BOXES06,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES06",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes07(
// TERRAIN_BOXES07,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES07",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes08(
// TERRAIN_BOXES08,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES08",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
//static TerrainTypeClass const Boxes09(
// TERRAIN_BOXES09,
// THEATERF_INTERIOR,
// XYP_COORD(12,24), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "BOXES09",
// TXT_CRATES,
// (short const *)_List10,
// NULL
//);
static TerrainTypeClass const Ice01(
TERRAIN_ICE01,
@@ -191,7 +191,7 @@ static TerrainTypeClass const Ice01(
XYP_COORD(24,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
true, // Is based on the water?
"ICE01",
"ICE0101",
TXT_ICE,
(short const *)_List1111,
NULL
@@ -202,7 +202,7 @@ static TerrainTypeClass const Ice02(
XYP_COORD(12,24), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
true, // Is based on the water?
"ICE02",
"ICE0102",
TXT_ICE,
(short const *)_List1010,
NULL
@@ -213,7 +213,7 @@ static TerrainTypeClass const Ice03(
XYP_COORD(24,12), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
true, // Is based on the water?
"ICE03",
"ICE0103",
TXT_ICE,
(short const *)_List11,
NULL
@@ -224,7 +224,7 @@ static TerrainTypeClass const Ice04(
XYP_COORD(12,12), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
true, // Is based on the water?
"ICE04",
"ICE0104",
TXT_ICE,
(short const *)_List10,
NULL
@@ -235,251 +235,251 @@ static TerrainTypeClass const Ice05(
XYP_COORD(12,12), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
true, // Is based on the water?
"ICE05",
"ICE0105",
TXT_ICE,
(short const *)_List10,
NULL
);
static TerrainTypeClass const Tree1Class(
TERRAIN_TREE1,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(11,41), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T01",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree2Class(
TERRAIN_TREE2,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(11,44), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T02",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree3Class(
TERRAIN_TREE3,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(12,45), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T03",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree5Class(
TERRAIN_TREE5,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(15,41), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T05",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree6Class(
TERRAIN_TREE6,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(16,37), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T06",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree7Class(
TERRAIN_TREE7,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(15,41), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T07",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree8Class(
TERRAIN_TREE8,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(14,22), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T08",
TXT_TREE,
(short const *)_List10,
(short const *)_List01
);
static TerrainTypeClass const Tree10Class(
TERRAIN_TREE10,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(25,43), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T10",
TXT_TREE,
(short const *)_List0011,
(short const *)_List1100
);
static TerrainTypeClass const Tree11Class(
TERRAIN_TREE11,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(23,44), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T11",
TXT_TREE,
(short const *)_List0011,
(short const *)_List1100
);
static TerrainTypeClass const Tree12Class(
TERRAIN_TREE12,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(14,36), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T12",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree13Class(
TERRAIN_TREE13,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(19,40), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T13",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1101
);
static TerrainTypeClass const Tree14Class(
TERRAIN_TREE14,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(19,40), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T14",
TXT_TREE,
(short const *)_List0011,
(short const *)_List1100
);
static TerrainTypeClass const Tree15Class(
TERRAIN_TREE15,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(19,40), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T15",
TXT_TREE,
(short const *)_List0011,
(short const *)_List1100
);
static TerrainTypeClass const Tree16Class(
TERRAIN_TREE16,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(13,36), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T16",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Tree17Class(
TERRAIN_TREE17,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(18,44), // Center base coordinate offset.
false, // Is it immune to normal combat damage?
false, // Is based on the water?
"T17",
TXT_TREE,
(short const *)_List0010,
(short const *)_List1001
);
static TerrainTypeClass const Clump1Class(
TERRAIN_CLUMP1,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(28,41), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"TC01",
TXT_TREE,
(short const *)_List000110,
(short const *)_List110001
);
static TerrainTypeClass const Clump2Class(
TERRAIN_CLUMP2,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(38,41), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"TC02",
TXT_TREE,
(short const *)_List010110,
(short const *)_List101001
);
static TerrainTypeClass const Clump3Class(
TERRAIN_CLUMP3,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(33,35), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"TC03",
TXT_TREE,
(short const *)_List110110,
(short const *)_List001
);
static TerrainTypeClass const Clump4Class(
TERRAIN_CLUMP4,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(44,49), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"TC04",
TXT_TREE,
(short const *)_List000011101000,
(short const *)_List111000010110
);
static TerrainTypeClass const Clump5Class(
TERRAIN_CLUMP5,
THEATERF_TEMPERATE|THEATERF_SNOW,
XYP_COORD(49,58), // Center base coordinate offset.
true, // Is it immune to normal combat damage?
false, // Is based on the water?
"TC05",
TXT_TREE,
(short const *)_List001011100110,
(short const *)_List110000011001
);
//static TerrainTypeClass const Tree1Class(
// TERRAIN_TREE1,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(11,41), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T01",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree2Class(
// TERRAIN_TREE2,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(11,44), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T02",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree3Class(
// TERRAIN_TREE3,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(12,45), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T03",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree5Class(
// TERRAIN_TREE5,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(15,41), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T05",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree6Class(
// TERRAIN_TREE6,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(16,37), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T06",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree7Class(
// TERRAIN_TREE7,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(15,41), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T07",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree8Class(
// TERRAIN_TREE8,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(14,22), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T08",
// TXT_TREE,
// (short const *)_List10,
// (short const *)_List01
//);
//
//static TerrainTypeClass const Tree10Class(
// TERRAIN_TREE10,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(25,43), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T10",
// TXT_TREE,
// (short const *)_List0011,
// (short const *)_List1100
//);
//
//static TerrainTypeClass const Tree11Class(
// TERRAIN_TREE11,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(23,44), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T11",
// TXT_TREE,
// (short const *)_List0011,
// (short const *)_List1100
//);
//
//static TerrainTypeClass const Tree12Class(
// TERRAIN_TREE12,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(14,36), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T12",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree13Class(
// TERRAIN_TREE13,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(19,40), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T13",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1101
//);
//
//static TerrainTypeClass const Tree14Class(
// TERRAIN_TREE14,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(19,40), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T14",
// TXT_TREE,
// (short const *)_List0011,
// (short const *)_List1100
//);
//
//static TerrainTypeClass const Tree15Class(
// TERRAIN_TREE15,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(19,40), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T15",
// TXT_TREE,
// (short const *)_List0011,
// (short const *)_List1100
//);
//
//static TerrainTypeClass const Tree16Class(
// TERRAIN_TREE16,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(13,36), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T16",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Tree17Class(
// TERRAIN_TREE17,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(18,44), // Center base coordinate offset.
// false, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "T17",
// TXT_TREE,
// (short const *)_List0010,
// (short const *)_List1001
//);
//
//static TerrainTypeClass const Clump1Class(
// TERRAIN_CLUMP1,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(28,41), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "TC01",
// TXT_TREE,
// (short const *)_List000110,
// (short const *)_List110001
//);
//
//static TerrainTypeClass const Clump2Class(
// TERRAIN_CLUMP2,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(38,41), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "TC02",
// TXT_TREE,
// (short const *)_List010110,
// (short const *)_List101001
//);
//
//static TerrainTypeClass const Clump3Class(
// TERRAIN_CLUMP3,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(33,35), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "TC03",
// TXT_TREE,
// (short const *)_List110110,
// (short const *)_List001
//);
//
//static TerrainTypeClass const Clump4Class(
// TERRAIN_CLUMP4,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(44,49), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "TC04",
// TXT_TREE,
// (short const *)_List000011101000,
// (short const *)_List111000010110
//);
//
//static TerrainTypeClass const Clump5Class(
// TERRAIN_CLUMP5,
// THEATERF_TEMPERATE|THEATERF_SNOW,
// XYP_COORD(49,58), // Center base coordinate offset.
// true, // Is it immune to normal combat damage?
// false, // Is based on the water?
// "TC05",
// TXT_TREE,
// (short const *)_List001011100110,
// (short const *)_List110000011001
//);
/***********************************************************************************************
@@ -595,41 +595,41 @@ void TerrainTypeClass::Init_Heap(void)
** are specified in the TerrainType enumeration. This is necessary because the heap
** allocation block index serves double duty as the type number index.
*/
new TerrainTypeClass(Tree1Class); // TERRAIN_TREE1
new TerrainTypeClass(Tree2Class); // TERRAIN_TREE2
new TerrainTypeClass(Tree3Class); // TERRAIN_TREE3
new TerrainTypeClass(Tree5Class); // TERRAIN_TREE5
new TerrainTypeClass(Tree6Class); // TERRAIN_TREE6
new TerrainTypeClass(Tree7Class); // TERRAIN_TREE7
new TerrainTypeClass(Tree8Class); // TERRAIN_TREE8
new TerrainTypeClass(Tree10Class); // TERRAIN_TREE10
new TerrainTypeClass(Tree11Class); // TERRAIN_TREE11
new TerrainTypeClass(Tree12Class); // TERRAIN_TREE12
new TerrainTypeClass(Tree13Class); // TERRAIN_TREE13
new TerrainTypeClass(Tree14Class); // TERRAIN_TREE14
new TerrainTypeClass(Tree15Class); // TERRAIN_TREE15
new TerrainTypeClass(Tree16Class); // TERRAIN_TREE16
new TerrainTypeClass(Tree17Class); // TERRAIN_TREE17
new TerrainTypeClass(Clump1Class); // TERRAIN_CLUMP1
new TerrainTypeClass(Clump2Class); // TERRAIN_CLUMP2
new TerrainTypeClass(Clump3Class); // TERRAIN_CLUMP3
new TerrainTypeClass(Clump4Class); // TERRAIN_CLUMP4
new TerrainTypeClass(Clump5Class); // TERRAIN_CLUMP5
//new TerrainTypeClass(Tree1Class); // TERRAIN_TREE1
//new TerrainTypeClass(Tree2Class); // TERRAIN_TREE2
//new TerrainTypeClass(Tree3Class); // TERRAIN_TREE3
//new TerrainTypeClass(Tree5Class); // TERRAIN_TREE5
//new TerrainTypeClass(Tree6Class); // TERRAIN_TREE6
//new TerrainTypeClass(Tree7Class); // TERRAIN_TREE7
//new TerrainTypeClass(Tree8Class); // TERRAIN_TREE8
//new TerrainTypeClass(Tree10Class); // TERRAIN_TREE10
//new TerrainTypeClass(Tree11Class); // TERRAIN_TREE11
//new TerrainTypeClass(Tree12Class); // TERRAIN_TREE12
//new TerrainTypeClass(Tree13Class); // TERRAIN_TREE13
//new TerrainTypeClass(Tree14Class); // TERRAIN_TREE14
//new TerrainTypeClass(Tree15Class); // TERRAIN_TREE15
//new TerrainTypeClass(Tree16Class); // TERRAIN_TREE16
//new TerrainTypeClass(Tree17Class); // TERRAIN_TREE17
//new TerrainTypeClass(Clump1Class); // TERRAIN_CLUMP1
//new TerrainTypeClass(Clump2Class); // TERRAIN_CLUMP2
//new TerrainTypeClass(Clump3Class); // TERRAIN_CLUMP3
//new TerrainTypeClass(Clump4Class); // TERRAIN_CLUMP4
//new TerrainTypeClass(Clump5Class); // TERRAIN_CLUMP5
new TerrainTypeClass(Ice01); // TERRAIN_ICE01
new TerrainTypeClass(Ice02); // TERRAIN_ICE02
new TerrainTypeClass(Ice03); // TERRAIN_ICE03
new TerrainTypeClass(Ice04); // TERRAIN_ICE04
new TerrainTypeClass(Ice05); // TERRAIN_ICE05
new TerrainTypeClass(Boxes01); // TERRAIN_BOXES01
new TerrainTypeClass(Boxes02); // TERRAIN_BOXES02
new TerrainTypeClass(Boxes03); // TERRAIN_BOXES03
new TerrainTypeClass(Boxes04); // TERRAIN_BOXES04
new TerrainTypeClass(Boxes05); // TERRAIN_BOXES05
new TerrainTypeClass(Boxes06); // TERRAIN_BOXES06
new TerrainTypeClass(Boxes07); // TERRAIN_BOXES07
new TerrainTypeClass(Boxes08); // TERRAIN_BOXES08
new TerrainTypeClass(Boxes09); // TERRAIN_BOXES09
new TerrainTypeClass(Mine); // TERRAIN_MINE
//new TerrainTypeClass(Boxes01); // TERRAIN_BOXES01
//new TerrainTypeClass(Boxes02); // TERRAIN_BOXES02
//new TerrainTypeClass(Boxes03); // TERRAIN_BOXES03
//new TerrainTypeClass(Boxes04); // TERRAIN_BOXES04
//new TerrainTypeClass(Boxes05); // TERRAIN_BOXES05
//new TerrainTypeClass(Boxes06); // TERRAIN_BOXES06
//new TerrainTypeClass(Boxes07); // TERRAIN_BOXES07
//new TerrainTypeClass(Boxes08); // TERRAIN_BOXES08
//new TerrainTypeClass(Boxes09); // TERRAIN_BOXES09
//new TerrainTypeClass(Mine); // TERRAIN_MINE
}
@@ -670,6 +670,8 @@ void TerrainTypeClass::One_Time(void)
*=============================================================================================*/
void TerrainTypeClass::Init(TheaterType theater)
{
void* terrainPalette = (void*)MFCD::Retrieve(Theaters[theater].IsoPalette);
if (theater != LastTheater) {
for (TerrainType index = TERRAIN_FIRST; index < TERRAIN_COUNT; index++) {
@@ -701,12 +703,12 @@ void TerrainTypeClass::Init(TheaterType theater)
{
char tmp[512];
sprintf(tmp, "icon_%s", fullname);
((void const*&)terrain.HDImageData) = Load_Stamp(fullname, terrain.ImageData);
((void const*&)terrain.HDImageData) = Load_Stamp(fullname, terrain.ImageData, terrainPalette);
}
IsTheaterShape = true; //Let Build_Frame know that this is a theater specific shape
if (terrain.RadarIcon != NULL) delete[] (char *)terrain.RadarIcon;
((void const *&)terrain.RadarIcon) = Get_Radar_Icon(terrain.Get_Image_Data(), 0, 1, 3);
// ((void const *&)terrain.RadarIcon) = Get_Radar_Icon(terrain.Get_Image_Data(), 0, 1, 3);
IsTheaterShape = false;
}
+5 -4
View File
@@ -491,10 +491,11 @@ void TerrainClass::AI(void)
assert(IsActive);
ObjectClass::AI();
if ((*this == TERRAIN_MINE) && (Frame % (Rule.GrowthRate * TICKS_PER_MINUTE)) == 0) {
Map[::As_Cell(As_Target())].Spread_Tiberium(true);
}
// jmarshall - add back terrain mine
//if ((*this == TERRAIN_MINE) && (Frame % (Rule.GrowthRate * TICKS_PER_MINUTE)) == 0) {
// Map[::As_Cell(As_Target())].Spread_Tiberium(true);
//}
// jmarshall end
if (StageClass::Graphic_Logic()) {
Mark();
+136 -208
View File
@@ -30,183 +30,124 @@ using std::memcpy;
class GraphicViewPortClass;
#define TD_TILESET_CHECK 0x20
/**
* @brief union is to handle the parts of the header which vary between TD and RA format tiles.
*/
struct IconControlType
{
uint8_t* Get_Icon_Data()
{
if (td.icons == TD_TILESET_CHECK) {
return reinterpret_cast<uint8_t*>(this) + td.icons;
}
else {
return reinterpret_cast<uint8_t*>(this) + ra.icons;
}
}
uint8_t* Get_Icon_Map()
{
if (td.icons == TD_TILESET_CHECK) {
return reinterpret_cast<uint8_t*>(this) + td.map;
}
else {
return reinterpret_cast<uint8_t*>(this) + ra.map;
}
}
int16_t width; // always 24 (ICON_WIDTH)
int16_t height; // always 24 (ICON_HEIGHT)
int16_t count; // count of cells in set, not same as images
int16_t allocated; // is treated like a bool, always 0 in the file?
union
{
struct
{
int32_t size; // filesize
int32_t icons; // always 0x00000020
int32_t palettes; // seems to always be 0x00000000
int32_t remaps; // unknown, bitfield?
int32_t trans_flag; // array of images length, unknown
int32_t map; // image index for each cell
} td;
struct
{
int16_t map_width; // tile width in cells
int16_t map_height; // tile height in cells
int32_t size; // filesize
int32_t icons; // always 0x00000028
int32_t palettes; // seems to always be 0x00000000
int32_t remaps; // unknown, bitfield?
int32_t trans_flag; // array of images length, unknown
int32_t color_map; // terrain type index, ra only
int32_t map; // image index for each cell
} ra;
};
struct IsoTileHeader_t {
int TileWidth;
int TileHeight;
int TileImageWidth;
int TileImageHeight;
};
static int IconEntry;
static void* IconData;
static IconControlType* LastIconset;
static uint8_t* StampPtr;
static uint8_t* TransFlagPtr;
static uint8_t* MapPtr;
static int IconWidth;
static int IconHeight;
static int IconSize;
static int IconCount;
byte TempTSStampData[48 * 24 * 4];
void __cdecl Init_Stamps(IconControlType* iconset)
{
if (iconset && LastIconset != iconset) {
IconCount = (iconset->count);
IconWidth = (iconset->width);
IconHeight = (iconset->height);
LastIconset = iconset;
IconSize = IconWidth * IconHeight;
// TD and RA tileset headers are slightly different, so check a constant that only exists in one type.
if ((iconset->td.icons) == TD_TILESET_CHECK) {
MapPtr = reinterpret_cast<uint8_t*>(iconset) + (iconset->td.map);
StampPtr = reinterpret_cast<uint8_t*>(iconset) + (iconset->td.icons);
TransFlagPtr = reinterpret_cast<uint8_t*>(iconset) + (iconset->td.trans_flag);
}
else {
MapPtr = reinterpret_cast<uint8_t*>(iconset) + (iconset->ra.map);
StampPtr = reinterpret_cast<uint8_t*>(iconset) + (iconset->ra.icons);
TransFlagPtr = reinterpret_cast<uint8_t*>(iconset) + (iconset->ra.trans_flag);
}
}
}
void __cdecl Buffer_Draw_Stamp2(GraphicViewPortClass& viewport, IconControlType* tileset, int icon, int x, int y, const void* remapper)
struct IsoTileImageHeader
{
if (!tileset) {
return;
int TileX;
int TileY;
uint8_t* GetExtraData(IsoTile *tile)
{
return reinterpret_cast<uint8_t*>(tile) + ExtraOffset;
}
if (LastIconset != tileset) {
Init_Stamps(tileset);
uint8_t* GetZData(IsoTile* tile)
{
return reinterpret_cast<uint8_t*>(tile) + ZDataoffset;
}
uint8_t* GetExtraZData(IsoTile* tile)
{
return reinterpret_cast<uint8_t*>(tile) + ExtraZOffset;
}
uint8_t* GetData() {
return reinterpret_cast<uint8_t*>(this) + sizeof(IsoTileImageHeader);
}
int32_t icon_index = MapPtr != nullptr ? MapPtr[icon] : icon;
// https://xhp.xwis.net/documents/TMP_TS_Format.html
uint8_t* GetRasterizedData() {
memset(TempTSStampData, 0, sizeof(TempTSStampData));
uint8_t* tileData = GetData();
byte* w_line = TempTSStampData;
int x = 24;
int global_cx = 48;
int cx = 0;
for (int y = 0; y < 12; y++)
{
cx += 4;
x -= 2;
memcpy(w_line + x, tileData, cx);
tileData += cx;
w_line += global_cx;
}
for (; y < 23; y++)
{
cx -= 4;
x += 2;
memcpy(w_line + x, tileData, cx);
tileData += cx;
w_line += global_cx;
}
if (icon_index < IconCount) {
int32_t fullpitch = viewport.Get_Full_Pitch(); //(viewport.Get_Pitch() + viewport.Get_XAdd() + viewport.Get_Width());
uint8_t* dst = (x * 4) + (y * 4) * fullpitch + (uint8_t*)(viewport.Get_Offset());
int32_t blitpitch = fullpitch - IconWidth;
uint8_t* src = &StampPtr[IconSize * icon_index];
if (remapper) {
const uint8_t* remap = static_cast<const uint8_t*>(remapper);
for (int i = 0; i < IconHeight; ++i) {
for (int j = 0; j < IconWidth; ++j) {
uint8_t cur_byte = remap[*src++];
if (cur_byte) {
dst[0] = backbuffer_data_raw[(cur_byte * 3) + 0];
dst[1] = backbuffer_data_raw[(cur_byte * 3) + 1];
dst[2] = backbuffer_data_raw[(cur_byte * 3) + 2];
dst[3] = 255;
}
dst+=4;
}
dst += blitpitch;
}
}
else if (TransFlagPtr[icon_index]) {
for (int i = 0; i < IconHeight; ++i) {
for (int j = 0; j < IconWidth; ++j) {
uint8_t cur_byte = *src++;
if (cur_byte) {
dst[0] = backbuffer_data_raw[(cur_byte * 3) + 0];
dst[1] = backbuffer_data_raw[(cur_byte * 3) + 1];
dst[2] = backbuffer_data_raw[(cur_byte * 3) + 2];
dst[3] = 255;
}
dst += 4;
}
dst += blitpitch;
}
}
else {
for (int32_t i = 0; i < IconHeight; ++i) {
FastScanlinePaletteBlit(dst, src, IconWidth);
dst += fullpitch;
src += IconWidth * 4;
}
}
return TempTSStampData;
}
}
int32_t ExtraOffset;
int32_t ZDataoffset;
int32_t ExtraZOffset;
signed int ExtraX;
signed int ExtraY;
int ExtraWidth;
int ExtraHeight;
struct Flags
{
unsigned int HasExtraData : 1; //1
unsigned int HasZData : 1; //2
unsigned int HasDamagedData : 1; //4
// invalid cause memory wasn'y cleared so all bitfields are at 0xCD by default
//unsigned int Bit8 : 1; //8
//unsigned int Bit16 : 1; //16
//unsigned int Bit32 : 1; //32
//unsigned int Bit64 : 1; //64
//unsigned int Bit128 : 1; //128
};
unsigned char Height;
unsigned char TileType;
unsigned char RampType;
RGBClass LowRGB;
RGBClass HighRGB;
unsigned char Padding[3];
};
class IsoTile {
public:
int TileImageWidth() { return header.TileImageWidth; }
int TileImageHeight() { return header.TileImageHeight; }
IsoTileImageHeader *GetTileInfo(int idx) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(this);
ptr += sizeof(IsoTileHeader_t);
uint32_t* offsets = (uint32_t*)ptr;
IsoTileImageHeader* tileImageHeaders = (IsoTileImageHeader * )(((uint8_t*)this) + offsets[idx]);
return tileImageHeaders;
}
int NumTiles(void) { return header.TileWidth * header.TileHeight; }
private:
IsoTileHeader_t header;
};
Image_t* Load_StampHD(int theater, const char* iconName, const void* icondata) {
char filename[2048];
Image_t* image = NULL;
IconControlType* tileset = (IconControlType*)icondata;
if (!tileset) {
return NULL;
}
if (LastIconset != tileset) {
Init_Stamps(tileset);
}
IsoTile* isoTile = (IsoTile*)icondata;
if (!isoTile) {
return NULL;
}
// This is because were trying to avoid parsing the XML's and the filenames aren't consistant.
const char* theaterName = Theaters[theater].Name;
for (int i = 0; i < IconCount; i++)
for (int i = 0; i < isoTile->NumTiles(); i++)
{
char filename[512];
char fixedIconName[512];
@@ -256,9 +197,9 @@ Image_t* Load_StampHD(int theater, const char* iconName, const void* icondata) {
}
void Get_Stamp_Size(const void* icondata, int* width, int* height) {
IconControlType* tileset = (IconControlType*)icondata;
IsoTile* isoTile = (IsoTile*)icondata;
if (!tileset) {
if (!isoTile) {
for (int i = 0; i < MAX_IMAGE_SHAPES; i++) {
*width = -1;
*height = -1;
@@ -266,37 +207,19 @@ void Get_Stamp_Size(const void* icondata, int* width, int* height) {
return;
}
if (LastIconset != tileset) {
Init_Stamps(tileset);
}
for (int i = 0; i < MAX_IMAGE_SHAPES; i++) {
width[i] = IconWidth;
height[i] = IconHeight;
width[i] = isoTile->TileImageWidth();
height[i] = isoTile->TileImageHeight();
}
}
Image_t * Load_Stamp(const char *name, const void* icondata)
Image_t * Load_Stamp(const char *name, const void* icondata, void* terrainPalette)
{
IconControlType* tileset = (IconControlType*)icondata;
if (!tileset) {
return NULL;
}
if (LastIconset != tileset) {
Init_Stamps(tileset);
}
int icon_index = 0;
if (icon_index >= IconCount) {
IsoTile* isoTile = (IsoTile*)icondata;
if (!isoTile) {
return NULL;
}
uint8_t* src = &StampPtr[IconSize * icon_index];
// Check to see if the image is already loaded.
{
Image_t* image = Find_Image(name);
@@ -305,30 +228,35 @@ Image_t * Load_Stamp(const char *name, const void* icondata)
}
}
Image_t *image = Image_CreateImageFrom8Bit(name, IconWidth, IconHeight, (unsigned char*)src);
image->IconMapPtr = MapPtr;
if (IconCount == 1)
return image;
uint8_t* src = isoTile->GetTileInfo(0)->GetRasterizedData();
Image_t *image = Image_CreateImageFrom8Bit(name, isoTile->TileImageWidth(), isoTile->TileImageHeight(), (unsigned char*)src, NULL, (unsigned char *)terrainPalette);
if (image == NULL) {
return NULL;
}
for (int i = 1; i < IconCount; i++) {
icon_index = i;
src = &StampPtr[IconSize * icon_index];
Image_Add8BitImage(image, 0, i, IconWidth, IconHeight, src, NULL);
image->isoTileInfo = isoTile;
for (int i = 1; i < isoTile->NumTiles(); i++) {
src = isoTile->GetTileInfo(i)->GetRasterizedData();
Image_Add8BitImage(image, 0, i, isoTile->TileImageWidth(), isoTile->TileImageHeight(), src, NULL, (unsigned char*)terrainPalette);
}
return image;
}
int Stamp_GetIconIndex(Image_t* iconImage, int icon) {
uint8_t* MapPtr = (uint8_t*)iconImage->IconMapPtr;
return MapPtr != nullptr ? MapPtr[icon] : icon;
return icon;
}
void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void *icondata, int icon, int x, int y, const void* remapper, int left, int top, int right, int bottom)
{
Image_t* iconImage = (Image_t*)icondata;
uint8_t* MapPtr = (uint8_t * )iconImage->IconMapPtr;
int icon_index = MapPtr != nullptr ? MapPtr[icon] : icon;
IsoTile* isoTile = iconImage->isoTileInfo;
if (icon > isoTile->NumTiles())
icon = isoTile->NumTiles() - 1;
IsoTileImageHeader* isoStampImage = isoTile->GetTileInfo(icon);
int icon_index = icon;
{
int blit_height = CELL_PIXEL_H;
int blit_width = CELL_PIXEL_W;
@@ -339,14 +267,14 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void
int ystart = top + y;
if (xstart < width && ystart < height && IconHeight + ystart > top && IconWidth + xstart > left) {
if (xstart < width && ystart < height && iconImage->isoTileInfo->TileImageHeight() + ystart > top && iconImage->isoTileInfo->TileImageWidth() + xstart > left) {
if (xstart < left) {
// src += left - xstart;
blit_width -= left - xstart;
xstart = left;
}
int src_pitch = IconWidth - blit_width;
int src_pitch = iconImage->isoTileInfo->TileImageWidth() - blit_width;
if (blit_width + xstart > width) {
src_pitch += blit_width - (width - xstart);
@@ -354,7 +282,7 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void
}
if (top > ystart) {
blit_height = IconHeight - (top - ystart);
blit_height = iconImage->isoTileInfo->TileImageHeight() - (top - ystart);
// src += IconWidth * (top - ystart);
ystart = top;
}
@@ -430,19 +358,19 @@ extern "C" void __cdecl Buffer_Draw_Stamp_Clip(void const* this_object, void con
}
extern "C" void __cdecl Buffer_Draw_Stamp(void const* thisptr, void const* icondata, int icon, int x_pixel, int y_pixel, void const* remap) {
Buffer_Draw_Stamp2(*((GraphicViewPortClass*)thisptr), (IconControlType*)icondata, icon, x_pixel, y_pixel, remap);
// NOT USED
}
uint8_t* Get_Icon_Set_Map(void* temp)
{
if (temp != nullptr) {
if ((static_cast<IconControlType*>(temp)->td.icons) == TD_TILESET_CHECK) {
return static_cast<uint8_t*>(temp) + (static_cast<IconControlType*>(temp)->td.icons);
}
else {
return static_cast<uint8_t*>(temp) + (static_cast<IconControlType*>(temp)->ra.icons);
}
}
//if (temp != nullptr) {
// if ((static_cast<IconControlType*>(temp)->td.icons) == TD_TILESET_CHECK) {
// return static_cast<uint8_t*>(temp) + (static_cast<IconControlType*>(temp)->td.icons);
// }
// else {
// return static_cast<uint8_t*>(temp) + (static_cast<IconControlType*>(temp)->ra.icons);
// }
//}
return nullptr;
}
+1 -1
View File
@@ -63,7 +63,7 @@ extern "C" {
struct Image_t;
Image_t* Load_Stamp(const char* name, const void* icondata);
Image_t* Load_Stamp(const char* name, const void* icondata, void *terrainPalette);
int Stamp_GetIconIndex(Image_t* iconImage, int icon);
void Get_Stamp_Size(const void* icondata, int *width, int *height);
Image_t* Load_StampHD(int theater, const char* iconName, const void *icondata);
+11 -3
View File
@@ -389,7 +389,7 @@ Image_t *Find_Image(const char* name) {
return NULL;
}
Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsigned char *data, unsigned char* remap) {
Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsigned char *data, unsigned char* remap, unsigned char* ccpalete) {
int64_t hash = generateHashValue(name, strlen(name));
int image_table_size = loaded_images.size();
@@ -405,7 +405,9 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi
}
}
unsigned char* ccpalete = (unsigned char*)CCPalette.Get_Data();
if (ccpalete == NULL)
ccpalete = (unsigned char*)CCPalette.Get_Data();
Image_t* image = new Image_t();
unsigned char *buffer = new unsigned char[Width * Height * 4];
@@ -427,6 +429,9 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi
b = 0;
a = 128;
}
else if (r == 0 && g == 0 && b == 0) {
r = g = b = a = 0;
}
else if (c != 0) {
a = 255;
}
@@ -459,9 +464,12 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi
return image;
}
void Image_Add8BitImage(Image_t *image, int HouseId, int ShapeID, int Width, int Height, unsigned char* data, unsigned char* remap) {
void Image_Add8BitImage(Image_t *image, int HouseId, int ShapeID, int Width, int Height, unsigned char* data, unsigned char* remap, unsigned char *palette) {
unsigned char* buffer = new unsigned char[Width * Height * 4];
unsigned char* ccpalete = (unsigned char*)CCPalette.Get_Data();
if (palette) {
ccpalete = palette;
}
if (image->width != Width || image->height != Height) {
assert(!"Image_Add8BitImage: Invalid new dimensions!");