Skip to content

Commit

Permalink
nuke all the #if 0's
Browse files Browse the repository at this point in the history
scripted commit:

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

https://coan2.sourceforge.net/coan_man_1.html
  • Loading branch information
majcosta authored and Asdow committed Jan 18, 2023
1 parent 6afe785 commit 8b1c4ef
Show file tree
Hide file tree
Showing 72 changed files with 0 additions and 6,657 deletions.
1,700 changes: 0 additions & 1,700 deletions Console/Console.cpp

Large diffs are not rendered by default.

74 changes: 0 additions & 74 deletions Console/Cursors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,7 @@ void ConsoleCursor::Draw(LPRECT pRect) {

if (m_bActive && m_bVisible) {

#if 0
CONSOLE_CURSOR_INFO csi;
::GetConsoleCursorInfo(m_hStdOut, &csi);
rect.top += (rect.bottom - rect.top) * (100-csi.dwSize)/100;
#else
rect.top += (rect.bottom - rect.top) * 80 / 100;
#endif

::FillRect(m_hdcWindow, &rect, m_hActiveBrush);
}
Expand Down Expand Up @@ -706,38 +700,6 @@ FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCurs
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 35, NULL);

#if 0
if (g_bWin2000) {
// on Win2000 we use real alpha blending

// create a reasonable-sized bitmap, since AlphaBlt resizes
// destination rect if needed, and we don't need to redraw the mem DC
// each time
m_nBmpWidth = BLEND_BMP_WIDTH;
m_nBmpHeight= BLEND_BMP_HEIGHT;
m_hMemDC = ::CreateCompatibleDC(hdcWindow);
m_hBmp = ::CreateCompatibleBitmap(hdcWindow, m_nBmpWidth, m_nBmpHeight);
m_hBmpOld = (HBITMAP)::SelectObject(m_hMemDC, m_hBmp);

HBRUSH hBrush= ::CreateSolidBrush(m_crCursorColor);
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = m_nBmpWidth;
rect.bottom = m_nBmpHeight;

::FillRect(m_hMemDC, &rect, hBrush);
::DeleteObject(hBrush);

m_nStep = -ALPHA_STEP;

m_bfn.BlendOp = AC_SRC_OVER;
m_bfn.BlendFlags = 0;
m_bfn.SourceConstantAlpha = 255;
m_bfn.AlphaFormat = 0;

} else {
#endif
FakeBlend();
// }
}
Expand All @@ -746,13 +708,6 @@ FadeBlockCursor::~FadeBlockCursor() {

if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);

#if 0
if (g_bWin2000) {
::SelectObject(m_hMemDC, m_hBmpOld);
::DeleteObject(m_hBmp);
::DeleteDC(m_hMemDC);
}
#endif
}

/////////////////////////////////////////////////////////////////////////////
Expand All @@ -762,24 +717,6 @@ FadeBlockCursor::~FadeBlockCursor() {

void FadeBlockCursor::Draw(LPRECT pRect) {

#if 0
if (g_bWin2000) {

g_pfnAlphaBlend(
m_hdcWindow,
pRect->left,
pRect->top,
pRect->right - pRect->left,
pRect->bottom - pRect->top,
m_hMemDC,
0,
0,
BLEND_BMP_WIDTH,
BLEND_BMP_HEIGHT,
m_bfn);

} else {
#endif

HBRUSH hBrush = ::CreateSolidBrush(m_arrColors[m_nIndex]);
::FillRect(m_hdcWindow, pRect, hBrush);
Expand All @@ -793,17 +730,6 @@ void FadeBlockCursor::Draw(LPRECT pRect) {
/////////////////////////////////////////////////////////////////////////////

void FadeBlockCursor::PrepareNext() {
#if 0
if (g_bWin2000){
if (m_bfn.SourceConstantAlpha < ALPHA_STEP) {
m_nStep = ALPHA_STEP;
} else if ((DWORD)m_bfn.SourceConstantAlpha + ALPHA_STEP > 255) {
m_nStep = -ALPHA_STEP;
}

m_bfn.SourceConstantAlpha += m_nStep;
} else {
#endif
if (m_nIndex == 0) {
m_nStep = 1;
} else if (m_nIndex == (FADE_STEPS)) {
Expand Down
6 changes: 0 additions & 6 deletions Console/Cursors.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ class FadeBlockCursor : public Cursor {
HMODULE m_hUser32;
BLENDFUNCTION m_bfn;
HDC m_hMemDC;
#if 0
HBITMAP m_hBmp;
HBITMAP m_hBmpOld;
int m_nBmpWidth;
int m_nBmpHeight;
#endif
};

/////////////////////////////////////////////////////////////////////////////
39 changes: 0 additions & 39 deletions Editor/Editor Callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,54 +791,15 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
#if 0//dnl ch80 011213
gfRenderTaskbar = TRUE;
if (_KeyDown( 17 ) ) // CTRL
{
if (_KeyDown( 16 ) ) // SHIFT
eInfo.sScrollIndex = 0;
else
eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 60, 0);
}
else if (_KeyDown( 16 ) ) // SHIFT
eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 6, 0);
else
eInfo.sScrollIndex--;

if( !eInfo.sScrollIndex )
DisableButton( iEditorButton[ITEMS_LEFTSCROLL] );
if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 )
EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
#else
ScrollEditorItemsInfo(FALSE);
#endif
}
}

void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
#if 0//dnl ch80 011213
gfRenderTaskbar = TRUE;
if (_KeyDown( 17 ) ) // CTRL
{
if (_KeyDown( 16 ) ) // SHIFT
eInfo.sScrollIndex = max( ((eInfo.sNumItems+1)/2)-6, 0);
else
eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 60, (eInfo.sNumItems+1)/2-6);
}
else if (_KeyDown( 16 ) ) // SHIFT
eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 6, (eInfo.sNumItems+1)/2-6);
else
eInfo.sScrollIndex++;

EnableButton( iEditorButton[ITEMS_LEFTSCROLL] );
if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) )
DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
#else
ScrollEditorItemsInfo(TRUE);
#endif
}
}

Expand Down
93 changes: 0 additions & 93 deletions Editor/Editor Undo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,56 +367,6 @@ void CropStackToMaxLength( INT32 iMaxCmds )
}
}

#if 0//dnl ch86 200214
//We are adding a light to the undo list. We won't save the mapelement, nor will
//we validate the gridno in the binary tree. This works differently than a mapelement,
//because lights work on a different system. By setting the fLightSaved flag to TRUE,
//this will handle the way the undo command is handled. If there is no lightradius in
//our saved light, then we intend on erasing the light upon undo execution, otherwise, we
//save the light radius and light ID, so that we place it during undo execution.
void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID )
{
undo_stack *pNode;
undo_struct *pUndoInfo;

if( !gfUndoEnabled )
return;
//When executing an undo command (by adding a light or removing one), that command
//actually tries to add it to the undo list. So we wrap the execution of the undo
//command by temporarily setting this flag, so it'll ignore, and not place a new undo
//command. When finished, the flag is cleared, and lights are again allowed to be saved
//in the undo list.
if( gfIgnoreUndoCmdsForLights )
return;

pNode = (undo_stack*)MemAlloc( sizeof( undo_stack ) );
if( !pNode )
return;

pUndoInfo = (undo_struct *)MemAlloc( sizeof( undo_struct ) );
if( !pUndoInfo )
{
MemFree( pNode );
return;
}

pUndoInfo->fLightSaved = TRUE;
//if ubLightRadius is 0, then we don't need to save the light information because we
//will erase it when it comes time to execute the undo command.
pUndoInfo->ubLightRadius = (UINT8)iLightRadius;
pUndoInfo->ubLightID = ubLightID;
pUndoInfo->iMapIndex = iMapIndex;
pUndoInfo->pMapTile = NULL;

//Add to undo stack
pNode->iCmdCount = 1;
pNode->pData = pUndoInfo;
pNode->pNext = gpTileUndoStack;
gpTileUndoStack = pNode;

CropStackToMaxLength( MAX_UNDO_COMMAND_LENGTH );
}
#endif

BOOLEAN AddToUndoList( INT32 iMapIndex )
{
Expand Down Expand Up @@ -543,11 +493,7 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount )
{
// this loop won't execute for single-tile structures; for multi-tile structures, we have to
// add to the undo list all the other tiles covered by the structure
#if 0//dnl ch83 080114
iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase;
#else
iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]);
#endif
AddToUndoList( iCoveredMapIndex );
}
pStructure = pStructure->pNext;
Expand Down Expand Up @@ -575,19 +521,11 @@ void CheckMapIndexForMultiTileStructures( UINT32 usMapIndex )
// for multi-tile structures we have to add, to the undo list, all the other tiles covered by the structure
if (pStructure->fFlags & STRUCTURE_BASE_TILE)
{
#if 0//dnl ch83 080114
iCoveredMapIndex = usMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase;
#else
iCoveredMapIndex = AddPosRelToBase(usMapIndex, pStructure->pDBStructureRef->ppTile[ubLoop]);
#endif
}
else
{
#if 0//dnl ch83 080114
iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase;
#else
iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]);
#endif
}
AddToUndoList( iCoveredMapIndex );
}
Expand Down Expand Up @@ -636,26 +574,6 @@ BOOLEAN ExecuteUndoList( void )
while ( (iCurCount < iCmdCount) && (gpTileUndoStack != NULL) )
{
iUndoMapIndex = gpTileUndoStack->pData->iMapIndex;
#if 0//dnl ch86 201214
fExitGrid = ExitGridAtGridNo( iUndoMapIndex );

// Find which map tile we are to "undo"
if( gpTileUndoStack->pData->fLightSaved )
{ //We saved a light, so delete that light
INT16 sX, sY;
//Turn on this flag so that the following code, when executed, doesn't attempt to
//add lights to the undo list. That would cause problems...
gfIgnoreUndoCmdsForLights = TRUE;
ConvertGridNoToXY( iUndoMapIndex, &sX, &sY );
if( !gpTileUndoStack->pData->ubLightRadius )
RemoveLight( sX, sY );
else
PlaceLight( gpTileUndoStack->pData->ubLightRadius, sX, sY, gpTileUndoStack->pData->ubLightID );
//Turn off the flag so lights can again be added to the undo list.
gfIgnoreUndoCmdsForLights = FALSE;
}
else
#endif
{ // We execute the undo command node by simply swapping the contents
// of the undo's MAP_ELEMENT with the world's element.
SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile );
Expand Down Expand Up @@ -730,19 +648,8 @@ BOOLEAN ExecuteUndoList( void )
//an undo is called, the item is erased, but a cursor is added! I'm quickly
//hacking around this by erasing all cursors here.
RemoveAllTopmostsOfTypeRange( iUndoMapIndex, FIRSTPOINTERS, FIRSTPOINTERS );
#if 0//dnl ch86 110214
if( fExitGrid && !ExitGridAtGridNo( iUndoMapIndex ) )
{ //An exitgrid has been removed, so get rid of the associated indicator.
RemoveTopmost( iUndoMapIndex, FIRSTPOINTERS8 );
}
else if( !fExitGrid && ExitGridAtGridNo( iUndoMapIndex ) )
{ //An exitgrid has been added, so add the associated indicator
AddTopmostToTail( iUndoMapIndex, FIRSTPOINTERS8 );
}
#else
if(gfShowExitGrids && fExitGrid)
AddTopmostToTail(iUndoMapIndex, FIRSTPOINTERS8);
#endif
}

return( TRUE );
Expand Down
37 changes: 0 additions & 37 deletions Editor/EditorBuildings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,44 +366,8 @@ void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo )
AddTopmostToTail( iDstGridNo, pNode->usIndex );
pNode = pNode->pNext;
}
#if 0//dnl ch86 110214
for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ )
{
HideStructOfGivenType( iDstGridNo, usType, (BOOLEAN)(!fBuildingShowRoofs) );
}
#endif
}

#if 0//dnl ch86 220214
void MoveBuilding( INT32 iMapIndex )
{
BUILDINGLAYOUTNODE *curr;
INT32 iOffset;
if( !gpBuildingLayoutList )
return;
SortBuildingLayout( iMapIndex );
iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo;
if(iOffset == 0)//dnl ch32 080909
return;
//First time, set the undo gridnos to everything effected.
curr = gpBuildingLayoutList;
while( curr )
{
AddToUndoList( curr->sGridNo );
AddToUndoList( curr->sGridNo + iOffset );
curr = curr->next;
}
//Now, move the building
curr = gpBuildingLayoutList;
while( curr )
{
PasteMapElementToNewMapElement( curr->sGridNo, curr->sGridNo + iOffset );
DeleteStuffFromMapTile( curr->sGridNo );
curr = curr->next;
}
MarkWorldDirty();
}
#else
void MoveBuilding( INT32 iMapIndex )
{
INT8 bLightType;
Expand Down Expand Up @@ -465,7 +429,6 @@ void MoveBuilding( INT32 iMapIndex )
MarkWorldDirty();
LightSpriteRenderAll();
}
#endif

void PasteBuilding( INT32 iMapIndex )
{
Expand Down
6 changes: 0 additions & 6 deletions Editor/EditorItems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,16 +1032,10 @@ void DeleteSelectedItem()
if( gpEditingItemPool == gpItemPool )
gpEditingItemPool = NULL;
RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 );
#if 0//dnl ch86 220214
gpItemPool = NULL;
//determine if there are still any items at this location
if( GetItemPoolFromGround( sGridNo, &gpItemPool ) )
#else
ITEM_POOL *pItemPoolOld = gpItemPool;
GetItemPoolFromGround(sGridNo, &gpItemPool);
UpdateItemPoolInUndoList(sGridNo, pItemPoolOld, gpItemPool);
if(gpItemPool)
#endif
{ //reset display for remaining items
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
}
Expand Down
Loading

0 comments on commit 8b1c4ef

Please sign in to comment.