mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Merge pull request #236 from 1dot13/container
Remove use of Container.cpp in vsurface, dialogue and event systems
This commit is contained in:
@@ -51,7 +51,6 @@
|
||||
|
||||
|
||||
|
||||
HLIST ghVideoObjects = NULL;
|
||||
BOOLEAN gfVideoObjectsInit=FALSE;
|
||||
|
||||
#ifndef SGP_VIDEO_DEBUGGING
|
||||
|
||||
@@ -225,7 +225,6 @@ BOOLEAN GetETRLEPixelValue( UINT8 * pDest, HVOBJECT hVObject, UINT16 usETLREInde
|
||||
// Globals
|
||||
//
|
||||
// ****************************************************************************
|
||||
extern HLIST ghVideoObjects;
|
||||
|
||||
// ****************************************************************************
|
||||
//
|
||||
|
||||
@@ -98,18 +98,13 @@ void CheckValidVSurfaceIndex( UINT32 uiIndex );
|
||||
|
||||
INT32 giMemUsedInSurfaces;
|
||||
|
||||
|
||||
//OBSOLETE!!!!!!!!!
|
||||
HLIST ghVideoSurfaces = NULL;
|
||||
//OBSOLETE!!!!!!!!!
|
||||
|
||||
|
||||
HVSURFACE ghPrimary = NULL;
|
||||
HVSURFACE ghBackBuffer = NULL;
|
||||
HVSURFACE ghFrameBuffer = NULL;
|
||||
HVSURFACE ghMouseBuffer = NULL;
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
extern std::map<UINT32,ClipRectangle> g_SurfaceRectangle;
|
||||
|
||||
@@ -1161,11 +1156,7 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
|
||||
//
|
||||
// Allocate memory for Video Surface data and initialize
|
||||
//
|
||||
|
||||
hVSurface = (HVSURFACE) MemAlloc( sizeof( SGPVSurface ) );
|
||||
memset( hVSurface, 0, sizeof( SGPVSurface ) );
|
||||
CHECKF( hVSurface != NULL );
|
||||
|
||||
hVSurface = new SGPVSurface{};
|
||||
hVSurface->usHeight = usHeight;
|
||||
hVSurface->usWidth = usWidth;
|
||||
// BF : since we use a 16bpp framebuffer and images are converted to that format,
|
||||
@@ -1178,7 +1169,6 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
|
||||
hVSurface->pPalette = NULL;
|
||||
hVSurface->p16BPPPalette = NULL;
|
||||
hVSurface->TransparentColor = FROMRGB( 0, 0, 0 );
|
||||
hVSurface->RegionList = CreateList( DEFAULT_NUM_REGIONS, sizeof( VSURFACE_REGION ) );
|
||||
hVSurface->fFlags = 0;
|
||||
hVSurface->pClipper = NULL;
|
||||
|
||||
@@ -1647,12 +1637,6 @@ BOOLEAN DeleteVideoSurface( HVSURFACE hVSurface )
|
||||
hVSurface->pPalette = NULL;
|
||||
}
|
||||
|
||||
//if ( hVSurface->pClipper != NULL )
|
||||
//{
|
||||
// Release Clipper
|
||||
// DDReleaseClipper( (LPDIRECTDRAWCLIPPER)hVSurface->pClipper );
|
||||
//}
|
||||
|
||||
// Get surface pointer
|
||||
lpDDSurface = (LPDIRECTDRAWSURFACE2)hVSurface->pSurfaceData;
|
||||
|
||||
@@ -1670,7 +1654,7 @@ BOOLEAN DeleteVideoSurface( HVSURFACE hVSurface )
|
||||
}
|
||||
|
||||
// Release region data
|
||||
DeleteList( hVSurface->RegionList );
|
||||
hVSurface->RegionList.clear();
|
||||
|
||||
//If there is a 16bpp palette, free it
|
||||
if( hVSurface->p16BPPPalette != NULL )
|
||||
@@ -1682,8 +1666,7 @@ BOOLEAN DeleteVideoSurface( HVSURFACE hVSurface )
|
||||
giMemUsedInSurfaces -= ( hVSurface->usHeight * hVSurface->usWidth * ( hVSurface->ubBitDepth / 8 ) );
|
||||
|
||||
// Release object
|
||||
MemFree( hVSurface );
|
||||
|
||||
delete hVSurface;
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -1768,7 +1751,7 @@ BOOLEAN GetNumRegions( HVSURFACE hVSurface , UINT32 *puiNumRegions )
|
||||
{
|
||||
Assert( hVSurface );
|
||||
|
||||
*puiNumRegions = ListSize( hVSurface->RegionList );
|
||||
*puiNumRegions = hVSurface->RegionList.size();
|
||||
|
||||
return( TRUE );
|
||||
|
||||
@@ -1780,7 +1763,7 @@ BOOLEAN AddVSurfaceRegion( HVSURFACE hVSurface, VSURFACE_REGION *pNewRegion )
|
||||
Assert( pNewRegion != NULL );
|
||||
|
||||
// Add new region to list
|
||||
hVSurface->RegionList = AddtoList( hVSurface->RegionList, pNewRegion, ListSize( hVSurface->RegionList ) );
|
||||
hVSurface->RegionList.push_back(*pNewRegion);
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -1801,29 +1784,10 @@ BOOLEAN AddVSurfaceRegions( HVSURFACE hVSurface, VSURFACE_REGION **ppNewRegions,
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN RemoveVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex )
|
||||
{
|
||||
VSURFACE_REGION aRegion;
|
||||
|
||||
Assert( hVSurface != NULL );
|
||||
|
||||
return( RemfromList( hVSurface->RegionList, &aRegion, usIndex ) );
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN ClearAllVSurfaceRegions( HVSURFACE hVSurface )
|
||||
{
|
||||
UINT32 uiListSize;
|
||||
|
||||
Assert( hVSurface != NULL );
|
||||
|
||||
uiListSize = ListSize( hVSurface->RegionList );
|
||||
|
||||
for ( INT32 cnt = uiListSize - 1; cnt >= 0; cnt-- )
|
||||
{
|
||||
RemoveVSurfaceRegion( hVSurface, (UINT16)cnt );
|
||||
}
|
||||
|
||||
hVSurface->RegionList.clear();
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -1831,11 +1795,12 @@ BOOLEAN GetVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_REGION
|
||||
{
|
||||
Assert( hVSurface != NULL );
|
||||
|
||||
if ( !PeekList( hVSurface->RegionList, aRegion, usIndex ) )
|
||||
if (usIndex >= hVSurface->RegionList.size())
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
*aRegion = hVSurface->RegionList[usIndex];
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -1858,15 +1823,12 @@ BOOLEAN ReplaceVSurfaceRegion( HVSURFACE hVSurface , UINT16 usIndex, VSURFACE_RE
|
||||
|
||||
Assert( hVSurface != NULL );
|
||||
|
||||
// Validate index given
|
||||
if ( !PeekList( hVSurface->RegionList, &OldRegion, usIndex ) )
|
||||
if (usIndex >= hVSurface->RegionList.size())
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Replace information
|
||||
hVSurface->RegionList = AddtoList( hVSurface->RegionList, aRegion, usIndex );
|
||||
|
||||
hVSurface->RegionList[usIndex] = *aRegion;
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -1875,11 +1837,14 @@ BOOLEAN AddVSurfaceRegionAtIndex( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_
|
||||
Assert( hVSurface != NULL );
|
||||
Assert( pNewRegion != NULL );
|
||||
|
||||
// Add new region to list
|
||||
hVSurface->RegionList = AddtoList( hVSurface->RegionList, pNewRegion, usIndex );
|
||||
|
||||
return( TRUE );
|
||||
if (usIndex >= hVSurface->RegionList.size())
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
auto pos = hVSurface->RegionList.begin() + usIndex;
|
||||
hVSurface->RegionList.insert(pos, *pNewRegion);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
// *******************************************************************
|
||||
@@ -2161,7 +2126,7 @@ HVSURFACE CreateVideoSurfaceFromDDSurface( LPDIRECTDRAWSURFACE2 lpDDSurface )
|
||||
|
||||
|
||||
// Allocate Video Surface struct
|
||||
hVSurface = (HVSURFACE) MemAlloc( sizeof( SGPVSurface ) );
|
||||
hVSurface = new SGPVSurface{};
|
||||
|
||||
// Set values based on DD Surface given
|
||||
DDGetSurfaceDescription ( lpDDSurface, &DDSurfaceDesc );
|
||||
@@ -2173,7 +2138,6 @@ HVSURFACE CreateVideoSurfaceFromDDSurface( LPDIRECTDRAWSURFACE2 lpDDSurface )
|
||||
hVSurface->pSurfaceData = (PTR)lpDDSurface;
|
||||
hVSurface->pSurfaceData1 = NULL;
|
||||
hVSurface->pSavedSurfaceData = NULL;
|
||||
hVSurface->RegionList = CreateList( DEFAULT_NUM_REGIONS, sizeof( VSURFACE_REGION ) );
|
||||
hVSurface->fFlags = 0;
|
||||
|
||||
// Get and Set palette, if attached, allow to fail
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "container.h"
|
||||
#include "himage.h"
|
||||
#include "vobject.h"
|
||||
#include <vector>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -105,7 +106,7 @@ typedef struct
|
||||
UINT16 *p16BPPPalette; // A 16BPP palette used for 8->16 blits
|
||||
COLORVAL TransparentColor; // Defaults to 0,0,0
|
||||
PTR pClipper; // A void pointer encapsolated as a clipper Surface
|
||||
HLIST RegionList; // A List of regions within the video Surface
|
||||
std::vector<VSURFACE_REGION> RegionList; // A List of regions within the video Surface
|
||||
|
||||
} SGPVSurface, *HVSURFACE;
|
||||
|
||||
@@ -240,7 +241,6 @@ BOOLEAN DeleteVideoSurfaceFromIndex( UINT32 uiIndex );
|
||||
BOOLEAN AddVSurfaceRegion( HVSURFACE hVSurface, VSURFACE_REGION *pNewRegion );
|
||||
BOOLEAN AddVSurfaceRegionAtIndex( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_REGION *pNewRegion );
|
||||
BOOLEAN AddVSurfaceRegions( HVSURFACE hVSurface, VSURFACE_REGION **ppNewRegions, UINT16 uiNumRegions );
|
||||
BOOLEAN RemoveVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex );
|
||||
BOOLEAN ClearAllVSurfaceRegions( HVSURFACE hVSurface );
|
||||
BOOLEAN GetVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_REGION *aRegion );
|
||||
BOOLEAN GetNumRegions( HVSURFACE hVSurface , UINT32 *puiNumRegions );
|
||||
@@ -286,4 +286,4 @@ BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user