From c7748a616d920f72496e3f599cae9b975fd13f21 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Wed, 1 Jul 2020 11:14:03 -0700 Subject: [PATCH] Fixed templatetypeclass land_type. Template's can be placed but only the first tile seems to work. --- SCU01EA.INI | 9 +- code/redalert/cdata.cpp | 66 ++++--- code/redalert/compat.h | 73 +------ code/redalert/defines.h | 4 + code/redalert/display.cpp | 4 +- code/redalert/image.h | 2 + code/redalert/map.cpp | 19 +- code/redalert/radar.cpp | 38 ++-- code/redalert/template.cpp | 8 +- code/redalert/tileset.cpp | 36 +++- code/redalert/win32lib/iconset.cpp | 293 ----------------------------- 11 files changed, 117 insertions(+), 435 deletions(-) diff --git a/SCU01EA.INI b/SCU01EA.INI index 211d7ed..dfbc85c 100644 --- a/SCU01EA.INI +++ b/SCU01EA.INI @@ -142,11 +142,8 @@ Height=30 99=8256 [MapPack] -1=BwAAIIH//v8f/4AHAAAggf/+/x//gAcAACCB//7/H/+ABwAAIIH//v8f/4AHAAAggQD+/x -2=8AgAcAACCBAP7/HwCA - -[UNITS] -0=USSR,4TNK,256,7867,0,Guard,None +1=BwAAIIH//v8f/4AVAAAggf/+dR7/hAEAAQD+/AD//4oAdh6ABwAAIIH//v8f/4AHAAAggf +2=/+/x//gBQAACCBAP47HwCBAf5+AACCAgP+QwAAgAcAACCBAP7/HwCA [Base] Player=USSR @@ -162,5 +159,5 @@ Count=0 4=Direct Tanya to destroy the westmost power plants to take them off-line. [Digest] -1=EwOfEw8wu+RAo5MXzV1zOUK2LeU= +1=dWjOPCEhb7UG7SsNlAGLf6N5iyc= diff --git a/code/redalert/cdata.cpp b/code/redalert/cdata.cpp index a89995b..4e37ed5 100644 --- a/code/redalert/cdata.cpp +++ b/code/redalert/cdata.cpp @@ -2309,31 +2309,29 @@ void TemplateTypeClass::Init_Heap(void) *=============================================================================================*/ LandType TemplateTypeClass::Land_Type(int icon) const { - IconsetClass const * icontrol = (IconsetClass const *)Get_Image_Data(); + IsoTile* icontrol = (IsoTile *)Get_Image_Data(); if (icontrol != NULL) { - unsigned char const * map = icontrol->Control_Map(); - if (map != NULL) { + IsoTileImageHeader* image = icontrol->GetTileInfo(icon); + if (image != NULL) { static LandType _land[16] = { LAND_CLEAR, - LAND_CLEAR, - LAND_CLEAR, - LAND_CLEAR, // Clear - LAND_CLEAR, - LAND_CLEAR, - LAND_BEACH, // Beach - LAND_CLEAR, - LAND_ROCK, // Rock - LAND_ROAD, // Road - LAND_WATER, // Water - LAND_RIVER, // River - LAND_CLEAR, - LAND_CLEAR, - LAND_ROUGH, // Rough - LAND_CLEAR, + LAND_ROAD , + LAND_WATER, + LAND_ROCK, + LAND_WALL, + LAND_TIBERIUM, + LAND_BEACH, + LAND_ROUGH, + LAND_ICE, + LAND_RAILROAD, + LAND_TUNNEL, + LAND_WEEDS, + LAND_COUNT, }; - return(_land[map[icon % (icontrol->Map_Width() * icontrol->Map_Height())]]); + //return(_land[map[icon % (icontrol->Map_Width() * icontrol->Map_Height())]]); + return _land[image->TileType % LAND_COUNT]; } } return(LAND_CLEAR); @@ -2394,14 +2392,19 @@ short const * TemplateTypeClass::Occupy_List(bool) const static short _occupy[13*8+5]; short * ptr; - IconsetClass const * iconset = (IconsetClass const *)Get_Image_Data(); - unsigned char const * map = iconset->Map_Data(); + IsoTile * iconset = (IsoTile *)Get_Image_Data(); + //unsigned char const * map = iconset->Map_Data(); ptr = &_occupy[0]; - for (int index = 0; index < Width * Height; index++) { - if (*map++ != 0xFF) { - *ptr++ = (index % Width) + ((index / Width)*MAP_CELL_W); - } + for (int index = 0; index < iconset->NumTiles(); index++) { + //if (*map++ != 0xFF) { + // *ptr++ = (index % Width) + ((index / Width)*MAP_CELL_W); + //} + IsoTileImageHeader* tileimg = iconset->GetTileInfo(index); + if (tileimg == NULL) + continue; + + *ptr++ = (index % Width) + ((index / Width) * MAP_CELL_W); } *ptr = REFRESH_EOL; @@ -2435,9 +2438,9 @@ void TemplateTypeClass::Init(TheaterType theater) void *terrainPalette = (void *)MFCD::Retrieve(Theaters[theater].IsoPalette); for (TemplateType index = TEMPLATE_FIRST; index < TEMPLATE_COUNT; index++) { - TemplateTypeClass const & tplate = As_Reference(index); + TemplateTypeClass& tplate = As_Reference(index); // jmarshall - temp hack - if (index > TEMPLATE_SHORE41) + if (index > TEMPLATE_ROAD43) break; // jmarshall end ((void const *&)tplate.ImageData) = NULL; @@ -2466,8 +2469,11 @@ void TemplateTypeClass::Init(TheaterType theater) sprintf(tmp, "icon_%s", fullname); ((void const*&)tplate.HDImageData) = Load_Stamp(fullname, tplate.ImageData, terrainPalette); } - } + + } } + + } @@ -2496,6 +2502,8 @@ void TemplateTypeClass::Display(int x, int y, WindowNumberType window, HousesTyp bool scale; // Should the template be half sized? Image_t* img = Get_HDImage_Data(); + if (img == NULL) + return; w = Bound(img->width, 1, 13); h = Bound(img->height, 1, 8); @@ -2546,7 +2554,7 @@ void TemplateTypeClass::Prep_For_Add(void) { for (TemplateType index = TEMPLATE_CLEAR1; index < TEMPLATE_COUNT; index++) { // jmarshall - if (index > TEMPLATE_SHORE41) + if (index > TEMPLATE_ROAD43) return; // jmarshall end if (As_Reference(index).Get_Image_Data()) { diff --git a/code/redalert/compat.h b/code/redalert/compat.h index 049a2fd..5a4d4cd 100644 --- a/code/redalert/compat.h +++ b/code/redalert/compat.h @@ -130,43 +130,9 @@ typedef enum MenuIndexType { #define DKGRAY GREY #define LTGRAY LTGREY +int Get_IconSet_MapWidth(void const* data); +int Get_IconSet_MapHeight(void const* data); -class IconsetClass; -#ifndef WIN32 -typedef struct { - short Width; // Width of icons (pixels). - short Height; // Height of icons (pixels). - short Count; // Number of (logical) icons in this set. - short Allocated; // Was this iconset allocated? - short MapWidth; // Width of map (in icons). - short MapHeight; // Height of map (in icons). - long Size; // Size of entire iconset memory block. - long Icons; // Offset from buffer start to icon data. -// unsigned char * Icons; // Offset from buffer start to icon data. - long Palettes; // Offset from buffer start to palette data. - long Remaps; // Offset from buffer start to remap index data. - long TransFlag; // Offset for transparency flag table. - long ColorMap; // Offset for color control value table. - long Map; // Icon map offset (if present). -// unsigned char * Map; // Icon map offset (if present). -} IControl_Type; -#endif - -inline int Get_IconSet_MapWidth(void const * data) -{ - if (data) { - return(((IControl_Type *)data)->MapWidth); - } - return(0); -} - -inline int Get_IconSet_MapHeight(void const * data) -{ - if (data) { - return(((IControl_Type *)data)->MapHeight); - } - return(0); -} inline unsigned char const * Get_IconSet_ControlMap(void const * data) { @@ -176,39 +142,4 @@ inline unsigned char const * Get_IconSet_ControlMap(void const * data) return(0); } -class IconsetClass : protected IControl_Type -{ - public: - /* - ** Query functions. - */ - int Map_Width(void) const {return(MapWidth);}; - int Map_Height(void) const {return(MapHeight);}; - unsigned char * Control_Map(void) {return((unsigned char *)this + ColorMap);}; - unsigned char const * Control_Map(void) const {return((unsigned char const *)this + ColorMap);}; - int Icon_Count(void) const {return(Count);}; - int Pixel_Width(void) const {return(Width);}; - int Pixel_Height(void) const {return(Height);}; - int Total_Size(void) const {return(Size);}; - unsigned char const * Palette_Data(void) const {return((unsigned char const *)this + Palettes);}; - unsigned char * Palette_Data(void) {return((unsigned char *)this + Palettes);}; - unsigned char const * Icon_Data(void) const {return((unsigned char const *)this + Icons);}; - unsigned char * Icon_Data(void) {return((unsigned char *)this + Icons);}; - unsigned char const * Map_Data(void) const {return((unsigned char const *)this + Map);}; - unsigned char * Map_Data(void) {return((unsigned char *)this + Map);}; - unsigned char const * Remap_Data(void) const {return((unsigned char const *)this + Remaps);}; - unsigned char * Remap_Data(void) {return((unsigned char *)this + Remaps);}; - unsigned char const * Trans_Data(void) const {return((unsigned char const *)this + TransFlag);}; - unsigned char * Trans_Data(void) {return((unsigned char *)this + TransFlag);}; - - /* - ** Disallow these operations with an IconsetClass object. - */ - private: - IconsetClass & operator = (IconsetClass const &); - IconsetClass(void); - static void * operator new(size_t); -}; - - #endif diff --git a/code/redalert/defines.h b/code/redalert/defines.h index fc7d391..9dea187 100644 --- a/code/redalert/defines.h +++ b/code/redalert/defines.h @@ -2928,6 +2928,10 @@ typedef enum LandType : char { LAND_BEACH, // Beach terrain. LAND_ROUGH, // Rocky terrain. LAND_RIVER, // Rocky riverbed. + LAND_ICE, + LAND_RAILROAD, + LAND_TUNNEL, + LAND_WEEDS, LAND_COUNT, LAND_NONE=-1, diff --git a/code/redalert/display.cpp b/code/redalert/display.cpp index 36db138..2512b3a 100644 --- a/code/redalert/display.cpp +++ b/code/redalert/display.cpp @@ -1003,7 +1003,7 @@ void DisplayClass::Cursor_Mark(CELL pos, bool on) CELL cell = pos + *ptr++; if (In_Radar(cell)) { cellptr = &(*this)[cell]; - cellptr->Redraw_Objects(); + cellptr->Redraw_Objects(true); // jmarshall: Force redraw all cursor tiles. if (on) { cellptr->IsCursorHere = true; } else { @@ -1022,7 +1022,7 @@ void DisplayClass::Cursor_Mark(CELL pos, bool on) CELL cell = pos + *ptr++; if (In_Radar(cell)) { cellptr = &(*this)[cell]; - cellptr->Redraw_Objects(); + cellptr->Redraw_Objects(true); // jmarshall: Force redraw all cursor tiles. } } } diff --git a/code/redalert/image.h b/code/redalert/image.h index 752de93..8e0976a 100644 --- a/code/redalert/image.h +++ b/code/redalert/image.h @@ -156,6 +156,8 @@ public: return tileImageHeaders; } int NumTiles(void) { return header.TileWidth * header.TileHeight; } + int NumTilesX(void) { return header.TileWidth; } + int NumTilesY(void) { return header.TileHeight; } private: IsoTileHeader_t header; }; \ No newline at end of file diff --git a/code/redalert/map.cpp b/code/redalert/map.cpp index 43f1f5f..7197c9d 100644 --- a/code/redalert/map.cpp +++ b/code/redalert/map.cpp @@ -1299,15 +1299,16 @@ if (BlubCell->Overlapper[1]) { ** icon. If the icon value is out of range or points to an invalid spot, ** return an error. */ - if (ttype != TEMPLATE_NONE) { - tclass = &TemplateTypeClass::As_Reference(ttype); - ticon = (*this)[cell].TIcon; - Mem_Copy(Get_Icon_Set_Map(tclass->Get_Image_Data()), map, tclass->Width * tclass->Height); - if (ticon < 0 || ticon >= (tclass->Width * tclass->Height) || map[ticon]==0xff) { - return (false); - } - } - +// jmarshall - readd this check? + //if (ttype != TEMPLATE_NONE) { + // tclass = &TemplateTypeClass::As_Reference(ttype); + // ticon = (*this)[cell].TIcon; + // Mem_Copy(Get_Icon_Set_Map(tclass->Get_Image_Data()), map, tclass->Width * tclass->Height); + // if (ticon < 0 || ticon >= (tclass->Width * tclass->Height) || map[ticon]==0xff) { + // return (false); + // } + //} +// jmarshall end /* ** Validate Overlay */ diff --git a/code/redalert/radar.cpp b/code/redalert/radar.cpp index bbc6c15..96b0d0e 100644 --- a/code/redalert/radar.cpp +++ b/code/redalert/radar.cpp @@ -1081,25 +1081,25 @@ void RadarClass::Plot_Radar_Pixel(CELL cell) ptr = &TemplateTypeClass::As_Reference(TEMPLATE_CLEAR1); icon = cellptr->Clear_Icon(); } - - IconsetClass const * iconset = (IconsetClass const *)ptr->Get_Image_Data(); - unsigned char const * icondata = iconset->Icon_Data(); - - - /* - ** Convert the logical icon number into the actual icon number. - */ - icon &= 0x00FF; - icon = *(iconset->Map_Data() + icon); -// jmarshall - unsigned char * data = (unsigned char *)icondata + icon*(24*24); - Image_t* image; - { - char tmp[512]; - sprintf(tmp, "radar_%d_%d", ptr->Type, icon); - image = Image_CreateImageFrom8Bit(tmp, 24, 24, (unsigned char*)data); - } - GL_RenderImage(image, x, y, ZoomFactor, ZoomFactor); +// jmarshall - fix radar +// IconsetClass const * iconset = (IconsetClass const *)ptr->Get_Image_Data(); +// unsigned char const * icondata = iconset->Icon_Data(); +// +// +// /* +// ** Convert the logical icon number into the actual icon number. +// */ +// icon &= 0x00FF; +// icon = *(iconset->Map_Data() + icon); +//// jmarshall +// unsigned char * data = (unsigned char *)icondata + icon*(24*24); +// Image_t* image; +// { +// char tmp[512]; +// sprintf(tmp, "radar_%d_%d", ptr->Type, icon); +// image = Image_CreateImageFrom8Bit(tmp, 24, 24, (unsigned char*)data); +// } +// GL_RenderImage(image, x, y, ZoomFactor, ZoomFactor); // jmarshall end //Buffer_To_Page(0, 0, 24, 24, data, _TileStage); //_TileStage.Scale(*LogicPage, 0, 0, x, y, 24, 24, ZoomFactor, ZoomFactor, TRUE); diff --git a/code/redalert/template.cpp b/code/redalert/template.cpp index 83777ae..b02583b 100644 --- a/code/redalert/template.cpp +++ b/code/redalert/template.cpp @@ -90,7 +90,7 @@ bool TemplateClass::Mark(MarkType mark) void const * iset = Get_Image_Data(); if (iset && ObjectClass::Mark(mark)) { - void * map = Get_Icon_Set_Map(iset); + //void * map = Get_Icon_Set_Map(iset); for (int y = 0; y < Class->Height; y++) { for (int x = 0; x < Class->Width; x++) { @@ -104,10 +104,10 @@ bool TemplateClass::Mark(MarkType mark) ** icon is associated with this logical position, then don't do any action ** since none is required. */ - char * mapptr = (char*)map; - bool real = (mapptr[number] != -1); + //char * mapptr = (char*)map; + //bool real = (mapptr[number] != -1); - if (real) { + { /* ** Lift the terrain object from the map. */ diff --git a/code/redalert/tileset.cpp b/code/redalert/tileset.cpp index 187c776..006111c 100644 --- a/code/redalert/tileset.cpp +++ b/code/redalert/tileset.cpp @@ -31,6 +31,28 @@ using std::memcpy; class GraphicViewPortClass; byte TempTSStampData[48 * 24 * 4]; + +int Get_IconSet_MapWidth(void const* data) +{ + // jmarshall + if (data) { + return ((IsoTile*)data)->NumTilesX(); + } + // jmarshall end + return(0); +} + +int Get_IconSet_MapHeight(void const* data) +{ + // jmarshall + if (data) { + return ((IsoTile*)data)->NumTilesY(); + } + // jmarshall end + return(0); +} + + Image_t* Load_StampHD(int theater, const char* iconName, const void* icondata) { char filename[2048]; Image_t* image = NULL; @@ -124,7 +146,12 @@ Image_t * Load_Stamp(const char *name, const void* icondata, void* terrainPalett } } - uint8_t* src = isoTile->GetTileInfo(0)->GetRasterizedData(); + IsoTileImageHeader* initialTile = isoTile->GetTileInfo(0); + if(initialTile == NULL) { + return NULL; + } + + uint8_t* src = initialTile->GetRasterizedData(); Image_t *image = Image_CreateImageFrom8Bit(name, isoTile->TileImageWidth(), isoTile->TileImageHeight(), (unsigned char*)src, NULL, (unsigned char *)terrainPalette); if (image == NULL) { return NULL; @@ -133,7 +160,12 @@ Image_t * Load_Stamp(const char *name, const void* icondata, void* terrainPalett image->isoTileInfo = isoTile; for (int i = 1; i < isoTile->NumTiles(); i++) { - src = isoTile->GetTileInfo(i)->GetRasterizedData(); + IsoTileImageHeader* tile = isoTile->GetTileInfo(i); + if(tile == NULL) { + continue; + } + + src = tile->GetRasterizedData(); Image_Add8BitImage(image, 0, i, isoTile->TileImageWidth(), isoTile->TileImageHeight(), src, NULL, (unsigned char*)terrainPalette); } diff --git a/code/redalert/win32lib/iconset.cpp b/code/redalert/win32lib/iconset.cpp index 5b3301c..1a6d52c 100644 --- a/code/redalert/win32lib/iconset.cpp +++ b/code/redalert/win32lib/iconset.cpp @@ -46,296 +46,3 @@ #include #include "tile.h" #include - - -// Misc? ST - 1/3/2019 10:40AM -//extern int Misc; -int Misc; - - -void * Load_Icon_Set(char const *filename, void *iconsetptr, long buffsize); -void Free_Icon_Set(void const *iconset); -long Get_Icon_Set_Size(void const *iconset); -int Get_Icon_Set_Width(void const *iconset); -int Get_Icon_Set_Height(void const *iconset); -void * Get_Icon_Set_Icondata(void const *iconset); -void * Get_Icon_Set_Trans(void const *iconset); -void * Get_Icon_Set_Remapdata(void const *iconset); -void * Get_Icon_Set_Palettedata(void const *iconset); -int Get_Icon_Set_Count(void const *iconset); -void * Get_Icon_Set_Map(void const *iconset); - - -//#define ICON_PALETTE_BYTES 16 -//#define ICON_MAX 256 - -/*************************************************************************** -** The terrain is rendered by using icons. These are the buffers that hold -** the icon data, remap tables, and remap index arrays. -*/ -//PRIVATE char *IconPalette = NULL; // MCGA only. -//PRIVATE char *IconRemap = NULL; // MCGA only. - -#define FORM_RPAL MAKE_ID('R','P','A','L') -#define FORM_RTBL MAKE_ID('R','T','B','L') -#define FORM_SSET MAKE_ID('S','S','E','T') -#define FORM_SINF MAKE_ID('S','I','N','F') -#define FORM_ICON MAKE_ID('I','C','O','N') -#define FORM_TRNS MAKE_ID('T','R','N','S') -#define FORM_MAP MAKE_ID('M','A','P',' ') - - - -/*************************************************************************** - * LOAD_ICON_SET -- Loads an icons set and initializes it. * - * * - * This routine will load an IFF icon set from disk. It handles all * - * of the necessary allocations. * - * * - * INPUT: filename -- Name of the icon file. * - * * - * buffer -- Pointer to paragraph aligned buffer to hold data. * - * * - * size -- Size of the buffer (in bytes). * - * * - * OUTPUT: none * - * * - * WARNINGS: In EEGA mode the iconset buffer will be free because the * - * icons will have been transferred to card ram. * - * * - * HISTORY: * - * 06/21/1991 JLB : Created. * - * 07/01/1991 JLB : Determines icon size from file. * - * 07/15/1991 JLB : Load and uncompress onto the same buffer. * - * 09/15/1993 JLB : Added EMS support. * - *=========================================================================*/ -void * Load_Icon_Set(char const *filename, void *iconsetptr, long buffsize) -{ - int fh; // File handle of iconset. - int bytespericon; // The number of bytes per icon. - unsigned long icons=0; // Number of icons loaded. - unsigned long size; // Size of the icon chunk (raw). - - unsigned long transsize; - void *transptr=NULL; - - unsigned long mapsize; // Icon map chunk size. - void *mapptr=NULL; // Icon map pointer. - void *returnptr=NULL; // Iconset pointer returned by routine. - BOOL allocated=FALSE; // Was the iconset block allocated? - IControl_Type *idata=NULL; // Icon data loaded. - long id; // ID of file openned. - struct { - char Width; // Width of icon in bytes. - char Height; // Height of icon in bytes. - char Format; // Graphic mode. - //lint -esym(754,Format) - char Bitplanes; // Number of bitplanes per icon. - } sinf; - - /* - ** Open the icon set for loading. If it is not a legal icon set - ** data file, then abort. - */ - fh = Open_Iff_File(filename); - if (fh != WW_ERROR) { - Read_File(fh, &id, sizeof(long)); - if (id == FORM_ICON) { - - /* - ** Determine the size of the icons and set up the graphic - ** system accordingly. Also get the sizes of the various - ** data blocks that have to be loaded. - */ - Read_Iff_Chunk(fh, FORM_SINF, &sinf, sizeof(sinf)); - bytespericon = ((((int)sinf.Width)<<3)*(((int)sinf.Height)<<3)*(int)sinf.Bitplanes)>>3; - - size = Get_Iff_Chunk_Size(fh,FORM_SSET); - transsize = Get_Iff_Chunk_Size(fh, FORM_TRNS); - mapsize = Get_Iff_Chunk_Size(fh, FORM_MAP); - - /* - ** Allocate the icon buffer if one isn't provided. First try EMS and - ** then try conventional RAM. - */ - allocated = FALSE; - if (!iconsetptr) { - buffsize = size + transsize + mapsize + sizeof(IControl_Type); - - Misc = buffsize; - iconsetptr = Alloc(buffsize, MEM_NORMAL); - allocated = (iconsetptr != NULL); - } - - if (iconsetptr && (size+transsize+mapsize+sizeof(IControl_Type)) <= (unsigned long)buffsize) { - - idata = (IControl_Type *)iconsetptr; - - memset(idata, 0, sizeof(IControl_Type)); - - /* - ** Initialize the iconset header structure. - */ - idata->Width = (short)(((short)sinf.Width)<<3); - idata->Height = (short)(((short)sinf.Height)<<3); - idata->Allocated = (short)allocated; - idata->Icons = (long)iconsetptr + sizeof(IControl_Type); - idata->Map = idata->Icons + size; - idata->TransFlag = sizeof(IControl_Type) + size + mapsize; - idata->Size = buffsize; - - { - long val; - - val = Read_Iff_Chunk(fh, FORM_SSET, Add_Long_To_Pointer(iconsetptr, sizeof(IControl_Type)), size); - icons = (int)(val/(long)bytespericon); - idata = (IControl_Type *)iconsetptr; - } - - if (mapsize) { - icons = mapsize; - } - idata->Count = (short)icons; - - /* - ** Limit buffer to only the size needed. This is done AFTER loading of the - ** raw icon data because it might have been compressed and thus need any - ** extra space to perform an overlapped decompression. - */ - if ((unsigned long)buffsize > size + transsize + mapsize + sizeof(IControl_Type)) { - buffsize = size + transsize + mapsize + sizeof(IControl_Type); - } - - transptr = Add_Long_To_Pointer(iconsetptr, idata->TransFlag); - Read_Iff_Chunk(fh, FORM_TRNS, transptr, transsize); - idata = (IControl_Type *)iconsetptr; - - mapptr = (void*)idata->Map; - Read_Iff_Chunk(fh, FORM_MAP, mapptr, mapsize); - - /* - ** Let the graphic overlay know of the icon data. This could involve - ** translation and other data manipulations. - */ - //Init_Stamps(iconsetptr); - - returnptr = iconsetptr; - } - } - Close_Iff_File(fh); - } - - return (returnptr); // Return with icon pointer. -} - - -/*************************************************************************** - * FREE_ICON_SET -- Frees allocations made by Load_Icon_Set(). * - * * - * This routine is used to free up any allocations by Load_Icon_Set(). * - * Use this routine when a new icon set is to be loaded. * - * * - * INPUT: none * - * * - * OUTPUT: none * - * * - * WARNINGS: none * - * * - * HISTORY: * - * 06/21/1991 JLB : Created. * - *=========================================================================*/ -void Free_Icon_Set(void const *iconset) -{ - IControl_Type *icontrol; - - icontrol = (IControl_Type *)iconset; - if (icontrol) { - if (icontrol->Allocated) { - Free((void *)iconset); - } - } -} - - -long Get_Icon_Set_Size(void const *iconset) -{ - IControl_Type *icontrol; - long size=0; - - icontrol = (IControl_Type *)iconset; - if (icontrol) { - size = icontrol->Size; - } - return(size); -} - - -int Get_Icon_Set_Width(void const *iconset) -{ - IControl_Type *icontrol; - int width=0; - - icontrol = (IControl_Type *)iconset; - if (icontrol) { - width = icontrol->Width; - } - return(width); -} - - -int Get_Icon_Set_Height(void const *iconset) -{ - IControl_Type *icontrol; - int height=0; - - icontrol = (IControl_Type *)iconset; - if (icontrol) { - height = icontrol->Height; - } - return(height); -} - - -void * Get_Icon_Set_Icondata(void const *iconset) -{ - IControl_Type *icontrol; - icontrol = (IControl_Type *)iconset; - if (icontrol) - return(Add_Long_To_Pointer(iconset, (LONG)icontrol->Icons)); - return(NULL); -} - -void * Get_Icon_Set_Trans(void const *iconset) -{ - IControl_Type *icontrol; - void *ptr=NULL; - - icontrol = (IControl_Type *)iconset; - if (icontrol) { - ptr = Add_Long_To_Pointer((void *)iconset, icontrol->TransFlag); - } - return(ptr); -} - - -int Get_Icon_Set_Count(void const *iconset) -{ - IControl_Type *icontrol; - int count; - - icontrol = (IControl_Type *)iconset; - if (icontrol) { - count = icontrol->Count; - } - return(count); -} - - -void * Get_Icon_Set_Map(void const *iconset) -{ - IControl_Type *icontrol; - icontrol = (IControl_Type *)iconset; - if (icontrol) - return(Add_Long_To_Pointer(iconset, (LONG)icontrol->Map)); - return(NULL); -}