Revert "Merge branch 'Isometric-Dev' into master"

This reverts commit ae0648fccc, reversing
changes made to d7243e8265.
This commit is contained in:
Justin Marshall
2020-08-06 15:50:30 -07:00
parent ae0648fccc
commit 6685b5d51a
433 changed files with 8487 additions and 172344 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ extern "C" {
struct Image_t;
Image_t* Load_Stamp(const char* name, const void* icondata, void *terrainPalette);
Image_t* Load_Stamp(const char* name, const void* icondata);
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);
+12 -2
View File
@@ -453,6 +453,12 @@ inline BOOL GraphicViewPortClass::Get_IsDirectDraw(void)
*=============================================================================================*/
inline BOOL GraphicViewPortClass::Lock(void)
{
BOOL lock = GraphicBuff->Lock();
if ( !lock ) return(FALSE);
if (this != GraphicBuff) {
Attach(GraphicBuff, XPos, YPos, Width, Height);
}
return(TRUE);
}
@@ -473,6 +479,11 @@ inline BOOL GraphicViewPortClass::Lock(void)
*=============================================================================================*/
inline BOOL GraphicViewPortClass::Unlock(void)
{
BOOL unlock = GraphicBuff->Unlock();
if (!unlock) return(FALSE);
if (this != GraphicBuff && IsDirectDraw && !GraphicBuff->LockCount) {
Offset = 0;
}
return(TRUE);
}
@@ -1030,9 +1041,8 @@ inline void GraphicViewPortClass::Draw_Stamp(void const * icondata, int icon, in
if (Lock()){
UnCachedIconsDrawn++;
extern int ScreenHeight, ScreenWidth;
if (y_pixel < ScreenHeight && x_pixel < ScreenWidth) {
if(y_pixel < ScreenHeight && x_pixel < ScreenWidth)
Buffer_Draw_Stamp_Clip(this, icondata, icon, x_pixel, y_pixel, remap, WindowList[clip_window][WINDOWX], WindowList[clip_window][WINDOWY], WindowList[clip_window][WINDOWWIDTH], WindowList[clip_window][WINDOWHEIGHT]);
}
}
}
Unlock();
+293
View File
@@ -46,3 +46,296 @@
#include <file.h>
#include "tile.h"
#include <iff.h>
// 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);
}
+2 -2
View File
@@ -251,7 +251,7 @@ void * __cdecl Open_Animation(char const *file_name, char *user_buffer, long use
}
if (wsa_hardware_image == NULL) {
wsa_hardware_image = Image_CreateBlankImage("wsa", file_header.pixel_width, file_header.pixel_height, true);
wsa_hardware_image = Image_CreateBlankImage("wsa", file_header.pixel_width, file_header.pixel_height);
}
Sys_SetOverlayImage(wsa_hardware_image);
wsa_palette = palette;
@@ -646,7 +646,7 @@ BOOL __cdecl Animate_Frame(void *handle, GraphicViewPortClass& view,
#endif
}
Image_UploadRaw(wsa_hardware_image, (uint8_t *)view.Get_Offset(), true, wsa_palette, true);
Image_UploadRaw(wsa_hardware_image, (uint8_t *)view.Get_Offset(), true, wsa_palette);
view.Unlock();
return TRUE;