nuke all the #if 0's

scripted commit:

find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';'

https://coan2.sourceforge.net/coan_man_1.html
This commit is contained in:
Marco Antonio Jaguaribe Costa
2023-01-19 00:13:08 +02:00
committed by Asdow
parent 6afe785f4b
commit 8b1c4effa0
72 changed files with 0 additions and 6657 deletions
-4
View File
@@ -277,12 +277,8 @@ extern "C" {
#define DXDEF __declspec(dllexport)
#else
#if 1 /*def __BORLANDC__*/
#define DXDEC extern
#define DXDEF
#else
#define DXDEC __declspec(dllimport)
#endif
#endif
-147
View File
@@ -179,62 +179,6 @@ bool IndexedSTIImage::addImage(UINT8 *data, UINT32 data_size, UINT32 image_width
return true;
#if 0
unsigned int uiBufferPos = 0;
bool bZeroRun = false;
UINT8 uiRunLength = 0;
UINT8 *uiRunStartPosition = data;
if(*data == 0)
{
bZeroRun = true;
}
bool done = false;
UINT32 scanline = 0;
while(!done)
{
if(bZeroRun)
{
while((*data == 0) && (uiRunLength < 128) && (uiBufferPos < data_size) && (scanline < image_width))
{
data++;
uiRunLength++;
uiBufferPos++;
scanline++;
}
uiRunStartPosition = compressed;
*compressed++ = uiRunLength | iCOMPRESS_TRANSPARENT;
compressed_size += 1;
}
else
{
uiRunStartPosition = compressed++;
while((*data != 0) && (uiRunLength < 128) && (uiBufferPos < data_size) && (scanline < image_width))
{
*compressed++ = *data++;
uiRunLength++;
uiBufferPos++;
scanline++;
}
*uiRunStartPosition = uiRunLength;
compressed_size += uiRunLength+1;
}
// prepare next run
uiRunLength = 0;
bZeroRun = (*data != 0) ? false : true;
if(scanline == image_width)
{
scanline = 0;
// "close" scanline with a zero
*compressed++ = 0;
compressed_size += 1;
}
if(uiBufferPos >= data_size)
{
done = true;
}
}
#endif
}
@@ -870,7 +814,6 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
{
#if 1
hImage->pETRLEObject = (ETRLEObject*)MemAlloc(1 * sizeof(ETRLEObject));
if(!hImage->pETRLEObject)
{
@@ -908,37 +851,6 @@ void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
}
hImage->fFlags |= IMAGE_BITMAPDATA;
#else
UINT32 SIZE = info->height * info->width;
hImage->p16BPPData = new UINT16[SIZE];
memset(hImage->p16BPPData, 0, SIZE*sizeof(UINT16));
UINT16* dest_row = NULL;
UINT32 rgbcolor = 0;
for(unsigned int i=0; i<info->height; ++i)
{
dest_row = &(hImage->p16BPPData[i*info->width]);
png_bytep row_i = rows[i];
for(unsigned int sx = 0, dx = 0; sx < 4*info->width; sx+=4, dx+=1)
{
if(row_i[sx+3] == 255)
{
rgbcolor = FROMRGB(row_i[sx], row_i[sx+1], row_i[sx+2]);
if(rgbcolor == 0)
{
// since we already use rgb(0,0,0) as a fully transparent color,
// the color black will be mapped to rgb(0,1,0), because green has the most bits
//rgbcolor = 1 << 8;
rgbcolor = FROMRGB(0,1,0);
}
dest_row[dx] = Get16BPPColor(rgbcolor);
}
else
{
dest_row[dx] = Get16BPPColor(0);
}
}
}
#endif
}
@@ -1039,65 +951,6 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
SGP_THROW_IFFALSE( etrle_size > 0, L"ETRLE compression of PNG image failed" );
subim.sOffsetX = subimage.sOffsetX;
subim.sOffsetY = subimage.sOffsetY;
#if 0
unsigned int uiBufferPos = 0;
bool bZeroRun = false;
UINT8 uiRunLength = 0;
UINT8 *uiRunStartPosition = data;
if(*data == 0)
{
bZeroRun = true;
}
bool done = false;
UINT32 scanline = 0;
while(!done)
{
if(bZeroRun)
{
while((*data == 0) && (uiRunLength < 128) && (uiBufferPos < SIZE) && (scanline < info->width))
{
data++;
uiRunLength++;
uiBufferPos++;
scanline++;
}
uiRunStartPosition = compressed;
*compressed++ = uiRunLength | COMPRESS_TRANSPARENT;
compressed_size += 1;
*compressed++ = 0;
compressed_size += 1;
}
else
{
uiRunStartPosition = compressed++;
while((*data != 0) && (uiRunLength < 128) && (uiBufferPos < SIZE) && (scanline < info->width))
{
*compressed++ = *data++;
uiRunLength++;
uiBufferPos++;
scanline++;
}
*uiRunStartPosition = uiRunLength | COMPRESS_NON_TRANSPARENT;
compressed_size += uiRunLength+1;
}
// prepare next run
uiRunLength = 0;
bZeroRun = (*data != 0) ? false : true;
if(scanline == info->width)
{
scanline = 0;
// "close" scanline with a zero
*compressed++ = 0;
compressed_size += 1;
}
if(uiBufferPos >= SIZE)
{
done = true;
}
}
UINT32 etrle_size = compressed_size;
#endif
//subimage.uiDataLength = compressed_size;
subimage.uiDataLength = etrle_size;
subimage.uiDataOffset = 0;
-81
View File
@@ -129,86 +129,6 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::Test
CHAR8 ExtensionSep[] = ".";
UINT32 iFileLoader;
#if 0
SGPFILENAME Extension;
STR StrPtr;
// Depending on extension of filename, use different image readers
// Get extension
StrPtr = strstr( ImageFile, ExtensionSep );
if ( StrPtr == NULL )
{
// No extension given, use default internal loader extension
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "No extension given, using default" );
strcat( ImageFile, ".PCX" );
strcpy( Extension, ".PCX" );
}
else
{
strcpy( Extension, StrPtr+1 );
}
// Determine type from Extension
do
{
iFileLoader = UNKNOWN_FILE_READER;
if ( _stricmp( Extension, "PCX" ) == 0 )
{
iFileLoader = PCX_FILE_READER;
break;
}
else if ( _stricmp( Extension, "TGA" ) == 0 )
{
iFileLoader = TGA_FILE_READER;
break;
}
else if ( _stricmp( Extension, "STI" ) == 0 )
{
#ifdef USE_VFS
// see if there is a .jpc file first and when that fails, try .sti
vfs::Path str(ImageFile);
vfs::String::str_t const& findext = str.c_wcs();
vfs::String::size_t dot = findext.find_last_of(vfs::Const::DOT());
vfs::String fname = findext.substr(0,dot).append(CONST_DOTJPC);
if(getVFS()->fileExists(fname))
{
iFileLoader = JPC_FILE_READER;
strncpy(ImageFile, fname.utf8().c_str(), fname.length());
ImageFile[fname.length()] = 0;
break;
}
#endif
iFileLoader = STCI_FILE_READER;
break;
}
else if ( _stricmp( Extension, "PNG" ) == 0 )
{
iFileLoader = PNG_FILE_READER;
break;
}
#ifdef USE_VFS
else if ( vfs::StrCmp::Equal(Extension, L"jpc.7z") )
{
iFileLoader = JPC_FILE_READER;
break;
}
#endif
} while ( FALSE );
// Determine if resource exists before creating image structure
if ( !FileExists( ImageFile ) )
{
//If in debig, make fatal!
#ifdef _DEBUG
//FatalError( "Resource file %s does not exist.", ImageFile );
#endif
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, String("Resource file %s does not exist.", ImageFile) );
return( NULL );
}
#else
std::string filename(ImageFile);
iFileLoader = ImageFileType::getFileReaderType(filename, order);
if ( iFileLoader == UNKNOWN_FILE_READER )
@@ -222,7 +142,6 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::Test
return( NULL );
}
#endif
// Create memory for image structure
hImage = (HIMAGE)MemAlloc( sizeof( image_type ) );
-23
View File
@@ -269,29 +269,6 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui
hImage->fFlags |= IMAGE_BITMAPDATA;
}
#if 0
// 32 bit not yet allowed in SGP
else if ( uiImagePixelSize == 32 )
{
iNumValues = uiWidth * uiHeight;
for ( i=0 ; i<iNumValues; i++ )
{
if ( !FileRead( hFile, &b, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
if ( !FileRead( hFile, &g, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
if ( !FileRead( hFile, &r, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
if ( !FileRead( hFile, &a, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
pBMData[ i*3 ] = r;
pBMData[ i*3+1 ] = g;
pBMData[ i*3+2 ] = b;
}
}
#endif
}
return( TRUE );
-19
View File
@@ -1609,25 +1609,6 @@ BOOLEAN IsCursorRestricted( void )
void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos )
{
#if 0
FLOAT flNewXPos, flNewYPos;
// Wizardry NOTE: This function currently doesn't quite work right for in any Windows resolution other than 640x480.
// mouse_event() uses your current Windows resolution to calculate the resulting x,y coordinates. So in order to get
// the right coordinates, you'd have to find out the current Windows resolution through a system call, and then do:
// uiNewXPos = uiNewXPos * SCREEN_WIDTH / WinScreenResX;
// uiNewYPos = uiNewYPos * SCREEN_HEIGHT / WinScreenResY;
//
// JA2 doesn't have this problem, 'cause they use DirectDraw calls that change the Windows resolution properly.
//
// Alex Meduna, Dec. 3, 1997
// Adjust coords based on our resolution
flNewXPos = ( (FLOAT)uiNewXPos / SCREEN_WIDTH ) * 65536;
flNewYPos = ( (FLOAT)uiNewYPos / SCREEN_HEIGHT ) * 65536;
mouse_event( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, (UINT32)flNewXPos, (UINT32)flNewYPos, 0, 0 );
#endif
// 0verhaul:
// The above is a bad hack. Especially in windowed mode. We don't want coords relative to the entire screen in that case.
// So instead, get screen coords and then use the setcursorpos call.
-36
View File
@@ -142,9 +142,6 @@ static CRITICAL_SECTION gcsGameLoop;
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
#if USE_CONSOLE
Console g_Console("", "", "Lua Console", "no");
#endif
#ifdef USE_VFS
@@ -394,15 +391,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
if (wParam == '\\' &&
lParam && KF_ALTDOWN)
{
#if USE_CONSOLE
g_Console.Create(ghWindow);
cout << "LUA console ready" << endl;
cout << "> ";
// Reset the pressed keys
gfKeyState[ ALT ] = FALSE;
gfKeyState[ 219 ] = FALSE; // "\"
#endif
}
}
}
@@ -1018,30 +1006,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
SHOWEXCEPTION(ex);
}
#if 0
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();
// After this frame, reset input given flag
gfSGPInputReceived = FALSE;
}
}
}
#endif
// This is the normal exit point
-23
View File
@@ -232,29 +232,6 @@ void BuildIntensityTable(void)
#if 0
UINT32 lumin;
UINT32 rmod, gmod, bmod;
for(red=0; red < 256; red+=4)
for(green=0; green < 256; green+=4)
for(blue=0; blue < 256; blue+=4)
{
index=Get16BPPColor(FROMRGB(red, green, blue));
lumin=( red*299/1000)+ ( green*587/1000 ) + ( blue*114/1000 );
//lumin = __min(lumin, 255);
rmod=(255*lumin)/256;
gmod=(100*lumin)/256;
bmod=(100*lumin)/256;
//rmod = __m( 255, rmod );
IntensityTable[index]=Get16BPPColor( FROMRGB( rmod, gmod , bmod ) );
}
#endif
-15
View File
@@ -11,20 +11,6 @@ bool TStringiLess::operator() (std::string const& s1, std::string const& s2) con
// An MSVC compliance issue...
//using std::toupper;
#if 0
std::string::const_iterator p1 = s1.begin();
std::string::const_iterator p2 = s2.begin();
while (p1 != s1.end() && p2 != s2.end() && toupper(*p1) == toupper(*p2)) {
++p1;
++p2;
}
if (p1 == s1.end()) return p2 != s2.end();
if (p2 == s2.end()) return false;
return toupper(*p1) < toupper(*p2);
#else
const char *p1 = s1.c_str();
const char *p2 = s2.c_str();
@@ -37,5 +23,4 @@ bool TStringiLess::operator() (std::string const& s1, std::string const& s2) con
if (!*p2) return false;
return toupper(*p1) < toupper(*p2);
#endif
}
-37
View File
@@ -1493,13 +1493,6 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
#endif
#if 0
StripRegions[ 0 ].left = gsVIEWPORT_START_X ;
StripRegions[ 0 ].right = gsVIEWPORT_END_X ;
StripRegions[ 0 ].top = gsVIEWPORT_WINDOW_START_Y ;
StripRegions[ 0 ].bottom = gsVIEWPORT_WINDOW_END_Y ;
usNumStrips = 1;
#endif
for ( cnt = 0; cnt < usNumStrips; cnt++ )
{
@@ -1596,28 +1589,6 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
ExecuteVideoOverlaysToAlternateBuffer( BACKBUFFER );
#if 0
// Erase mouse from old position
if (gMouseCursorBackground[ uiCurrentMouseBackbuffer ].fRestore == TRUE )
{
do
{
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, usMouseXPos, usMouseYPos, gMouseCursorBackground[uiCurrentMouseBackbuffer].pSurface, (LPRECT)&MouseRegion, DDBLTFAST_NOCOLORKEY);
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
{
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
if (ReturnCode == DDERR_SURFACELOST || (IS_ERROR(ReturnCode) && ++iDXLoopCount > iMaxDXLoopCount))
{
}
}
} while (ReturnCode != DD_OK);
}
#endif
}
@@ -1786,14 +1757,6 @@ void RefreshScreen(void *DummyVariable)
// Either Method (1) or (2)
//
{
#if 0
if ( gfRenderScroll )
{
ScrollJA2Background( guiScrollDirection, gsScrollXIncrement, gsScrollYIncrement, gpPrimarySurface, gpBackBuffer, TRUE, PREVIOUS_MOUSE_DATA );
// ScrollJA2Background( guiScrollDirection, gsScrollXIncrement, gsScrollYIncrement, gpBackBuffer, gpBackBuffer, TRUE, PREVIOUS_MOUSE_DATA );
gfForceFullScreenRefresh = TRUE;
}
#endif
if (gfForceFullScreenRefresh == TRUE)
{
//
-8
View File
@@ -922,18 +922,10 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
case 32:
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
image = &hSrcVObject->p16BPPObject[usIndex];
#if 0
Blt16BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
image->p16BPPData, image->usWidth * sizeof(UINT16),
iDestX, iDestY,
0, 0, image->usWidth, image->usHeight,
0 );
#else
Blt32BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
(UINT32*)image->p16BPPData, image->usWidth * sizeof(UINT32),
iDestX, iDestY,
0, 0, image->usWidth, image->usHeight);
#endif
break;
case 16:
@@ -224,7 +224,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc
//alpha = 255;
if(alpha > 0)
{
#if 1
// the darker shade
tmpVal = ShadeTable[*pDstPtr];
@@ -249,9 +248,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc
newcolor = FROMRGB(red,green,blue);
*pDstPtr = Get16BPPColor(newcolor);
#else
*pDstPtr = ShadeTable[*pDstPtr];
#endif
}
pSrcPtr++;
pDstPtr++;
@@ -7258,7 +7254,6 @@ BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UI
pDestPtr = (UINT16*)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
uiLineSkipDest = uiDestPitch - (uiWidth*2);
uiLineSkipSrc = uiSrcPitch - (uiWidth*2);
#if 1
do
{
UINT32 w = uiWidth;
@@ -7273,36 +7268,6 @@ BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UI
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
}
while (--uiHeight != 0);
#else
__asm {
mov esi, pSrcPtr
mov edi, pDestPtr
mov ebx, uiHeight
mov dx, usTrans
BlitNewLine:
mov ecx, uiWidth
Blit2:
mov ax, [esi]
cmp ax, dx
je Blit3
mov [edi], ax
Blit3:
add esi, 2
add edi, 2
dec ecx
jnz Blit2
add edi, uiLineSkipDest
add esi, uiLineSkipSrc
dec ebx
jnz BlitNewLine
}
#endif
return(TRUE);
}
@@ -7318,7 +7283,6 @@ BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pS
pDestPtr = (UINT16*)((UINT8 *)pDest + (iDestYPos * uiDestPitch) + (iDestXPos * 2));
uiLineSkipDest = uiDestPitch - (uiWidth * 2);
uiLineSkipSrc = uiSrcPitch - (uiWidth * 2);
#if 1
do
{
UINT32 w = uiWidth;
@@ -7336,7 +7300,6 @@ BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pS
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
}
while (--uiHeight != 0);
#endif
return TRUE;
}
@@ -9649,51 +9612,6 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha(UINT16 *pBuffer, UINT32 uiDe
}
#if 0
BlitNTL4:
// TEST FOR Z FIRST!
mov ax, [ebx]
cmp ax, usZValue
ja BlitNTL8
// Write it NOW!
jmp BlitNTL7
BlitNTL8:
test uiLineFlag, 1
jz BlitNTL6
test edi, 2
jz BlitNTL5
jmp BlitNTL9
BlitNTL6:
test edi, 2
jnz BlitNTL5
BlitNTL7:
// Write normal z value
mov ax, usZValue
mov [ebx], ax
jmp BlitNTL10
BlitNTL9:
// Write high z
mov ax, 32767
mov [ebx], ax
BlitNTL10:
xor eax, eax
mov al, [esi]
mov ax, [edx+eax*2]
mov [edi], ax
#endif
/**********************************************************************************************