Removed remnants of editoritems buffer as it is no longer used

This commit is contained in:
Asdow
2022-11-07 19:12:53 +02:00
parent 9919531f56
commit af9e221578
2 changed files with 10 additions and 108 deletions
+10 -103
View File
@@ -137,11 +137,7 @@ void EntryInitEditorItemsInfo()
{
INT32 i;
INVTYPE *item;
eInfo.uiBuffer = 0;
eInfo.fKill = 0;
eInfo.fActive = 0;
eInfo.sWidth = 0;
eInfo.sHeight = 0;
eInfo.sScrollIndex = 0;
eInfo.sSelItemIndex = 0;
eInfo.sHilitedItemIndex = -1;
@@ -223,20 +219,10 @@ void EntryInitEditorItemsInfo()
void InitEditorItemsInfo(UINT32 uiItemType)
{
VSURFACE_DESC vs_desc;
UINT8 *pDestBuf, *pSrcBuf;
UINT32 uiSrcPitchBYTES, uiDestPitchBYTES;
INVTYPE *item;
SGPRect SaveRect, NewRect;
HVOBJECT hVObject;
UINT32 uiVideoObjectIndex;
UINT16 usUselessWidth, usUselessHeight;
INT32 sWidth, sOffset, sStart;
INT32 i, x, y;
SGPRect SaveRect;
INT32 i;
UINT16 usCounter;
CHAR16 pStr[ 100 ];//, pStr2[ 100 ];
CHAR16 pItemName[SIZE_ITEM_NAME];
UINT8 ubBitDepth;
BOOLEAN fTypeMatch;
INT32 iEquipCount = 0;
@@ -327,95 +313,23 @@ void InitEditorItemsInfo(UINT32 uiItemType)
//Allocate memory to store all the item pointers.
if(eInfo.sNumItems)//dnl ch78 271113
eInfo.pusItemIndex = (UINT16*)MemAlloc( sizeof(UINT16) * eInfo.sNumItems );
//Disable the appropriate scroll buttons based on the saved scroll index if applicable
//Left most scroll position
DetermineItemsScrolling();
//calculate the width of the buffer based on the number of items.
//every pair of items (odd rounded up) requires 60 pixels for width.
//the minimum buffer size is 420. Height is always 80 pixels.
eInfo.sWidth = (eInfo.sNumItems > 12) ? (((INT32) eInfo.sNumItems+1)/2)*60 : 360;//dnl ch77 251113 was (SCREEN_HEIGHT - 120) but editor crash if resolution is 1024x768
eInfo.sHeight = 80;
// Create item buffer
GetCurrentVideoSettings( &usUselessWidth, &usUselessHeight, &ubBitDepth );
vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE;
vs_desc.usWidth = eInfo.sWidth;
vs_desc.usHeight = eInfo.sHeight;
vs_desc.ubBitDepth = ubBitDepth;
//!!!Memory check. Create the item buffer
if(!AddVideoSurface( &vs_desc, &eInfo.uiBuffer ))
{
eInfo.fKill = TRUE;
eInfo.fActive = FALSE;
return;
}
pDestBuf = LockVideoSurface(eInfo.uiBuffer, &uiDestPitchBYTES);
pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES);
//copy a blank chunk of the editor interface to the new buffer.
for( i=0; i<eInfo.sWidth; i+=60 )
{
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0+i, 0, iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, 60, 80 );
}
UnLockVideoSurface(eInfo.uiBuffer);
UnLockVideoSurface(FRAME_BUFFER);
x = 0;
y = 0;
usCounter = 0;
NewRect.iTop = 0;
NewRect.iBottom = eInfo.sHeight;
NewRect.iLeft = 0;
NewRect.iRight = eInfo.sWidth;
GetClippingRect(&SaveRect);
SetClippingRect(&NewRect);
// Go through the items, and depending on the current eInfo.uiItemType, store the item indexes for blitting graphics and names later in RenderEditorItemsInfo()
if( eInfo.uiItemType == TBAR_MODE_ITEM_KEYS )
{ //Keys use a totally different method for determining
for( i = 0; i < eInfo.sNumItems; i++ )
{
//item = &Item[ KeyTable[ 0 ].usItem + LockTable[ i ].usKeyItem ];
item = &Item[ KeyTable[ LockTable[ i ].usKeyItem ].usItem ];
uiVideoObjectIndex = GetInterfaceGraphicForItem( item );
GetVideoObject( &hVObject, uiVideoObjectIndex );
//Store these item pointers for later when rendering selected items.
//eInfo.pusItemIndex[i] = KeyTable[ 0 ].usItem + LockTable[ i ].usKeyItem;
eInfo.pusItemIndex[i] = KeyTable[ LockTable[ i ].usKeyItem ].usItem;
SetFont(SMALLCOMPFONT);
SetFontForeground( FONT_MCOLOR_WHITE );
SetFontDestBuffer( eInfo.uiBuffer, 0, 0, eInfo.sWidth, eInfo.sHeight, FALSE );
swprintf( pStr, L"%S", LockTable[ i ].ubEditorName );
DisplayWrappedString(x, (UINT16)(y+25), 60, 2, SMALLCOMPFONT, FONT_WHITE, pStr, FONT_BLACK, TRUE, CENTER_JUSTIFIED );
UINT16 usGraphicNum = g_bUsePngItemImages ? 0 : item->ubGraphicNum;
//Calculate the center position of the graphic in a 60 pixel wide area.
sWidth = hVObject->pETRLEObject[usGraphicNum].usWidth;
sOffset = hVObject->pETRLEObject[usGraphicNum].sOffsetX;
sStart = x + (60 - sWidth - sOffset*2) / 2;
BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, usGraphicNum, sStart, y+2, 0, FALSE );
//cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)...
if( y == 0 )
{
y = 40;
}
else
{
y = 0;
x += 60;
}
eInfo.pusItemIndex[i] = KeyTable[LockTable[i].usKeyItem].usItem;
}
}
else for( i = 0; i < eInfo.sNumItems; i++ )
{
// Go through the items, and divide them into different classes. Store the item index for blitting later in RenderEditorItemsInfo()
fTypeMatch = FALSE;
while( usCounter<MAXITEMS && !fTypeMatch )
{
@@ -499,7 +413,6 @@ void InitEditorItemsInfo(UINT32 uiItemType)
usCounter++;
}
}
SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
SetClippingRect(&SaveRect);
gfRenderTaskbar = TRUE;
}
@@ -521,8 +434,6 @@ void DetermineItemsScrolling()
void RenderEditorItemsInfo()
{
UINT8 *pDestBuf, *pSrcBuf;
UINT32 uiSrcPitchBYTES, uiDestPitchBYTES;
INVTYPE *item;
HVOBJECT hVObject;
UINT32 uiVideoObjectIndex;
@@ -619,7 +530,11 @@ void RenderEditorItemsInfo()
CHAR16 pStr[100];
CHAR16 pItemName[SIZE_ITEM_NAME];
if (eInfo.uiItemType != TBAR_MODE_ITEM_TRIGGERS)
if (eInfo.uiItemType == TBAR_MODE_ITEM_KEYS)
{
swprintf(pStr, L"%S", LockTable[i].ubEditorName);
}
else if (eInfo.uiItemType != TBAR_MODE_ITEM_TRIGGERS)
{
LoadItemInfo(eInfo.pusItemIndex[i], pItemName, NULL);
swprintf(pStr, L"%s", pItemName);
@@ -692,21 +607,13 @@ void RenderEditorItemsInfo()
void ClearEditorItemsInfo()
{
if( eInfo.uiBuffer )
{
DeleteVideoSurfaceFromIndex( eInfo.uiBuffer );
eInfo.uiBuffer = 0;
}
if( eInfo.pusItemIndex )
{
MemFree( eInfo.pusItemIndex );
eInfo.pusItemIndex = NULL;
}
DisableEditorRegion( ITEM_REGION_ID );
eInfo.fKill = 0;
eInfo.fActive = 0;
eInfo.sWidth = 0;
eInfo.sHeight = 0;
eInfo.sNumItems = 0;
//save the highlighted selections
switch( eInfo.uiItemType )
-5
View File
@@ -6,14 +6,9 @@
typedef struct{
BOOLEAN fGameInit; //Used for initializing save variables the first time.
//This flag is initialize at
BOOLEAN fKill; //flagged for deallocation.
BOOLEAN fActive; //currently active
UINT16 *pusItemIndex; //a dynamic array of Item indices
UINT32 uiBuffer; //index of buffer
UINT32 uiItemType; //Weapons, ammo, armour, explosives, equipment
//Kaiden/Buggler: was previously INT16 - Fix for number of items capped by class in editor
INT32 sWidth, sHeight; //width and height of buffer
INT16 sNumItems; //total number of items in the current class of item.
INT16 sSelItemIndex; //currently selected item index.
INT16 sHilitedItemIndex;