From 79b24cb81dc536e09578c3fb4f19807d6c278f8b Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Sat, 20 Jun 2020 14:31:11 -0700 Subject: [PATCH 1/3] Initial HD stamp loading code. --- code/REDALERT/CDATA.CPP | 11 +++- code/REDALERT/Image.h | 4 +- code/REDALERT/TDATA.CPP | 8 +++ code/REDALERT/TILESET.CPP | 83 +++++++++++++++++++++++++++++-- code/REDALERT/WIN32LIB/DRAWBUFF.H | 6 ++- code/REDALERT/WINSTUB.CPP | 4 +- 6 files changed, 109 insertions(+), 7 deletions(-) diff --git a/code/REDALERT/CDATA.CPP b/code/REDALERT/CDATA.CPP index 06cdfc4..962930a 100644 --- a/code/REDALERT/CDATA.CPP +++ b/code/REDALERT/CDATA.CPP @@ -46,7 +46,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "function.h" - +#include "image.h" static TemplateTypeClass const Empty( TEMPLATE_CLEAR1, @@ -3137,7 +3137,16 @@ void TemplateTypeClass::Init(TheaterType theater) ((unsigned char &)tplate.Width) = Get_IconSet_MapWidth(ptr); ((unsigned char &)tplate.Height) = Get_IconSet_MapHeight(ptr); + // Try and load HD assets first. + Image_t *hdImage = Load_StampHD(Theaters[theater].Name, fullname, tplate.ImageData); + if (hdImage) { + Get_Stamp_Size(tplate.ImageData, hdImage->renderwidth, hdImage->renderheight); + ((void const*&)tplate.HDImageData) = hdImage; + } + else + { + // If no HD assets, load the legacy assets into a texture. char tmp[512]; sprintf(tmp, "icon_%s", fullname); ((void const*&)tplate.HDImageData) = Load_Stamp(fullname, tplate.ImageData); diff --git a/code/REDALERT/Image.h b/code/REDALERT/Image.h index 9c01ed8..fe5302f 100644 --- a/code/REDALERT/Image.h +++ b/code/REDALERT/Image.h @@ -21,6 +21,7 @@ struct Image_t { __forceinline Image_t::Image_t() { IconMapPtr = NULL; numAnimFrames = 0; + memset(image, 0, sizeof(image)); } __forceinline Image_t::~Image_t() { @@ -29,4 +30,5 @@ __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* 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); \ No newline at end of file +void Image_Add8BitImage(Image_t* image, int HouseId, int ShapeID, int Width, int Height, unsigned char* data, unsigned char* remap); +bool Image_Add32BitImage(const char* name, Image_t* image, int HouseId, int ShapeID); \ No newline at end of file diff --git a/code/REDALERT/TDATA.CPP b/code/REDALERT/TDATA.CPP index 3dadc71..41c21bd 100644 --- a/code/REDALERT/TDATA.CPP +++ b/code/REDALERT/TDATA.CPP @@ -690,6 +690,14 @@ void TerrainTypeClass::Init(TheaterType theater) _makepath(fullname, NULL, NULL, terrain.IniName, Theaters[theater].Suffix); ((void const *&)terrain.ImageData) = MFCD::Retrieve(fullname); + // Try and load HD assets first. + Image_t* hdImage = Load_StampHD(Theaters[theater].Name, fullname, terrain.ImageData); + if (hdImage) + { + Get_Stamp_Size(terrain.ImageData, hdImage->renderwidth, hdImage->renderheight); + ((void const*&)terrain.HDImageData) = hdImage; + } + else { char tmp[512]; sprintf(tmp, "icon_%s", fullname); diff --git a/code/REDALERT/TILESET.CPP b/code/REDALERT/TILESET.CPP index a17da1d..6faa8c0 100644 --- a/code/REDALERT/TILESET.CPP +++ b/code/REDALERT/TILESET.CPP @@ -190,7 +190,81 @@ void __cdecl Buffer_Draw_Stamp2(GraphicViewPortClass& viewport, IconControlType* } } -struct Image_t *__cdecl Load_Stamp(const char *name, const void* icondata) +Image_t* Load_StampHD(const char* theaterName, 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); + } + + // This is because were trying to avoid parsing the XML's and the filenames aren't consistant. + char* baseFileNameTemplate = "DATA/ART/TEXTURES/SRGB/RED_ALERT/TERRAIN/%s/%s/%s-%04d.DDS"; + char* fileNameTemplate = baseFileNameTemplate; + + for (int i = 0; i < IconCount; i++) + { + sprintf(filename, fileNameTemplate, theaterName, iconName, iconName, i); + if (image == NULL) { + image = Image_LoadImage(filename); + if (image == NULL) { + fileNameTemplate = "DATA/ART/TEXTURES/SRGB/RED_ALERT/TERRAIN/%s/%s/%s-%04d-0000.DDS"; + sprintf(filename, fileNameTemplate, theaterName, iconName, iconName, i); + image = Image_LoadImage(filename); + if (image == NULL) { + fileNameTemplate = "DATA/ART/TEXTURES/SRGB/RED_ALERT/TERRAIN/%s/%s/%s-%04d-00.DDS"; + sprintf(filename, fileNameTemplate, theaterName, iconName, iconName, i); + image = Image_LoadImage(filename); + if (image == NULL) { + fileNameTemplate = baseFileNameTemplate; // Restore back to the original template. + continue; + } + } + } + + //if (i != 0) { + // image->image[0][i] = image->image[0][0]; + // image->image[0][0] = 0; + //} + } + else { + if (!Image_Add32BitImage(filename, image, -1, i)) { + continue; + } + } + } + + //if (image) { + // image->IconMapPtr = MapPtr; + //} + + return image; +} + +void Get_Stamp_Size(const void* icondata, int& width, int& height) { + IconControlType* tileset = (IconControlType*)icondata; + + if (!tileset) { + width = -1; + height = -1; + return; + } + + if (LastIconset != tileset) { + Init_Stamps(tileset); + } + + width = IconWidth; + height = IconHeight; +} + +Image_t * Load_Stamp(const char *name, const void* icondata) { IconControlType* tileset = (IconControlType*)icondata; @@ -239,8 +313,8 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void uint8_t* MapPtr = (uint8_t * )iconImage->IconMapPtr; int icon_index = MapPtr != nullptr ? MapPtr[icon] : icon; { - int blit_height = IconHeight; - int blit_width = IconWidth; + int blit_height = iconImage->renderheight; + int blit_width = iconImage->renderwidth; int width = left + right; int xstart = left + x; @@ -320,6 +394,9 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void // src += IconWidth; //} + if (iconImage->image[0][icon_index] == 0) + return; + GL_SetClipRect(xstart, ystart, blit_width, blit_height); GL_RenderImage(iconImage, xstart, ystart, blit_width, blit_height, 0, icon_index); GL_ResetClipRect(); diff --git a/code/REDALERT/WIN32LIB/DRAWBUFF.H b/code/REDALERT/WIN32LIB/DRAWBUFF.H index 72ace4c..4ee36f6 100644 --- a/code/REDALERT/WIN32LIB/DRAWBUFF.H +++ b/code/REDALERT/WIN32LIB/DRAWBUFF.H @@ -61,7 +61,11 @@ extern "C" { void * __cdecl Get_Font_Palette_Ptr ( void ); } -struct Image_t* __cdecl Load_Stamp(const char* name, const void* icondata); +struct Image_t; + +Image_t* Load_Stamp(const char* name, const void* icondata); +void Get_Stamp_Size(const void* icondata, int &width, int &height); +Image_t* Load_StampHD(const char* theaterName, const char* iconName, const void *icondata); extern GraphicViewPortClass *LogicPage; extern BOOL AllowHardwareBlitFills; diff --git a/code/REDALERT/WINSTUB.CPP b/code/REDALERT/WINSTUB.CPP index 7a9f856..71e7f2c 100644 --- a/code/REDALERT/WINSTUB.CPP +++ b/code/REDALERT/WINSTUB.CPP @@ -433,7 +433,9 @@ void Image_Add8BitImage(Image_t *image, int HouseId, int ShapeID, int Width, int delete buffer; } - +bool Image_Add32BitImage(const char *name, Image_t* image, int HouseId, int ShapeID) { + return Image_loadHDImage(image, name, HouseId, ShapeID, image->namehash, false); +} BOOL Set_Video_Mode(HWND hwnd, int w, int h, int bits_per_pixel) { // Todo implement resoluton scaling. From e7697aa3ac3f46c3a1c34838bb007e005d47ac0e Mon Sep 17 00:00:00 2001 From: Ben Lankamp Date: Sat, 20 Jun 2020 23:33:26 +0200 Subject: [PATCH 2/3] * Fixed input loops/too much callbacks. --- code/REDALERT/CONQUER.CPP | 2 +- code/REDALERT/EGOS.CPP | 6 +++--- code/REDALERT/GADGET.CPP | 2 ++ code/REDALERT/MAPEDDLG.CPP | 25 +++++++++++++------------ code/REDALERT/MAPEDIT.CPP | 21 ++++++++++++++++----- code/REDALERT/MAPSEL.CPP | 32 +++++++++++++++++--------------- code/REDALERT/MENUS.CPP | 13 +++++++------ code/REDALERT/SCORE.CPP | 6 +++--- code/REDALERT/STARTUP.CPP | 15 ++++++++------- code/REDALERT/WINSTUB.CPP | 2 +- code/REDALERT/io/UserInput.cpp | 19 ++++++++++--------- code/REDALERT/io/UserInput.h | 5 ++++- 12 files changed, 85 insertions(+), 63 deletions(-) diff --git a/code/REDALERT/CONQUER.CPP b/code/REDALERT/CONQUER.CPP index ff2a75a..4787c38 100644 --- a/code/REDALERT/CONQUER.CPP +++ b/code/REDALERT/CONQUER.CPP @@ -1638,7 +1638,7 @@ void Color_Cycle(void) *=============================================================================================*/ void Call_Back(void) { - WWSDL_ProcessEvents(g_globalKeyNumType, g_globalKeyFlags); + Device_Present(); /* ** Music and speech maintenance diff --git a/code/REDALERT/EGOS.CPP b/code/REDALERT/EGOS.CPP index f38f46e..7b42bcc 100644 --- a/code/REDALERT/EGOS.CPP +++ b/code/REDALERT/EGOS.CPP @@ -859,9 +859,9 @@ void Show_Who_Was_Responsible (void) ** If user hits escape then break. */ - KeyNumType _key = KN_NONE; - int _flags; - WWSDL_ProcessEvents(_key, _flags); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); key = Keyboard->Check(); diff --git a/code/REDALERT/GADGET.CPP b/code/REDALERT/GADGET.CPP index 185d008..adfaabd 100644 --- a/code/REDALERT/GADGET.CPP +++ b/code/REDALERT/GADGET.CPP @@ -501,6 +501,8 @@ KeyNumType GadgetClass::Input(void) */ // jmarshall int flags = g_globalKeyFlags; + UserInput.Process_Input( g_globalKeyNumType, flags ); + // jmarshall end /* diff --git a/code/REDALERT/MAPEDDLG.CPP b/code/REDALERT/MAPEDDLG.CPP index 7d80932..41c0b0f 100644 --- a/code/REDALERT/MAPEDDLG.CPP +++ b/code/REDALERT/MAPEDDLG.CPP @@ -652,9 +652,9 @@ int MapEditClass::Pick_Scenario(char const * caption, int & scen_nump, ScenarioP */ bool display = true; while (pickscenerio_process) { - KeyNumType _key; - int _flags; - WWSDL_ProcessEvents(_key, _flags); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); } Imgui_Dialog_Function = nullptr; @@ -1117,9 +1117,10 @@ int MapEditClass::Size_Map(int x, int y, int w, int h) // } // // Show_Mouse(); - KeyNumType _key; - int _types; - WWSDL_ProcessEvents(_key, _types); + + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); // display = REDRAW_NONE; @@ -1957,9 +1958,9 @@ int MapEditClass::Scenario_Dialog(void) */ KeyNumType input = KN_NONE; //commands->Input(); - KeyNumType _key; - int _flags; - WWSDL_ProcessEvents(_key, _flags); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); /* ** Process input @@ -2549,9 +2550,9 @@ int MapEditClass::Select_Trigger(void) //// LogicPage->Unlock(); // } - KeyNumType _key; - int _flags; - WWSDL_ProcessEvents(_key, _flags); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); /* ** Get user input diff --git a/code/REDALERT/MAPEDIT.CPP b/code/REDALERT/MAPEDIT.CPP index ff3c30c..06cc48c 100644 --- a/code/REDALERT/MAPEDIT.CPP +++ b/code/REDALERT/MAPEDIT.CPP @@ -1584,11 +1584,16 @@ void MapEditClass::Main_Menu(void) */ Hide_Mouse(); // Do_Menu assumes the mouse is already hidden selection = mainmenu_selection; - KeyNumType _key; - int _flags; - WWSDL_ProcessEvents(_key, _flags); + + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); + + Call_Back(); + Show_Mouse(); - if (UnknownKey==KN_ESC || _key == KN_RMOUSE) { + + if (UnknownKey==KN_ESC || g_globalKeyNumType == KN_RMOUSE) { break; } @@ -1702,7 +1707,9 @@ void MapEditClass::Main_Menu(void) case 7: if (Changed) { Imgui_Dialog_Function = nullptr; - WWSDL_ProcessEvents(_key, _flags); + + UserInput.Process_Input(); + rc = WWMessageBox().Process("Save Changes?", TXT_YES, TXT_NO, TXT_CANCEL); HidPage.Clear(); Flag_To_Redraw(true); @@ -1779,12 +1786,16 @@ void MapEditClass::AI_Menu(void) */ Call_Back(); + UserInput.Process_Input(); + /* ** Invoke menu */ Hide_Mouse(); // Do_Menu assumes the mouse is already hidden + selection = Do_Menu(&_menus[0], true); Show_Mouse(); + if (UnknownKey==KN_ESC || UnknownKey==KN_LMOUSE || UnknownKey==KN_RMOUSE) { break; } diff --git a/code/REDALERT/MAPSEL.CPP b/code/REDALERT/MAPSEL.CPP index 9d1989a..023382b 100644 --- a/code/REDALERT/MAPSEL.CPP +++ b/code/REDALERT/MAPSEL.CPP @@ -228,9 +228,12 @@ char const * Map_Selection(void) bool done = 0; MouseType shape = MOUSE_NORMAL; while (!done) { - KeyNumType _key; - int _flags = 0; - WWSDL_ProcessEvents(_key, _flags); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + + UserInput.Process_Input(); + + Call_Back(); #ifdef WIN32 /* @@ -259,24 +262,23 @@ char const * Map_Selection(void) timer = delay; Set_Mouse_Cursor(xspot, yspot, start + frame); } - if (_flags == KN_LMOUSE) { - { - choice = 0; - if (choice != -1) { - done = 1; - selection = choice; + if (g_globalKeyFlags == KN_LMOUSE) + { + choice = 0; + if (choice != -1) { + done = 1; + selection = choice; #ifdef WIN32 - Play_Sample(country1, 255, Options.Normalize_Volume(170)); + Play_Sample(country1, 255, Options.Normalize_Volume(170)); #else - Play_Sample(country1, 255, Options.Normalize_Volume(50)); + Play_Sample(country1, 255, Options.Normalize_Volume(50)); #endif - } else { + } else { #ifdef WIN32 - Play_Sample(scold1, 255, Options.Normalize_Volume(170)); + Play_Sample(scold1, 255, Options.Normalize_Volume(170)); #else - Play_Sample(scold1, 255, Options.Normalize_Volume(50)); + Play_Sample(scold1, 255, Options.Normalize_Volume(50)); #endif - } } } } diff --git a/code/REDALERT/MENUS.CPP b/code/REDALERT/MENUS.CPP index 7c4603c..fd8ffda 100644 --- a/code/REDALERT/MENUS.CPP +++ b/code/REDALERT/MENUS.CPP @@ -443,13 +443,14 @@ int Do_Menu(char const ** strings, bool ) UnknownKey = 0; while (selection == -1) { // jmarshall - KeyNumType _key = KN_NONE; - int _flags; - WWSDL_ProcessEvents(_key, _flags); - Show_Mouse(true); -// jmarshall end + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + Call_Back(); - selection = Check_Menu(0, strings, NULL, 0xFFL, 0, _key); + + Show_Mouse(true); + + selection = Check_Menu(0, strings, NULL, 0xFFL, 0, (KeyNumType)g_globalKeyFlags); if (UnknownKey != 0 || UnknownKey == KN_ESC || UnknownKey==KN_LMOUSE || UnknownKey==KN_RMOUSE) break; } Keyboard->Clear(); diff --git a/code/REDALERT/SCORE.CPP b/code/REDALERT/SCORE.CPP index fae61e3..ea2a50c 100644 --- a/code/REDALERT/SCORE.CPP +++ b/code/REDALERT/SCORE.CPP @@ -1427,9 +1427,9 @@ void ScoreClass::Input_Name(char str[], int xpos, int ypos, char const pal[]) // jmarshall - temp disable high school writing. // do { //// jmarshall -// KeyNumType _key; -// int flags; -// WWSDL_ProcessEvents(_key, flags); +// g_globalKeyNumType = KN_NONE; +// g_globalKeyFlags = 0; +// UserInput.Process_Input(); //// jmarshall end // Call_Back(); // Animate_Score_Objs(); diff --git a/code/REDALERT/STARTUP.CPP b/code/REDALERT/STARTUP.CPP index f5febf1..4349196 100644 --- a/code/REDALERT/STARTUP.CPP +++ b/code/REDALERT/STARTUP.CPP @@ -684,9 +684,10 @@ int PASCAL WinMain ( HINSTANCE instance , HINSTANCE , char * command_line , int { Keyboard->Check(); - KeyNumType _key = KN_NONE; - int _flags; - WWSDL_ProcessEvents(_key, _flags); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + + UserInput.Process_Input(); } while (ReadyToQuit == 1); return (EXIT_SUCCESS); @@ -866,10 +867,10 @@ void Emergency_Exit ( int code ) { Keyboard->Check(); - KeyNumType _key = KN_NONE; - int _flags; - WWSDL_ProcessEvents(_key, _flags); - }while (ReadyToQuit == 3); + g_globalKeyNumType = KN_NONE; + g_globalKeyFlags = 0; + UserInput.Process_Input(); + } while (ReadyToQuit == 3); #else //WIN32 diff --git a/code/REDALERT/WINSTUB.CPP b/code/REDALERT/WINSTUB.CPP index 0b988dd..770911b 100644 --- a/code/REDALERT/WINSTUB.CPP +++ b/code/REDALERT/WINSTUB.CPP @@ -886,7 +886,7 @@ void __cdecl SetPalette(unsigned char *palette, long, unsigned long) void WWSDL_ProcessEvents(KeyNumType& key, int& flags, bool presentBuffer) { - UserInput.Process_Input(key, flags, presentBuffer); + //UserInput.Process_Input(key, flags); } #ifndef NDEBUG diff --git a/code/REDALERT/io/UserInput.cpp b/code/REDALERT/io/UserInput.cpp index 6fc66d8..7c602f3 100644 --- a/code/REDALERT/io/UserInput.cpp +++ b/code/REDALERT/io/UserInput.cpp @@ -3,7 +3,7 @@ extern KeyboardClass * Keyboard; -void UserInputClass::Process_Input(KeyNumType& key, int& flags, bool presentBuffer) +void UserInputClass::Process_Input(KeyNumType& key, int& flags) { bool leftMouseProcessed = false; SDL_GetMouseState(&Mouse.X, &Mouse.Y); @@ -50,17 +50,23 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags, bool presentBuff if (event.button.button == SDL_BUTTON_LEFT) { Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_DOWN; + key = KN_LMOUSE; flags = GadgetClass::LEFTPRESS; + + Keyboard->Put_Element(KN_LMOUSE); + leftMouseProcessed = true; numFramesLMouse++; - key = KN_LMOUSE; } else if (event.button.button == SDL_BUTTON_RIGHT) { Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_DOWN; - numFramesLMouse = 0; - flags = GadgetClass::RIGHTPRESS; + Keyboard->Put_Element(KN_RMOUSE); + key = KN_RMOUSE; + flags = GadgetClass::RIGHTPRESS; + + numFramesLMouse = 0; } break; @@ -138,9 +144,4 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags, bool presentBuff Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_HOLD; flags = GadgetClass::LEFTHELD; } - - if (presentBuffer) - { - Device_Present(); - } } \ No newline at end of file diff --git a/code/REDALERT/io/UserInput.h b/code/REDALERT/io/UserInput.h index 7f405e2..2ef72f3 100644 --- a/code/REDALERT/io/UserInput.h +++ b/code/REDALERT/io/UserInput.h @@ -7,6 +7,9 @@ #include "examples/imgui_impl_sdl.h" +extern KeyNumType g_globalKeyNumType; +extern int g_globalKeyFlags; + // Mapping of SDL KeyCode values to internal KeyNumType std::map const sdl_keyMapping = { { SDLK_a, KN_A }, @@ -101,7 +104,7 @@ class UserInputClass INPUT_ACTION_MOUSE, } InputAction; - void UserInputClass::Process_Input(KeyNumType& key, int& flags, bool presentBuffer = true); + void UserInputClass::Process_Input(KeyNumType& key = g_globalKeyNumType, int& flags = g_globalKeyFlags); InputAction LastAction; From acc1af0c0527b749a9d1921d88da27a6a7b9e026 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Sat, 20 Jun 2020 14:47:37 -0700 Subject: [PATCH 3/3] Fix for placement editor crash. --- code/REDALERT/CDATA.CPP | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/code/REDALERT/CDATA.CPP b/code/REDALERT/CDATA.CPP index 962930a..11bd4ad 100644 --- a/code/REDALERT/CDATA.CPP +++ b/code/REDALERT/CDATA.CPP @@ -3198,20 +3198,23 @@ void TemplateTypeClass::Display(int x, int y, WindowNumberType window, HousesTyp for (index = 0; index < w*h; index++) { if (map[index] != 0xFF) { - HidPage.Draw_Stamp(iconset, index, 0, 0, NULL, WINDOW_MAIN); - Buffer_Enable_HD_Texture(true); // At this point, Draw_Stamp creates a 32bit image. - if (scale) { - HidPage.Scale((*LogicPage), 0, 0, - x + ((index % w)*(ICON_PIXEL_W/2)), - y + ((index / w)*(ICON_PIXEL_H/2)), - ICON_PIXEL_W, ICON_PIXEL_H, - ICON_PIXEL_W/2, ICON_PIXEL_H/2, (char *)NULL); - - } else { - HidPage.Blit((*LogicPage), 0, 0, x + ((index % w)*(ICON_PIXEL_W)), - y + ((index / w)*(ICON_PIXEL_H)), ICON_PIXEL_W, ICON_PIXEL_H); - } - Buffer_Enable_HD_Texture(false); +// jmarshall - even if using legacy data, always use hdimage. + HidPage.Draw_Stamp(Get_HDImage_Data(), index, 0, 0, NULL, WINDOW_MAIN); + // Disabled legacy blit code. + //Buffer_Enable_HD_Texture(true); // At this point, Draw_Stamp creates a 32bit image. + //if (scale) { + // HidPage.Scale((*LogicPage), 0, 0, + // x + ((index % w)*(ICON_PIXEL_W/2)), + // y + ((index / w)*(ICON_PIXEL_H/2)), + // ICON_PIXEL_W, ICON_PIXEL_H, + // ICON_PIXEL_W/2, ICON_PIXEL_H/2, (char *)NULL); + // + //} else { + // HidPage.Blit((*LogicPage), 0, 0, x + ((index % w)*(ICON_PIXEL_W)), + // y + ((index / w)*(ICON_PIXEL_H)), ICON_PIXEL_W, ICON_PIXEL_H); + //} + //Buffer_Enable_HD_Texture(false); +// jmarshall end } } }