mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
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:
committed by
Asdow
parent
6afe785f4b
commit
8b1c4effa0
@@ -791,27 +791,7 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -819,26 +799,7 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
@@ -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;
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -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 );
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
@@ -465,7 +429,6 @@ void MoveBuilding( INT32 iMapIndex )
|
||||
MarkWorldDirty();
|
||||
LightSpriteRenderAll();
|
||||
}
|
||||
#endif
|
||||
|
||||
void PasteBuilding( INT32 iMapIndex )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -239,11 +239,6 @@ enum{
|
||||
SUMMARY_LOAD,
|
||||
SUMMARY_SAVE,
|
||||
SUMMARY_OVERRIDE,
|
||||
#if 0
|
||||
SUMMARY_NEW_GROUNDLEVEL,
|
||||
SUMMARY_NEW_BASEMENTLEVEL,
|
||||
SUMMARY_NEW_CAVELEVEL,
|
||||
#endif
|
||||
SUMMARY_UPDATE,
|
||||
SUMMARY_SCIFI,
|
||||
SUMMARY_REAL,
|
||||
@@ -351,17 +346,6 @@ void CreateSummaryWindow()
|
||||
CreateCheckBoxButton( ( INT16 ) ( MAP_LEFT + 110 ), ( INT16 ) ( MAP_BOTTOM + 59 ), "EDITOR\\smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryOverrideCallback );
|
||||
|
||||
|
||||
#if 0
|
||||
iSummaryButton[ SUMMARY_NEW_GROUNDLEVEL ] =
|
||||
CreateSimpleButton( MAP_LEFT, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewGroundLevelCallback );
|
||||
SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_GROUNDLEVEL ], L"New map" );
|
||||
iSummaryButton[ SUMMARY_NEW_BASEMENTLEVEL ] =
|
||||
CreateSimpleButton( MAP_LEFT+32, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewBasementLevelCallback );
|
||||
SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_BASEMENTLEVEL ], L"New basement" );
|
||||
iSummaryButton[ SUMMARY_NEW_CAVELEVEL ] =
|
||||
CreateSimpleButton( MAP_LEFT+64, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewCaveLevelCallback );
|
||||
SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_CAVELEVEL ], L"New cave level" );
|
||||
#endif
|
||||
|
||||
|
||||
iSummaryButton[ SUMMARY_UPDATE ] =
|
||||
@@ -1826,23 +1810,6 @@ void SummaryToggleProgressCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
|
||||
void PerformTest()
|
||||
{
|
||||
#if 0
|
||||
OutputDebugString( "PERFORMING A NEW TEST -------------------------------------------------\n" );
|
||||
memset( gbDefaultSurfaceUsed, 0, sizeof( gbDefaultSurfaceUsed ) );
|
||||
giCurrentTilesetID = -1;
|
||||
switch( Random( 3 ) )
|
||||
{
|
||||
case 0:
|
||||
LoadWorld( "J9.dat" );
|
||||
break;
|
||||
case 1:
|
||||
LoadWorld( "J9_b1.dat" );
|
||||
break;
|
||||
case 2:
|
||||
LoadWorld( "J9_b2.dat" );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -3029,16 +2996,6 @@ void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
SetProgressBarTitle( 0, pSummaryUpdateCallbackText[0], BLOCKFONT2, FONT_RED, FONT_NEARBLACK );
|
||||
SetProgressBarMsgAttributes( 0, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK );
|
||||
|
||||
#if 0
|
||||
// 0verhaul: This should NOT be freed. An array index can be freed when it is recalculated,
|
||||
// as this function is about to do. And then it SHOULD be freed first, which it wasn't doing.
|
||||
// Either way, using this pointer is not a safe way to free the current sector's summary data.
|
||||
if( gpCurrentSectorSummary )
|
||||
{
|
||||
MemFree( gpCurrentSectorSummary );
|
||||
gpCurrentSectorSummary = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
sprintf( str, "%c%d", gsSelSectorY + 'A' - 1, gsSelSectorX );
|
||||
EvaluateWorld( str, (UINT8)giCurrLevel );
|
||||
@@ -3252,220 +3209,6 @@ void ApologizeOverrideAndForceUpdateEverything()
|
||||
gusNumberOfMapsToBeForceUpdated = 0;
|
||||
}
|
||||
|
||||
#if 0//dnl ch81 041213 this function is screwed up so decide to rewrite it
|
||||
//CHRISL: ADB changed the way this load file is handled
|
||||
extern int gEnemyPreservedTempFileVersion[256];
|
||||
extern int gCivPreservedTempFileVersion[256];
|
||||
void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
|
||||
{
|
||||
HWFILE hfile;
|
||||
UINT32 uiNumBytesRead;
|
||||
UINT32 uiNumItems;
|
||||
CHAR8 szFilename[40];
|
||||
BASIC_SOLDIERCREATE_STRUCT basic;
|
||||
SOLDIERCREATE_STRUCT priority;
|
||||
INT32 i, j;
|
||||
UINT16 usNumItems;
|
||||
OBJECTTYPE *pItem;
|
||||
UINT16 usPEnemyIndex, usNEnemyIndex;
|
||||
|
||||
SUMMARYFILE *s = gpCurrentSectorSummary;
|
||||
MAPCREATE_STRUCT *m = &gpCurrentSectorSummary->MapInfo;
|
||||
|
||||
//Clear memory for all the item summaries loaded
|
||||
if( gpWorldItemsSummaryArray )
|
||||
{
|
||||
delete[]( gpWorldItemsSummaryArray );
|
||||
gpWorldItemsSummaryArray = NULL;
|
||||
gusWorldItemsSummaryArraySize = 0;
|
||||
}
|
||||
if( gpPEnemyItemsSummaryArray )
|
||||
{
|
||||
delete[]( gpPEnemyItemsSummaryArray );
|
||||
gpPEnemyItemsSummaryArray = NULL;
|
||||
gusPEnemyItemsSummaryArraySize = 0;
|
||||
}
|
||||
if( gpNEnemyItemsSummaryArray )
|
||||
{
|
||||
delete[]( gpNEnemyItemsSummaryArray );
|
||||
gpNEnemyItemsSummaryArray = NULL;
|
||||
gusNEnemyItemsSummaryArraySize = 0;
|
||||
}
|
||||
|
||||
if( !gpCurrentSectorSummary->uiNumItemsPosition )
|
||||
{ //Don't have one, so generate them
|
||||
if( gpCurrentSectorSummary->ubSummaryVersion == GLOBAL_SUMMARY_VERSION )
|
||||
gusNumEntriesWithOutdatedOrNoSummaryInfo++;
|
||||
SummaryUpdateCallback( ButtonList[ iSummaryButton[ SUMMARY_UPDATE ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
}
|
||||
//Open the original map for the sector
|
||||
sprintf( szFilename, "MAPS\\%S", gszFilename );
|
||||
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
if( !hfile )
|
||||
{ //The file couldn't be found!
|
||||
return;
|
||||
}
|
||||
// ADB: The uiNumItemsPosition may be 0 here due to the recursion further down.
|
||||
// If so, skip the read
|
||||
uiNumItems = 0;
|
||||
if (gpCurrentSectorSummary->uiNumItemsPosition)
|
||||
{
|
||||
//Now fileseek directly to the file position where the number of world items are stored
|
||||
if( !FileSeek( hfile, gpCurrentSectorSummary->uiNumItemsPosition, FILE_SEEK_FROM_START ) )
|
||||
{ //Position couldn't be found!
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
//Now load the number of world items from the map.
|
||||
FileRead( hfile, &uiNumItems, 4, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != 4 )
|
||||
{ //Invalid situation.
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Now compare this number with the number the summary thinks we should have. If they are different,
|
||||
//then the summary doesn't match the map. What we will do is force regenerate the map so that they do
|
||||
//match
|
||||
if( uiNumItems != gpCurrentSectorSummary->usNumItems && fAllowRecursion )
|
||||
{
|
||||
FileClose( hfile );
|
||||
gpCurrentSectorSummary->uiNumItemsPosition = 0;
|
||||
SetupItemDetailsMode( FALSE );
|
||||
return;
|
||||
}
|
||||
//Passed the gauntlet, so now allocate memory for it, and load all the world items into this array.
|
||||
ShowButton( iSummaryButton[ SUMMARY_SCIFI ] );
|
||||
ShowButton( iSummaryButton[ SUMMARY_REAL ] );
|
||||
ShowButton( iSummaryButton[ SUMMARY_ENEMY ] );
|
||||
gpWorldItemsSummaryArray = new WORLDITEM[ uiNumItems ];
|
||||
gusWorldItemsSummaryArraySize = gpCurrentSectorSummary->usNumItems;
|
||||
for (unsigned int x = 0; x < uiNumItems; ++x)
|
||||
{
|
||||
gpWorldItemsSummaryArray[x].Load(hfile, s->dMajorMapVersion, m->ubMapVersion);
|
||||
}
|
||||
|
||||
//NOW, do the enemy's items!
|
||||
//We need to do two passes. The first pass simply processes all the enemies and counts all the droppable items
|
||||
//keeping track of two different values. The first value is the number of droppable items that come off of
|
||||
//enemy detailed placements, the other counter keeps track of the number of droppable items that come off of
|
||||
//normal enemy placements. After doing this, the memory is allocated for the tables that will store all the item
|
||||
//summary information, then the second pass will repeat the process, except it will record the actual items.
|
||||
|
||||
//PASS #1
|
||||
if( !FileSeek( hfile, gpCurrentSectorSummary->uiEnemyPlacementPosition, FILE_SEEK_FROM_START ) )
|
||||
{ //Position couldn't be found!
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
for( i = 0; i < gpCurrentSectorSummary->MapInfo.ubNumIndividuals ; i++ )
|
||||
{
|
||||
FileRead( hfile, &basic, sizeof( BASIC_SOLDIERCREATE_STRUCT ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( BASIC_SOLDIERCREATE_STRUCT ) )
|
||||
{ //Invalid situation.
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
if( basic.fDetailedPlacement )
|
||||
{ //skip static priority placement
|
||||
if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) )
|
||||
{ //Invalid situation.
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //non detailed placements don't have items, so skip
|
||||
continue;
|
||||
}
|
||||
if( basic.bTeam == ENEMY_TEAM )
|
||||
{
|
||||
//Count the items that this enemy placement drops
|
||||
usNumItems = 0;
|
||||
for( j = 0; j < 9; j++ )
|
||||
{
|
||||
pItem = &priority.Inv[ gbMercSlotTypes[ j ] ];
|
||||
if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) )
|
||||
{
|
||||
usNumItems++;
|
||||
}
|
||||
}
|
||||
if( basic.fPriorityExistance )
|
||||
{
|
||||
gusPEnemyItemsSummaryArraySize += usNumItems;
|
||||
}
|
||||
else
|
||||
{
|
||||
gusNEnemyItemsSummaryArraySize += usNumItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Pass 1 completed, so now allocate enough space to hold all the items
|
||||
if( gusPEnemyItemsSummaryArraySize )
|
||||
{
|
||||
gpPEnemyItemsSummaryArray = new OBJECTTYPE[ gusPEnemyItemsSummaryArraySize ];
|
||||
}
|
||||
if( gusNEnemyItemsSummaryArraySize )
|
||||
{
|
||||
gpNEnemyItemsSummaryArray = new OBJECTTYPE[ gusNEnemyItemsSummaryArraySize ];
|
||||
}
|
||||
|
||||
//PASS #2
|
||||
//During this pass, simply copy all the data instead of counting it, now that we have already done so.
|
||||
usPEnemyIndex = usNEnemyIndex = 0;
|
||||
if( !FileSeek( hfile, gpCurrentSectorSummary->uiEnemyPlacementPosition, FILE_SEEK_FROM_START ) )
|
||||
{ //Position couldn't be found!
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
for( i = 0; i < gpCurrentSectorSummary->MapInfo.ubNumIndividuals ; i++ )
|
||||
{
|
||||
FileRead( hfile, &basic, sizeof( BASIC_SOLDIERCREATE_STRUCT ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( BASIC_SOLDIERCREATE_STRUCT ) )
|
||||
{ //Invalid situation.
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
if( basic.fDetailedPlacement )
|
||||
{ //skip static priority placement
|
||||
if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) )
|
||||
{ //Invalid situation.
|
||||
FileClose( hfile );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //non detailed placements don't have items, so skip
|
||||
continue;
|
||||
}
|
||||
if( basic.bTeam == ENEMY_TEAM )
|
||||
{
|
||||
//Copy the items that this enemy placement drops
|
||||
usNumItems = 0;
|
||||
for( j = 0; j < 9; j++ )
|
||||
{
|
||||
pItem = &priority.Inv[ gbMercSlotTypes[ j ] ];
|
||||
if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) )
|
||||
{
|
||||
if( basic.fPriorityExistance )
|
||||
{
|
||||
gpPEnemyItemsSummaryArray[ usPEnemyIndex ] = *pItem;
|
||||
usPEnemyIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gpNEnemyItemsSummaryArray[ usNEnemyIndex ] = *pItem;
|
||||
usNEnemyIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FileClose( hfile );
|
||||
}
|
||||
#else
|
||||
void SetupItemDetailsMode(BOOLEAN fAllowRecursion)
|
||||
{
|
||||
UINT32 uiNumItems, uiFileSize, uiBytesRead;
|
||||
@@ -3630,7 +3373,6 @@ L01:
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT8 GetCurrentSummaryVersion()
|
||||
{
|
||||
|
||||
@@ -2090,22 +2090,7 @@ void HandleKeyboardShortcuts( )
|
||||
// item left scroll
|
||||
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
|
||||
{
|
||||
#if 0//dnl ch80 011213
|
||||
if( eInfo.sScrollIndex )
|
||||
{
|
||||
if( EditorInputEvent.usKeyState & CTRL_DOWN )
|
||||
eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 60, 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
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2120,21 +2105,7 @@ void HandleKeyboardShortcuts( )
|
||||
// item right scroll
|
||||
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
|
||||
{
|
||||
#if 0//dnl ch80 011213
|
||||
if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) )
|
||||
{
|
||||
if( EditorInputEvent.usKeyState & CTRL_DOWN )
|
||||
eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 60, (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
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2149,22 +2120,7 @@ void HandleKeyboardShortcuts( )
|
||||
// item left scroll by page
|
||||
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
|
||||
{
|
||||
#if 0//dnl ch80 011213
|
||||
if( eInfo.sScrollIndex )
|
||||
{
|
||||
if( EditorInputEvent.usKeyState & CTRL_DOWN )
|
||||
eInfo.sScrollIndex = 0;
|
||||
else
|
||||
eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 6, 0);
|
||||
|
||||
if( !eInfo.sScrollIndex )
|
||||
DisableButton( iEditorButton[ITEMS_LEFTSCROLL] );
|
||||
if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 )
|
||||
EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
|
||||
}
|
||||
#else
|
||||
ScrollEditorItemsInfo(FALSE);
|
||||
#endif
|
||||
}
|
||||
//gfRenderTaskbar = TRUE;
|
||||
break;
|
||||
@@ -2172,21 +2128,7 @@ void HandleKeyboardShortcuts( )
|
||||
// item right scroll by page
|
||||
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
|
||||
{
|
||||
#if 0//dnl ch80 011213
|
||||
if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) )
|
||||
{
|
||||
if( EditorInputEvent.usKeyState & CTRL_DOWN )
|
||||
eInfo.sScrollIndex = max( ((eInfo.sNumItems+1)/2)-6, 0);
|
||||
else
|
||||
eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 6, (eInfo.sNumItems+1)/2-6);
|
||||
|
||||
EnableButton( iEditorButton[ITEMS_LEFTSCROLL] );
|
||||
if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) )
|
||||
DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
|
||||
}
|
||||
#else
|
||||
ScrollEditorItemsInfo(TRUE);
|
||||
#endif
|
||||
}
|
||||
//gfRenderTaskbar = TRUE;
|
||||
break;
|
||||
@@ -3264,65 +3206,6 @@ BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType, INT8 b
|
||||
// Returns TRUE if deleted the light, otherwise, returns FALSE.
|
||||
// i.e. FALSE is not an error condition!
|
||||
//
|
||||
#if 0//dnl ch86 210214
|
||||
BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY )
|
||||
{
|
||||
INT32 iCount;
|
||||
UINT16 cnt;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
BOOLEAN fSoldierLight;
|
||||
BOOLEAN fRemovedLight;
|
||||
INT32 iMapIndex = 0;
|
||||
UINT32 uiLastLightType = 0;
|
||||
UINT8 *pLastLightName = NULL;
|
||||
|
||||
fRemovedLight = FALSE;
|
||||
|
||||
// Check all lights if any at this given position
|
||||
for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++)
|
||||
{
|
||||
if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE)
|
||||
{
|
||||
if ( LightSprites[iCount].iX == iMapX && LightSprites[iCount].iY == iMapY )
|
||||
{
|
||||
// Found a light, so let's see if it belong to a merc!
|
||||
fSoldierLight = FALSE;
|
||||
for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ )
|
||||
{
|
||||
if ( GetSoldier( &pSoldier, cnt ) )
|
||||
{
|
||||
if ( pSoldier->iLight == iCount )
|
||||
fSoldierLight = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !fSoldierLight )
|
||||
{
|
||||
// Ok, it's not a merc's light so kill it!
|
||||
pLastLightName = (UINT8 *) LightSpriteGetTypeName( iCount );
|
||||
uiLastLightType = LightSprites[iCount].uiLightType;
|
||||
LightSpritePower( iCount, FALSE );
|
||||
LightSpriteDestroy( iCount );
|
||||
fRemovedLight = TRUE;
|
||||
iMapIndex = ((INT32)iMapY * WORLD_COLS) + (INT32)iMapX;
|
||||
RemoveAllObjectsOfTypeRange( iMapIndex, GOODRING, GOODRING );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( fRemovedLight )
|
||||
{
|
||||
UINT16 usRadius;
|
||||
//Assuming that the light naming convention doesn't change, then this following conversion
|
||||
//should work. Basically, the radius values aren't stored in the lights, so I have pull
|
||||
//the radius out of the filename. Ex: L-RO5.LHT
|
||||
usRadius = pLastLightName[4] - 0x30;
|
||||
AddLightToUndoList( iMapIndex, usRadius, (UINT8)uiLastLightType );
|
||||
}
|
||||
|
||||
return( fRemovedLight );
|
||||
}
|
||||
#else
|
||||
BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType)
|
||||
{
|
||||
INT32 iCount, iMapIndex;
|
||||
@@ -3340,7 +3223,6 @@ BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType)
|
||||
RemoveAllObjectsOfTypeRange(iMapIndex, GOODRING, GOODRING);
|
||||
return(fRemovedLight);
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// ShowLightPositionHandles
|
||||
@@ -3473,79 +3355,6 @@ BOOLEAN CheckForSlantRoofs( void )
|
||||
//
|
||||
void MapOptimize(void)
|
||||
{
|
||||
#if 0
|
||||
INT32 GridNo;
|
||||
LEVELNODE *start, *head, *end, *node, *temp;
|
||||
MAP_ELEMENT *pMapTile;
|
||||
BOOLEAN fFound, fChangedHead, fChangedTail;
|
||||
|
||||
for( GridNo = 0; GridNo < WORLD_MAX; GridNo++ )
|
||||
{
|
||||
if ( !GridNoOnVisibleWorldTile( GridNo ) )
|
||||
{
|
||||
// Tile isn't in viewable area so trash everything in it
|
||||
TrashMapTile( GridNo );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tile is in viewable area so try to optimize any extra land pieces
|
||||
pMapTile = &gpWorldLevelData[ GridNo ];
|
||||
|
||||
node = start = pMapTile->pLandStart;
|
||||
head = pMapTile->pLandHead;
|
||||
|
||||
if ( start == NULL )
|
||||
node = start = head;
|
||||
|
||||
end = pMapTile->pLandTail;
|
||||
|
||||
fChangedHead = fChangedTail = fFound = FALSE;
|
||||
while ( !fFound && node != NULL )
|
||||
{
|
||||
if ( gTileDatabase[node->usIndex].ubFullTile == 1 )
|
||||
fFound = TRUE;
|
||||
else
|
||||
node = node->pNext;
|
||||
}
|
||||
|
||||
if(fFound)
|
||||
{
|
||||
// Delete everything up to the start node
|
||||
/*
|
||||
// Not having this means we still keep the smoothing
|
||||
|
||||
while( head != start && head != NULL )
|
||||
{
|
||||
fChangedHead = TRUE;
|
||||
temp = head->pNext;
|
||||
MemFree( head );
|
||||
head = temp;
|
||||
if ( head )
|
||||
head->pPrev = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
// Now delete from the end to "node"
|
||||
while( end != node && end != NULL )
|
||||
{
|
||||
fChangedTail = TRUE;
|
||||
temp = end->pPrev;
|
||||
MemFree( end );
|
||||
end = temp;
|
||||
if ( end )
|
||||
end->pNext = NULL;
|
||||
}
|
||||
|
||||
if ( fChangedHead )
|
||||
pMapTile->pLandHead = head;
|
||||
|
||||
if ( fChangedTail )
|
||||
pMapTile->pLandTail = end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -3929,29 +3738,11 @@ void HandleMouseClicksInGameScreen()//dnl ch80 011213
|
||||
{
|
||||
if(iLastMapIndexRB != iMapIndex && iLastMapIndexRB == -1)
|
||||
iLastMapIndexRB = iMapIndex;
|
||||
#if 0
|
||||
gfRenderWorld = TRUE;
|
||||
switch(iDrawMode)
|
||||
{
|
||||
default:
|
||||
gfRenderWorld = fPrevState;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(_MiddleButtonDown)
|
||||
{
|
||||
if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1)
|
||||
iLastMapIndexMB = iMapIndex;
|
||||
#if 0
|
||||
gfRenderWorld = TRUE;
|
||||
switch(iDrawMode)
|
||||
{
|
||||
default:
|
||||
gfRenderWorld = fPrevState;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(!_LeftButtonDown)
|
||||
{
|
||||
@@ -4192,15 +3983,6 @@ void HandleMouseClicksInGameScreen()//dnl ch80 011213
|
||||
{
|
||||
if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile
|
||||
{
|
||||
#if 0
|
||||
gfRenderWorld = TRUE;
|
||||
switch(iDrawMode)
|
||||
{
|
||||
default:
|
||||
gfRenderWorld = fPrevState;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
iLastMapIndexMB = -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user