Merge remote-tracking branch 'upstream/master' into nev6502_branch

This commit is contained in:
nev6502
2020-06-17 20:14:52 -06:00
8 changed files with 108 additions and 10 deletions
+1 -1
View File
@@ -709,7 +709,7 @@ set(src_external
)
add_definitions(-DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR -DWINDOWS_IGNORE_PACKING_MISMATCH -DTRUE_FALSE_DEFINED -DWIN32 -DWINDOWS -DENGLISH -D_USRDLL -DREDALERT_EXPORTS)
add_definitions(-D RA_AF -DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR -DWINDOWS_IGNORE_PACKING_MISMATCH -DTRUE_FALSE_DEFINED -DWIN32 -DWINDOWS -DENGLISH -D_USRDLL -DREDALERT_EXPORTS)
add_compile_options(/permissive+ /Zc:forScope- /Zp1)
add_executable(RedAlert ${src_win32lib} ${src_redalert} ${src_external})
+24 -7
View File
@@ -142,6 +142,9 @@ static short const OComList[] = {1, REFRESH_EOL};
static short const OList12[] = {0, REFRESH_EOL};
static short const OListTmpl[] = {0, 1, 2, REFRESH_EOL};
#ifdef RA_AF
#include "BDATA_AF.H"
#endif
/***************************************************************************
*/
@@ -3026,6 +3029,9 @@ void BuildingTypeClass::Init_Heap(void)
new BuildingTypeClass(ClassLarva2); // STRUCT_LARVA2
#endif
#ifdef RA_AF
new BuildingTypeClass(ClassAFV01); // STRUCT_AFV01
#endif
}
@@ -3206,13 +3212,24 @@ StructType BuildingTypeClass::From_Name(char const * name)
*=============================================================================================*/
void BuildingTypeClass::Display(int x, int y, WindowNumberType window, HousesType ) const
{
void const * ptr = Get_Cameo_Data();
if (ptr == NULL) {
IsTheaterShape = IsTheater;
ptr = Get_Image_Data();
// jmarshall - hd buildings.
Image_t* hdimage = Get_HDImage_Data();
if (hdimage != NULL) {
//CC_Draw_Shape((Image_t *)Get_HDImage_Data(), 0, x, y, window, SHAPE_CENTER | SHAPE_WIN_REL, NULL, NULL, DIR_N);
x += WindowList[window][WINDOWX];
y += WindowList[window][WINDOWY];
GL_RenderImage(hdimage, x, y, hdimage->width, hdimage->height);
}
CC_Draw_Shape(ptr, 0, x, y, window, SHAPE_CENTER|SHAPE_WIN_REL);
IsTheaterShape = false;
else {
void const* ptr = Get_Cameo_Data();
if (ptr == NULL) {
IsTheaterShape = IsTheater;
ptr = Get_Image_Data();
}
CC_Draw_Shape(ptr, 0, x, y, window, SHAPE_CENTER | SHAPE_WIN_REL);
IsTheaterShape = false;
}
// jmarshall end
}
@@ -3235,7 +3252,7 @@ void BuildingTypeClass::Display(int x, int y, WindowNumberType window, HousesTyp
void BuildingTypeClass::Prep_For_Add(void)
{
for (StructType index = STRUCT_FIRST; index < STRUCT_COUNT; index++) {
if (As_Reference(index).Get_Image_Data()) {
if (As_Reference(index).Get_Image_Data() || As_Reference(index).Get_HDImage_Data()) {
Map.Add_To_List(&As_Reference(index));
}
}
+34
View File
@@ -0,0 +1,34 @@
// BDAD_AF.H
//
// Building Data for Red Alert Allied Force.
static BuildingTypeClass const ClassAFV01(
STRUCT_AFV01,
TXT_CIV1, // NAME: Short name of the structure.
"afV01", // NAME: Short name of the structure.
FACING_S, // Foundation direction from center of building.
XYP_COORD(0, 0), // Exit point for produced units.
REMAP_ALTERNATE, // Sidebar remap logic.
0x0000, // Vertical offset.
0x0000, // Primary weapon offset along turret centerline.
0x0000, // Primary weapon lateral offset along turret centerline.
false, // Is this building a fake (decoy?)
true, // Animation rate is regulated for constant speed?
true, // Always use the given name for the building?
false, // Is this a wall type structure?
true, // Simple (one frame) damage imagery?
true, // Is it invisible to radar?
true, // Can the player select this?
true, // Is this a legal target for attack or move?
true, // Is this an insignificant building?
true, // Theater specific graphic image?
false, // Does it have a rotating turret?
false, // Can the building be color remapped to indicate owner?
RTTI_NONE, // The object type produced at this factory.
DIR_N, // Starting idle frame to match construction.
BSIZE_22, // SIZE: Building size.
NULL, // Preferred exit cell list.
(short const*)List0011, // OCCUPYLIST: List of active foundation squares.
(short const*)List1100 // OVERLAPLIST:List of overlap cell offset.
);
+3
View File
@@ -1472,6 +1472,9 @@ typedef enum StructType : char {
STRUCT_LARVA2,
#endif
#ifdef RA_AF
STRUCT_AFV01,
#endif
STRUCT_COUNT,
STRUCT_FIRST=0
} StructType;
+2 -1
View File
@@ -23,4 +23,5 @@ __forceinline Image_t::~Image_t() {
}
}
Image_t* Image_LoadImage(const char* name);
Image_t* Image_LoadImage(const char* name);
Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, char* data);
+44
View File
@@ -144,6 +144,50 @@ Image_t* Image_LoadImage(const char* name) {
return image;
}
Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, char *data) {
// Check to see if the image is already loaded.
for (int i = 0; i < loaded_images.size(); i++) {
if (!strcmp(loaded_images[i]->name, name)) {
return loaded_images[i];
}
}
Image_t* image = new Image_t();
image->buffer = new unsigned char[Width * Height * 4];
for (int i = 0; i < Width * Height; i++) {
char c = data[i];
image->buffer[(i * 4) + 0] = backbuffer_palette[(c * 3) + 0];
image->buffer[(i * 4) + 1] = backbuffer_palette[(c * 3) + 1];
image->buffer[(i * 4) + 2] = backbuffer_palette[(c * 3) + 2];
if (c == 0) {
image->buffer[(i * 4) + 3] = 0;
}
else {
image->buffer[(i * 4) + 3] = 255;
}
}
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->buffer);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
strcpy(image->name, name);
image->image = texture;
image->width = Width;
image->height = Height;
loaded_images.push_back(image);
return image;
}
BOOL Set_Video_Mode(HWND hwnd, int w, int h, int bits_per_pixel) {
// Todo implement resoluton scaling.
return true; // Always return true;
-1
View File
@@ -1 +0,0 @@
To see HD textures in action, move the textures folder out of the examples folder.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB