Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+87 -87
View File
@@ -72,15 +72,15 @@
CHAR8 str[128];
//Kris: December 2, 1997
//Kris: December 2, 1997
//Special internal debugging utilities that will ensure that you don't attempt to delete
//an already deleted button, or it's images, etc. It will also ensure that you don't create
//an already deleted button, or it's images, etc. It will also ensure that you don't create
//the same button that already exists.
//TO REMOVE ALL DEBUG FUNCTIONALITY: simply comment out BUTTONSYSTEM_DEBUGGING definition
//TO REMOVE ALL DEBUG FUNCTIONALITY: simply comment out BUTTONSYSTEM_DEBUGGING definition
#ifdef JA2
#ifdef _DEBUG
#define BUTTONSYSTEM_DEBUGGING
#endif
#ifdef _DEBUG
#define BUTTONSYSTEM_DEBUGGING
#endif
#endif
#ifdef BUTTONSYSTEM_DEBUGGING
@@ -94,7 +94,7 @@ void AssertFailIfIdenticalButtonAttributesFound( GUI_BUTTON *b )
{
c = ButtonList[ x ];
if( !c ) continue;
if( c->uiFlags & BUTTON_DELETION_PENDING ) continue;
if( c->uiFlags & BUTTON_DELETION_PENDING ) continue;
if( c->UserData[3] == 0xffffffff ) continue;
if( b->Area.PriorityLevel != c->Area.PriorityLevel ) continue;
if( b->Area.RegionTopLeftX != c->Area.RegionTopLeftX ) continue;
@@ -106,7 +106,7 @@ void AssertFailIfIdenticalButtonAttributesFound( GUI_BUTTON *b )
if( b->XLoc != c->XLoc ) continue;
if( b->YLoc != c->YLoc ) continue;
//if we get this far, it is reasonably safe to assume that the newly created
//button already exists. Placing a break point on the following assert will
//button already exists. Placing a break point on the following assert will
//allow the coder to easily isolate the case!
sprintf( str, "Attempting to create a button that has already been created (existing buttonID %d).", c->IDNum );
AssertMsg( 0, str );
@@ -118,7 +118,7 @@ void AssertFailIfIdenticalButtonAttributesFound( GUI_BUTTON *b )
//These are the variables used for the anchoring of a particular button.
//When you click on a button, it get's anchored, until you release the mouse button.
//When you move around, you don't want to select other buttons, even when you release
//it. This follows the Windows 95 convention.
//it. This follows the Windows 95 convention.
GUI_BUTTON *gpAnchoredButton;
GUI_BUTTON *gpPrevAnchoredButton;
BOOLEAN gfAnchoredState;
@@ -216,7 +216,7 @@ INT32 LoadButtonImage(const STR8 filename, INT32 Grayed, INT32 OffNormal, INT32
// is there ANY file to open?
if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) &&
(OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE))
(OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE))
{
DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("No button pictures selected for %s",filename));
return(-1);
@@ -351,7 +351,7 @@ INT32 UseLoadedButtonImage(INT32 LoadedImg, INT32 Grayed, INT32 OffNormal, INT32
// is there ANY file to open?
if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) &&
(OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE))
(OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE))
{
DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("No button pictures selected for pre-loaded button image %d",LoadedImg));
return(-1);
@@ -473,7 +473,7 @@ INT32 UseVObjAsButtonImage(HVOBJECT hVObject, INT32 Grayed, INT32 OffNormal, INT
// is there ANY file to open?
if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) &&
(OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE))
(OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE))
{
DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("UseVObjAsButtonImage: No button pictures indexes selected for VObject"));
return(-1);
@@ -908,7 +908,7 @@ INT16 LoadGenericButtonIcon(const STR8 filename)
//
BOOLEAN UnloadGenericButtonIcon(INT16 GenImg)
{
if( GenImg < 0 || GenImg >= MAX_BUTTON_ICONS )
if( GenImg < 0 || GenImg >= MAX_BUTTON_ICONS )
{
sprintf( str, "Attempting to UnloadGenericButtonIcon with out of range index %d.", GenImg );
AssertMsg( 0, str );
@@ -939,7 +939,7 @@ BOOLEAN UnloadGenericButtonIcon(INT16 GenImg)
BOOLEAN UnloadGenericButtonImage(INT16 GenImg)
{
BOOLEAN fDeletedSomething = FALSE;
if( GenImg < 0 || GenImg >= MAX_GENERIC_PICS )
if( GenImg < 0 || GenImg >= MAX_GENERIC_PICS )
{
sprintf( str, "Attempting to UnloadGenericButtonImage with out of range index %d.", GenImg );
AssertMsg( 0, str );
@@ -1317,7 +1317,7 @@ void RemoveButton(INT32 iButtonID)
//Kris:
if( b->uiFlags & BUTTON_SELFDELETE_IMAGE )
{ //checkboxes and simple create buttons have their own graphics associated with them,
//and it is handled internally. We delete it here. This provides the advantage of less
//and it is handled internally. We delete it here. This provides the advantage of less
//micromanagement, but with the disadvantage of wasting more memory if you have lots of
//buttons using the same graphics.
UnloadButtonImage( b->ImageNum );
@@ -1518,8 +1518,8 @@ INT32 SetButtonIcon( INT32 iButtonID, INT16 Icon, INT16 IconIndex )
// If button isn't an icon button, ignore this call
if(((b->uiFlags & BUTTON_TYPES) == BUTTON_QUICK) ||
((b->uiFlags & BUTTON_TYPES) == BUTTON_HOT_SPOT) ||
((b->uiFlags & BUTTON_TYPES) == BUTTON_GENERIC))
((b->uiFlags & BUTTON_TYPES) == BUTTON_HOT_SPOT) ||
((b->uiFlags & BUTTON_TYPES) == BUTTON_GENERIC))
{
return -1;
}
@@ -1714,7 +1714,7 @@ INT32 CreateTextButton(STR16 string, UINT32 uiFont, INT16 sForeColor, INT16 sSha
if ( string && wcslen( string ) )
{
b->string = (STR16) MemAlloc( (wcslen(string)+1)*sizeof(CHAR16) );
AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateTextButton." );
AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateTextButton." );
wcscpy( b->string, string );
}
@@ -1905,11 +1905,11 @@ INT32 CreateHotSpot(INT16 xloc, INT16 yloc, INT16 Width, INT16 Height,INT16 Prio
// will simply set the cursor for the mouse region the button occupies
BOOLEAN SetButtonCursor(INT32 iBtnId, UINT16 crsr)
{
GUI_BUTTON *b;
b = ButtonList[iBtnId];
GUI_BUTTON *b;
b = ButtonList[iBtnId];
if (!b)
return FALSE;
b->Area.Cursor = crsr;
b->Area.Cursor = crsr;
return TRUE;
}
@@ -2033,7 +2033,7 @@ INT32 QuickCreateButton(UINT32 Image,INT16 xloc,INT16 yloc,INT32 Type,INT16 Prio
memset( &b->Area, 0, sizeof( MOUSE_REGION ) );
// Define a MOUSE_REGION for this QuickButton
MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc,
(UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth),
(UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth),
(UINT16)(yloc+(INT16)ButtonPictures[Image].MaxHeight),
(INT8)Priority, MSYS_STARTING_CURSORVAL,
(MOUSE_CALLBACK)QuickButtonCallbackMMove,
@@ -2060,16 +2060,16 @@ INT32 QuickCreateButton(UINT32 Image,INT16 xloc,INT16 yloc,INT32 Type,INT16 Prio
return(ButtonNum);
}
//A hybrid of QuickCreateButton. Takes a lot less parameters, but makes more assumptions. It self manages the
//loading, and deleting of the image. The size of the image determines the size of the button. It also uses
//the default move callback which emulates Win95. Finally, it sets the priority to normal. The function you
//A hybrid of QuickCreateButton. Takes a lot less parameters, but makes more assumptions. It self manages the
//loading, and deleting of the image. The size of the image determines the size of the button. It also uses
//the default move callback which emulates Win95. Finally, it sets the priority to normal. The function you
//choose also determines the type of button (toggle, notoggle, or newtoggle)
INT32 CreateEasyNoToggleButton ( INT32 x, INT32 y, const STR8 filename, GUI_CALLBACK ClickCallback )
{
return CreateSimpleButton( x, y, filename, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback );
}
INT32 CreateEasyToggleButton ( INT32 x, INT32 y, const STR8 filename, GUI_CALLBACK ClickCallback )
INT32 CreateEasyToggleButton ( INT32 x, INT32 y, const STR8 filename, GUI_CALLBACK ClickCallback )
{
return CreateSimpleButton( x, y, filename, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback );
}
@@ -2111,11 +2111,11 @@ INT32 CreateSimpleButton( INT32 x, INT32 y, const STR8 filename, INT32 Type, INT
}
INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont,
INT16 sForeColor, INT16 sShadowColor,
INT16 sForeColorDown, INT16 sShadowColorDown,
INT8 bJustification,
INT16 xloc, INT16 yloc, INT32 Type, INT16 Priority,
GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback)
INT16 sForeColor, INT16 sShadowColor,
INT16 sForeColorDown, INT16 sShadowColorDown,
INT8 bJustification,
INT16 xloc, INT16 yloc, INT32 Type, INT16 Priority,
GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback)
{
GUI_BUTTON *b;
INT32 iButtonID;
@@ -2173,10 +2173,10 @@ INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont,
// Allocate memory for the button's text string...
b->string = NULL;
if ( string )
if ( string )
{
b->string = (STR16) MemAlloc( (wcslen(string)+1)*sizeof(CHAR16) );
AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateIconAndTextButton." );
AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateIconAndTextButton." );
wcscpy( b->string, string );
}
@@ -2219,7 +2219,7 @@ INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont,
// Define a MOUSE_REGION for this QuickButton
MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc,
(UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth),
(UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth),
(UINT16)(yloc+(INT16)ButtonPictures[Image].MaxHeight),
(INT8)Priority, MSYS_STARTING_CURSORVAL,
(MOUSE_CALLBACK)QuickButtonCallbackMMove,
@@ -2338,7 +2338,7 @@ void SpecifyButtonTextJustification( INT32 iButtonID, INT8 bJustification )
Assert( iButtonID < MAX_BUTTONS );
b = ButtonList[ iButtonID ];
Assert( b );
//Range check: if invalid, then set it to center justified.
//Range check: if invalid, then set it to center justified.
if( bJustification < BUTTON_TEXT_LEFT || bJustification > BUTTON_TEXT_RIGHT )
bJustification = BUTTON_TEXT_CENTER;
b->bJustification = bJustification;
@@ -2361,7 +2361,7 @@ void SpecifyFullButtonTextAttributes( INT32 iButtonID, STR16 string, INT32 uiFon
b->sShadowColor = sShadowColor;
b->sForeColorDown = sForeColorDown;
b->sShadowColorDown = sShadowColorDown;
//Range check: if invalid, then set it to center justified.
//Range check: if invalid, then set it to center justified.
if( bJustification < BUTTON_TEXT_LEFT || bJustification > BUTTON_TEXT_RIGHT )
bJustification = BUTTON_TEXT_CENTER;
b->bJustification = bJustification;
@@ -2436,11 +2436,11 @@ void SpecifyDisabledButtonStyle( INT32 iButtonID, INT8 bStyle )
}
//Note: Text is always on top
//Note: Text is always on top
//If fShiftImage is true, then the image will shift down one pixel and right one pixel
//just like the text does.
BOOLEAN SpecifyButtonIcon( INT32 iButtonID, INT32 iVideoObjectID, UINT16 usVideoObjectIndex,
INT8 bXOffset, INT8 bYOffset, BOOLEAN fShiftImage )
INT8 bXOffset, INT8 bYOffset, BOOLEAN fShiftImage )
{
GUI_BUTTON *b;
@@ -2573,11 +2573,11 @@ void QuickButtonCallbackMMove(MOUSE_REGION *reg,INT32 reason)
AssertMsg( b != NULL, str );
if( !b )
return; //This is getting called when Adding new regions...
return; //This is getting called when Adding new regions...
if( b->uiFlags & BUTTON_ENABLED &&
reason & (MSYS_CALLBACK_REASON_LOST_MOUSE | MSYS_CALLBACK_REASON_GAIN_MOUSE) )
reason & (MSYS_CALLBACK_REASON_LOST_MOUSE | MSYS_CALLBACK_REASON_GAIN_MOUSE) )
{
b->uiFlags |= BUTTON_DIRTY;
}
@@ -2717,14 +2717,14 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason )
//Kris:
//Set the anchored button incase the user moves mouse off region while still holding
//down the button, but only if the button is up. In Win95, buttons that are already
//down the button, but only if the button is up. In Win95, buttons that are already
//down, and anchored never change state, unless you release the mouse in the button area.
if( b->MoveCallback == DEFAULT_MOVE_CALLBACK && b->uiFlags & BUTTON_ENABLED )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
gpAnchoredButton = b;
gpAnchoredButton = b;
gfAnchoredState = StateBefore;
b->uiFlags |= BUTTON_CLICKED_ON;
}
@@ -2742,7 +2742,7 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason )
gpAnchoredButton = b;
gfAnchoredState = StateBefore;
//Trick the before state of the button to be different so the sound will play properly as checkbox buttons
//Trick the before state of the button to be different so the sound will play properly as checkbox buttons
//are processed differently.
StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? FALSE : TRUE;
StateAfter = !StateBefore;
@@ -2750,7 +2750,7 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason )
else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
b->uiFlags ^= BUTTON_CLICKED_ON; //toggle the checkbox state upon release inside button area.
//Trick the before state of the button to be different so the sound will play properly as checkbox buttons
//Trick the before state of the button to be different so the sound will play properly as checkbox buttons
//are processed differently.
StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? FALSE : TRUE;
StateAfter = !StateBefore;
@@ -2781,7 +2781,7 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason )
// If there is a callback function with this button, call it
if(b->uiFlags & BUTTON_CLICK_CALLBACK)
{
//Kris: January 6, 1998
//Kris: January 6, 1998
//Added these checks to avoid a case where it was possible to process a leftbuttonup message when
//the button wasn't anchored, and should have been.
gfDelayButtonDeletion = TRUE;
@@ -2847,7 +2847,7 @@ void RenderButtons(void)
for(iButtonID=0;iButtonID<MAX_BUTTONS;iButtonID++)
{
// If the button exists, and it's not owned by another object, draw it
//Kris: and make sure that the button isn't hidden.
//Kris: and make sure that the button isn't hidden.
b = ButtonList[iButtonID];
if( b && b->Area.uiFlags & MSYS_REGION_ENABLED )
{
@@ -2916,10 +2916,10 @@ void RenderButtons(void)
//
void MarkAButtonDirty( INT32 iButtonNum )
{
// surgical dirtying -> marks a user specified button dirty, without dirty the whole lot of them
// surgical dirtying->marks a user specified button dirty, without dirty the whole lot of them
// If the button exists, and it's not owned by another object, draw it
// If the button exists, and it's not owned by another object, draw it
if( ButtonList[ iButtonNum ] )
{
// Turn on dirty flag
@@ -2948,10 +2948,10 @@ void MarkButtonsDirty( void )
void UnMarkButtonDirty( INT32 iButtonIndex )
{
if ( ButtonList[ iButtonIndex ] )
{
ButtonList[ iButtonIndex ]->uiFlags &= ~( BUTTON_DIRTY );
}
if ( ButtonList[ iButtonIndex ] )
{
ButtonList[ iButtonIndex ]->uiFlags &= ~( BUTTON_DIRTY );
}
}
void UnmarkButtonsDirty( void )
@@ -3003,10 +3003,10 @@ BOOLEAN DrawButton(INT32 iButtonID )
if( ButtonList[ iButtonID ]->string )
SaveFontSettings();
// Draw this button
if( ButtonList[ iButtonID ]->Area.uiFlags & MSYS_REGION_ENABLED )
{
DrawButtonFromPtr( ButtonList[ iButtonID ] );
}
if( ButtonList[ iButtonID ]->Area.uiFlags & MSYS_REGION_ENABLED )
{
DrawButtonFromPtr( ButtonList[ iButtonID ] );
}
if( ButtonList[ iButtonID ]->string )
RestoreFontSettings();
@@ -3037,7 +3037,7 @@ void DrawButtonFromPtr(GUI_BUTTON *b)
case BUTTON_HOT_SPOT:
if(b->uiFlags & BUTTON_NO_TOGGLE)
b->uiFlags &= (~BUTTON_CLICKED_ON);
return; //hotspots don't have text, but if you want to, change this to a break!
return; //hotspots don't have text, but if you want to, change this to a break!
case BUTTON_CHECKBOX:
DrawCheckBoxButton(b);
break;
@@ -3118,13 +3118,13 @@ void DrawQuickButton(GUI_BUTTON *b)
// Display the button image
BltVideoObject(ButtonDestBuffer, ButtonPictures[b->ImageNum].vobj,
(UINT16)UseImage, b->XLoc, b->YLoc,
VO_BLT_SRCTRANSPARENCY, NULL);
(UINT16)UseImage, b->XLoc, b->YLoc,
VO_BLT_SRCTRANSPARENCY, NULL);
}
void DrawHatchOnButton( GUI_BUTTON *b )
{
UINT8 *pDestBuf;
UINT8 *pDestBuf;
UINT32 uiDestPitchBYTES;
SGPRect ClipRect;
ClipRect.iLeft = b->Area.RegionTopLeftX;
@@ -3157,7 +3157,7 @@ void DrawDefaultOnButton( GUI_BUTTON *b )
pDestBuf = LockVideoSurface( ButtonDestBuffer, &uiDestPitchBYTES );
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
if( b->bDefaultStatus == DEFAULT_STATUS_DARKBORDER || b->bDefaultStatus == DEFAULT_STATUS_WINDOWS95 )
{
{
//left (one thick)
LineDraw( TRUE, b->Area.RegionTopLeftX-1, b->Area.RegionTopLeftY-1, b->Area.RegionTopLeftX-1, b->Area.RegionBottomRightY+1, 0, pDestBuf );
//top (one thick)
@@ -3239,7 +3239,7 @@ void DrawCheckBoxButton( GUI_BUTTON *b )
{
// Is the mouse over the button, and do we have hilite image?
if( b->Area.uiFlags & MSYS_MOUSE_IN_AREA && gfRenderHilights &&
gfLeftButtonState &&
gfLeftButtonState &&
ButtonPictures[b->ImageNum].OffHilite != -1 )
UseImage = ButtonPictures[b->ImageNum].OffHilite; // Use Off-Hilite image
else if(ButtonPictures[b->ImageNum].OffNormal != -1)
@@ -3270,8 +3270,8 @@ void DrawCheckBoxButton( GUI_BUTTON *b )
// Display the button image
BltVideoObject(ButtonDestBuffer, ButtonPictures[b->ImageNum].vobj,
(UINT16)UseImage, b->XLoc, b->YLoc,
VO_BLT_SRCTRANSPARENCY, NULL);
(UINT16)UseImage, b->XLoc, b->YLoc,
VO_BLT_SRCTRANSPARENCY, NULL);
}
void DrawIconOnButton(GUI_BUTTON *b)
@@ -3370,10 +3370,10 @@ void DrawIconOnButton(GUI_BUTTON *b)
// Blit the icon
if( b->uiFlags & BUTTON_GENERIC )
BltVideoObject( ButtonDestBuffer,GenericButtonIcons[b->iIconID], b->usIconIndex, (INT16)xp, (INT16)yp,
VO_BLT_SRCTRANSPARENCY, NULL);
VO_BLT_SRCTRANSPARENCY, NULL);
else
BltVideoObject( ButtonDestBuffer, hvObject, b->usIconIndex, (INT16)xp, (INT16)yp,
VO_BLT_SRCTRANSPARENCY, NULL );
VO_BLT_SRCTRANSPARENCY, NULL );
// Restore previous clip region
SetClippingRect(&OldClip);
}
@@ -3518,23 +3518,23 @@ void DrawTextOnButton(GUI_BUTTON *b)
{
//Kris:
//There needs to be recalculation of the start positions based on the
//justification and the width specified wrapped width. I was drawing a
//justification and the width specified wrapped width. I was drawing a
//double lined word on the right side of the button to find it drawing way
//over to the left. I've added the necessary code for the right and center
//over to the left. I've added the necessary code for the right and center
//justification.
yp = b->Area.RegionTopLeftY + 2;
switch( b->bJustification )
{
case BUTTON_TEXT_RIGHT:
xp = b->Area.RegionBottomRightX - 3 - b->sWrappedWidth;
if( b->fShiftText && b->uiFlags & BUTTON_CLICKED_ON )
xp++, yp++;
break;
case BUTTON_TEXT_CENTER:
xp = b->Area.RegionTopLeftX + 3 + b->sWrappedWidth/2;
if( b->fShiftText && b->uiFlags & BUTTON_CLICKED_ON )
xp++, yp++;
break;
@@ -3643,10 +3643,10 @@ void DrawGenericButton(GUI_BUTTON *b)
// Fill the button's area with the button's background color
ColorFillVideoSurfaceArea(ButtonDestBuffer,b->Area.RegionTopLeftX,
b->Area.RegionTopLeftY,
b->Area.RegionBottomRightX,
b->Area.RegionBottomRightY,
GenericButtonFillColors[b->ImageNum]);
b->Area.RegionTopLeftY,
b->Area.RegionBottomRightX,
b->Area.RegionBottomRightY,
GenericButtonFillColors[b->ImageNum]);
// If there is a background image, fill the button's area with it
if(GenericButtonBackground[b->ImageNum]!=NULL)
@@ -3659,13 +3659,13 @@ void DrawGenericButton(GUI_BUTTON *b)
// Fill the area with the image, tilling it if need be.
ImageFillVideoSurfaceArea(ButtonDestBuffer,b->Area.RegionTopLeftX+ox,
b->Area.RegionTopLeftY+oy,
b->Area.RegionBottomRightX,
b->Area.RegionBottomRightY,
GenericButtonBackground[b->ImageNum],
GenericButtonBackgroundIndex[b->ImageNum],
GenericButtonOffsetX[b->ImageNum],
GenericButtonOffsetY[b->ImageNum]);
b->Area.RegionTopLeftY+oy,
b->Area.RegionBottomRightX,
b->Area.RegionBottomRightY,
GenericButtonBackground[b->ImageNum],
GenericButtonBackgroundIndex[b->ImageNum],
GenericButtonOffsetX[b->ImageNum],
GenericButtonOffsetY[b->ImageNum]);
}
// Lock the dest buffer
@@ -4114,7 +4114,7 @@ INT32 CreateCheckBoxButton( INT16 x, INT16 y, const STR8 filename, INT16 Priorit
// Added Oct17, 97 Carter - kind of mindless, but might as well have it
void MSYS_SetBtnUserData(INT32 iButtonNum,INT32 index,INT32 userdata)
{
GUI_BUTTON *b;
GUI_BUTTON *b;
b=ButtonList[iButtonNum];
if((index < 0) || (index > 3))
return;
@@ -4168,11 +4168,11 @@ void BtnGenericMouseMoveButtonCallback(GUI_BUTTON *btn,INT32 reason)
void ReleaseAnchorMode()
{
if( !gpAnchoredButton )
if( !gpAnchoredButton )
return;
if( gusMouseXPos < gpAnchoredButton->Area.RegionTopLeftX ||
gusMouseXPos > gpAnchoredButton->Area.RegionBottomRightX ||
gusMouseXPos > gpAnchoredButton->Area.RegionBottomRightX ||
gusMouseYPos < gpAnchoredButton->Area.RegionTopLeftY ||
gusMouseYPos > gpAnchoredButton->Area.RegionBottomRightY )
{
@@ -4299,7 +4299,7 @@ void GiveButtonDefaultStatus( INT32 iButtonID, INT32 iDefaultStatus )
if( b->bDefaultStatus != (INT8)iDefaultStatus )
{
b->bDefaultStatus = (INT8)iDefaultStatus;
b->uiFlags |= BUTTON_DIRTY;
b->uiFlags |= BUTTON_DIRTY;
}
}
@@ -4314,7 +4314,7 @@ void RemoveButtonDefaultStatus( INT32 iButtonID )
if( b->bDefaultStatus )
{
b->bDefaultStatus = DEFAULT_STATUS_NONE;
b->uiFlags |= BUTTON_DIRTY;
b->uiFlags |= BUTTON_DIRTY;
}
}
+11 -11
View File
@@ -13,7 +13,7 @@
voidpf ZAlloc( voidpf opaque, uInt items, uInt size )
{
return( MemAlloc( items * size ) );
return( MemAlloc( items * size ) );
}
void ZFree( voidpf opaque, voidpf address )
@@ -25,9 +25,9 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize )
{
z_stream * pZStream;
int iZRetCode;
// allocate memory for the z_stream struct
pZStream = MemAlloc( sizeof( z_stream ) );
pZStream = (z_stream *)MemAlloc( sizeof( z_stream ) );
if( pZStream == NULL )
{ // out of memory!
return( NULL );
@@ -37,7 +37,7 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize )
pZStream->zalloc = ZAlloc;
pZStream->zfree = ZFree;
pZStream->opaque = NULL;
// call the ZLIB init routine
iZRetCode = inflateInit( pZStream );
if( iZRetCode != Z_OK )
@@ -45,7 +45,7 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize )
MemFree( pZStream );
return( NULL );
}
// set up our parameters
pZStream->next_in = pCompressedData;
pZStream->avail_in = uiDataSize;
@@ -73,7 +73,7 @@ UINT32 Decompress( PTR pDecompPtr, BYTE * pBuffer, UINT32 uiBufferLen )
// decompress!
iZRetCode = inflate( pZStream, Z_PARTIAL_FLUSH );
Assert( iZRetCode == Z_OK || iZRetCode == Z_STREAM_END );
return( uiBufferLen - pZStream->avail_out );
}
@@ -100,9 +100,9 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize )
{
z_stream * pZStream;
int iZRetCode;
// allocate memory for the z_stream struct
pZStream = MemAlloc( sizeof( z_stream ) );
pZStream = (z_stream *)MemAlloc( sizeof( z_stream ) );
if( pZStream == NULL )
{ // out of memory!
return( NULL );
@@ -112,7 +112,7 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize )
pZStream->zalloc = ZAlloc;
pZStream->zfree = ZFree;
pZStream->opaque = NULL;
// call the ZLIB init routine
iZRetCode = deflateInit( pZStream, Z_BEST_COMPRESSION );
if( iZRetCode != Z_OK )
@@ -120,7 +120,7 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize )
MemFree( pZStream );
return( NULL );
}
// set up our parameters
pZStream->next_in = pUncompressedData;
pZStream->avail_in = uiDataSize;
@@ -148,7 +148,7 @@ UINT32 Compress( PTR pCompPtr, BYTE * pBuffer, UINT32 uiBufferLen )
// decompress!
iZRetCode = deflate( pZStream, Z_FINISH );
Assert( iZRetCode == Z_STREAM_END );
return( uiBufferLen - pZStream->avail_out );
}
+9 -9
View File
@@ -9,16 +9,16 @@
// To decompress:
//
// 1) call DecompressInit() with a pointer to your compressed data, and the
// size of that compressed data. DecompressInit() returns a "decompression
// size of that compressed data. DecompressInit() returns a "decompression
// pointer" that you should pass to Decompress() and DecompressFini()
//
// 2) call Decompress() with the decompression pointer, a pointer to a
// buffer for decompressed data, and the length of that buffer. If the
// buffer for decompressed data, and the length of that buffer. If the
// buffer is not large enough to hold all of the decompressed data,
// Decompress() will fill it completely, and you can call Decompress() again
// to continue your decompression. You are responsible for knowing the
// size your data will be after decompression. (The STI/STCI file format
// records your original data size for you...) Decompress() returns the
// to continue your decompression. You are responsible for knowing the
// size your data will be after decompression. (The STI/STCI file format
// records your original data size for you...) Decompress() returns the
// number of bytes of output.
//
// 3) call DecompressFini() with the decompression pointer when you're done
@@ -30,16 +30,16 @@ void DecompressFini( PTR pDecompPtr );
// To compress:
//
// 1) call CompressInit() with a pointer to your uncompressed data, and the
// size of that uncompressed data. CompressInit() returns a "compression
// size of that uncompressed data. CompressInit() returns a "compression
// pointer" that you should pass to Compress() and CompressFini()
//
// 2) call Compress() with the compression pointer, a pointer to a
// buffer for compressed data, and the length of that buffer. If the
// buffer for compressed data, and the length of that buffer. If the
// buffer is not large enough to hold all of the compressed data,
// Compress() will fill it completely, and you can call Compress() again
// with a new or emptied buffer to continue your compression later. You
// with a new or emptied buffer to continue your compression later. You
// can call CompressedBufferSize() to determine the largest buffer size you
// should need for a certain number of bytes. Ccompress() returns the number
// should need for a certain number of bytes. Ccompress() returns the number
// of bytes of output.
//
// 3) call CompressFini() with the compression pointer when you're done
File diff suppressed because it is too large Load Diff
+22 -22
View File
@@ -13,7 +13,7 @@
//***********************************************
//
// Includes
// Includes
//
//
//***********************************************
@@ -22,13 +22,13 @@
//***********************************************
//
// Defines and typedefs
// Defines and typedefs
//
//***********************************************
#define ORDLIST_ERROR -1
#define ORDLIST_EQUAL 0
#define ORDLIST_LEFT_LESS 1
#define ORDLIST_RIGHT_LESS 2
#define ORDLIST_ERROR -1
#define ORDLIST_EQUAL 0
#define ORDLIST_LEFT_LESS 1
#define ORDLIST_RIGHT_LESS 2
typedef void * HCONTAINER;
typedef HCONTAINER HSTACK;
@@ -53,9 +53,9 @@ extern void ShutdownContainers(void);
// Stack Functions
// CreateStack(estimated number of items in stack, size of each item
// Push(handle to container returned from CreateStack, data to be passed in (must be void *)
// : returns handle to new stack
// : returns handle to new stack
// Pop(handle to container returned from CreateStack, data to be passed in (must be void *)
// : returns BOOLEAN
// : returns BOOLEAN
// DeleteStack deletes the stack container
// StackSize returns size of stack
@@ -78,51 +78,51 @@ extern BOOLEAN PeekStack(HSTACK hStack, void *data);
// DeleteQueue(handle to container) Delete the queue container
// : returns BOOLEAN
extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each);
extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each);
extern HQUEUE AddtoQueue(HQUEUE hQueue, void *data);
extern BOOLEAN RemfromQueue(HQUEUE hQueue,void *data);
extern BOOLEAN PeekQueue(HQUEUE hQueue, void *data);
extern UINT32 QueueSize(HQUEUE hQueue);
extern UINT32 QueueSize(HQUEUE hQueue);
extern BOOLEAN DeleteQueue(HQUEUE hQueue);
// List Functions
// CreateList(estimated number of items in queue, size of each item
// AddtoList(handle to container returned from CreateQueue, data to be passed in (must be void *)
// position where data is to be added (0...sizeof(list))
// position where data is to be added (0...sizeof(list))
// : returns handle to new list
// RemfromList(handle to container returned from CreateList, variable where data is stored (must be void *)
// position where data is to be deleted (0...sizeof(list)-1)
// position where data is to be deleted (0...sizeof(list)-1)
// PeekList(handle to the list, variable where peeked data is stored). Item is not deleted.
// position where data is to be peeked (0...sizeof(list)-1)
// position where data is to be peeked (0...sizeof(list)-1)
// ListSize(handle to the list) returns the list size
// DeleteList(handle to the list) Delete the list container
extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each);
extern HLIST AddtoList(HLIST hList, void *data, UINT32 position);
extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each);
extern HLIST AddtoList(HLIST hList, void *data, UINT32 position);
extern BOOLEAN RemfromList(HLIST hList,void *data, UINT32 position);
extern BOOLEAN PeekList(HLIST hList, void *data, UINT32 position);
extern UINT32 ListSize(HLIST hList);
extern UINT32 ListSize(HLIST hList);
extern BOOLEAN DeleteList(HLIST hList);
extern BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos);
extern BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos);
// Ordered List Functions
// CreateOrdList(estimated number of items in ordered list, size of each item,
// pointer to a compare function that returns info on whether the data in the ordered stack
// is < or > the new data to be added into the ordered list.
// pointer to a compare function that returns info on whether the data in the ordered stack
// is < or > the new data to be added into the ordered list.
// AddtoOrdList(handle to container returned from CreateOrdList, data to be passed in (must be void *)
// RemfromOrdList(handle to container returned from CreateList, variable where data is stored (must be void *)
// position where data is to be deleted (0...sizeof(list)-1)
// position where data is to be deleted (0...sizeof(list)-1)
// PeekOrdList(handle to the list, variable where peeked data is stored). Item is not deleted.
// position where data is to be peeked (0...sizeof(list)-1)
// position where data is to be peeked (0...sizeof(list)-1)
// OrdListSize(handle to the list) returns the ordered list size
// DeleteOrdList(handle to the list) Delete the ordered list container
extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32));
extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32));
extern HLIST AddtoOrdList(HLIST hList, void *data);
extern BOOLEAN RemfromOrdList(HLIST hList,void *data, UINT32 position);
extern BOOLEAN PeekOrdList(HLIST hList, void *data, UINT32 position);
extern UINT32 OrdListSize(HLIST hList);
extern UINT32 OrdListSize(HLIST hList);
extern BOOLEAN DeleteOrdList(HLIST hList);
#ifdef __cplusplus
+47 -47
View File
@@ -23,19 +23,19 @@
BOOLEAN gfCursorDatabaseInit = FALSE;
CursorFileData *gpCursorFileDatabase;
CursorData *gpCursorDatabase;
INT16 gsGlobalCursorYOffset = 0;
INT16 gsCurMouseOffsetX = 0;
INT16 gsCurMouseOffsetY = 0;
UINT16 gsCurMouseHeight = 0;
UINT16 gsCurMouseWidth = 0;
UINT16 gusNumDataFiles = 0;
UINT32 guiExternVo;
UINT16 gusExternVoSubIndex;
UINT32 guiExtern2Vo;
UINT16 gusExtern2VoSubIndex;
UINT32 guiOldSetCursor = 0;
UINT32 guiDelayTimer = 0;
CursorData *gpCursorDatabase;
INT16 gsGlobalCursorYOffset = 0;
INT16 gsCurMouseOffsetX = 0;
INT16 gsCurMouseOffsetY = 0;
UINT16 gsCurMouseHeight = 0;
UINT16 gsCurMouseWidth = 0;
UINT16 gusNumDataFiles = 0;
UINT32 guiExternVo;
UINT16 gusExternVoSubIndex;
UINT32 guiExtern2Vo;
UINT16 gusExtern2VoSubIndex;
UINT32 guiOldSetCursor = 0;
UINT32 guiDelayTimer = 0;
MOUSEBLT_HOOK gMouseBltOverride = NULL;
@@ -44,17 +44,17 @@ MOUSEBLT_HOOK gMouseBltOverride = NULL;
BOOLEAN BltToMouseCursorFromVObject( HVOBJECT hVObject, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos )
{
BOOLEAN ReturnValue;
BOOLEAN ReturnValue;
ReturnValue = BltVideoObject(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, usXPos, usYPos, VO_BLT_SRCTRANSPARENCY, NULL);
ReturnValue = BltVideoObject(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, usXPos, usYPos, VO_BLT_SRCTRANSPARENCY, NULL);
return ReturnValue;
return ReturnValue;
}
BOOLEAN BltToMouseCursorFromVObjectWithOutline( HVOBJECT hVObject, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos )
{
BOOLEAN ReturnValue;
ETRLEObject *pTrav;
BOOLEAN ReturnValue;
ETRLEObject *pTrav;
INT16 sXPos, sYPos;
// Adjust for offsets
@@ -71,9 +71,9 @@ BOOLEAN BltToMouseCursorFromVObjectWithOutline( HVOBJECT hVObject, UINT16 usVide
sXPos += ( ( gsCurMouseWidth - pTrav->usWidth ) / 2 );
sYPos += ( ( gsCurMouseHeight - pTrav->usHeight ) / 2 );
ReturnValue = BltVideoObjectOutline(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, sXPos, sYPos, Get16BPPColor( FROMRGB( 0, 255, 0 ) ), TRUE );
ReturnValue = BltVideoObjectOutline(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, sXPos, sYPos, Get16BPPColor( FROMRGB( 0, 255, 0 ) ), TRUE );
return ReturnValue;
return ReturnValue;
}
@@ -82,7 +82,7 @@ void InitCursorDatabase( CursorFileData *pCursorFileData, CursorData *pCursorDat
{
// Set global values!
gpCursorFileDatabase = pCursorFileData;
gpCursorFileDatabase = pCursorFileData;
gpCursorDatabase = pCursorData;
gusNumDataFiles = suNumDataFiles;
gfCursorDatabaseInit = TRUE;
@@ -102,7 +102,7 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex)
UINT32 cnt;
INT16 sMaxHeight = -1;
INT16 sMaxWidth = -1;
ETRLEObject *pTrav;
ETRLEObject *pTrav;
pCurData = &( gpCursorDatabase[ uiCursorIndex ] );
@@ -118,7 +118,7 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex)
//
VOBJECT_DESC VideoObjectDescription;
// FIRST LOAD AS AN HIMAGE SO WE CAN GET AUX DATA!
HIMAGE hImage;
HIMAGE hImage;
AuxObjectData *pAuxData;
@@ -164,7 +164,7 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex)
// the hImage is no longer needed
DestroyImage( hImage );
// Save hVObject....
GetVideoObject( &(gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject), gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex );
@@ -182,12 +182,12 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex)
return FALSE;
}
if ( pTrav->usHeight > sMaxHeight )
if ( pTrav->usHeight > sMaxHeight )
{
sMaxHeight = pTrav->usHeight;
}
if ( pTrav->usWidth > sMaxWidth )
if ( pTrav->usWidth > sMaxWidth )
{
sMaxWidth = pTrav->usWidth;
}
@@ -284,7 +284,7 @@ void UnLoadCursorData(UINT32 uiCursorIndex)
{
if ( !( gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) )
{
DeleteVideoObjectFromIndex( gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex);
DeleteVideoObjectFromIndex( gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex);
gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex = 0;
}
gpCursorFileDatabase[ pCurImage->uiFileIndex ].fLoaded = FALSE;
@@ -295,45 +295,45 @@ void UnLoadCursorData(UINT32 uiCursorIndex)
///////////////////////////////////////////////////////////////////////////////////////////////////
void CursorDatabaseClear(void)
void CursorDatabaseClear(void)
{
UINT32 uiIndex;
UINT32 uiIndex;
for (uiIndex = 0; uiIndex < gusNumDataFiles; uiIndex++)
{
if (gpCursorFileDatabase[uiIndex].fLoaded == TRUE)
{
for (uiIndex = 0; uiIndex < gusNumDataFiles; uiIndex++)
{
if (gpCursorFileDatabase[uiIndex].fLoaded == TRUE)
{
if ( !( gpCursorFileDatabase[ uiIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) )
{
DeleteVideoObjectFromIndex( gpCursorFileDatabase[uiIndex].uiIndex);
DeleteVideoObjectFromIndex( gpCursorFileDatabase[uiIndex].uiIndex);
gpCursorFileDatabase[uiIndex].uiIndex = 0;
}
gpCursorFileDatabase[uiIndex].fLoaded = FALSE;
}
}
gpCursorFileDatabase[uiIndex].fLoaded = FALSE;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex )
BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex )
{
#ifdef JA2
BOOLEAN ReturnValue = TRUE;
BOOLEAN ReturnValue = TRUE;
UINT16 usSubIndex;
CursorData *pCurData;
CursorImage *pCurImage;
UINT32 cnt;
INT16 sCenterValX, sCenterValY;
HVOBJECT hVObject;
ETRLEObject *pTrav;
ETRLEObject *pTrav;
UINT16 usEffHeight, usEffWidth;
if ( gfCursorDatabaseInit )
{
// Enter mouse buffer mutex
//EnterMutex(MOUSE_BUFFER_MUTEX, __LINE__, __FILE__);
//EnterMutex(MOUSE_BUFFER_MUTEX, __LINE__, __FILE__);
// If the current cursor is the first index, disable cursors
@@ -350,7 +350,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex )
else
{
// CHECK FOR EXTERN CURSOR
if ( uiCursorIndex == EXTERN_CURSOR || uiCursorIndex == EXTERN2_CURSOR )
if ( uiCursorIndex == EXTERN_CURSOR || uiCursorIndex == EXTERN2_CURSOR )
{
INT16 sSubX, sSubY;
HVOBJECT hVObjectTemp;
@@ -400,7 +400,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex )
{
BltVideoObjectOutlineFromIndex( MOUSE_BUFFER, guiExternVo, gusExternVoSubIndex, 0, 0, 0, FALSE );
}
// Hook into hook function
if ( gMouseBltOverride != NULL )
{
@@ -496,7 +496,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex )
continue;
}
}
}
}
else
{
if ( cnt <= 1 )
@@ -584,7 +584,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex )
}
}
return ( ReturnValue );
return ( ReturnValue );
#else
return(0);
#endif
@@ -616,7 +616,7 @@ void SetExternVOData( UINT32 uiCursorIndex, HVOBJECT hVObject, UINT16 usSubIndex
// If loaded, unload...
UnLoadCursorData( uiCursorIndex );
// Set extern vo
gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject = hVObject;
pCurImage->uiSubIndex = usSubIndex;
@@ -646,7 +646,7 @@ void RemoveExternVOData( UINT32 uiCursorIndex )
gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject = NULL;
}
}
}
}
+23 -23
View File
@@ -10,7 +10,7 @@
#include "Video.h"
#else
#include "video2.h"
#endif
#endif
#ifdef __cplusplus
extern "C" {
@@ -18,11 +18,11 @@ extern "C" {
extern UINT32 GetCursorHandle(UINT32 uiCursorIndex);
extern void UnloadCursorData(UINT32 uiCursorIndex);
extern BOOLEAN LoadCursorData(UINT32 uiCursorIndex);
extern void CursorDatabaseClear(void);
extern void UnloadCursorData(UINT32 uiCursorIndex);
extern BOOLEAN LoadCursorData(UINT32 uiCursorIndex);
extern void CursorDatabaseClear(void);
extern UINT16 GetCursorSubIndex(UINT32 uiCursorIndex);
extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex );
extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex );
#define ANIMATED_CURSOR 0x02
#define USE_EXTERN_VO_CURSOR 0x04
@@ -44,7 +44,7 @@ extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex );
#define CURSOR_TO_FLASH2 0x02
#define CURSOR_TO_SUB_CONDITIONALLY 0x04
#define DELAY_START_CURSOR 0x08
#define CURSOR_TO_PLAY_SOUND 0x10
#define CURSOR_TO_PLAY_SOUND 0x10
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -55,9 +55,9 @@ extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex );
typedef struct
{
UINT8 ubFilename[MAX_FILENAME_LEN];
BOOLEAN fLoaded;
UINT32 uiIndex;
UINT8 ubFilename[MAX_FILENAME_LEN];
BOOLEAN fLoaded;
UINT32 uiIndex;
UINT8 ubFlags;
UINT8 ubNumberOfFrames;
HVOBJECT hVObject;
@@ -66,8 +66,8 @@ typedef struct
typedef struct
{
UINT32 uiFileIndex;
UINT16 uiSubIndex;
UINT32 uiFileIndex;
UINT16 uiSubIndex;
UINT32 uiCurrentFrame;
INT16 usPosX;
INT16 usPosY;
@@ -78,8 +78,8 @@ typedef struct
{
CursorImage Composites[ MAX_COMPOSITES ];
UINT16 usNumComposites;
INT16 sOffsetX;
INT16 sOffsetY;
INT16 sOffsetX;
INT16 sOffsetY;
UINT16 usHeight;
UINT16 usWidth;
UINT8 bFlags;
@@ -87,19 +87,19 @@ typedef struct
} CursorData;
extern INT16 gsGlobalCursorYOffset;
extern INT16 gsGlobalCursorYOffset;
// Globals for cursor database offset values
extern INT16 gsCurMouseOffsetX;
extern INT16 gsCurMouseOffsetY;
extern UINT16 gsCurMouseHeight;
extern UINT16 gsCurMouseWidth;
extern INT16 gsCurMouseOffsetX;
extern INT16 gsCurMouseOffsetY;
extern UINT16 gsCurMouseHeight;
extern UINT16 gsCurMouseWidth;
extern UINT32 guiExternVo;
extern UINT16 gusExternVoSubIndex;
extern UINT32 guiExtern2Vo;
extern UINT16 gusExtern2VoSubIndex;
extern BOOLEAN gfExternUse2nd;
extern UINT32 guiExternVo;
extern UINT16 gusExternVoSubIndex;
extern UINT32 guiExtern2Vo;
extern UINT16 gusExtern2VoSubIndex;
extern BOOLEAN gfExternUse2nd;
typedef void (*MOUSEBLT_HOOK)( void );
+12 -12
View File
@@ -55,21 +55,21 @@ extern STR8 String(const STR8 String, ...);
// Debug Mode
//*******************************************************************************************
//Modified the Assertion code. As of the writing of this code, there are no other functions that
//make use of _FailMessage. With that assumption made, we can then make two functions, the first Assert, taking
//one argument, and passing a NULL string. The second one, AssertMsg(), accepts a string as the second parameter.
//This string that has vanished for Assert is now built inside of fail message. This is the case for both Asserts, but the second one
//also is added. Ex:
//Modified the Assertion code. As of the writing of this code, there are no other functions that
//make use of _FailMessage. With that assumption made, we can then make two functions, the first Assert, taking
//one argument, and passing a NULL string. The second one, AssertMsg(), accepts a string as the second parameter.
//This string that has vanished for Assert is now built inside of fail message. This is the case for both Asserts, but the second one
//also is added. Ex:
//Assert( pointer );
//Assert( pointer, "This pointer is null and you tried to access it in function A ");
//It'll make debugging a little simpler. In anal cases, you could build the string first, then assert
//Assert( pointer, "This pointer is null and you tried to access it in function A ");
//It'll make debugging a little simpler. In anal cases, you could build the string first, then assert
//with it.
extern void _FailMessage(STR8 pString, UINT32 uiLineNum, STR8 pSourceFile );
#define Assert(a) (a) ? _Null() : _FailMessage( NULL, __LINE__, __FILE__ )
#define AssertMsg(a,b) (a) ? _Null() : _FailMessage( b, __LINE__, __FILE__ )
#define AssertMsg(a,b) (a) ? _Null() : _FailMessage( b, __LINE__, __FILE__ )
extern CHAR8 gubAssertString[128];
extern CHAR8 gubAssertString[512];//for long filenames
#else
@@ -83,7 +83,7 @@ extern CHAR8 gubAssertString[128];
// Kaiden: Added this for Map Editor
#ifdef JA2BETAVERSION
extern CHAR8 gubAssertString[128];
extern CHAR8 gubAssertString[512];//for long filenames
#endif
// Moved these out of the defines - debug mgr always initialized
@@ -120,7 +120,7 @@ extern BOOLEAN gfDebugTopics[MAX_TOPICS_ALLOTED];
// Enable the debug topic we want
#if defined( JA2 ) || defined( UTIL )
#define RegisterJA2DebugTopic(a, b) DbgTopicRegistration( TOPIC_REGISTER, &(a), (b) )
#define RegisterDebugTopic(a, b) ((void *)0)
#define RegisterDebugTopic(a, b) ((void *)0)
#define DebugMsg(a, b, c) DbgMessageReal( (a), TOPIC_MESSAGE, (b), (c) )
#else
#define RegisterJA2DebugTopic(a, b) ((void *)0)
@@ -182,4 +182,4 @@ extern void _DebugMessage(UINT8 *pSourceFile, UINT32 uiLineNum, UINT8 *pString)
#endif
*/
#endif
#endif
+13 -17
View File
@@ -68,7 +68,7 @@ INT32 giProfileCount;
// they are required for the String() function, which is NOT a
// debug-mode only function, it's used in release-mode as well! -- DB
CHAR8 gubAssertString[128];
CHAR8 gubAssertString[512];//for long filenames
#define MAX_MSG_LENGTH2 512
CHAR8 gbTmpDebugString[8][MAX_MSG_LENGTH2];
@@ -158,7 +158,7 @@ STRING512 gpcDebugLogFileName;
// Return Value :
// Modification history :
//
// xxjun98:CJC -> creation
// xxjun98:CJC ->creation
//
//**************************************************************************
BOOLEAN DbgGetLogFileName( STRING512 pcName )
@@ -194,7 +194,7 @@ BOOLEAN DbgGetLogFileName( STRING512 pcName )
// Return Value :
// Modification history :
//
// xxnov96:HJH -> creation
// xxnov96:HJH ->creation
//
//**************************************************************************
@@ -235,7 +235,7 @@ BOOLEAN DbgInitialize(void)
// Return Value :
// Modification history :
//
// xxnov96:HJH -> creation
// xxnov96:HJH ->creation
//
//**************************************************************************
@@ -254,7 +254,7 @@ void DbgShutdown(void)
// Return Value :
// Modification history :
//
// June 97: BR -> creation
// June 97: BR ->creation
//
//**************************************************************************
@@ -324,7 +324,7 @@ void RemoveDebugText( void )
// Return Value :
// Modification history :
//
// June 97: BR -> creation
// June 97: BR ->creation
//
//**************************************************************************
@@ -343,7 +343,6 @@ void DbgClearAllTopics( void )
}
}
//**************************************************************************
//
// DbgMessageReal
@@ -354,7 +353,7 @@ void DbgClearAllTopics( void )
// Return Value :
// Modification history :
//
// xxnov96:HJH -> creation
// xxnov96:HJH ->creation
//
//**************************************************************************
void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8 strMessage)
@@ -362,7 +361,6 @@ void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8
#ifndef _NO_DEBUG_TXT
FILE *OutFile;
#endif
// Check for a registered topic ID
if ( uiTopicId < MAX_TOPICS_ALLOTED )//&& gfDebugTopics[uiTopicId] )
{
@@ -379,7 +377,6 @@ void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8
}
#endif
}
}
//**************************************************************************
@@ -392,7 +389,7 @@ void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8
// Return Value :
// Modification history :
//
// 11nov96:HJH -> creation
// 11nov96:HJH ->creation
//
//**************************************************************************
@@ -411,7 +408,7 @@ BOOLEAN DbgSetDebugLevel(UINT16 uiTopicId, UINT8 uiDebugLevel)
// Return Value :
// Modification history :
//
// xxnov96:HJH -> creation
// xxnov96:HJH ->creation
//
//**************************************************************************
@@ -493,7 +490,6 @@ void DbgShutdown(void) {};
#endif
#if defined ( _DEBUG ) || defined ( FORCE_ASSERTS_ON )
@@ -507,15 +503,14 @@ extern HVOBJECT FontObjs[25];
#ifdef JA2 //JAGGED ALLIANCE 2 VERSION ONLY
void _FailMessage( STR8 pString, UINT32 uiLineNum, STR8 pSourceFile )
{
{
CHAR8 ubOutputString[512];
#ifndef _NO_DEBUG_TXT
MSG Message;
// FILE *DebugFile;
#endif
BOOLEAN fDone = FALSE;
//Build the output strings
sprintf( ubOutputString, "{ %ld } Assertion Failure [Line %d in %s]\n", GetTickCount(), uiLineNum, pSourceFile );
sprintf( ubOutputString, "{ %ld } Assertion Failure [Line %d in \n%c %s]\n", GetTickCount(), uiLineNum, '\n', pSourceFile );
if( pString )
sprintf( gubAssertString, pString );
else
@@ -540,6 +535,7 @@ void _FailMessage( STR8 pString, UINT32 uiLineNum, STR8 pSourceFile )
// 0verhaul: Replacement for the above. More consistent.
DbgMessage( TOPIC_GAME, DBG_LEVEL_1, ubOutputString);
#if 0
if( !FontObjs[0] )
{ //Font manager hasn't yet been initialized so use the windows error system
@@ -554,7 +550,7 @@ void _FailMessage( STR8 pString, UINT32 uiLineNum, STR8 pSourceFile )
//NASTY HACK, THE GAME IS GOING TO DIE ANYWAY, SO WHO CARES WHAT WE DO.
//This will actually bring up a screen that prints out the assert message
//until the user hits esc or alt-x.
sprintf( gubErrorText, "Assertion Failure -- Line %d in %s", uiLineNum, pSourceFile );
sprintf( gubErrorText, "Assertion Failure -- Line %d in %s %s", uiLineNum, std::string("\n").c_str(), pSourceFile );
SetPendingNewScreen( ERROR_SCREEN );
SetCurrentScreen( ERROR_SCREEN );
while (gfProgramIsRunning)
+65 -65
View File
@@ -6,7 +6,7 @@
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -44,11 +44,11 @@
#define INITIAL_NUM_HANDLES 20
#define NUM_FILES_TO_ADD_AT_A_TIME 20
#define CHECKF(exp) if (!(exp)) { return(FALSE); }
#define CHECKV(exp) if (!(exp)) { return; }
#define CHECKN(exp) if (!(exp)) { return(NULL); }
#define CHECKF(exp) if (!(exp)) { return(FALSE); }
#define CHECKV(exp) if (!(exp)) { return; }
#define CHECKN(exp) if (!(exp)) { return(NULL); }
#define CHECKBI(exp) if (!(exp)) { return(-1); }
#define CHECK0(exp) if (!(exp)) { return(0); }
#define CHECK0(exp) if (!(exp)) { return(0); }
#define PRINT_DEBUG_INFO FileDebugPrint();
@@ -194,7 +194,7 @@ BOOLEAN GetShortFilename( STR strFilename, STR strPathname );
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -213,7 +213,7 @@ HDBFILE CreateDBFileHandle( HFILEINDEX high, HDBINDEX low )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -241,7 +241,7 @@ BOOLEAN InitializeDatabaseManager( STR strIndexFilename )
strcpy( gdb.strIndexFilename, strIndexFilename );
RegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager");
RegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager");
return(TRUE);
}
@@ -256,7 +256,7 @@ BOOLEAN InitializeDatabaseManager( STR strIndexFilename )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -281,7 +281,7 @@ void ShutdownDatabaseManager( void )
// release memory used
MemFree( gdb.pDBFiles );
UnRegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager" );
UnRegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager" );
}
//**************************************************************************
@@ -294,7 +294,7 @@ void ShutdownDatabaseManager( void )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -311,16 +311,16 @@ void DbDebug( BOOLEAN fFlag )
//
// Parameter List :
//
// STR -> name of file to check existence of
// STR ->name of file to check existence of
//
// Return Value :
//
// BOOLEAN -> TRUE if it exists
// -> FALSE if not
// BOOLEAN ->TRUE if it exists
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -337,16 +337,16 @@ BOOLEAN DbExists( STR strFilename )
//
// Parameter List :
//
// STR -> filename
// STR ->filename
//
// Return Value :
//
// HDBINDEX -> handle of opened file
// -> 0 if unsuccessful
// HDBINDEX ->handle of opened file
// ->0 if unsuccessful
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -358,7 +358,7 @@ HDBINDEX DbOpen( STR strFilename )
CHAR cShortDBName[FILENAME_LENGTH];
BOOLEAN fFound;
fFound = FALSE;
fFound = FALSE;
hDBIndex = 0;
// first, find any already open databases, and make sure that if we're trying to
@@ -423,12 +423,12 @@ HDBINDEX DbOpen( STR strFilename )
//
// Parameter List :
//
// HWFILE hFile -> handle to database file to close
// HWFILE hFile ->handle to database file to close
//
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -452,17 +452,17 @@ void DbClose( HDBINDEX hFile )
//
// Parameter List :
//
// STR -> filename
// UIN32 -> access - read or write, or both
// BOOLEAN -> delete on close
// STR ->filename
// UIN32 ->access - read or write, or both
// BOOLEAN ->delete on close
//
// Return Value :
//
// HWFILE -> handle of opened file
// HWFILE ->handle of opened file
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -491,7 +491,7 @@ HDBFILE DbFileOpen( STR strFilename )
DbFile *pNew;
pNew = (DbFile *) MemRealloc( gdb.pDBFiles[hDBIndex].pOpenFiles,
gdb.pDBFiles[hDBIndex].uiNumFiles + NUM_FILES_TO_ADD_AT_A_TIME );
gdb.pDBFiles[hDBIndex].uiNumFiles + NUM_FILES_TO_ADD_AT_A_TIME );
if ( !pNew )
{
@@ -519,12 +519,12 @@ HDBFILE DbFileOpen( STR strFilename )
//
// Parameter List :
//
// HWFILE hFile -> handle to database file to close
// HWFILE hFile ->handle to database file to close
//
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -534,7 +534,7 @@ void DbFileClose( HDBFILE hDBFile )
HDBINDEX hDBIndex;
hFileIndex = ExtractFileIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
if ( hDBIndex >= gdb.uiNumDBFiles )
return;
@@ -559,19 +559,19 @@ void DbFileClose( HDBFILE hDBFile )
//
// Parameter List :
//
// HWFILE -> handle to file to read from
// void * -> source buffer
// UINT32 -> num bytes to read
// UINT32 -> num bytes read
// HWFILE ->handle to file to read from
// void * ->source buffer
// UINT32 ->num bytes to read
// UINT32 ->num bytes read
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -583,7 +583,7 @@ BOOLEAN DbFileRead(HDBFILE hDBFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *pui
UINT32 uiStartPos, uiCurPos, uiBytesRead;
hFileIndex = ExtractFileIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
CHECKF( hDBIndex < gdb.uiNumDBFiles );
CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles )
@@ -618,12 +618,12 @@ BOOLEAN DbFileRead(HDBFILE hDBFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *pui
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -652,18 +652,18 @@ BOOLEAN DbFileLoad(STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByt
//
// Parameter List :
//
// HWFILE -> handle to file to seek in
// UINT32 -> distance to seek
// UINT8 -> how to seek
// HWFILE ->handle to file to seek in
// UINT32 ->distance to seek
// UINT8 ->how to seek
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -674,7 +674,7 @@ BOOLEAN DbFileSeek( HDBFILE hDBFile, UINT32 uiDistance, UINT8 uiHow )
UINT32 uiStartPos, uiCurPos, uiSize;
hFileIndex = ExtractFileIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
CHECKF( hDBIndex < gdb.uiNumDBFiles );
CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles )
@@ -705,16 +705,16 @@ BOOLEAN DbFileSeek( HDBFILE hDBFile, UINT32 uiDistance, UINT8 uiHow )
//
// Parameter List :
//
// HWFILE -> handle to file
// HWFILE ->handle to file
//
// Return Value :
//
// INT32 -> current offset in file if successful
// -> -1 if not
// INT32 ->current offset in file if successful
// ->-1 if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -724,7 +724,7 @@ UINT32 DbFileGetPos( HDBFILE hDBFile )
HDBINDEX hDBIndex;
hFileIndex = ExtractFileIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
CHECK0( hDBIndex < gdb.uiNumDBFiles );
CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles )
@@ -742,16 +742,16 @@ UINT32 DbFileGetPos( HDBFILE hDBFile )
//
// Parameter List :
//
// HWFILE -> handle to file
// HWFILE ->handle to file
//
// Return Value :
//
// INT32 -> file size in file if successful
// -> 0 if not
// INT32 ->file size in file if successful
// ->0 if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -761,7 +761,7 @@ UINT32 DbFileGetSize( HDBFILE hDBFile )
HDBINDEX hDBIndex;
hFileIndex = ExtractFileIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
hDBIndex = ExtractDbIndex( hDBFile );
CHECK0( hDBIndex < gdb.uiNumDBFiles );
CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles )
@@ -781,7 +781,7 @@ UINT32 DbFileGetSize( HDBFILE hDBFile )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -799,7 +799,7 @@ void DbDebugPrint( void )
// Return Value :
// Modification history :
//
// 15oct96:HJH -> creation
// 15oct96:HJH ->creation
//
//**************************************************************************
@@ -842,7 +842,7 @@ BOOLEAN InitDB( DbInfo *pDBInfo, STR strFilename )
// Return Value :
// Modification history :
//
// 15oct96:HJH -> creation
// 15oct96:HJH ->creation
//
//**************************************************************************
@@ -888,7 +888,7 @@ HDBINDEX OpenDatabaseContainingFile( STR strFilename )
// Return Value :
// Modification history :
//
// 15oct96:HJH -> creation
// 15oct96:HJH ->creation
//
//**************************************************************************
@@ -938,7 +938,7 @@ BOOLEAN InitFile( HWFILE hDBFile, DbFile *pFileInfo, STR strFilename )
// Return Value :
// Modification history :
//
// 15oct96:HJH -> creation
// 15oct96:HJH ->creation
//
//**************************************************************************
@@ -1015,7 +1015,7 @@ BOOLEAN LoadBucket( CHAR cFirstLetter )
// Return Value :
// Modification history :
//
// 15oct96:HJH -> creation
// 15oct96:HJH ->creation
//
//**************************************************************************
+2 -2
View File
@@ -28,11 +28,11 @@
//**************************************************************************
#ifndef FILE_ACCESS_READ
#define FILE_ACCESS_READ 0x01
#define FILE_ACCESS_READ 0x01
#endif
#ifndef FILE_ACCESS_WRITE
#define FILE_ACCESS_WRITE 0x02
#define FILE_ACCESS_WRITE 0x02
#endif
#define FILE_SEEK_FROM_START 0x01 // keep in sync with fileman.h
+58 -58
View File
@@ -50,12 +50,12 @@ DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw,
// copy to a local so we don't change the input parameter
memcpy ( &DDSurfaceDesc, pNewSurfaceDesc, sizeof ( DDSURFACEDESC ) );
// must have caps set since we are adding to the ddsCaps element
DDSurfaceDesc.dwFlags |= DDSD_CAPS;
// If this is a hardware D3D driver, the Z-Buffer MUST end up in video
// memory. Otherwise, it MUST end up in system memory.
// memory. Otherwise, it MUST end up in system memory.
if ( fVideoMemory )
DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
else
@@ -64,7 +64,7 @@ DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw,
// create the surface
DDCreateSurface ( pExistingDirectDraw, &DDSurfaceDesc, ppNewSurface1, ppNewSurface2 );
// get surface information
// get surface information
DDGetSurfaceDescription ( *ppNewSurface2, &DDSurfaceDesc );
// was the surface created in video memory?
@@ -123,7 +123,7 @@ void DDGetSurfaceDescription ( LPDIRECTDRAWSURFACE2 pSurface, DDSURFACEDESC *pSu
void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps )
{
Assert( pSurface != NULL );
Assert( pSurface != NULL );
Assert( pSurfaceCaps != NULL );
ATTEMPT( IDirectDrawSurface2_GetCaps( pSurface, pSurfaceCaps ) );
@@ -131,9 +131,9 @@ void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps )
}
void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight,
BOOLEAN fVideoMemory,
LPDIRECTDRAWSURFACE *ppRasterSurface1,
LPDIRECTDRAWSURFACE2 *ppRasterSurface2 )
BOOLEAN fVideoMemory,
LPDIRECTDRAWSURFACE *ppRasterSurface1,
LPDIRECTDRAWSURFACE2 *ppRasterSurface2 )
{
DDSURFACEDESC DDSurfaceDesc;
@@ -155,9 +155,9 @@ void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHei
}
void DDCreateZBufferSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight,
BOOLEAN fVideoMemory,
LPDIRECTDRAWSURFACE *ppZBufferSurface1,
LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 )
BOOLEAN fVideoMemory,
LPDIRECTDRAWSURFACE *ppZBufferSurface1,
LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 )
{
DDSURFACEDESC DDSurfaceDesc;
@@ -183,9 +183,9 @@ void
DDAddAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface,
LPDIRECTDRAWSURFACE2 pAddChildSurface )
{
Assert ( pParentSurface != NULL );
Assert ( pParentSurface != NULL );
Assert ( pAddChildSurface != NULL );
// attach the child to the parent surface
ATTEMPT ( IDirectDrawSurface2_AddAttachedSurface ( pParentSurface,
pAddChildSurface ) );
@@ -195,7 +195,7 @@ void
DDDeleteAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface,
LPDIRECTDRAWSURFACE2 pDeleteChildSurface )
{
Assert ( pParentSurface != NULL );
Assert ( pParentSurface != NULL );
Assert ( pDeleteChildSurface != NULL );
// seperate the z buffer surface from the raster surface
@@ -226,13 +226,13 @@ void DDRestoreSurface( LPDIRECTDRAWSURFACE2 pSurface )
}
void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface,
void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface,
LPRECT pSrcRect, UINT32 uiTrans)
{
HRESULT ReturnCode;
Assert( pDestSurface != NULL );
Assert( pSrcSurface != NULL );
Assert( pDestSurface != NULL );
Assert( pSrcSurface != NULL );
do
{
@@ -243,12 +243,12 @@ void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY
void DDBltSurface( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface,
LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx )
LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx )
{
HRESULT ReturnCode;
Assert( pDestSurface != NULL );
Assert( pDestSurface != NULL );
do
{
@@ -272,7 +272,7 @@ void DDCreatePalette( LPDIRECTDRAW2 pDirectDraw, UINT32 uiFlags, LPPALETTEENTRY
void DDSetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE pDDPalette )
{
Assert( pDDPalette != NULL );
Assert( pDDPalette != NULL );
Assert( pSurface != NULL );
ATTEMPT( IDirectDrawSurface2_SetPalette( pSurface, pDDPalette ) );
@@ -294,7 +294,7 @@ void DDSetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 u
Assert( pPalette != NULL );
Assert( pEntries != NULL );
ATTEMPT( IDirectDrawPalette_SetEntries( pPalette, uiFlags, uiStartingEntry, uiCount, pEntries ) );
ATTEMPT( IDirectDrawPalette_SetEntries( pPalette, uiFlags, uiStartingEntry, uiCount, pEntries ) );
}
@@ -304,7 +304,7 @@ void DDGetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 u
Assert( pPalette != NULL );
Assert( pEntries != NULL );
ATTEMPT( IDirectDrawPalette_GetEntries( pPalette, uiFlags, uiBase, uiNumEntries, pEntries ) );
ATTEMPT( IDirectDrawPalette_GetEntries( pPalette, uiFlags, uiBase, uiNumEntries, pEntries ) );
}
@@ -381,7 +381,7 @@ void DDSetClipperList( LPDIRECTDRAWCLIPPER pDDClipper, LPRGNDATA pClipList, UINT
{
Assert( pDDClipper != NULL );
Assert( pClipList != NULL );
ATTEMPT( IDirectDrawClipper_SetClipList( pDDClipper, pClipList, uiFlags ) );
}
@@ -391,30 +391,30 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32
{
DDSURFACEDESC SurfaceDescription;
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
HRESULT ReturnCode;
DDCOLORKEY ColorKey;
UINT8 *pDestBuf, *pSrcBuf;
HRESULT ReturnCode;
DDCOLORKEY ColorKey;
UINT16 us16BPPColorKey;
// Lock surfaces
DDLockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL, &SurfaceDescription, 0, NULL);
uiDestPitchBYTES = SurfaceDescription.lPitch;
pDestBuf = (UINT8 *) SurfaceDescription.lpSurface;
pDestBuf = (UINT8 *) SurfaceDescription.lpSurface;
// Lock surfaces
DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL);
uiSrcPitchBYTES = SurfaceDescription.lPitch;
pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface;
pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface;
if ( uiTrans == DDBLTFAST_NOCOLORKEY )
{
Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
uiX , uiY,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
uiX , uiY,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
( pSrcRect->bottom - pSrcRect->top ) );
}
else if ( uiTrans == DDBLTFAST_SRCCOLORKEY )
@@ -422,20 +422,20 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32
// Get 16 bpp color key.....
ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey);
if (ReturnCode == DD_OK)
if (ReturnCode == DD_OK)
{
us16BPPColorKey = (UINT16)ColorKey.dwColorSpaceLowValue;
Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
uiX , uiY,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
uiX , uiY,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
( pSrcRect->bottom - pSrcRect->top ), us16BPPColorKey );
}
}
else
else
{
// Not supported.....
}
@@ -453,15 +453,15 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe
DDSURFACEDESC SurfaceDescription;
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES = 0;
UINT8 *pDestBuf, *pSrcBuf = NULL;
HRESULT ReturnCode;
DDCOLORKEY ColorKey;
HRESULT ReturnCode;
DDCOLORKEY ColorKey;
UINT16 us16BPPColorKey;
// Lock surfaces
DDLockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL, &SurfaceDescription, 0, NULL);
uiDestPitchBYTES = SurfaceDescription.lPitch;
pDestBuf = (UINT8 *) SurfaceDescription.lpSurface;
pDestBuf = (UINT8 *) SurfaceDescription.lpSurface;
if ( pSrcSurface != NULL )
@@ -469,12 +469,12 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe
// Lock surfaces
DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL);
uiSrcPitchBYTES = SurfaceDescription.lPitch;
pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface;
pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface;
}
if ( pSrcRect != NULL &&
( ( pSrcRect->right - pSrcRect->left ) != ( pDestRect->right - pDestRect->left ) ||
( pSrcRect->bottom - pSrcRect->top ) != ( pDestRect->bottom - pDestRect->top ) ) )
if ( pSrcRect != NULL &&
( ( pSrcRect->right - pSrcRect->left ) != ( pDestRect->right - pDestRect->left ) ||
( pSrcRect->bottom - pSrcRect->top ) != ( pDestRect->bottom - pDestRect->top ) ) )
{
DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL );
@@ -493,13 +493,13 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe
// Lock surfaces
DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL);
uiSrcPitchBYTES = SurfaceDescription.lPitch;
pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface;
pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface;
Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
pDestRect->left , pDestRect->top,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
pDestRect->left , pDestRect->top,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
( pSrcRect->bottom - pSrcRect->top ) );
}
else if ( uiFlags & DDBLT_KEYSRC )
@@ -507,15 +507,15 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe
// Get 16 bpp color key.....
ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey);
if (ReturnCode == DD_OK)
if (ReturnCode == DD_OK)
{
us16BPPColorKey = (UINT16)ColorKey.dwColorSpaceLowValue;
Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
pDestRect->left , pDestRect->top,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
pDestRect->left , pDestRect->top,
pSrcRect->left , pSrcRect->top,
( pSrcRect->right - pSrcRect->left ),
( pSrcRect->bottom - pSrcRect->top ), us16BPPColorKey );
}
+8 -8
View File
@@ -20,11 +20,11 @@ void DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw,
BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppNewSurface1,
LPDIRECTDRAWSURFACE2 *ppNewSurface2 );
void DDCreateZBufferSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight,
BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppZBufferSurface1,
LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 );
BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppZBufferSurface1,
LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 );
void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight,
BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppRasterSurface1,
LPDIRECTDRAWSURFACE2 *ppRasterSurface2 );
BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppRasterSurface1,
LPDIRECTDRAWSURFACE2 *ppRasterSurface2 );
void DDGetSurfaceDescription ( LPDIRECTDRAWSURFACE2 pSurface, DDSURFACEDESC *pSurfaceDesc );
void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps );
void DDAddAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface,
@@ -37,7 +37,7 @@ void DDGetDDInterface( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAW *ppDirectDraw
void DDLockSurface( LPDIRECTDRAWSURFACE2 pSurface, LPRECT pDestRect, LPDDSURFACEDESC pSurfaceDesc,
UINT32 uiFlags, HANDLE hEvent);
UINT32 uiFlags, HANDLE hEvent);
void DDUnlockSurface( LPDIRECTDRAWSURFACE2 pSurface, PTR pSurfaceData );
@@ -47,7 +47,7 @@ void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY
LPRECT pSrcRect, UINT32 uiTrans);
void DDBltSurface( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface,
LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx );
LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx );
void DDSetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE pDDPalette );
@@ -86,8 +86,8 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32
HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx );
#define IDirectDrawSurface2_SGPBltFast(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltFastDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ) )
#define IDirectDrawSurface2_SGPBlt(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_Blt(p,a,b,c,d,e) ) )
#define IDirectDrawSurface2_SGPBltFast(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltFastDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ) )
#define IDirectDrawSurface2_SGPBlt(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_Blt(p,a,b,c,d,e) ) )
#ifdef __cplusplus
+209 -209
View File
@@ -14,7 +14,7 @@
#include "debug.h"
#endif
void DirectXZeroMem ( void* pMemory, int nSize )
void DirectXZeroMem ( void* pMemory, int nSize )
{
memset ( pMemory, 0, nSize );
}
@@ -26,219 +26,219 @@ void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, STR8 szFilename )
if ( iErrorCode != DD_OK )
{
FastDebugMsg("DIRECTX COMMON: DirectX Error\n" );
FastDebugMsg(DirectXErrorDescription(iErrorCode));
FastDebugMsg(DirectXErrorDescription(iErrorCode));
}
#endif
}
STR8 DirectXErrorDescription ( INT32 iDXReturn )
{
switch( iDXReturn )
{
case DD_OK
: return "No error.\0";
case DDERR_ALREADYINITIALIZED
: return "The object has already been initialized.";
case DDERR_BLTFASTCANTCLIP
: return "A DirectDrawClipper object is attached to a source surface that has passed into a call to the IDirectDrawSurface2::BltFast method.";
case DDERR_CANNOTATTACHSURFACE
: return "A surface cannot be attached to another requested surface.";
case DDERR_CANNOTDETACHSURFACE
: return "A surface cannot be detached from another requested surface.";
case DDERR_CANTCREATEDC
: return "Windows cannot create any more device contexts (DCs).";
case DDERR_CANTDUPLICATE
: return "Primary and 3D surfaces, or surfaces that are implicitly created, cannot be duplicated.";
case DDERR_CANTLOCKSURFACE
: return "Access to this surface is refused because an attempt was made to lock the primary surface without DCI support.";
case DDERR_CANTPAGELOCK
: return "An attempt to page lock a surface failed. Page lock will not work on a display-memory surface or an emulated primary surface.";
case DDERR_CANTPAGEUNLOCK
: return "An attempt to page unlock a surface failed. Page unlock will not work on a display-memory surface or an emulated primary surface.";
case DDERR_CLIPPERISUSINGHWND
: return "An attempt was made to set a clip list for a DirectDrawClipper object that is already monitoring a window handle.";
case DDERR_COLORKEYNOTSET
: return "No source color key is specified for this operation.";
case DDERR_CURRENTLYNOTAVAIL
: return "No support is currently available.";
case DDERR_DCALREADYCREATED
: return "A device context (DC) has already been returned for this surface. Only one DC can be retrieved for each surface.";
case DDERR_DIRECTDRAWALREADYCREATED
: return "A DirectDraw object representing this driver has already been created for this process.";
case DDERR_EXCEPTION
: return "An exception was encountered while performing the requested operation.";
case DDERR_EXCLUSIVEMODEALREADYSET
: return "An attempt was made to set the cooperative level when it was already set to exclusive.";
case DDERR_GENERIC
: return "There is an undefined error condition.";
case DDERR_HEIGHTALIGN
: return "The height of the provided rectangle is not a multiple of the required alignment.";
case DDERR_HWNDALREADYSET
: return "The DirectDraw cooperative level window handle has already been set. It cannot be reset while the process has surfaces or palettes created.";
case DDERR_HWNDSUBCLASSED
: return "DirectDraw is prevented from restoring state because the DirectDraw cooperative level window handle has been subclassed.";
case DDERR_IMPLICITLYCREATED
: return "The surface cannot be restored because it is an implicitly created surface.";
case DDERR_INCOMPATIBLEPRIMARY
: return "The primary surface creation request does not match with the existing primary surface.";
case DDERR_INVALIDCAPS
: return "One or more of the capability bits passed to the callback function are incorrect.";
case DDERR_INVALIDCLIPLIST
: return "DirectDraw does not support the provided clip list.";
case DDERR_INVALIDDIRECTDRAWGUID
: return "The globally unique identifier (GUID) passed to the DirectDrawCreate function is not a valid DirectDraw driver identifier.";
case DDERR_INVALIDMODE
: return "DirectDraw does not support the requested mode.";
case DDERR_INVALIDOBJECT
: return "DirectDraw received a pointer that was an invalid DirectDraw object.";
case DDERR_INVALIDPARAMS
: return "One or more of the parameters passed to the method are incorrect.";
case DDERR_INVALIDPIXELFORMAT
: return "The pixel format was invalid as specified.";
case DDERR_INVALIDPOSITION
: return "The position of the overlay on the destination is no longer legal.";
case DDERR_INVALIDRECT
: return "The provided rectangle was invalid.";
case DDERR_INVALIDSURFACETYPE
: return "The requested operation could not be performed because the surface was of the wrong type.";
case DDERR_LOCKEDSURFACES
: return "One or more surfaces are locked, causing the failure of the requested operation.";
case DDERR_NO3D
: return "No 3D hardware or emulation is present.";
case DDERR_NOALPHAHW
: return "No alpha acceleration hardware is present or available, causing the failure of the requested operation.";
case DDERR_NOBLTHW
: return "No blitter hardware is present.";
case DDERR_NOCLIPLIST
: return "No clip list is available.";
case DDERR_NOCLIPPERATTACHED
: return "No DirectDrawClipper object is attached to the surface object.";
case DDERR_NOCOLORCONVHW
: return "The operation cannot be carried out because no color-conversion hardware is present or available.";
case DDERR_NOCOLORKEY
: return "The surface does not currently have a color key.";
case DDERR_NOCOLORKEYHW
: return "The operation cannot be carried out because there is no hardware support for the destination color key.";
case DDERR_NOCOOPERATIVELEVELSET
: return "A create function is called without the IDirectDraw2::SetCooperativeLevel method being called.";
case DDERR_NODC
: return "No DC has ever been created for this surface.";
case DDERR_NODDROPSHW
: return "No DirectDraw raster operation (ROP) hardware is available.";
case DDERR_NODIRECTDRAWHW
: return "Hardware-only DirectDraw object creation is not possible; the driver does not support any hardware.";
case DDERR_NODIRECTDRAWSUPPORT
: return "DirectDraw support is not possible with the current display driver.";
case DDERR_NOEMULATION
: return "Software emulation is not available.";
case DDERR_NOEXCLUSIVEMODE
: return "The operation requires the application to have exclusive mode, but the application does not have exclusive mode.";
case DDERR_NOFLIPHW
: return "Flipping visible surfaces is not supported.";
case DDERR_NOGDI
: return "No GDI is present.";
case DDERR_NOHWND
: return "Clipper notification requires a window handle, or no window handle has been previously set as the cooperative level window handle.";
case DDERR_NOMIPMAPHW
: return "The operation cannot be carried out because no mipmap texture mapping hardware is present or available.";
case DDERR_NOMIRRORHW
: return "The operation cannot be carried out because no mirroring hardware is present or available.";
case DDERR_NOOVERLAYDEST
: return "The IDirectDrawSurface2::GetOverlayPosition method is called on an overlay that the IDirectDrawSurface2::UpdateOverlay method has not been called on to establish a destination.";
case DDERR_NOOVERLAYHW
: return "The operation cannot be carried out because no overlay hardware is present or available.";
case DDERR_NOPALETTEATTACHED
: return "No palette object is attached to this surface.";
case DDERR_NOPALETTEHW
: return "There is no hardware support for 16- or 256-color palettes.";
case DDERR_NORASTEROPHW
: return "The operation cannot be carried out because no appropriate raster operation hardware is present or available.";
case DDERR_NOROTATIONHW
: return "The operation cannot be carried out because no rotation hardware is present or available.";
case DDERR_NOSTRETCHHW
: return "The operation cannot be carried out because there is no hardware support for stretching.";
case DDERR_NOT4BITCOLOR
: return "The DirectDrawSurface object is not using a 4-bit color palette and the requested operation requires a 4-bit color palette.";
case DDERR_NOT4BITCOLORINDEX
: return "The DirectDrawSurface object is not using a 4-bit color index palette and the requested operation requires a 4-bit color index palette.";
case DDERR_NOT8BITCOLOR
: return "The DirectDrawSurface object is not using an 8-bit color palette and the requested operation requires an 8-bit color palette.";
case DDERR_NOTAOVERLAYSURFACE
: return "An overlay component is called for a non-overlay surface.";
case DDERR_NOTEXTUREHW
: return "The operation cannot be carried out because no texture-mapping hardware is present or available.";
case DDERR_NOTFLIPPABLE
: return "An attempt has been made to flip a surface that cannot be flipped.";
case DDERR_NOTFOUND
: return "The requested item was not found.";
case DDERR_NOTINITIALIZED
: return "An attempt was made to call an interface method of a DirectDraw object created by CoCreateInstance before the object was initialized.";
case DDERR_NOTLOCKED
: return "An attempt is made to unlock a surface that was not locked.";
case DDERR_NOTPAGELOCKED
: return "An attempt is made to page unlock a surface with no outstanding page locks.";
case DDERR_NOTPALETTIZED
: return "The surface being used is not a palette-based surface.";
case DDERR_NOVSYNCHW
: return "The operation cannot be carried out because there is no hardware support for vertical blank synchronized operations.";
case DDERR_NOZBUFFERHW
: return "The operation to create a z-buffer in display memory or to perform a blit using a z-buffer cannot be carried out because there is no hardware support for z-buffers.";
case DDERR_NOZOVERLAYHW
: return "The overlay surfaces cannot be z-layered based on the z-order because the hardware does not support z-ordering of overlays.";
case DDERR_OUTOFCAPS
: return "The hardware needed for the requested operation has already been allocated.";
case DDERR_OUTOFMEMORY
: return "DirectDraw does not have enough memory to perform the operation.";
case DDERR_OUTOFVIDEOMEMORY
: return "DirectDraw does not have enough display memory to perform the operation.";
case DDERR_OVERLAYCANTCLIP
: return "The hardware does not support clipped overlays.";
case DDERR_OVERLAYCOLORKEYONLYONEACTIVE
: return "An attempt was made to have more than one color key active on an overlay.";
case DDERR_OVERLAYNOTVISIBLE
: return "The IDirectDrawSurface2::GetOverlayPosition method is called on a hidden overlay.";
case DDERR_PALETTEBUSY
: return "Access to this palette is refused because the palette is locked by another thread.";
case DDERR_PRIMARYSURFACEALREADYEXISTS
: return "This process has already created a primary surface.";
case DDERR_REGIONTOOSMALL
: return "The region passed to the IDirectDrawClipper::GetClipList method is too small.";
case DDERR_SURFACEALREADYATTACHED
: return "An attempt was made to attach a surface to another surface to which it is already attached.";
case DDERR_SURFACEALREADYDEPENDENT
: return "An attempt was made to make a surface a dependency of another surface to which it is already dependent.";
case DDERR_SURFACEBUSY
: return "Access to the surface is refused because the surface is locked by another thread.";
case DDERR_SURFACEISOBSCURED
: return "Access to the surface is refused because the surface is obscured.";
case DDERR_SURFACELOST
: return "Access to the surface is refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have the IDirectDrawSurface2::Restore method called on it.";
case DDERR_SURFACENOTATTACHED
: return "The requested surface is not attached.";
case DDERR_TOOBIGHEIGHT
: return "The height requested by DirectDraw is too large.";
case DDERR_TOOBIGSIZE
: return "The size requested by DirectDraw is too large. However, the individual height and width are OK.";
case DDERR_TOOBIGWIDTH
: return "The width requested by DirectDraw is too large.";
case DDERR_UNSUPPORTED
: return "The operation is not supported.";
case DDERR_UNSUPPORTEDFORMAT
: return "The FourCC format requested is not supported by DirectDraw.";
case DDERR_UNSUPPORTEDMASK
: return "The bitmask in the pixel format requested is not supported by DirectDraw.";
case DDERR_UNSUPPORTEDMODE
: return "The display is currently in an unsupported mode.";
case DDERR_VERTICALBLANKINPROGRESS
: return "A vertical blank is in progress.";
case DDERR_WASSTILLDRAWING
: return "The previous blit operation that is transferring information to or from this surface is incomplete.";
case DDERR_WRONGMODE
: return "This surface cannot be restored because it was created in a different mode.";
case DDERR_XALIGN
: return "The provided rectangle was not horizontally aligned on a required boundary.";
default
: return "Unrecognized error value.\0";
}
switch( iDXReturn )
{
case DD_OK
: return "No error.\0";
case DDERR_ALREADYINITIALIZED
: return "The object has already been initialized.";
case DDERR_BLTFASTCANTCLIP
: return "A DirectDrawClipper object is attached to a source surface that has passed into a call to the IDirectDrawSurface2::BltFast method.";
case DDERR_CANNOTATTACHSURFACE
: return "A surface cannot be attached to another requested surface.";
case DDERR_CANNOTDETACHSURFACE
: return "A surface cannot be detached from another requested surface.";
case DDERR_CANTCREATEDC
: return "Windows cannot create any more device contexts (DCs).";
case DDERR_CANTDUPLICATE
: return "Primary and 3D surfaces, or surfaces that are implicitly created, cannot be duplicated.";
case DDERR_CANTLOCKSURFACE
: return "Access to this surface is refused because an attempt was made to lock the primary surface without DCI support.";
case DDERR_CANTPAGELOCK
: return "An attempt to page lock a surface failed. Page lock will not work on a display-memory surface or an emulated primary surface.";
case DDERR_CANTPAGEUNLOCK
: return "An attempt to page unlock a surface failed. Page unlock will not work on a display-memory surface or an emulated primary surface.";
case DDERR_CLIPPERISUSINGHWND
: return "An attempt was made to set a clip list for a DirectDrawClipper object that is already monitoring a window handle.";
case DDERR_COLORKEYNOTSET
: return "No source color key is specified for this operation.";
case DDERR_CURRENTLYNOTAVAIL
: return "No support is currently available.";
case DDERR_DCALREADYCREATED
: return "A device context (DC) has already been returned for this surface. Only one DC can be retrieved for each surface.";
case DDERR_DIRECTDRAWALREADYCREATED
: return "A DirectDraw object representing this driver has already been created for this process.";
case DDERR_EXCEPTION
: return "An exception was encountered while performing the requested operation.";
case DDERR_EXCLUSIVEMODEALREADYSET
: return "An attempt was made to set the cooperative level when it was already set to exclusive.";
case DDERR_GENERIC
: return "There is an undefined error condition.";
case DDERR_HEIGHTALIGN
: return "The height of the provided rectangle is not a multiple of the required alignment.";
case DDERR_HWNDALREADYSET
: return "The DirectDraw cooperative level window handle has already been set. It cannot be reset while the process has surfaces or palettes created.";
case DDERR_HWNDSUBCLASSED
: return "DirectDraw is prevented from restoring state because the DirectDraw cooperative level window handle has been subclassed.";
case DDERR_IMPLICITLYCREATED
: return "The surface cannot be restored because it is an implicitly created surface.";
case DDERR_INCOMPATIBLEPRIMARY
: return "The primary surface creation request does not match with the existing primary surface.";
case DDERR_INVALIDCAPS
: return "One or more of the capability bits passed to the callback function are incorrect.";
case DDERR_INVALIDCLIPLIST
: return "DirectDraw does not support the provided clip list.";
case DDERR_INVALIDDIRECTDRAWGUID
: return "The globally unique identifier (GUID) passed to the DirectDrawCreate function is not a valid DirectDraw driver identifier.";
case DDERR_INVALIDMODE
: return "DirectDraw does not support the requested mode.";
case DDERR_INVALIDOBJECT
: return "DirectDraw received a pointer that was an invalid DirectDraw object.";
case DDERR_INVALIDPARAMS
: return "One or more of the parameters passed to the method are incorrect.";
case DDERR_INVALIDPIXELFORMAT
: return "The pixel format was invalid as specified.";
case DDERR_INVALIDPOSITION
: return "The position of the overlay on the destination is no longer legal.";
case DDERR_INVALIDRECT
: return "The provided rectangle was invalid.";
case DDERR_INVALIDSURFACETYPE
: return "The requested operation could not be performed because the surface was of the wrong type.";
case DDERR_LOCKEDSURFACES
: return "One or more surfaces are locked, causing the failure of the requested operation.";
case DDERR_NO3D
: return "No 3D hardware or emulation is present.";
case DDERR_NOALPHAHW
: return "No alpha acceleration hardware is present or available, causing the failure of the requested operation.";
case DDERR_NOBLTHW
: return "No blitter hardware is present.";
case DDERR_NOCLIPLIST
: return "No clip list is available.";
case DDERR_NOCLIPPERATTACHED
: return "No DirectDrawClipper object is attached to the surface object.";
case DDERR_NOCOLORCONVHW
: return "The operation cannot be carried out because no color-conversion hardware is present or available.";
case DDERR_NOCOLORKEY
: return "The surface does not currently have a color key.";
case DDERR_NOCOLORKEYHW
: return "The operation cannot be carried out because there is no hardware support for the destination color key.";
case DDERR_NOCOOPERATIVELEVELSET
: return "A create function is called without the IDirectDraw2::SetCooperativeLevel method being called.";
case DDERR_NODC
: return "No DC has ever been created for this surface.";
case DDERR_NODDROPSHW
: return "No DirectDraw raster operation (ROP) hardware is available.";
case DDERR_NODIRECTDRAWHW
: return "Hardware-only DirectDraw object creation is not possible; the driver does not support any hardware.";
case DDERR_NODIRECTDRAWSUPPORT
: return "DirectDraw support is not possible with the current display driver.";
case DDERR_NOEMULATION
: return "Software emulation is not available.";
case DDERR_NOEXCLUSIVEMODE
: return "The operation requires the application to have exclusive mode, but the application does not have exclusive mode.";
case DDERR_NOFLIPHW
: return "Flipping visible surfaces is not supported.";
case DDERR_NOGDI
: return "No GDI is present.";
case DDERR_NOHWND
: return "Clipper notification requires a window handle, or no window handle has been previously set as the cooperative level window handle.";
case DDERR_NOMIPMAPHW
: return "The operation cannot be carried out because no mipmap texture mapping hardware is present or available.";
case DDERR_NOMIRRORHW
: return "The operation cannot be carried out because no mirroring hardware is present or available.";
case DDERR_NOOVERLAYDEST
: return "The IDirectDrawSurface2::GetOverlayPosition method is called on an overlay that the IDirectDrawSurface2::UpdateOverlay method has not been called on to establish a destination.";
case DDERR_NOOVERLAYHW
: return "The operation cannot be carried out because no overlay hardware is present or available.";
case DDERR_NOPALETTEATTACHED
: return "No palette object is attached to this surface.";
case DDERR_NOPALETTEHW
: return "There is no hardware support for 16- or 256-color palettes.";
case DDERR_NORASTEROPHW
: return "The operation cannot be carried out because no appropriate raster operation hardware is present or available.";
case DDERR_NOROTATIONHW
: return "The operation cannot be carried out because no rotation hardware is present or available.";
case DDERR_NOSTRETCHHW
: return "The operation cannot be carried out because there is no hardware support for stretching.";
case DDERR_NOT4BITCOLOR
: return "The DirectDrawSurface object is not using a 4-bit color palette and the requested operation requires a 4-bit color palette.";
case DDERR_NOT4BITCOLORINDEX
: return "The DirectDrawSurface object is not using a 4-bit color index palette and the requested operation requires a 4-bit color index palette.";
case DDERR_NOT8BITCOLOR
: return "The DirectDrawSurface object is not using an 8-bit color palette and the requested operation requires an 8-bit color palette.";
case DDERR_NOTAOVERLAYSURFACE
: return "An overlay component is called for a non-overlay surface.";
case DDERR_NOTEXTUREHW
: return "The operation cannot be carried out because no texture-mapping hardware is present or available.";
case DDERR_NOTFLIPPABLE
: return "An attempt has been made to flip a surface that cannot be flipped.";
case DDERR_NOTFOUND
: return "The requested item was not found.";
case DDERR_NOTINITIALIZED
: return "An attempt was made to call an interface method of a DirectDraw object created by CoCreateInstance before the object was initialized.";
case DDERR_NOTLOCKED
: return "An attempt is made to unlock a surface that was not locked.";
case DDERR_NOTPAGELOCKED
: return "An attempt is made to page unlock a surface with no outstanding page locks.";
case DDERR_NOTPALETTIZED
: return "The surface being used is not a palette-based surface.";
case DDERR_NOVSYNCHW
: return "The operation cannot be carried out because there is no hardware support for vertical blank synchronized operations.";
case DDERR_NOZBUFFERHW
: return "The operation to create a z-buffer in display memory or to perform a blit using a z-buffer cannot be carried out because there is no hardware support for z-buffers.";
case DDERR_NOZOVERLAYHW
: return "The overlay surfaces cannot be z-layered based on the z-order because the hardware does not support z-ordering of overlays.";
case DDERR_OUTOFCAPS
: return "The hardware needed for the requested operation has already been allocated.";
case DDERR_OUTOFMEMORY
: return "DirectDraw does not have enough memory to perform the operation.";
case DDERR_OUTOFVIDEOMEMORY
: return "DirectDraw does not have enough display memory to perform the operation.";
case DDERR_OVERLAYCANTCLIP
: return "The hardware does not support clipped overlays.";
case DDERR_OVERLAYCOLORKEYONLYONEACTIVE
: return "An attempt was made to have more than one color key active on an overlay.";
case DDERR_OVERLAYNOTVISIBLE
: return "The IDirectDrawSurface2::GetOverlayPosition method is called on a hidden overlay.";
case DDERR_PALETTEBUSY
: return "Access to this palette is refused because the palette is locked by another thread.";
case DDERR_PRIMARYSURFACEALREADYEXISTS
: return "This process has already created a primary surface.";
case DDERR_REGIONTOOSMALL
: return "The region passed to the IDirectDrawClipper::GetClipList method is too small.";
case DDERR_SURFACEALREADYATTACHED
: return "An attempt was made to attach a surface to another surface to which it is already attached.";
case DDERR_SURFACEALREADYDEPENDENT
: return "An attempt was made to make a surface a dependency of another surface to which it is already dependent.";
case DDERR_SURFACEBUSY
: return "Access to the surface is refused because the surface is locked by another thread.";
case DDERR_SURFACEISOBSCURED
: return "Access to the surface is refused because the surface is obscured.";
case DDERR_SURFACELOST
: return "Access to the surface is refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have the IDirectDrawSurface2::Restore method called on it.";
case DDERR_SURFACENOTATTACHED
: return "The requested surface is not attached.";
case DDERR_TOOBIGHEIGHT
: return "The height requested by DirectDraw is too large.";
case DDERR_TOOBIGSIZE
: return "The size requested by DirectDraw is too large. However, the individual height and width are OK.";
case DDERR_TOOBIGWIDTH
: return "The width requested by DirectDraw is too large.";
case DDERR_UNSUPPORTED
: return "The operation is not supported.";
case DDERR_UNSUPPORTEDFORMAT
: return "The FourCC format requested is not supported by DirectDraw.";
case DDERR_UNSUPPORTEDMASK
: return "The bitmask in the pixel format requested is not supported by DirectDraw.";
case DDERR_UNSUPPORTEDMODE
: return "The display is currently in an unsupported mode.";
case DDERR_VERTICALBLANKINPROGRESS
: return "A vertical blank is in progress.";
case DDERR_WASSTILLDRAWING
: return "The previous blit operation that is transferring information to or from this surface is incomplete.";
case DDERR_WRONGMODE
: return "This surface cannot be restored because it was created in a different mode.";
case DDERR_XALIGN
: return "The provided rectangle was not horizontally aligned on a required boundary.";
default
: return "Unrecognized error value.\0";
}
}
+3 -3
View File
@@ -9,9 +9,9 @@ extern "C" {
// local functions
STR8 DirectXErrorDescription ( INT32 iDXReturn );
void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, STR8 szFilename );
void DirectXAssert ( BOOLEAN fValue, INT32 nLine, STR8 szFilename );
void DirectXZeroMem ( void* pMemory, int nSize );
void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, STR8 szFilename );
void DirectXAssert ( BOOLEAN fValue, INT32 nLine, STR8 szFilename );
void DirectXZeroMem ( void* pMemory, int nSize );
#undef ATTEMPT
#define ATTEMPT(x) DirectXAttempt ((x),__LINE__,__FILE__)
+223 -223
View File
@@ -13,74 +13,74 @@
UINT16 gsKeyTranslationTable[1024] =
{
0, //
1, //
2, //
3, //
4, //
5, //
6, //
7, //
8, // BACK
9, // TAB
10, //
11, //
12, //
13, // ENTER
14, //
15, //
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
21, //
22, //
23, //
24, //
25, //
26, //
27, // ESC
28, //
29, //
30, //
31, //
32, // SPACE
33, //
34, //
35, //
36, //
37, //
38, //
39, //
40, //
41, //
42, //
43, //
44, //
45, //
46, //
47, //
48, // 0
49, // 1
50, // 2
51, // 3
52, // 4
53, // 5
54, // 6
55, // 7
56, // 8
57, // 9
58, //
59, //
60, //
61, //
62, //
63, //
64, //
97, // a
98, // b
99, // c
0, //
1, //
2, //
3, //
4, //
5, //
6, //
7, //
8, // BACK
9, // TAB
10, //
11, //
12, //
13, // ENTER
14, //
15, //
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
21, //
22, //
23, //
24, //
25, //
26, //
27, // ESC
28, //
29, //
30, //
31, //
32, // SPACE
33, //
34, //
35, //
36, //
37, //
38, //
39, //
40, //
41, //
42, //
43, //
44, //
45, //
46, //
47, //
48, // 0
49, // 1
50, // 2
51, // 3
52, // 4
53, // 5
54, // 6
55, // 7
56, // 8
57, // 9
58, //
59, //
60, //
61, //
62, //
63, //
64, //
97, // a
98, // b
99, // c
100, // d
101, // e
102, // f
@@ -104,27 +104,27 @@ UINT16 gsKeyTranslationTable[1024] =
120, // x
121, // y
122, // z
91, //
92, //
93, //
94, //
95, //
96, //
97, //
98, //
99, //
91, //
92, //
93, //
94, //
95, //
96, //
97, //
98, //
99, //
100, //
101, //
102, //
103, //
104, //
105, //
42, // NUM_TIMES
43, // NUM_PLUS
42, // NUM_TIMES
43, // NUM_PLUS
108, //
45, // NUM_MINUS
45, // NUM_MINUS
110, //
47, // NUM_SLASH
47, // NUM_SLASH
124, // F1
125, // F2
126, // F3
@@ -199,13 +199,13 @@ UINT16 gsKeyTranslationTable[1024] =
183, //
184, //
185, //
59, // ;
61, // =
44, // ,
45, // -
46, // .
47, // slash
96, // `
59, // ;
61, // =
44, // ,
45, // -
46, // .
47, // slash
96, // `
193, //
194, //
195, //
@@ -232,28 +232,28 @@ UINT16 gsKeyTranslationTable[1024] =
216, //
217, //
218, //
91, // [
92, // back slash
93, // ]
39, // '
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
91, // [
92, // back slash
93, // ]
39, // '
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
245, // NUM_0 (OFF)
246, // NUM_PERIOD (OFF)
247, // NUM_1 (OFF)
248, // NUM_2 (OFF)
249, // NUM_3 (OFF)
250, // NUM_4 (OFF)
0, // NUM_5 (OFF)
0, // NUM_5 (OFF)
251, // NUM_6 (OFF)
252, // NUM_7 (OFF)
253, // NUM_8 (OFF)
@@ -277,31 +277,31 @@ UINT16 gsKeyTranslationTable[1024] =
261, //
262, //
263, //
8, // BACK
8, // BACK
265, // TAB
266, //
267, //
268, //
13, // ENTER
13, // ENTER
270, //
271, //
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
277, //
278, //
279, //
280, //
281, //
282, //
27, // ESC
27, // ESC
284, //
285, //
286, //
287, //
32, // SPACE
32, // SPACE
289, //
290, //
291, //
@@ -317,16 +317,16 @@ UINT16 gsKeyTranslationTable[1024] =
301, //
302, //
303, //
41, // )
33, // !
64, // @
35, // #
36, // $
37, // %
94, // ^
38, // &
42, // *
40, // (
41, // )
33, // !
64, // @
35, // #
36, // $
37, // %
94, // ^
38, // &
42, // *
40, // (
314, //
315, //
316, //
@@ -334,32 +334,32 @@ UINT16 gsKeyTranslationTable[1024] =
318, //
319, //
320, //
65, // A
66, // B
67, // C
68, // D
69, // E
70, // F
71, // G
72, // H
73, // I
74, // J
75, // K
76, // L
77, // M
78, // N
79, // O
80, // P
81, // Q
82, // R
83, // S
84, // T
85, // U
86, // V
87, // W
88, // X
89, // Y
90, // Z
65, // A
66, // B
67, // C
68, // D
69, // E
70, // F
71, // G
72, // H
73, // I
74, // J
75, // K
76, // L
77, // M
78, // N
79, // O
80, // P
81, // Q
82, // R
83, // S
84, // T
85, // U
86, // V
87, // W
88, // X
89, // Y
90, // Z
347, //
348, //
349, //
@@ -375,12 +375,12 @@ UINT16 gsKeyTranslationTable[1024] =
359, //
360, //
361, //
42, // NUM_TIMES
43, // NUM_PLUS
42, // NUM_TIMES
43, // NUM_PLUS
364, //
45, // NUM_MINUS
45, // NUM_MINUS
366, //
47, // NUM_SLASH
47, // NUM_SLASH
368, // SHIFT-F1
369, // SHIFT-F2
370, // SHIFT-F3
@@ -455,12 +455,12 @@ UINT16 gsKeyTranslationTable[1024] =
439, //
440, //
441, //
58, // :
43, // +
60, // <
95, // _
62, // >
63, // ?
58, // :
43, // +
60, // <
95, // _
62, // >
63, // ?
126, // ~
449, //
450, //
@@ -491,25 +491,25 @@ UINT16 gsKeyTranslationTable[1024] =
123, // {
124, // |
125, // }
34, // "
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
34, // "
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
501, // SHIFT-NUM_0 (OFF)
502, // SHIFT-NUM_PERIOD (OFF)
503, // SHIFT-NUM_1 (OFF)
504, // SHIFT-NUM_2 (OFF)
505, // SHIFT-NUM_3 (OFF)
506, // SHIFT-NUM_4 (OFF)
0, // SHIFT-NUM_5 (OFF)
0, // SHIFT-NUM_5 (OFF)
507, // SHIFT-NUM_6 (OFF)
508, // SHIFT-NUM_7 (OFF)
509, // SHIFT-NUM_8 (OFF)
@@ -533,31 +533,31 @@ UINT16 gsKeyTranslationTable[1024] =
517, //
518, //
519, //
8, // BACK
8, // BACK
521, // TAB
522, //
523, //
524, //
13, // ENTER
13, // ENTER
526, //
527, //
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
533, //
534, //
535, //
536, //
537, //
538, //
27, // ESC
27, // ESC
540, //
541, //
542, //
543, //
32, // SPACE
32, // SPACE
545, //
546, //
547, //
@@ -631,12 +631,12 @@ UINT16 gsKeyTranslationTable[1024] =
615, //
616, //
617, //
42, // NUM_TIMES
43, // NUM_PLUS
42, // NUM_TIMES
43, // NUM_PLUS
620, //
45, // NUM_MINUS
45, // NUM_MINUS
622, //
47, // NUM_SLASH
47, // NUM_SLASH
624, // ALT-F1
625, // ALT-F2
626, // ALT-F3
@@ -748,24 +748,24 @@ UINT16 gsKeyTranslationTable[1024] =
732, //
733, //
734, //
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
757, // ALT-NUM_0 (OFF)
758, // ALT-NUM_PERIOD (OFF)
759, // ALT-NUM_1 (OFF)
760, // ALT-NUM_2 (OFF)
761, // ALT-NUM_3 (OFF)
762, // ALT-NUM_4 (OFF)
0, // ALT-NUM_5 (OFF)
0, // ALT-NUM_5 (OFF)
763, // ALT-NUM_6 (OFF)
764, // ALT-NUM_7 (OFF)
765, // ALT-NUM_8 (OFF)
@@ -789,31 +789,31 @@ UINT16 gsKeyTranslationTable[1024] =
773, //
774, //
775, //
8, // BACK
8, // BACK
777, // TAB
778, //
779, //
780, //
13, // ENTER
13, // ENTER
782, //
783, //
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
16, // SHIFT
17, // CTRL
18, // ALT
19, // PAUSE
20, // CAPS
789, //
790, //
791, //
792, //
793, //
794, //
27, // ESC
27, // ESC
796, //
797, //
798, //
799, //
32, // SPACE
32, // SPACE
801, //
802, //
803, //
@@ -887,12 +887,12 @@ UINT16 gsKeyTranslationTable[1024] =
871, //
872, //
873, //
42, // NUM_TIMES
43, // NUM_PLUS
42, // NUM_TIMES
43, // NUM_PLUS
876, //
45, // NUM_MINUS
45, // NUM_MINUS
878, //
47, // NUM_SLASH
47, // NUM_SLASH
880, // CTRL-F1
881, // CTRL-F2
882, // CTRL-F3
@@ -1004,24 +1004,24 @@ UINT16 gsKeyTranslationTable[1024] =
988, //
989, //
990, //
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
48, // NUM_0 (ON)
46, // NUM_PERIOD (ON)
49, // NUM_1 (ON)
50, // NUM_2 (ON)
51, // NUM_3 (ON)
52, // NUM_4 (ON)
53, // NUM_5 (ON)
54, // NUM_6 (ON)
55, // NUM_7 (ON)
56, // NUM_8 (ON)
57, // NUM_9 (ON)
1013, // CTRL-NUM_0 (OFF)
1014, // CTRL-NUM_PERIOD (OFF)
1015, // CTRL-NUM_1 (OFF)
1016, // CTRL-NUM_2 (OFF)
1017, // CTRL-NUM_3 (OFF)
1018, // CTRL-NUM_4 (OFF)
0, // CTRL-NUM_5 (OFF)
0, // CTRL-NUM_5 (OFF)
1019, // CTRL-NUM_6 (OFF)
1020, // CTRL-NUM_7 (OFF)
1021, // CTRL-NUM_8 (OFF)
@@ -1036,5 +1036,5 @@ UINT16 gsKeyTranslationTable[1024] =
1020, // CTRL-HOME
1021, // CTRL-UP
1022, // CTRL-PGUP
1023 // CURSOR
1023 // CURSOR
};
+10 -10
View File
@@ -43,7 +43,7 @@ const int StackColumns = 8; // Number of columns in stack dump.
//ppp
void ErrorLog(HWFILE LogFile, STR8 Format, ...);
void ErrorLog(HWFILE LogFile, STR8 Format, ...);
STR GetExceptionString( DWORD uiExceptionCode );
void DisplayRegisters( HWFILE hFile, CONTEXT *pContext );
BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext );
@@ -73,7 +73,7 @@ INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo )
//
// Open a file to output the current state of the game
// Open a file to output the current state of the game
//
@@ -103,7 +103,7 @@ INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo )
#ifdef JA2
//Dispay Ja's version number
ErrorLog( hFile, "%S: %s. %S",zVersionLabel, czVersionNumber, zTrackingNumber );
ErrorLog( hFile, "%S: %s. %S",zVersionLabel, czVersionNumber, zTrackingNumber );
//Insert a new line
ErrorLog( hFile, zNewLine );
@@ -198,7 +198,7 @@ INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo )
void ErrorLog( HWFILE hFile, STR8 Format, ...)
void ErrorLog( HWFILE hFile, STR8 Format, ...)
{
char buffer[2000]; // wvsprintf never prints more than one K.
UINT32 uiNumBytesWritten=0;
@@ -355,7 +355,7 @@ BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext )
//
// This code for this function is based ( stolen ) from Bruce Dawson's article in Game Developer Magazine Jan 99
//
BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext )
BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext )
{
int Count = 0;
char buffer[1000] = "";
@@ -464,7 +464,7 @@ void PrintTime(STR8 output, FILETIME TimeToPrint)
void RecordModuleList(HWFILE hFile )
{
ErrorLog( hFile, "\r\n"
"Module list: names, addresses, sizes, time stamps "
"Module list: names, addresses, sizes, time stamps "
"and file times:\r\n");
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
@@ -520,12 +520,12 @@ static void ShowModuleInfo(HWFILE hFile, HINSTANCE ModuleHandle)
// be a valid code module address. Therefore we can try to walk
// our way through its structures to find the link time stamp.
IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle;
if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic)
return;
if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic)
return;
IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((STR8 )DosHeader
+ DosHeader->e_lfanew);
if (IMAGE_NT_SIGNATURE != NTHeader->Signature)
return;
if (IMAGE_NT_SIGNATURE != NTHeader->Signature)
return;
// Open the code module file so that we can get its file date
// and size.
HANDLE ModuleFile = CreateFile(ModName, GENERIC_READ,
+1 -1
View File
@@ -45,4 +45,4 @@ private:
void TraverseDir(std::string dir, int depth = -1);
};
#endif // FILECAT_H
#endif // FILECAT_H
+134 -136
View File
@@ -6,16 +6,16 @@
//
// Modification history :
//
// 24sep96:HJH -> creation
// 08Apr97:ARM -> Assign return value from Push() calls back to HStack
// handle, because it may possibly do a MemRealloc()
// 24sep96:HJH ->creation
// 08Apr97:ARM ->Assign return value from Push() calls back to HStack
// handle, because it may possibly do a MemRealloc()
// 29Dec97:Kris Morness
// -> Added functionality for setting file attributes which
// allows for read-only attribute overriding
// -> Also added a simple function that clears all file attributes
// to normal.
// ->Added functionality for setting file attributes which
// allows for read-only attribute overriding
// ->Also added a simple function that clears all file attributes
// to normal.
//
// 5 Feb 98:Dave French -> extensive modification to support libraries
// 5 Feb 98:Dave French->extensive modification to support libraries
//
//**************************************************************************
@@ -54,9 +54,9 @@
#define FILENAME_LENGTH 600
#define CHECKF(exp) if (!(exp)) { return(FALSE); }
#define CHECKV(exp) if (!(exp)) { return; }
#define CHECKN(exp) if (!(exp)) { return(NULL); }
#define CHECKF(exp) if (!(exp)) { return(FALSE); }
#define CHECKV(exp) if (!(exp)) { return; }
#define CHECKN(exp) if (!(exp)) { return(NULL); }
#define CHECKBI(exp) if (!(exp)) { return(-1); }
#define PRINT_DEBUG_INFO FileDebugPrint();
@@ -119,8 +119,8 @@ HANDLE hFindInfoHandle[20] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE,
// Snap: At program launch we build two directory catalogues:
// one for the default Data directory, the other for the custom Data directory.
TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
//**************************************************************************
//
@@ -153,10 +153,10 @@ INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *, HANDLE hFile, WIN32_FIND_
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
BOOLEAN InitializeFileManager( STR strIndexFilename )
BOOLEAN InitializeFileManager( STR strIndexFilename )
{
RegisterDebugTopic( TOPIC_FILE_MANAGER, "File Manager" );
return( TRUE );
@@ -174,7 +174,7 @@ BOOLEAN InitializeFileManager( STR strIndexFilename )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -195,7 +195,7 @@ void ShutdownFileManager( void )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -212,27 +212,27 @@ void FileDebug( BOOLEAN f )
//
// Parameter List :
//
// STR -> name of file to check existence of
// STR ->name of file to check existence of
//
// Return Value :
//
// BOOLEAN -> TRUE if it exists
// -> FALSE if not
// BOOLEAN ->TRUE if it exists
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
// Oct 2005: Snap - Rewrote, made to check data catalogues
// Oct 2005: Snap - Rewrote, made to check data catalogues
//
//**************************************************************************
BOOLEAN FileExists( STR strFilename )
{
// First check to see if it's in a library (most files should be there)
if ( gFileDataBase.fInitialized &&
CheckIfFileExistInLibrary( strFilename ) ) return TRUE;
CheckIfFileExistInLibrary( strFilename ) ) return TRUE;
// ... then check if it's in the custom Data directory
if ( gCustomDataCat.FindFile(strFilename) ) return TRUE;
@@ -256,18 +256,18 @@ BOOLEAN FileExists( STR strFilename )
//
// Parameter List :
//
// STR -> name of file to check existence of
// STR ->name of file to check existence of
//
// Return Value :
//
// BOOLEAN -> TRUE if it exists
// -> FALSE if not
// BOOLEAN ->TRUE if it exists
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// Oct 2005: Snap - Rewrote, made to check data catalogues
// Oct 2005: Snap - Rewrote, made to check data catalogues
//
//**************************************************************************
extern BOOLEAN FileExistsNoDB( STR strFilename )
@@ -294,16 +294,16 @@ extern BOOLEAN FileExistsNoDB( STR strFilename )
//
// Parameter List :
//
// STR -> name of file to delete
// STR ->name of file to delete
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
BOOLEAN FileDelete( STR strFilename )
@@ -324,21 +324,21 @@ BOOLEAN FileDelete( STR strFilename )
//
// Parameter List :
//
// STR -> filename
// UIN32 -> access - read or write, or both
// BOOLEAN -> delete on close
// STR ->filename
// UIN32 ->access - read or write, or both
// BOOLEAN ->delete on close
//
// Return Value :
//
// HWFILE -> handle of opened file
// HWFILE ->handle of opened file
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
// Oct 2005: Snap - modified to work with the custom Data directory
// Oct 2005: Snap - modified to work with the custom Data directory
//
//**************************************************************************
HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
@@ -379,7 +379,7 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
filePath = gCustomDataCat.GetRootDir() + '\\';
}
filePath += strFilename;
// Bad cast! strFilename should have been const. Oh well...
// Bad cast! strFilename should have been const. Oh well...
strFilename = const_cast<STR>( filePath.c_str() );
// Now strFilename points either to the original file name,
// or to the full file path in the custom Data directory.
@@ -427,7 +427,7 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
else
{
//If the file is in the library, get a handle to it.
hLibFile = OpenFileFromLibrary( strFilename );
hLibFile = OpenFileFromLibrary( strFilename );
//tried to open a file that wasnt in the database
if( !hLibFile )
@@ -494,12 +494,12 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
//
// Parameter List :
//
// HWFILE hFile -> handle to file to close
// HWFILE hFile ->handle to file to close
//
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -545,20 +545,20 @@ void FileClose( HWFILE hFile )
//
// Parameter List :
//
// HWFILE -> handle to file to read from
// void * -> source buffer
// UINT32 -> num bytes to read
// UINT32 -> num bytes read
// HWFILE ->handle to file to read from
// void * ->source buffer
// UINT32 ->num bytes to read
// UINT32 ->num bytes read
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 08Dec97:ARM -> return FALSE if bytes to read != bytes read
// 24sep96:HJH ->creation
// 08Dec97:ARM ->return FALSE if bytes to read != bytes read
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -650,20 +650,20 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
//
// Parameter List :
//
// HWFILE -> handle to file to write to
// void * -> destination buffer
// UINT32 -> num bytes to write
// UINT32 -> num bytes written
// HWFILE ->handle to file to write to
// void * ->destination buffer
// UINT32 ->num bytes to write
// UINT32 ->num bytes written
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 08Dec97:ARM -> return FALSE if dwNumBytesToWrite != dwNumBytesWritten
// 24sep96:HJH ->creation
// 08Dec97:ARM ->return FALSE if dwNumBytesToWrite != dwNumBytesWritten
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -718,13 +718,13 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 08Dec97:ARM -> return FALSE if bytes to read != bytes read (CHECKF is inappropriate?)
// 24sep96:HJH ->creation
// 08Dec97:ARM ->return FALSE if bytes to read != bytes read (CHECKF is inappropriate?)
//
//**************************************************************************
@@ -762,28 +762,27 @@ BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiB
//
// Parameter List :
//
// HWFILE -> handle to file to seek in
// ... -> arguments, 1st of which should be a string
// HWFILE ->handle to file to seek in
// ... ->arguments, 1st of which should be a string
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
//**************************************************************************
#ifndef DIM
# define DIM(x) (sizeof(x)/sizeof(x[0])) /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */
# define DIM(x) (sizeof(x)/sizeof(x[0])) /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */
#endif
BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
{
CHAR8 strToSend[160]; /* itemdescription of item 0 will NOT fit if only 80 Chars per Line!, Sergeant_Kolja, 2007-06-10 */
va_list argptr;
@@ -799,7 +798,7 @@ BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
{
va_start(argptr, strFormatted);
_vsnprintf( strToSend, DIM(strToSend), strFormatted, argptr ); /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */
strToSend[ DIM(strToSend)-1 ] = 0;
strToSend[ DIM(strToSend)-1 ] = 0;
va_end(argptr);
fRetVal = FileWrite( hFile, strToSend, strlen(strToSend), NULL );
@@ -821,18 +820,18 @@ BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
//
// Parameter List :
//
// HWFILE -> handle to file to seek in
// UINT32 -> distance to seek
// UINT8 -> how to seek
// HWFILE ->handle to file to seek in
// UINT32 ->distance to seek
// UINT8 ->how to seek
//
// Return Value :
//
// BOOLEAN -> TRUE if successful
// -> FALSE if not
// BOOLEAN ->TRUE if successful
// ->FALSE if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -892,16 +891,16 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
//
// Parameter List :
//
// HWFILE -> handle to file
// HWFILE ->handle to file
//
// Return Value :
//
// INT32 -> current offset in file if successful
// -> -1 if not
// INT32 ->current offset in file if successful
// ->-1 if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -955,16 +954,16 @@ INT32 FileGetPos( HWFILE hFile )
//
// Parameter List :
//
// HWFILE -> handle to file
// HWFILE ->handle to file
//
// Return Value :
//
// INT32 -> file size in file if successful
// -> 0 if not
// INT32 ->file size in file if successful
// ->0 if not
//
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -972,7 +971,7 @@ INT32 FileGetPos( HWFILE hFile )
UINT32 FileGetSize( HWFILE hFile )
{
HANDLE hRealHandle;
HANDLE hRealHandle;
UINT32 uiFileSize = 0xFFFFFFFF;
INT16 sLibraryID;
@@ -1012,7 +1011,7 @@ UINT32 FileGetSize( HWFILE hFile )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
@@ -1030,7 +1029,7 @@ void FileDebugPrint( void )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
// 9 Feb 98 DEF - modified to work with the library system
//
@@ -1071,7 +1070,7 @@ HANDLE GetHandleToRealFile( HWFILE hFile, BOOLEAN *pfDatabaseFile )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
/*
@@ -1134,7 +1133,7 @@ HWFILE CreateFileHandle( HANDLE hRealFile, BOOLEAN fDatabaseFile )
// Return Value :
// Modification history :
//
// 24sep96:HJH -> creation
// 24sep96:HJH ->creation
//
//**************************************************************************
/*
@@ -1160,7 +1159,7 @@ void DestroyFileHandle( HWFILE hFile )
// Return Value :
// Modification history :
//
// ??nov96:HJH -> creation
// ??nov96:HJH ->creation
//
//**************************************************************************
@@ -1261,7 +1260,7 @@ void BuildFileDirectory( void )
// Return Value :
// Modification history :
//
// ??nov96:HJH -> creation
// ??nov96:HJH ->creation
//
//**************************************************************************
@@ -1310,7 +1309,7 @@ INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_F
BOOLEAN SetFileManCurrentDirectory( STR pcDirectory )
{
return( SetCurrentDirectory( pcDirectory ) );
return( SetCurrentDirectory( pcDirectory ) );
}
@@ -1338,7 +1337,7 @@ BOOLEAN DirectoryExists( STRING512 pcDirectory )
if (uiLastError != ERROR_FILE_NOT_FOUND)
{
FastDebugMsg(String("DirectoryExists: ERROR - GetFileAttributes failed, error #%d on file %s", uiLastError, pcDirectory));
FastDebugMsg(String("DirectoryExists: ERROR - GetFileAttributes failed, error #%d on file %s", uiLastError, pcDirectory));
}
}
else
@@ -1385,7 +1384,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
//If there are files in the directory, DELETE THEM
SearchHandle = FindFirstFile( pFileSpec, &sFindData);
if( SearchHandle != INVALID_HANDLE_VALUE )
if( SearchHandle != INVALID_HANDLE_VALUE )
{
fDone = FALSE;
@@ -1403,7 +1402,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
{
if (!RemoveFileManDirectory(zSubdirectory, TRUE))
{
FastDebugMsg(String("RemoveFileManDirectory: ERROR - Recursive call on %s failed", zSubdirectory));
FastDebugMsg(String("RemoveFileManDirectory: ERROR - Recursive call on %s failed", zSubdirectory));
break;
}
}
@@ -1447,7 +1446,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Removes ALL FILES in the specified directory but leaves the directory alone. Does not affect any subdirectories!
// Removes ALL FILES in the specified directory but leaves the directory alone. Does not affect any subdirectories!
// Use RemoveFilemanDirectory() to also delete the directory itself, or to recursively delete subdirectories.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOLEAN EraseDirectory( STRING512 pcDirectory)
@@ -1468,7 +1467,7 @@ BOOLEAN EraseDirectory( STRING512 pcDirectory)
//If there are files in the directory, DELETE THEM
SearchHandle = FindFirstFile( pFileSpec, &sFindData);
if( SearchHandle != INVALID_HANDLE_VALUE )
if( SearchHandle != INVALID_HANDLE_VALUE )
{
fDone = FALSE;
@@ -1523,8 +1522,8 @@ BOOLEAN GetExecutableDirectory( STRING512 pcDirectory )
{
if ( pcDirectory[ cnt ] == '\\' )
{
pcDirectory[ cnt ] = '\0';
break;
pcDirectory[ cnt ] = '\0';
break;
}
}
@@ -1663,20 +1662,20 @@ BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists)
// open source file
hFile = FileOpen(strSrcFile, FILE_ACCESS_READ, FALSE);
if (hFile == 0)
{
FastDebugMsg(String("FileCopy: FileOpen failed on Src file %s", strSrcFile));
return(FALSE);
}
hFile = FileOpen(strSrcFile, FILE_ACCESS_READ, FALSE);
if (hFile == 0)
{
FastDebugMsg(String("FileCopy: FileOpen failed on Src file %s", strSrcFile));
return(FALSE);
}
// get its size
uiSize = FileGetSize(hFile);
if (uiSize == 0)
{
FastDebugMsg(String("FileCopy: size is 0, Src file %s", strSrcFile));
FileClose(hFile);
return(FALSE);
FastDebugMsg(String("FileCopy: size is 0, Src file %s", strSrcFile));
FileClose(hFile);
return(FALSE);
}
// allocate a buffer big enough to hold the entire file
@@ -1684,44 +1683,44 @@ BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists)
if (pBuffer == NULL)
{
FastDebugMsg(String("FileCopy: ERROR - MemAlloc pBuffer failed, size %d", uiSize));
FileClose(hFile);
FileClose(hFile);
return(FALSE);
}
// read the file into memory
if (!FileRead(hFile, pBuffer, uiSize, &uiBytesRead))
{
FastDebugMsg(String("FileCopy: FileRead failed, file %s", strSrcFile));
FileClose(hFile);
return(FALSE);
}
if (!FileRead(hFile, pBuffer, uiSize, &uiBytesRead))
{
FastDebugMsg(String("FileCopy: FileRead failed, file %s", strSrcFile));
FileClose(hFile);
return(FALSE);
}
// close source file
FileClose(hFile);
FileClose(hFile);
// open destination file
hFile = FileOpen(strDstFile, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE);
if (hFile == 0)
{
FastDebugMsg(String("FileCopy: FileOpen failed on Dst file %s", strDstFile));
return(FALSE);
}
hFile = FileOpen(strDstFile, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE);
if (hFile == 0)
{
FastDebugMsg(String("FileCopy: FileOpen failed on Dst file %s", strDstFile));
return(FALSE);
}
// write buffer to the destination file
if (!FileWrite(hFile, pBuffer, uiSize, &uiBytesWritten))
{
FastDebugMsg(String("FileCopy: FileWrite failed, file %s", strDstFile));
FileClose(hFile);
return(FALSE);
}
if (!FileWrite(hFile, pBuffer, uiSize, &uiBytesWritten))
{
FastDebugMsg(String("FileCopy: FileWrite failed, file %s", strDstFile));
FileClose(hFile);
return(FALSE);
}
// close destination file
FileClose(hFile);
FileClose(hFile);
MemFree(pBuffer);
pBuffer = NULL;
MemFree(pBuffer);
pBuffer = NULL;
return(TRUE);
*/
}
@@ -1814,7 +1813,6 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile )
UINT32 uiFileNum;
HANDLE hRealFile;
// UINT8 Data;
UINT32 uiNumberOfBytesRead=0;
UINT32 uiOldFilePtrLoc=0;
UINT32 uiEndOfFilePtrLoc=0;
UINT32 temp=0;
@@ -1998,7 +1996,7 @@ HANDLE GetRealFileHandleFromFileManFileHandle( HWFILE hFile )
// Return Value :
// Modification history :
//
// 10June98:DB -> creation
// 10June98:DB ->creation
//
//**************************************************************************
BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory)
@@ -2060,8 +2058,8 @@ UINT32 uiPathLen;
UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( )
{
STRING512 zExecDir;
STRING512 zDrive;
STRING512 zExecDir;
STRING512 zDrive;
STRING512 zDir;
STRING512 zFileName;
STRING512 zExt;
+8 -8
View File
@@ -31,10 +31,10 @@
//
//**************************************************************************
#define MAX_FILENAME_LEN 48
#define MAX_FILENAME_LEN 48
#define FILE_ACCESS_READ 0x01
#define FILE_ACCESS_WRITE 0x02
#define FILE_ACCESS_READ 0x01
#define FILE_ACCESS_WRITE 0x02
#define FILE_ACCESS_READWRITE 0x03
#define FILE_CREATE_NEW 0x0010 // create new file. fail if exists
@@ -84,8 +84,8 @@ typedef FILETIME SGP_FILETIME;
// Snap: At program launch we build two directory catalogues:
// one for the default Data directory, the other for the custom Data directory.
extern TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
extern TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
extern TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
extern TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
//**************************************************************************
//
@@ -98,7 +98,7 @@ extern "C" {
#endif
*/
extern BOOLEAN InitializeFileManager( STR strIndexFilename );
extern BOOLEAN InitializeFileManager( STR strIndexFilename );
extern void ShutdownFileManager( void );
extern void FileDebug( BOOLEAN f );
@@ -115,7 +115,7 @@ extern BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *
extern BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten );
extern BOOLEAN FileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead );
extern BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... );
extern BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... );
extern BOOLEAN FileSeek( HWFILE, UINT32 uiDistance, UINT8 uiHow );
extern INT32 FileGetPos( HWFILE );
@@ -187,7 +187,7 @@ BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory);
//Gets the amount of free space on the hard drive that the main executeablt is runnning from
UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( );
//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ )
//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ )
UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter );
/*
+82 -85
View File
@@ -20,8 +20,8 @@
// ???:David Smoth - ???
// ???:Bret Rowdon for RIO/GORGE - added 640x480 SVGA support
// 05-11jun96:HJH - added routines for bitmap use, and
// other utilities
// 08-May-97 ARM Adapted for Win95 Standard Gaming Platform
// other utilities
// 08-May-97 ARM Adapted for Win95 Standard Gaming Platform
//
//**************************************************************************
@@ -31,7 +31,6 @@
//
//**************************************************************************
//#include "stdafx.h"
#include <conio.h>
#include "flic.h"
#include "windows.h"
@@ -226,7 +225,7 @@ static void screen_repeat_two(FlicScreen *s, int x, int y, Pixels2 pixels2, int
count <<= 1; // Convert from word to pixel count.
if (!line_clip(s, &x, &y, &count))
return;
is_odd = (count&1); // Did it turn odd after clipping? Ack!
is_odd = (count&1); // Did it turn odd after clipping? Ack!
count >>= 1; // Convert back to word count.
// Calculate start screen address.
@@ -246,7 +245,7 @@ static void screen_repeat_two(FlicScreen *s, int x, int y, Pixels2 pixels2, int
//
// screen_put_colors
//
// Set count colors in color map starting at start. RGB values
// Set count colors in color map starting at start. RGB values
// go from 0 to 255.
//
// Parameter List :
@@ -279,7 +278,7 @@ static void screen_put_colors(FlicScreen *s, int start, Colour *colors, int coun
//
// screen_put_colors_64
//
// Set count colors in color map starting at start. RGB values
// Set count colors in color map starting at start. RGB values
// go from 0 to 64. */
//
// Parameter List :
@@ -325,13 +324,13 @@ static void screen_put_colors_64(FlicScreen *s, int start, Colour *colors, int c
//
//**************************************************************************
static void decode_byte_run(Uchar *data, Flic *flic)
static void decode_byte_run(Uchar *data, Flic *flic)
{
int x,y;
int width = flic->head.width;
int height = flic->head.height;
int psize; // was char -> HJH
Char *cpt = (Char *)data;
Char *cpt = (Char *)data;
int end;
y = flic->yoff;
@@ -375,12 +374,12 @@ static void decode_byte_run(Uchar *data, Flic *flic)
//
//**************************************************************************
static void decode_delta_fli(Uchar *data, Flic *flic)
static void decode_delta_fli(Uchar *data, Flic *flic)
{
int xorg = flic->xoff;
int yorg = flic->yoff;
Short *wpt = (Short *)data;
Uchar *cpt = (Uchar *)(wpt + 2);
Short *wpt = (Short *)data;
Uchar *cpt = (Uchar *)(wpt + 2);
int x,y;
Short lines;
Uchar opcount;
@@ -419,7 +418,7 @@ static void decode_delta_fli(Uchar *data, Flic *flic)
//
// decode_delta_flc
//
// Flc-style delta decompression. The data is word oriented though
// Flc-style delta decompression. The data is word oriented though
// a lot of the control info (how to skip, how many words to
// copy) are byte oriented still to save space.
//
@@ -433,7 +432,7 @@ static void decode_delta_fli(Uchar *data, Flic *flic)
//
//**************************************************************************
static void decode_delta_flc(Uchar *data, Flic *flic)
static void decode_delta_flc(Uchar *data, Flic *flic)
{
int xorg = flic->xoff;
int yorg = flic->yoff;
@@ -442,7 +441,7 @@ static void decode_delta_flc(Uchar *data, Flic *flic)
Short lp_count;
Short opcount;
int psize;
union {Short *w; Uchar *ub; Char *b; Pixels2 *p2;} wpt;
union {Short *w; Uchar *ub; Char *b; Pixels2 *p2;} wpt;
int lastx;
@@ -504,7 +503,7 @@ OUTT:
//
// decode_black
//
// Decode a BLACK chunk. Set frame to solid color 0 one
// Decode a BLACK chunk. Set frame to solid color 0 one
// line at a time.
//
// Parameter List :
@@ -517,7 +516,7 @@ OUTT:
//
//**************************************************************************
static void decode_black(Uchar *data, Flic *flic)
static void decode_black(Uchar *data, Flic *flic)
{
Pixels2 black;
int i;
@@ -539,7 +538,7 @@ static void decode_black(Uchar *data, Flic *flic)
//
// decode_literal
//
// Decode a LITERAL chunk. Just copy data to screen one line at
// Decode a LITERAL chunk. Just copy data to screen one line at
// a time.
//
// Parameter List :
@@ -552,7 +551,7 @@ static void decode_black(Uchar *data, Flic *flic)
//
//**************************************************************************
static void decode_literal(Uchar *data, Flic *flic)
static void decode_literal(Uchar *data, Flic *flic)
{
int i;
int height = flic->head.height;
@@ -570,16 +569,16 @@ static void decode_literal(Uchar *data, Flic *flic)
typedef void ColorOut(FlicScreen *s, int start, Colour *colors, int count);
/* This is the type of output parameter to our decode_color below.
* Not coincedently screen_put_color is of this type. */
* Not coincedently screen_put_color is of this type. */
//**************************************************************************
//
// decode_color
//
// Decode color map. Put results into output. The two color
// Decode color map. Put results into output. The two color
// compressions are identical except for whether the RGB values
// are 0-63 or 0-255. Passing in an output that does the appropriate
// are 0-63 or 0-255. Passing in an output that does the appropriate
// shifting on the way to the real pallete lets us use the same
// code for both COLOR_64 and COLOR_256 compression.
//
@@ -594,7 +593,7 @@ typedef void ColorOut(FlicScreen *s, int start, Colour *colors, int count);
//
//**************************************************************************
static void decode_color(Uchar *data, Flic *flic, ColorOut *output)
static void decode_color(Uchar *data, Flic *flic, ColorOut *output)
{
int start = 0;
Uchar *cbuf = (Uchar *)data;
@@ -631,7 +630,7 @@ static void decode_color(Uchar *data, Flic *flic, ColorOut *output)
//
//**************************************************************************
static void decode_color_256(Uchar *data, Flic *flic)
static void decode_color_256(Uchar *data, Flic *flic)
{
decode_color(data, flic, screen_put_colors);
}
@@ -652,7 +651,7 @@ static void decode_color_256(Uchar *data, Flic *flic)
//
//**************************************************************************
static void decode_color_64(Uchar *data, Flic *flic)
static void decode_color_64(Uchar *data, Flic *flic)
{
decode_color(data, flic, screen_put_colors_64);
}
@@ -676,40 +675,40 @@ static void decode_color_64(Uchar *data, Flic *flic)
//
//**************************************************************************
static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data)
static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data)
{
int i;
ChunkHead *chunk;
for (i=0; i<frame->chunks; ++i)
{
chunk = (ChunkHead *)data;
chunk = (ChunkHead *)data;
data += chunk->size;
switch (chunk->type)
{
case COLOR_256:
if (flic->screen.change_palette)
//decode_color_256((Uchar *)(chunk+1), flic);
decode_color_256( (((Uchar *)chunk) + 4 ), flic);
//decode_color_256((Uchar *)(chunk+1), flic);
decode_color_256( (((Uchar *)chunk) + 4 ), flic);
break;
case DELTA_FLC:
decode_delta_flc((Uchar *)(chunk+1), flic);
decode_delta_flc((Uchar *)(chunk+1), flic);
break;
case COLOR_64:
if (flic->screen.change_palette)
decode_color_64((Uchar *)(chunk+1), flic);
decode_color_64((Uchar *)(chunk+1), flic);
break;
case DELTA_FLI:
decode_delta_fli((Uchar *)(chunk+1), flic);
decode_delta_fli((Uchar *)(chunk+1), flic);
break;
case BLACK_FRAME:
decode_black((Uchar *)(chunk+1), flic);
decode_black((Uchar *)(chunk+1), flic);
break;
case BYTE_RUN:
decode_byte_run((Uchar *)(chunk+1), flic);
decode_byte_run((Uchar *)(chunk+1), flic);
break;
case LITERAL:
decode_literal((Uchar *)(chunk+1), flic);
decode_literal((Uchar *)(chunk+1), flic);
break;
default:
break;
@@ -719,7 +718,7 @@ static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data)
}
static ErrCode file_read_big_block(FILE *file, char *block, Ulong size)
/* Read in a big block. Could be bigger than 64K. */
/* Read in a big block. Could be bigger than 64K. */
{
char *pt = block;
unsigned size1;
@@ -758,10 +757,10 @@ static ErrCode fill_in_frame2(Flic *flic)
(*flic->seek)(flic, flic->head.oframe1);
if ( fread(&head, sizeof(head), 1, flic->file) != 1 )
return ErrFlicRead;
return ErrFlicRead;
if ( fread(&head, sizeof(head), 1, flic->file) != 1 )
return ErrFlicRead;
return ErrFlicRead;
flic->head.oframe2 = flic->head.oframe1 + head.size;
@@ -790,7 +789,7 @@ static ErrCode flic_next_frame(Flic *flic, BOOL fDecode)
long size;
if ( fread(&head, sizeof(head), 1, flic->file) != 1 )
err = ErrFlicRead;
err = ErrFlicRead;
else
{
if (head.type == FRAME_TYPE)
@@ -802,7 +801,7 @@ static ErrCode flic_next_frame(Flic *flic, BOOL fDecode)
{
//TRACE("FLC chunk too big: %d\n",size);
//Assert(0);
FastDebugMsg(String("flic_next_frame: FLC chunk too big: %d", size));
FastDebugMsg(String("flic_next_frame: FLC chunk too big: %d", size));
size = 64000;
}
if (!(err = file_read_big_block(flic->file, pcxbuf, size)))
@@ -835,7 +834,7 @@ static ErrCode flic_next_frame(Flic *flic, BOOL fDecode)
static Boolean flic_check_frame(Flic *flic)
{
return TRUE;
return TRUE;
}
//**************************************************************************
@@ -846,12 +845,12 @@ static Boolean flic_check_frame(Flic *flic)
static ErrCode flic_open(Flic *flic, const char *filename)
{
return (flic->file = fopen(filename, "rb")) ? 0 : ErrFlicAccess;
return (flic->file = fopen(filename, "rb")) ? 0 : ErrFlicAccess;
}
static ErrCode flic_seek(Flic *flic, long offset)
{
return fseek(flic->file, offset, SEEK_SET) ? ErrFlicSeek : 0;
return fseek(flic->file, offset, SEEK_SET) ? ErrFlicSeek : 0;
}
//**************************************************************************
@@ -871,20 +870,20 @@ static ErrCode flic_seek(Flic *flic, long offset)
void FlicInit(Flic *flic, unsigned screen_width, unsigned screen_height, char change_palette, char *Buff)
{
flic->file = NULL;
//flic->lib.names = NULL;
flic->file = NULL;
//flic->lib.names = NULL;
flic->open = flic_open; /* Set routines for single flick file access */
flic->seek = flic_seek;
flic->open = flic_open; /* Set routines for single flick file access */
flic->seek = flic_seek;
flic->check_frame = flic_check_frame; /* Select a dummy routine */
flic->check_frame = flic_check_frame; /* Select a dummy routine */
/** Info used by low level routines */
/** Info used by low level routines */
flic->screen.pixels = (unsigned char *)Buff; // (char *) 0xa0000;
flic->screen.width = screen_width;
flic->screen.height = screen_height;
flic->screen.change_palette = change_palette;
flic->screen.pixels = (unsigned char *)Buff; // (char *) 0xa0000;
flic->screen.width = screen_width;
flic->screen.height = screen_height;
flic->screen.change_palette = change_palette;
}
//**************************************************************************
@@ -912,7 +911,7 @@ ErrCode FlicOpen(Flic *flic, const char *filename)
if ( !(err = (*flic->open)(flic, filename)) )
{
if (fread(&flic->head, sizeof(flic->head), 1, flic->file) != 1)
err = ErrFlicRead;
err = ErrFlicRead;
else
{
flic->name = filename;
@@ -966,8 +965,8 @@ ErrCode FlicOpen(Flic *flic, const char *filename)
void FlicSetOrigin(Flic *flic, unsigned x, unsigned y)
{
flic->xoff = x;
flic->yoff = y;
flic->xoff = x;
flic->yoff = y;
}
//**************************************************************************
@@ -1024,7 +1023,7 @@ static void flic_play_loop_timer()
}
#ifdef DEBUG
#pragma on (check_stack)
#pragma on (check_stack)
#endif
//**************************************************************************
@@ -1083,16 +1082,16 @@ ErrCode FlicPlay(Flic *flic, Ulong max_loop)
}
for (flic->status.loop_count = 0; !max_loop || flic->status.loop_count < max_loop;
++flic->status.loop_count)
++flic->status.loop_count)
{
// Seek to second frame
(*flic->seek)(flic, flic->head.oframe2);
// Loop from 2nd frame thru ring frame
for (flic->status.frame_index=0;
(flic->status.frame_index < (flic->head.frames-1)) ||
( (flic->status.frame_index < flic->head.frames) &&
( !max_loop || (flic->status.loop_count < (max_loop - 1))));
++flic->status.frame_index)
(flic->status.frame_index < (flic->head.frames-1)) ||
( (flic->status.frame_index < flic->head.frames) &&
( !max_loop || (flic->status.loop_count < (max_loop - 1))));
++flic->status.frame_index)
{
while (!timer_flag);
@@ -1133,10 +1132,10 @@ int FlicAdvance(Flic *flic, BOOL fDecode)
// Loop from 2nd frame thru ring frame
// for (flic->status.frame_index=0;
// (flic->status.frame_index < (flic->head.frames-1)) ||
// ( (flic->status.frame_index < flic->head.frames) &&
// ( !max_loop || (flic->status.loop_count < (max_loop - 1))));
// ++flic->status.frame_index)
// (flic->status.frame_index < (flic->head.frames-1)) ||
// ( (flic->status.frame_index < flic->head.frames) &&
// ( !max_loop || (flic->status.loop_count < (max_loop - 1))));
// ++flic->status.frame_index)
// {
if(flic->status.frame_index < flic->head.frames)
@@ -1150,7 +1149,7 @@ int FlicAdvance(Flic *flic, BOOL fDecode)
return(0);
// if (flic->check_frame && !(*flic->check_frame)(flic))
// return 0;
// return 0;
}
static void center_flic(Flic *flic)
@@ -1163,20 +1162,20 @@ static void center_flic(Flic *flic)
void set_flic_origin(Flic *flic, int x, int y)
{
flic->xoff = x;
flic->yoff = y;
flic->xoff = x;
flic->yoff = y;
}
int frame_check(Flic *flic)
{
/*
char key;
/*
char key;
if (Esc())
{
{
//AbortScript = TRUE;
return 0;
}
}
if (flic->status.frame_index == FlcSoundFrames[FlcSoundIndex][0])
{
@@ -1206,7 +1205,7 @@ int frame_check(Flic *flic)
}
RefreshSound();
*/
return 1;
return 1;
}
//**************************************************************************
@@ -1295,7 +1294,7 @@ ErrCode FlicGetStats(char *filename, int width, int height, Flic *flic, int *piB
if ( !(err = (*flic->open)(flic, filename)) )
{
if (fread(&flic->head, sizeof(flic->head), 1, flic->file) != 1)
err = ErrFlicRead;
err = ErrFlicRead;
}
if ( !err && piBufferSize )
@@ -1352,7 +1351,7 @@ ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuf
return(-1);
FlicSetOrigin(&flic, 0, 0);
*ppBuffer = (CHAR *)MemAlloc( iColourPaletteSize );
chunk = (ChunkHead *)FlicSeekChunk( &flic, 0, COLOR_256, NULL );
pcPosition = (CHAR *)(((BYTE *)chunk)+6);
@@ -1374,11 +1373,11 @@ ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuf
count = 256;
{
colors = (Colour *)cbuf;
end = start + count;
end = start + count;
for (ix = start; ix < end; ++ix)
{
(*ppBuffer)[ix*3] =colors->r;
(*ppBuffer)[ix*3] =colors->r;
(*ppBuffer)[ix*3+1]=colors->g;
(*ppBuffer)[ix*3+2]=colors->b;
++colors;
@@ -1424,9 +1423,8 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize)
{
FrameHead head;
LONG lSize;
BOOL fFound = FALSE;
ErrCode err=0;
INT i;
INT i;
FlicSeekFirst(flic);
@@ -1434,7 +1432,7 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize)
FlicAdvance(flic, FALSE);
if ( fread(&head, sizeof(head), 1, flic->file) != 1 )
err = ErrFlicRead;
err = ErrFlicRead;
else
{
if (head.type == FRAME_TYPE)
@@ -1449,20 +1447,19 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize)
}
if (!(err = file_read_big_block(flic->file, pcxbuf, lSize)))
{
FrameHead *frame = &head;
Uchar *data = (unsigned char *)pcxbuf;
int i;
ChunkHead *chunk;
for (i=0; i<head.chunks; ++i)
{
chunk = (ChunkHead *)data;
chunk = (ChunkHead *)data;
data += chunk->size;
if ( chunk->type == eType )
{
if ( piChunkSize )
*piChunkSize = chunk->size;
return( ((char *)chunk) );
return( ((char *)chunk) );
}
}
}
@@ -1500,7 +1497,7 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize)
INT FlicFindByteRunBeforeFrame(Flic *flic, INT iFrame)
{
INT iRet = BAD_INDEX;
INT i;
INT i;
for ( i=iFrame-1 ; i>=0 ; i-- )
@@ -1620,7 +1617,7 @@ ErrCode FlicFillFrameData(
//GetObject( hBitmap, sizeof(DIBSECTION), &dibSection );
flic->screen.pixels = (Pixel *)pcBuffer;
iNumBytesInBuffer = *piNumBytes;
iNumBytesInBuffer = *piNumBytes;
if ( iPrevFrame == BAD_INDEX || iPrevFrame != (iFrame-1) )
{
File diff suppressed because it is too large Load Diff
+22 -22
View File
@@ -70,7 +70,7 @@
typedef struct
{
UINT16 usNumberOfSymbols;
UINT16 usNumberOfSymbols;
UINT16 *DynamicArrayOf16BitValues;
} FontTranslationTable;
@@ -110,7 +110,7 @@ void SetFontForeground(UINT8 ubForeground);
void SetFontBackground(UINT8 ubBackground);
void SetFontShadow(UINT8 ubBackground);
//Kris: added these
//Kris: added these
void SetRGBFontForeground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
void SetRGBFontBackground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
void SetRGBFontShadow( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
@@ -122,14 +122,14 @@ UINT16 *GetFontObjectPalette16BPP(INT32 iFont);
void DestroyEnglishTransTable( void );
extern HVOBJECT GetFontObject(INT32 iFont);
extern UINT32 gprintf(INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 gprintfDirty(INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 mprintf(INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 gprintf_buffer( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 FontType, INT32 x, INT32 y, const STR16 pFontString, ...);
extern HVOBJECT GetFontObject(INT32 iFont);
extern UINT32 gprintf(INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 gprintfDirty(INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 mprintf(INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 gprintf_buffer( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 FontType, INT32 x, INT32 y, const STR16 pFontString, ...);
extern UINT32 mprintf_buffer( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 FontType, INT32 x, INT32 y, const STR16 pFontString, ...);
// Function for displaying coded test. Since it's slower to do this, it's separate from the normal fuctions
// Function for displaying coded test. Since it's slower to do this, it's separate from the normal fuctions
#define FONT_CODE_BEGINCOLOR 180
#define FONT_CODE_RESETCOLOR 181
@@ -137,16 +137,16 @@ UINT32 mprintf_buffer_coded( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 Fo
UINT32 mprintf_coded( INT32 x, INT32 y, const STR16 pFontString, ...);
extern BOOLEAN SetFontDestBuffer(UINT32 DestBuffer, INT32 x1, INT32 y1, INT32 x2, INT32 y2, BOOLEAN wrap);
extern BOOLEAN SetFont(INT32 iFontIndex);
extern BOOLEAN SetFontDestBuffer(UINT32 DestBuffer, INT32 x1, INT32 y1, INT32 x2, INT32 y2, BOOLEAN wrap);
extern BOOLEAN SetFont(INT32 iFontIndex);
extern INT32 LoadFontFile(const STR8 pFileName);
extern UINT16 GetFontHeight(INT32 FontNum);
extern BOOLEAN InitializeFontManager(UINT16 usDefaultPixDepth, FontTranslationTable *pTransTable);
extern void ShutdownFontManager(void);
extern void UnloadFont(UINT32 FontIndex);
extern INT32 LoadFontFile(const STR8 pFileName);
extern UINT16 GetFontHeight(INT32 FontNum);
extern BOOLEAN InitializeFontManager(UINT16 usDefaultPixDepth, FontTranslationTable *pTransTable);
extern void ShutdownFontManager(void);
extern void UnloadFont(UINT32 FontIndex);
extern FontTranslationTable *CreateEnglishTransTable( );
extern FontTranslationTable *CreateEnglishTransTable( );
extern INT16 GetIndex(CHAR16 siChar);
extern UINT32 GetWidth(HVOBJECT hSrcVObject, INT16 ssIndex);
@@ -168,13 +168,13 @@ void FindFontRightCoordinates( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHei
void FindFontCenterCoordinates( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, const STR16 pStr, INT32 iFontIndex, INT16 *psNewX, INT16 *psNewY );
//extern FontBase *LoadFontFile(CHAR8 *pFileName);
//extern UINT8 *GetFontPalette(CHAR8 *pFileName);
//extern UINT16 GetMaxFontWidth(FontBase *pBase);
//extern void UnloadFont(FontBase *pBase);
//extern BOOLEAN SetFontPalette(FontBase *pFont, UINT16 siDepthPix, SGPPaletteEntry *pNewPalette);
//extern UINT8 *GetFontPalette(CHAR8 *pFileName);
//extern UINT16 GetMaxFontWidth(FontBase *pBase);
//extern void UnloadFont(FontBase *pBase);
//extern BOOLEAN SetFontPalette(FontBase *pFont, UINT16 siDepthPix, SGPPaletteEntry *pNewPalette);
// make sure the pFontString is terminated by 0
//extern BOOLEAN PrintFontString(STR16 pFontString, UINT8 *pDestBuffer, UINT16 siDestWidth, UINT16 siDestPixelDepth, UINT16 siDestPitch, UINT16 siDestHeight, UINT16 siX, UINT16 siY, UINT16 siTotalWidth, UINT16 siTotalHeight, BOOLEAN MultiLine, FontBase *pFontBase);
//extern BOOLEAN SetFont16BitData(FontBase *pFontBase, UINT16 *pData16);
//extern BOOLEAN PrintFontString(STR16 pFontString, UINT8 *pDestBuffer, UINT16 siDestWidth, UINT16 siDestPixelDepth, UINT16 siDestPitch, UINT16 siDestHeight, UINT16 siX, UINT16 siY, UINT16 siTotalWidth, UINT16 siTotalHeight, BOOLEAN MultiLine, FontBase *pFontBase);
//extern BOOLEAN SetFont16BitData(FontBase *pFontBase, UINT16 *pData16);
/*
#ifdef __cplusplus
+1 -1
View File
@@ -50,7 +50,7 @@
BOOLEAN InstallApplication( STR strAppname, STR strPath )
{
HKEY hKey;
BOOL fRet = TRUE;
BOOL fRet = TRUE;
hKey = GetAppRegistryKey();
RegCloseKey( hKey );
+2 -3
View File
@@ -1,7 +1,7 @@
/*
* ChangeLog:
* 10.12.2005 Lesh ripped out everything that refers to MSS
* 10.12.2005 Lesh added fmod.h
* 10.12.2005 Lesh ripped out everything that refers to MSS
* 10.12.2005 Lesh added fmod.h
*/
#ifndef __JA2_SGP_ALL_H
#define __JA2_SGP_ALL_H
@@ -88,7 +88,6 @@
#include <windowsx.h>
#include "vobject_private.h"
#include "shading.h"
//#include "mss.h"
#include "imgfmt.h"
#include "timer.h"
#include "renderworld.h"
+8 -8
View File
@@ -1,4 +1,4 @@
#include "LibraryDataBase.h"
LibraryInitHeader gGameLibaries[ ] =
{
//Library Name Can be Init at start
@@ -15,18 +15,18 @@ LibraryInitHeader gGameLibaries[ ] =
{ "Fonts.slf", FALSE, TRUE },
{ "Interface.slf", FALSE, TRUE },
{ "Laptop.slf", FALSE, TRUE },
{ "Maps.slf", TRUE, TRUE },
{ "Maps.slf", TRUE, TRUE },
{ "MercEdt.slf", FALSE, TRUE },
{ "Music.slf", TRUE, TRUE },
{ "Npc_Speech.slf", TRUE, TRUE },
{ "Music.slf", TRUE, TRUE },
{ "Npc_Speech.slf", TRUE, TRUE },
{ "NpcData.slf", FALSE, TRUE },
{ "RadarMaps.slf", FALSE, TRUE },
{ "Sounds.slf", FALSE, TRUE },
{ "Speech.slf", TRUE, TRUE },
{ "Speech.slf", TRUE, TRUE },
// { "TileCache.slf", FALSE, TRUE },
{ "TileSets.slf", TRUE, TRUE },
{ "LoadScreens.slf", TRUE, TRUE },
{ "Intro.slf", TRUE, TRUE },
{ "TileSets.slf", TRUE, TRUE },
{ "LoadScreens.slf", TRUE, TRUE },
{ "Intro.slf", TRUE, TRUE },
#ifdef GERMAN
{ "German.slf", FALSE, TRUE },
+38 -41
View File
@@ -21,7 +21,7 @@
//NUMBER_OF_LIBRARIES
#ifdef JA2
#include "Ja2 Libs.cpp"
#include "Ja2 Libs.h"
#include "GameSettings.h"
#elif defined(UTIL)
LibraryInitHeader gGameLibaries[ ] = { 0 };
@@ -52,9 +52,9 @@ INT32 CompareDirEntryFileNames( CHAR8 *arg1[], DIRENTRY **arg2 );
//************************************************************************
//
// InitializeFileDatabase(): Call this function to initialize the file
// database. It will use the gGameLibaries[] array for the list of libraries
// and the define NUMBER_OF_LIBRARIES for the number of libraries. The gGameLibaries
// InitializeFileDatabase(): Call this function to initialize the file
// database. It will use the gGameLibaries[] array for the list of libraries
// and the define NUMBER_OF_LIBRARIES for the number of libraries. The gGameLibaries
// array is an array of structure, one of the fields determines if the library
// will be initialized and game start.
//
@@ -130,9 +130,9 @@ BOOLEAN InitializeFileDatabase( )
// Closes all CD libraries, then reopens them. This function needs to be called when CDs
// are changed.
//
// Returns BOOLEAN - TRUE, always
// Returns BOOLEAN - TRUE, always
//
// Created: 3/21/00 Derek Beland
// Created: 3/21/00 Derek Beland
//*****************************************************************************************
BOOLEAN ReopenCDLibraries(void)
{
@@ -153,7 +153,7 @@ INT16 i;
//************************************************************************
//
// ShutDownFileDatabase(): Call this function to close down the file
// ShutDownFileDatabase(): Call this function to close down the file
// database.
//
//************************************************************************
@@ -177,7 +177,7 @@ BOOLEAN ShutDownFileDatabase( )
//loop through all the 'opened files' ( there should be no files open )
for( sLoop1=0; sLoop1< gFileDataBase.RealFiles.iNumFilesOpen; sLoop1++)
{
FastDebugMsg( String("ShutDownFileDatabase( ): ERROR: real file id still exists, wasnt closed") );
FastDebugMsg( String("ShutDownFileDatabase( ): ERROR: real file id still exists, wasnt closed") );
CloseHandle( gFileDataBase.RealFiles.pRealFilesOpen[ sLoop1 ].hRealFileHandle );
}
@@ -276,7 +276,7 @@ BOOLEAN InitializeLibrary( STR pLibraryName, LibraryHeaderStruct *pLibHeader, BO
SetFilePointer( hFile, -( LibFileHeader.iEntries * (INT32)sizeof(DIRENTRY) ), NULL, FILE_END );
//loop through the library and determine the number of files that are FILE_OK
//ie. so we dont load the old or deleted files
//ie. so we dont load the old or deleted files
usNumEntries = 0;
for( uiLoop=0; uiLoop<(UINT32)LibFileHeader.iEntries; uiLoop++ )
{
@@ -313,7 +313,7 @@ BOOLEAN InitializeLibrary( STR pLibraryName, LibraryHeaderStruct *pLibHeader, BO
{
//Check to see if the file is not longer then it should be
if( ( strlen( DirEntry.sFileName ) + 1 ) >= FILENAME_SIZE )
FastDebugMsg(String("\n*******InitializeLibrary(): Warning!: '%s' from the library '%s' has name whose size (%d) is bigger then it should be (%s)", DirEntry.sFileName, pLibHeader->sLibraryPath, ( strlen( DirEntry.sFileName ) + 1 ), FILENAME_SIZE ) );
FastDebugMsg(String("\n*******InitializeLibrary(): Warning!: '%s' from the library '%s' has name whose size (%d) is bigger then it should be (%s)", DirEntry.sFileName, pLibHeader->sLibraryPath, ( strlen( DirEntry.sFileName ) + 1 ), FILENAME_SIZE ) );
//allocate memory for the files name
@@ -347,7 +347,7 @@ BOOLEAN InitializeLibrary( STR pLibraryName, LibraryHeaderStruct *pLibHeader, BO
//allocate memory for the library path
// if( strlen( LibFileHeader.sPathToLibrary ) == 0 )
{
// FastDebugMsg( String("The %s library file does not contain a path. Use 'n' argument to name the library when you create it\n", LibFileHeader.sLibName ) );
// FastDebugMsg( String("The %s library file does not contain a path. Use 'n' argument to name the library when you create it\n", LibFileHeader.sLibName ) );
// Assert( 0 );
}
@@ -474,9 +474,9 @@ BOOLEAN CheckIfFileExistInLibrary( STR pFileName )
//************************************************************************
//
// This function finds out if the file CAN be in a library. It determines
// This function finds out if the file CAN be in a library. It determines
// if the library that the file MAY be in is open.
// ( eg. File is Laptop\Test.sti, if the Laptop\ library is open, it returns true
// ( eg. File is Laptop\Test.sti, if the Laptop\ library is open, it returns true
//
//************************************************************************
INT16 GetLibraryIDFromFileName( STR pFileName )
@@ -522,7 +522,7 @@ INT16 sLoop1, sBestMatch=-1;
//************************************************************************
//
// GetFileHeaderFromLibrary() performsperforms a binary search of the
// library. It adds the libraries path to the file in the
// library. It adds the libraries path to the file in the
// library and then string compared that to the name that we are
// searching for.
//
@@ -538,20 +538,20 @@ BOOLEAN GetFileHeaderFromLibrary( INT16 sLibraryID, STR pstrFileName, FileHeader
gsCurrentLibrary = sLibraryID;
/* try to find the filename using a binary search algorithm: */
ppFileHeader = (FileHeaderStruct **) bsearch( &sFileNameWithPath, (FileHeaderStruct *) gFileDataBase.pLibraries[ sLibraryID ].pFileHeader, gFileDataBase.pLibraries[ sLibraryID ].usNumberOfEntries,
/* try to find the filename using a binary search algorithm: */
ppFileHeader = (FileHeaderStruct **) bsearch( &sFileNameWithPath, (FileHeaderStruct *) gFileDataBase.pLibraries[ sLibraryID ].pFileHeader, gFileDataBase.pLibraries[ sLibraryID ].usNumberOfEntries,
sizeof( FileHeaderStruct ), (int (*)(const void*, const void*))CompareFileNames );
if( ppFileHeader )
{
if( ppFileHeader )
{
*pFileHeader = ( FileHeaderStruct * ) ppFileHeader;
return( TRUE );
}
else
{
}
else
{
pFileHeader = NULL;
return( FALSE );
}
}
}
@@ -573,8 +573,8 @@ INT CompareFileNames( CHAR8 *arg1[], FileHeaderStruct **arg2 )
sprintf( sFileNameWithPath, "%s%s", gFileDataBase.pLibraries[ gsCurrentLibrary ].sLibraryPath, TempFileHeader->pFileName );
/* Compare all of both strings: */
return _stricmp( sSearchKey, sFileNameWithPath );
/* Compare all of both strings: */
return _stricmp( sSearchKey, sFileNameWithPath );
}
@@ -584,7 +584,6 @@ void AddSlashToPath( STR pName )
{
UINT32 uiLoop, uiCounter;
BOOLEAN fDone = FALSE;
BOOLEAN fFound = FALSE;
CHAR8 sNewName[ FILENAME_SIZE ];
//find out if there is a '\' in the file name
@@ -612,7 +611,7 @@ void AddSlashToPath( STR pName )
//************************************************************************
//
// This function will see if a file is in a library. If it is, the file will be opened and a file
// This function will see if a file is in a library. If it is, the file will be opened and a file
// handle will be created for it.
//
//************************************************************************
@@ -639,8 +638,8 @@ HWFILE OpenFileFromLibrary( STR pName )
if( gFileDataBase.pLibraries[ sLibraryID ].uiIdOfOtherFileAlreadyOpenedLibrary != 0 )
{
// Temp removed
// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open\n", pName, gGameLibaries[ sLibraryID ].sLibraryName ) );
// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open ( file open is '%s')\n", pName, gGameLibaries[ sLibraryID ].sLibraryName, gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ gFileDataBase.pLibraries[ sLibraryID ].uiIdOfOtherFileAlreadyOpenedLibrary ].pFileHeader->pFileName ) );
// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open\n", pName, gGameLibaries[ sLibraryID ].sLibraryName ) );
// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open ( file open is '%s')\n", pName, gGameLibaries[ sLibraryID ].sLibraryName, gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ gFileDataBase.pLibraries[ sLibraryID ].uiIdOfOtherFileAlreadyOpenedLibrary ].pFileHeader->pFileName ) );
}
//check if the file is already open
@@ -660,7 +659,7 @@ HWFILE OpenFileFromLibrary( STR pName )
//reallocate more space for the array
pOpenFiles = (FileOpenStruct *) MemRealloc( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles,
gFileDataBase.pLibraries[ sLibraryID ].iSizeOfOpenFileArray + NUM_FILES_TO_ADD_AT_A_TIME );
gFileDataBase.pLibraries[ sLibraryID ].iSizeOfOpenFileArray + NUM_FILES_TO_ADD_AT_A_TIME );
if( !pOpenFiles )
return( 0 );
@@ -875,7 +874,7 @@ BOOLEAN LibraryFileSeek( INT16 sLibraryID, UINT32 uiFileNum, UINT32 uiDistance,
//************************************************************************
//
// OpenLibrary() Opens a library from the 'array' of library names
// that was passd in at game initialization. Pass in an enum for the
// that was passd in at game initialization. Pass in an enum for the
// library.
//
//************************************************************************
@@ -910,7 +909,7 @@ BOOLEAN CloseLibrary( INT16 sLibraryID )
return( FALSE );
#ifdef JA2TESTVERSION
FastDebugMsg( String("ShutDownFileDatabase( ): %d bytes of ram used for the Library #%3d, path '%s', in the File Database System\n", gFileDataBase.pLibraries[ sLibraryID ].uiTotalMemoryAllocatedForLibrary, sLibraryID, gFileDataBase.pLibraries[ sLibraryID ].sLibraryPath ));
FastDebugMsg( String("ShutDownFileDatabase( ): %d bytes of ram used for the Library #%3d, path '%s', in the File Database System\n", gFileDataBase.pLibraries[ sLibraryID ].uiTotalMemoryAllocatedForLibrary, sLibraryID, gFileDataBase.pLibraries[ sLibraryID ].sLibraryPath ));
gFileDataBase.pLibraries[ sLibraryID ].uiTotalMemoryAllocatedForLibrary = 0;
#endif
@@ -922,10 +921,10 @@ BOOLEAN CloseLibrary( INT16 sLibraryID )
{
if( CheckIfFileIsAlreadyOpen( gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName, sLibraryID ) )
{
FastDebugMsg( String("CloseLibrary(): ERROR: %s library file id still exists, wasnt closed, closing now.", gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName ) );
FastDebugMsg( String("CloseLibrary(): ERROR: %s library file id still exists, wasnt closed, closing now.", gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName ) );
CloseLibraryFile( sLibraryID, uiLoop1 );
// Removed because the memory gets freed in the next for loop. Would only enter here if files were still open
// Removed because the memory gets freed in the next for loop. Would only enter here if files were still open
// gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName = NULL;
}
}
@@ -1023,11 +1022,9 @@ BOOLEAN CheckIfFileIsAlreadyOpen( STR pFileName, INT16 sLibraryID )
BOOLEAN GetLibraryFileTime( INT16 sLibraryID, UINT32 uiFileNum, SGP_FILETIME *pLastWriteTime )
{
UINT16 usNumEntries=0;
UINT32 uiNumBytesRead;
DIRENTRY *pDirEntry;
LIBHEADER LibFileHeader;
BOOLEAN fDone = FALSE;
// UINT32 cnt;
INT32 iFilePos=0;
@@ -1077,15 +1074,15 @@ BOOLEAN GetLibraryFileTime( INT16 sLibraryID, UINT32 uiFileNum, SGP_FILETIME *pL
/* try to find the filename using a binary search algorithm: */
ppDirEntry = (DIRENTRY **) bsearch( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].pFileHeader->pFileName,
/* try to find the filename using a binary search algorithm: */
ppDirEntry = (DIRENTRY **) bsearch( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].pFileHeader->pFileName,
(DIRENTRY *) pAllEntries,
LibFileHeader.iEntries,
sizeof( DIRENTRY ), (int (*)(const void*, const void*))CompareDirEntryFileNames );
if( ppDirEntry )
if( ppDirEntry )
pDirEntry = ( DIRENTRY * ) ppDirEntry;
else
else
return( FALSE );
//Copy the dir entry time over to the passed in time
@@ -1118,7 +1115,7 @@ INT32 CompareDirEntryFileNames( CHAR8 *arg1[], DIRENTRY **arg2 )
sprintf( sFileNameWithPath, "%s", TempDirEntry->sFileName );
/* Compare all of both strings: */
return _stricmp( sSearchKey, sFileNameWithPath );
/* Compare all of both strings: */
return _stricmp( sSearchKey, sFileNameWithPath );
}
+3 -3
View File
@@ -87,8 +87,8 @@ typedef struct
HANDLE hLibraryHandle;
UINT16 usNumberOfEntries;
BOOLEAN fLibraryOpen;
// BOOLEAN fAnotherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time.
UINT32 uiIdOfOtherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time.
// BOOLEAN fAnotherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time.
UINT32 uiIdOfOtherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time.
INT32 iNumFilesOpen;
INT32 iSizeOfOpenFileArray;
FileHeaderStruct *pFileHeader;
@@ -132,7 +132,7 @@ typedef struct
//*************************************************************************
//
// NOTE! The following structs are also used by the datalib98 utility
// NOTE! The following structs are also used by the datalib98 utility
//
//*************************************************************************
+85 -85
View File
@@ -7,8 +7,8 @@
// Modification history :
//
// 11sep96:HJH - Creation
// 29may97:ARM - Fix & improve MemDebugCounter handling, logging of
// MemAlloc/MemFree, and reporting of any errors
// 29may97:ARM - Fix & improve MemDebugCounter handling, logging of
// MemAlloc/MemFree, and reporting of any errors
//
//**************************************************************************
@@ -49,7 +49,7 @@
#ifdef JA2
#include "mousesystem.h"
#include "MessageBoxScreen.h"
STR16 gzJA2ScreenNames[] =
STR16 gzJA2ScreenNames[] =
{
L"EDIT_SCREEN",
L"SAVING_SCREEN",
@@ -92,8 +92,8 @@ STR16 gzJA2ScreenNames[] =
UINT32 uiSize;
}MEMORY_NODE;
MEMORY_NODE *gpMemoryHead = NULL;
MEMORY_NODE *gpMemoryTail = NULL;
MEMORY_NODE *gpMemoryHead = NULL;
MEMORY_NODE *gpMemoryTail = NULL;
UINT32 guiMemoryNodes = 0;
UINT32 guiTotalMemoryNodes = 0;
#endif
@@ -101,8 +101,8 @@ STR16 gzJA2ScreenNames[] =
static BOOLEAN gfMemDebug = TRUE;
// debug variable for total memory currently allocated
UINT32 guiMemTotal = 0;
UINT32 guiMemAlloced = 0;
UINT32 guiMemFreed = 0;
UINT32 guiMemAlloced = 0;
UINT32 guiMemFreed = 0;
UINT32 MemDebugCounter = 0;
BOOLEAN fMemManagerInit = FALSE;
@@ -124,13 +124,13 @@ void DebugPrint( void );
//
// MemInit
//
//
//
//
// Parameter List :
// Return Value :
// Modification history :
//
// 12sep96:HJH -> modified for use by Wizardry
// 12sep96:HJH ->modified for use by Wizardry
//
//**************************************************************************
@@ -164,7 +164,7 @@ BOOLEAN InitializeMemoryManager( void )
// Return Value :
// Modification history :
//
// 12sep96:HJH -> modified for use by Wizardry
// 12sep96:HJH ->modified for use by Wizardry
//
//**************************************************************************
@@ -183,7 +183,7 @@ void MemDebug( BOOLEAN f )
// Return Value :
// Modification history :
//
// 12sep96:HJH -> modified for use by Wizardry
// 12sep96:HJH ->modified for use by Wizardry
//
//**************************************************************************
@@ -196,7 +196,7 @@ void ShutdownMemoryManager( void )
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("***** WARNING - WARNING - WARNING *****"));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("***** WARNING - WARNING - WARNING *****"));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String(" "));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String(" >>>>> MEMORY LEAK DETECTED!!! <<<<< "));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String(" >>>>> MEMORY LEAK DETECTED!!! <<<<< "));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("%d memory blocks still allocated", MemDebugCounter ));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("%d bytes memory total STILL allocated", guiMemTotal ));
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("%d bytes memory total was allocated", guiMemAlloced));
@@ -217,7 +217,7 @@ void ShutdownMemoryManager( void )
{
fprintf( fp, "\n\n" );
fprintf( fp, ">>>>> MEMORY LEAK DETECTED!!! <<<<<\n" );
fprintf( fp, " %d bytes memory total was allocated\n", guiMemAlloced );
fprintf( fp, " %d bytes memory total was allocated\n", guiMemAlloced );
fprintf( fp, "- %d bytes memory total was freed\n", guiMemFreed );
fprintf( fp, "_______________________________________________\n" );
fprintf( fp, "%d bytes memory total STILL allocated\n", guiMemTotal );
@@ -237,7 +237,7 @@ void ShutdownMemoryManager( void )
fMemManagerInit = FALSE;
}
#ifdef _DEBUG
PTR MemAllocReal( UINT32 uiSize, const STR8 pcFile, INT32 iLine )
@@ -250,23 +250,23 @@ PTR MemAllocReal( UINT32 uiSize, const STR8 pcFile, INT32 iLine )
}
if ( !fMemManagerInit )
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) );
ptr = _malloc_dbg( uiSize, _NORMAL_BLOCK, pcFile, iLine );
if (ptr != NULL)
{
guiMemTotal += uiSize;
if (ptr != NULL)
{
guiMemTotal += uiSize;
guiMemAlloced += uiSize;
MemDebugCounter++;
}
else
}
else
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc failed: %d bytes (line %d file %s)", uiSize, iLine, pcFile) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc failed: %d bytes (line %d file %s)", uiSize, iLine, pcFile) );
}
#ifdef DEBUG_MEM_LEAKS
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAlloc %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAlloc %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) );
#endif
return( ptr );
@@ -278,28 +278,28 @@ void MemFreeReal( PTR ptr, const STR8 pcFile, INT32 iLine )
UINT32 uiSize;
if ( !fMemManagerInit )
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) );
if (ptr != NULL)
{
if (ptr != NULL)
{
uiSize = _msize(ptr);
guiMemTotal -= uiSize;
guiMemFreed += uiSize;
_free_dbg( ptr, _NORMAL_BLOCK );
#ifdef DEBUG_MEM_LEAKS
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFree %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFree %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) );
#endif
}
else
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree ERROR: NULL ptr received (line %d file %s)", iLine, pcFile) );
}
}
else
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree ERROR: NULL ptr received (line %d file %s)", iLine, pcFile) );
}
// count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some
// sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage
// is not noticed.
MemDebugCounter--;
// count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some
// sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage
// is not noticed.
MemDebugCounter--;
}
@@ -310,21 +310,21 @@ PTR MemReallocReal( PTR ptr, UINT32 uiSize, const STR8 pcFile, INT32 iLine )
if ( !fMemManagerInit )
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemRealloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemRealloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) );
if(ptr != NULL)
if(ptr != NULL)
{
uiOldSize = _msize(ptr);
guiMemTotal -= uiOldSize;
guiMemFreed += uiOldSize;
MemDebugCounter--;
MemDebugCounter--;
}
// Note that the ptr changes to ptrNew...
ptrNew = _realloc_dbg( ptr, uiSize, _NORMAL_BLOCK, pcFile, iLine );
if (ptrNew == NULL)
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemReAlloc failed: ptr %d, %d -> %d bytes (line %d file %s)", ptr, uiOldSize, uiSize, iLine, pcFile) );
if (ptrNew == NULL)
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemReAlloc failed: ptr %d, %d->%d bytes (line %d file %s)", ptr, uiOldSize, uiSize, iLine, pcFile) );
if ( uiSize != 0 )
{
// ptr is left untouched, so undo the math above
@@ -332,17 +332,17 @@ PTR MemReallocReal( PTR ptr, UINT32 uiSize, const STR8 pcFile, INT32 iLine )
guiMemFreed -= uiOldSize;
MemDebugCounter++;
}
}
else
{
}
else
{
#ifdef DEBUG_MEM_LEAKS
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemRealloc %p: Resizing %d bytes to %d bytes (line %d file %s) - New ptr %p", ptr, uiOldSize, uiSize, iLine, pcFile, ptrNew ) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemRealloc %p: Resizing %d bytes to %d bytes (line %d file %s) - New ptr %p", ptr, uiOldSize, uiSize, iLine, pcFile, ptrNew ) );
#endif
guiMemTotal += uiSize;
guiMemTotal += uiSize;
guiMemAlloced += uiSize;
MemDebugCounter++;
}
}
return( ptrNew );
}
@@ -355,26 +355,26 @@ PTR MemAllocLocked( UINT32 uiSize )
PTR ptr;
if ( !fMemManagerInit )
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked: Warning -- Memory manager not initialized!!! ") );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked: Warning -- Memory manager not initialized!!! ") );
ptr = VirtualAlloc( NULL, uiSize, MEM_COMMIT, PAGE_READWRITE );
if ( ptr )
{
VirtualLock( ptr, uiSize );
VirtualLock( ptr, uiSize );
guiMemTotal += uiSize;
guiMemTotal += uiSize;
guiMemAlloced += uiSize;
MemDebugCounter++;
}
else
}
else
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked failed: %d bytes", uiSize) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked failed: %d bytes", uiSize) );
}
#ifdef DEBUG_MEM_LEAKS
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAllocLocked %p: %d bytes", ptr, uiSize) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAllocLocked %p: %d bytes", ptr, uiSize) );
#endif
return( ptr );
@@ -384,29 +384,29 @@ PTR MemAllocLocked( UINT32 uiSize )
void MemFreeLocked( PTR ptr, UINT32 uiSize )
{
if ( !fMemManagerInit )
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked: Warning -- Memory manager not initialized!!! ") );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked: Warning -- Memory manager not initialized!!! ") );
if (ptr != NULL)
{
VirtualUnlock( ptr, uiSize );
VirtualFree( ptr, uiSize, MEM_RELEASE );
if (ptr != NULL)
{
VirtualUnlock( ptr, uiSize );
VirtualFree( ptr, uiSize, MEM_RELEASE );
guiMemTotal -= uiSize;
guiMemFreed += uiSize;
}
else
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked ERROR: NULL ptr received, size %d", uiSize) );
}
}
else
{
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked ERROR: NULL ptr received, size %d", uiSize) );
}
// count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some
// sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage
// is not noticed.
MemDebugCounter--;
// count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some
// sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage
// is not noticed.
MemDebugCounter--;
#ifdef DEBUG_MEM_LEAKS
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFreeLocked %p", ptr) );
DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFreeLocked %p", ptr) );
#endif
}
@@ -415,13 +415,13 @@ void MemFreeLocked( PTR ptr, UINT32 uiSize )
//
// MemGetFree
//
//
//
//
// Parameter List :
// Return Value :
// Modification history :
//
// ??sep96:HJH -> modified for use by Wizardry
// ??sep96:HJH ->modified for use by Wizardry
//
//**************************************************************************
@@ -440,13 +440,13 @@ UINT32 MemGetFree( void )
//
// MemGetTotalSystem
//
//
//
//
// Parameter List :
// Return Value :
// Modification history :
//
// May98:HJH -> Carter
// May98:HJH ->Carter
//
//**************************************************************************
@@ -465,13 +465,13 @@ UINT32 MemGetTotalSystem( void )
//
// MemCheckPool
//
//
//
//
// Parameter List :
// Return Value :
// Modification history :
//
// 23sep96:HJH -> modified for use by Wizardry
// 23sep96:HJH ->modified for use by Wizardry
//
//**************************************************************************
@@ -503,7 +503,7 @@ PTR MemAllocXDebug( UINT32 size, const STR8 szCodeString, INT32 iLineNum, void *
return NULL;
}
if( !pSpecial )
if( !pSpecial )
{
ptr = malloc( size );
}
@@ -512,8 +512,8 @@ PTR MemAllocXDebug( UINT32 size, const STR8 szCodeString, INT32 iLineNum, void *
ptr = pSpecial;
}
if( ptr )
{
if( ptr )
{
// Set into video object list
if( gpMemoryHead )
{ //Add node after tail
@@ -556,8 +556,8 @@ void MemFreeXDebug( PTR ptr, const STR8 szCodeString, INT32 iLineNum, void *pSpe
{
MEMORY_NODE *curr;
if( ptr )
{
if( ptr )
{
curr = gpMemoryHead;
while( curr )
{
@@ -586,7 +586,7 @@ void MemFreeXDebug( PTR ptr, const STR8 szCodeString, INT32 iLineNum, void *pSpe
{ //Make the next node point to the prev
curr->prev->next = curr->next;
}
//The node is now detached. Now deallocate it.
//The node is now detached. Now deallocate it.
free( curr );
curr = NULL;
guiMemoryNodes--;
@@ -594,7 +594,7 @@ void MemFreeXDebug( PTR ptr, const STR8 szCodeString, INT32 iLineNum, void *pSpe
}
curr = curr->next;
}
}
}
}
PTR MemReallocXDebug( PTR ptr, UINT32 size, const STR8 szCodeString, INT32 iLineNum, void *pSpecial )
@@ -679,7 +679,7 @@ void DumpMemoryInfoIntoFile( UINT8 *filename, BOOLEAN fAppend )
if( !guiMemoryNodes )
{
fprintf( fp, "NO MEMORY LEAKS DETECTED! CONGRATULATIONS!\n" );
fprintf( fp, "NO MEMORY LEAKS DETECTED! CONGRATULATIONS!\n" );
fclose( fp );
return;
}
@@ -750,4 +750,4 @@ BOOLEAN _AddAndRecordMemAlloc( UINT32 size, UINT32 uiLineNum, UINT8 *pSourceFile
return 0;
}
#endif
#endif
+5 -5
View File
@@ -55,9 +55,9 @@ extern void ShutdownMemoryManager( void );
// Creates and adds a video object to list
#ifdef EXTREME_MEMORY_DEBUGGING
//This is the most effective way to debug memory leaks. Each memory leak will be recorded in a linked
//This is the most effective way to debug memory leaks. Each memory leak will be recorded in a linked
//list containing a string referring to the location in code the memory was allocated in addition to
//the number of occurrences. The shutdown code will report all unhandled memory with exact location allocated.
//the number of occurrences. The shutdown code will report all unhandled memory with exact location allocated.
void DumpMemoryInfoIntoFile( UINT8 *filename, BOOLEAN fAppend );
BOOLEAN _AddAndRecordMemAlloc( UINT32 size, UINT32 uiLineNum, UINT8 *pSourceFile );
#define MemAlloc( size ) MemAllocXDebug( (size), __FILE__, __LINE__, NULL )
@@ -69,13 +69,13 @@ extern void ShutdownMemoryManager( void );
#else
#ifdef _DEBUG
#include <crtdbg.h>
//This is another debug feature. Not as sophistocated, but definately not the pig the extreme system is.
//This is another debug feature. Not as sophistocated, but definately not the pig the extreme system is.
//This system reports all memory allocations/deallocations in the debug output.
#define MemAlloc( size ) MemAllocReal( (size), __FILE__, __LINE__ )
#define MemFree( ptr ) MemFreeReal( (ptr), __FILE__, __LINE__ )
#define MemRealloc( ptr, size ) MemReallocReal( (ptr), (size), __FILE__, __LINE__ )
extern PTR MemAllocReal( UINT32 size, const STR8 , INT32 );
extern void MemFreeReal( PTR ptr, const STR8 , INT32 );
extern void MemFreeReal( PTR ptr, const STR8 , INT32 );
extern PTR MemReallocReal( PTR ptr, UINT32 size, const STR8 , INT32 );
//void* ::operator new( size_t sz, const char* file, int line);
//void* ::operator new[]( size_t sz, const char *file, int line);
@@ -92,7 +92,7 @@ extern void ShutdownMemoryManager( void );
extern PTR MemAllocLocked( UINT32 size );
extern PTR MemAllocLocked( UINT32 size );
extern void MemFreeLocked( PTR, UINT32 size );
// get total free on the system at this moment
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+122 -122
View File
@@ -18,129 +18,129 @@ HANDLE MutexTable[MAX_MUTEX_HANDLES];
BOOLEAN InitializeMutexManager(void)
{
UINT32 uiIndex;
UINT32 uiIndex;
//
// Register the Mutex Manager debug topic
//
//
// Register the Mutex Manager debug topic
//
RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Initializing the Mutex Manager");
RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Initializing the Mutex Manager");
//
// Initialize the table of mutex handles to NULL
//
//
// Initialize the table of mutex handles to NULL
//
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
MutexTable[uiIndex] = NULL;
}
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
MutexTable[uiIndex] = NULL;
}
return TRUE;
return TRUE;
}
void ShutdownMutexManager(void)
{
UINT32 uiIndex;
UINT32 uiIndex;
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager");
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager");
//
// Make sure all mutex handles are closed
//
//
// Make sure all mutex handles are closed
//
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
if (MutexTable[uiIndex] != NULL)
{
CloseHandle(MutexTable[uiIndex]);
MutexTable[uiIndex] = NULL;
}
}
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
if (MutexTable[uiIndex] != NULL)
{
CloseHandle(MutexTable[uiIndex]);
MutexTable[uiIndex] = NULL;
}
}
UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
}
BOOLEAN InitializeMutex(UINT32 uiMutexIndex, UINT8 *ubMutexName)
{
MutexTable[uiMutexIndex] = CreateMutex(NULL, FALSE, ubMutexName);
if (MutexTable[uiMutexIndex] == NULL)
{
//
// Mutex creation has failed.
//
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex initialization has failed.");
return FALSE;
}
MutexTable[uiMutexIndex] = CreateMutex(NULL, FALSE, ubMutexName);
if (MutexTable[uiMutexIndex] == NULL)
{
//
// Mutex creation has failed.
//
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex initialization has failed.");
return FALSE;
}
return TRUE;
return TRUE;
}
BOOLEAN DeleteMutex(UINT32 uiMutexIndex)
{
if (MutexTable[uiMutexIndex] == NULL)
{
//
// Hum ?? We just tried to initialize a mutex entry which doesn't have a reserved slot
//
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit");
return FALSE;
}
if (CloseHandle(MutexTable[uiMutexIndex]) == FALSE)
{
//
// Hum, the mutex deletion has failed
//
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit");
return FALSE;
}
if (MutexTable[uiMutexIndex] == NULL)
{
//
// Hum ?? We just tried to initialize a mutex entry which doesn't have a reserved slot
//
MutexTable[uiMutexIndex] = NULL;
return TRUE;
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit");
return FALSE;
}
if (CloseHandle(MutexTable[uiMutexIndex]) == FALSE)
{
//
// Hum, the mutex deletion has failed
//
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit");
return FALSE;
}
MutexTable[uiMutexIndex] = NULL;
return TRUE;
}
BOOLEAN EnterMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename)
{
switch (WaitForSingleObject(MutexTable[uiMutexIndex], INFINITE))
{
case WAIT_OBJECT_0
: return TRUE;
case WAIT_TIMEOUT
: DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Possible infinite loop detected due to enter mutex timeout");
return FALSE;
case WAIT_ABANDONED
: DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Abandoned mutex has been found");
return FALSE;
}
switch (WaitForSingleObject(MutexTable[uiMutexIndex], INFINITE))
{
case WAIT_OBJECT_0
: return TRUE;
case WAIT_TIMEOUT
: DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Possible infinite loop detected due to enter mutex timeout");
return FALSE;
case WAIT_ABANDONED
: DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Abandoned mutex has been found");
return FALSE;
}
}
BOOLEAN EnterMutexWithTimeout(UINT32 uiMutexIndex, UINT32 uiTimeout, INT32 nLine, STR8 szFilename)
{
switch (WaitForSingleObject(MutexTable[uiMutexIndex], uiTimeout))
{
case WAIT_OBJECT_0
: return TRUE;
case WAIT_TIMEOUT
: return FALSE;
case WAIT_ABANDONED
: return FALSE;
}
return TRUE;
switch (WaitForSingleObject(MutexTable[uiMutexIndex], uiTimeout))
{
case WAIT_OBJECT_0
: return TRUE;
case WAIT_TIMEOUT
: return FALSE;
case WAIT_ABANDONED
: return FALSE;
}
return TRUE;
}
BOOLEAN LeaveMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename)
{
if (ReleaseMutex(MutexTable[uiMutexIndex]) == FALSE)
{
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Failed to leave mutex");
return FALSE;
}
return TRUE;
if (ReleaseMutex(MutexTable[uiMutexIndex]) == FALSE)
{
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Failed to leave mutex");
return FALSE;
}
return TRUE;
}
#else
@@ -153,71 +153,71 @@ CRITICAL_SECTION MutexTable[MAX_MUTEX_HANDLES];
BOOLEAN InitializeMutexManager(void)
{
UINT32 uiIndex;
UINT32 uiIndex;
//
// Make sure all mutex handles are opened
//
//
// Make sure all mutex handles are opened
//
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
InitializeCriticalSection(&MutexTable[uiIndex]);
}
RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
InitializeCriticalSection(&MutexTable[uiIndex]);
}
return TRUE;
RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
return TRUE;
}
void ShutdownMutexManager(void)
{
UINT32 uiIndex;
UINT32 uiIndex;
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager");
DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager");
//
// Make sure all mutex handles are closed
//
//
// Make sure all mutex handles are closed
//
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
DeleteCriticalSection(&MutexTable[uiIndex]);
}
for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++)
{
DeleteCriticalSection(&MutexTable[uiIndex]);
}
UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager");
}
BOOLEAN InitializeMutex(UINT32 uiMutexIndex, UINT8 *ubMutexName)
{
//InitializeCriticalSection(&MutexTable[uiMutexIndex]);
//InitializeCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
return TRUE;
}
BOOLEAN DeleteMutex(UINT32 uiMutexIndex)
{
//DeleteCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
//DeleteCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
}
BOOLEAN EnterMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename)
{
EnterCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
EnterCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
}
BOOLEAN EnterMutexWithTimeout(UINT32 uiMutexIndex, UINT32 uiTimeout, INT32 nLine, STR8 szFilename)
{
EnterCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
EnterCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
}
BOOLEAN LeaveMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename)
{
LeaveCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
LeaveCriticalSection(&MutexTable[uiMutexIndex]);
return TRUE;
}
#endif
#endif
+1 -1
View File
@@ -6,7 +6,7 @@
#include "Local.h"
extern BOOLEAN InitializeMutexManager(void);
extern void ShutdownMutexManager(void);
extern void ShutdownMutexManager(void);
extern BOOLEAN InitializeMutex(UINT32 uiMutexIndex, UINT8 *ubMutexName);
extern BOOLEAN DeleteMutex(UINT32 uiMutexIndex);
extern BOOLEAN EnterMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename);
+257 -257
View File
@@ -10,22 +10,22 @@
#include "fileman.h"
#endif
// Local typedefs
// Local typedefs
#define PCX_NORMAL 1
#define PCX_RLE 2
#define PCX_256COLOR 4
#define PCX_TRANSPARENT 8
#define PCX_CLIPPED 16
#define PCX_NORMAL 1
#define PCX_RLE 2
#define PCX_256COLOR 4
#define PCX_TRANSPARENT 8
#define PCX_CLIPPED 16
#define PCX_REALIZEPALETTE 32
#define PCX_X_CLIPPING 64
#define PCX_Y_CLIPPING 128
#define PCX_NOTLOADED 256
#define PCX_X_CLIPPING 64
#define PCX_Y_CLIPPING 128
#define PCX_NOTLOADED 256
#define PCX_ERROROPENING 1
#define PCX_INVALIDFORMAT 2
#define PCX_INVALIDLEN 4
#define PCX_OUTOFMEMORY 8
#define PCX_ERROROPENING 1
#define PCX_INVALIDFORMAT 2
#define PCX_INVALIDLEN 4
#define PCX_OUTOFMEMORY 8
BOOLEAN SetPcxPalette( PcxObject *pCurrentPcxObject, HIMAGE hImage );
@@ -68,7 +68,7 @@ BOOLEAN LoadPCXFileToImage( HIMAGE hImage, UINT16 fContents )
{
SetPcxPalette( pPcxObject, hImage );
// Create 16 BPP palette if flags and BPP justify
// Create 16 BPP palette if flags and BPP justify
hImage->pui16BPPPalette = Create16BPPPalette( hImage->pPalette );
}
@@ -82,24 +82,24 @@ BOOLEAN LoadPCXFileToImage( HIMAGE hImage, UINT16 fContents )
PcxObject *LoadPcx(STR8 pFilename)
{
PcxHeader Header;
PcxObject *pCurrentPcxObject;
HWFILE hFileHandle;
UINT32 uiFileSize;
UINT8 *pPcxBuffer;
// Open and read in the file
if ((hFileHandle = FileOpen(pFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE)) == 0)
{ // damn we failed to open the file
return NULL;
}
{
PcxHeader Header;
PcxObject *pCurrentPcxObject;
HWFILE hFileHandle;
UINT32 uiFileSize;
UINT8 *pPcxBuffer;
uiFileSize = FileGetSize(hFileHandle);
if (uiFileSize == 0)
{ // we failed to size up the file
return NULL;
}
// Open and read in the file
if ((hFileHandle = FileOpen(pFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE)) == 0)
{ // damn we failed to open the file
return NULL;
}
uiFileSize = FileGetSize(hFileHandle);
if (uiFileSize == 0)
{ // we failed to size up the file
return NULL;
}
// Create enw pCX object
pCurrentPcxObject = (PcxObject *) MemAlloc( sizeof( PcxObject ) );
@@ -115,241 +115,241 @@ PcxObject *LoadPcx(STR8 pFilename)
{
return( NULL );
}
// Ok we now have a file handle, so let's read in the data
FileRead(hFileHandle, &Header, sizeof(PcxHeader), NULL);
if ((Header.ubManufacturer != 10)||(Header.ubEncoding != 1))
{ // We have an invalid pcx format
// Delete the object
MemFree( pCurrentPcxObject->pPcxBuffer );
// Ok we now have a file handle, so let's read in the data
FileRead(hFileHandle, &Header, sizeof(PcxHeader), NULL);
if ((Header.ubManufacturer != 10)||(Header.ubEncoding != 1))
{ // We have an invalid pcx format
// Delete the object
MemFree( pCurrentPcxObject->pPcxBuffer );
MemFree( pCurrentPcxObject );
return( NULL );
}
return( NULL );
}
if (Header.ubBitsPerPixel == 8)
{
pCurrentPcxObject->usPcxFlags = PCX_256COLOR;
} else
{
pCurrentPcxObject->usPcxFlags = 0;
}
if (Header.ubBitsPerPixel == 8)
{
pCurrentPcxObject->usPcxFlags = PCX_256COLOR;
} else
{
pCurrentPcxObject->usPcxFlags = 0;
}
pCurrentPcxObject->usWidth = 1 + (Header.usRight - Header.usLeft);
pCurrentPcxObject->usHeight = 1 + (Header.usBottom - Header.usTop);
pCurrentPcxObject->uiBufferSize = uiFileSize - 768 - sizeof(PcxHeader);
pCurrentPcxObject->usWidth = 1 + (Header.usRight - Header.usLeft);
pCurrentPcxObject->usHeight = 1 + (Header.usBottom - Header.usTop);
pCurrentPcxObject->uiBufferSize = uiFileSize - 768 - sizeof(PcxHeader);
// We are ready to read in the pcx buffer data. Therefore we must lock the buffer
pPcxBuffer = pCurrentPcxObject->pPcxBuffer;
// We are ready to read in the pcx buffer data. Therefore we must lock the buffer
pPcxBuffer = pCurrentPcxObject->pPcxBuffer;
FileRead(hFileHandle, pPcxBuffer, pCurrentPcxObject->uiBufferSize, NULL);
FileRead(hFileHandle, pPcxBuffer, pCurrentPcxObject->uiBufferSize, NULL);
// Read in the palette
FileRead(hFileHandle, &(pCurrentPcxObject->ubPalette[0]), 768, NULL);
// Read in the palette
FileRead(hFileHandle, &(pCurrentPcxObject->ubPalette[0]), 768, NULL);
// Close file
FileClose( hFileHandle );
return pCurrentPcxObject;
return pCurrentPcxObject;
}
BOOLEAN BlitPcxToBuffer( PcxObject *pCurrentPcxObject, UINT8 *pBuffer, UINT16 usBufferWidth, UINT16 usBufferHeight, UINT16 usX, UINT16 usY, BOOLEAN fTransp)
{
UINT8 *pPcxBuffer;
UINT8 ubRepCount;
UINT16 usMaxX, usMaxY;
UINT32 uiImageSize;
UINT8 ubCurrentByte = 0;
UINT8 ubMode;
UINT16 usCurrentX, usCurrentY;
UINT32 uiOffset, uiIndex;
UINT32 uiNextLineOffset, uiStartOffset, uiCurrentOffset;
{
UINT8 *pPcxBuffer;
UINT8 ubRepCount;
UINT16 usMaxX, usMaxY;
UINT32 uiImageSize;
UINT8 ubCurrentByte = 0;
UINT8 ubMode;
UINT16 usCurrentX, usCurrentY;
UINT32 uiOffset, uiIndex;
UINT32 uiNextLineOffset, uiStartOffset, uiCurrentOffset;
pPcxBuffer = pCurrentPcxObject->pPcxBuffer;
pPcxBuffer = pCurrentPcxObject->pPcxBuffer;
if (((pCurrentPcxObject->usWidth + usX) == usBufferWidth)&&((pCurrentPcxObject->usHeight + usY)== usBufferHeight))
{ // Pre-compute PCX blitting aspects.
uiImageSize = usBufferWidth * usBufferHeight;
ubMode = PCX_NORMAL;
uiOffset = 0;
ubRepCount = 0;
if (((pCurrentPcxObject->usWidth + usX) == usBufferWidth)&&((pCurrentPcxObject->usHeight + usY)== usBufferHeight))
{ // Pre-compute PCX blitting aspects.
uiImageSize = usBufferWidth * usBufferHeight;
ubMode = PCX_NORMAL;
uiOffset = 0;
ubRepCount = 0;
// Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency.
if (fTransp == TRUE)
{
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{
ubMode = PCX_NORMAL;
}
}
if (ubCurrentByte != 0)
{
*(pBuffer + uiIndex) = ubCurrentByte;
}
}
}
else
{
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{ ubMode = PCX_NORMAL;
}
}
*(pBuffer + uiIndex) = ubCurrentByte;
}
}
} else
{ // Pre-compute PCX blitting aspects.
if ((pCurrentPcxObject->usWidth + usX) >= usBufferWidth)
{
pCurrentPcxObject->usPcxFlags |= PCX_X_CLIPPING;
usMaxX = usBufferWidth - 1;
}
else
{
usMaxX = pCurrentPcxObject->usWidth + usX;
}
// Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency.
if (fTransp == TRUE)
{
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{
ubMode = PCX_NORMAL;
}
}
if (ubCurrentByte != 0)
{
*(pBuffer + uiIndex) = ubCurrentByte;
}
}
}
else
{
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{ ubMode = PCX_NORMAL;
}
}
*(pBuffer + uiIndex) = ubCurrentByte;
}
}
} else
{ // Pre-compute PCX blitting aspects.
if ((pCurrentPcxObject->usWidth + usX) >= usBufferWidth)
{
pCurrentPcxObject->usPcxFlags |= PCX_X_CLIPPING;
usMaxX = usBufferWidth - 1;
}
else
{
usMaxX = pCurrentPcxObject->usWidth + usX;
}
if ((pCurrentPcxObject->usHeight + usY) >= usBufferHeight)
{
pCurrentPcxObject->usPcxFlags |= PCX_Y_CLIPPING;
uiImageSize = pCurrentPcxObject->usWidth * (usBufferHeight - usY);
usMaxY = usBufferHeight - 1;
}
else
{ uiImageSize = pCurrentPcxObject->usWidth * pCurrentPcxObject->usHeight;
usMaxY = pCurrentPcxObject->usHeight + usY;
}
if ((pCurrentPcxObject->usHeight + usY) >= usBufferHeight)
{
pCurrentPcxObject->usPcxFlags |= PCX_Y_CLIPPING;
uiImageSize = pCurrentPcxObject->usWidth * (usBufferHeight - usY);
usMaxY = usBufferHeight - 1;
}
else
{ uiImageSize = pCurrentPcxObject->usWidth * pCurrentPcxObject->usHeight;
usMaxY = pCurrentPcxObject->usHeight + usY;
}
ubMode = PCX_NORMAL;
uiOffset = 0;
ubRepCount = 0;
usCurrentX = usX;
usCurrentY = usY;
ubMode = PCX_NORMAL;
uiOffset = 0;
ubRepCount = 0;
usCurrentX = usX;
usCurrentY = usY;
// Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency.
if (fTransp == TRUE)
{
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{ ubMode = PCX_NORMAL;
}
}
if (ubCurrentByte != 0)
{ *(pBuffer + (usCurrentY*usBufferWidth) + usCurrentX) = ubCurrentByte;
}
usCurrentX++;
if (usCurrentX > usMaxX)
{
usCurrentX = usX;
usCurrentY++;
}
}
} else
{
uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX;
uiNextLineOffset = uiStartOffset + usBufferWidth;
uiCurrentOffset = uiStartOffset;
// Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency.
if (fTransp == TRUE)
{
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{ ubMode = PCX_NORMAL;
}
}
if (ubCurrentByte != 0)
{ *(pBuffer + (usCurrentY*usBufferWidth) + usCurrentX) = ubCurrentByte;
}
usCurrentX++;
if (usCurrentX > usMaxX)
{
usCurrentX = usX;
usCurrentY++;
}
}
} else
{
uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX;
uiNextLineOffset = uiStartOffset + usBufferWidth;
uiCurrentOffset = uiStartOffset;
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{
ubMode = PCX_NORMAL;
}
}
for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++)
{
if (usCurrentX < usMaxX)
{ // We are within the visible bounds so we write the byte to buffer
*(pBuffer + uiCurrentOffset) = ubCurrentByte;
uiCurrentOffset++;
usCurrentX++;
}
else
{ if ((uiCurrentOffset + 1)< uiNextLineOffset)
{ // Increment the uiCurrentOffset
uiCurrentOffset++;
}
else
{ // Go to next line
usCurrentX = usX;
usCurrentY++;
if (usCurrentY > usMaxY)
{
break;
}
uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX;
uiNextLineOffset = uiStartOffset + usBufferWidth;
uiCurrentOffset = uiStartOffset;
}
}
}
}
}
if (ubMode == PCX_NORMAL)
{
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (ubCurrentByte > 0x0BF)
{
ubRepCount = ubCurrentByte & 0x03F;
ubCurrentByte = *(pPcxBuffer + uiOffset++);
if (--ubRepCount > 0)
{
ubMode = PCX_RLE;
}
}
}
else
{
if (--ubRepCount == 0)
{
ubMode = PCX_NORMAL;
}
}
if (usCurrentX < usMaxX)
{ // We are within the visible bounds so we write the byte to buffer
*(pBuffer + uiCurrentOffset) = ubCurrentByte;
uiCurrentOffset++;
usCurrentX++;
}
else
{ if ((uiCurrentOffset + 1)< uiNextLineOffset)
{ // Increment the uiCurrentOffset
uiCurrentOffset++;
}
else
{ // Go to next line
usCurrentX = usX;
usCurrentY++;
if (usCurrentY > usMaxY)
{
break;
}
uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX;
uiNextLineOffset = uiStartOffset + usBufferWidth;
uiCurrentOffset = uiStartOffset;
}
}
}
}
}
return( TRUE );
}
@@ -357,7 +357,7 @@ BOOLEAN BlitPcxToBuffer( PcxObject *pCurrentPcxObject, UINT8 *pBuffer, UINT16 us
BOOLEAN SetPcxPalette( PcxObject *pCurrentPcxObject, HIMAGE hImage )
{
UINT16 Index;
UINT8 *pubPalette;
UINT8 *pubPalette;
pubPalette = &(pCurrentPcxObject->ubPalette[0]);
@@ -369,14 +369,14 @@ BOOLEAN SetPcxPalette( PcxObject *pCurrentPcxObject, HIMAGE hImage )
return( FALSE );
}
// Initialize the proper palette entries
for (Index = 0; Index < 256; Index++)
{
hImage->pPalette[ Index ].peRed = *(pubPalette+(Index*3));
hImage->pPalette[ Index ].peGreen = *(pubPalette+(Index*3)+1);
hImage->pPalette[ Index ].peBlue = *(pubPalette+(Index*3)+2);
hImage->pPalette[ Index ].peFlags = 0;
}
// Initialize the proper palette entries
for (Index = 0; Index < 256; Index++)
{
hImage->pPalette[ Index ].peRed = *(pubPalette+(Index*3));
hImage->pPalette[ Index ].peGreen = *(pubPalette+(Index*3)+1);
hImage->pPalette[ Index ].peBlue = *(pubPalette+(Index*3)+2);
hImage->pPalette[ Index ].peFlags = 0;
}
return TRUE;
}
return TRUE;
}
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -22,9 +22,9 @@
void InitializeRandom()
{
// Seed the random-number generator with current time so that
// the numbers will be different every time we run.
srand( (unsigned) time(NULL) );
// Seed the random-number generator with current time so that
// the numbers will be different every time we run.
srand( (unsigned) time(NULL) );
#ifdef PRERANDOM_GENERATOR
//Pregenerate all of the random numbers.
for( guiPreRandomIndex = 0; guiPreRandomIndex < MAX_PREGENERATED_NUMS; guiPreRandomIndex++ )
@@ -46,7 +46,7 @@ UINT32 Random(UINT32 uiRange)
}
#endif
if (uiRange == 0)
if (uiRange == 0)
return(0);
return rand() * uiRange / RAND_MAX % uiRange;
}
@@ -73,7 +73,7 @@ UINT32 PreRandom( UINT32 uiRange )
uiNum = guiPreRandomNums[ guiPreRandomIndex ] * uiRange / RAND_MAX % uiRange;
//Replace the current pregenerated number with a new one.
//This was removed in the name of optimization. Uncomment if you hate recycling.
//This was removed in the name of optimization. Uncomment if you hate recycling.
//guiPreRandomNums[ guiPreRandomIndex ] = rand();
//Go to the next index.
+4 -4
View File
@@ -62,8 +62,8 @@ BOOLEAN InitializeRegistryKeys(STR lpszAppName, STR lpszRegistryKey)
//CHECKF(gpszProfileName == NULL);
// Note: this will leak the original gpszProfileName, but it
// will be freed when the application exits. No assumptions
// can be made on how gpszProfileName was allocated.
// will be freed when the application exits. No assumptions
// can be made on how gpszProfileName was allocated.
strcpy( gszAppName, lpszAppName);
strcpy( gszRegistryKey, lpszRegistryKey );
@@ -106,7 +106,7 @@ HKEY GetAppRegistryKey()
}
// returns key for:
// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection
// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection
// creating it if it doesn't exist.
// responsibility of the caller to call RegCloseKey() on the returned HKEY
HKEY GetSectionKey(STR lpszSection)
@@ -203,7 +203,7 @@ BOOLEAN GetProfileChar(STR lpszSection, STR lpszEntry, STR lpszDefault, STR lpsz
// assert(gpszProfileName != NULL);
//
// if (lpszDefault == NULL)
// lpszDefault = &afxChNil; // don't pass in NULL
// lpszDefault = &afxChNil; // don't pass in NULL
// TCHAR szT[4096];
// DWORD dw = ::GetPrivateProfileString(lpszSection, lpszEntry,
// lpszDefault, szT, _countof(szT), gpszProfileName);
+1 -1
View File
@@ -56,7 +56,7 @@ extern BOOLEAN InitializeRegistryKeys(STR strAppName, STR strRegistryKey);
extern HKEY GetAppRegistryKey();
// returns key for:
// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection
// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection
// creating it if it doesn't exist.
// responsibility of the caller to call RegCloseKey() on the returned HKEY
extern HKEY GetSectionKey(STR lpszSection);
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="SGP_2005Express"
ProjectGUID="{6283CE93-2960-4596-8E74-7A6FBA8716FF}"
RootNamespace="SGP_2005Express"
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;&#x0D;&#x0A;"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
MinimalRebuild="true"
@@ -103,7 +103,6 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
@@ -139,6 +138,69 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="MapEditor|Win32"
OutputDirectory="MapEditor"
IntermediateDirectory="MapEditor"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_2005Express.vsprops;..\ja2_2005ExpressEditor.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
@@ -418,6 +480,10 @@
RelativePath=".\Button System.cpp"
>
</File>
<File
RelativePath=".\Compression.cpp"
>
</File>
<File
RelativePath=".\Container.cpp"
>
@@ -458,6 +524,10 @@
RelativePath=".\FileMan.cpp"
>
</File>
<File
RelativePath=".\Flic.cpp"
>
</File>
<File
RelativePath=".\Font.cpp"
>
@@ -478,6 +548,10 @@
RelativePath=".\Install.cpp"
>
</File>
<File
RelativePath=".\Ja2 Libs.cpp"
>
</File>
<File
RelativePath=".\LibraryDataBase.cpp"
>
+288 -288
View File
@@ -10,126 +10,126 @@
RADDEFSTART
typedef struct SmackTag {
u32 Version; // SMK2 only right now
u32 Width; // Width (1 based, 640 for example)
u32 Height; // Height (1 based, 480 for example)
u32 Frames; // Number of frames (1 based, 100 = 100 frames)
u32 MSPerFrame; // Frame Rate
u32 SmackerType; // bit 0 set=ring frame
u32 LargestInTrack[7]; // Largest single size for each track
u32 tablesize; // Size of the init tables
u32 codesize; // Compression info
u32 absize; // ditto
u32 detailsize; // ditto
u32 typesize; // ditto
u32 TrackType[7]; // high byte=0x80-Comp,0x40-PCM data,0x20-16 bit,0x10-stereo
u32 extra; // extra value (should be zero)
u32 NewPalette; // set to one if the palette changed
u8 Palette[772]; // palette data
u32 PalType; // type of palette
u32 FrameNum; // Frame Number to be displayed
u32 FrameSize; // The current frame's size in bytes
u32 SndSize; // The current frame sound tracks' size in bytes
s32 LastRectx; // Rect set in from SmackToBufferRect (X coord)
s32 LastRecty; // Rect set in from SmackToBufferRect (Y coord)
s32 LastRectw; // Rect set in from SmackToBufferRect (Width)
s32 LastRecth; // Rect set in from SmackToBufferRect (Height)
u32 OpenFlags; // flags used on open
u32 LeftOfs; // Left Offset used in SmackTo
u32 TopOfs; // Top Offset used in SmackTo
u32 LargestFrameSize; // Largest frame size
u32 Highest1SecRate; // Highest 1 sec data rate
u32 Highest1SecFrame; // Highest 1 sec data rate starting frame
u32 ReadError; // Set to non-zero if a read error has ocurred
u32 addr32; // translated address for 16 bit interface
} Smack;
u32 Version; // SMK2 only right now
u32 Width; // Width (1 based, 640 for example)
u32 Height; // Height (1 based, 480 for example)
u32 Frames; // Number of frames (1 based, 100 = 100 frames)
u32 MSPerFrame; // Frame Rate
u32 SmackerType; // bit 0 set=ring frame
u32 LargestInTrack[7]; // Largest single size for each track
u32 tablesize; // Size of the init tables
u32 codesize; // Compression info
u32 absize; // ditto
u32 detailsize; // ditto
u32 typesize; // ditto
u32 TrackType[7]; // high byte=0x80-Comp,0x40-PCM data,0x20-16 bit,0x10-stereo
u32 extra; // extra value (should be zero)
u32 NewPalette; // set to one if the palette changed
u8 Palette[772]; // palette data
u32 PalType; // type of palette
u32 FrameNum; // Frame Number to be displayed
u32 FrameSize; // The current frame's size in bytes
u32 SndSize; // The current frame sound tracks' size in bytes
s32 LastRectx; // Rect set in from SmackToBufferRect (X coord)
s32 LastRecty; // Rect set in from SmackToBufferRect (Y coord)
s32 LastRectw; // Rect set in from SmackToBufferRect (Width)
s32 LastRecth; // Rect set in from SmackToBufferRect (Height)
u32 OpenFlags; // flags used on open
u32 LeftOfs; // Left Offset used in SmackTo
u32 TopOfs; // Top Offset used in SmackTo
u32 LargestFrameSize; // Largest frame size
u32 Highest1SecRate; // Highest 1 sec data rate
u32 Highest1SecFrame; // Highest 1 sec data rate starting frame
u32 ReadError; // Set to non-zero if a read error has ocurred
u32 addr32; // translated address for 16 bit interface
} Smack;
#define SmackHeaderSize(smk) ((((u8*)&((smk)->extra))-((u8*)(smk)))+4)
typedef struct SmackSumTag {
u32 TotalTime; // total time
u32 MS100PerFrame; // MS*100 per frame (100000/MS100PerFrame=Frames/Sec)
u32 TotalOpenTime; // Time to open and prepare for decompression
u32 TotalFrames; // Total Frames displayed
u32 SkippedFrames; // Total number of skipped frames
u32 SoundSkips; // Total number of sound skips
u32 TotalBlitTime; // Total time spent blitting
u32 TotalReadTime; // Total time spent reading
u32 TotalDecompTime; // Total time spent decompressing
u32 TotalBackReadTime; // Total time spent reading in background
u32 TotalReadSpeed; // Total io speed (bytes/second)
u32 SlowestFrameTime; // Slowest single frame time
u32 Slowest2FrameTime; // Second slowest single frame time
u32 SlowestFrameNum; // Slowest single frame number
u32 Slowest2FrameNum; // Second slowest single frame number
u32 AverageFrameSize; // Average size of the frame
u32 HighestMemAmount; // Highest amount of memory allocated
u32 TotalExtraMemory; // Total extra memory allocated
u32 HighestExtraUsed; // Highest extra memory actually used
u32 TotalTime; // total time
u32 MS100PerFrame; // MS*100 per frame (100000/MS100PerFrame=Frames/Sec)
u32 TotalOpenTime; // Time to open and prepare for decompression
u32 TotalFrames; // Total Frames displayed
u32 SkippedFrames; // Total number of skipped frames
u32 SoundSkips; // Total number of sound skips
u32 TotalBlitTime; // Total time spent blitting
u32 TotalReadTime; // Total time spent reading
u32 TotalDecompTime; // Total time spent decompressing
u32 TotalBackReadTime; // Total time spent reading in background
u32 TotalReadSpeed; // Total io speed (bytes/second)
u32 SlowestFrameTime; // Slowest single frame time
u32 Slowest2FrameTime; // Second slowest single frame time
u32 SlowestFrameNum; // Slowest single frame number
u32 Slowest2FrameNum; // Second slowest single frame number
u32 AverageFrameSize; // Average size of the frame
u32 HighestMemAmount; // Highest amount of memory allocated
u32 TotalExtraMemory; // Total extra memory allocated
u32 HighestExtraUsed; // Highest extra memory actually used
} SmackSum;
//=======================================================================
#define SMACKNEEDPAN 0x00020L // Will be setting the pan
#define SMACKNEEDPAN 0x00020L // Will be setting the pan
#define SMACKNEEDVOLUME 0x00040L // Will be setting the volume
#define SMACKFRAMERATE 0x00080L // Override fr (call SmackFrameRate first)
#define SMACKLOADEXTRA 0x00100L // Load the extra buffer during SmackOpen
#define SMACKFRAMERATE 0x00080L // Override fr (call SmackFrameRate first)
#define SMACKLOADEXTRA 0x00100L // Load the extra buffer during SmackOpen
#define SMACKPRELOADALL 0x00200L // Preload the entire animation
#define SMACKNOSKIP 0x00400L // Don't skip frames if falling behind
#define SMACKSIMULATE 0x00800L // Simulate the speed (call SmackSim first)
#define SMACKNOSKIP 0x00400L // Don't skip frames if falling behind
#define SMACKSIMULATE 0x00800L // Simulate the speed (call SmackSim first)
#define SMACKFILEHANDLE 0x01000L // Use when passing in a file handle
#define SMACKTRACK1 0x02000L // Play audio track 1
#define SMACKTRACK2 0x04000L // Play audio track 2
#define SMACKTRACK3 0x08000L // Play audio track 3
#define SMACKTRACK4 0x10000L // Play audio track 4
#define SMACKTRACK5 0x20000L // Play audio track 5
#define SMACKTRACK6 0x40000L // Play audio track 6
#define SMACKTRACK7 0x80000L // Play audio track 7
#define SMACKTRACK1 0x02000L // Play audio track 1
#define SMACKTRACK2 0x04000L // Play audio track 2
#define SMACKTRACK3 0x08000L // Play audio track 3
#define SMACKTRACK4 0x10000L // Play audio track 4
#define SMACKTRACK5 0x20000L // Play audio track 5
#define SMACKTRACK6 0x40000L // Play audio track 6
#define SMACKTRACK7 0x80000L // Play audio track 7
#define SMACKTRACKS (SMACKTRACK1|SMACKTRACK2|SMACKTRACK3|SMACKTRACK4|SMACKTRACK5|SMACKTRACK6|SMACKTRACK7)
#define SMACKBUFFERREVERSED 0x00000001
#define SMACKBUFFER555 0x80000000
#define SMACKBUFFER565 0xc0000000
#define SMACKBUFFER16 (SMACKBUFFER555|SMACKBUFFER565)
#define SMACKBUFFER555 0x80000000
#define SMACKBUFFER565 0xc0000000
#define SMACKBUFFER16 (SMACKBUFFER555|SMACKBUFFER565)
#define SMACKYINTERLACE 0x100000L // Force interleaving Y scaling
#define SMACKYDOUBLE 0x200000L // Force doubling Y scaling
#define SMACKYNONE (SMACKYINTERLACE|SMACKYDOUBLE) // Force normal Y scaling
#define SMACKYDOUBLE 0x200000L // Force doubling Y scaling
#define SMACKYNONE (SMACKYINTERLACE|SMACKYDOUBLE) // Force normal Y scaling
#define SMACKFILEISSMK 0x2000000L // Internal flag for 16 to 32 bit thunking
#define SMACKAUTOEXTRA 0xffffffffL // NOT A FLAG! - Use as extrabuf param
//=======================================================================
#define SMACKSURFACEFAST 0
#define SMACKSURFACESLOW 1
#define SMACKSURFACEDIRECT 2
#define SMACKSURFACEFAST 0
#define SMACKSURFACESLOW 1
#define SMACKSURFACEDIRECT 2
RADEXPFUNC Smack PTR4* RADEXPLINK SmackOpen(const char PTR4* name,u32 flags,u32 extrabuf);
#ifdef __RADMAC__
#include <files.h>
#include <files.h>
RADEXPFUNC Smack PTR4* RADEXPLINK SmackMacOpen(FSSpec* fsp,u32 flags,u32 extrabuf);
RADEXPFUNC Smack PTR4* RADEXPLINK SmackMacOpen(FSSpec* fsp,u32 flags,u32 extrabuf);
#endif
RADEXPFUNC u32 RADEXPLINK SmackDoFrame(Smack PTR4* smk);
RADEXPFUNC u32 RADEXPLINK SmackDoFrame(Smack PTR4* smk);
RADEXPFUNC void RADEXPLINK SmackNextFrame(Smack PTR4* smk);
RADEXPFUNC u32 RADEXPLINK SmackWait(Smack PTR4* smk);
RADEXPFUNC u32 RADEXPLINK SmackWait(Smack PTR4* smk);
RADEXPFUNC void RADEXPLINK SmackClose(Smack PTR4* smk);
RADEXPFUNC void RADEXPLINK SmackVolumePan(Smack PTR4* smk, u32 trackflag,u32 volume,u32 pan);
RADEXPFUNC void RADEXPLINK SmackSummary(Smack PTR4* smk,SmackSum PTR4* sum);
RADEXPFUNC u32 RADEXPLINK SmackSoundInTrack(Smack PTR4* smk,u32 trackflags);
RADEXPFUNC u32 RADEXPLINK SmackSoundOnOff(Smack PTR4* smk,u32 on);
RADEXPFUNC u32 RADEXPLINK SmackSoundInTrack(Smack PTR4* smk,u32 trackflags);
RADEXPFUNC u32 RADEXPLINK SmackSoundOnOff(Smack PTR4* smk,u32 on);
#ifndef __RADMAC__
RADEXPFUNC void RADEXPLINK SmackToScreen(Smack PTR4* smk,u32 left,u32 top,u32 BytePS,const u16 PTR4* WinTbl,void* SetBank,u32 Flags);
#endif
RADEXPFUNC void RADEXPLINK SmackToBuffer(Smack PTR4* smk,u32 left,u32 top,u32 Pitch,u32 destheight,const void PTR4* buf,u32 Flags);
RADEXPFUNC u32 RADEXPLINK SmackToBufferRect(Smack PTR4* smk, u32 SmackSurface);
RADEXPFUNC u32 RADEXPLINK SmackToBufferRect(Smack PTR4* smk, u32 SmackSurface);
RADEXPFUNC void RADEXPLINK SmackGoto(Smack PTR4* smk,u32 frame);
RADEXPFUNC void RADEXPLINK SmackColorRemapWithTrans(Smack PTR4* smk,const void PTR4* remappal,u32 numcolors,u32 paltype,u32 transindex);
@@ -138,7 +138,7 @@ RADEXPFUNC void RADEXPLINK SmackColorTrans(Smack PTR4* smk,const void PTR4* tran
RADEXPFUNC void RADEXPLINK SmackFrameRate(u32 forcerate);
RADEXPFUNC void RADEXPLINK SmackSimulate(u32 sim);
RADEXPFUNC u32 RADEXPLINK SmackGetTrackData(Smack PTR4* smk,void PTR4* dest,u32 trackflag);
RADEXPFUNC u32 RADEXPLINK SmackGetTrackData(Smack PTR4* smk,void PTR4* dest,u32 trackflag);
RADEXPFUNC void RADEXPLINK SmackSoundCheck(void);
@@ -150,23 +150,23 @@ RADEXPFUNC void RADEXPLINK SmackSoundCheck(void);
typedef struct _SMACKBLIT PTR4* HSMACKBLIT;
typedef struct _SMACKBLIT {
u32 Flags;
u8 PTR4* Palette;
u32 PalType;
u16 PTR4* SmoothTable;
u16 PTR4* Conv8to16Table;
u32 whichmode;
u32 palindex;
u32 t16index;
u32 smoothindex;
u32 smoothtype;
u32 firstpalette;
u32 Flags;
u8 PTR4* Palette;
u32 PalType;
u16 PTR4* SmoothTable;
u16 PTR4* Conv8to16Table;
u32 whichmode;
u32 palindex;
u32 t16index;
u32 smoothindex;
u32 smoothtype;
u32 firstpalette;
} SMACKBLIT;
#define SMACKBLIT1X 1
#define SMACKBLIT2X 2
#define SMACKBLIT2XSMOOTHING 4
#define SMACKBLIT2XINTERLACE 8
#define SMACKBLIT1X 1
#define SMACKBLIT2X 2
#define SMACKBLIT2XSMOOTHING 4
#define SMACKBLIT2XINTERLACE 8
RADEXPFUNC HSMACKBLIT RADEXPLINK SmackBlitOpen(u32 flags);
RADEXPFUNC void RADEXPLINK SmackBlitSetPalette(HSMACKBLIT sblit, void PTR4* Palette,u32 PalType);
@@ -186,244 +186,244 @@ RADEXPFUNC u32 RADEXPLINK SmackUseMMX(u32 flag); //0=off, 1=on, 2=query current
//======================================================================
#ifdef __RADDOS__
#define SMACKSOUNDNONE -1
#define SMACKSOUNDNONE -1
extern void* SmackTimerSetupAddr;
extern void* SmackTimerReadAddr;
extern void* SmackTimerDoneAddr;
extern void* SmackTimerSetupAddr;
extern void* SmackTimerReadAddr;
extern void* SmackTimerDoneAddr;
typedef void RADEXPLINK (*SmackTimerSetupType)(void);
typedef u32 RADEXPLINK (*SmackTimerReadType)(void);
typedef void RADEXPLINK (*SmackTimerDoneType)(void);
typedef void RADEXPLINK (*SmackTimerSetupType)(void);
typedef u32 RADEXPLINK (*SmackTimerReadType)(void);
typedef void RADEXPLINK (*SmackTimerDoneType)(void);
#define SmackTimerSetup() ((SmackTimerSetupType)(SmackTimerSetupAddr))()
#define SmackTimerRead() ((SmackTimerReadType)(SmackTimerReadAddr))()
#define SmackTimerDone() ((SmackTimerDoneType)(SmackTimerDoneAddr))()
#define SmackTimerSetup() ((SmackTimerSetupType)(SmackTimerSetupAddr))()
#define SmackTimerRead() ((SmackTimerReadType)(SmackTimerReadAddr))()
#define SmackTimerDone() ((SmackTimerDoneType)(SmackTimerDoneAddr))()
RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void* DigDriver);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void* DigDriver);
#ifndef AIL_startup
#ifdef __SW_3R
extern s32 cdecl AIL_startup_reg(void);
#define AIL_startup AIL_startup_reg
#else
extern s32 cdecl AIL_startup_stack(void);
#define AIL_startup AIL_startup_stack
#endif
#endif
#define SmackSoundMSSLiteInit() SmackSoundMSSLiteInitWithStart(&AIL_startup);
RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteInitWithStart(void* start);
RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteDone(void);
#ifndef AIL_startup
#ifdef __SW_3R
extern s32 cdecl AIL_startup_reg(void);
#define AIL_startup AIL_startup_reg
#else
extern s32 cdecl AIL_startup_stack(void);
#define AIL_startup AIL_startup_stack
#endif
#endif
#define SmackSoundMSSLiteInit() SmackSoundMSSLiteInitWithStart(&AIL_startup);
RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteInitWithStart(void* start);
RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteDone(void);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3r(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3s(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4r(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4s(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3r(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3s(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4r(u32 SOSDriver,u32 MaxTimerSpeed);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4s(u32 SOSDriver,u32 MaxTimerSpeed);
#ifdef __SW_3R
#define SmackSoundUseSOS3 SmackSoundUseSOS3r
#define SmackSoundUseSOS4 SmackSoundUseSOS4r
#else
#define SmackSoundUseSOS3 SmackSoundUseSOS3s
#define SmackSoundUseSOS4 SmackSoundUseSOS4s
#endif
#ifdef __SW_3R
#define SmackSoundUseSOS3 SmackSoundUseSOS3r
#define SmackSoundUseSOS4 SmackSoundUseSOS4r
#else
#define SmackSoundUseSOS3 SmackSoundUseSOS3s
#define SmackSoundUseSOS4 SmackSoundUseSOS4s
#endif
#else
#define SMACKRESRESET 0
#define SMACKRES640X400 1
#define SMACKRES640X480 2
#define SMACKRES800X600 3
#define SMACKRES1024X768 4
#define SMACKRESRESET 0
#define SMACKRES640X400 1
#define SMACKRES640X480 2
#define SMACKRES800X600 3
#define SMACKRES1024X768 4
RADEXPFUNC u32 RADEXPLINK SmackSetSystemRes(u32 mode); // use SMACKRES* values
RADEXPFUNC u32 RADEXPLINK SmackSetSystemRes(u32 mode); // use SMACKRES* values
#define SMACKNOCUSTOMBLIT 128
#define SMACKSMOOTHBLIT 256
#define SMACKINTERLACEBLIT 512
#define SMACKNOCUSTOMBLIT 128
#define SMACKSMOOTHBLIT 256
#define SMACKINTERLACEBLIT 512
#ifdef __RADMAC__
#ifdef __RADMAC__
#include <windows.h>
#include <palettes.h>
#include <qdoffscreen.h>
#include <windows.h>
#include <palettes.h>
#include <qdoffscreen.h>
#define SmackTimerSetup()
#define SmackTimerDone()
RADEXPFUNC u32 RADEXPLINK SmackTimerRead(void);
#define SmackTimerSetup()
#define SmackTimerDone()
RADEXPFUNC u32 RADEXPLINK SmackTimerRead(void);
RADEXPFUNC s32 RADEXPLINK SmackGDSurfaceType( GDHandle gd );
RADEXPFUNC s32 RADEXPLINK SmackGDSurfaceType( GDHandle gd );
#define SMACKAUTOBLIT 0
#define SMACKDIRECTBLIT 1
#define SMACKGWORLDBLIT 2
#define SMACKAUTOBLIT 0
#define SMACKDIRECTBLIT 1
#define SMACKGWORLDBLIT 2
typedef struct SmackBufTag {
u32 Reversed;
u32 SurfaceType; // SMACKSURFACExxxxxx
u32 BlitType; // SMACKxxxxxBLIT
u32 Width;
u32 Height;
u32 Pitch;
u32 Zoomed;
u32 ZWidth;
u32 ZHeight;
u32 DispColors; // colors on screen
u32 MaxPalColors;
u32 PalColorsInUse;
u32 StartPalColor;
u32 EndPalColor;
void* Buffer;
void* Palette;
u32 PalType;
u32 SoftwareCursor;
typedef struct SmackBufTag {
u32 Reversed;
u32 SurfaceType; // SMACKSURFACExxxxxx
u32 BlitType; // SMACKxxxxxBLIT
u32 Width;
u32 Height;
u32 Pitch;
u32 Zoomed;
u32 ZWidth;
u32 ZHeight;
u32 DispColors; // colors on screen
u32 MaxPalColors;
u32 PalColorsInUse;
u32 StartPalColor;
u32 EndPalColor;
void* Buffer;
void* Palette;
u32 PalType;
u32 SoftwareCursor;
WindowPtr wp;
GWorldPtr gwp;
CTabHandle cth;
PaletteHandle palh;
WindowPtr wp;
GWorldPtr gwp;
CTabHandle cth;
PaletteHandle palh;
GDHandle gd;
u32 gdSurfaceType;
HSMACKBLIT sblit;
void * ScreenAddr;
u32 ScreenPitch;
s32 manyblits;
s32 PTR4* blitrects;
s32 PTR4* rectsptr;
s32 maxrects;
s32 numrects;
GDHandle gd;
u32 gdSurfaceType;
HSMACKBLIT sblit;
void * ScreenAddr;
u32 ScreenPitch;
s32 manyblits;
s32 PTR4* blitrects;
s32 PTR4* rectsptr;
s32 maxrects;
s32 numrects;
} SmackBuf;
} SmackBuf;
#else
#else
#ifdef __RADWIN__
#ifdef __RADWIN__
#define INCLUDE_MMSYSTEM_H
#include "windows.h"
#include "windowsx.h"
#define INCLUDE_MMSYSTEM_H
#include "windows.h"
#include "windowsx.h"
#ifdef __RADNT__ // to combat WIN32_LEAN_AND_MEAN
#ifdef __RADNT__ // to combat WIN32_LEAN_AND_MEAN
#include "mmsystem.h"
#include "mmsystem.h"
RADEXPFUNC s32 RADEXPLINK SmackDDSurfaceType(void* lpDDS);
RADEXPFUNC s32 RADEXPLINK SmackDDSurfaceType(void* lpDDS);
#endif
#endif
#define SMACKAUTOBLIT 0
#define SMACKFULL320X240BLIT 1
#define SMACKFULL320X200BLIT 2
#define SMACKFULL320X200DIRECTBLIT 3
#define SMACKSTANDARDBLIT 4
#define SMACKWINGBLIT 5
#define SMACKDIBSECTIONBLIT 5
#define SMACKAUTOBLIT 0
#define SMACKFULL320X240BLIT 1
#define SMACKFULL320X200BLIT 2
#define SMACKFULL320X200DIRECTBLIT 3
#define SMACKSTANDARDBLIT 4
#define SMACKWINGBLIT 5
#define SMACKDIBSECTIONBLIT 5
#define WM_SMACKACTIVATE WM_USER+0x5678
#define WM_SMACKACTIVATE WM_USER+0x5678
typedef struct SmackBufTag {
u32 Reversed; // 1 if the buffer is upside down
u32 SurfaceType; // SMACKSURFACExxxx defines
u32 BlitType; // SMACKxxxxBLIT defines
u32 FullScreen; // 1 if full-screen
u32 Width;
u32 Height;
u32 Pitch;
u32 Zoomed;
u32 ZWidth;
u32 ZHeight;
u32 DispColors; // colors on the screen
u32 MaxPalColors; // total possible colors in palette (usually 256)
u32 PalColorsInUse; // Used colors in palette (usually 236)
u32 StartPalColor; // first usable color index (usually 10)
u32 EndPalColor; // last usable color index (usually 246)
RGBQUAD Palette[256];
u32 PalType;
u32 forceredraw; // force a complete redraw on next blit (for >8bit)
u32 didapalette; // force an invalidate on the next palette change
typedef struct SmackBufTag {
u32 Reversed; // 1 if the buffer is upside down
u32 SurfaceType; // SMACKSURFACExxxx defines
u32 BlitType; // SMACKxxxxBLIT defines
u32 FullScreen; // 1 if full-screen
u32 Width;
u32 Height;
u32 Pitch;
u32 Zoomed;
u32 ZWidth;
u32 ZHeight;
u32 DispColors; // colors on the screen
u32 MaxPalColors; // total possible colors in palette (usually 256)
u32 PalColorsInUse; // Used colors in palette (usually 236)
u32 StartPalColor; // first usable color index (usually 10)
u32 EndPalColor; // last usable color index (usually 246)
RGBQUAD Palette[256];
u32 PalType;
u32 forceredraw; // force a complete redraw on next blit (for >8bit)
u32 didapalette; // force an invalidate on the next palette change
void PTR4* Buffer;
void PTR4* DIBRestore;
u32 OurBitmap;
u32 OrigBitmap;
u32 OurPalette;
u32 WinGDC;
u32 FullFocused;
u32 ParentHwnd;
u32 OldParWndProc;
u32 OldDispWndProc;
u32 DispHwnd;
u32 WinGBufHandle;
void PTR4* lpDD;
void PTR4* lpDDSP;
u32 DDSurfaceType;
HSMACKBLIT DDblit;
s32 ddSoftwarecur;
s32 didaddblit;
s32 lastwasdd;
RECT ddscreen;
s32 manyblits;
s32 PTR4* blitrects;
s32 PTR4* rectsptr;
s32 maxrects;
s32 numrects;
HDC lastdc;
} SmackBuf;
void PTR4* Buffer;
void PTR4* DIBRestore;
u32 OurBitmap;
u32 OrigBitmap;
u32 OurPalette;
u32 WinGDC;
u32 FullFocused;
u32 ParentHwnd;
u32 OldParWndProc;
u32 OldDispWndProc;
u32 DispHwnd;
u32 WinGBufHandle;
void PTR4* lpDD;
void PTR4* lpDDSP;
u32 DDSurfaceType;
HSMACKBLIT DDblit;
s32 ddSoftwarecur;
s32 didaddblit;
s32 lastwasdd;
RECT ddscreen;
s32 manyblits;
s32 PTR4* blitrects;
s32 PTR4* rectsptr;
s32 maxrects;
s32 numrects;
HDC lastdc;
} SmackBuf;
RADEXPFUNC void RADEXPLINK SmackGet(Smack PTR4* smk,void PTR4* dest);
RADEXPFUNC void RADEXPLINK SmackBufferGet( SmackBuf PTR4* sbuf, void PTR4* dest);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void PTR4* dd);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseDirectSound(void PTR4* dd); // NULL=Create
RADEXPFUNC void RADEXPLINK SmackSoundSetDirectSoundHWND(HWND hw);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseDW(u32 openfreq, u32 openbits, u32 openchans);
RADEXPFUNC void RADEXPLINK SmackGet(Smack PTR4* smk,void PTR4* dest);
RADEXPFUNC void RADEXPLINK SmackBufferGet( SmackBuf PTR4* sbuf, void PTR4* dest);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void PTR4* dd);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseDirectSound(void PTR4* dd); // NULL=Create
RADEXPFUNC void RADEXPLINK SmackSoundSetDirectSoundHWND(HWND hw);
RADEXPFUNC u8 RADEXPLINK SmackSoundUseDW(u32 openfreq, u32 openbits, u32 openchans);
#define SmackTimerSetup()
#define SmackTimerDone()
#define SmackTimerRead timeGetTime
#define SmackTimerSetup()
#define SmackTimerDone()
#define SmackTimerRead timeGetTime
#endif
#endif
#endif
#endif
#ifdef __RADMAC__
RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( WindowPtr wp, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH );
RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh );
RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, s32 x, s32 y);
#ifdef __RADMAC__
RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( WindowPtr wp, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH );
RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh );
RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, s32 x, s32 y);
RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(GDHandle gd);
RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(WindowPtr wp,s32 x,s32 y,s32 w,s32 h);
RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount);
#else
RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( HWND wnd, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH );
RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, HDC dc, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh );
RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, HWND hw, s32 x, s32 y);
RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(GDHandle gd);
RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(WindowPtr wp,s32 x,s32 y,s32 w,s32 h);
RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount);
#else
RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( HWND wnd, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH );
RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, HDC dc, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh );
RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, HWND hw, s32 x, s32 y);
RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(void* lpDDSP,HCURSOR cur);
RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(HWND wnd,s32 x,s32 y,s32 w,s32 h);
RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount);
#endif
RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(void* lpDDSP,HCURSOR cur);
RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(HWND wnd,s32 x,s32 y,s32 w,s32 h);
RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount);
#endif
RADEXPFUNC void RADEXPLINK SmackBufferStartMultipleBlits( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferEndMultipleBlits( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferStartMultipleBlits( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferEndMultipleBlits( SmackBuf PTR4* sbuf );
RADEXPFUNC char PTR4* RADEXPLINK SmackBufferString(SmackBuf PTR4* sb,char PTR4* dest);
RADEXPFUNC char PTR4* RADEXPLINK SmackBufferString(SmackBuf PTR4* sb,char PTR4* dest);
RADEXPFUNC void RADEXPLINK SmackBufferNewPalette( SmackBuf PTR4* sbuf, const void PTR4* pal, u32 paltype );
RADEXPFUNC u32 RADEXPLINK SmackBufferSetPalette( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferClose( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferNewPalette( SmackBuf PTR4* sbuf, const void PTR4* pal, u32 paltype );
RADEXPFUNC u32 RADEXPLINK SmackBufferSetPalette( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferClose( SmackBuf PTR4* sbuf );
RADEXPFUNC void RADEXPLINK SmackBufferClear( SmackBuf PTR4* destbuf, u32 color);
RADEXPFUNC void RADEXPLINK SmackBufferClear( SmackBuf PTR4* destbuf, u32 color);
RADEXPFUNC void RADEXPLINK SmackBufferToBuffer( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh);
RADEXPFUNC void RADEXPLINK SmackBufferToBufferTrans( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor);
RADEXPFUNC void RADEXPLINK SmackBufferToBufferMask( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* maskbuf);
RADEXPFUNC void RADEXPLINK SmackBufferToBufferMerge( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* mergebuf);
RADEXPFUNC void RADEXPLINK SmackBufferCopyPalette( SmackBuf PTR4* destbuf, SmackBuf PTR4* sourcebuf, u32 remap);
RADEXPFUNC void RADEXPLINK SmackBufferToBuffer( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh);
RADEXPFUNC void RADEXPLINK SmackBufferToBufferTrans( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor);
RADEXPFUNC void RADEXPLINK SmackBufferToBufferMask( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* maskbuf);
RADEXPFUNC void RADEXPLINK SmackBufferToBufferMerge( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* mergebuf);
RADEXPFUNC void RADEXPLINK SmackBufferCopyPalette( SmackBuf PTR4* destbuf, SmackBuf PTR4* sourcebuf, u32 remap);
RADEXPFUNC u32 RADEXPLINK SmackBufferFocused( SmackBuf PTR4* sbuf);
RADEXPFUNC u32 RADEXPLINK SmackBufferFocused( SmackBuf PTR4* sbuf);
#endif
+31 -31
View File
@@ -82,7 +82,7 @@ BOOLEAN LoadSTCIFileToImage( HIMAGE hImage, UINT16 fContents )
TempImage.ubBitDepth = Header.ubDepth;
*hImage = TempImage;
return( TRUE );
return( TRUE );
}
BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * pHeader )
@@ -93,9 +93,9 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader *
{ // RGB doesn't have a palette!
return( FALSE );
}
if (fContents & IMAGE_BITMAPDATA)
{
{
// Allocate memory for the image data and read it in
hImage->pImageData = MemAlloc( pHeader->uiStoredSize );
if (hImage->pImageData == NULL)
@@ -103,7 +103,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader *
return( FALSE );
}
else if (!FileRead( hFile, hImage->pImageData, pHeader->uiStoredSize, &uiBytesRead ) || uiBytesRead != pHeader->uiStoredSize)
{
{
MemFree( hImage->pImageData );
return( FALSE );
}
@@ -116,7 +116,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader *
if (gusRedMask != (UINT16) pHeader->RGB.uiRedMask || gusGreenMask != (UINT16) pHeader->RGB.uiGreenMask || gusBlueMask != (UINT16) pHeader->RGB.uiBlueMask )
{
// colour distribution of the file is different from hardware! We have to change it!
// colour distribution of the file is different from hardware! We have to change it!
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Converting to current RGB distribution!" );
// Convert the image to the current hardware's specifications
if (gusRedMask > gusGreenMask && gusGreenMask > gusBlueMask)
@@ -137,7 +137,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader *
ConvertRGBDistribution565To556( hImage->p16BPPData, pHeader->usWidth * pHeader->usHeight );
return( TRUE );
}
else
else
{
// take the long route
ConvertRGBDistribution565ToAny( hImage->p16BPPData, pHeader->usWidth * pHeader->usHeight );
@@ -153,7 +153,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader *
}
}
}
#ifdef JA2
#ifdef JA2
return( TRUE );
#else
// Anything else is an ERROR! --DB
@@ -171,7 +171,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
if (fContents & IMAGE_PALETTE)
{ // Allocate memory for reading in the palette
if (pHeader->Indexed.uiNumberOfColours != 256)
{
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Palettized image has bad palette size." );
return( FALSE );
}
@@ -200,7 +200,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Problem setting hImage-format palette!" );
FileClose( hFile );
MemFree( pSTCIPalette );
return( FALSE );
return( FALSE );
}
hImage->fFlags |= IMAGE_PALETTE;
// Free the temporary buffer
@@ -213,11 +213,11 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Problem seeking past palette!" );
FileClose( hFile );
return( FALSE );
return( FALSE );
}
}
if (fContents & IMAGE_BITMAPDATA)
{
{
if (pHeader->fFlags & STCI_ETRLE_COMPRESSED)
{
// load data for the subimage (object) structures
@@ -229,17 +229,17 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Out of memory!" );
FileClose( hFile );
if (fContents & IMAGE_PALETTE)
if (fContents & IMAGE_PALETTE)
{
MemFree( hImage->pPalette );
}
return( FALSE );
}
if (!FileRead( hFile, hImage->pETRLEObject, uiFileSectionSize, &uiBytesRead ) || uiBytesRead != uiFileSectionSize)
{
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Error loading subimage structures!" );
FileClose( hFile );
if (fContents & IMAGE_PALETTE)
if (fContents & IMAGE_PALETTE)
{
MemFree( hImage->pPalette );
}
@@ -255,7 +255,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Out of memory!" );
FileClose( hFile );
if (fContents & IMAGE_PALETTE)
if (fContents & IMAGE_PALETTE)
{
MemFree( hImage->pPalette );
}
@@ -270,7 +270,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Error loading image data!" );
FileClose( hFile );
MemFree( hImage->pImageData );
if (fContents & IMAGE_PALETTE)
if (fContents & IMAGE_PALETTE)
{
MemFree( hImage->pPalette );
}
@@ -288,7 +288,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Problem seeking past image data!" );
FileClose( hFile );
return( FALSE );
return( FALSE );
}
}
@@ -301,7 +301,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Out of memory!" );
FileClose( hFile );
MemFree( hImage->pAppData );
if (fContents & IMAGE_PALETTE)
if (fContents & IMAGE_PALETTE)
{
MemFree( hImage->pPalette );
}
@@ -316,11 +316,11 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead
return( FALSE );
}
if (!FileRead( hFile, hImage->pAppData, pHeader->uiAppDataSize, &uiBytesRead ) || uiBytesRead != pHeader->uiAppDataSize)
{
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Error loading application-specific data!" );
FileClose( hFile );
MemFree( hImage->pAppData );
if (fContents & IMAGE_PALETTE)
if (fContents & IMAGE_PALETTE)
{
MemFree( hImage->pPalette );
}
@@ -362,16 +362,16 @@ BOOLEAN STCISetPalette( PTR pSTCIPalette, HIMAGE hImage )
return( FALSE );
}
// Initialize the proper palette entries
for (usIndex = 0; usIndex < 256; usIndex++)
{
hImage->pPalette[ usIndex ].peRed = pubPalette->ubRed;
// Initialize the proper palette entries
for (usIndex = 0; usIndex < 256; usIndex++)
{
hImage->pPalette[ usIndex ].peRed = pubPalette->ubRed;
hImage->pPalette[ usIndex ].peGreen = pubPalette->ubGreen;
hImage->pPalette[ usIndex ].peBlue = pubPalette->ubBlue;
hImage->pPalette[ usIndex ].peFlags = 0;
hImage->pPalette[ usIndex ].peBlue = pubPalette->ubBlue;
hImage->pPalette[ usIndex ].peFlags = 0;
pubPalette ++;
}
return TRUE;
}
return TRUE;
}
@@ -396,10 +396,10 @@ BOOLEAN IsSTCIETRLEFile( CHAR8 * ImageFile )
FileClose( hFile );
if (Header.fFlags & STCI_ETRLE_COMPRESSED)
{
return( TRUE );
return( TRUE );
}
else
{
return( FALSE );
return( FALSE );
}
}
}
File diff suppressed because it is too large Load Diff
+20 -20
View File
@@ -3,28 +3,28 @@
// YOU MUST KEEP THIS VARIABLE UP TO DATE !!!!
#define NUM_TOPIC_IDS 23
#define NUM_TOPIC_IDS 23
/* #define TOPIC_MEMORY_MANAGER 0
#define TOPIC_FILE_MANAGER 1
#define TOPIC_DATABASE_MANAGER 2
#define TOPIC_GAME 3
#define TOPIC_SGP 4
#define TOPIC_VIDEO 5
#define TOPIC_INPUT 6
#define TOPIC_STACK_CONTAINERS 7
#define TOPIC_LIST_CONTAINERS 8
#define TOPIC_QUEUE_CONTAINERS 9
#define TOPIC_PRILIST_CONTAINERS 10
#define TOPIC_HIMAGE 11
/* #define TOPIC_MEMORY_MANAGER 0
#define TOPIC_FILE_MANAGER 1
#define TOPIC_DATABASE_MANAGER 2
#define TOPIC_GAME 3
#define TOPIC_SGP 4
#define TOPIC_VIDEO 5
#define TOPIC_INPUT 6
#define TOPIC_STACK_CONTAINERS 7
#define TOPIC_LIST_CONTAINERS 8
#define TOPIC_QUEUE_CONTAINERS 9
#define TOPIC_PRILIST_CONTAINERS 10
#define TOPIC_HIMAGE 11
#define TOPIC_ORDLIST_CONTAINERS 12
#define TOPIC_3DENGINE 13
#define TOPIC_VIDEOOBJECT 14
#define TOPIC_FONT_HANDLER 15
#define TOPIC_VIDEOSURFACE 16
#define TOPIC_MOUSE_SYSTEM 17
#define TOPIC_BUTTON_HANDLER 18
#define TOPIC_MUTEX 19
#define TOPIC_3DENGINE 13
#define TOPIC_VIDEOOBJECT 14
#define TOPIC_FONT_HANDLER 15
#define TOPIC_VIDEOSURFACE 16
#define TOPIC_MOUSE_SYSTEM 17
#define TOPIC_BUTTON_HANDLER 18
#define TOPIC_MUTEX 19
#define TOPIC_JA2 20
#define TOPIC_BLIT_QUEUE 21
#define TOPIC_JA2OPPLIST 22
+12 -12
View File
@@ -3,23 +3,23 @@
// debug levels
#define DBG_LEVEL_0 0 // for registering and unregistering topics only
#define DBG_LEVEL_1 1 // for basic stuff
#define DBG_LEVEL_2 2 // for ordinary, I usually want to see them, messages
#define DBG_LEVEL_3 3 // nitty gritty detail
#define DBG_LEVEL_0 0 // for registering and unregistering topics only
#define DBG_LEVEL_1 1 // for basic stuff
#define DBG_LEVEL_2 2 // for ordinary, I usually want to see them, messages
#define DBG_LEVEL_3 3 // nitty gritty detail
// from client
#define TOPIC_REGISTER 0
#define TOPIC_UNREGISTER 1
#define TOPIC_MESSAGE 2
#define CLIENT_REGISTER 3
#define CLIENT_SHUTDOWN 4
#define TOPIC_REGISTER 0
#define TOPIC_UNREGISTER 1
#define TOPIC_MESSAGE 2
#define CLIENT_REGISTER 3
#define CLIENT_SHUTDOWN 4
// from server
#define SYSTEM_SHUTDOWN 0
#define MODULE_RESET 1
#define SET_DEBUG_LEVEL 2
#define SYSTEM_SHUTDOWN 0
#define MODULE_RESET 1
#define SET_DEBUG_LEVEL 2
#endif
+22 -22
View File
@@ -32,21 +32,21 @@
// HEY WIZARDRY DUDES, JA2 ISN'T THE ONLY PROGRAM WE COMPILE! :-)
#if defined( JA2 ) || defined( UTILS )
typedef unsigned int UINT32;
typedef signed int INT32;
typedef unsigned int UINT32;
typedef signed int INT32;
#else
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned int UINT32;
typedef int INT32;
#endif
// integers
typedef unsigned char UINT8;
typedef signed char INT8;
typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned char UINT8;
typedef signed char INT8;
typedef unsigned short UINT16;
typedef signed short INT16;
// floats
typedef float FLOAT;
typedef double DOUBLE;
typedef float FLOAT;
typedef double DOUBLE;
// strings
typedef char CHAR8;
typedef wchar_t CHAR16;
@@ -94,38 +94,38 @@ typedef CHAR8 SGPFILENAME[SGPFILENAME_LEN];
typedef struct
{
INT32 iLeft;
INT32 iTop;
INT32 iRight;
INT32 iBottom;
INT32 iLeft;
INT32 iTop;
INT32 iRight;
INT32 iBottom;
} SGPRect;
typedef struct
{
INT32 iX;
INT32 iY;
INT32 iY;
} SGPPoint;
typedef struct
{
INT32 Min;
INT32 Max;
INT32 Min;
INT32 Max;
} SGPRange;
typedef FLOAT VECTOR2[2]; // 2d vector (2x1 matrix)
typedef FLOAT VECTOR3[3]; // 3d vector (3x1 matrix)
typedef FLOAT VECTOR4[4]; // 4d vector (4x1 matrix)
typedef FLOAT VECTOR2[2]; // 2d vector (2x1 matrix)
typedef FLOAT VECTOR3[3]; // 3d vector (3x1 matrix)
typedef FLOAT VECTOR4[4]; // 4d vector (4x1 matrix)
typedef INT32 IVECTOR2[2]; // 2d vector (2x1 matrix)
typedef INT32 IVECTOR3[3]; // 3d vector (3x1 matrix)
typedef INT32 IVECTOR4[4]; // 4d vector (4x1 matrix)
typedef VECTOR3 MATRIX3[3]; // 3x3 matrix
typedef VECTOR4 MATRIX4[4]; // 4x4 matrix
typedef VECTOR3 MATRIX3[3]; // 3x3 matrix
typedef VECTOR4 MATRIX4[4]; // 4x4 matrix
//typedef VECTOR3 ANGLE; // angle return array //lal removed
typedef VECTOR4 COLOR; // rgba color array
+7 -7
View File
@@ -1,14 +1,14 @@
#ifndef __WCHECK_
#define __WCHECK_
#define CHECKF(exp) if (!(exp)) { return(FALSE); }
#define CHECKV(exp) if (!(exp)) { return; }
#define CHECKN(exp) if (!(exp)) { return(NULL); }
#define CHECKBI(exp) if (!(exp)) { return(-1); }
#define CHECKF(exp) if (!(exp)) { return(FALSE); }
#define CHECKV(exp) if (!(exp)) { return; }
#define CHECKN(exp) if (!(exp)) { return(NULL); }
#define CHECKBI(exp) if (!(exp)) { return(-1); }
#define CHECKASSERTF(exp) if (!(exp)) { ASSERT(0); return(FALSE); }
#define CHECKASSERTV(exp) if (!(exp)) { ASSERT(0); return; }
#define CHECKASSERTN(exp) if (!(exp)) { ASSERT(0); return(NULL); }
#define CHECKASSERTF(exp) if (!(exp)) { ASSERT(0); return(FALSE); }
#define CHECKASSERTV(exp) if (!(exp)) { ASSERT(0); return; }
#define CHECKASSERTN(exp) if (!(exp)) { ASSERT(0); return(NULL); }
#define CHECKASSERTBI(exp) if (!(exp)) { ASSERT(0); return(-1); }
#endif
+140 -140
View File
@@ -27,15 +27,15 @@ BOOLEAN gfEnumSucceed = FALSE;
#define MAX_WIN_FONTS 10
#define MAX_WIN_FONTS 10
// Private struct not to be exported
// to other modules
typedef struct
{
HFONT hFont;
COLORVAL ForeColor;
COLORVAL BackColor;
HFONT hFont;
COLORVAL ForeColor;
COLORVAL BackColor;
} HWINFONT;
@@ -44,7 +44,7 @@ LOGFONT gLogFont;
HWINFONT WinFonts[ MAX_WIN_FONTS ];
void Convert16BitStringTo8BitChineseBig5String( UINT8 *dst, UINT16 *src )
void Convert16BitStringTo8BitChineseBig5String( CHAR8 *dst, CHAR16 *src )
{
INT32 i, j;
STR8 ptr;
@@ -67,7 +67,7 @@ void Convert16BitStringTo8BitChineseBig5String( UINT8 *dst, UINT16 *src )
void InitWinFonts( )
{
memset( WinFonts, 0, sizeof( WinFonts ) );
memset( WinFonts, 0, sizeof( WinFonts ) );
}
void ShutdownWinFonts( )
@@ -77,15 +77,15 @@ void ShutdownWinFonts( )
INT32 FindFreeWinFont( void )
{
INT32 iCount;
INT32 iCount;
for( iCount = 0; iCount < MAX_WIN_FONTS; iCount++ )
{
{
if( WinFonts[ iCount ].hFont == NULL )
{
{
return( iCount );
}
}
}
}
return( -1 );
}
@@ -93,42 +93,42 @@ INT32 FindFreeWinFont( void )
HWINFONT *GetWinFont( INT32 iFont )
{
if ( iFont == -1 )
{
return( NULL );
}
if ( iFont == -1 )
{
return( NULL );
}
if ( WinFonts[ iFont ].hFont == NULL )
{
return( NULL );
}
else
{
return( &( WinFonts[ iFont ] ) );
}
if ( WinFonts[ iFont ].hFont == NULL )
{
return( NULL );
}
else
{
return( &( WinFonts[ iFont ] ) );
}
}
CHAR16 gzFontName[32];
INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement,
INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet )
INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement,
INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet )
{
INT32 iFont;
HFONT hFont;
CHAR8 szCharFontName[32]; //32 characters including null terminator (matches max font name length)
// Find free slot
iFont = FindFreeWinFont( );
INT32 iFont;
HFONT hFont;
CHAR8 szCharFontName[32]; //32 characters including null terminator (matches max font name length)
// Find free slot
iFont = FindFreeWinFont( );
if ( iFont == -1 )
{
return( iFont );
}
if ( iFont == -1 )
{
return( iFont );
}
//SET UP FONT WE WANT TO LOAD HERE
wcscpy( gzFontName, szFontName );
//ATTEMPT TO LOAD THE FONT NOW
sprintf( szCharFontName, "%S", szFontName );
sprintf( szCharFontName, "%S", szFontName );
if( DoesWinFontExistOnSystem( szFontName, iCharSet ) )
{
gLogFont.lfHeight = iHeight;
@@ -141,77 +141,77 @@ INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement,
return( -1 );
}
if ( hFont == NULL )
{
return( -1 );
}
if ( hFont == NULL )
{
return( -1 );
}
// Set font....
WinFonts[ iFont ].hFont = hFont;
// Set font....
WinFonts[ iFont ].hFont = hFont;
return( iFont );
return( iFont );
}
void DeleteWinFont( INT32 iFont )
void DeleteWinFont( INT32 iFont )
{
HWINFONT *pWinFont;
pWinFont = GetWinFont( iFont );
HWINFONT *pWinFont;
pWinFont = GetWinFont( iFont );
if ( pWinFont != NULL )
{
DeleteObject( pWinFont->hFont );
}
if ( pWinFont != NULL )
{
DeleteObject( pWinFont->hFont );
}
}
void SetWinFontForeColor( INT32 iFont, COLORVAL *pColor )
{
HWINFONT *pWinFont;
pWinFont = GetWinFont( iFont );
HWINFONT *pWinFont;
pWinFont = GetWinFont( iFont );
if ( pWinFont != NULL )
{
pWinFont->ForeColor = ( *pColor );
}
if ( pWinFont != NULL )
{
pWinFont->ForeColor = ( *pColor );
}
}
void SetWinFontBackColor( INT32 iFont, COLORVAL *pColor )
{
HWINFONT *pWinFont;
pWinFont = GetWinFont( iFont );
HWINFONT *pWinFont;
pWinFont = GetWinFont( iFont );
if ( pWinFont != NULL )
{
pWinFont->BackColor = ( *pColor );
}
if ( pWinFont != NULL )
{
pWinFont->BackColor = ( *pColor );
}
}
void PrintWinFont( UINT32 uiDestBuf, INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...)
{
va_list argptr;
CHAR16 string2[512];
CHAR8 string[512];
HVSURFACE hVSurface;
LPDIRECTDRAWSURFACE2 pDDSurface;
HDC hdc;
RECT rc;
HWINFONT *pWinFont;
int len;
SIZE RectSize;
pWinFont = GetWinFont( iFont );
va_list argptr;
CHAR16 string2[512];
CHAR8 string[512];
HVSURFACE hVSurface;
LPDIRECTDRAWSURFACE2 pDDSurface;
HDC hdc;
RECT rc;
HWINFONT *pWinFont;
int len;
SIZE RectSize;
pWinFont = GetWinFont( iFont );
if ( pWinFont == NULL )
{
return;
}
if ( pWinFont == NULL )
{
return;
}
va_start(argptr, pFontString); // Set up variable argument pointer
va_start(argptr, pFontString); // Set up variable argument pointer
len = vswprintf(string2, pFontString, argptr); // process gprintf string (get output str)
va_end(argptr);
@@ -221,38 +221,38 @@ void PrintWinFont( UINT32 uiDestBuf, INT32 iFont, INT32 x, INT32 y, STR16 pFontS
sprintf( string, "%S", string2 );
#endif
// Get surface...
GetVideoSurface( &hVSurface, uiDestBuf );
// Get surface...
GetVideoSurface( &hVSurface, uiDestBuf );
pDDSurface = GetVideoSurfaceDDSurface( hVSurface );
pDDSurface = GetVideoSurfaceDDSurface( hVSurface );
IDirectDrawSurface2_GetDC( pDDSurface, &hdc );
IDirectDrawSurface2_GetDC( pDDSurface, &hdc );
SelectObject(hdc, pWinFont->hFont );
SetTextColor( hdc, pWinFont->ForeColor );
SetBkColor(hdc, pWinFont->BackColor );
SetBkMode(hdc, TRANSPARENT);
SelectObject(hdc, pWinFont->hFont );
SetTextColor( hdc, pWinFont->ForeColor );
SetBkColor(hdc, pWinFont->BackColor );
SetBkMode(hdc, TRANSPARENT);
GetTextExtentPoint32( hdc, string, len, &RectSize );
SetRect(&rc, x, y, x + RectSize.cx, y + RectSize.cy );
ExtTextOut( hdc, x, y, ETO_OPAQUE, &rc, string, len, NULL );
IDirectDrawSurface2_ReleaseDC( pDDSurface, hdc );
GetTextExtentPoint32( hdc, string, len, &RectSize );
SetRect(&rc, x, y, x + RectSize.cx, y + RectSize.cy );
ExtTextOut( hdc, x, y, ETO_OPAQUE, &rc, string, len, NULL );
IDirectDrawSurface2_ReleaseDC( pDDSurface, hdc );
}
INT16 WinFontStringPixLength( STR16 string2, INT32 iFont )
{
HWINFONT *pWinFont;
HDC hdc;
SIZE RectSize;
CHAR8 string[512];
pWinFont = GetWinFont( iFont );
HWINFONT *pWinFont;
HDC hdc;
SIZE RectSize;
CHAR8 string[512];
pWinFont = GetWinFont( iFont );
if ( pWinFont == NULL )
{
return( 0 );
}
if ( pWinFont == NULL )
{
return( 0 );
}
#ifdef TAIWANESE
Convert16BitStringTo8BitChineseBig5String( string, string2 );
@@ -260,28 +260,28 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont )
sprintf( string, "%S", string2 );
#endif
hdc = GetDC(NULL);
SelectObject(hdc, pWinFont->hFont );
GetTextExtentPoint32( hdc, string, strlen(string), &RectSize );
ReleaseDC(NULL, hdc);
return( (INT16)RectSize.cx );
hdc = GetDC(NULL);
SelectObject(hdc, pWinFont->hFont );
GetTextExtentPoint32( hdc, string, strlen(string), &RectSize );
ReleaseDC(NULL, hdc);
return( (INT16)RectSize.cx );
}
INT16 GetWinFontHeight( STR16 string2, INT32 iFont )
{
HWINFONT *pWinFont;
HDC hdc;
SIZE RectSize;
CHAR8 string[512];
HWINFONT *pWinFont;
HDC hdc;
SIZE RectSize;
CHAR8 string[512];
pWinFont = GetWinFont( iFont );
pWinFont = GetWinFont( iFont );
if ( pWinFont == NULL )
{
return( 0 );
}
if ( pWinFont == NULL )
{
return( 0 );
}
#ifdef TAIWANESE
Convert16BitStringTo8BitChineseBig5String( string, string2 );
@@ -289,34 +289,34 @@ INT16 GetWinFontHeight( STR16 string2, INT32 iFont )
sprintf( string, "%S", string2 );
#endif
hdc = GetDC(NULL);
SelectObject(hdc, pWinFont->hFont );
GetTextExtentPoint32( hdc, string, strlen(string), &RectSize );
ReleaseDC(NULL, hdc);
return( (INT16)RectSize.cy );
hdc = GetDC(NULL);
SelectObject(hdc, pWinFont->hFont );
GetTextExtentPoint32( hdc, string, strlen(string), &RectSize );
ReleaseDC(NULL, hdc);
return( (INT16)RectSize.cy );
}
UINT32 WinFont_mprintf( INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...)
{
va_list argptr;
CHAR16 string[512];
va_list argptr;
CHAR16 string[512];
va_start(argptr, pFontString); // Set up variable argument pointer
va_start(argptr, pFontString); // Set up variable argument pointer
vswprintf(string, pFontString, argptr); // process gprintf string (get output str)
va_end(argptr);
PrintWinFont( FontDestBuffer, iFont, x, y, string );
PrintWinFont( FontDestBuffer, iFont, x, y, string );
return( 1 );
return( 1 );
}
int CALLBACK EnumFontFamProc( CONST LOGFONT *lplf, CONST TEXTMETRIC *lptm, DWORD dwType, LPARAM lpData )
int CALLBACK EnumFontFamProc( CONST LOGFONT *lplf, CONST TEXTMETRIC *lptm, DWORD dwType, LPARAM lpData )
{
gfEnumSucceed = TRUE;
gfEnumSucceed = TRUE;
return( TRUE );
return( TRUE );
}
@@ -325,7 +325,7 @@ int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
CHAR8 szFontName[32];
sprintf( szFontName, "%S", gzFontName );
if( !strcmp( szFontName, (STR8) lpelfe->elfFullName ) )
if( !strcmp( szFontName, (STR8) lpelfe->elfFullName ) )
{
gfEnumSucceed = TRUE;
memcpy( &gLogFont, &(lpelfe->elfLogFont), sizeof( LOGFONT ) );
@@ -337,12 +337,12 @@ int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
BOOLEAN DoesWinFontExistOnSystem( STR16 pTypeFaceName, INT32 iCharSet )
{
HDC hdc;
HDC hdc;
char string[512];
LOGFONT LogFont;
hdc = GetDC(NULL);
hdc = GetDC(NULL);
gfEnumSucceed = FALSE;
gfEnumSucceed = FALSE;
// Copy into 8-bit!
sprintf( string, "%S", pTypeFaceName );
@@ -351,8 +351,8 @@ BOOLEAN DoesWinFontExistOnSystem( STR16 pTypeFaceName, INT32 iCharSet )
lstrcpy( (LPSTR)&LogFont.lfFaceName, string );
EnumFontFamiliesEx( hdc, &LogFont, (FONTENUMPROCA) EnumFontFamExProc, 0, 0 );
ReleaseDC(NULL, hdc);
return( gfEnumSucceed );
return( gfEnumSucceed );
}
+4 -4
View File
@@ -4,16 +4,16 @@
void InitWinFonts( );
void ShutdownWinFonts( );
INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement,
INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet );
void DeleteWinFont( INT32 iFont );
INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement,
INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet );
void DeleteWinFont( INT32 iFont );
void SetWinFontBackColor( INT32 iFont, COLORVAL *pColor );
void SetWinFontForeColor( INT32 iFont, COLORVAL *pColor );
void PrintWinFont( UINT32 uiDestBuf, INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...);
INT16 WinFontStringPixLength( STR16 string, INT32 iFont );
INT16 WinFontStringPixLength( STR16 string, INT32 iFont );
INT16 GetWinFontHeight( STR16 string, INT32 iFont );
UINT32 WinFont_mprintf( INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...);
+1 -1
View File
@@ -28,7 +28,7 @@
//**************************************************************************
#define MAX_MSG_LENGTH 128
#define NUM_MESSAGES 100
#define NUM_MESSAGES 100
//**************************************************************************
//
+89 -89
View File
@@ -13,49 +13,49 @@
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateReset z_inflateReset
# define compress z_compress
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateReset z_inflateReset
# define compress z_compress
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif
# ifndef __32BIT__
# define __32BIT__
# endif
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
# define MSDOS
#endif
/*
@@ -63,122 +63,122 @@
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#if defined(MSDOS) && !defined(__32BIT__)
# define MAXSEG_64K
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
# define UNALIGNED_OK
#endif
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
# define STDC
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
# define STDC
#endif
#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC)
# define STDC
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const
# endif
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
# define NO_DUMMY_DECL
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2 */
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
1 << (windowBits+2) + 1 << (memLevel+9)
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
1 << (windowBits+2) + 1 << (memLevel+9)
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR __far
# else
# define FAR far
# endif
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR __far
# else
# define FAR far
# endif
#endif
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__
# define SMALL_MEDIUM
# define FAR __far
# endif
# ifndef __32BIT__
# define SMALL_MEDIUM
# define FAR __far
# endif
#endif
#ifndef FAR
# define FAR
# define FAR
#endif
typedef unsigned char Byte; /* 8 bits */
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
typedef unsigned char Byte; /* 8 bits */
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#if defined(__BORLANDC__) && defined(SMALL_MEDIUM)
/* Borland C/C++ ignores FAR inside typedef */
# define Bytef Byte FAR
/* Borland C/C++ ignores FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void FAR *voidpf;
typedef void *voidp;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte FAR *voidpf;
typedef Byte *voidp;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
/* Compile with -DZLIB_DLL for Windows DLL support */
#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
# include <windows.h>
# define EXPORT WINAPI
# include <windows.h>
# define EXPORT WINAPI
#else
# define EXPORT
# define EXPORT
#endif
#endif /* _ZCONF_H */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+173 -173
View File
@@ -1,9 +1,9 @@
/*==========================================================================;
*
* Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved.
* Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved.
*
* File: dsound.h
* Content: DirectSound include file
* File: dsound.h
* Content: DirectSound include file
*
***************************************************************************/
@@ -15,14 +15,14 @@
#include <objbase.h>
#endif
#define _FACDS 0x878
#define MAKE_DSHRESULT( code ) MAKE_HRESULT( 1, _FACDS, code )
#define _FACDS 0x878
#define MAKE_DSHRESULT( code ) MAKE_HRESULT( 1, _FACDS, code )
#ifdef __cplusplus
extern "C" {
#endif
// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000}
// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000}
DEFINE_GUID(CLSID_DirectSound,
0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
@@ -35,7 +35,7 @@ DEFINE_GUID(IID_IDirectSoundBuffer,0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,
//==========================================================================;
//
// Structures...
// Structures...
//
//==========================================================================;
#ifdef __cplusplus
@@ -44,56 +44,56 @@ struct IDirectSound;
struct IDirectSoundBuffer;
#endif
typedef struct IDirectSound *LPDIRECTSOUND;
typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER;
typedef struct IDirectSoundBuffer **LPLPDIRECTSOUNDBUFFER;
typedef struct IDirectSound *LPDIRECTSOUND;
typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER;
typedef struct IDirectSoundBuffer **LPLPDIRECTSOUNDBUFFER;
typedef struct _DSCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwMinSecondarySampleRate;
DWORD dwMaxSecondarySampleRate;
DWORD dwPrimaryBuffers;
DWORD dwMaxHwMixingAllBuffers;
DWORD dwMaxHwMixingStaticBuffers;
DWORD dwMaxHwMixingStreamingBuffers;
DWORD dwFreeHwMixingAllBuffers;
DWORD dwFreeHwMixingStaticBuffers;
DWORD dwFreeHwMixingStreamingBuffers;
DWORD dwMaxHw3DAllBuffers;
DWORD dwMaxHw3DStaticBuffers;
DWORD dwMaxHw3DStreamingBuffers;
DWORD dwFreeHw3DAllBuffers;
DWORD dwFreeHw3DStaticBuffers;
DWORD dwFreeHw3DStreamingBuffers;
DWORD dwTotalHwMemBytes;
DWORD dwFreeHwMemBytes;
DWORD dwMaxContigFreeHwMemBytes;
DWORD dwUnlockTransferRateHwBuffers;
DWORD dwPlayCpuOverheadSwBuffers;
DWORD dwReserved1;
DWORD dwReserved2;
DWORD dwSize;
DWORD dwFlags;
DWORD dwMinSecondarySampleRate;
DWORD dwMaxSecondarySampleRate;
DWORD dwPrimaryBuffers;
DWORD dwMaxHwMixingAllBuffers;
DWORD dwMaxHwMixingStaticBuffers;
DWORD dwMaxHwMixingStreamingBuffers;
DWORD dwFreeHwMixingAllBuffers;
DWORD dwFreeHwMixingStaticBuffers;
DWORD dwFreeHwMixingStreamingBuffers;
DWORD dwMaxHw3DAllBuffers;
DWORD dwMaxHw3DStaticBuffers;
DWORD dwMaxHw3DStreamingBuffers;
DWORD dwFreeHw3DAllBuffers;
DWORD dwFreeHw3DStaticBuffers;
DWORD dwFreeHw3DStreamingBuffers;
DWORD dwTotalHwMemBytes;
DWORD dwFreeHwMemBytes;
DWORD dwMaxContigFreeHwMemBytes;
DWORD dwUnlockTransferRateHwBuffers;
DWORD dwPlayCpuOverheadSwBuffers;
DWORD dwReserved1;
DWORD dwReserved2;
} DSCAPS, *LPDSCAPS;
typedef struct _DSBCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwUnlockTransferRate;
DWORD dwPlayCpuOverhead;
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwUnlockTransferRate;
DWORD dwPlayCpuOverhead;
} DSBCAPS, *LPDSBCAPS;
typedef struct _DSBUFFERDESC
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
LPWAVEFORMATEX lpwfxFormat;
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
LPWAVEFORMATEX lpwfxFormat;
} DSBUFFERDESC, *LPDSBUFFERDESC;
@@ -109,11 +109,11 @@ extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, LPVOID
extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext );
#ifdef UNICODE
#define LPDSENUMCALLBACK LPDSENUMCALLBACKW
#define DirectSoundEnumerate DirectSoundEnumerateW
#define LPDSENUMCALLBACK LPDSENUMCALLBACKW
#define DirectSoundEnumerate DirectSoundEnumerateW
#else
#define LPDSENUMCALLBACK LPDSENUMCALLBACKA
#define DirectSoundEnumerate DirectSoundEnumerateA
#define LPDSENUMCALLBACK LPDSENUMCALLBACKA
#define DirectSoundEnumerate DirectSoundEnumerateA
#endif
//
@@ -124,34 +124,34 @@ extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID
#ifdef _WIN32
DECLARE_INTERFACE_( IDirectSound, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectSound methods ***/
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectSound methods ***/
STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE;
STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE;
STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE;
STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE;
STDMETHOD( Compact)(THIS ) PURE;
STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE;
STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE;
STDMETHOD( Initialize)(THIS_ GUID FAR * ) PURE;
STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE;
STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE;
STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE;
STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE;
STDMETHOD( Compact)(THIS ) PURE;
STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE;
STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE;
STDMETHOD( Initialize)(THIS_ GUID FAR * ) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p)
#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a)
#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b)
#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p)
#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a)
#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b)
#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#endif
#endif
@@ -164,54 +164,54 @@ DECLARE_INTERFACE_( IDirectSound, IUnknown )
#ifdef _WIN32
DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectSoundBuffer methods ***/
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectSoundBuffer methods ***/
STDMETHOD( GetCaps)(THIS_ LPDSBCAPS ) PURE;
STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE;
STDMETHOD( GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
STDMETHOD( GetVolume)(THIS_ LPLONG ) PURE;
STDMETHOD( GetPan)(THIS_ LPLONG ) PURE;
STDMETHOD( GetFrequency)(THIS_ LPDWORD ) PURE;
STDMETHOD( GetStatus)(THIS_ LPDWORD ) PURE;
STDMETHOD( Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE;
STDMETHOD( Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE;
STDMETHOD( Play)(THIS_ DWORD,DWORD,DWORD ) PURE;
STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE;
STDMETHOD( SetFormat)(THIS_ LPWAVEFORMATEX ) PURE;
STDMETHOD( SetVolume)(THIS_ LONG ) PURE;
STDMETHOD( SetPan)(THIS_ LONG ) PURE;
STDMETHOD( SetFrequency)(THIS_ DWORD ) PURE;
STDMETHOD( Stop)(THIS ) PURE;
STDMETHOD( Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE;
STDMETHOD( Restore)(THIS ) PURE;
STDMETHOD( GetCaps)(THIS_ LPDSBCAPS ) PURE;
STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE;
STDMETHOD( GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
STDMETHOD( GetVolume)(THIS_ LPLONG ) PURE;
STDMETHOD( GetPan)(THIS_ LPLONG ) PURE;
STDMETHOD( GetFrequency)(THIS_ LPDWORD ) PURE;
STDMETHOD( GetStatus)(THIS_ LPDWORD ) PURE;
STDMETHOD( Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE;
STDMETHOD( Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE;
STDMETHOD( Play)(THIS_ DWORD,DWORD,DWORD ) PURE;
STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE;
STDMETHOD( SetFormat)(THIS_ LPWAVEFORMATEX ) PURE;
STDMETHOD( SetVolume)(THIS_ LONG ) PURE;
STDMETHOD( SetPan)(THIS_ LONG ) PURE;
STDMETHOD( SetFrequency)(THIS_ DWORD ) PURE;
STDMETHOD( Stop)(THIS ) PURE;
STDMETHOD( Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE;
STDMETHOD( Restore)(THIS ) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b)
#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c)
#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a)
#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a)
#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a)
#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c)
#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a)
#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a)
#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a)
#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a)
#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p)
#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b)
#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c)
#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a)
#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a)
#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a)
#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c)
#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a)
#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a)
#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a)
#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a)
#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p)
#endif
#endif
@@ -222,137 +222,137 @@ DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown )
* Return Codes
*/
#define DS_OK 0
#define DS_OK 0
/*
* The call failed because resources (such as a priority level)
* were already being used by another caller.
* were already being used by another caller.
*/
#define DSERR_ALLOCATED MAKE_DSHRESULT( 10 )
#define DSERR_ALLOCATED MAKE_DSHRESULT( 10 )
/*
* The control (vol,pan,etc.) requested by the caller is not available.
*/
#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT( 30 )
#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT( 30 )
/*
* An invalid parameter was passed to the returning function
*/
#define DSERR_INVALIDPARAM E_INVALIDARG
#define DSERR_INVALIDPARAM E_INVALIDARG
/*
* This call is not valid for the current state of this object
*/
#define DSERR_INVALIDCALL MAKE_DSHRESULT( 50 )
#define DSERR_INVALIDCALL MAKE_DSHRESULT( 50 )
/*
* An undetermined error occured inside the DSound subsystem
*/
#define DSERR_GENERIC E_FAIL
#define DSERR_GENERIC E_FAIL
/*
* The caller does not have the priority level required for the function to
* succeed.
*/
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT( 70 )
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT( 70 )
/*
* The DSound subsystem couldn't allocate sufficient memory to complete the
* caller's request.
*/
#define DSERR_OUTOFMEMORY E_OUTOFMEMORY
#define DSERR_OUTOFMEMORY E_OUTOFMEMORY
/*
* The specified WAVE format is not supported
*/
#define DSERR_BADFORMAT MAKE_DSHRESULT( 100 )
#define DSERR_BADFORMAT MAKE_DSHRESULT( 100 )
/*
* The function called is not supported at this time
*/
#define DSERR_UNSUPPORTED E_NOTIMPL
#define DSERR_UNSUPPORTED E_NOTIMPL
/*
* No sound driver is available for use
*/
#define DSERR_NODRIVER MAKE_DSHRESULT( 120 )
#define DSERR_NODRIVER MAKE_DSHRESULT( 120 )
/*
* This object is already initialized
*/
#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT( 130 )
#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT( 130 )
/*
* This object does not support aggregation
*/
#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION
#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION
/*
* The buffer memory has been lost, and must be Restored.
*/
#define DSERR_BUFFERLOST MAKE_DSHRESULT( 150 )
#define DSERR_BUFFERLOST MAKE_DSHRESULT( 150 )
/*
* Another app has a higher priority level, preventing this call from
* succeeding.
*/
#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT( 160 )
#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT( 160 )
/*
* The Initialize() member on the Direct Sound Object has not been
* called or called successfully before calls to other members.
*/
#define DSERR_UNINITIALIZED MAKE_DSHRESULT( 170 )
#define DSERR_UNINITIALIZED MAKE_DSHRESULT( 170 )
//==========================================================================;
//
// Flags...
// Flags...
//
//==========================================================================;
#define DSCAPS_PRIMARYMONO 0x00000001
#define DSCAPS_PRIMARYSTEREO 0x00000002
#define DSCAPS_PRIMARY8BIT 0x00000004
#define DSCAPS_PRIMARY16BIT 0x00000008
#define DSCAPS_CONTINUOUSRATE 0x00000010
#define DSCAPS_EMULDRIVER 0x00000020
#define DSCAPS_CERTIFIED 0x00000040
#define DSCAPS_SECONDARYMONO 0x00000100
#define DSCAPS_SECONDARYSTEREO 0x00000200
#define DSCAPS_SECONDARY8BIT 0x00000400
#define DSCAPS_SECONDARY16BIT 0x00000800
#define DSCAPS_PRIMARYMONO 0x00000001
#define DSCAPS_PRIMARYSTEREO 0x00000002
#define DSCAPS_PRIMARY8BIT 0x00000004
#define DSCAPS_PRIMARY16BIT 0x00000008
#define DSCAPS_CONTINUOUSRATE 0x00000010
#define DSCAPS_EMULDRIVER 0x00000020
#define DSCAPS_CERTIFIED 0x00000040
#define DSCAPS_SECONDARYMONO 0x00000100
#define DSCAPS_SECONDARYSTEREO 0x00000200
#define DSCAPS_SECONDARY8BIT 0x00000400
#define DSCAPS_SECONDARY16BIT 0x00000800
#define DSBPLAY_LOOPING 0x00000001
#define DSBPLAY_LOOPING 0x00000001
#define DSBSTATUS_PLAYING 0x00000001
#define DSBSTATUS_BUFFERLOST 0x00000002
#define DSBSTATUS_LOOPING 0x00000004
#define DSBSTATUS_PLAYING 0x00000001
#define DSBSTATUS_BUFFERLOST 0x00000002
#define DSBSTATUS_LOOPING 0x00000004
#define DSBLOCK_FROMWRITECURSOR 0x00000001
#define DSBLOCK_FROMWRITECURSOR 0x00000001
#define DSSCL_NORMAL 1
#define DSSCL_PRIORITY 2
#define DSSCL_EXCLUSIVE 3
#define DSSCL_WRITEPRIMARY 4
#define DSSCL_NORMAL 1
#define DSSCL_PRIORITY 2
#define DSSCL_EXCLUSIVE 3
#define DSSCL_WRITEPRIMARY 4
#define DSBCAPS_PRIMARYBUFFER 0x00000001
#define DSBCAPS_STATIC 0x00000002
#define DSBCAPS_LOCHARDWARE 0x00000004
#define DSBCAPS_LOCSOFTWARE 0x00000008
#define DSBCAPS_CTRLFREQUENCY 0x00000020
#define DSBCAPS_CTRLPAN 0x00000040
#define DSBCAPS_CTRLVOLUME 0x00000080
#define DSBCAPS_CTRLDEFAULT 0x000000E0 // Pan + volume + frequency.
#define DSBCAPS_CTRLALL 0x000000E0 // All control capabilities
#define DSBCAPS_STICKYFOCUS 0x00004000
#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 // More accurate play cursor under emulation
#define DSBCAPS_PRIMARYBUFFER 0x00000001
#define DSBCAPS_STATIC 0x00000002
#define DSBCAPS_LOCHARDWARE 0x00000004
#define DSBCAPS_LOCSOFTWARE 0x00000008
#define DSBCAPS_CTRLFREQUENCY 0x00000020
#define DSBCAPS_CTRLPAN 0x00000040
#define DSBCAPS_CTRLVOLUME 0x00000080
#define DSBCAPS_CTRLDEFAULT 0x000000E0 // Pan + volume + frequency.
#define DSBCAPS_CTRLALL 0x000000E0 // All control capabilities
#define DSBCAPS_STICKYFOCUS 0x00004000
#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 // More accurate play cursor under emulation
#define DSSPEAKER_HEADPHONE 1
#define DSSPEAKER_MONO 2
#define DSSPEAKER_QUAD 3
#define DSSPEAKER_STEREO 4
#define DSSPEAKER_SURROUND 5
#define DSSPEAKER_HEADPHONE 1
#define DSSPEAKER_MONO 2
#define DSSPEAKER_QUAD 3
#define DSSPEAKER_STEREO 4
#define DSSPEAKER_SURROUND 5
@@ -363,4 +363,4 @@ DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown )
};
#endif
#endif /* __DSOUND_INCLUDED__ */
#endif /* __DSOUND_INCLUDED__ */
+104 -104
View File
@@ -3,131 +3,131 @@
#include "types.h"
#define SHIFT 16
#define CTRL 17
#define ALT 18
#define SHIFT 16
#define CTRL 17
#define ALT 18
#define F1 124
#define F2 125
#define F3 126
#define F4 127
#define F5 128
#define F6 129
#define F7 130
#define F8 131
#define F9 132
#define F10 133
#define F11 134
#define F12 135
#define F1 124
#define F2 125
#define F3 126
#define F4 127
#define F5 128
#define F6 129
#define F7 130
#define F8 131
#define F9 132
#define F10 133
#define F11 134
#define F12 135
#define SHIFT_F1 368
#define SHIFT_F2 369
#define SHIFT_F3 370
#define SHIFT_F4 371
#define SHIFT_F5 372
#define SHIFT_F6 373
#define SHIFT_F7 374
#define SHIFT_F8 375
#define SHIFT_F9 376
#define SHIFT_F10 377
#define SHIFT_F11 378
#define SHIFT_F12 379
#define SHIFT_F1 368
#define SHIFT_F2 369
#define SHIFT_F3 370
#define SHIFT_F4 371
#define SHIFT_F5 372
#define SHIFT_F6 373
#define SHIFT_F7 374
#define SHIFT_F8 375
#define SHIFT_F9 376
#define SHIFT_F10 377
#define SHIFT_F11 378
#define SHIFT_F12 379
#define ALT_F1 624
#define ALT_F2 625
#define ALT_F3 626
#define ALT_F4 627
#define ALT_F5 628
#define ALT_F6 629
#define ALT_F7 630
#define ALT_F8 631
#define ALT_F9 632
#define ALT_F10 633
#define ALT_F11 634
#define ALT_F12 635
#define ALT_F1 624
#define ALT_F2 625
#define ALT_F3 626
#define ALT_F4 627
#define ALT_F5 628
#define ALT_F6 629
#define ALT_F7 630
#define ALT_F8 631
#define ALT_F9 632
#define ALT_F10 633
#define ALT_F11 634
#define ALT_F12 635
#define CTRL_F1 880
#define CTRL_F2 881
#define CTRL_F3 882
#define CTRL_F4 883
#define CTRL_F5 884
#define CTRL_F6 885
#define CTRL_F7 886
#define CTRL_F8 887
#define CTRL_F9 888
#define CTRL_F10 889
#define CTRL_F11 890
#define CTRL_F12 891
#define CTRL_F1 880
#define CTRL_F2 881
#define CTRL_F3 882
#define CTRL_F4 883
#define CTRL_F5 884
#define CTRL_F6 885
#define CTRL_F7 886
#define CTRL_F8 887
#define CTRL_F9 888
#define CTRL_F10 889
#define CTRL_F11 890
#define CTRL_F12 891
#define ESC 27
#define TAB 9
#define CAPS 20
#define SCRL_LOCK 145 //*** this may be incorrect! DB
#define ESC 27
#define TAB 9
#define CAPS 20
#define SCRL_LOCK 145 //*** this may be incorrect! DB
#define SNAPSHOT 44
#define PAUSE 19
#define NUM_LOCK 144
#define BACKSPACE 8
#define PAUSE 19
#define NUM_LOCK 144
#define BACKSPACE 8
#define INSERT 245
#define DEL 246
#define INSERT 245
#define DEL 246
#ifndef JA2
// Stupid definition causes problems with headers that use the keyword END -- DB
#define KEY_END 247
#define KEY_END 247
#else
#define END 247
#endif
#define DNARROW 248
#define PGDN 249
#define LEFTARROW 250
#define RIGHTARROW 251
#define HOME 252
#define UPARROW 253
#define PGUP 254
#define DNARROW 248
#define PGDN 249
#define LEFTARROW 250
#define RIGHTARROW 251
#define HOME 252
#define UPARROW 253
#define PGUP 254
#define SHIFT_TAB 265
#define SHIFT_TAB 265
#define SHIFT_INSERT 501
#define SHIFT_DELETE 502
#define SHIFT_END 503
#define SHIFT_DNARROW 504
#define SHIFT_PGDN 505
#define SHIFT_LEFTARROW 506
#define SHIFT_RIGHTARROW 507
#define SHIFT_HOME 508
#define SHIFT_UPARROW 509
#define SHIFT_PGUP 510
#define SHIFT_INSERT 501
#define SHIFT_DELETE 502
#define SHIFT_END 503
#define SHIFT_DNARROW 504
#define SHIFT_PGDN 505
#define SHIFT_LEFTARROW 506
#define SHIFT_RIGHTARROW 507
#define SHIFT_HOME 508
#define SHIFT_UPARROW 509
#define SHIFT_PGUP 510
#define ALT_TAB 521
#define ALT_TAB 521
#define ALT_INSERT 757
#define ALT_DELETE 758
#define ALT_END 759
#define ALT_DNARROW 760
#define ALT_PGDN 761
#define ALT_LEFTARROW 762
#define ALT_RIGHTARROW 763
#define ALT_HOME 764
#define ALT_UPARROW 765
#define ALT_PGUP 766
#define ALT_INSERT 757
#define ALT_DELETE 758
#define ALT_END 759
#define ALT_DNARROW 760
#define ALT_PGDN 761
#define ALT_LEFTARROW 762
#define ALT_RIGHTARROW 763
#define ALT_HOME 764
#define ALT_UPARROW 765
#define ALT_PGUP 766
#define CTRL_TAB 777
#define CTRL_TAB 777
#define CTRL_INSERT 1013
#define CTRL_DELETE 1014
#define CTRL_END 1015
#define CTRL_DNARROW 1016
#define CTRL_PGDN 1017
#define CTRL_LEFTARROW 1018
#define CTRL_RIGHTARROW 1019
#define CTRL_HOME 1020
#define CTRL_UPARROW 1021
#define CTRL_PGUP 1022
#define CTRL_INSERT 1013
#define CTRL_DELETE 1014
#define CTRL_END 1015
#define CTRL_DNARROW 1016
#define CTRL_PGDN 1017
#define CTRL_LEFTARROW 1018
#define CTRL_RIGHTARROW 1019
#define CTRL_HOME 1020
#define CTRL_UPARROW 1021
#define CTRL_PGUP 1022
#define CURSOR 1023
#define CURSOR 1023
#define ENTER 13
#define SPACE 32
#define ENTER 13
#define SPACE 32
#endif
File diff suppressed because it is too large Load Diff
+24 -24
View File
@@ -26,7 +26,7 @@
//
//**************************************************************************
#define ErrFlicLibAccess -1
#define ErrFlicLibAccess -1
#define ErrFlicAccess -2
#define ErrFlicSeek -3
#define ErrFlicRead -4
@@ -76,7 +76,7 @@ typedef struct
Ushort frames; /* Number of frames in flic. */
Ushort width; /* Flic width in pixels. */
Ushort height; /* Flic height in pixels. */
Ushort depth; /* Bits per pixel. (Always 8 now.) */
Ushort depth; /* Bits per pixel. (Always 8 now.) */
Ushort flags; /* FLI_FINISHED | FLI_LOOPED ideally. */
Long speed; /* Delay between frames. */
Short reserved1; /* Set to zero. */
@@ -104,38 +104,38 @@ typedef struct
{
Pixel *pixels; /* Set to AOOO:0000 for hardware. */
int width, height; /* Dimensions of screen. (320x200) */
char change_palette; /*True means that the flic changes the palette */
char change_palette; /*True means that the flic changes the palette */
} FlicScreen; /* Device specific screen type. */
typedef struct
{
Ulong max_loop_count,
Ulong max_loop_count,
loop_count;
Ushort max_frame_index,
frame_index;
Ushort max_frame_index,
frame_index;
} FlicFrameStatus;
typedef struct
{
// lmlib_t *names;
long offset,
length;
// lmlib_t *names;
long offset,
length;
}FlicLib;
typedef struct _Flic
{
FlicHead head; /* Flic file header. */
FILE *file; /* File handle. */
const char *name; /* Name from flic_open. Helps error reporting. */
int xoff,yoff; /* Offset to display flic at. */
FlicHead head; /* Flic file header. */
FILE *file; /* File handle. */
const char *name; /* Name from flic_open. Helps error reporting. */
int xoff,yoff; /* Offset to display flic at. */
FlicFrameStatus status;
FlicScreen screen;
FlicLib lib;
FlicFrameStatus status;
FlicScreen screen;
FlicLib lib;
FlicOpenFunc *open;
FlicCheckFrameFunc *check_frame;
FlicSeekFunc *seek;
FlicOpenFunc *open;
FlicCheckFrameFunc *check_frame;
FlicSeekFunc *seek;
} Flic;
@@ -144,7 +144,7 @@ typedef struct _Flic
#define FLC_TYPE 0xAF12u /* Variable rez .FLC type ID */
/* Values for FlicHead.flags */
#define FLI_FINISHED 0x0001
#define FLI_LOOPED 0x0002
#define FLI_LOOPED 0x0002
/* Optional Prefix Header */
typedef struct
@@ -156,7 +156,7 @@ typedef struct
} PrefixHead;
/* Value for PrefixHead.type */
#define PREFIX_TYPE 0xF100u
#define PREFIX_TYPE 0xF100u
/* Frame Header */
typedef struct
@@ -205,9 +205,9 @@ void FlicSetOrigin(Flic *flic, unsigned x, unsigned y);
ErrCode FlicPlay(Flic *flic, Ulong max_loop);
void FlicClose(Flic *flic);
void FlicSeekFirst(Flic *flic);
int FlicAdvance(Flic *flic, BOOL fDecode);
int FlicAdvanceNoDecode(Flic *flic);
int FlicStart(char *filename, int width, int height, char *buffer, Flic *flic, char usepal);
int FlicAdvance(Flic *flic, BOOL fDecode);
int FlicAdvanceNoDecode(Flic *flic);
int FlicStart(char *filename, int width, int height, char *buffer, Flic *flic, char usepal);
void FlicStop(Flic *flic);
ErrCode FlicGetStats(char *filename, int width, int height, Flic *flic, int *piBufferSize, int *piColourPalSize);
ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuffer, INT *piNumColours);
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -1,12 +1,11 @@
#ifndef _FMOD_ERRORS_H
#define _FMOD_ERRORS_H
static STR8 FMOD_ErrorString(int errcode)
{
switch (errcode)
{
case FMOD_ERR_NONE: return "No errors";
case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first.";
case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first.";
case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called";
case FMOD_ERR_PLAY: return "Playing the sound failed.";
case FMOD_ERR_INIT: return "Error initializing output device.";
@@ -28,5 +27,4 @@ static STR8 FMOD_ErrorString(int errcode)
default : return "Unknown error";
};
}
#endif
+51 -51
View File
@@ -19,19 +19,19 @@
#include "vobject.h"
#endif
// This is the color substituted to keep a 24bpp -> 16bpp color
// This is the color substituted to keep a 24bpp->16bpp color
// from going transparent (0x0000) -- DB
#define BLACK_SUBSTITUTE 0x0001
#define BLACK_SUBSTITUTE 0x0001
UINT16 gusAlphaMask = 0;
UINT16 gusRedMask = 0;
UINT16 gusGreenMask = 0;
UINT16 gusBlueMask = 0;
INT16 gusRedShift = 0;
INT16 gusBlueShift = 0;
INT16 gusGreenShift = 0;
INT16 gusRedShift = 0;
INT16 gusBlueShift = 0;
INT16 gusGreenShift = 0;
// this funky union is used for fast 16-bit pixel format conversions
@@ -73,7 +73,7 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
do
{
iFileLoader = UNKNOWN_FILE_READER;
if ( _stricmp( Extension, "PCX" ) == 0 )
{
iFileLoader = PCX_FILE_READER;
@@ -113,11 +113,11 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
AssertMsg( hImage, "Failed to allocate memory for hImage in CreateImage");
// Initialize some values
memset( hImage, 0, sizeof( image_type ) );
//hImage->fFlags = 0;
// Set data pointers to NULL
//hImage->pImageData = NULL;
//hImage->pPalette = NULL;
//hImage->pPalette = NULL;
//hImage->pui16BPPPalette = NULL;
// Set filename and loader
@@ -151,7 +151,7 @@ BOOLEAN ReleaseImageData( HIMAGE hImage, UINT16 fContents )
{
Assert( hImage != NULL );
if ( (fContents & IMAGE_PALETTE) && (hImage->fFlags & IMAGE_PALETTE) )
{
//Destroy palette
@@ -170,7 +170,7 @@ BOOLEAN ReleaseImageData( HIMAGE hImage, UINT16 fContents )
// Remove contents flag
hImage->fFlags = hImage->fFlags ^ IMAGE_PALETTE;
}
if ( (fContents & IMAGE_BITMAPDATA) && (hImage->fFlags & IMAGE_BITMAPDATA) )
{
//Destroy image data
@@ -204,7 +204,7 @@ BOOLEAN LoadImageData( HIMAGE hImage, UINT16 fContents )
Assert( hImage != NULL );
// Switch on file loader
// Switch on file loader
switch( hImage->iFileLoader )
{
case TGA_FILE_READER:
@@ -226,7 +226,7 @@ BOOLEAN LoadImageData( HIMAGE hImage, UINT16 fContents )
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Unknown image loader was specified." );
}
if ( !fReturnVal )
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Error occured while reading image data." );
@@ -253,7 +253,7 @@ BOOLEAN CopyImageToBuffer( HIMAGE hImage, UINT32 fBufferType, BYTE *pDestBuf, UI
// Default do here
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Copying 8 BPP Imagery." );
return ( Copy8BPPImageTo8BPPBuffer( hImage, pDestBuf, usDestWidth, usDestHeight, usX, usY, srcRect ) );
return ( Copy8BPPImageTo8BPPBuffer( hImage, pDestBuf, usDestWidth, usDestHeight, usX, usY, srcRect ) );
}
@@ -303,7 +303,7 @@ BOOLEAN Copy8BPPCompressedImageTo8BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT
UINT8 * pDest;
UINT32 uiDestStart;
UINT8 * pScanLine;
PTR pDecompPtr;
@@ -386,7 +386,7 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN
UINT16 * pDest;
UINT16 * pDestTemp;
UINT32 uiDestStart;
UINT8 * pScanLine;
UINT8 * pScanLineTemp;
@@ -454,8 +454,8 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN
// decompress a scanline
uiDecompressed = Decompress( pDecompPtr, pScanLine, hImage->usWidth );
Assert( uiDecompressed == hImage->usWidth );
// set pointers and blit
// set pointers and blit
pDestTemp = pDest;
pScanLineTemp = pScanLine + srcRect->iLeft;
for (uiCol = 0; uiCol < uiLineSize; uiCol++ )
@@ -466,9 +466,9 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN
}
pDest += usDestWidth;
}
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, String( "End Copying at %p", pDest ) );
DecompressFini( pDecompPtr );
return( TRUE );
}
@@ -508,16 +508,16 @@ BOOLEAN Copy8BPPImageTo8BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDestW
Assert( usDestWidth >= uiLineSize );
Assert( usDestHeight >= uiNumLines );
// Copy line by line
pDest = ( UINT8*)pDestBuf + uiDestStart;
pSrc = hImage->p8BPPData + uiSrcStart;
pSrc = hImage->p8BPPData + uiSrcStart;
for( cnt = 0; cnt < uiNumLines-1; cnt++ )
{
memcpy( pDest, pSrc, uiLineSize );
pDest += usDestWidth;
pSrc += hImage->usWidth;
pSrc += hImage->usWidth;
}
// Do last line
memcpy( pDest, pSrc, uiLineSize );
@@ -551,16 +551,16 @@ BOOLEAN Copy16BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDes
CHECKF( usDestWidth >= uiLineSize );
CHECKF( usDestHeight >= uiNumLines );
// Copy line by line
pDest = ( UINT16*)pDestBuf + uiDestStart;
pSrc = hImage->p16BPPData + uiSrcStart;
pSrc = hImage->p16BPPData + uiSrcStart;
for( cnt = 0; cnt < uiNumLines-1; cnt++ )
{
memcpy( pDest, pSrc, uiLineSize * 2 );
pDest += usDestWidth;
pSrc += hImage->usWidth;
pSrc += hImage->usWidth;
}
// Do last line
memcpy( pDest, pSrc, uiLineSize * 2 );
@@ -586,11 +586,11 @@ BOOLEAN Copy8BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDest
{
UINT32 uiSrcStart, uiDestStart, uiNumLines, uiLineSize;
UINT32 rows, cols;
UINT8 *pSrc, *pSrcTemp;
UINT8 *pSrc, *pSrcTemp;
UINT16 *pDest, *pDestTemp;
UINT16 *p16BPPPalette;
p16BPPPalette = hImage->pui16BPPPalette;
// Assertions
@@ -614,10 +614,10 @@ BOOLEAN Copy8BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDest
CHECKF( usDestWidth >= uiLineSize );
CHECKF( usDestHeight >= uiNumLines );
// Convert to Pixel specification
pDest = ( UINT16*)pDestBuf + uiDestStart;
pSrc = hImage->p8BPPData + uiSrcStart;
pSrc = hImage->p8BPPData + uiSrcStart;
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, String( "Start Copying at %p", pDest ) );
// For every entry, look up into 16BPP palette
@@ -634,7 +634,7 @@ BOOLEAN Copy8BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDest
}
pDest += usDestWidth;
pSrc += hImage->usWidth;
pSrc += hImage->usWidth;
}
// Do last line
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, String( "End Copying at %p", pDest ) );
@@ -647,7 +647,7 @@ UINT16 *Create16BPPPalette( SGPPaletteEntry *pPalette )
{
UINT16 *p16BPPPalette, r16, g16, b16, usColor;
UINT32 cnt;
UINT8 r,g,b;
UINT8 r,g,b;
Assert( pPalette != NULL );
@@ -694,17 +694,17 @@ UINT16 *Create16BPPPalette( SGPPaletteEntry *pPalette )
/**********************************************************************************************
Create16BPPPaletteShaded
Creates an 8 bit to 16 bit palette table, and modifies the colors as it builds.
Creates an 8 bit to 16 bit palette table, and modifies the colors as it builds.
Parameters:
rscale, gscale, bscale:
rscale, gscale, bscale:
Color mode: Percentages (255=100%) of color to translate into destination palette.
Mono mode: Color for monochrome palette.
Mono mode: Color for monochrome palette.
mono:
TRUE or FALSE to create a monochrome palette. In mono mode, Luminance values for
TRUE or FALSE to create a monochrome palette. In mono mode, Luminance values for
colors are calculated, and the RGB color is shaded according to each pixel's brightness.
This can be used in several ways:
1) To "brighten" a palette, pass down RGB values that are higher than 100% ( > 255) for all
@@ -721,7 +721,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT
UINT16 *p16BPPPalette, r16, g16, b16, usColor;
UINT32 cnt, lumin;
UINT32 rmod, gmod, bmod;
UINT8 r,g,b;
UINT8 r,g,b;
Assert( pPalette != NULL );
@@ -743,7 +743,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT
gmod = (gscale*pPalette[ cnt ].peGreen/256);
bmod = (bscale*pPalette[ cnt ].peBlue/256);
}
r = (UINT8)__min(rmod, 255);
g = (UINT8)__min(gmod, 255);
b = (UINT8)__min(bmod, 255);
@@ -784,7 +784,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT
UINT16 Get16BPPColor( UINT32 RGBValue )
{
UINT16 r16, g16, b16, usColor = 0;
UINT8 r, g, b;
UINT8 r,g,b;
r = SGPGetRValue( RGBValue );
g = SGPGetGValue( RGBValue );
@@ -864,10 +864,10 @@ UINT32 GetRGBColor( UINT16 Value16BPP )
//
// Parameter List : Converts from RGB to SGPPaletteEntry
//
// Return Value pointer to the SGPPaletteEntry
//
// Return Value pointer to the SGPPaletteEntry
//
// Modification History :
// Dec 15th 1996 -> modified for use by Wizardry
// Dec 15th 1996->modified for use by Wizardry
//
//*****************************************************************************
@@ -881,8 +881,8 @@ SGPPaletteEntry *ConvertRGBToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOl
memset( pPalEntry, 0, sizeof(SGPPaletteEntry) * 256 );
pInitEntry = pPalEntry;
DbgMessage(TOPIC_HIMAGE, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry");
DbgMessage(TOPIC_HIMAGE, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry");
for(Index=0; Index <= (sbEnd-sbStart);Index++)
{
pPalEntry->peRed = *(pOldPalette + (Index*3));
@@ -892,7 +892,7 @@ SGPPaletteEntry *ConvertRGBToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOl
pPalEntry++;
}
return pInitEntry;
}
}
BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
{
@@ -928,7 +928,7 @@ void ConvertRGBDistribution565To555( UINT16 * p16BPPData, UINT32 uiNumberOfPixel
{
UINT16 * pPixel;
UINT32 uiLoop;
SplitUINT32 Pixel;
pPixel = p16BPPData;
@@ -956,7 +956,7 @@ void ConvertRGBDistribution565To655( UINT16 * p16BPPData, UINT32 uiNumberOfPixel
{
UINT16 * pPixel;
UINT32 uiLoop;
SplitUINT32 Pixel;
pPixel = p16BPPData;
@@ -983,7 +983,7 @@ void ConvertRGBDistribution565To556( UINT16 * p16BPPData, UINT32 uiNumberOfPixel
{
UINT16 * pPixel;
UINT32 uiLoop;
SplitUINT32 Pixel;
pPixel = p16BPPData;
@@ -1022,4 +1022,4 @@ void ConvertRGBDistribution565ToAny( UINT16 * p16BPPData, UINT32 uiNumberOfPixel
*pPixel = Get16BPPColor( uiTemp );
pPixel++;
}
}
}
+3 -3
View File
@@ -2,7 +2,7 @@
#define STCI_H
// Sir-Tech's Crazy Image (STCI) file format specifications. Each file is composed of:
// Sir-Tech's Crazy Image (STCI) file format specifications. Each file is composed of:
// 1 ImageFileHeader, uncompressed
// * Palette (STCI_INDEXED, size = uiNumberOfColours * PALETTE_ELEMENT_SIZE), uncompressed
// * SubRectInfo's (usNumberOfRects > 0, size = usNumberOfSubRects * sizeof(SubRectInfo) ), uncompressed
@@ -10,8 +10,8 @@
#include "Types.h"
#define STCI_ID_STRING "STCI"
#define STCI_ID_LEN 4
#define STCI_ID_STRING "STCI"
#define STCI_ID_LEN 4
#define STCI_ETRLE_COMPRESSED 0x0020
#define STCI_ZLIB_COMPRESSED 0x0010
+25 -25
View File
@@ -105,7 +105,7 @@ BOOLEAN LoadTGAFileToImage( HIMAGE hImage, UINT16 fContents )
break;
}
// Set remaining values
// Set remaining values
end:
FileClose( hFile );
@@ -122,7 +122,7 @@ end:
// Return Value :
// Modification history :
//
// 20nov96:HJH -> creation
// 20nov96:HJH ->creation
//
//**************************************************************************
@@ -141,7 +141,7 @@ BOOLEAN ReadUncompColMapImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8
// Return Value :
// Modification history :
//
// 20nov96:HJH -> creation
// 20nov96:HJH ->creation
//
//**************************************************************************
@@ -161,7 +161,7 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui
UINT8 uiImagePixelSize;
UINT8 uiImageDescriptor;
UINT32 iNumValues;
UINT16 cnt;
UINT16 cnt;
UINT32 i;
UINT8 r;
@@ -270,7 +270,7 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui
if ( !FileRead( hFile, &r, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
pBMPtr[ i*3 ] = r;
pBMPtr[ i*3 ] = r;
pBMPtr[ i*3+1 ] = g;
pBMPtr[ i*3+2 ] = b;
}
@@ -296,7 +296,7 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui
if ( !FileRead( hFile, &a, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
pBMData[ i*3 ] = r;
pBMData[ i*3 ] = r;
pBMData[ i*3+1 ] = g;
pBMData[ i*3+2 ] = b;
}
@@ -324,7 +324,7 @@ freeEnd:
// Return Value :
// Modification history :
//
// 20nov96:HJH -> creation
// 20nov96:HJH ->creation
//
//**************************************************************************
@@ -343,7 +343,7 @@ BOOLEAN ReadRLEColMapImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui
// Return Value :
// Modification history :
//
// 20nov96:HJH -> creation
// 20nov96:HJH ->creation
//
//**************************************************************************
@@ -385,13 +385,13 @@ BOOLEAN ConvertTGAToSystemBPPFormat( HIMAGE hImage )
ubScaleR = 0;
ubScaleG = 0;
ubScaleB = 0;
ubRNewShift = 10;
ubGNewShift = 5;
ubBNewShift = 0;
ubRNewShift = 10;
ubGNewShift = 5;
ubBNewShift = 0;
// Determine values
switch( uiBBitMask )
{
switch( uiBBitMask )
{
case 0x3f: // 0000000000111111 pixel mask for blue
// 5-5-6
@@ -400,30 +400,30 @@ BOOLEAN ConvertTGAToSystemBPPFormat( HIMAGE hImage )
ubScaleB = 1;
break;
case 0x1f: // 0000000000011111 pixel mask for blue
case 0x1f: // 0000000000011111 pixel mask for blue
switch( uiGBitMask )
{
{
case 0x7e0: // 0000011111100000 pixel mask for green
// 5-6-5
// 5-6-5
ubRNewShift = 11;
ubScaleG = 1;
ubScaleG = 1;
break;
case 0x3e0: // 0000001111100000 pixel mask for green
case 0x3e0: // 0000001111100000 pixel mask for green
switch( uiRBitMask )
{
{
case 0xfc00: // 1111110000000000 pixel mask for red
// 6-5-5
ubScaleR = 1;
break;
}
break;
}
break;
}
}
break;
}
break;
}
pData = hImage->pui16BPPPalette;
usX = 0;
@@ -448,7 +448,7 @@ BOOLEAN ConvertTGAToSystemBPPFormat( HIMAGE hImage )
usG = usG << ubScaleG;
usB = usB << ubScaleB;
hImage->p16BPPData[ usX * hImage->usWidth + usY ] = ((UINT16) ( ( usR << ubRNewShift | usG << ubGNewShift ) | usB ) );
hImage->p16BPPData[ usX * hImage->usWidth + usY ] = ((UINT16) ( ( usR << ubRNewShift | usG << ubGNewShift ) | usB ) );
usY++;
+1 -1
View File
@@ -44,7 +44,7 @@
extern "C" {
#endif
*/
BOOLEAN LoadTGAFileToImage( HIMAGE hImage, UINT16 fContents );
BOOLEAN LoadTGAFileToImage( HIMAGE hImage, UINT16 fContents );
/*
#ifdef __cplusplus
}
File diff suppressed because it is too large Load Diff
+47 -47
View File
@@ -25,17 +25,17 @@
#define ALT_DOWN 0x04
#define MAX_STRING_INPUT 64
#define DBL_CLK_TIME 300 // Increased by Alex, Jun-10-97, 200 felt too short
#define DBL_CLK_TIME 300 // Increased by Alex, Jun-10-97, 200 felt too short
#define BUTTON_REPEAT_TIMEOUT 250
#define BUTTON_REPEAT_TIME 50
typedef struct
{
UINT32 uiTimeStamp;
UINT16 usKeyState;
UINT16 usEvent;
UINT32 usParam;
UINT32 uiParam;
UINT32 uiTimeStamp;
UINT16 usKeyState;
UINT16 usEvent;
UINT32 usParam;
UINT32 uiParam;
} InputAtom;
@@ -46,17 +46,17 @@ typedef struct
typedef struct StringInput
{
UINT16 *pString;
UINT16 *pOriginalString;
UINT16 *pFilter;
UINT16 usMaxStringLength;
UINT16 usCurrentStringLength;
UINT16 usStringOffset;
UINT16 usLastCharacter;
BOOLEAN fInsertMode;
BOOLEAN fFocus;
struct StringInput *pPreviousString;
struct StringInput *pNextString;
UINT16 *pString;
UINT16 *pOriginalString;
UINT16 *pFilter;
UINT16 usMaxStringLength;
UINT16 usCurrentStringLength;
UINT16 usStringOffset;
UINT16 usLastCharacter;
BOOLEAN fInsertMode;
BOOLEAN fFocus;
struct StringInput *pPreviousString;
struct StringInput *pNextString;
} StringInput;
@@ -77,16 +77,16 @@ extern void DisableDoubleClk(void);
extern void GetMousePos(SGPPoint *Point);
extern StringInput *InitStringInput(UINT16 *pInputString, UINT16 usLength, UINT16 *pFilter);
extern void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString);
extern void LinkNextString(StringInput *pCurrentString, StringInput *pNextString);
extern UINT16 GetStringLastInput(void);
extern BOOLEAN StringInputHasFocus(void);
extern BOOLEAN SetStringFocus(StringInput *pStringDescriptor);
extern UINT16 GetCursorPositionInString(StringInput *pStringDescriptor);
extern UINT16 GetStringInputState(void);
extern BOOLEAN StringHasFocus(StringInput *pStringDescriptor);
extern UINT16 *GetString(StringInput *pStringDescriptor);
extern void EndStringInput(StringInput *pStringDescriptor);
extern void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString);
extern void LinkNextString(StringInput *pCurrentString, StringInput *pNextString);
extern UINT16 GetStringLastInput(void);
extern BOOLEAN StringInputHasFocus(void);
extern BOOLEAN SetStringFocus(StringInput *pStringDescriptor);
extern UINT16 GetCursorPositionInString(StringInput *pStringDescriptor);
extern UINT16 GetStringInputState(void);
extern BOOLEAN StringHasFocus(StringInput *pStringDescriptor);
extern UINT16 *GetString(StringInput *pStringDescriptor);
extern void EndStringInput(StringInput *pStringDescriptor);
extern BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags );
extern void RestrictMouseToXYXY(UINT16 usX1, UINT16 usY1, UINT16 usX2, UINT16 usY2);
@@ -94,7 +94,7 @@ extern void RestrictMouseCursor(SGPRect *pRectangle);
extern void FreeMouseCursor(void);
extern BOOLEAN IsCursorRestricted( void );
extern void GetRestrictedClipCursor( SGPRect *pRectangle );
extern void RestoreCursorClipRect( void );
extern void RestoreCursorClipRect( void );
void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos );
@@ -105,33 +105,33 @@ INT16 GetMouseWheelDeltaValue( UINT32 wParam );
extern void DequeueAllKeyBoardEvents();
extern BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed
extern BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed
extern INT16 gusMouseXPos; // X position of the mouse on screen
extern INT16 gusMouseYPos; // y position of the mouse on screen
extern BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed
extern BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed
extern INT16 gusMouseXPos; // X position of the mouse on screen
extern INT16 gusMouseYPos; // y position of the mouse on screen
extern BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed
extern BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed
extern BOOLEAN gfSGPInputReceived;
#define _KeyDown(a) gfKeyState[(a)]
#define _LeftButtonDown gfLeftButtonState
#define _RightButtonDown gfRightButtonState
#define _MouseXPos gusMouseXPos
#define _MouseYPos gusMouseYPos
#define _KeyDown(a) gfKeyState[(a)]
#define _LeftButtonDown gfLeftButtonState
#define _RightButtonDown gfRightButtonState
#define _MouseXPos gusMouseXPos
#define _MouseYPos gusMouseYPos
// NOTE: this may not be the absolute most-latest current mouse co-ordinates, use GetCursorPos for that
#define _gusMouseInside(x1,y1,x2,y2) ((gusMouseXPos >= x1) && (gusMouseXPos <= x2) && (gusMouseYPos >= y1) && (gusMouseYPos <= y2))
#define _gusMouseInside(x1,y1,x2,y2) ((gusMouseXPos >= x1) && (gusMouseXPos <= x2) && (gusMouseYPos >= y1) && (gusMouseYPos <= y2))
#define _EvType(a) ((InputAtom *)(a))->usEvent
#define _EvTimeStamp(a) ((InputAtom *)(a))->uiTimeStamp
#define _EvKey(a) ((InputAtom *)(a))->usParam
#define _EvMouseX(a) (UINT16)(((InputAtom *)(a))->uiParam & 0x0000ffff)
#define _EvMouseY(a) (UINT16)((((InputAtom *)(a))->uiParam & 0xffff0000) >> 16)
#define _EvShiftDown(a) (((InputAtom *)(a))->usKeyState & SHIFT_DOWN)
#define _EvCtrlDown(a) (((InputAtom *)(a))->usKeyState & CTRL_DOWN)
#define _EvAltDown(a) (((InputAtom *)(a))->usKeyState & ALT_DOWN)
#define _EvType(a) ((InputAtom *)(a))->usEvent
#define _EvTimeStamp(a) ((InputAtom *)(a))->uiTimeStamp
#define _EvKey(a) ((InputAtom *)(a))->usParam
#define _EvMouseX(a) (UINT16)(((InputAtom *)(a))->uiParam & 0x0000ffff)
#define _EvMouseY(a) (UINT16)((((InputAtom *)(a))->uiParam & 0xffff0000) >> 16)
#define _EvShiftDown(a) (((InputAtom *)(a))->usKeyState & SHIFT_DOWN)
#define _EvCtrlDown(a) (((InputAtom *)(a))->usKeyState & CTRL_DOWN)
#define _EvAltDown(a) (((InputAtom *)(a))->usKeyState & ALT_DOWN)
#ifdef __cplusplus
}
+242 -245
View File
@@ -16,7 +16,7 @@
// SetClippingRegionAndImageWidth( uiPitch, 15, 15, 30, 30 );
//
// LineDraw( TRUE, 10, 10, 200, 200, colour, pImageData);
// OR
// OR
// RectangleDraw( TRUE, 10, 10, 200, 200, colour, pImageData);
//**************************************************************************
@@ -32,14 +32,14 @@ int giClipYMin=0;
int giClipYMax=0;
void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength,
int Color, int ScreenWidth);
int Color, int ScreenWidth);
void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength,
int Color, int ScreenWidth);
int Color, int ScreenWidth);
void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance,
int RunLength, int Color, int ScreenWidth);
int RunLength, int Color, int ScreenWidth);
void DrawVerticalRun8(UINT8 **ScreenPtr, int XAdvance,
int RunLength, int Color, int ScreenWidth);
int RunLength, int Color, int ScreenWidth);
void SetClippingRegionAndImageWidth(
@@ -88,7 +88,7 @@ BOOL Clipt( FLOAT denom, FLOAT num, FLOAT *tE, FLOAT *tL )
BOOL ClipPoint( int x, int y )
{
return( x <= giClipXMax && x >= giClipXMin &&
return( x <= giClipXMax && x >= giClipXMin &&
y <= giClipYMax && y >= giClipYMin );
}
@@ -225,128 +225,128 @@ void LineDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Col
return;
}
/* Determine whether the line is X or Y major, and handle accordingly */
if (XDelta >= YDelta)
{
/* X major line */
/* Minimum # of pixels in a run in this line */
WholeStep = XDelta / YDelta;
/* Determine whether the line is X or Y major, and handle accordingly */
if (XDelta >= YDelta)
{
/* X major line */
/* Minimum # of pixels in a run in this line */
WholeStep = XDelta / YDelta;
/* Error term adjust each time Y steps by 1; used to tell when one
extra pixel should be drawn as part of a run, to account for
fractional steps along the X axis per 1-pixel steps along Y */
AdjUp = (XDelta % YDelta) * 2;
/* Error term adjust each time Y steps by 1; used to tell when one
extra pixel should be drawn as part of a run, to account for
fractional steps along the X axis per 1-pixel steps along Y */
AdjUp = (XDelta % YDelta) * 2;
/* Error term adjust when the error term turns over, used to factor
out the X step made at that time */
AdjDown = YDelta * 2;
/* Error term adjust when the error term turns over, used to factor
out the X step made at that time */
AdjDown = YDelta * 2;
/* Initial error term; reflects an initial step of 0.5 along the Y
axis */
ErrorTerm = (XDelta % YDelta) - (YDelta * 2);
/* Initial error term; reflects an initial step of 0.5 along the Y
axis */
ErrorTerm = (XDelta % YDelta) - (YDelta * 2);
/* The initial and last runs are partial, because Y advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* The initial and last runs are partial, because Y advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* If the basic run length is even and there's no fractional
advance, we have one pixel that could go to either the initial
or last partial run, which we'll arbitrarily allocate to the
last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there're an odd number of pixels per run, we have 1 pixel that can't
be allocated to either the initial or last partial run, so we'll add 0.5
to error term so this pixel will be handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += YDelta;
}
/* Draw the first, partial run of pixels */
DrawHorizontalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* Draw all full runs */
for (i=0; i<(YDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawHorizontalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawHorizontalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
else
{
/* Y major line */
/* If the basic run length is even and there's no fractional
advance, we have one pixel that could go to either the initial
or last partial run, which we'll arbitrarily allocate to the
last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there're an odd number of pixels per run, we have 1 pixel that can't
be allocated to either the initial or last partial run, so we'll add 0.5
to error term so this pixel will be handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += YDelta;
}
/* Draw the first, partial run of pixels */
DrawHorizontalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* Draw all full runs */
for (i=0; i<(YDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawHorizontalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawHorizontalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
else
{
/* Y major line */
/* Minimum # of pixels in a run in this line */
WholeStep = YDelta / XDelta;
/* Minimum # of pixels in a run in this line */
WholeStep = YDelta / XDelta;
/* Error term adjust each time X steps by 1; used to tell when 1 extra
pixel should be drawn as part of a run, to account for
fractional steps along the Y axis per 1-pixel steps along X */
AdjUp = (YDelta % XDelta) * 2;
/* Error term adjust each time X steps by 1; used to tell when 1 extra
pixel should be drawn as part of a run, to account for
fractional steps along the Y axis per 1-pixel steps along X */
AdjUp = (YDelta % XDelta) * 2;
/* Error term adjust when the error term turns over, used to factor
out the Y step made at that time */
AdjDown = XDelta * 2;
/* Error term adjust when the error term turns over, used to factor
out the Y step made at that time */
AdjDown = XDelta * 2;
/* Initial error term; reflects initial step of 0.5 along the X axis */
ErrorTerm = (YDelta % XDelta) - (XDelta * 2);
/* Initial error term; reflects initial step of 0.5 along the X axis */
ErrorTerm = (YDelta % XDelta) - (XDelta * 2);
/* The initial and last runs are partial, because X advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* The initial and last runs are partial, because X advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* If the basic run length is even and there's no fractional advance, we
have 1 pixel that could go to either the initial or last partial run,
which we'll arbitrarily allocate to the last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there are an odd number of pixels per run, we have one pixel
that can't be allocated to either the initial or last partial
run, so we'll add 0.5 to the error term so this pixel will be
handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += XDelta;
}
/* Draw the first, partial run of pixels */
DrawVerticalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* If the basic run length is even and there's no fractional advance, we
have 1 pixel that could go to either the initial or last partial run,
which we'll arbitrarily allocate to the last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there are an odd number of pixels per run, we have one pixel
that can't be allocated to either the initial or last partial
run, so we'll add 0.5 to the error term so this pixel will be
handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += XDelta;
}
/* Draw the first, partial run of pixels */
DrawVerticalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* Draw all full runs */
for (i=0; i<(XDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawVerticalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawVerticalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
/* Draw all full runs */
for (i=0; i<(XDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawVerticalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawVerticalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
}
//Draws a pixel in the specified color
@@ -369,9 +369,9 @@ void PixelDraw( BOOLEAN fClip, INT32 xp, INT32 yp, INT16 sColor, UINT8 *pScreen
}
/* Draws a horizontal run of pixels, then advances the bitmap pointer to
the first pixel of the next run. */
the first pixel of the next run. */
void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance,
int RunLength, int Color, int ScreenWidth)
int RunLength, int Color, int ScreenWidth)
{
int i;
UINT8 *WorkingScreenPtr = *ScreenPtr;
@@ -390,9 +390,9 @@ void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance,
}
/* Draws a vertical run of pixels, then advances the bitmap pointer to
the first pixel of the next run. */
the first pixel of the next run. */
void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance,
int RunLength, int Color, int ScreenWidth)
int RunLength, int Color, int ScreenWidth)
{
int i;
UINT8 *WorkingScreenPtr = *ScreenPtr;
@@ -414,10 +414,10 @@ void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance,
/* Draws a rectangle between the specified endpoints in color Color. */
void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr)
{
LineDraw( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr);
LineDraw( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr);
LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr);
LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr);
LineDraw( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr);
LineDraw( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr);
LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr);
LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr);
}
/***********************************************************************************
@@ -431,10 +431,10 @@ void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, shor
/* Draws a rectangle between the specified endpoints in color Color. */
void RectangleDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr)
{
LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr);
LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr);
LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr);
LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr);
LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr);
LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr);
LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr);
LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr);
}
/* Draws a line between the specified endpoints in color Color. */
@@ -443,7 +443,6 @@ void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Co
int Temp, AdjUp, AdjDown, ErrorTerm, XAdvance, XDelta, YDelta;
int WholeStep, InitialPixelCount, FinalPixelCount, i, RunLength;
int ScreenWidth = giImageWidth;
UINT8 col2 = Color>>8;
UINT8 col1 = Color & 0x00FF;
if ( fClip )
@@ -513,139 +512,138 @@ void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Co
return;
}
/* Determine whether the line is X or Y major, and handle accordingly */
if (XDelta >= YDelta)
{
/* X major line */
/* Minimum # of pixels in a run in this line */
WholeStep = XDelta / YDelta;
/* Determine whether the line is X or Y major, and handle accordingly */
if (XDelta >= YDelta)
{
/* X major line */
/* Minimum # of pixels in a run in this line */
WholeStep = XDelta / YDelta;
/* Error term adjust each time Y steps by 1; used to tell when one
extra pixel should be drawn as part of a run, to account for
fractional steps along the X axis per 1-pixel steps along Y */
AdjUp = (XDelta % YDelta) * 2;
/* Error term adjust each time Y steps by 1; used to tell when one
extra pixel should be drawn as part of a run, to account for
fractional steps along the X axis per 1-pixel steps along Y */
AdjUp = (XDelta % YDelta) * 2;
/* Error term adjust when the error term turns over, used to factor
out the X step made at that time */
AdjDown = YDelta * 2;
/* Error term adjust when the error term turns over, used to factor
out the X step made at that time */
AdjDown = YDelta * 2;
/* Initial error term; reflects an initial step of 0.5 along the Y
axis */
ErrorTerm = (XDelta % YDelta) - (YDelta * 2);
/* Initial error term; reflects an initial step of 0.5 along the Y
axis */
ErrorTerm = (XDelta % YDelta) - (YDelta * 2);
/* The initial and last runs are partial, because Y advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* The initial and last runs are partial, because Y advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* If the basic run length is even and there's no fractional
advance, we have one pixel that could go to either the initial
or last partial run, which we'll arbitrarily allocate to the
last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there're an odd number of pixels per run, we have 1 pixel that can't
be allocated to either the initial or last partial run, so we'll add 0.5
to error term so this pixel will be handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += YDelta;
}
/* Draw the first, partial run of pixels */
DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* Draw all full runs */
for (i=0; i<(YDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
else
{
/* Y major line */
/* If the basic run length is even and there's no fractional
advance, we have one pixel that could go to either the initial
or last partial run, which we'll arbitrarily allocate to the
last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there're an odd number of pixels per run, we have 1 pixel that can't
be allocated to either the initial or last partial run, so we'll add 0.5
to error term so this pixel will be handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += YDelta;
}
/* Draw the first, partial run of pixels */
DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* Draw all full runs */
for (i=0; i<(YDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
else
{
/* Y major line */
/* Minimum # of pixels in a run in this line */
WholeStep = YDelta / XDelta;
/* Minimum # of pixels in a run in this line */
WholeStep = YDelta / XDelta;
/* Error term adjust each time X steps by 1; used to tell when 1 extra
pixel should be drawn as part of a run, to account for
fractional steps along the Y axis per 1-pixel steps along X */
AdjUp = (YDelta % XDelta) * 2;
/* Error term adjust each time X steps by 1; used to tell when 1 extra
pixel should be drawn as part of a run, to account for
fractional steps along the Y axis per 1-pixel steps along X */
AdjUp = (YDelta % XDelta) * 2;
/* Error term adjust when the error term turns over, used to factor
out the Y step made at that time */
AdjDown = XDelta * 2;
/* Error term adjust when the error term turns over, used to factor
out the Y step made at that time */
AdjDown = XDelta * 2;
/* Initial error term; reflects initial step of 0.5 along the X axis */
ErrorTerm = (YDelta % XDelta) - (XDelta * 2);
/* Initial error term; reflects initial step of 0.5 along the X axis */
ErrorTerm = (YDelta % XDelta) - (XDelta * 2);
/* The initial and last runs are partial, because X advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* The initial and last runs are partial, because X advances only 0.5
for these runs, rather than 1. Divide one full run, plus the
initial pixel, between the initial and last runs */
InitialPixelCount = (WholeStep / 2) + 1;
FinalPixelCount = InitialPixelCount;
/* If the basic run length is even and there's no fractional advance, we
have 1 pixel that could go to either the initial or last partial run,
which we'll arbitrarily allocate to the last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there are an odd number of pixels per run, we have one pixel
that can't be allocated to either the initial or last partial
run, so we'll add 0.5 to the error term so this pixel will be
handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += XDelta;
}
/* Draw the first, partial run of pixels */
DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* If the basic run length is even and there's no fractional advance, we
have 1 pixel that could go to either the initial or last partial run,
which we'll arbitrarily allocate to the last run */
if ((AdjUp == 0) && ((WholeStep & 0x01) == 0))
{
InitialPixelCount--;
}
/* If there are an odd number of pixels per run, we have one pixel
that can't be allocated to either the initial or last partial
run, so we'll add 0.5 to the error term so this pixel will be
handled by the normal full-run loop */
if ((WholeStep & 0x01) != 0)
{
ErrorTerm += XDelta;
}
/* Draw the first, partial run of pixels */
DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth);
/* Draw all full runs */
for (i=0; i<(XDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
/* Draw all full runs */
for (i=0; i<(XDelta-1); i++)
{
RunLength = WholeStep; /* run is at least this long */
/* Advance the error term and add an extra pixel if the error
term so indicates */
if ((ErrorTerm += AdjUp) > 0)
{
RunLength++;
ErrorTerm -= AdjDown; /* reset the error term */
}
/* Draw this scan line's run */
DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth);
}
/* Draw the final run of pixels */
DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth);
return;
}
}
/* Draws a horizontal run of pixels, then advances the bitmap pointer to
the first pixel of the next run. */
the first pixel of the next run. */
void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance,
int RunLength, int Color, int ScreenWidth)
int RunLength, int Color, int ScreenWidth)
{
int i;
UINT8 *WorkingScreenPtr = *ScreenPtr;
UINT8 col2 = Color>>8;
UINT8 col1 = Color & 0x00FF;
for (i=0; i<RunLength; i++)
@@ -659,13 +657,12 @@ void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance,
}
/* Draws a vertical run of pixels, then advances the bitmap pointer to
the first pixel of the next run. */
the first pixel of the next run. */
void DrawVerticalRun8(UINT8 **ScreenPtr, int XAdvance,
int RunLength, int Color, int ScreenWidth)
int RunLength, int Color, int ScreenWidth)
{
int i;
UINT8 *WorkingScreenPtr = *ScreenPtr;
UINT8 col2 = Color>>8;
UINT8 col1 = Color & 0x00FF;
for (i=0; i<RunLength; i++)
+3 -3
View File
@@ -30,7 +30,7 @@
// SetClippingRegionAndImageWidth( uiPitch, 15, 15, 30, 30 );
//
// LineDraw( TRUE, 10, 10, 200, 200, colour, pImageData);
// OR
// OR
// RectangleDraw( TRUE, 10, 10, 200, 200, colour, pImageData);
// *****************************************************************************
@@ -50,11 +50,11 @@ extern "C" {
void SetClippingRegionAndImageWidth(
int iImageWidth,
int iClipStartX, int iClipStartY,
int iClipWidth, int iClipHeight );
int iClipWidth, int iClipHeight );
// NOTE:
// Don't send fClip==TRUE to LineDraw if you don't have to. So if you know
// that your line will be within the region you want it to be in, set
// that your line will be within the region you want it to be in, set
// fClip == FALSE.
void PixelDraw( BOOLEAN fClip, INT32 xp, INT32 yp, INT16 sColor, UINT8 *pScreen );
void LineDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr);
+88 -89
View File
@@ -7,7 +7,7 @@
// each region.
//
// Written by Bret Rowdon, Jan 30 '97
// Re-Written by Kris Morness, since...
// Re-Written by Kris Morness, since...
//
//=================================================================================================
@@ -55,7 +55,7 @@
//Max double click delay (in milliseconds) to be considered a double click
#define MSYS_DOUBLECLICK_DELAY 400
//
//Records and stores the last place the user clicked. These values are compared to the current
//Records and stores the last place the user clicked. These values are compared to the current
//click to determine if a double click event has been detected.
MOUSE_REGION *gpRegionLastLButtonDown = NULL;
MOUSE_REGION *gpRegionLastLButtonUp = NULL;
@@ -64,7 +64,7 @@ UINT32 guiRegionLastLButtonDownTime = 0;
extern void ReleaseAnchorMode(); //private function used here (implemented in Button System.c)
extern void ReleaseAnchorMode(); //private function used here (implemented in Button System.c)
// number of lines in height help text will be
INT16 GetNumberOfLinesInHeight( const STR16 pStringA );
@@ -96,12 +96,12 @@ MOUSE_REGION *MSYS_PrevRegion = NULL;
MOUSE_REGION *MSYS_CurrRegion = NULL;
//When set, the fast help text will be instantaneous, if consecutive regions with help text are
//hilighted. It is set, whenever the timer for the first help button expires, and the mode is
//hilighted. It is set, whenever the timer for the first help button expires, and the mode is
//cleared as soon as the cursor moves into no region or a region with no helptext.
BOOLEAN gfPersistantFastHelpMode;
INT16 gsFastHelpDelay = 600; // In timer ticks
BOOLEAN gfShowFastHelp = TRUE;
INT16 gsFastHelpDelay = 600; // In timer ticks
BOOLEAN gfShowFastHelp = TRUE;
// help text is done, now execute callback, if there is one
void ExecuteMouseHelpEndCallBack( MOUSE_REGION *region );
@@ -109,9 +109,9 @@ void ExecuteMouseHelpEndCallBack( MOUSE_REGION *region );
//Kris:
//NOTE: This doesn't really need to be here, however, it is a good indication that
//NOTE: This doesn't really need to be here, however, it is a good indication that
//when an error appears here, that you need to go below to the init code and initialize the
//values there as well. That's the only reason why I left this here.
//values there as well. That's the only reason why I left this here.
MOUSE_REGION MSYS_SystemBaseRegion = {
MSYS_ID_SYSTEM, MSYS_PRIORITY_SYSTEM, BASE_REGION_FLAGS,
-32767, -32767, 32767, 32767, 0, 0, 0, 0, 0, 0,
@@ -120,17 +120,17 @@ MOUSE_REGION MSYS_SystemBaseRegion = {
BOOLEAN gfRefreshUpdate = FALSE;
//Kris: December 3, 1997
//Kris: December 3, 1997
//Special internal debugging utilities that will ensure that you don't attempt to delete
//an already deleted region. It will also ensure that you don't create an identical region
//an already deleted region. It will also ensure that you don't create an identical region
//that already exists.
//TO REMOVE ALL DEBUG FUNCTIONALITY: simply comment out MOUSESYSTEM_DEBUGGING definition
//TO REMOVE ALL DEBUG FUNCTIONALITY: simply comment out MOUSESYSTEM_DEBUGGING definition
#ifdef JA2
#ifdef _DEBUG
#ifdef _DEBUG
#ifndef BOUNDS_CHECKER
#define MOUSESYSTEM_DEBUGGING
#define MOUSESYSTEM_DEBUGGING
#endif
#endif
#endif
#endif
#ifdef MOUSESYSTEM_DEBUGGING
@@ -254,11 +254,11 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
{
MSYS_Action |= MSYS_DO_LBUTTON_UP;
//Kris:
//Used only if applicable. This is used for that special button that is locked with the
//mouse press -- just like windows. When you release the button, the previous state
//of the button is restored if you released the mouse outside of it's boundaries. If
//Used only if applicable. This is used for that special button that is locked with the
//mouse press -- just like windows. When you release the button, the previous state
//of the button is restored if you released the mouse outside of it's boundaries. If
//you release inside of the button, the action is selected -- but later in the code.
//NOTE: It has to be here, because the mouse can be released anywhere regardless of
//NOTE: It has to be here, because the mouse can be released anywhere regardless of
//regions, buttons, etc.
#ifdef JA2
ReleaseAnchorMode();
@@ -323,7 +323,7 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
break;
default:
DbgMessage(TOPIC_MOUSE_SYSTEM, DBG_LEVEL_0, "ERROR -- MSYS 2 SGP Mouse Hook got bad type");
DbgMessage(TOPIC_MOUSE_SYSTEM, DBG_LEVEL_0, "ERROR -- MSYS 2 SGP Mouse Hook got bad type");
break;
}
}
@@ -519,7 +519,7 @@ void MSYS_DeleteRegionFromList(MOUSE_REGION *region)
{
if(region->prev)
region->prev->next = region->next;
// If not last node in list, adjust following node's ->prev entry.
// If not last node in list, adjust following node's->prev entry.
if( region->next )
region->next->prev = region->prev;
region->prev = region->next = NULL;
@@ -555,14 +555,14 @@ void MSYS_DeleteRegionFromList(MOUSE_REGION *region)
//======================================================================================================
// MSYS_UpdateMouseRegion
//
// Searches the list for the highest priority region and updates its info. It also dispatches
// Searches the list for the highest priority region and updates it's info. It also dispatches
// the callback functions
//
void MSYS_UpdateMouseRegion(void)
{
INT32 found;
UINT32 ButtonReason;
MOUSE_REGION *pTempRegion;
MOUSE_REGION *pTempRegion;
BOOLEAN fFound=FALSE;
found=FALSE;
@@ -578,10 +578,10 @@ void MSYS_UpdateMouseRegion(void)
while( !found && MSYS_CurrRegion )
{
if( MSYS_CurrRegion->uiFlags & (MSYS_REGION_ENABLED | MSYS_ALLOW_DISABLED_FASTHELP) &&
(MSYS_CurrRegion->RegionTopLeftX <= MSYS_CurrentMX) && // Check boundaries
(MSYS_CurrRegion->RegionTopLeftY <= MSYS_CurrentMY) &&
(MSYS_CurrRegion->RegionBottomRightX >= MSYS_CurrentMX) &&
(MSYS_CurrRegion->RegionBottomRightY >= MSYS_CurrentMY))
(MSYS_CurrRegion->RegionTopLeftX <= MSYS_CurrentMX) && // Check boundaries
(MSYS_CurrRegion->RegionTopLeftY <= MSYS_CurrentMY) &&
(MSYS_CurrRegion->RegionBottomRightX >= MSYS_CurrentMX) &&
(MSYS_CurrRegion->RegionBottomRightY >= MSYS_CurrentMY))
{
// We got the right region. We don't need to check for priorities 'cause
// the whole list is sorted the right way!
@@ -623,7 +623,7 @@ void MSYS_UpdateMouseRegion(void)
}
if (MSYS_CurrRegion)
MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay;
MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay;
// Force a callbacks to happen on previous region to indicate that
// the mouse has left the old region
@@ -643,7 +643,7 @@ void MSYS_UpdateMouseRegion(void)
{
if( MSYS_CurrRegion->FastHelpText && !( MSYS_CurrRegion->uiFlags & MSYS_FASTHELP_RESET ) )
{
//ExecuteMouseHelpEndCallBack( MSYS_CurrRegion );
//ExecuteMouseHelpEndCallBack( MSYS_CurrRegion );
MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay;
#ifdef _JA2_RENDER_DIRTY
if( MSYS_CurrRegion->uiFlags & MSYS_GOT_BACKGROUND )
@@ -666,7 +666,7 @@ void MSYS_UpdateMouseRegion(void)
}
// if the cursor is set and is not set to no cursor
if( MSYS_CurrRegion->uiFlags & MSYS_REGION_ENABLED &&
if( MSYS_CurrRegion->uiFlags & MSYS_REGION_ENABLED &&
MSYS_CurrRegion->uiFlags & MSYS_SET_CURSOR &&
MSYS_CurrRegion->Cursor != MSYS_NO_CURSOR )
{
@@ -674,26 +674,26 @@ void MSYS_UpdateMouseRegion(void)
}
else
{
// Addition Oct 10/1997 Carter, patch for mouse cursor
// start at region and find another region encompassing
pTempRegion=MSYS_CurrRegion->next;
while((pTempRegion!=NULL)&&(!fFound))
{
if((pTempRegion->uiFlags & MSYS_REGION_ENABLED) &&
(pTempRegion->RegionTopLeftX <= MSYS_CurrentMX) &&
(pTempRegion->RegionTopLeftY <= MSYS_CurrentMY) &&
(pTempRegion->RegionBottomRightX >= MSYS_CurrentMX) &&
(pTempRegion->RegionBottomRightY >= MSYS_CurrentMY)&&(pTempRegion->uiFlags & MSYS_SET_CURSOR))
// Addition Oct 10/1997 Carter, patch for mouse cursor
// start at region and find another region encompassing
pTempRegion=MSYS_CurrRegion->next;
while((pTempRegion!=NULL)&&(!fFound))
{
if((pTempRegion->uiFlags & MSYS_REGION_ENABLED) &&
(pTempRegion->RegionTopLeftX <= MSYS_CurrentMX) &&
(pTempRegion->RegionTopLeftY <= MSYS_CurrentMY) &&
(pTempRegion->RegionBottomRightX >= MSYS_CurrentMX) &&
(pTempRegion->RegionBottomRightY >= MSYS_CurrentMY)&&(pTempRegion->uiFlags & MSYS_SET_CURSOR))
{
fFound=TRUE;
if( pTempRegion->Cursor != MSYS_NO_CURSOR )
{
MSYS_SetCurrentCursor(pTempRegion->Cursor);
}
fFound=TRUE;
if( pTempRegion->Cursor != MSYS_NO_CURSOR )
{
MSYS_SetCurrentCursor(pTempRegion->Cursor);
}
pTempRegion=pTempRegion->next;
}
}
}
pTempRegion=pTempRegion->next;
}
}
}
// OK, if we do not have a button down, any button is game!
@@ -746,19 +746,19 @@ void MSYS_UpdateMouseRegion(void)
gusClickedIDNumber = MSYS_CurrRegion->IDNumber;
}
if(MSYS_Action & MSYS_DO_RBUTTON_UP )
if(MSYS_Action & MSYS_DO_RBUTTON_UP )
{
ButtonReason|=MSYS_CALLBACK_REASON_RBUTTON_UP;
gfClickedModeOn = FALSE;
}
// ATE: Added repeat resons....
if(MSYS_Action & MSYS_DO_LBUTTON_REPEAT )
if(MSYS_Action & MSYS_DO_LBUTTON_REPEAT )
{
ButtonReason|=MSYS_CALLBACK_REASON_LBUTTON_REPEAT;
}
if(MSYS_Action & MSYS_DO_RBUTTON_REPEAT )
if(MSYS_Action & MSYS_DO_RBUTTON_REPEAT )
{
ButtonReason|=MSYS_CALLBACK_REASON_RBUTTON_REPEAT;
}
@@ -812,7 +812,7 @@ void MSYS_UpdateMouseRegion(void)
UINT32 uiCurrTime = GetClock();
if( gpRegionLastLButtonDown == MSYS_CurrRegion &&
uiCurrTime <= guiRegionLastLButtonDownTime + MSYS_DOUBLECLICK_DELAY )
{ //Double click is Left down, then left up, then left down. We have just detected the left up here (step 2).
{ //Double click is Left down, then left up, then left down. We have just detected the left up here (step 2).
gpRegionLastLButtonUp = MSYS_CurrRegion;
}
else
@@ -834,11 +834,11 @@ void MSYS_UpdateMouseRegion(void)
{
// OK here, if we have release a button, UNSET LOCK wherever you are....
// Just don't give this button the message....
if(MSYS_Action & MSYS_DO_RBUTTON_UP )
if(MSYS_Action & MSYS_DO_RBUTTON_UP )
{
gfClickedModeOn = FALSE;
}
if(MSYS_Action & MSYS_DO_LBUTTON_UP )
if(MSYS_Action & MSYS_DO_LBUTTON_UP )
{
gfClickedModeOn = FALSE;
}
@@ -871,7 +871,7 @@ void MSYS_UpdateMouseRegion(void)
// Inits a MOUSE_REGION structure for use with the mouse system
//
void MSYS_DefineRegion(MOUSE_REGION *region,UINT16 tlx,UINT16 tly,UINT16 brx,UINT16 bry,INT8 priority,
UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback)
UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback)
{
#ifdef MOUSESYSTEM_DEBUGGING
if( region->uiFlags & MSYS_REGION_EXISTS )
@@ -1175,38 +1175,38 @@ void MSYS_ReleaseMouse(MOUSE_REGION *region)
/* ==================================================================================
MSYS_MoveMouseRegionTo( MOUSE_REGION *region, INT16 sX, INT16 sY)
MSYS_MoveMouseRegionTo( MOUSE_REGION *region, INT16 sX, INT16 sY)
Moves a Mouse region to X Y on the screen
Moves a Mouse region to X Y on the screen
*/
void MSYS_MoveMouseRegionTo( MOUSE_REGION *region, INT16 sX, INT16 sY)
{
INT16 sWidth;
INT16 sWidth;
INT16 sHeight;
sWidth = region ->RegionBottomRightX - region ->RegionTopLeftX;
sHeight = region ->RegionBottomRightY - region ->RegionTopLeftY;
sWidth = region->RegionBottomRightX - region->RegionTopLeftX;
sHeight = region->RegionBottomRightY - region->RegionTopLeftY;
// move top left
region -> RegionTopLeftX = sX;
region -> RegionTopLeftY = sY;
region->RegionTopLeftX = sX;
region->RegionTopLeftY = sY;
// now move bottom right based on topleft + width or height
region -> RegionBottomRightX = sX + sWidth;
region -> RegionBottomRightY = sY + sHeight;
region->RegionBottomRightX = sX + sWidth;
region->RegionBottomRightY = sY + sHeight;
return;
}
/* ==================================================================================
MSYS_MoveMouseRegionBy( MOUSE_REGION *region, INT16 sDeltaX, INT16 sDeltaY)
MSYS_MoveMouseRegionBy( MOUSE_REGION *region, INT16 sDeltaX, INT16 sDeltaY)
Moves a Mouse region by sDeltaX sDeltaY on the screen
Moves a Mouse region by sDeltaX sDeltaY on the screen
*/
@@ -1214,12 +1214,12 @@ void MSYS_MoveMouseRegionBy( MOUSE_REGION *region, INT16 sDeltaX, INT16 sDeltaY)
{
// move top left
region -> RegionTopLeftX = region -> RegionTopLeftX + sDeltaX;
region -> RegionTopLeftY = region -> RegionTopLeftY + sDeltaY;
region->RegionTopLeftX = region->RegionTopLeftX + sDeltaX;
region->RegionTopLeftY = region->RegionTopLeftY + sDeltaY;
// now move bottom right
region -> RegionBottomRightX = region -> RegionBottomRightX + sDeltaX;
region -> RegionBottomRightY = region -> RegionBottomRightY + sDeltaY;
region->RegionBottomRightX = region->RegionBottomRightX + sDeltaX;
region->RegionBottomRightY = region->RegionBottomRightY + sDeltaY;
return;
}
@@ -1259,8 +1259,8 @@ void SetRegionFastHelpText( MOUSE_REGION *region, const STR16 szText )
wcscpy( region->FastHelpText, szText );
// ATE: We could be replacing already existing, active text
// so let's remove the region so it be rebuilt...
// ATE: We could be replacing already existing, active text
// so let's remove the region so it be rebuilt...
#ifdef JA2
if ( guiCurrentScreen != MAP_SCREEN )
@@ -1268,12 +1268,12 @@ void SetRegionFastHelpText( MOUSE_REGION *region, const STR16 szText )
#endif
#ifdef _JA2_RENDER_DIRTY
if( region->uiFlags & MSYS_GOT_BACKGROUND )
FreeBackgroundRectPending( region->FastHelpRect );
#endif
if( region->uiFlags & MSYS_GOT_BACKGROUND )
FreeBackgroundRectPending( region->FastHelpRect );
#endif
region->uiFlags &= (~MSYS_GOT_BACKGROUND);
region->uiFlags &= (~MSYS_FASTHELP_RESET);
region->uiFlags &= (~MSYS_GOT_BACKGROUND);
region->uiFlags &= (~MSYS_FASTHELP_RESET);
#ifdef JA2
}
@@ -1294,9 +1294,9 @@ INT16 GetNumberOfLinesInHeight( const STR16 pStringA )
pToken = wcstok( pString, L"\n" );
while( pToken != NULL )
{
pToken = wcstok( NULL, L"\n" );
sCounter++;
{
pToken = wcstok( NULL, L"\n" );
sCounter++;
}
return( sCounter );
@@ -1313,7 +1313,6 @@ void DisplayFastHelp( MOUSE_REGION *region )
{
UINT16 usFillColor;
INT32 iX,iY,iW,iH;
INT32 iNumberOfLines = 1;
if ( region->uiFlags & MSYS_FASTHELP )
{
@@ -1359,7 +1358,7 @@ void DisplayFastHelp( MOUSE_REGION *region )
SetFont( FONT10ARIAL );
SetFontShadow( FONT_NEARBLACK );
DisplayHelpTokenizedString( region->FastHelpText ,( INT16 )( iX + 5 ), ( INT16 )( iY + 5 ) );
InvalidateRegion( iX, iY, (iX + iW) , (iY + iH) );
InvalidateRegion( iX, iY, (iX + iW) , (iY + iH) );
}
}
}
@@ -1376,7 +1375,7 @@ INT16 GetWidthOfString( const STR16 pStringA )
pToken = wcstok( pString, L"\n" );
while( pToken != NULL )
{
{
if( sWidth < StringPixLength( pToken, FONT10ARIAL ) )
{
sWidth = StringPixLength( pToken, FONT10ARIAL );
@@ -1403,7 +1402,7 @@ void DisplayHelpTokenizedString( const STR16 pStringA, INT16 sX, INT16 sY )
pToken = wcstok( pString, L"\n" );
while( pToken != NULL )
{
{
iLength = (INT32)wcslen( pToken );
for( i = 0; i < iLength; i++ )
{
@@ -1491,7 +1490,7 @@ INT16 GetWidthOfString( const STR16 pStringA )
pToken = wcstok( pString, L"\n" );
while( pToken != NULL )
{
{
if( sWidth < StringPixLength( pToken, ghTinyMonoFont ) )
{
sWidth = StringPixLength( pToken, ghTinyMonoFont );
@@ -1548,7 +1547,7 @@ void DisplayHelpTokenizedString( const STR16 pStringA, INT16 sX, INT16 sY )
pToken = wcstok( pString, L"\n" );
while( pToken != NULL )
{
{
iLength = (INT32)wcslen( pToken );
for( i = 0; i < iLength; i++ )
{
@@ -1656,7 +1655,7 @@ void SetRegionHelpEndCallback( MOUSE_REGION *region, MOUSE_HELPTEXT_DONE_CALLBAC
}
// now set the region help text
region-> HelpDoneCallback = CallbackFxn;
region->HelpDoneCallback = CallbackFxn;
return;
}
@@ -1689,17 +1688,17 @@ void ExecuteMouseHelpEndCallBack( MOUSE_REGION *region )
void SetFastHelpDelay( INT16 sFastHelpDelay )
{
gsFastHelpDelay = sFastHelpDelay;
gsFastHelpDelay = sFastHelpDelay;
}
void EnableMouseFastHelp( void )
{
gfShowFastHelp = TRUE;
gfShowFastHelp = TRUE;
}
void DisableMouseFastHelp( void )
{
gfShowFastHelp = FALSE;
gfShowFastHelp = FALSE;
}
void ResetClickedMode(void)
+5 -5
View File
@@ -6,7 +6,7 @@
//
// Modification history :
//
// 30jan97:Bret -> Creation
// 30jan97:Bret ->Creation
//
// *****************************************************************************
@@ -135,10 +135,10 @@ typedef struct _MOUSE_REGION {
#define MSYS_CALLBACK_REASON_LBUTTON_REPEAT 256
#define MSYS_CALLBACK_REASON_RBUTTON_REPEAT 512
//Kris: Nov 31, 1999
//Added support for double clicks. The DOUBLECLICK event is passed combined with
//Kris: Nov 31, 1999
//Added support for double clicks. The DOUBLECLICK event is passed combined with
//the LBUTTON_DWN event if two LBUTTON_DWN events are detected on the same button/region
//within the delay defined by MSYS_DOUBLECLICK_DELAY (in milliseconds). If your button/region
//within the delay defined by MSYS_DOUBLECLICK_DELAY (in milliseconds). If your button/region
//supports double clicks and single clicks, make sure the DOUBLECLICK event is checked first (rejecting
//the LBUTTON_DWN event if detected)
#define MSYS_CALLBACK_REASON_LBUTTON_DOUBLECLICK 1024
@@ -178,7 +178,7 @@ void MSYS_SetCurrentCursor(UINT16 Cursor);
INT32 MSYS_Init(void);
void MSYS_Shutdown(void);
void MSYS_DefineRegion(MOUSE_REGION *region,UINT16 tlx,UINT16 tly,UINT16 brx,UINT16 bry,INT8 priority,
UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback);
UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback);
void MSYS_ChangeRegionCursor(MOUSE_REGION *region,UINT16 crsr);
INT32 MSYS_AddRegion(MOUSE_REGION *region);
void MSYS_RemoveRegion(MOUSE_REGION *region);
+18 -18
View File
@@ -7,29 +7,29 @@
typedef struct
{
UINT8 ubManufacturer;
UINT8 ubVersion;
UINT8 ubEncoding;
UINT8 ubBitsPerPixel;
UINT16 usLeft, usTop;
UINT16 usRight, usBottom;
UINT16 usHorRez, usVerRez;
UINT8 ubEgaPalette[48];
UINT8 ubReserved;
UINT8 ubColorPlanes;
UINT16 usBytesPerLine;
UINT16 usPaletteType;
UINT8 ubFiller[58];
UINT8 ubManufacturer;
UINT8 ubVersion;
UINT8 ubEncoding;
UINT8 ubBitsPerPixel;
UINT16 usLeft, usTop;
UINT16 usRight, usBottom;
UINT16 usHorRez, usVerRez;
UINT8 ubEgaPalette[48];
UINT8 ubReserved;
UINT8 ubColorPlanes;
UINT16 usBytesPerLine;
UINT16 usPaletteType;
UINT8 ubFiller[58];
} PcxHeader;
typedef struct
{
UINT8 *pPcxBuffer;
UINT8 ubPalette[768];
UINT16 usWidth, usHeight;
UINT32 uiBufferSize;
UINT16 usPcxFlags;
UINT8 *pPcxBuffer;
UINT8 ubPalette[768];
UINT16 usWidth, usHeight;
UINT32 uiBufferSize;
UINT16 usPcxFlags;
} PcxObject;
+3 -3
View File
@@ -13,7 +13,7 @@ extern "C" {
extern void InitializeRandom(void);
extern UINT32 Random( UINT32 uiRange );
//Chance( 74 ) returns TRUE 74% of the time. If uiChance >= 100, then it will always return TRUE.
//Chance( 74 ) returns TRUE 74% of the time. If uiChance >= 100, then it will always return TRUE.
extern BOOLEAN Chance( UINT32 uiChance );
//Wizardry can use it too, but I'm saving them a K in the meantime...
@@ -23,12 +23,12 @@ extern BOOLEAN Chance( UINT32 uiChance );
#endif
#ifdef PRERANDOM_GENERATOR
//Returns a pregenerated random number.
//Returns a pregenerated random number.
//Used to deter Ian's tactic of shoot, miss, restore saved game :)
extern UINT32 PreRandom( UINT32 uiRange );
extern BOOLEAN PreChance( UINT32 uiChance );
//IMPORTANT: Changing this define will invalidate the JA2 save. If this
//IMPORTANT: Changing this define will invalidate the JA2 save. If this
// is necessary, please ifdef your own value.
#define MAX_PREGENERATED_NUMS 256
extern UINT32 guiPreRandomIndex;
+169 -172
View File
@@ -28,7 +28,7 @@
#include "Timer Control.h"
#endif
#if !defined( JA2 ) && !defined( UTIL )
#include "GameData.h" // for MoveTimer() [Wizardry specific]
#include "GameData.h" // for MoveTimer() [Wizardry specific]
#endif
#include "LibraryDataBase.h"
#include "utilities.h"
@@ -60,21 +60,21 @@
extern UINT32 MemDebugCounter;
#ifdef JA2
extern BOOLEAN gfPauseDueToPlayerGamePause;
extern int iScreenMode;
extern BOOL bScreenModeCmdLine;
extern int iScreenMode;
extern BOOL bScreenModeCmdLine;
#endif
extern BOOLEAN CheckIfGameCdromIsInCDromDrive();
extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam);
extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam);
// Prototype Declarations
INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam);
BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow);
void ShutdownStandardGamingPlatform(void);
void GetRuntimeSettings( );
BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow);
void ShutdownStandardGamingPlatform(void);
void GetRuntimeSettings( );
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
Console g_Console("", "", "Lua Console", "no");
@@ -99,7 +99,7 @@ HINSTANCE ghInstance;
// Global Variable Declarations
RECT rcWindow;
POINT ptWindowSize;
POINT ptWindowSize;
// moved from header file: 24mar98:HJH
UINT32 giStartMem;
@@ -125,7 +125,7 @@ BOOLEAN gfIgnoreMessages=FALSE;
UINT8 gbPixelDepth = PIXEL_DEPTH;
INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam)
{
{
static BOOLEAN fRestore = FALSE;
if ( Message == WM_USER )
@@ -134,19 +134,19 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
return 0L;
}
BOOL visible = IsWindowVisible(hWindow);
if(gfIgnoreMessages)
return(DefWindowProc(hWindow, Message, wParam, lParam));
// ATE: This is for older win95 or NT 3.51 to get MOUSE_WHEEL Messages
if ( Message == guiMouseWheelMsg )
{
QueueEvent(MOUSE_WHEEL, wParam, lParam);
QueueEvent(MOUSE_WHEEL, wParam, lParam);
return( 0L );
}
switch(Message)
{
{
case WM_CLOSE:
PostQuitMessage(0);
break;
@@ -158,15 +158,15 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
}
#ifdef JA2
case WM_MOVE:
// if( 1==iScreenMode )
case WM_MOVE:
// if( 1==iScreenMode )
{
GetClientRect(hWindow, &rcWindow);
// Go ahead and clamp the client width and height
rcWindow.right = SCREEN_WIDTH;
rcWindow.bottom = SCREEN_HEIGHT;
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
GetClientRect(hWindow, &rcWindow);
// Go ahead and clamp the client width and height
rcWindow.right = SCREEN_WIDTH;
rcWindow.bottom = SCREEN_HEIGHT;
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
int xPos = (int)(short) LOWORD(lParam);
int yPos = (int)(short) HIWORD(lParam);
BOOL needchange = FALSE;
@@ -186,7 +186,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
}
}
break;
break;
case WM_GETMINMAXINFO:
{
MINMAXINFO *mmi = (MINMAXINFO*)lParam;
@@ -206,7 +206,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
INT32 iWidth, iHeight, iX, iY;
BOOLEAN fWidthByHeight=FALSE, fHoldRight=FALSE;
lpWindow = (LPRECT) lParam;
lpWindow = (LPRECT) lParam;
iWidth=lpWindow->right-lpWindow->left;
iHeight=lpWindow->bottom-lpWindow->top;
@@ -315,9 +315,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
}
break;
case WM_SIZE:
case WM_SIZE:
{
UINT16 nWidth = LOWORD(lParam); // width of client area
UINT16 nWidth = LOWORD(lParam); // width of client area
UINT16 nHeight = HIWORD(lParam); // height of client area
if(nWidth && nHeight)
@@ -336,10 +336,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
}
break;
case WM_MOVE:
case WM_MOVE:
{
INT32 xPos = (INT32)LOWORD(lParam); // horizontal position
INT32 yPos = (INT32)HIWORD(lParam); // vertical position
INT32 xPos = (INT32)LOWORD(lParam); // horizontal position
INT32 yPos = (INT32)HIWORD(lParam); // vertical position
}
break;
#endif
@@ -352,40 +352,40 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
PollConsole( );
#endif
if (gfApplicationActive)
{
GameLoop();
}
break;
if (gfApplicationActive)
{
GameLoop();
}
break;
case WM_ACTIVATEAPP:
switch(wParam)
{
case TRUE: // We are restarting DirectDraw
if (fRestore == TRUE)
{
case WM_ACTIVATEAPP:
switch(wParam)
{
case TRUE: // We are restarting DirectDraw
if (fRestore == TRUE)
{
#ifdef JA2
RestoreVideoManager();
RestoreVideoSurfaces(); // Restore any video surfaces
RestoreVideoManager();
RestoreVideoSurfaces(); // Restore any video surfaces
// unpause the JA2 Global clock
if ( !gfPauseDueToPlayerGamePause )
{
PauseTime( FALSE );
}
if ( !gfPauseDueToPlayerGamePause )
{
PauseTime( FALSE );
}
#else
if(!VideoInspectorIsEnabled())
{
RestoreVideoManager();
RestoreVideoSurfaces(); // Restore any video surfaces
RestoreVideoManager();
RestoreVideoSurfaces(); // Restore any video surfaces
}
MoveTimer(TIMER_RESUME);
MoveTimer(TIMER_RESUME);
#endif
gfApplicationActive = TRUE;
}
break;
case FALSE: // We are suspending direct draw
gfApplicationActive = TRUE;
}
break;
case FALSE: // We are suspending direct draw
#ifdef JA2
// pause the JA2 Global clock
PauseTime( TRUE );
@@ -396,27 +396,27 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
SuspendVideoManager();
#endif
#endif
// suspend movement timer, to prevent timer crash if delay becomes long
// * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized
// * restore is automatic, no need to do anything on reactivation
// suspend movement timer, to prevent timer crash if delay becomes long
// * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized
// * restore is automatic, no need to do anything on reactivation
#if !defined( JA2 ) && !defined( UTIL )
MoveTimer(TIMER_SUSPEND);
MoveTimer(TIMER_SUSPEND);
#endif
gfApplicationActive = FALSE;
fRestore = TRUE;
break;
}
break;
gfApplicationActive = FALSE;
fRestore = TRUE;
break;
}
break;
case WM_CREATE:
case WM_CREATE:
break;
case WM_DESTROY:
case WM_DESTROY:
ShutdownStandardGamingPlatform();
// ShowCursor(TRUE);
PostQuitMessage(0);
break;
// ShowCursor(TRUE);
PostQuitMessage(0);
break;
case WM_SETFOCUS:
#if !defined( JA2 ) && !defined( UTIL )
@@ -425,7 +425,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
gfApplicationActive=TRUE;
// RestrictMouseToXYXY(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
#else
RestoreCursorClipRect( );
RestoreCursorClipRect( );
#endif
break;
@@ -444,14 +444,14 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
#if defined( JA2 )
case WM_DEVICECHANGE:
case WM_DEVICECHANGE:
{
//DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam;
//DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam;
////if a device has been removed
//if( wParam == DBT_DEVICEREMOVECOMPLETE )
//{
// //if its a disk
// //if its a disk
// if( pHeader->dbch_devicetype == DBT_DEVTYP_VOLUME )
// {
// //check to see if the play cd is still in the cdrom
@@ -466,13 +466,13 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
case WM_SYSKEYUP:
case WM_KEYUP:
KeyUp(wParam, lParam);
KeyUp(wParam, lParam);
break;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
KeyDown(wParam, lParam);
gfSGPInputReceived = TRUE;
KeyDown(wParam, lParam);
gfSGPInputReceived = TRUE;
break;
case WM_CHAR:
@@ -500,10 +500,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
cout << "> ";
}
break;
default
: return DefWindowProc(hWindow, Message, wParam, lParam);
}
return 0L;
default
: return DefWindowProc(hWindow, Message, wParam, lParam);
}
return 0L;
}
@@ -532,7 +532,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
// Now start up everything else.
RegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
// this one needs to go ahead of all others (except Debug), for MemDebugCounter to work right...
// this one needs to go ahead of all others (except Debug), for MemDebugCounter to work right...
FastDebugMsg("Initializing Memory Manager");
// Initialize the Memory Manager
if (InitializeMemoryManager() == FALSE)
@@ -542,7 +542,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
}
#ifdef JA2
FastDebugMsg("Initializing Mutex Manager");
FastDebugMsg("Initializing Mutex Manager");
// Initialize the Dirty Rectangle Manager
if (InitializeMutexManager() == FALSE)
{ // We were unable to initialize the game
@@ -560,7 +560,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
}
FastDebugMsg("Initializing Containers Manager");
InitializeContainers();
InitializeContainers();
FastDebugMsg("Initializing Input Manager");
// Initialize the Input Manager
@@ -629,9 +629,9 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
InitJA2SplashScreen();
//#endif
// Make sure we start up our local clock (in milliseconds)
// We don't need to check for a return value here since so far its always TRUE
InitializeClockManager(); // must initialize after VideoManager, 'cause it uses ghWindow
// Make sure we start up our local clock (in milliseconds)
// We don't need to check for a return value here since so far its always TRUE
InitializeClockManager(); // must initialize after VideoManager, 'cause it uses ghWindow
// Create font translation table (store in temp structure)
pFontTable = CreateEnglishTransTable( );
@@ -658,12 +658,12 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
{ // We were unable to initialize the sound manager
FastDebugMsg("FAILED : Initializing Sound Manager");
return FALSE;
}
}
#endif
FastDebugMsg("Initializing Random");
// Initialize random number generator
InitializeRandom(); // no Shutdown
// Initialize random number generator
InitializeRandom(); // no Shutdown
FastDebugMsg("Initializing Game Manager");
// Initialize the Game
@@ -710,7 +710,7 @@ void ShutdownStandardGamingPlatform(void)
if (gfGameInitialized)
{
ShutdownGame();
ShutdownGame();
}
@@ -718,45 +718,45 @@ void ShutdownStandardGamingPlatform(void)
MSYS_Shutdown();
#ifndef UTIL
ShutdownSoundManager();
ShutdownSoundManager();
#endif
DestroyEnglishTransTable( ); // has to go before ShutdownFontManager()
ShutdownFontManager();
DestroyEnglishTransTable( ); // has to go before ShutdownFontManager()
ShutdownFontManager();
ShutdownClockManager(); // must shutdown before VideoManager, 'cause it uses ghWindow
ShutdownClockManager(); // must shutdown before VideoManager, 'cause it uses ghWindow
#ifdef SGP_VIDEO_DEBUGGING
PerformVideoInfoDumpIntoFile( "SGPVideoShutdownDump.txt", FALSE );
#endif
ShutdownVideoSurfaceManager();
ShutdownVideoObjectManager();
ShutdownVideoManager();
ShutdownVideoObjectManager();
ShutdownVideoManager();
ShutdownInputManager();
ShutdownContainers();
ShutdownFileManager();
ShutdownInputManager();
ShutdownContainers();
ShutdownFileManager();
#ifdef JA2
ShutdownMutexManager();
ShutdownMutexManager();
#endif
#ifdef EXTREME_MEMORY_DEBUGGING
DumpMemoryInfoIntoFile( "ExtremeMemoryDump.txt", FALSE );
#endif
ShutdownMemoryManager(); // must go last (except for Debug), for MemDebugCounter to work right...
ShutdownMemoryManager(); // must go last (except for Debug), for MemDebugCounter to work right...
//
// Make sure we unregister the last remaining debug topic before shutting
// down the debugging layer
UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
// Make sure we unregister the last remaining debug topic before shutting
// down the debugging layer
UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
ShutdownDebugManager();
ShutdownDebugManager();
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow)
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow)
{
//If we are to use exception handling
@@ -785,13 +785,13 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommand
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow)
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow)
{
//DO NOT REMOVE, used for exception handing list above in WinMain
#endif
MSG Message;
MSG Message;
HWND hPrevInstanceWindow;
UINT32 uiTimer = 0;
UINT32 uiTimer = 0;
// Make sure that only one instance of this application is running at once
// // Look for prev instance by searching for the window
@@ -834,8 +834,8 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
#endif
// Mem Usage
giStartMem = MemGetFree( ) / 1024;
giStartMem = MemGetFree( ) / 1024;
#ifdef JA2
// Handle Check for CD
@@ -850,19 +850,19 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
#endif
// ShowCursor(FALSE);
// ShowCursor(FALSE);
// Inititialize the SGP
if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE)
{ // We failed to initialize the SGP
return 0;
}
// Inititialize the SGP
if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE)
{ // We failed to initialize the SGP
return 0;
}
#ifdef LUACONSOLE
if (1==iScreenMode)
{
CreateConsole();
}
if (1==iScreenMode)
{
CreateConsole();
}
#endif
#ifdef JA2
@@ -871,59 +871,59 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
#endif
#endif
gfApplicationActive = TRUE;
gfProgramIsRunning = TRUE;
gfApplicationActive = TRUE;
gfProgramIsRunning = TRUE;
FastDebugMsg("Running Game");
FastDebugMsg("Running Game");
// 0verhaul: Use the smallest available timer to make sure all animation updates happen at the speed they're supposed to
SetTimer( ghWindow, uiTimer, 1, NULL);
// 0verhaul: Use the smallest available timer to make sure all animation updates happen at the speed they're supposed to
SetTimer( ghWindow, uiTimer, 1, NULL);
// At this point the SGP is set up, which means all I/O, Memory, tools, etc... are available. All we need to do is
// attend to the gaming mechanics themselves
Message.wParam = 0;
// At this point the SGP is set up, which means all I/O, Memory, tools, etc... are available. All we need to do is
// attend to the gaming mechanics themselves
Message.wParam = 0;
while (gfProgramIsRunning)
{
// if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
// { // We have a message on the WIN95 queue, let's get it
if (!GetMessage(&Message, NULL, 0, 0))
{ // It's quitting time
return Message.wParam;
}
// Ok, now that we have the message, let's handle it
TranslateMessage(&Message);
DispatchMessage(&Message);
}
while (gfProgramIsRunning)
{
// if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
// { // We have a message on the WIN95 queue, let's get it
if (!GetMessage(&Message, NULL, 0, 0))
{ // It's quitting time
return Message.wParam;
}
// Ok, now that we have the message, let's handle it
TranslateMessage(&Message);
DispatchMessage(&Message);
}
#if 0
else
{ // Windows hasn't processed any messages, therefore we handle the rest
else
{ // Windows hasn't processed any messages, therefore we handle the rest
#ifdef LUACONSOLE
PollConsole( );
#endif
if (gfApplicationActive == FALSE)
{ // Well we got nothing to do but to wait for a message to activate
WaitMessage();
}
else
{ // Well, the game is active, so we handle the game stuff
GameLoop();
if (gfApplicationActive == FALSE)
{ // Well we got nothing to do but to wait for a message to activate
WaitMessage();
}
else
{ // Well, the game is active, so we handle the game stuff
GameLoop();
// After this frame, reset input given flag
gfSGPInputReceived = FALSE;
}
}
}
gfSGPInputReceived = FALSE;
}
}
}
#endif
KillTimer( ghWindow, uiTimer);
KillTimer( ghWindow, uiTimer);
// This is the normal exit point
FastDebugMsg("Exiting Game");
PostQuitMessage(0);
// This is the normal exit point
FastDebugMsg("Exiting Game");
PostQuitMessage(0);
// SGPExit() will be called next through the atexit() mechanism... This way we correctly process both normal exits and
// SGPExit() will be called next through the atexit() mechanism... This way we correctly process both normal exits and
// emergency aborts (such as those caused by a failed assertion).
// return wParam of the last message received
@@ -935,9 +935,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
void SGPExit(void)
{
static BOOLEAN fAlreadyExiting = FALSE;
BOOLEAN fUnloadScreens = TRUE;
// helps prevent heap crashes when multiple assertions occur and call us
if ( fAlreadyExiting )
{
@@ -963,11 +960,11 @@ void SGPExit(void)
#endif
ShutdownStandardGamingPlatform();
// ShowCursor(TRUE);
// ShowCursor(TRUE);
if(strlen(gzErrorMsg))
{
MessageBox(NULL, gzErrorMsg, "Error", MB_OK | MB_ICONERROR );
}
{
MessageBox(NULL, gzErrorMsg, "Error", MB_OK | MB_ICONERROR );
}
#ifndef JA2
VideoDumpMemoryLeaks();
@@ -1032,10 +1029,10 @@ void GetRuntimeSettings( )
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
/* Sergeant_Kolja. 2007-02-20: runtime Windowed mode instead of compile-time */
/* 1 for Windowed, 0 for Fullscreen */
if( !bScreenModeCmdLine )
iScreenMode = (int) GetPrivateProfileInt( "Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode, INIFile );
/* Sergeant_Kolja. 2007-02-20: runtime Windowed mode instead of compile-time */
/* 1 for Windowed, 0 for Fullscreen */
if( !bScreenModeCmdLine )
iScreenMode = (int) GetPrivateProfileInt( "Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode, INIFile );
// WANNE: Should we play the intro?
iPlayIntro = (int) GetPrivateProfileInt( "Ja2 Settings","PLAY_INTRO", iPlayIntro, INIFile );
@@ -1152,18 +1149,18 @@ void ProcessJa2CommandLineBeforeInitialization(CHAR8 *pCommandLine)
{
//overwrite Graphic setting from JA2_settings.ini
iScreenMode=0; /* 1 for Windowed, 0 for Fullscreen */
bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */
/* no resolution read from Args. Still from INI, but could be added here, too...*/
bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */
/* no resolution read from Args. Still from INI, but could be added here, too...*/
}
else if(!_strnicmp(pToken, "/WINDOW", 7))
{
//overwrite Graphic setting from JA2_settings.ini
iScreenMode=1; /* 1 for Windowed, 0 for Fullscreen */
bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */
/* no resolution read from Args. Still from INI, but could be added here, too...*/
bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */
/* no resolution read from Args. Still from INI, but could be added here, too...*/
}
//get the next token
//get the next token
pToken=strtok(NULL, cSeparators);
}
+13 -13
View File
@@ -31,8 +31,8 @@ UINT8 ubColorTables[HVOBJECT_SHADE_TABLES+3][256];
UINT16 IntensityTable[65536];
UINT16 ShadeTable[65536];
UINT16 White16BPPPalette[ 256 ];
FLOAT guiShadePercent = (FLOAT)0.48;
FLOAT guiBrightPercent = (FLOAT)1.1;
FLOAT guiShadePercent = (FLOAT)0.48;
FLOAT guiBrightPercent = (FLOAT)1.1;
BOOLEAN ShadesCalculateTables(SGPPaletteEntry *p8BPPPalette)
{
@@ -41,7 +41,7 @@ UINT32 uiCount;
// Green palette
ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[0], 0, 255, 0, TRUE);
// Blue palette
ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[HVOBJECT_SHADE_TABLES], 0, 0, 255, TRUE);
ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[HVOBJECT_SHADE_TABLES], 0, 0, 255, TRUE);
// Yellow palette
ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[HVOBJECT_SHADE_TABLES+1], 255, 255, 0, TRUE);
// Red palette
@@ -150,19 +150,19 @@ DoNextIndex:
xor bx,bx
NextColor:
xor ah,ah ; Calc delta between shaded color
xor ah,ah ; Calc delta between shaded color
mov al,[edi] ; and a color in the orig palette.
mov bl,[esi] ; Formula:
sub ax,bx ; Delta = abs(red-origred) +
or ax,ax ; abs(green-origgreen) +
sub ax,bx ; Delta = abs(red-origred) +
or ax,ax ; abs(green-origgreen) +
jns NC1
neg ax
NC1:mov dx,ax ; abs(blue-origblue)
NC1:mov dx,ax ; abs(blue-origblue)
xor ah,ah
mov al,[edi+1]
mov bl,[esi+1]
sub ax,bx
or ax,ax ; abs(green-origgreen) +
or ax,ax ; abs(green-origgreen) +
jns NC2
neg ax
NC2:add dx,ax
@@ -170,21 +170,21 @@ NC2:add dx,ax
mov al,[edi+2]
mov bl,[esi+2]
sub ax,bx
or ax,ax ; abs(green-origgreen) +
or ax,ax ; abs(green-origgreen) +
jns NC3
neg ax
NC3:add dx,ax
cmp dx,usCurDelta ; If delta < old delta
jae NotThisCol ; Save this delta and it's
mov ax,256 ; palette index
mov ax,256 ; palette index
mov [usCurDelta],dx
sub ax,cx
sub ax,cx
mov [usCurIndex],ax
NotThisCol:
add edi,4 ; Try next color in orginal pal
dec cx
jnz NextColor
jnz NextColor
pop ebx
mov ax,usCurIndex ; By now, usCurIndex holds pal index
@@ -241,7 +241,7 @@ void BuildIntensityTable(void)
{
UINT16 red, green, blue = 0;
UINT16 index = 0;
FLOAT dShadedPercent = (FLOAT)0.80;
FLOAT dShadedPercent = (FLOAT)0.80;
+2 -2
View File
@@ -27,8 +27,8 @@ extern UINT8 ubColorTables[HVOBJECT_SHADE_TABLES+3][256];
extern UINT16 IntensityTable[65536];
extern UINT16 ShadeTable[65536];
extern UINT16 White16BPPPalette[ 256 ];
extern FLOAT guiShadePercent;
extern FLOAT guiBrightPercent;
extern FLOAT guiShadePercent;
extern FLOAT guiBrightPercent;
#ifdef __cplusplus
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -57,7 +57,7 @@ extern void ShutdownSoundManager(void);
// Configuration functions
extern BOOLEAN SoundSetMemoryLimit(UINT32 uiLimit);
extern BOOLEAN SoundSetCacheThreshhold(UINT32 uiThreshold);
extern void * SoundGetDriverHandle( void );
extern void * SoundGetDriverHandle( void );
// Master volume control functions
extern void SoundSetDefaultVolume(UINT32 uiVolume);
-1
View File
@@ -2,7 +2,6 @@
// Snap: Implementation of case-insensitive string comparison classes
//
#include "stringicmp.h"
//#include <cctype>
#include <ctype.h>
+26 -26
View File
@@ -22,52 +22,52 @@ UINT32 guiCurrentTime;
void CALLBACK Clock( HWND hWindow, UINT uMessage, UINT idEvent, DWORD dwTime )
{
guiCurrentTime = GetTickCount();
if (guiCurrentTime < guiStartupTime)
{ // Adjust guiCurrentTime because of loopback on the timer value
guiCurrentTime = guiCurrentTime + (0xffffffff - guiStartupTime);
}
else
{ // Adjust guiCurrentTime because of loopback on the timer value
guiCurrentTime = guiCurrentTime - guiStartupTime;
}
guiCurrentTime = GetTickCount();
if (guiCurrentTime < guiStartupTime)
{ // Adjust guiCurrentTime because of loopback on the timer value
guiCurrentTime = guiCurrentTime + (0xffffffff - guiStartupTime);
}
else
{ // Adjust guiCurrentTime because of loopback on the timer value
guiCurrentTime = guiCurrentTime - guiStartupTime;
}
}
BOOLEAN InitializeClockManager(void)
{
// Register the start time (use WIN95 API call)
guiCurrentTime = guiStartupTime = GetTickCount();
SetTimer(ghWindow, MAIN_TIMER_ID, 10, (TIMERPROC)Clock);
// Register the start time (use WIN95 API call)
guiCurrentTime = guiStartupTime = GetTickCount();
SetTimer(ghWindow, MAIN_TIMER_ID, 10, (TIMERPROC)Clock);
return TRUE;
return TRUE;
}
void ShutdownClockManager(void)
void ShutdownClockManager(void)
{
// Make sure we kill the timer
KillTimer(ghWindow, MAIN_TIMER_ID);
// Make sure we kill the timer
KillTimer(ghWindow, MAIN_TIMER_ID);
}
TIMER GetClock(void)
TIMER GetClock(void)
{
return guiCurrentTime;
return guiCurrentTime;
}
TIMER SetCountdownClock(UINT32 uiTimeToElapse)
TIMER SetCountdownClock(UINT32 uiTimeToElapse)
{
return (guiCurrentTime + uiTimeToElapse);
return (guiCurrentTime + uiTimeToElapse);
}
UINT32 ClockIsTicking(TIMER uiTimer)
{
if (uiTimer > guiCurrentTime)
{ // Well timer still hasn't elapsed
return (uiTimer - guiCurrentTime);
}
// Time's up
return 0;
if (uiTimer > guiCurrentTime)
{ // Well timer still hasn't elapsed
return (uiTimer - guiCurrentTime);
}
// Time's up
return 0;
}
+5 -5
View File
@@ -5,7 +5,7 @@
typedef UINT32 TIMER;
#define MAIN_TIMER_ID 1
#define MAIN_TIMER_ID 1
#define MILLISECONDS(a) (a)
#define SECONDS(a) ((a) / 1000)
@@ -18,10 +18,10 @@ extern "C" {
#endif
BOOLEAN InitializeClockManager(void);
void ShutdownClockManager(void);
TIMER GetClock(void);
TIMER SetCountdownClock(UINT32 TimeToElapse);
UINT32 ClockIsTicking(TIMER uiTimer);
void ShutdownClockManager(void);
TIMER GetClock(void);
TIMER SetCountdownClock(UINT32 TimeToElapse);
UINT32 ClockIsTicking(TIMER uiTimer);
#ifdef __cplusplus
}
+10 -10
View File
@@ -4,22 +4,22 @@
typedef struct
{
UINT32 uiOffset;
UINT32 uiWidth;
UINT32 uiOffLen;
INT16 sOffsetX;
INT16 sOffsetY;
UINT32 uiOffset;
UINT32 uiWidth;
UINT32 uiOffLen;
INT16 sOffsetX;
INT16 sOffsetY;
} TRLEObject;
typedef struct
{
UINT32 uiHeightEach;
UINT32 uiTotalElements;
TRLEObject *pTRLEObject;
PTR pPixData;
UINT32 uiSizePixDataElem;
UINT32 uiHeightEach;
UINT32 uiTotalElements;
TRLEObject *pTRLEObject;
PTR pPixData;
UINT32 uiSizePixDataElem;
} TRLEData;
File diff suppressed because it is too large Load Diff
+36 -36
View File
@@ -12,18 +12,18 @@
#include "VSurface.h"
#include "Mutex Manager.h"
#define BUFFER_READY 0x00
#define BUFFER_BUSY 0x01
#define BUFFER_DIRTY 0x02
#define BUFFER_DISABLED 0x03
#define BUFFER_READY 0x00
#define BUFFER_BUSY 0x01
#define BUFFER_DIRTY 0x02
#define BUFFER_DISABLED 0x03
#define MAX_CURSOR_WIDTH 64
#define MAX_CURSOR_HEIGHT 64
#define MAX_CURSOR_WIDTH 64
#define MAX_CURSOR_HEIGHT 64
#define VIDEO_NO_CURSOR 0xFFFF
extern HWND ghWindow;
extern UINT32 guiMouseBufferState; // BUFFER_READY, BUFFER_DIRTY, BUFFER_DISABLED
extern UINT32 guiMouseBufferState; // BUFFER_READY, BUFFER_DIRTY, BUFFER_DISABLED
/*
#ifdef __cplusplus
@@ -31,40 +31,40 @@ extern "C" {
#endif
*/
extern BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *WindowProc);
extern void ShutdownVideoManager(void);
extern void SuspendVideoManager(void);
extern BOOLEAN RestoreVideoManager(void);
extern void GetCurrentVideoSettings(UINT16 *usWidth, UINT16 *usHeight, UINT8 *ubBitDepth);
extern BOOLEAN CanBlitToFrameBuffer(void);
extern BOOLEAN CanBlitToMouseBuffer(void);
extern void InvalidateRegion(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom);
extern void InvalidateRegions(SGPRect *pArrayOfRegions, UINT32 uiRegionCount);
extern void InvalidateScreen(void);
extern void InvalidateFrameBuffer(void);
extern void SetFrameBufferRefreshOverride(PTR pFrameBufferRefreshOverride);
extern LPDIRECTDRAW2 GetDirectDraw2Object(void);
extern BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *WindowProc);
extern void ShutdownVideoManager(void);
extern void SuspendVideoManager(void);
extern BOOLEAN RestoreVideoManager(void);
extern void GetCurrentVideoSettings(UINT16 *usWidth, UINT16 *usHeight, UINT8 *ubBitDepth);
extern BOOLEAN CanBlitToFrameBuffer(void);
extern BOOLEAN CanBlitToMouseBuffer(void);
extern void InvalidateRegion(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom);
extern void InvalidateRegions(SGPRect *pArrayOfRegions, UINT32 uiRegionCount);
extern void InvalidateScreen(void);
extern void InvalidateFrameBuffer(void);
extern void SetFrameBufferRefreshOverride(PTR pFrameBufferRefreshOverride);
extern LPDIRECTDRAW2 GetDirectDraw2Object(void);
extern LPDIRECTDRAWSURFACE2 GetPrimarySurfaceObject(void);
extern LPDIRECTDRAWSURFACE2 GetBackBufferObject(void);
extern LPDIRECTDRAWSURFACE2 GetFrameBufferObject(void);
extern LPDIRECTDRAWSURFACE2 GetMouseBufferObject(void);
extern PTR LockPrimarySurface(UINT32 *uiPitch);
extern void UnlockPrimarySurface(void);
extern PTR LockBackBuffer(UINT32 *uiPitch);
extern void UnlockBackBuffer(void);
extern PTR LockFrameBuffer(UINT32 *uiPitch);
extern void UnlockFrameBuffer(void);
extern PTR LockMouseBuffer(UINT32 *uiPitch);
extern void UnlockMouseBuffer(void);
extern BOOLEAN GetRGBDistribution(void);
extern BOOLEAN GetPrimaryRGBDistributionMasks(UINT32 *RedBitMask, UINT32 *GreenBitMask, UINT32 *BblueBitMask);
extern PTR LockPrimarySurface(UINT32 *uiPitch);
extern void UnlockPrimarySurface(void);
extern PTR LockBackBuffer(UINT32 *uiPitch);
extern void UnlockBackBuffer(void);
extern PTR LockFrameBuffer(UINT32 *uiPitch);
extern void UnlockFrameBuffer(void);
extern PTR LockMouseBuffer(UINT32 *uiPitch);
extern void UnlockMouseBuffer(void);
extern BOOLEAN GetRGBDistribution(void);
extern BOOLEAN GetPrimaryRGBDistributionMasks(UINT32 *RedBitMask, UINT32 *GreenBitMask, UINT32 *BblueBitMask);
extern BOOLEAN SetMouseCursorFromObject(UINT32 uiVideoObjectHandle, UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY );
extern BOOLEAN HideMouseCursor(void);
extern BOOLEAN LoadCursorFile(STR8 pFilename);
extern BOOLEAN SetCurrentCursor(UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY );
extern void StartFrameBufferRender(void);
extern void EndFrameBufferRender(void);
extern void PrintScreen(void);
extern BOOLEAN HideMouseCursor(void);
extern BOOLEAN LoadCursorFile(STR8 pFilename);
extern BOOLEAN SetCurrentCursor(UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY );
extern void StartFrameBufferRender(void);
extern void EndFrameBufferRender(void);
extern void PrintScreen(void);
+1 -1
View File
@@ -16,6 +16,6 @@ LPDIRECTDRAWSURFACE2 GetBackbufferInterface( );
BOOLEAN SetDirectDraw2Object( LPDIRECTDRAW2 pDirectDraw );
BOOLEAN SetPrimarySurfaceInterface( LPDIRECTDRAWSURFACE2 pSurface );
BOOLEAN SetBackbufferInterface( LPDIRECTDRAWSURFACE2 pSurface );
BOOLEAN SetBackbufferInterface( LPDIRECTDRAWSURFACE2 pSurface );
#endif
+50 -49
View File
@@ -68,7 +68,7 @@ typedef struct VOBJECT_NODE
{
HVOBJECT hVObject;
UINT32 uiIndex;
struct VOBJECT_NODE *next, *prev;
struct VOBJECT_NODE *next, *prev;
#ifdef SGP_VIDEO_DEBUGGING
STR8 pName;
@@ -77,8 +77,8 @@ typedef struct VOBJECT_NODE
}VOBJECT_NODE;
VOBJECT_NODE *gpVObjectHead = NULL;
VOBJECT_NODE *gpVObjectTail = NULL;
VOBJECT_NODE *gpVObjectHead = NULL;
VOBJECT_NODE *gpVObjectTail = NULL;
UINT32 guiVObjectIndex = 1;
UINT32 guiVObjectSize = 0;
UINT32 guiVObjectTotalAdded = 0;
@@ -111,19 +111,19 @@ void CheckValidVObjectIndex( UINT32 uiIndex );
//
// **************************************************************
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep)
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep)
{
puts("in filter.");
if (code == EXCEPTION_ACCESS_VIOLATION) {
puts("caught AV as expected.");
return EXCEPTION_EXECUTE_HANDLER;
}
puts("in filter.");
if (code == EXCEPTION_ACCESS_VIOLATION) {
puts("caught AV as expected.");
return EXCEPTION_EXECUTE_HANDLER;
}
else
{
puts("didn't catch AV, unexpected.");
return EXCEPTION_CONTINUE_SEARCH;
};
else
{
puts("didn't catch AV, unexpected.");
return EXCEPTION_CONTINUE_SEARCH;
};
}
BOOLEAN InitializeVideoObjectManager( )
@@ -277,7 +277,7 @@ BOOLEAN GetVideoObject( HVOBJECT *hVObject, UINT32 uiIndex )
BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usRegionIndex, INT32 iDestX, INT32 iDestY, UINT32 fBltFlags, blt_fx *pBltFx )
{
UINT16 *pBuffer;
UINT16 *pBuffer;
UINT32 uiPitch;
HVOBJECT hSrcVObject;
@@ -302,7 +302,7 @@ BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT
// Now we have the video object and surface, call the VO blitter function
if ( !BltVideoObjectToBuffer( pBuffer, uiPitch, hSrcVObject, usRegionIndex, iDestX, iDestY, fBltFlags, pBltFx ) )
{
UnLockVideoSurface( uiDestVSurface );
UnLockVideoSurface( uiDestVSurface );
// VO Blitter will set debug messages for error conditions
return FALSE;
}
@@ -312,7 +312,7 @@ BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT
}
BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject )
BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject )
{
VOBJECT_NODE *curr;
@@ -347,7 +347,7 @@ BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject )
{ //Make the next node point to the prev
curr->prev->next = curr->next;
}
//The node is now detached. Now deallocate it.
//The node is now detached. Now deallocate it.
#ifdef SGP_VIDEO_DEBUGGING
if( curr->pName )
MemFree( curr->pName );
@@ -376,13 +376,13 @@ BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject )
// Based on flags, blit accordingly
// There are two types, a BltFast and a Blt. BltFast is 10% faster, uses no
// clipping lists
BOOLEAN BltVideoObject( UINT32 uiDestVSurface,
HVOBJECT hSrcVObject,
UINT16 usRegionIndex,
INT32 iDestX,
INT32 iDestY,
UINT32 fBltFlags,
blt_fx *pBltFx )
BOOLEAN BltVideoObject( UINT32 uiDestVSurface,
HVOBJECT hSrcVObject,
UINT16 usRegionIndex,
INT32 iDestX,
INT32 iDestY,
UINT32 fBltFlags,
blt_fx *pBltFx )
{
UINT16 *pBuffer;
@@ -507,7 +507,7 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
// while( FALSE );
// All is well
// DbgMessage( TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Success in Creating Video Object" ) );
// DbgMessage( TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Success in Creating Video Object" ) );
return( hVObject );
}
@@ -548,7 +548,7 @@ BOOLEAN SetVideoObjectPalette( HVOBJECT hVObject, SGPPaletteEntry *pSrcPalette )
hVObject->p16BPPPalette = Create16BPPPalette( pSrcPalette );
hVObject->pShadeCurrent = hVObject->p16BPPPalette;
// DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Video Object Palette change successfull" ));
// DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Video Object Palette change successfull" ));
return( TRUE );
}
@@ -727,7 +727,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
if ( hSrcVObject == NULL )
{
int i=0;
//int breakpoint=0;
}
Assert( hSrcVObject != NULL );
@@ -756,7 +756,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
}
else
#endif
if ( fBltFlags & VO_BLT_SRCTRANSPARENCY )
if ( fBltFlags & VO_BLT_SRCTRANSPARENCY )
{
if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect))
Blt8BPPDataTo16BPPBufferTransparentClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect);
@@ -764,7 +764,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
Blt8BPPDataTo16BPPBufferTransparent( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex );
break;
}
else if ( fBltFlags & VO_BLT_SHADOW )
else if ( fBltFlags & VO_BLT_SHADOW )
{
if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect))
Blt8BPPDataTo16BPPBufferShadowClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect);
@@ -776,7 +776,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
}
else if(gbPixelDepth==8)
{
if ( fBltFlags & VO_BLT_SRCTRANSPARENCY )
if ( fBltFlags & VO_BLT_SRCTRANSPARENCY )
{
if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect))
Blt8BPPDataTo8BPPBufferTransparentClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect);
@@ -784,7 +784,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
Blt8BPPDataTo8BPPBufferTransparent( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex );
break;
}
else if ( fBltFlags & VO_BLT_SHADOW )
else if ( fBltFlags & VO_BLT_SHADOW )
{
if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect))
Blt8BPPDataTo8BPPBufferShadowClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect);
@@ -809,11 +809,11 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
}
}
BOOLEAN PixelateVideoObjectRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2)
BOOLEAN PixelateVideoObjectRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2)
{
UINT16 *pBuffer;
UINT32 uiPitch;
SGPRect area;
SGPRect area;
UINT8 uiPattern[8][8]={ {0,1,0,1,0,1,0,1},
{1,0,1,0,1,0,1,0},
{0,1,0,1,0,1,0,1},
@@ -911,7 +911,7 @@ UINT16 SetObjectShade(HVOBJECT pObj, UINT32 uiShade)
if(pObj->pShades[uiShade]==NULL)
{
DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Attempt to set shade level to NULL table"));
DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Attempt to set shade level to NULL table"));
return(FALSE);
}
@@ -928,7 +928,7 @@ UINT16 SetObjectHandleShade(UINT32 uiHandle, UINT32 uiShade)
#endif
if(!GetVideoObject(&hObj, uiHandle))
{
DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Invalid object handle for setting shade level"));
DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Invalid object handle for setting shade level"));
return(FALSE);
}
return(SetObjectShade(hObj, uiShade));
@@ -1259,7 +1259,7 @@ BOOLEAN ConvertVObjectRegionTo16BPP( HVOBJECT hVObject, UINT16 usRegionIndex, UI
pInput++;
//uiDataLoop++;
if(uiLen!=p16BPPObject->usWidth)
DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_1, String( "Actual pixel width different from header width" ));
DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_1, String( "Actual pixel width different from header width" ));
uiLen=0;
}
@@ -1296,7 +1296,7 @@ BOOLEAN ConvertVObjectRegionTo16BPP( HVOBJECT hVObject, UINT16 usRegionIndex, UI
BOOLEAN BltVideoObjectOutlineFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY, INT16 s16BPPColor, BOOLEAN fDoOutline )
{
UINT16 *pBuffer;
UINT16 *pBuffer;
UINT32 uiPitch;
HVOBJECT hSrcVObject;
@@ -1316,11 +1316,11 @@ BOOLEAN BltVideoObjectOutlineFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObjec
if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) )
{
Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect );
Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect );
}
else
{
Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline );
Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline );
}
// Now we have the video object and surface, call the VO blitter function
@@ -1331,7 +1331,7 @@ BOOLEAN BltVideoObjectOutlineFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObjec
BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY, INT16 s16BPPColor, BOOLEAN fDoOutline )
{
UINT16 *pBuffer;
UINT16 *pBuffer;
UINT32 uiPitch;
// Lock video surface
pBuffer = (UINT16*)LockVideoSurface( uiDestVSurface, &uiPitch );
@@ -1343,11 +1343,11 @@ BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT1
if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) )
{
Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect );
Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect );
}
else
{
Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline );
Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline );
}
// Now we have the video object and surface, call the VO blitter function
@@ -1360,7 +1360,7 @@ BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT1
BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY )
{
UINT16 *pBuffer;
UINT16 *pBuffer;
UINT32 uiPitch;
HVOBJECT hSrcVObject;
@@ -1380,11 +1380,11 @@ BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrc
if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) )
{
Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect );
Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect );
}
else
{
Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex );
Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex );
}
// Now we have the video object and surface, call the VO blitter function
@@ -1395,7 +1395,7 @@ BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrc
BOOLEAN BltVideoObjectOutlineShadow(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY )
{
UINT16 *pBuffer;
UINT16 *pBuffer;
UINT32 uiPitch;
// Lock video surface
pBuffer = (UINT16*)LockVideoSurface( uiDestVSurface, &uiPitch );
@@ -1407,11 +1407,11 @@ BOOLEAN BltVideoObjectOutlineShadow(UINT32 uiDestVSurface, HVOBJECT hSrcVObject,
if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) )
{
Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect );
Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect );
}
else
{
Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex );
Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex );
}
// Now we have the video object and surface, call the VO blitter function
@@ -1599,3 +1599,4 @@ void PerformVideoInfoDumpIntoFile( const STR8 filename, BOOLEAN fAppend )
#endif
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1167,7 +1167,7 @@ BYTE *LockVideoSurfaceBuffer( HVSURFACE hVSurface, UINT32 *pPitch )
// Assertions
if ( hVSurface == NULL )
{
int i = 0;
//int breakpoint = 0;
}
+14 -14
View File
@@ -16,10 +16,10 @@
// Defines for special video object handles given to blit function
//
#define PRIMARY_SURFACE 0xFFFFFFF0
#define BACKBUFFER 0xFFFFFFF1
#define FRAME_BUFFER 0xFFFFFFF2
#define MOUSE_BUFFER 0xFFFFFFF3
#define PRIMARY_SURFACE 0xFFFFFFF0
#define BACKBUFFER 0xFFFFFFF1
#define FRAME_BUFFER 0xFFFFFFF2
#define MOUSE_BUFFER 0xFFFFFFF3
//
// Defines for blitting
@@ -43,9 +43,9 @@
typedef struct
{
COLORVAL ColorFill; // Used for fill effect
SGPRect SrcRect; // Given SRC subrect instead of srcregion
SGPRect FillRect; // Given SRC subrect instead of srcregion
UINT16 DestRegion; // Given a DEST region for dest positions within the VO
SGPRect SrcRect; // Given SRC subrect instead of srcregion
SGPRect FillRect; // Given SRC subrect instead of srcregion
UINT16 DestRegion; // Given a DEST region for dest positions within the VO
} blt_vs_fx;
@@ -64,8 +64,8 @@ typedef struct
// Used in the VSurface_DESC structure to describe creation flags
//
#define VSURFACE_CREATE_DEFAULT 0x00000020 // Creates and empty Surface of given width, height and BPP
#define VSURFACE_CREATE_FROMFILE 0x00000040 // Creates a video Surface from a file ( using HIMAGE )
#define VSURFACE_CREATE_DEFAULT 0x00000020 // Creates and empty Surface of given width, height and BPP
#define VSURFACE_CREATE_FROMFILE 0x00000040 // Creates a video Surface from a file ( using HIMAGE )
//
// The following structure is used to define a region of the video Surface
@@ -96,7 +96,7 @@ typedef struct
PTR pSavedSurfaceData; // A void pointer, but for this implementation, is really a lpDirectDrawSurface;
// pSavedSurfaceData is used to hold all video memory Surfaces so that they my be restored
UINT32 fFlags; // Used to describe memory usage, etc
PTR pPalette; // A void pointer, but for this implementation a DDPalette
PTR pPalette; // A void pointer, but for this implementation a DDPalette
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
@@ -182,7 +182,7 @@ BOOLEAN GetVideoSurfaceDescription( UINT32 uiIndex, UINT16 *usWidth, UINT16 *usH
///////////////////////////////////////////////////////////////////////////////////////////////////
// Darkens a rectangular area on a surface for menus etc.
BOOLEAN PixelateVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
BOOLEAN PixelateVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
// Created from a VSurface_DESC structure. Can be from a file via HIMAGE or empty.
HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc );
@@ -228,7 +228,7 @@ BOOLEAN AddVSurfaceRegionAtIndex( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_
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 GetVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_REGION *aRegion );
BOOLEAN GetNumRegions( HVSURFACE hVSurface , UINT32 *puiNumRegions );
BOOLEAN ReplaceVSurfaceRegion( HVSURFACE hVSurface , UINT16 usIndex, VSURFACE_REGION *aRegion );
BOOLEAN DeleteVideoSurfaceFromIndex( UINT32 uiIndex );
@@ -255,7 +255,7 @@ BOOLEAN BltVideoSurfaceToVideoSurface( HVSURFACE hDestVSurface, HVSURFACE hSrcVS
HVSURFACE GetPrimaryVideoSurface( );
HVSURFACE GetBackBufferVideoSurface( );
BOOLEAN ShadowVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
BOOLEAN ShadowVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
BOOLEAN ShadowVideoSurfaceImage( UINT32 uiDestVSurface, HVOBJECT hImageHandle, INT32 iPosX, INT32 iPosY);
// If the Dest Rect and the source rect are not the same size, the source surface will be either
@@ -264,7 +264,7 @@ BOOLEAN BltStretchVideoSurface(UINT32 uiDestVSurface, UINT32 uiSrcVSurface, INT3
BOOLEAN MakeVSurfaceFromVObject(UINT32 uiVObject, UINT16 usSubIndex, UINT32 *puiVSurface);
BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
/*
#ifdef __cplusplus
+2 -2
View File
@@ -10,8 +10,8 @@
// ***********************************************************************
LPDIRECTDRAWSURFACE2 GetVideoSurfaceDDSurface( HVSURFACE hVSurface );
LPDIRECTDRAWSURFACE GetVideoSurfaceDDSurfaceOne( HVSURFACE hVSurface );
LPDIRECTDRAWPALETTE GetVideoSurfaceDDPalette( HVSURFACE hVSurface );
LPDIRECTDRAWSURFACE GetVideoSurfaceDDSurfaceOne( HVSURFACE hVSurface );
LPDIRECTDRAWPALETTE GetVideoSurfaceDDPalette( HVSURFACE hVSurface );
HVSURFACE CreateVideoSurfaceFromDDSurface( LPDIRECTDRAWSURFACE2 lpDDSurface );