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

This commit is contained in:
nev6502
2020-06-24 23:04:27 -06:00
18 changed files with 297 additions and 106 deletions
+67 -43
View File
@@ -2759,6 +2759,7 @@ static BuildingTypeClass const ClassLarva2(
);
#endif
void const * BuildingTypeClass::WarFactoryOverlay;
Image_t* BuildingTypeClass::WarFactoryHDOverlay;
void const * LightningShapes;
@@ -3034,6 +3035,47 @@ void BuildingTypeClass::Init_Heap(void)
#endif
}
Image_t* BuildingTypeClass::LoadHDImage(const char* fullname, int& numHDShapes) {
const char* imageFileName = Buildings_FindHDTexture(fullname, 0, 0);
Image_t* image = NULL;
numHDShapes = -1;
if (imageFileName) {
image = Image_LoadImage(imageFileName, true, true);
int numBuildingAnims = Buildings_GetNumFramesForTile(fullname, 0);
int shapeId = 1;
// Load the old school animation pipeline.
{
while (true) {
imageFileName = Buildings_FindHDTexture(fullname, shapeId, 0);
if (imageFileName == NULL)
break;
for (int d = 0; d < MAX_MPLAYER_COLORS; d++) {
Image_Add32BitImage(imageFileName, image, d, shapeId, 0);
}
shapeId++;
}
}
if (numBuildingAnims > 0)
{
for (int i = 1; i < numBuildingAnims; i++) {
imageFileName = Buildings_FindHDTexture(fullname, 0, i);
for (int d = 0; d < MAX_MPLAYER_COLORS; d++) {
Image_Add32BitImage(imageFileName, image, d, 0, i);
}
}
}
image->numFrames = numBuildingAnims;
numHDShapes = shapeId;
}
return image;
}
/***********************************************************************************************
* BuildingTypeClass::One_Time -- Performs special one time action for buildings. *
@@ -3135,63 +3177,45 @@ void BuildingTypeClass::One_Time(void)
building.Init_Anim(BSTATE_CONSTRUCTION, 0, count, timedelay);
}
int numhdimages = 0;
/*
** Fetch the normal game shape for this building.
*/
_makepath(fullname, NULL, NULL, building.Graphic_Name(), ".SHP");
((void const *&)building.ImageData) = MFCD::Retrieve(fullname);
{
const char* imageFileName = Buildings_FindHDTexture(fullname, 0, 0);
((void const*&)building.HDImageData) = LoadHDImage(fullname, numhdimages);
if (imageFileName) {
Image_t *image = Image_LoadImage(imageFileName, true, true);
int numBuildingAnims = Buildings_GetNumFramesForTile(fullname, 0);
int shapeId = 1;
if (building.ImageData != NULL && building.HDImageData != NULL) {
int width = Get_Build_Frame_Width(building.ImageData);
int height = Get_Build_Frame_Height(building.ImageData);
// Load the old school animation pipeline.
{
while (true) {
imageFileName = Buildings_FindHDTexture(fullname, shapeId, 0);
if (imageFileName == NULL)
break;
for (int d = 0; d < MAX_MPLAYER_COLORS; d++) {
Image_Add32BitImage(imageFileName, image, d, shapeId, 0);
}
shapeId++;
}
}
if (numBuildingAnims > 0)
{
for (int i = 1; i < numBuildingAnims; i++) {
imageFileName = Buildings_FindHDTexture(fullname, 0, i);
for (int d = 0; d < MAX_MPLAYER_COLORS; d++) {
Image_Add32BitImage(imageFileName, image, d, 0, i);
}
}
}
image->numFrames = numBuildingAnims;
((void const*&)building.HDImageData) = image;
if (building.ImageData != NULL && building.HDImageData != NULL) {
int width = Get_Build_Frame_Width(building.ImageData);
int height = Get_Build_Frame_Height(building.ImageData);
for (int d = 0; d < shapeId; d++)
{
building.HDImageData->renderwidth[d] = width;
building.HDImageData->renderheight[d] = height;
}
}
}
for (int d = 0; d < numhdimages; d++)
{
building.HDImageData->renderwidth[d] = width;
building.HDImageData->renderheight[d] = height;
}
}
}
int specialNumHDImages = 0;
// Try to load weap2.shp and tesla coil's lightning shapes
char fullname[_MAX_FNAME+_MAX_EXT];
_makepath(fullname, NULL, NULL, (char const *)"WEAP2",".SHP");
WarFactoryOverlay = MFCD::Retrieve(fullname);
WarFactoryHDOverlay = LoadHDImage(fullname, specialNumHDImages);
if (WarFactoryOverlay != NULL && WarFactoryHDOverlay != NULL) {
int width = Get_Build_Frame_Width(WarFactoryOverlay);
int height = Get_Build_Frame_Height(WarFactoryOverlay);
for (int d = 0; d < specialNumHDImages; d++)
{
WarFactoryHDOverlay->renderwidth[d] = width;
WarFactoryHDOverlay->renderheight[d] = height;
}
}
_makepath(fullname, NULL, NULL, (char const *)"LITNING",".SHP");
LightningShapes = MFCD::Retrieve(fullname);
+19 -11
View File
@@ -454,14 +454,8 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
{
assert(Buildings.ID(this) == ID);
assert(IsActive);
// jmarshall
Image_t* hdimage = Get_HDImage_Data();
if (hdimage != NULL) {
Techno_Draw_Object_HD(hdimage, Shape_Number(), x, y, window);
TechnoClass::Draw_It(x, y, window);
return;
}
// jmarshall end
/*
** The shape file to use for rendering depends on whether the building
@@ -474,7 +468,14 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
** Actually draw the building shape.
*/
IsTheaterShape = Class->IsTheater; //Let Build_Frame know if this is a theater specific shape
Techno_Draw_Object(shapefile, Shape_Number(), x, y, window);
// jmarshall - added HD support
if (hdimage != NULL) {
Techno_Draw_Object_HD(hdimage, Shape_Number(), x, y, window);
}
else {
Techno_Draw_Object(shapefile, Shape_Number(), x, y, window);
}
// jmarshall end
IsTheaterShape = false;
/*
@@ -504,9 +505,16 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
if ( (*this == STRUCT_WEAP || *this == STRUCT_FAKEWEAP)) {
int shapenum = Door_Stage();
if (Health_Ratio() <= Rule.ConditionYellow) shapenum += 4;
// Added override shape file name. ST - 8/1/2019 5:24PM
//Techno_Draw_Object(Class->WarFactoryOverlay, shapenum, x, y, window);
Techno_Draw_Object_Virtual(Class->WarFactoryOverlay, shapenum, x, y, window, DIR_N, 0x0100, "WEAP2");
// jmarshall - added HD support.
if (Class->WarFactoryHDOverlay)
{
Techno_Draw_Object_HD(Class->WarFactoryHDOverlay, shapenum, x, y, window, DIR_N, 0x0100);
}
else
{
Techno_Draw_Object_Virtual(Class->WarFactoryOverlay, shapenum, x, y, window, DIR_N, 0x0100, "WEAP2");
}
// jmarshall end
}
/*
+1
View File
@@ -70,6 +70,7 @@ extern bool Debug_Cheat;
extern bool Debug_Remap;
extern bool Debug_Flag;
extern bool Debug_Lose;
extern bool Debug_SkipBriefing;
extern bool Debug_Map;
extern bool Debug_Win;
extern bool Debug_Icon;
+1
View File
@@ -43,6 +43,7 @@ bool Debug_Remap = false;
bool Debug_Icon = false;
bool Debug_Flag = true;
bool Debug_Lose = false;
bool Debug_SkipBriefing = false;
bool Debug_Win = false;
bool Debug_Map = false; // true = map editor mode
bool Debug_Passable = false; // true = show passable/impassable terrain
+30 -1
View File
@@ -1294,6 +1294,34 @@ bool Select_Game(bool fade)
** Play a VQ
*/
case SEL_INTRO:
// jmarshall
#ifdef SCENARIO_EDITOR
Debug_Map = true;
Clear_Scenario();
//Scen.Set_Scenario_Name(1, SCEN_PLAYER_SPAIN, SCEN_DIR_EAST, SCEN_VAR_A);
strcpy(Scen.ScenarioName, "DEFAULTMAP.INI");
/*
** Create houses
*/
for (HousesType house = HOUSE_FIRST; house < HOUSE_COUNT; house++) {
new HouseClass(house);
}
PlayerPtr = HouseClass::As_Pointer(HOUSE_SPAIN);
PlayerPtr->IsHuman = true;
Base.House = HOUSE_USSR;
//LastHouse = HOUSE_GOOD;
Fill_In_Data();
//Size_Map(-1, -1, 30, 30);
Scen.Waypoint[WAYPT_REINF] = XY_Cell(Map.MapCellX + Map.MapCellWidth / 2, Map.MapCellY + Map.MapCellHeight / 2);
Scen.Waypoint[WAYPT_HOME] = XY_Cell(Map.MapCellX + Map.MapCellWidth / 2, Map.MapCellY + Map.MapCellHeight / 2);
// (*this)[TacticalCoord].IsWaypoint = 1;
Map.Flag_Cell(Coord_Cell(Map.TacticalCoord));
Map.Set_Tactical_Position(Cell_Coord(Scen.Waypoint[WAYPT_HOME] - (MAP_CELL_W * 4 * RESFACTOR) - (5 * RESFACTOR)));
Go_Editor(true);
process = false;
Debug_SkipBriefing = true;
#else
Theme.Fade_Out();
if (Debug_Flag) {
@@ -1313,7 +1341,8 @@ bool Select_Game(bool fade)
display = true;
fade = true;
selection = SEL_NONE;
#endif
// jmarshall end
break;
/*
+3
View File
@@ -1594,6 +1594,9 @@ void MapEditClass::Main_Menu(void)
Show_Mouse();
if (UnknownKey==KN_ESC || g_globalKeyNumType == KN_RMOUSE) {
// jmarshall - consume the RMOUSE DOWN so it doesn't bring up the context menu again.
Buttons->Input();
// jmarshall end
break;
}
+13 -7
View File
@@ -70,7 +70,7 @@ void ImGui_Placement_Editor(void) {
ImGuiStyle& style = ImGui::GetStyle();
style.FramePadding = ImVec2(0, 0);
ImGui::SetNextWindowSize(ImVec2(480, 220));
ImGui::SetNextWindowPos(ImVec2(0, 150));
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::Begin("Place Object", &toolActive, ImGuiWindowFlags_AlwaysAutoResize /*| ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground*/);
ImGui::Columns(3, "outer", true);
ImGui::LabelText("Test", "Object Name");
@@ -429,8 +429,6 @@ int MapEditClass::Placement_Dialog(void)
g_globalKeyFlags = 0;
UserInput.Process_Input();
Device_Present();
/*
** Refresh display if needed
*/
@@ -442,9 +440,6 @@ int MapEditClass::Placement_Dialog(void)
Hide_Mouse();
// Dialog_Box(D_DIALOG_X, D_DIALOG_Y, D_DIALOG_W, D_DIALOG_H);
// Draw_Caption(TXT_PLACE_OBJECT, D_DIALOG_X, D_DIALOG_Y, D_DIALOG_W);
// jmarshall - temp render a black background here so the tool works.
LogicPage->Fill_Rect(D_DIALOG_X, D_DIALOG_Y, D_DIALOG_X + D_DIALOG_W, D_DIALOG_Y + D_DIALOG_H, 0);
// jamrshall end
/*
** Display the current object:
@@ -459,9 +454,20 @@ int MapEditClass::Placement_Dialog(void)
WindowList[WINDOW_EDITOR][WINDOWHEIGHT] = D_PICTURE_H;
Change_Window((int)WINDOW_EDITOR);
// Draw_Box(D_PICTURE_X, D_PICTURE_Y, D_PICTURE_W, D_PICTURE_H, BOXSTYLE_DOWN, false);
curobj->Display(WinW/2, WinH>>1, WINDOW_EDITOR, LastHouse);
//curobj->Display(WinW/2, WinH>>1, WINDOW_EDITOR, LastHouse);
// curobj->Display(WinW<<2, WinH>>1, WINDOW_EDITOR, LastHouse);
Image_t* image = NULL;
if (curobj->Get_HDImage_Data()) {
image = curobj->Get_HDImage_Data();
GL_RenderForeGroundImage(image, 30, 100, 75, 75);
}
//else {
// image = (Image_t *)curobj->Get_Image_Data();
//}
/*
** Erase the grid
*/
+6 -1
View File
@@ -549,8 +549,13 @@ int Main_Menu(unsigned long )
TextButtonClass multibtn(BUTTON_MULTI, TXT_MULTIPLAYER_GAME, TPF_BUTTON, d_button_x, d_button_y, d_button_w, d_button_h);
d_button_y += d_button_dy;
// jmarshall - Intro button is going to be the scenario editor button.
#ifdef SCENARIO_EDITOR
TextButtonClass introbtn(BUTTON_INTRO, "Scenario Editor", TPF_BUTTON, d_button_x, d_button_y, d_button_w, d_button_h);
#else
TextButtonClass introbtn(BUTTON_INTRO, TXT_INTRO, TPF_BUTTON, d_button_x, d_button_y, d_button_w, d_button_h);
#endif
// jmarshall end
d_button_y += d_button_dy;
TextButtonClass exitbtn(BUTTON_EXIT, TXT_EXIT_GAME, TPF_BUTTON, d_button_x, d_button_y, d_button_w, d_button_h);
+21 -5
View File
@@ -11,11 +11,11 @@ extern uint8_t g_ColorXlat[16];
void GL_SetClipRect(int x, int y, int width, int height) {
ImVec2 mi(x, y);
ImVec2 ma(x + width, y + height);
ImGui::GetForegroundDrawList()->PushClipRect(mi, ma);
ImGui::GetBackgroundDrawList()->PushClipRect(mi, ma);
}
void GL_ResetClipRect(void) {
ImGui::GetForegroundDrawList()->PopClipRect();
ImGui::GetBackgroundDrawList()->PopClipRect();
}
void GL_RenderImage(Image_t* image, int x, int y, int width, int height, int colorRemap, int shapeId) {
@@ -24,6 +24,22 @@ void GL_RenderImage(Image_t* image, int x, int y, int width, int height, int col
if (image->numFrames > 0) {
if(image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames] == 0)
ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma);
else
ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames], mi, ma);
}
else {
ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma);
}
}
void GL_RenderForeGroundImage(Image_t* image, int x, int y, int width, int height, int colorRemap, int shapeId) {
ImVec2 mi(x, y);
ImVec2 ma(x + width, y + height);
if (image->numFrames > 0) {
if (image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames] == 0)
ImGui::GetForegroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma);
else
ImGui::GetForegroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames], mi, ma);
@@ -40,7 +56,7 @@ void GL_FillRect(int color, int x, int y, int width, int height) {
float r = backbuffer_palette[(color * 3) + 0] / 255.0f;
float g = backbuffer_palette[(color * 3) + 1] / 255.0f;
float b = backbuffer_palette[(color * 3) + 2] / 255.0f;
ImGui::GetForegroundDrawList()->AddRectFilled(mi, ma, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)));
ImGui::GetBackgroundDrawList()->AddRectFilled(mi, ma, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)));
}
void GL_DrawText(int color, int x, int y, char* text) {
@@ -51,7 +67,7 @@ void GL_DrawText(int color, int x, int y, char* text) {
float r = backbuffer_palette[(color * 3) + 0] / 255.0f;
float g = backbuffer_palette[(color * 3) + 1] / 255.0f;
float b = backbuffer_palette[(color * 3) + 2] / 255.0f;
ImGui::GetForegroundDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)), text);
ImGui::GetBackgroundDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)), text);
}
void GL_DrawLine(int color, int x, int y, int dx, int dy) {
@@ -60,5 +76,5 @@ void GL_DrawLine(int color, int x, int y, int dx, int dy) {
float r = backbuffer_palette[(color * 3) + 0] / 255.0f;
float g = backbuffer_palette[(color * 3) + 1] / 255.0f;
float b = backbuffer_palette[(color * 3) + 2] / 255.0f;
ImGui::GetForegroundDrawList()->AddLine(pos, pos2, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)));
ImGui::GetBackgroundDrawList()->AddLine(pos, pos2, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)));
}
+1
View File
@@ -3,6 +3,7 @@
struct Image_t;
void GL_RenderImage(Image_t* image, int x, int y, int width, int height, int colorRemap = 0, int shapeId = 0);
void GL_RenderForeGroundImage(Image_t* image, int x, int y, int width, int height, int colorRemap = 0, int shapeId = 0);
void GL_DrawText(int color, int x, int y, char* text);
void GL_FillRect(int color, int x, int y, int width, int height);
void GL_DrawLine(int color, int x, int y, int dx, int dy);
+30 -18
View File
@@ -63,6 +63,7 @@
#ifdef WIN32
#include "tcpip.h"
#include "ccdde.h"
#include "audiomix.h"
extern bool SpawnedFromWChat;
#endif
@@ -399,30 +400,41 @@ bool Start_Scenario(char * name, bool briefing)
/*
** If there's no briefing movie, restate the mission at the beginning.
*/
char buffer[25];
if (Scen.BriefMovie != VQ_NONE) {
sprintf(buffer, "%s.VQA", VQName[Scen.BriefMovie]);
}
if (Session.Type == GAME_NORMAL && ( Scen.BriefMovie == VQ_NONE || !CCFileClass(buffer).Is_Available() ) ) {
/*
** Make sure the mouse is visible before showing the restatement.
*/
while(Get_Mouse_State()) {
Show_Mouse();
if (!Debug_SkipBriefing)
{
char buffer[25];
if (Scen.BriefMovie != VQ_NONE) {
sprintf(buffer, "%s.VQA", VQName[Scen.BriefMovie]);
}
if (Session.Type == GAME_NORMAL && (Scen.BriefMovie == VQ_NONE || !CCFileClass(buffer).Is_Available())) {
/*
** Make sure the mouse is visible before showing the restatement.
*/
while (Get_Mouse_State()) {
Show_Mouse();
}
Restate_Mission(Scen.ScenarioName, TXT_OK, TXT_NONE);
}
Restate_Mission(Scen.ScenarioName, TXT_OK, TXT_NONE);
}
if (briefing) {
Hide_Mouse();
VisiblePage.Clear();
Show_Mouse();
Play_Movie(Scen.ActionMovie, Scen.TransitTheme);
}
if (briefing) {
Hide_Mouse();
VisiblePage.Clear();
Show_Mouse();
Play_Movie(Scen.ActionMovie, Scen.TransitTheme);
}
}
if (Scen.TransitTheme == THEME_NONE) {
Theme.Queue_Song(THEME_FIRST);
}
// jmarshall
// If we are skipping the briefing, pausing the music(assuming in editor mode).
if (Debug_SkipBriefing) {
AudMix_SetMusicState(false);
}
// jmarshall end
Debug_SkipBriefing = false;
/*
** Set the options values, since the palette has been initialized by Read_Scenario
+2 -2
View File
@@ -4,8 +4,8 @@
#include "FUNCTION.H"
#include "TEXCACHE.H"
#define CACHE_HEADER_FILENAME "cache/cache_header_v1.vhdr"
#define CACHE_DATA_FILERNAME "cache/cache_data_v1.vdata"
#define CACHE_HEADER_FILENAME "cache/cache_header_v2.vhdr"
#define CACHE_DATA_FILERNAME "cache/cache_data_v2.vdata"
TexCache texCache;
+8 -1
View File
@@ -194,7 +194,7 @@ Image_t* Load_StampHD(int theater, const char* iconName, const void* icondata) {
char filename[2048];
Image_t* image = NULL;
IconControlType* tileset = (IconControlType*)icondata;
IconControlType* tileset = (IconControlType*)icondata;
if (!tileset) {
return NULL;
@@ -222,6 +222,13 @@ Image_t* Load_StampHD(int theater, const char* iconName, const void* icondata) {
COM_SetExtension(filename, sizeof(filename), ".dds");
if (image == NULL) {
// If the image is already loaded, then we are done.
image = Find_Image(filename);
if (image) {
return image;
}
// Load the initial terrain image.
image = Image_LoadImage(filename);
if (image != NULL && i != 0) {
+3
View File
@@ -41,6 +41,7 @@
class MapEditClass;
class HouseClass;
class WeaponTypeClass;
struct Image_t;
/***************************************************************************
** This is the abstract type class. It holds information common to all
@@ -815,6 +816,7 @@ class BuildingTypeClass : public TechnoTypeClass {
** Special overlay for the weapons factory.
*/
static void const * WarFactoryOverlay;
static Image_t* WarFactoryHDOverlay;
private:
@@ -839,6 +841,7 @@ class BuildingTypeClass : public TechnoTypeClass {
void const * BuildupData;
void Init_Anim(BStateType state, int start, int count, int rate) const;
static Image_t* LoadHDImage(const char* fullname, int &numHDShapes);
};
+3
View File
@@ -764,6 +764,9 @@ void ChronalVortexClass::Zap_Target (void)
void ChronalVortexClass::Coordinate_Remap ( GraphicViewPortClass *inbuffer, int x, int y, int width, int height, unsigned char *remap_table)
{
unsigned char getx,gety, remap_color, pixel_color;
// jmarshall - todo fix ChronalVortexClass
return;
// jmarshall end
BufferClass destbuf (width * height);
+26 -13
View File
@@ -158,13 +158,25 @@ static bool Image_LoadFromCache(Image_t* image, const char* name, int houseid, i
return true;
}
static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int animid, int frameId, int64_t hash) {
static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int animid, int frameId, int64_t hash) {
// Don't load the image if its already loaded.
if (houseid == -1) {
if (image->HouseImages[0].image[animid][frameId] != 0) {
return true;
}
}
else {
if (image->HouseImages[houseid].image[animid][frameId] != 0) {
return true;
}
}
const char* generatedName = Image_GetGeneratedName(image, name, houseid, animid, frameId, hash);
hash = generateHashValue(generatedName, strlen(generatedName));
// Check to see if we can load a generated image first.
// We only generate images that need a houseid
if (houseid >= 0) {
{
if (Image_LoadFromCache(image, generatedName, houseid, animid, frameId, hash)) {
return true;
}
@@ -179,10 +191,8 @@ static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int
return false;
}
bool swapBGR = false;
if (strstr(name, ".TGA") || strstr(name, ".tga")) {
iluFlipImage();
swapBGR = true;
}
ILuint Width, Height, Bpp;
@@ -201,18 +211,20 @@ static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int
RenderTeamPalette(&Data[i * 4], *houseColors[houseid]);
}
}
else if (Bpp == 4) {
for (int i = 0; i < Width * Height; i++) {
byte b = Data[(i * 4) + 2];
Data[(i * 4) + 2] = Data[(i * 4) + 0];
Data[(i * 4) + 0] = b;
}
}
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
if (Bpp == 4) {
if (swapBGR) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, Data);
}
else {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, Data);
}
else if (Bpp == 3) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Data);
@@ -240,7 +252,7 @@ static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int
//image->buffer[houseid][animid] = new unsigned char[Width * Height * Bpp];
//memcpy(image->buffer[houseid][animid], Data, Width * Height * Bpp);
if (Bpp == 4 && houseid >= 0) {
if (Bpp == 4) {
texCache.AddImage(generatedName, Width, Height, Bpp, Data);
Console_Printf("Writing %s to cache %s\n", image->name, name);
Sleep(0);
@@ -574,8 +586,9 @@ void Device_Present(void) {
//ImGui::End();
// jmarshall end
if (Imgui_Dialog_Function) {
Imgui_Dialog_Function();
if (Imgui_Dialog_Function) {
Map.Render();
Imgui_Dialog_Function();
}
if (renderConsole) {
+6 -4
View File
@@ -11,6 +11,8 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
Keyboard->MouseQX = Mouse.X;
Keyboard->MouseQY = Mouse.Y;
flags = 0;
static SDL_Event event;
memset(&event, 0, sizeof(SDL_Event));
@@ -51,7 +53,7 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_DOWN;
key = KN_LMOUSE;
flags = GadgetClass::LEFTPRESS;
flags |= GadgetClass::LEFTPRESS;
Keyboard->Put_Element(KN_LMOUSE);
@@ -64,7 +66,7 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
Keyboard->Put_Element(KN_RMOUSE);
key = KN_RMOUSE;
flags = GadgetClass::RIGHTPRESS;
flags |= GadgetClass::RIGHTPRESS;
numFramesLMouse = 0;
}
@@ -74,13 +76,13 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
if (event.button.button == SDL_BUTTON_LEFT) {
Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_RELEASE;
flags = GadgetClass::LEFTRELEASE;
flags |= GadgetClass::LEFTRELEASE;
numFramesLMouse = 0;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_RELEASE;
flags = GadgetClass::RIGHTRELEASE;
flags |= GadgetClass::RIGHTRELEASE;
numFramesLMouse = 0;
}
break;