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
-1700
View File
File diff suppressed because it is too large Load Diff
-74
View File
@@ -327,13 +327,7 @@ void ConsoleCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) { 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; rect.top += (rect.bottom - rect.top) * 80 / 100;
#endif
::FillRect(m_hdcWindow, &rect, m_hActiveBrush); ::FillRect(m_hdcWindow, &rect, m_hActiveBrush);
} }
@@ -706,38 +700,6 @@ FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCurs
{ {
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 35, NULL); 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(); FakeBlend();
// } // }
} }
@@ -746,13 +708,6 @@ FadeBlockCursor::~FadeBlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); 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
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -762,24 +717,6 @@ FadeBlockCursor::~FadeBlockCursor() {
void FadeBlockCursor::Draw(LPRECT pRect) { 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]); HBRUSH hBrush = ::CreateSolidBrush(m_arrColors[m_nIndex]);
::FillRect(m_hdcWindow, pRect, hBrush); ::FillRect(m_hdcWindow, pRect, hBrush);
@@ -793,17 +730,6 @@ void FadeBlockCursor::Draw(LPRECT pRect) {
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
void FadeBlockCursor::PrepareNext() { 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) { if (m_nIndex == 0) {
m_nStep = 1; m_nStep = 1;
} else if (m_nIndex == (FADE_STEPS)) { } else if (m_nIndex == (FADE_STEPS)) {
-6
View File
@@ -337,12 +337,6 @@ class FadeBlockCursor : public Cursor {
HMODULE m_hUser32; HMODULE m_hUser32;
BLENDFUNCTION m_bfn; BLENDFUNCTION m_bfn;
HDC m_hMemDC; HDC m_hMemDC;
#if 0
HBITMAP m_hBmp;
HBITMAP m_hBmpOld;
int m_nBmpWidth;
int m_nBmpHeight;
#endif
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
-39
View File
@@ -791,27 +791,7 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason)
{ {
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) 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); ScrollEditorItemsInfo(FALSE);
#endif
} }
} }
@@ -819,26 +799,7 @@ void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason)
{ {
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) 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); ScrollEditorItemsInfo(TRUE);
#endif
} }
} }
-93
View File
@@ -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 ) 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 // 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 // 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]); iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]);
#endif
AddToUndoList( iCoveredMapIndex ); AddToUndoList( iCoveredMapIndex );
} }
pStructure = pStructure->pNext; 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 // 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 (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]); iCoveredMapIndex = AddPosRelToBase(usMapIndex, pStructure->pDBStructureRef->ppTile[ubLoop]);
#endif
} }
else else
{ {
#if 0//dnl ch83 080114
iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase;
#else
iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]); iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]);
#endif
} }
AddToUndoList( iCoveredMapIndex ); AddToUndoList( iCoveredMapIndex );
} }
@@ -636,26 +574,6 @@ BOOLEAN ExecuteUndoList( void )
while ( (iCurCount < iCmdCount) && (gpTileUndoStack != NULL) ) while ( (iCurCount < iCmdCount) && (gpTileUndoStack != NULL) )
{ {
iUndoMapIndex = gpTileUndoStack->pData->iMapIndex; 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 { // We execute the undo command node by simply swapping the contents
// of the undo's MAP_ELEMENT with the world's element. // of the undo's MAP_ELEMENT with the world's element.
SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile ); 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 //an undo is called, the item is erased, but a cursor is added! I'm quickly
//hacking around this by erasing all cursors here. //hacking around this by erasing all cursors here.
RemoveAllTopmostsOfTypeRange( iUndoMapIndex, FIRSTPOINTERS, FIRSTPOINTERS ); 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) if(gfShowExitGrids && fExitGrid)
AddTopmostToTail(iUndoMapIndex, FIRSTPOINTERS8); AddTopmostToTail(iUndoMapIndex, FIRSTPOINTERS8);
#endif
} }
return( TRUE ); return( TRUE );
-37
View File
@@ -366,44 +366,8 @@ void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo )
AddTopmostToTail( iDstGridNo, pNode->usIndex ); AddTopmostToTail( iDstGridNo, pNode->usIndex );
pNode = pNode->pNext; 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 ) void MoveBuilding( INT32 iMapIndex )
{ {
INT8 bLightType; INT8 bLightType;
@@ -465,7 +429,6 @@ void MoveBuilding( INT32 iMapIndex )
MarkWorldDirty(); MarkWorldDirty();
LightSpriteRenderAll(); LightSpriteRenderAll();
} }
#endif
void PasteBuilding( INT32 iMapIndex ) void PasteBuilding( INT32 iMapIndex )
{ {
-6
View File
@@ -1032,16 +1032,10 @@ void DeleteSelectedItem()
if( gpEditingItemPool == gpItemPool ) if( gpEditingItemPool == gpItemPool )
gpEditingItemPool = NULL; gpEditingItemPool = NULL;
RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 ); 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; ITEM_POOL *pItemPoolOld = gpItemPool;
GetItemPoolFromGround(sGridNo, &gpItemPool); GetItemPoolFromGround(sGridNo, &gpItemPool);
UpdateItemPoolInUndoList(sGridNo, pItemPoolOld, gpItemPool); UpdateItemPoolInUndoList(sGridNo, pItemPoolOld, gpItemPool);
if(gpItemPool) if(gpItemPool)
#endif
{ //reset display for remaining items { //reset display for remaining items
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo ); SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
} }
-258
View File
@@ -239,11 +239,6 @@ enum{
SUMMARY_LOAD, SUMMARY_LOAD,
SUMMARY_SAVE, SUMMARY_SAVE,
SUMMARY_OVERRIDE, SUMMARY_OVERRIDE,
#if 0
SUMMARY_NEW_GROUNDLEVEL,
SUMMARY_NEW_BASEMENTLEVEL,
SUMMARY_NEW_CAVELEVEL,
#endif
SUMMARY_UPDATE, SUMMARY_UPDATE,
SUMMARY_SCIFI, SUMMARY_SCIFI,
SUMMARY_REAL, SUMMARY_REAL,
@@ -351,17 +346,6 @@ void CreateSummaryWindow()
CreateCheckBoxButton( ( INT16 ) ( MAP_LEFT + 110 ), ( INT16 ) ( MAP_BOTTOM + 59 ), "EDITOR\\smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryOverrideCallback ); 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 ] = iSummaryButton[ SUMMARY_UPDATE ] =
@@ -1826,23 +1810,6 @@ void SummaryToggleProgressCallback( GUI_BUTTON *btn, INT32 reason )
void PerformTest() 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 ); SetProgressBarTitle( 0, pSummaryUpdateCallbackText[0], BLOCKFONT2, FONT_RED, FONT_NEARBLACK );
SetProgressBarMsgAttributes( 0, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK ); 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 ); sprintf( str, "%c%d", gsSelSectorY + 'A' - 1, gsSelSectorX );
EvaluateWorld( str, (UINT8)giCurrLevel ); EvaluateWorld( str, (UINT8)giCurrLevel );
@@ -3252,220 +3209,6 @@ void ApologizeOverrideAndForceUpdateEverything()
gusNumberOfMapsToBeForceUpdated = 0; 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) void SetupItemDetailsMode(BOOLEAN fAllowRecursion)
{ {
UINT32 uiNumItems, uiFileSize, uiBytesRead; UINT32 uiNumItems, uiFileSize, uiBytesRead;
@@ -3630,7 +3373,6 @@ L01:
} }
} }
} }
#endif
UINT8 GetCurrentSummaryVersion() UINT8 GetCurrentSummaryVersion()
{ {
-218
View File
@@ -2090,22 +2090,7 @@ void HandleKeyboardShortcuts( )
// item left scroll // item left scroll
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) 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); ScrollEditorItemsInfo(FALSE);
#endif
} }
else else
{ {
@@ -2120,21 +2105,7 @@ void HandleKeyboardShortcuts( )
// item right scroll // item right scroll
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) 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); ScrollEditorItemsInfo(TRUE);
#endif
} }
else else
{ {
@@ -2149,22 +2120,7 @@ void HandleKeyboardShortcuts( )
// item left scroll by page // item left scroll by page
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) 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); ScrollEditorItemsInfo(FALSE);
#endif
} }
//gfRenderTaskbar = TRUE; //gfRenderTaskbar = TRUE;
break; break;
@@ -2172,21 +2128,7 @@ void HandleKeyboardShortcuts( )
// item right scroll by page // item right scroll by page
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) 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); ScrollEditorItemsInfo(TRUE);
#endif
} }
//gfRenderTaskbar = TRUE; //gfRenderTaskbar = TRUE;
break; 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. // Returns TRUE if deleted the light, otherwise, returns FALSE.
// i.e. FALSE is not an error condition! // 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) BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType)
{ {
INT32 iCount, iMapIndex; INT32 iCount, iMapIndex;
@@ -3340,7 +3223,6 @@ BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType)
RemoveAllObjectsOfTypeRange(iMapIndex, GOODRING, GOODRING); RemoveAllObjectsOfTypeRange(iMapIndex, GOODRING, GOODRING);
return(fRemovedLight); return(fRemovedLight);
} }
#endif
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
// ShowLightPositionHandles // ShowLightPositionHandles
@@ -3473,79 +3355,6 @@ BOOLEAN CheckForSlantRoofs( void )
// //
void MapOptimize(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) if(iLastMapIndexRB != iMapIndex && iLastMapIndexRB == -1)
iLastMapIndexRB = iMapIndex; iLastMapIndexRB = iMapIndex;
#if 0
gfRenderWorld = TRUE;
switch(iDrawMode)
{
default:
gfRenderWorld = fPrevState;
break;
}
#endif
} }
else if(_MiddleButtonDown) else if(_MiddleButtonDown)
{ {
if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1) if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1)
iLastMapIndexMB = iMapIndex; iLastMapIndexMB = iMapIndex;
#if 0
gfRenderWorld = TRUE;
switch(iDrawMode)
{
default:
gfRenderWorld = fPrevState;
break;
}
#endif
} }
else if(!_LeftButtonDown) else if(!_LeftButtonDown)
{ {
@@ -4192,15 +3983,6 @@ void HandleMouseClicksInGameScreen()//dnl ch80 011213
{ {
if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile
{ {
#if 0
gfRenderWorld = TRUE;
switch(iDrawMode)
{
default:
gfRenderWorld = fPrevState;
break;
}
#endif
} }
iLastMapIndexMB = -1; iLastMapIndexMB = -1;
} }
-5
View File
@@ -1324,13 +1324,8 @@ void GameInitEncyclopediaData_NEW( )
giEncyclopedia_DataBtnImage = BUTTON_NO_IMAGE; giEncyclopedia_DataBtnImage = BUTTON_NO_IMAGE;
memset( giEncyclopedia_DataFilterBtn, BUTTON_NO_SLOT, sizeof(giEncyclopedia_DataFilterBtn) ); memset( giEncyclopedia_DataFilterBtn, BUTTON_NO_SLOT, sizeof(giEncyclopedia_DataFilterBtn) );
giEncyclopedia_DataFilterBtnImage = BUTTON_NO_IMAGE; giEncyclopedia_DataFilterBtnImage = BUTTON_NO_IMAGE;
#if 0//debug
memset( gbEncyclopediaData_ItemVisible, ENC_ITEM_DISCOVERED_NOT_REACHABLE, sizeof(gbEncyclopediaData_ItemVisible) );
gbEncyclopediaData_ItemVisible[1] = ENC_ITEM_NOT_DISCOVERED;
#else
if( guiCurrentScreen == MAINMENU_SCREEN ) if( guiCurrentScreen == MAINMENU_SCREEN )
EncyclopediaInitItemsVisibility(); EncyclopediaInitItemsVisibility();
#endif
// do following only once at start of JA2 // do following only once at start of JA2
CHECKV( guiCurrentScreen == 0 ); CHECKV( guiCurrentScreen == 0 );
//prepare indexes for subfilter texts defined in _LanguageText.cpp, assuming there are blank separators between filter button texts ("1", "2", "3", "", "1", "", "1", "2", "3", "4") //prepare indexes for subfilter texts defined in _LanguageText.cpp, assuming there are blank separators between filter button texts ("1", "2", "3", "", "1", "", "1", "2", "3", "4")
-97
View File
@@ -38,11 +38,7 @@
#include "vobject.h"//video objects #include "vobject.h"//video objects
#include "Utils/Cursors.h" #include "Utils/Cursors.h"
#include "Text.h"//button text #include "Text.h"//button text
#ifdef ENC_USE_BUTTONSYSTEM
#include "Button System.h" #include "Button System.h"
#else
#include "WordWrap.h"//centered text
#endif
#include "Encyclopedia_new.h" #include "Encyclopedia_new.h"
//#include "Encrypted File.h" //#include "Encrypted File.h"
//#include "Soldier Profile.h" //#include "Soldier Profile.h"
@@ -68,13 +64,8 @@ UINT32 guiEncyclopediaAimLogo;
///@} ///@}
///@{ buttons, graphics and regions for main page ///@{ buttons, graphics and regions for main page
#ifdef ENC_USE_BUTTONSYSTEM
INT32 giEncyclopediaBtn[ ENC_NUM_SUBPAGES ]; INT32 giEncyclopediaBtn[ ENC_NUM_SUBPAGES ];
INT32 giEncyclopediaBtnImage; INT32 giEncyclopediaBtnImage;
#else
MOUSE_REGION gEncyclopediaBtnRegions[ ENC_NUM_SUBPAGES ];
UINT32 guiEncyclopediaBtnImage;
#endif
#define ENC_BTN_GAP 6 #define ENC_BTN_GAP 6
#define ENC_AIMLOGO_GAP_TOP 20 #define ENC_AIMLOGO_GAP_TOP 20
#define ENC_AIMLOGO_GAP_BOTTOM 40 #define ENC_AIMLOGO_GAP_BOTTOM 40
@@ -85,11 +76,7 @@ ENC_SUBPAGE_T geENC_SubPage; ///< Current sub page
/////// ///////
//prototypes //prototypes
#ifdef ENC_USE_BUTTONSYSTEM
void BtnEncyclopedia_newSelectDataPageBtnCallBack ( GUI_BUTTON *btn, INT32 reason ); void BtnEncyclopedia_newSelectDataPageBtnCallBack ( GUI_BUTTON *btn, INT32 reason );
#else
void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason );
#endif
/////// ///////
//functions //functions
@@ -108,11 +95,8 @@ void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, IN
void GameInitEncyclopedia_NEW() void GameInitEncyclopedia_NEW()
{ {
// initialize gui handles // initialize gui handles
#ifdef ENC_USE_BUTTONSYSTEM
memset( giEncyclopediaBtn, BUTTON_NO_SLOT, sizeof(giEncyclopediaBtn) ); memset( giEncyclopediaBtn, BUTTON_NO_SLOT, sizeof(giEncyclopediaBtn) );
giEncyclopediaBtnImage = BUTTON_NO_IMAGE; giEncyclopediaBtnImage = BUTTON_NO_IMAGE;
#else
#endif
// check for files only on start of JA2 // check for files only on start of JA2
CHECKV( guiCurrentScreen == 0 && gGameExternalOptions.gEncyclopedia ); CHECKV( guiCurrentScreen == 0 && gGameExternalOptions.gEncyclopedia );
@@ -178,7 +162,6 @@ BOOLEAN EnterEncyclopedia_NEW( )
CHECKF(hVObject);CHECKF(hVObject->pETRLEObject); CHECKF(hVObject);CHECKF(hVObject->pETRLEObject);
logoBottomY = hVObject->pETRLEObject->usHeight + LAPTOP_SCREEN_WEB_UL_Y + ENC_AIMLOGO_GAP_TOP; logoBottomY = hVObject->pETRLEObject->usHeight + LAPTOP_SCREEN_WEB_UL_Y + ENC_AIMLOGO_GAP_TOP;
#ifdef ENC_USE_BUTTONSYSTEM//use button system
////// //////
// load button graphic for the data pages // load button graphic for the data pages
giEncyclopediaBtnImage = LoadButtonImage( "ENCYCLOPEDIA\\CONTENTBUTTON.STI", BUTTON_NO_IMAGE, 0, BUTTON_NO_IMAGE , 0, BUTTON_NO_IMAGE ); giEncyclopediaBtnImage = LoadButtonImage( "ENCYCLOPEDIA\\CONTENTBUTTON.STI", BUTTON_NO_IMAGE, 0, BUTTON_NO_IMAGE , 0, BUTTON_NO_IMAGE );
@@ -202,34 +185,6 @@ BOOLEAN EnterEncyclopedia_NEW( )
GetButtonPtr( giEncyclopediaBtn[ i ] )->fShiftImage = TRUE; GetButtonPtr( giEncyclopediaBtn[ i ] )->fShiftImage = TRUE;
//SpecifyButtonSoundScheme( giEncyclopediaDataBtn[ i ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); //SpecifyButtonSoundScheme( giEncyclopediaDataBtn[ i ], BUTTON_SOUND_SCHEME_BIGSWITCH3 );
} }
#else
//////
// load button graphic for the data pages
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP( "ENCYCLOPEDIA\\CONTENTBUTTON.STI", VObjectDesc.ImageFile );
CHECKF( AddVideoObject( &VObjectDesc, &guiEncyclopediaBtnImage ) );
//////
// create mouse regions for data buttons and set user data
GetVideoObject( &hVObject, guiEncyclopediaBtnImage );
CHECKF(hVObject);CHECKF(hVObject->pETRLEObject);
buttonSizeX = hVObject->pETRLEObject->usWidth;//get width of buttons from image
buttonSizeY = hVObject->pETRLEObject->usHeight;//get heigth of buttons from image
for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ )
{
MSYS_DefineRegion( &gEncyclopediaBtnRegions[i],
LAPTOP_SCREEN_UL_X + (LAPTOP_SCREEN_WIDTH)/2 - buttonSizeX/2,//upper left x: center of laptop screen - 1/2 buttonsize
logoBottomY + ENC_AIMLOGO_GAP_BOTTOM + i * (ENC_BTN_GAP + buttonSizeY),//upper left y: below logo + logo gap + previous buttons and button gaps
LAPTOP_SCREEN_UL_X + (LAPTOP_SCREEN_WIDTH)/2 + buttonSizeX/2,//lower right x: center of laptop screen + 1/2 buttonsize
logoBottomY + ENC_AIMLOGO_GAP_BOTTOM + buttonSizeY + i * (ENC_BTN_GAP + buttonSizeY),//lower right y: below logo + logo gap + button height + previous buttons and button gaps
MSYS_PRIORITY_HIGH,//priority
CURSOR_WWW,//cursor
MSYS_NO_CALLBACK,//moveCB
BtnEncyclopedia_newSelectDataPageRegionCallBack);
MSYS_SetRegionUserData( &gEncyclopediaBtnRegions[i], 0, i + 1 );
CHECKF( MSYS_AddRegion( &gEncyclopediaBtnRegions[i] ) );
}
#endif
return TRUE; return TRUE;
} }
@@ -252,7 +207,6 @@ BOOLEAN ExitEncyclopedia_NEW( )
// destroy AIM logo // destroy AIM logo
success &= DeleteVideoObjectFromIndex( guiEncyclopediaAimLogo ); success &= DeleteVideoObjectFromIndex( guiEncyclopediaAimLogo );
#ifdef ENC_USE_BUTTONSYSTEM//use button system
// destroy buttons // destroy buttons
for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ ) for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ )
if ( giEncyclopediaBtn[ i ] != BUTTON_NO_SLOT ) if ( giEncyclopediaBtn[ i ] != BUTTON_NO_SLOT )
@@ -270,13 +224,6 @@ BOOLEAN ExitEncyclopedia_NEW( )
} }
else else
success = FALSE; success = FALSE;
#else
// destroy button graphic
success &= DeleteVideoObjectFromIndex( guiEncyclopediaBtnImage );
// destroy mouseregions for buttons
for (UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++)
MSYS_RemoveRegion( &gEncyclopediaBtnRegions[i] );
#endif
return success; return success;
} }
@@ -303,20 +250,7 @@ void RenderEncyclopedia_NEW( )
CHECKV( BltVideoObjectFromIndex( FRAME_BUFFER, guiEncyclopediaAimLogo, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ) ); CHECKV( BltVideoObjectFromIndex( FRAME_BUFFER, guiEncyclopediaAimLogo, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ) );
// render Buttons for Data pages // render Buttons for Data pages
#ifdef ENC_USE_BUTTONSYSTEM
RenderButtons(); RenderButtons();
#else
for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ )
{
x = gEncyclopediaBtnRegions[ i ].RegionTopLeftX;
y = gEncyclopediaBtnRegions[ i ].RegionTopLeftY;
//Btn graphic
CHECKV( BltVideoObjectFromIndex( FRAME_BUFFER, guiEncyclopediaBtnImage, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ) );
//Btn text
y += (gEncyclopediaBtnRegions[ i ].RegionBottomRightY - y)/2 - GetFontHeight( FONT12ARIAL )/2;
DrawTextToScreen( pMenuStrings[ i ], x, y, (UINT16)gEncyclopediaBtnRegions[ i ].RegionBottomRightX - x, FONT12ARIAL, FONT_FCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
}
#endif
// finish render // finish render
CHECKV ( RenderWWWProgramTitleBar() ); CHECKV ( RenderWWWProgramTitleBar() );
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
@@ -401,7 +335,6 @@ void ChangingEncyclopediaSubPage( UINT8 ubSubPageNumber )
////////////// //////////////
//Callback functions //Callback functions
#ifdef ENC_USE_BUTTONSYSTEM//use button system
void BtnEncyclopedia_newSelectDataPageBtnCallBack( GUI_BUTTON *btn, INT32 reason ) void BtnEncyclopedia_newSelectDataPageBtnCallBack( GUI_BUTTON *btn, INT32 reason )
{ {
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
@@ -430,35 +363,5 @@ void BtnEncyclopedia_newSelectDataPageBtnCallBack( GUI_BUTTON *btn, INT32 reason
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
} }
} }
#else
/**
* @brief Callback for data page buttons.
* Userdata at index 0 is used to determine which button is pressed.
*/
void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
{
CHECKV( gGameExternalOptions.gEncyclopedia );
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
UINT8 selectedButton = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
if( selectedButton == 0 )
{
guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA;
}
else if( selectedButton > 0 && selectedButton <= ENC_NUM_SUBPAGES )
{
ChangingEncyclopediaSubPage ( selectedButton );
guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA_DATA;
}
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
#endif
#endif #endif
-4
View File
@@ -277,12 +277,8 @@ extern "C" {
#define DXDEF __declspec(dllexport) #define DXDEF __declspec(dllexport)
#else #else
#if 1 /*def __BORLANDC__*/
#define DXDEC extern #define DXDEC extern
#define DXDEF #define DXDEF
#else
#define DXDEC __declspec(dllimport)
#endif
#endif #endif
-147
View File
@@ -179,62 +179,6 @@ bool IndexedSTIImage::addImage(UINT8 *data, UINT32 data_size, UINT32 image_width
return true; 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) void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
{ {
#if 1
hImage->pETRLEObject = (ETRLEObject*)MemAlloc(1 * sizeof(ETRLEObject)); hImage->pETRLEObject = (ETRLEObject*)MemAlloc(1 * sizeof(ETRLEObject));
if(!hImage->pETRLEObject) if(!hImage->pETRLEObject)
{ {
@@ -908,37 +851,6 @@ void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
} }
hImage->fFlags |= IMAGE_BITMAPDATA; 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" ); SGP_THROW_IFFALSE( etrle_size > 0, L"ETRLE compression of PNG image failed" );
subim.sOffsetX = subimage.sOffsetX; subim.sOffsetX = subimage.sOffsetX;
subim.sOffsetY = subimage.sOffsetY; 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 = compressed_size;
subimage.uiDataLength = etrle_size; subimage.uiDataLength = etrle_size;
subimage.uiDataOffset = 0; subimage.uiDataOffset = 0;
-81
View File
@@ -129,86 +129,6 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::Test
CHAR8 ExtensionSep[] = "."; CHAR8 ExtensionSep[] = ".";
UINT32 iFileLoader; 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); std::string filename(ImageFile);
iFileLoader = ImageFileType::getFileReaderType(filename, order); iFileLoader = ImageFileType::getFileReaderType(filename, order);
if ( iFileLoader == UNKNOWN_FILE_READER ) if ( iFileLoader == UNKNOWN_FILE_READER )
@@ -222,7 +142,6 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::Test
return( NULL ); return( NULL );
} }
#endif
// Create memory for image structure // Create memory for image structure
hImage = (HIMAGE)MemAlloc( sizeof( image_type ) ); 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; 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 ); return( TRUE );
-19
View File
@@ -1609,25 +1609,6 @@ BOOLEAN IsCursorRestricted( void )
void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos ) 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: // 0verhaul:
// The above is a bad hack. Especially in windowed mode. We don't want coords relative to the entire screen in that case. // 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. // 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); int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
#if USE_CONSOLE
Console g_Console("", "", "Lua Console", "no");
#endif
#ifdef USE_VFS #ifdef USE_VFS
@@ -394,15 +391,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
if (wParam == '\\' && if (wParam == '\\' &&
lParam && KF_ALTDOWN) 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); 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 // 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... // An MSVC compliance issue...
//using std::toupper; //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 *p1 = s1.c_str();
const char *p2 = s2.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; if (!*p2) return false;
return toupper(*p1) < toupper(*p2); return toupper(*p1) < toupper(*p2);
#endif
} }
-37
View File
@@ -1493,13 +1493,6 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
#endif #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++ ) for ( cnt = 0; cnt < usNumStrips; cnt++ )
{ {
@@ -1596,28 +1589,6 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr
ExecuteVideoOverlaysToAlternateBuffer( BACKBUFFER ); 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) // 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) if (gfForceFullScreenRefresh == TRUE)
{ {
// //
-8
View File
@@ -922,18 +922,10 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
case 32: case 32:
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images"); SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
image = &hSrcVObject->p16BPPObject[usIndex]; 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, Blt32BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
(UINT32*)image->p16BPPData, image->usWidth * sizeof(UINT32), (UINT32*)image->p16BPPData, image->usWidth * sizeof(UINT32),
iDestX, iDestY, iDestX, iDestY,
0, 0, image->usWidth, image->usHeight); 0, 0, image->usWidth, image->usHeight);
#endif
break; break;
case 16: case 16:
@@ -224,7 +224,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc
//alpha = 255; //alpha = 255;
if(alpha > 0) if(alpha > 0)
{ {
#if 1
// the darker shade // the darker shade
tmpVal = ShadeTable[*pDstPtr]; tmpVal = ShadeTable[*pDstPtr];
@@ -249,9 +248,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc
newcolor = FROMRGB(red,green,blue); newcolor = FROMRGB(red,green,blue);
*pDstPtr = Get16BPPColor(newcolor); *pDstPtr = Get16BPPColor(newcolor);
#else
*pDstPtr = ShadeTable[*pDstPtr];
#endif
} }
pSrcPtr++; pSrcPtr++;
pDstPtr++; pDstPtr++;
@@ -7258,7 +7254,6 @@ BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UI
pDestPtr = (UINT16*)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2)); pDestPtr = (UINT16*)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
uiLineSkipDest = uiDestPitch - (uiWidth*2); uiLineSkipDest = uiDestPitch - (uiWidth*2);
uiLineSkipSrc = uiSrcPitch - (uiWidth*2); uiLineSkipSrc = uiSrcPitch - (uiWidth*2);
#if 1
do do
{ {
UINT32 w = uiWidth; UINT32 w = uiWidth;
@@ -7273,36 +7268,6 @@ BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UI
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest); pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
} }
while (--uiHeight != 0); 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); return(TRUE);
} }
@@ -7318,7 +7283,6 @@ BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pS
pDestPtr = (UINT16*)((UINT8 *)pDest + (iDestYPos * uiDestPitch) + (iDestXPos * 2)); pDestPtr = (UINT16*)((UINT8 *)pDest + (iDestYPos * uiDestPitch) + (iDestXPos * 2));
uiLineSkipDest = uiDestPitch - (uiWidth * 2); uiLineSkipDest = uiDestPitch - (uiWidth * 2);
uiLineSkipSrc = uiSrcPitch - (uiWidth * 2); uiLineSkipSrc = uiSrcPitch - (uiWidth * 2);
#if 1
do do
{ {
UINT32 w = uiWidth; UINT32 w = uiWidth;
@@ -7336,7 +7300,6 @@ BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pS
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest); pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
} }
while (--uiHeight != 0); while (--uiHeight != 0);
#endif
return TRUE; 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
/********************************************************************************************** /**********************************************************************************************
-11
View File
@@ -2205,17 +2205,6 @@ void CreateAutoResolveInterface()
ubGreenMilitia += bonusGreenMilitia; ubGreenMilitia += bonusGreenMilitia;
// This block should be unnecessary. If the counts do not line up, there is a bug. // This block should be unnecessary. If the counts do not line up, there is a bug.
#if 0
while( ubEliteMilitia + ubRegMilitia + ubGreenMilitia < gpAR->ubCivs )
{
switch( PreRandom( 3 ) )
{
case 0: ubEliteMilitia++; break;
case 1: ubRegMilitia++; break;
case 2: ubGreenMilitia++; break;
}
}
#endif
cnt = 0; cnt = 0;
// Add the militia in this sector // Add the militia in this sector
-11
View File
@@ -102,17 +102,6 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
BOOLEAN bMercDayOne = FALSE; BOOLEAN bMercDayOne = FALSE;
// BF : file access is bad, especially if a function is called so often. // BF : file access is bad, especially if a function is called so often.
#if 0
// Kaiden: Opening the INI File
CIniReader iniReader("..\\Ja2_Options.ini");
if(is_networked) memset(&iniReader, 0, sizeof (CIniReader) );//disable ini in mp (taking default values)
//Kaiden: Getting Value for MERC Available on Day one?
// for some reason, this can't be in gamesettings.cpp
// or it won't work.
bMercDayOne = iniReader.ReadBoolean("Options","MERC_DAY_ONE",FALSE);
#endif
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent"); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent");
if( gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents && _KeyDown( NUM_LOCK ) ) if( gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents && _KeyDown( NUM_LOCK ) )
-30
View File
@@ -12786,22 +12786,7 @@ static bool locationStringToCoordinates_AltSector(std::string loc, UINT8* x, UIN
} }
// gather column // gather column
#if 0
loc = loc.substr(1);
stringstream ss = stringstream();
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
#else
stringstream ss(loc.substr(1)); stringstream ss(loc.substr(1));
#endif
int col = 0; int col = 0;
ss >> col; ss >> col;
if (col >= 1 && col <= 16) if (col >= 1 && col <= 16)
@@ -12840,22 +12825,7 @@ static bool locationStringToCoordinates(std::string loc, UINT8* x, UINT8* y, UIN
} }
// gather column // gather column
#if 0
loc = loc.substr(1);
stringstream ss = stringstream();
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
#else
stringstream ss(loc); stringstream ss(loc);
#endif
int col = 0; int col = 0;
ss >> col; ss >> col;
if (col >= 1 && col <= 16) if (col >= 1 && col <= 16)
@@ -1091,24 +1091,8 @@ void SaveSeenAndUnseenItems( void )
//make list of seen items //make list of seen items
for ( UINT32 i = 0; i < pInventoryPoolList.size(); i++ ) for ( UINT32 i = 0; i < pInventoryPoolList.size(); i++ )
{ {
#if 0
if ( pInventoryPoolList[ i ].object.exists() )
{
pInventoryPoolList[ i ].fExists = TRUE;
pInventoryPoolList[ i ].bVisible = TRUE;
//Check
if(TileIsOutOfBounds( pInventoryPoolList[ i ].sGridNo) && !( pInventoryPoolList[ i ].usFlags & WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT ) )
{
pInventoryPoolList[ i ].usFlags |= WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT;
// Display warning.....
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Error: Trying to add item ( %d: %s ) to invalid gridno in unloaded sector. Please Report.", pInventoryPoolList[ i ].object.usItem, ItemNames[ pInventoryPoolList[ i ].object.usItem] );
}
#else
if ( pInventoryPoolList[i].fExists ) if ( pInventoryPoolList[i].fExists )
{ {
#endif
worldItemsSaveList.push_back(pInventoryPoolList[i]); worldItemsSaveList.push_back(pInventoryPoolList[i]);
iExistingItems++; iExistingItems++;
} }
@@ -3625,45 +3609,6 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot )
{ {
SOLDIERTYPE *pSoldier = NULL; SOLDIERTYPE *pSoldier = NULL;
static BOOLEAN fItemWasHighLighted = FALSE; static BOOLEAN fItemWasHighLighted = FALSE;
#if 0
if( iCurrentSlot == -1 )
{
giCompatibleItemBaseTime = 0;
}
if( fChangedInventorySlots == TRUE )
{
giCompatibleItemBaseTime = 0;
fChangedInventorySlots = FALSE;
}
// reset the base time to the current game clock
if( giCompatibleItemBaseTime == 0 )
{
giCompatibleItemBaseTime = GetJA2Clock( );
if( fItemWasHighLighted == TRUE )
{
fTeamPanelDirty = TRUE;
fMapPanelDirty = TRUE;
fItemWasHighLighted = FALSE;
}
}
ResetCompatibleItemArray( );
ResetMapSectorInventoryPoolHighLights( );
if( iCurrentSlot == -1 )
{
return;
}
// Check also that we're not beyond the resize.
if (pInventoryPoolList.size() < (UINT32)(iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) ))
{
return;
}
#else
//if same slot then before dont recalculate //if same slot then before dont recalculate
if ( !fChangedInventorySlots ) return; if ( !fChangedInventorySlots ) return;
@@ -3689,36 +3634,10 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot )
} }
return; return;
} }
#endif
// given this slot value, check if anything in the displayed sector inventory or on the mercs inventory is compatable // given this slot value, check if anything in the displayed sector inventory or on the mercs inventory is compatable
if( fShowInventoryFlag ) if( fShowInventoryFlag )
{ {
#if 0
// check if any compatable items in the soldier inventory matches with this item
if( gfCheckForCursorOverMapSectorInventoryItem )
{
pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ];
if( pSoldier )
{
if( HandleCompatibleAmmoUIForMapScreen( pSoldier, iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ), TRUE, FALSE ) )
{
if( GetJA2Clock( ) - giCompatibleItemBaseTime > 100 )
{
if( fItemWasHighLighted == FALSE )
{
fTeamPanelDirty = TRUE;
fItemWasHighLighted = TRUE;
}
}
}
}
}
else
{
giCompatibleItemBaseTime = 0;
}
#else
//Soldier inventory is shown, highlight those items //Soldier inventory is shown, highlight those items
pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ];
if( pSoldier ) if( pSoldier )
@@ -3729,40 +3648,17 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot )
} }
fTeamPanelDirty = TRUE; fTeamPanelDirty = TRUE;
} }
#endif
} }
// now handle for the sector inventory // now handle for the sector inventory
if( fShowMapInventoryPool ) if( fShowMapInventoryPool )
{ {
#if 0
// check if any compatable items in the soldier inventory matches with this item
if( gfCheckForCursorOverMapSectorInventoryItem )
{
if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) )
{
if( GetJA2Clock( ) - giCompatibleItemBaseTime > 100 )
{
if( fItemWasHighLighted == FALSE )
{
fItemWasHighLighted = TRUE;
fMapPanelDirty = TRUE;
}
}
}
}
else
{
giCompatibleItemBaseTime = 0;
}
#else
if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) ) if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) )
{ {
fItemWasHighLighted = TRUE;//remember that something is highlighted fItemWasHighLighted = TRUE;//remember that something is highlighted
} }
fMapPanelDirty = TRUE; fMapPanelDirty = TRUE;
#endif
} }
fChangedInventorySlots = FALSE; fChangedInventorySlots = FALSE;
@@ -3870,79 +3766,11 @@ void CheckGridNoOfItemsInMapScreenMapInventory()
void SortSectorInventory( std::vector<WORLDITEM>& pInventory, UINT32 uiSizeOfArray ) void SortSectorInventory( std::vector<WORLDITEM>& pInventory, UINT32 uiSizeOfArray )
{ {
#if 0//dnl ch75 011113 return code from v1.12 as current one is terrible slow
//first, compress the inventory by stacking like items that are reachable, while moving empty items towards the back
for (std::vector<WORLDITEM>::iterator iter = pInventory.begin(); iter != pInventory.end(); ++iter) {
//if object exists, we want to try to stack it
if (iter->fExists && iter->object.exists() == true) {
//ADB TODO if it is active and reachable etc, alternatively if it's on the same gridNo
#if 0
if (iter->object.ubNumberOfObjects < ItemSlotLimit( iter->object.usItem, STACK_SIZE_LIMIT )) {
std::vector<WORLDITEM>::iterator second = iter;
for (++second; second != pInventory.end(); ++second) {
if (second->object.usItem == iter->object.usItem
&& second->object.exists() == true) {
iter->object.AddObjectsToStack(second->object, second->object.ubNumberOfObjects);
if (iter->object.ubNumberOfObjects >= ItemSlotLimit( iter->object.usItem, STACK_SIZE_LIMIT )) {
break;
}
}
}
}
#endif
}
else {
//object does not exist, so compress the list
std::vector<WORLDITEM>::iterator second = iter;
for (++second; second != pInventory.end(); ++second) {
if (second->fExists && second->object.exists() == true) {
*iter = *second;
second->initialize();
break;
}
}
if (second == pInventory.end()) {
//we reached the end of the list without finding any active item, so we can break out of this loop too!
break;
}
}
}
//once compressed, we need only sort the existing items
//all empty items should be at the back!!!
std::vector<WORLDITEM>::iterator endSort = pInventory.begin();
for (unsigned int x = 1; x < pInventory.size(); ++x) {
if (pInventory[x].fExists && pInventory[x].object.exists() == true) {
++endSort;
}
else {
break;
}
}
++endSort;
//ADB I'm not sure qsort will work with OO data, so replace it with stl sort, which is faster anyways
std::sort(pInventory.begin(), endSort);
//then compress it by removing the empty objects, we know they are at the back
//we want the size to equal x * MAP_INVENTORY_POOL_SLOT_COUNT
for (unsigned int x = 1; x <= pInventory.size() / MAP_INVENTORY_POOL_SLOT_COUNT && pInventory.size() > x * MAP_INVENTORY_POOL_SLOT_COUNT; ++x) {
if (pInventory[x * MAP_INVENTORY_POOL_SLOT_COUNT].fExists == false
&& pInventory[x * MAP_INVENTORY_POOL_SLOT_COUNT].object.exists() == false) {
//we have found a page where the first item on the page does not exist, resize to this
//we may have just cut off a blank page leaving the previous page full with no place to put
//any new objects, but ResizeInventoryList after this will take care of that.
pInventory.resize(x * MAP_INVENTORY_POOL_SLOT_COUNT);
}
}
#else
#if _ITERATOR_DEBUG_LEVEL > 1//dnl ch75 061113 under debug VS2010 throws exceptions after qsort but not under VS2005 and VS2008, all release version seems to work fine #if _ITERATOR_DEBUG_LEVEL > 1//dnl ch75 061113 under debug VS2010 throws exceptions after qsort but not under VS2005 and VS2008, all release version seems to work fine
std::sort(pInventory.begin(), pInventory.begin() + uiSizeOfArray); std::sort(pInventory.begin(), pInventory.begin() + uiSizeOfArray);
#else #else
qsort((LPVOID)&pInventory.front(), (size_t)uiSizeOfArray, sizeof(WORLDITEM), MapScreenSectorInventoryCompare); qsort((LPVOID)&pInventory.front(), (size_t)uiSizeOfArray, sizeof(WORLDITEM), MapScreenSectorInventoryCompare);
#endif #endif
#endif
} }
INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2) INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
@@ -3955,31 +3783,10 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
UINT16 ubItem2Quality; UINT16 ubItem2Quality;
//dnl ch75 071113 without below fix sort will create mess when use empty slots because fExists remain TRUE after item is removed from inventory so decide to rather check ubNumberOfObjects //dnl ch75 071113 without below fix sort will create mess when use empty slots because fExists remain TRUE after item is removed from inventory so decide to rather check ubNumberOfObjects
#if 0
if(!(pFirst->fExists && pFirst->object.ubNumberOfObjects && pFirst->object.usItem) && (pFirst->fExists | pFirst->object.ubNumberOfObjects | pFirst->object.usItem))
{
pFirst->fExists = FALSE;
pFirst->object.ubNumberOfObjects = 0;
pFirst->object.usItem = NONE;
return(1);
}
if(!(pSecond->fExists && pSecond->object.ubNumberOfObjects && pSecond->object.usItem) && (pSecond->fExists | pSecond->object.ubNumberOfObjects | pSecond->object.usItem))
{
pSecond->fExists = FALSE;
pSecond->object.ubNumberOfObjects = 0;
pSecond->object.usItem = NONE;
return(-1);
}
if(!pFirst->fExists)
return(1);
if(!pSecond->fExists)
return(-1);
#else
if(!pFirst->object.ubNumberOfObjects) if(!pFirst->object.ubNumberOfObjects)
return(1); return(1);
if(!pSecond->object.ubNumberOfObjects) if(!pSecond->object.ubNumberOfObjects)
return(-1); return(-1);
#endif
usItem1Index = pFirst->object.usItem; usItem1Index = pFirst->object.usItem;
usItem2Index = pSecond->object.usItem; usItem2Index = pSecond->object.usItem;
@@ -4157,20 +3964,7 @@ BOOLEAN SortInventoryPoolQ(void)
{ {
if(pInventoryPoolList.size() > 0) if(pInventoryPoolList.size() > 0)
{ {
#if 0//dnl ch75 311013
for(INT32 iSlotCounter=0; iSlotCounter<(INT32)pInventoryPoolList.size(); iSlotCounter++)
if(pInventoryPoolList[iSlotCounter].object.usItem == NOTHING && pInventoryPoolList[iSlotCounter].object.exists() == false)
{
pInventoryPoolList[iSlotCounter].fExists = FALSE;
pInventoryPoolList[iSlotCounter].bVisible = FALSE;
}
SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size()); SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size());
iLastInventoryPoolPage = (pInventoryPoolList.size() - 1) / MAP_INVENTORY_POOL_SLOT_COUNT;
if(iCurrentInventoryPoolPage > iLastInventoryPoolPage)
iCurrentInventoryPoolPage = iLastInventoryPoolPage;
#else
SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size());
#endif
} }
fMapPanelDirty = TRUE; fMapPanelDirty = TRUE;
return(TRUE); return(TRUE);
@@ -6227,9 +6021,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ... FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ...
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", guntemperature, newguntemperature );
#endif
(*itemStack)[i]->data.bTemperature = newguntemperature; // ... set new temperature (*itemStack)[i]->data.bTemperature = newguntemperature; // ... set new temperature
@@ -6247,9 +6038,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
(*iter)[i]->data.bTemperature = newtemperature; // ... set new temperature (*iter)[i]->data.bTemperature = newtemperature; // ... set new temperature
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", temperature, newtemperature );
#endif
// we assume that there can exist only 1 underbarrel weapon per gun // we assume that there can exist only 1 underbarrel weapon per gun
break; break;
-36
View File
@@ -1373,42 +1373,6 @@ BOOLEAN HandleFiredDeadMerc( SOLDIERTYPE *pSoldier )
{ {
AddCharacterToDeadList( pSoldier ); AddCharacterToDeadList( pSoldier );
#if 0
//if the dead merc is in the current sector
if( pSoldier->sSectorX == gWorldSectorX &&
pSoldier->sSectorY == gWorldSectorY &&
pSoldier->bSectorZ == gbWorldSectorZ )
{
TurnSoldierIntoCorpse( pSoldier, FALSE, FALSE );
}
else
{
ROTTING_CORPSE_DEFINITION Corpse;
// Setup some values!
Corpse.ubBodyType = pSoldier->ubBodyType;
Corpse.sGridNo = pSoldier->sInsertionGridNo;
Corpse.dXPos = pSoldier->dXPos;
Corpse.dYPos = pSoldier->dYPos;
Corpse.sHeightAdjustment = pSoldier->sHeightAdjustment;
SET_PALETTEREP_ID ( Corpse.HeadPal, pSoldier->HeadPal );
SET_PALETTEREP_ID ( Corpse.VestPal, pSoldier->VestPal );
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
Corpse.bDirection = pSoldier->ubDirection;
// Set time of death
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
// Set type
Corpse.ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ];
//Add the rotting corpse info to the sectors unloaded rotting corpse file
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, &Corpse);
}
#endif
return( TRUE ); return( TRUE );
} }
-6
View File
@@ -1596,9 +1596,7 @@ void CheckForQuests( UINT32 uiDay )
{ {
// This function gets called at 8:00 AM time of the day // This function gets called at 8:00 AM time of the day
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay ); ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay );
#endif
#ifdef JA2UB #ifdef JA2UB
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@@ -1609,9 +1607,7 @@ void CheckForQuests( UINT32 uiDay )
if( gubQuest[ QUEST_DESTROY_MISSLES ] == QUESTNOTSTARTED ) if( gubQuest[ QUEST_DESTROY_MISSLES ] == QUESTNOTSTARTED )
{ {
StartQuest( QUEST_DESTROY_MISSLES, -1, -1 ); StartQuest( QUEST_DESTROY_MISSLES, -1, -1 );
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DESTORY MISSLES quest"); ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DESTORY MISSLES quest");
#endif
} }
//Ja25: No deliver letter quest, dont start it //Ja25: No deliver letter quest, dont start it
#else #else
@@ -1623,11 +1619,9 @@ void CheckForQuests( UINT32 uiDay )
if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED) if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED)
{ {
StartQuest( QUEST_DELIVER_LETTER, -1, -1 ); StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
#ifdef TESTQUESTS
if (!is_networked) if (!is_networked)
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest"); ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
#endif
} }
#endif #endif
// This quest gets turned OFF through conversation with Miguel - when user hands // This quest gets turned OFF through conversation with Miguel - when user hands
-52
View File
@@ -45,58 +45,6 @@ void RemoveNonIntelItems();
UINT8 gubLastSpecialItemAddedAtElement = 255; UINT8 gubLastSpecialItemAddedAtElement = 255;
// Flugente 2012-12-19: merchant data has been externalised - see XML_Merchants.cpp // Flugente 2012-12-19: merchant data has been externalised - see XML_Merchants.cpp
#if 0
// THIS STRUCTURE HAS UNCHANGING INFO THAT DOESN'T GET SAVED/RESTORED/RESET
// TODO: externalize
const ARMS_DEALER_INFO DefaultarmsDealerInfo[ NUM_ARMS_DEALERS ] =
{
//Buying Selling Merc ID# Type Initial Flags
//Price Price Of Cash
//Modifier Modifier Dealer
/* Tony */ { 0.75f, 1.25f, TONY, ARMS_DEALER_BUYS_SELLS, 15000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 15000, 15000, 0, 1, 10, 1, 10, 2, 3, false, false },
/* Franz Hinkle */ { 1.0f, 1.5f, FRANZ, ARMS_DEALER_BUYS_SELLS, 5000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 5000, 5000, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Keith Hemps */ { 0.75f, 1.0f, KEITH, ARMS_DEALER_BUYS_SELLS, 1500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 1500, 1500, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Jake Cameron */ { 0.8f, 1.1f, JAKE, ARMS_DEALER_BUYS_SELLS, 2500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 2500, 2500, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Gabby Mulnick*/ { 1.0f, 1.0f, GABBY, ARMS_DEALER_BUYS_SELLS, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true },
#ifdef JA2UB
/* Devin Connell*/ //ja25 ub Biggins//{ 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE , 5000, 5000, 0, 3, 10, 0, 10, 2, 3, false, false },
#else
/* Devin Connell*/ { 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE , 5000, 5000, 0, 3, 10, 0, 10, 2, 3, false, false },
#endif
/* Howard Filmore*/ { 1.0f, 1.0f, HOWARD, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Sam Rozen */ { 1.0f, 1.0f, SAM, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Frank */ { 1.0f, 1.0f, FRANK, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Bar Bro 1 */ { 1.0f, 1.0f, HERVE, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Bar Bro 2 */ { 1.0f, 1.0f, PETER, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Bar Bro 3 */ { 1.0f, 1.0f, ALBERTO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Bar Bro 4 */ { 1.0f, 1.0f, CARLO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true },
/* Micky O'Brien*/ { 1.0f, 1.4f, MICKY, ARMS_DEALER_BUYS_ONLY, 10000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 10000, 10000, 0, 1, 10, 1, 10, 1, 2, false, true },
//Repair Repair
//Speed Cost
/* Arnie Brunzwell*/{ 0.1f, 0.8f, ARNIE, ARMS_DEALER_REPAIRS, 1500, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1500, 1500, 0, 1, 10, 1, 10, 1, 2, false, true },
/* Fredo */ { 0.6f, 0.6f, FREDO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true },
#ifdef JA2UB
/* Raul */ { 0.80f, 1.8f, PERKO, ARMS_DEALER_BUYS_SELLS, 20000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE , 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true },
#else
/* Perko */ { 1.0f, 0.4f, PERKO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true },
#endif
/* Elgin */ { 1.0f, 1.0f, DRUGGIST, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 1, 10, 1, 2, false, true },
/* Manny */ { 1.0f, 1.0f, MANNY, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 1, 10, 1, 2, false, true },
#ifdef JA2UB
/* Betty */ { 0.75f, 1.25f, 73, ARMS_DEALER_BUYS_SELLS, 10000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE , 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true },
#endif
};
#endif
std::vector<ARMS_DEALER_INFO> armsDealerInfo (NUM_ARMS_DEALERS); std::vector<ARMS_DEALER_INFO> armsDealerInfo (NUM_ARMS_DEALERS);
-29
View File
@@ -10,35 +10,6 @@
SUBSEQUENTSOUNDS subsequentsounds; SUBSEQUENTSOUNDS subsequentsounds;
#if 0
static void AILCALLBACK timer_func( UINT32 user )
{
AudioGapList *pGapList;
pGapList = (AudioGapList*)user;
pGapList->gap_monitor_timer += GAP_TIMER_INTERVAL;
if ( pGapList->audio_gap_active )
{
if ( (pGapList->gap_monitor_timer / 1000) > pGapList->end[ pGapList->gap_monitor_current] )
{
pGapList->audio_gap_active = 0;
pGapList->gap_monitor_current++;
}
}
else
{
if ( pGapList->gap_monitor_current < pGapList->count )
{
if ( ( pGapList->gap_monitor_timer / 1000) >= pGapList->start[ pGapList->gap_monitor_current ])
{
pGapList->audio_gap_active = 1;
}
}
}
}
#endif
void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList ) void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList )
-8
View File
@@ -3920,14 +3920,6 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance )
pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( bNewStance ); pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( bNewStance );
pSoldier->ubDesiredHeight = NO_DESIRED_HEIGHT; pSoldier->ubDesiredHeight = NO_DESIRED_HEIGHT;
#if 0
if ( pSoldier->usUIMovementMode == CRAWLING && gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE )
{
pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = LOCKED_NO_NEWGRIDNO;
pSoldier->pathing.bPathStored = FALSE;
}
else
#endif
{ {
pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = 1; pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = 1;
} }
-44
View File
@@ -2761,19 +2761,6 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe
} }
} }
#if 0
if ( gbInvalidPlacementSlot[ sPocket ] )
{
if ( sPocket != SECONDHANDPOS )
{
// If we are in inv panel and our guy is not = cursor guy...
if ( !gfSMDisableForItems )
{
fHatchItOut = TRUE;
}
}
}
#endif
if (AM_A_ROBOT(pSoldier) && sPocket == HANDPOS) if (AM_A_ROBOT(pSoldier) && sPocket == HANDPOS)
fHatchItOut = FALSE; fHatchItOut = FALSE;
@@ -3808,7 +3795,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
{ {
SetFontBackground( FONT_MCOLOR_BLACK ); SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_DKGRAY ); SetFontForeground( FONT_MCOLOR_DKGRAY );
#if 1
//CHRISL: Moved this condition to the start so that stacked guns will show number in stack //CHRISL: Moved this condition to the start so that stacked guns will show number in stack
if ( ubStatusIndex != RENDER_ITEM_NOSTATUS ) if ( ubStatusIndex != RENDER_ITEM_NOSTATUS )
{ {
@@ -3833,7 +3819,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
gprintfinvalidate( sNewX, sNewY, pStr ); gprintfinvalidate( sNewX, sNewY, pStr );
} }
} }
#endif
if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher ) if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher )
{ {
@@ -3941,35 +3926,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
} }
} }
} }
#if 0
else
{
if ( ubStatusIndex != RENDER_ITEM_NOSTATUS )
{
// Now display # of items
if ( pObject->ubNumberOfObjects > 1 )
{
SetFontForeground( FONT_GRAY4 );
sNewY = sY + sHeight - 10;
swprintf( pStr, L"%d", pObject->ubNumberOfObjects );
// Get length of string
uiStringLength=StringPixLength(pStr, ITEM_FONT );
sNewX = sX + sWidth - uiStringLength - 4;
if ( uiBuffer == guiSAVEBUFFER )
{
RestoreExternBackgroundRect( sNewX, sNewY, 15, 15 );
}
mprintf( sNewX, sNewY, pStr );
gprintfinvalidate( sNewX, sNewY, pStr );
}
}
}
#endif
if ( ItemHasAttachments( pObject, pSoldier, iter ) ) if ( ItemHasAttachments( pObject, pSoldier, iter ) )
{ {
if ( !IsGrenadeLauncherAttached( pObject, iter ) ) if ( !IsGrenadeLauncherAttached( pObject, iter ) )
-6
View File
@@ -594,13 +594,7 @@ LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index)
bool OBJECTTYPE::exists() bool OBJECTTYPE::exists()
{ {
#if 0//dnl ch75 011113
if(this == NULL)
return(FALSE);
return (ubNumberOfObjects > 0 && usItem != NOTHING);
#else
return(this && ubNumberOfObjects && usItem); return(this && ubNumberOfObjects && usItem);
#endif
} }
void OBJECTTYPE::SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter) void OBJECTTYPE::SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter)
-91
View File
@@ -3031,49 +3031,6 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject )
currentSize = __max(iSize + testSize, currentSize); currentSize = __max(iSize + testSize, currentSize);
currentSize = __min(currentSize, maxSize); currentSize = __min(currentSize, maxSize);
} }
#if 0
//old method
UINT16 newSize, testSize, maxSize;
UINT8 cnt=0;
newSize = 0;
maxSize = max(iSize, LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbeFilledSize);
// Look for the ItemSize of the largest item in this LBENODE
for(UINT16 x = 0; x < invsize; ++x)
{
if(pLBE->inv[x].exists() == true)
{
testSize = CalculateItemSize(&(pLBE->inv[x]));
//Now that we have the size of one item, we want to factor in the number of items since two
// items take up more space then one.
testSize = testSize + pLBE->inv[x].ubNumberOfObjects - 1;
testSize = min(testSize,34);
//We also need to increase the size of guns so they'll fit with the rest of our calculations.
if(testSize < 5)
testSize += 10;
if(testSize < 10)
testSize += 18;
//Finally, we want to factor in multiple pockets. We'll do this by counting the number of filled
// pockets, then add this count total to our newSize when everything is finished.
cnt++;
newSize = max(testSize, newSize);
}
}
//Add the total number of filled pockets to our NewSize to account for multiple pockets being used
newSize += cnt;
newSize = min(newSize,34);
// If largest item is smaller then LBE, don't change ItemSize
if(newSize > 0 && newSize < iSize) {
iSize = iSize;
}
// if largest item is larget then LBE but smaller then max size, partially increase ItemSize
else if(newSize >= iSize && newSize < maxSize) {
iSize = newSize;
}
// if largest item is larger then max size, reset ItemSize to max size
else if(newSize >= maxSize) {
iSize = maxSize;
}
#endif
} }
} }
} }
@@ -8458,19 +8415,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
{ {
(*pObj).fFlags |= OBJECT_UNDROPPABLE; (*pObj).fFlags |= OBJECT_UNDROPPABLE;
} }
#if 0//dnl ch74 201013 create default attachments rather at gun status instead of 100%
for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++){
if(Item [ usItem ].defaultattachments[cnt] == 0)
break;
//cannot use gTempObject
OBJECTTYPE defaultAttachment;
CreateItem(Item [ usItem ].defaultattachments[cnt],100,&defaultAttachment);
pObj->AttachObject(NULL,&defaultAttachment, FALSE);
}
#else
AttachDefaultAttachments(pObj);//dnl ch75 261013 AttachDefaultAttachments(pObj);//dnl ch75 261013
#endif
} }
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateItem: return %d",fRet)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateItem: return %d",fRet));
@@ -12644,42 +12589,6 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
UINT16 usNumMatches = 0; UINT16 usNumMatches = 0;
UINT16 usRandom = 0; UINT16 usRandom = 0;
UINT16 lowestCoolness = LowestLaunchableCoolness(itemIndex); UINT16 lowestCoolness = LowestLaunchableCoolness(itemIndex);
#if 0
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("PickARandomLaunchable: itemIndex = %d", itemIndex));
// WANNE: This should fix the hang on the merc positioning screen (fix by Razer)
//while( !usNumMatches )
{ //Count the number of valid launchables
for( i = 0; i < MAXITEMS; ++i )
{
if ( Item[i].usItemClass == 0 )
break;
//Madd: quickfix: make it not choose best grenades right away.
if( ValidLaunchable( i, itemIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) )
usNumMatches++;
}
}
if( usNumMatches )
{
usRandom = (UINT16)Random( usNumMatches );
for( i = 0; i < MAXITEMS; ++i )
{
if ( Item[i].usItemClass == 0 )
break;
if( ValidLaunchable( i, itemIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) )
{
if( usRandom )
usRandom--;
else
{
return i;
}
}
}
}
#endif
// Flugente: the above code is highly dubious.. why do we loop over all items 2 times, and why that obscure usRandom--; business? This can cause an underflow! // Flugente: the above code is highly dubious.. why do we loop over all items 2 times, and why that obscure usRandom--; business? This can cause an underflow!
BOOLEAN isnight = NightTime(); BOOLEAN isnight = NightTime();
-12
View File
@@ -1190,9 +1190,6 @@ BOOLEAN ModifyDoorStatus( INT32 sGridNo, BOOLEAN fOpen, BOOLEAN fPerceivedOpen )
if ( pBaseStructure == NULL ) if ( pBaseStructure == NULL )
{ {
#if 0
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", sGridNo );
#endif
return( FALSE ); return( FALSE );
} }
@@ -1314,9 +1311,6 @@ BOOLEAN IsDoorOpen( INT32 sGridNo )
if ( pBaseStructure == NULL ) if ( pBaseStructure == NULL )
{ {
#if 0
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", sGridNo );
#endif
return( FALSE ); return( FALSE );
} }
@@ -1527,9 +1521,6 @@ void SyncronizeDoorStatusToStructureData( DOOR_STATUS *pDoorStatus )
if ( pBaseStructure == NULL ) if ( pBaseStructure == NULL )
{ {
#if 0
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", pDoorStatus->sGridNo );
#endif
return; return;
} }
@@ -1611,9 +1602,6 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse
if ( pBaseStructure == NULL ) if ( pBaseStructure == NULL )
{ {
#if 0
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", pDoorStatus->sGridNo );
#endif
return; return;
} }
-36
View File
@@ -4805,15 +4805,7 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY,
dDeltaX = dEndX - dStartX; dDeltaX = dEndX - dStartX;
dDeltaY = dEndY - dStartY; dDeltaY = dEndY - dStartY;
dDeltaZ = dEndZ - dStartZ; dDeltaZ = dEndZ - dStartZ;
#if 0//dnl ch60 020913 isn't true see reason in FireBulletGivenTarget
//lal bugfix
if( dDeltaZ > 0 )
d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ );
else
d2DDistance = Distance2D( dDeltaX, dDeltaY );
#else
d2DDistance = Distance2D( dDeltaX, dDeltaY ); d2DDistance = Distance2D( dDeltaX, dDeltaY );
#endif
iDistance = (INT32) d2DDistance; iDistance = (INT32) d2DDistance;
if ( d2DDistance != iDistance ) if ( d2DDistance != iDistance )
@@ -5304,15 +5296,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
dDeltaX = dEndX - dStartX; dDeltaX = dEndX - dStartX;
dDeltaY = dEndY - dStartY; dDeltaY = dEndY - dStartY;
dDeltaZ = dEndZ - dStartZ; dDeltaZ = dEndZ - dStartZ;
#if 0//dnl ch60 311009 this isn't correct, e.g. if you try head shot from prone to standing target at 1 tile, Distance3D will calculate 7,8 tile distance, this means that you will always hit target regard of CTH calculation, correct usage will be Distance3D(dDeltaX, dDeltaY, CONVERT_HEIGHTUNITS_TO_DISTANCE(dDeltaZ)) but we need here 2D distance as was in original v1.12
//lal bugfix
if( dDeltaZ > 0 )
d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ );
else
d2DDistance = Distance2D( dDeltaX, dDeltaY );
#else
d2DDistance = Distance2D( dDeltaX, dDeltaY ); d2DDistance = Distance2D( dDeltaX, dDeltaY );
#endif
iDistance = (INT32) d2DDistance; iDistance = (INT32) d2DDistance;
if ( d2DDistance != iDistance ) if ( d2DDistance != iDistance )
@@ -5813,15 +5797,7 @@ INT8 FireFragmentGivenTarget( UINT8 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT
dDeltaX = dEndX - dStartX; dDeltaX = dEndX - dStartX;
dDeltaY = dEndY - dStartY; dDeltaY = dEndY - dStartY;
dDeltaZ = dEndZ - dStartZ; dDeltaZ = dEndZ - dStartZ;
#if 0//dnl ch60 030913
//lal bugfix
if( dDeltaZ > 0 )
d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ );
else
d2DDistance = Distance2D( dDeltaX, dDeltaY );
#else
d2DDistance = Distance2D( dDeltaX, dDeltaY ); d2DDistance = Distance2D( dDeltaX, dDeltaY );
#endif
iDistance = (INT32) d2DDistance; iDistance = (INT32) d2DDistance;
if ( d2DDistance != iDistance ) if ( d2DDistance != iDistance )
@@ -5990,15 +5966,7 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT
dDeltaX = dEndX - dStartX; dDeltaX = dEndX - dStartX;
dDeltaY = dEndY - dStartY; dDeltaY = dEndY - dStartY;
dDeltaZ = dEndZ - dStartZ; dDeltaZ = dEndZ - dStartZ;
#if 0//dnl ch60 030913
//lal bugfix
if( dDeltaZ > 0 )
d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ );
else
d2DDistance = Distance2D( dDeltaX, dDeltaY );
#else
d2DDistance = Distance2D( dDeltaX, dDeltaY ); d2DDistance = Distance2D( dDeltaX, dDeltaY );
#endif
iDistance = (INT32) d2DDistance; iDistance = (INT32) d2DDistance;
if ( d2DDistance != iDistance ) if ( d2DDistance != iDistance )
@@ -8584,11 +8552,7 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Find distance between shooter and target, in points. // Find distance between shooter and target, in points.
FLOAT d2DDistance=0; FLOAT d2DDistance=0;
#if 0//dnl ch60 030913
d2DDistance = Distance3D( dDeltaX, dDeltaY, CONVERT_HEIGHTUNITS_TO_DISTANCE( dDeltaZ ) );
#else
d2DDistance = Distance2D( dDeltaX, dDeltaY ); d2DDistance = Distance2D( dDeltaX, dDeltaY );
#endif
// Round it upwards. // Round it upwards.
INT32 iDistance = (INT32) d2DDistance; INT32 iDistance = (INT32) d2DDistance;
if ( d2DDistance != iDistance ) if ( d2DDistance != iDistance )
-321
View File
@@ -199,327 +199,6 @@ void SaveMapInformation(HWFILE hFile, FLOAT dMajorMapVersion, UINT8 ubMinorMapVe
//loading and won't be permanently updated until the map is saved, regardless of changes. //loading and won't be permanently updated until the map is saved, regardless of changes.
void UpdateOldVersionMap() void UpdateOldVersionMap()
{ {
#if 0 //This code is no longer needed since the major version update from 1.0 to 4.0
//However, I am keeping it in for reference.
SOLDIERINITNODE *curr;
INT32 i;
LEVELNODE *pStruct;
//VERSION 0 -- obsolete November 14, 1997
if( gMapInformation.ubMapVersion == 0 )
{
//Soldier information contained two fixable bugs.
gMapInformation.ubMapVersion++;
curr = gSoldierInitHead;
while( curr )
{
//Bug #01) Nodes without detailed slots weren't initialized.
if( !curr->pBasicPlacement->fDetailedPlacement )
curr->pDetailedPlacement = NULL;
//Bug #02) The attitude variable was accidentally being generated like attributes
// which put it completely out of range.
if( curr->pBasicPlacement->bAttitude > 7 )
curr->pBasicPlacement->bAttitude = (INT8)Random(8);
//go to next node
curr = curr->next;
}
}
//VERSION 1 -- obsolete January 7, 1998
if( gMapInformation.ubMapVersion == 1 )
{
gMapInformation.ubMapVersion++;
//Bug #03) Removing all wall decals from map, because of new changes to the slots
// as well as certain decals found commonly in illegal places.
for( i = 0; i < WORLD_MAX; i++ )
{
RemoveAllStructsOfTypeRange( i, FIRSTWALLDECAL, LASTWALLDECAL );
RemoveAllStructsOfTypeRange( i, FIFTHWALLDECAL, SIXTHWALLDECAL );
}
}
//VERSION 2 -- obsolete February 3, 1998
if( gMapInformation.ubMapVersion == 2 )
{
gMapInformation.ubMapVersion++;
curr = gSoldierInitHead;
while( curr )
{
//Bug #04) Assign enemy mercs default army color code if applicable
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM && !curr->pBasicPlacement->ubSoldierClass )
{
if( !curr->pDetailedPlacement )
{
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY;
}
else if( curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile == NO_PROFILE )
{
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY;
curr->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY;
}
}
curr = curr->next;
}
}
//VERSION 3 -- obsolete February 9, 1998
if( gMapInformation.ubMapVersion == 3 )
{
gMapInformation.ubMapVersion++;
//Bug #05) Move entry points down if necessary.
ValidateEntryPointGridNo( &gMapInformation.sNorthGridNo );
ValidateEntryPointGridNo( &gMapInformation.sEastGridNo );
ValidateEntryPointGridNo( &gMapInformation.sSouthGridNo );
ValidateEntryPointGridNo( &gMapInformation.sWestGridNo );
}
//VERSION 4 -- obsolete February 25, 1998
if( gMapInformation.ubMapVersion == 4 )
{
gMapInformation.ubMapVersion++;
//6) Change all doors to FIRSTDOOR
for( i = 0; i < WORLD_MAX; ++i )
{
//NOTE: Here are the index values for the various doors
//DOOR OPEN CLOSED
//FIRST 916 912
//SECOND 936 932
//THIRD 956 952
//FOURTH 976 972
pStruct = gpWorldLevelData[ i ].pStructHead;
while( pStruct )
{
//outside topleft
if( pStruct->usIndex == 932 || pStruct->usIndex == 952 || pStruct->usIndex == 972 )
{
ReplaceStructIndex( i, pStruct->usIndex, 912 );
break;
}
else if( pStruct->usIndex == 936 || pStruct->usIndex == 956 || pStruct->usIndex == 976 )
{
ReplaceStructIndex( i, pStruct->usIndex, 916 );
break;
}
//outside topright
else if( pStruct->usIndex == 927 || pStruct->usIndex == 947 || pStruct->usIndex == 967 )
{
ReplaceStructIndex( i, pStruct->usIndex, 907 );
break;
}
else if( pStruct->usIndex == 931 || pStruct->usIndex == 951 || pStruct->usIndex == 971 )
{
ReplaceStructIndex( i, pStruct->usIndex, 911 );
break;
}
//inside topleft
else if( pStruct->usIndex == 942 || pStruct->usIndex == 962 || pStruct->usIndex == 982 )
{
ReplaceStructIndex( i, pStruct->usIndex, 922 );
break;
}
else if( pStruct->usIndex == 946 || pStruct->usIndex == 966 || pStruct->usIndex == 986 )
{
ReplaceStructIndex( i, pStruct->usIndex, 926 );
break;
}
//inside topright
else if( pStruct->usIndex == 937 || pStruct->usIndex == 957 || pStruct->usIndex == 977 )
{
ReplaceStructIndex( i, pStruct->usIndex, 917 );
break;
}
else if( pStruct->usIndex == 941 || pStruct->usIndex == 961 || pStruct->usIndex == 981 )
{
ReplaceStructIndex( i, pStruct->usIndex, 921 );
break;
}
pStruct = pStruct->pNext;
}
}
}
//VERSION 5 -- obsolete March 4, 1998
if( gMapInformation.ubMapVersion == 5 )
{
gMapInformation.ubMapVersion++;
//Bug 7) Remove all exit grids (the format has changed)
for( i = 0; i < WORLD_MAX; i++ )
RemoveExitGridFromWorld( i );
}
//VERSION 6 -- obsolete March 9, 1998
if( gMapInformation.ubMapVersion == 6 )
{ //Bug 8) Change droppable status of merc items so that they are all undroppable.
gMapInformation.ubMapVersion++;
curr = gSoldierInitHead;
while( curr )
{
//Bug #04) Assign enemy mercs default army color code if applicable
if( curr->pDetailedPlacement )
{
INT32 invsize = (INT32)curr->pDetailedPlacement->Inv.size();
for( i = 0; i < invsize; ++i )
{ //make all items undroppable, even if it is empty. This will allow for
//random item generation, while empty, droppable slots are locked as empty
//during random item generation.
curr->pDetailedPlacement->Inv[ i ].fFlags |= OBJECT_UNDROPPABLE;
}
}
curr = curr->next;
}
}
//VERSION 7 -- obsolete April 14, 1998
if( gMapInformation.ubMapVersion == 7 )
{
gMapInformation.ubMapVersion++;
//Bug 9) Priority placements have been dropped in favor of splitting it into two categories.
// The first is Detailed placements, and the second is priority existance. So, all
// current detailed placements will also have priority existance.
curr = gSoldierInitHead;
while( curr )
{
if( curr->pDetailedPlacement )
{
curr->pBasicPlacement->fPriorityExistance = TRUE;
}
curr = curr->next;
}
}
if( gMapInformation.ubMapVersion == 14 )
{ //Toast all of the ambiguous road pieces that ended up wrapping the byte.
LEVELNODE *pStruct, *pStruct2;
INT32 i;
for( i = 0; i < WORLD_MAX; i++ )
{
pStruct = gpWorldLevelData[ i ].pObjectHead;
if( pStruct && pStruct->usIndex == 1078 && i < WORLD_MAX-2 && i >= 320 )
{ //This is the only detectable road piece that we can repair.
pStruct2 = gpWorldLevelData[ i+1 ].pObjectHead;
if( pStruct2 && pStruct2->usIndex == 1081 )
{
RemoveObject( i, pStruct->usIndex );
RemoveObject( i+1, pStruct->usIndex+1 );
RemoveObject( i+2, pStruct->usIndex+2 );
RemoveObject( i-160, pStruct->usIndex-160 );
RemoveObject( i-159, pStruct->usIndex-159 );
RemoveObject( i-158, pStruct->usIndex-158 );
RemoveObject( i-320, pStruct->usIndex-320 );
RemoveObject( i-319, pStruct->usIndex-319 );
RemoveObject( i-318, pStruct->usIndex-318 );
AddObjectToTail( i, 1334 );
AddObjectToTail( i-160, 1335 );
AddObjectToTail( i-320, 1336 );
AddObjectToTail( i+1, 1337 );
AddObjectToTail( i-159, 1338 );
AddObjectToTail( i-319, 1339 );
AddObjectToTail( i+2, 1340 );
AddObjectToTail( i-158, 1341 );
AddObjectToTail( i-318, 1342 );
}
}
else if( pStruct && pStruct->usIndex >= 1079 && pStruct->usIndex < 1115 )
{
RemoveObject( i, pStruct->usIndex );
}
}
}
if( gMapInformation.ubMapVersion <= 7 )
{
if( gfEditMode )
{
#ifdef JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Currently loaded map is corrupt! Allowing the map to load anyway!" );
#endif
}
else
{
if( gbWorldSectorZ )
{
AssertMsg( 0, String( "Currently loaded map (%c%d_b%d.dat) is invalid -- less than the minimum supported version.", gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) );
}
else if( !gbWorldSectorZ )
{
AssertMsg( 0, String( "Currently loaded map (%c%d.dat) is invalid -- less than the minimum supported version.", gWorldSectorY + 'A' - 1, gWorldSectorX ) );
}
}
}
//VERSION 8 -- obsolete April 18, 1998
if( gMapInformation.ubMapVersion == 8 )
{
gMapInformation.ubMapVersion++;
//Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at
// fKillSlotIfOwnerDies.
curr = gSoldierInitHead;
while( curr )
{
if( curr->pDetailedPlacement )
{
//The size 120 was hand calculated. The remaining padding was 118 bytes
//and there were two one byte fields cleared, fKillSlotIfOwnerDies and ubScheduleID
memset( &curr->pDetailedPlacement->fKillSlotIfOwnerDies, 0, 120 );
}
curr = curr->next;
}
}
//Version 9 -- Kris -- obsolete April 27, 1998
if( gMapInformation.ubMapVersion == 9 )
{
gMapInformation.ubMapVersion++;
curr = gSoldierInitHead;
while( curr )
{
//Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database.
if( curr->pDetailedPlacement && curr->pDetailedPlacement->ubBodyType == CRIPPLECIV )
{
curr->pDetailedPlacement->ubBodyType = COW;
curr->pBasicPlacement->ubBodyType = COW;
}
curr = curr->next;
}
}
if( gMapInformation.ubMapVersion < 12 )
{
gMapInformation.ubMapVersion = 12;
gMapInformation.sCenterGridNo = -1;
}
if( gMapInformation.ubMapVersion < 13 )
{ //replace all merc ammo inventory slots status value with the max ammo that the clip can hold.
INT32 cnt;
OBJECTTYPE *pItem;
gMapInformation.ubMapVersion++;
//Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at
// fKillSlotIfOwnerDies.
curr = gSoldierInitHead;
while( curr )
{
if( curr->pDetailedPlacement )
{
UINT32 invsize = curr->pDetailedPlacement->Inv.size();
for ( UINT32 i = 0; i < invsize; ++i )
{
pItem = &curr->pDetailedPlacement->Inv[ i ];
if( Item[ pItem->usItem ].usItemClass & IC_AMMO )
{
for( cnt = 0; cnt < pItem->ubNumberOfObjects; ++cnt )
{
pItem->shots.ubShotsLeft[ cnt ] = Magazine[ Item[ pItem->usItem ].ubClassIndex ].ubMagSize;
}
}
}
}
curr = curr->next;
}
}
if( gMapInformation.ubMapVersion < 14 )
{
gMapInformation.ubMapVersion++;
if( !gfCaves && !gfBasement )
{
ReplaceObsoleteRoads();
}
}
if( gMapInformation.ubMapVersion < 15 )
{ //Do nothing. The object layer was expanded from 1 byte to 2 bytes, effecting the
//size of the maps. This was due to the fact that the ROADPIECES tileset contains
//over 300 pieces, hence requiring a size increase of the tileset subindex for this
//layer only.
}
#endif //end of MAJOR VERSION 3.0 obsolete code
if( gMapInformation.ubMapVersion < 15 ) if( gMapInformation.ubMapVersion < 15 )
{ {
AssertMsg( 0, "Map is less than minimum supported version." ); AssertMsg( 0, "Map is less than minimum supported version." );
-15
View File
@@ -299,21 +299,6 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
// If the sector is already loaded, don't add the existing militia // If the sector is already loaded, don't add the existing militia
for( x = 1; x < guiDirNumber ; ++x ) for( x = 1; x < guiDirNumber ; ++x )
{ {
#if 0
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld,%ld,%ld", gpAttackDirs[ x ][ 0 ], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2], gpAttackDirs[ x ][3] );
if( gfMSResetMilitia )
{
if( gpAttackDirs[ x ][ 3 ] != INSERTION_CODE_CENTER )
{
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
ubGreen -= gpAttackDirs[ x ][0];
ubRegs -= gpAttackDirs[ x ][1];
ubElites -= gpAttackDirs[ x ][2];
}
}
//else
//{
#endif
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
} }
-77
View File
@@ -9296,11 +9296,6 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
{ {
DebugAI(AI_MSG_INFO, pSoldier, String("CancelAIAction: suppression: change stance/cower")); DebugAI(AI_MSG_INFO, pSoldier, String("CancelAIAction: suppression: change stance/cower"));
CancelAIAction( pSoldier, TRUE ); CancelAIAction( pSoldier, TRUE );
#if 0
pSoldier->aiData.bAction = AI_ACTION_CHANGE_STANCE;
pSoldier->aiData.usActionData = ubNewStance;
pSoldier->aiData.bActionInProgress = TRUE;
#endif
} }
// go for it! // go for it!
@@ -9642,38 +9637,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
UINT32 cnt; UINT32 cnt;
UINT8 ubID; UINT8 ubID;
#if 0
// 0verhaul: None of this is necessary anymore with the new attack busy system
if (ubID == NOBODY)
{
pSoldier = NULL;
pTarget = NULL;
}
else
{
pSoldier = MercPtrs[ ubID ];
if ( ubTargetID != NOBODY)
{
pTarget = MercPtrs[ ubTargetID ];
}
else
{
pTarget = NULL;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(">>Target ptr is null!" ) );
}
}
if (fCalledByAttacker)
{
if (pSoldier && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN)
{
if (pSoldier->bBulletsLeft > 0)
{
return( pTarget );
}
}
}
#endif
// if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) // if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT))
// { // {
@@ -9798,15 +9761,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
return( NULL ); return( NULL );
} }
#endif #endif
#if 0
// 0verhaul: This is moved to the end loop where everybody's state is reset for the next action
if (pTarget)
{
// reset # of shotgun pellets hit by
pTarget->bNumPelletsHitBy = 0;
// reset flag for making "ow" sound on being shot
}
#endif
if (pSoldier) if (pSoldier)
{ {
@@ -10099,17 +10053,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
SOLDIERTYPE * ReduceAttackBusyCount( ) SOLDIERTYPE * ReduceAttackBusyCount( )
{ {
#if 0
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyCount") );
if ( ubID == NOBODY )
{
return( InternalReduceAttackBusyCount( ubID, fCalledByAttacker, NOBODY ) );
}
else
{
return( InternalReduceAttackBusyCount( ubID, fCalledByAttacker, MercPtrs[ ubID ]->ubTargetID ) );
}
#endif
// 0verhaul: This is now a simple subroutine. // 0verhaul: This is now a simple subroutine.
return InternalReduceAttackBusyCount( ); return InternalReduceAttackBusyCount( );
} }
@@ -10126,26 +10069,6 @@ SOLDIERTYPE * FreeUpAttacker( )
return( ReduceAttackBusyCount( ) ); return( ReduceAttackBusyCount( ) );
} }
#if 0
// 0verhaul: These routines are declared obsolete. Call ReduceAttackBusyCount instead.
SOLDIERTYPE * FreeUpAttackerGivenTarget( UINT8 ubID, UINT8 ubTargetID )
{
// Strange as this may seem, this function returns a pointer to
// the *target* in case the target has changed sides as a result
// of being attacked
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FreeUpAttackerGivenTarget") );
return( InternalReduceAttackBusyCount( ubID, TRUE, ubTargetID ) );
}
SOLDIERTYPE * ReduceAttackBusyGivenTarget( UINT8 ubID, UINT8 ubTargetID )
{
// Strange as this may seem, this function returns a pointer to
// the *target* in case the target has changed sides as a result
// of being attacked
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyGivenTarget") );
return( InternalReduceAttackBusyCount( ubID, FALSE, ubTargetID ) );
}
#endif
void StopMercAnimation( BOOLEAN fStop ) void StopMercAnimation( BOOLEAN fStop )
-63
View File
@@ -708,7 +708,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
guiTotalPathChecks++; guiTotalPathChecks++;
#endif #endif
#ifdef VEHICLE
fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0);
if ( fMultiTile == false) if ( fMultiTile == false)
@@ -758,7 +757,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
fContinuousTurnNeeded = FALSE; fContinuousTurnNeeded = FALSE;
} }
} }
#endif
if (fContinuousTurnNeeded == false) if (fContinuousTurnNeeded == false)
{ {
@@ -803,16 +801,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
{ {
SetRenderFlags( RENDER_FLAG_FULL ); SetRenderFlags( RENDER_FLAG_FULL );
// The RenderCoverDebugInfo call is now made by RenderWorld. So don't try to call it here // The RenderCoverDebugInfo call is now made by RenderWorld. So don't try to call it here
#if 0
if ( guiCurrentScreen == GAME_SCREEN )
{
RenderWorld();
RenderCoverDebug( );
InvalidateScreen( );
EndFrameBufferRender();
RefreshScreen( NULL );
}
#endif
} }
#endif #endif
@@ -901,13 +889,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
if (gfDisplayCoverValues && gfDrawPathPoints) if (gfDisplayCoverValues && gfDrawPathPoints)
{ {
SetRenderFlags( RENDER_FLAG_FULL ); SetRenderFlags( RENDER_FLAG_FULL );
#if 0
RenderWorld();
RenderCoverDebug( );
InvalidateScreen( );
EndFrameBufferRender();
RefreshScreen( NULL );
#endif
} }
#endif #endif
@@ -1088,7 +1069,6 @@ void AStarPathfinder::ExecuteAStarLogic()
continue; continue;
} }
#ifdef VEHICLE
//has side effects, including setting loop counters //has side effects, including setting loop counters
int retVal = VehicleObstacleCheck(); int retVal = VehicleObstacleCheck();
if (retVal == 1) if (retVal == 1)
@@ -1099,7 +1079,6 @@ void AStarPathfinder::ExecuteAStarLogic()
{ {
return; return;
} }
#endif
//calc the cost to move from the current node to here //calc the cost to move from the current node to here
INT16 terrainCost = EstimateActionPointCost( pSoldier, CurrentNode, direction, movementMode, 0, 3 ); INT16 terrainCost = EstimateActionPointCost( pSoldier, CurrentNode, direction, movementMode, 0, 3 );
@@ -1769,7 +1748,6 @@ int AStarPathfinder::CalcH()
int x = abs(n1->x - n2->x); int x = abs(n1->x - n2->x);
int y = abs(n1->y - n2->y); int y = abs(n1->y - n2->y);
#if 1
if (x >= y) if (x >= y)
{ {
return this->travelcostDiag * y + this->travelcostOrth * (x-y); return this->travelcostDiag * y + this->travelcostOrth * (x-y);
@@ -1778,35 +1756,6 @@ int AStarPathfinder::CalcH()
{ {
return this->travelcostDiag * x + this->travelcostOrth * (y-x); return this->travelcostDiag * x + this->travelcostOrth * (y-x);
} }
#else
// Try a real distance method. This should underestimate in some cases
// However, the distances need to be increased for the moment because running orthogonal is 1AP while running diagonal is 2AP
// so the total to reach a diagonal tile is identical for 2 moves. So we have to trick the pathing calc into thinking it's
// a longer distance and also calculate the other costs accordingly.
x *= 100;
y *= 100;
int d = x*x + y*y;
int r = 1200; // Just a guess
if (d == 0)
{
return d;
}
while (1)
{
int gr = (r + (d/r)) / 2;
if (gr == r || gr == r+1)
{
break;
}
r = gr;
}
return r * travelcostOrth;
#endif
} }
#ifdef ASTAR_USING_EXTRACOVER #ifdef ASTAR_USING_EXTRACOVER
@@ -2116,7 +2065,6 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
} }
#endif //#ifdef ASTAR_USING_EXTRACOVER #endif //#ifdef ASTAR_USING_EXTRACOVER
#ifdef VEHICLE
void AStarPathfinder::InitVehicle() void AStarPathfinder::InitVehicle()
{ {
fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0);
@@ -2263,7 +2211,6 @@ int AStarPathfinder::VehicleObstacleCheck()
} }
return 0; return 0;
} }
#endif
bool AStarPathfinder::WantToTraverse() bool AStarPathfinder::WantToTraverse()
{ {
@@ -2523,7 +2470,6 @@ b=GetJA2Clock();//return s->sGridNo+6;
INT32 iWaterToWater; INT32 iWaterToWater;
INT16 ubCurAPCost,ubAPCost; INT16 ubCurAPCost,ubAPCost;
INT16 ubNewAPCost=0; INT16 ubNewAPCost=0;
#ifdef VEHICLE
//BOOLEAN fTurnSlow = FALSE; //BOOLEAN fTurnSlow = FALSE;
//BOOLEAN fReverse = FALSE; // stuff for vehicles turning //BOOLEAN fReverse = FALSE; // stuff for vehicles turning
BOOLEAN fMultiTile, fVehicle; BOOLEAN fMultiTile, fVehicle;
@@ -2534,7 +2480,6 @@ b=GetJA2Clock();//return s->sGridNo+6;
UINT16 usAnimSurface; UINT16 usAnimSurface;
//INT32 iCnt2, iCnt3; //INT32 iCnt2, iCnt3;
BOOLEAN fVehicleIgnoreObstacles = FALSE; BOOLEAN fVehicleIgnoreObstacles = FALSE;
#endif
INT32 iLastDir = 0; INT32 iLastDir = 0;
@@ -2759,7 +2704,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
guiTotalPathChecks++; guiTotalPathChecks++;
#endif #endif
#ifdef VEHICLE
fMultiTile = ((s->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); fMultiTile = ((s->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0);
if (fMultiTile) if (fMultiTile)
@@ -2819,7 +2763,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
fContinuousTurnNeeded = FALSE; fContinuousTurnNeeded = FALSE;
} }
#endif
if (!fContinuousTurnNeeded) if (!fContinuousTurnNeeded)
{ {
@@ -2962,7 +2905,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
} }
#endif #endif
#ifdef VEHICLE
/* /*
if (fTurnSlow) if (fTurnSlow)
{ {
@@ -2987,7 +2929,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
} }
*/ */
#endif
if (gubNPCAPBudget) if (gubNPCAPBudget)
{ {
@@ -3048,7 +2989,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
//for ( iCnt = iLoopStart; iCnt != iLoopEnd; iCnt = (iCnt + iLoopIncrement) % MAXDIR ) //for ( iCnt = iLoopStart; iCnt != iLoopEnd; iCnt = (iCnt + iLoopIncrement) % MAXDIR )
for ( iCnt = iLoopStart; ; ) for ( iCnt = iLoopStart; ; )
{ {
#ifdef VEHICLE
/* /*
if (fTurnSlow) if (fTurnSlow)
{ {
@@ -3130,7 +3070,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
} }
} }
#endif
newLoc = curLoc + dirDelta[iCnt]; newLoc = curLoc + dirDelta[iCnt];
@@ -3479,7 +3418,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
} }
} }
#ifdef VEHICLE
if (fMultiTile) if (fMultiTile)
{ {
// vehicle test for obstacles: prevent movement to next tile if // vehicle test for obstacles: prevent movement to next tile if
@@ -3518,7 +3456,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
} }
*/ */
} }
#endif
// NEW Apr 21 by Ian: abort if cost exceeds budget // NEW Apr 21 by Ian: abort if cost exceeds budget
if (gubNPCAPBudget) if (gubNPCAPBudget)
-274
View File
@@ -679,7 +679,6 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir,
// Get switch value... // Get switch value...
sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ]; sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ];
#if 1 //Moa: set to 0 to use original copy and paste code from ActionPointCost()
if ( sSwitchValue == TRAVELCOST_FENCE ) if ( sSwitchValue == TRAVELCOST_FENCE )
{ {
// If we are changeing stance ( either before or after getting there.... // If we are changeing stance ( either before or after getting there....
@@ -737,191 +736,6 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir,
sPoints += ActionPointCost( pSoldier, sGridNo, bDir, usMovementMode ); sPoints += ActionPointCost( pSoldier, sGridNo, bDir, usMovementMode );
return (sPoints); return (sPoints);
#else
// Tile cost should not be reduced based on movement mode...
if ( sSwitchValue == TRAVELCOST_FENCE )
{
return( sTileCost );
}
// WANNE.WATER: If our soldier is not on the ground level and the tile is a "water" tile, then simply set the tile to "FLAT_GROUND"
// This should fix "problems" for special modified maps
UINT8 ubTerrainID = gpWorldLevelData[ sGridNo ].ubTerrainID;
if ( TERRAIN_IS_WATER( ubTerrainID) && pSoldier->pathing.bLevel > 0 )
ubTerrainID = FLAT_GROUND;
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
if ( TERRAIN_IS_WATER( ubTerrainID) )
{
usMovementMode = WALKING;
}
// so, then we must modify it for other movement styles and accumulate
// CHRISL: Adjusted system to use different move costs while wearing a backpack
if (sTileCost > 0)
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// SANDRO - This part have been modified "a bit"
// Check movement modifiers
switch( usMovementMode )
{
case RUNNING:
case ADULTMONSTER_WALKING:
case BLOODCAT_RUN:
sPoints = sTileCost + APBPConstants[AP_MODIFIER_RUN];
break;
case CROW_FLY:
case SIDE_STEP:
case WALK_BACKWARDS:
case ROBOT_WALK:
case BLOODCAT_WALK_BACKWARDS:
case MONSTER_WALK_BACKWARDS:
case LARVAE_WALK:
case WALKING :
case WALKING_ALTERNATIVE_RDY :
case SIDE_STEP_ALTERNATIVE_RDY :
sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK];
if (!(pSoldier->MercInWater()) && ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) ) && !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) )
{
sPoints += APBPConstants[AP_MODIFIER_READY];
}
break;
case SIDE_STEP_WEAPON_RDY:
case SIDE_STEP_DUAL_RDY:
case WALKING_WEAPON_RDY:
case WALKING_DUAL_RDY:
sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY];
break;
case START_SWAT:
case SWAT_BACKWARDS:
case SWATTING:
sPoints = sTileCost + APBPConstants[AP_MODIFIER_SWAT];
break;
case CRAWLING:
sPoints = sTileCost + APBPConstants[AP_MODIFIER_CRAWL];
break;
default:
// Invalid movement mode
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Invalid movement mode %d used in ActionPointCost", usMovementMode ) );
sPoints = sTileCost;
break;
}
// Check for reverse mode
if ( pSoldier->bReverse || gUIUseReverse )
sPoints += APBPConstants[AP_REVERSE_MODIFIER];
// STOMP traits - Athletics trait decreases movement cost
if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, ATHLETICS_NT ))
{
sPoints = max(1, (INT16)((sPoints * (100 - gSkillTraitValues.ubATAPsMovementReduction) / 100) + 0.5));
}
// Flugente: riot shields lower movement speed
if ( pSoldier->IsRiotShieldEquipped( ) )
sPoints *= gItemSettings.fShieldMovementAPCostModifier;
// Flugente: dragging someone
if ( pSoldier->IsDraggingSomeone( ) )
sPoints *= gItemSettings.fDragAPCostModifier;
// Check if doors if not player's merc (they have to open them manually)
if ( sSwitchValue == TRAVELCOST_DOOR && pSoldier->bTeam != gbPlayerNum )
{
sPoints += GetAPsToOpenDoor( pSoldier ) + GetAPsToOpenDoor( pSoldier ); // Include open and close costs!
}
// Check for stealth mode
if ( pSoldier->bStealthMode )
{
// STOMP traits - Stealthy trait decreases stealth AP modifier
if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, STEALTHY_NT ))
{
sPoints += (max(0, (INT16)((APBPConstants[AP_STEALTH_MODIFIER] * (100 - gSkillTraitValues.ubSTStealthModeSpeedBonus) / 100) + 0.5)));
}
else
{
sPoints += APBPConstants[AP_STEALTH_MODIFIER];
}
}
// Check for backpack
if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( pSoldier ) != ITEM_NOT_FOUND )
sPoints += APBPConstants[AP_MODIFIER_PACK];
///////////////////////////////////////////////////////////////////////////////////////////////////////////
}
// Get switch value...
sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ];
// ATE: If we have a 'special cost, like jump fence...
if ( sSwitchValue == TRAVELCOST_FENCE )
{
// If we are changeing stance ( either before or after getting there....
// We need to reflect that...
switch(usMovementMode)
{
case SIDE_STEP:
case SIDE_STEP_WEAPON_RDY:
case SIDE_STEP_DUAL_RDY:
case WALK_BACKWARDS:
case RUNNING:
case WALKING :
case WALKING_WEAPON_RDY:
case WALKING_DUAL_RDY:
case WALKING_ALTERNATIVE_RDY :
case SIDE_STEP_ALTERNATIVE_RDY:
// Add here cost to go from crouch to stand AFTER fence hop....
// Since it's AFTER.. make sure we will be moving after jump...
if ( ( bPathIndex + 2 ) < bPathLength )
{
sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed..
}
break;
case SWATTING:
case START_SWAT:
case SWAT_BACKWARDS:
// Add cost to stand once there BEFORE....
sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed..
break;
case CRAWLING:
// Can't do it here.....
break;
}
}
else if (sSwitchValue == TRAVELCOST_NOT_STANDING)
{
switch(usMovementMode)
{
case RUNNING:
case WALKING :
case WALKING_WEAPON_RDY:
case WALKING_DUAL_RDY:
case SIDE_STEP:
case SIDE_STEP_WEAPON_RDY:
case SIDE_STEP_DUAL_RDY:
case WALK_BACKWARDS:
case WALKING_ALTERNATIVE_RDY :
case SIDE_STEP_ALTERNATIVE_RDY:
// charge crouch APs for ducking head!
sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed..
break;
default:
break;
}
}
return( sPoints );
#endif
} }
@@ -2563,20 +2377,6 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
// Do we need to stand up? // Do we need to stand up?
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
} }
#if 0//dnl ch73 021013 relocate this to MinAPsToPunch
// blunt weapons & blades
else if ( Item[ usUBItem ].usItemClass == IC_PUNCH || Item[ usUBItem ].usItemClass == IC_BLADE )
{
if ( usTargID != NOBODY )
{
// Check if target is prone, if so, calc cost...
if ( gAnimControl[ MercPtrs[ usTargID ]->usAnimState ].ubEndHeight == ANIM_PRONE )
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_CROUCH );
else
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
}
}
#endif
else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too
{ {
if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND)
@@ -2594,10 +2394,6 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
//Calculate usTurningCost //Calculate usTurningCost
if (!TileIsOutOfBounds(sGridNo)) if (!TileIsOutOfBounds(sGridNo))
{ {
#if 0//dnl ch73 021013 relocate this to MinAPsToPunch
// Buggler: actual melee ap deduction for turning applies only when target is 1 tile away
if ( !( ( Item[ usUBItem ].usItemClass == IC_PUNCH || Item[ usUBItem ].usItemClass == IC_BLADE ) && usRange > 1 ) )
#endif
{ {
if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913
{ {
@@ -2652,11 +2448,6 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
bAPCost += APBPConstants[AP_UNJAM]; bAPCost += APBPConstants[AP_UNJAM];
} }
#if 0//dnl ch63 240813 this seems very wrong, in most case (pSoldier->bActionPoints > bFullAps) and this will return less points then is actually required and could cancel some AI actions, like throwing grenades
// the minimum AP cost of ANY shot can NEVER be more than merc's maximum APs!
if ( bAPCost > bFullAPs )
bAPCost = bFullAPs;
#endif
// this SHOULD be impossible, but nevertheless... // this SHOULD be impossible, but nevertheless...
if ( bAPCost < 1 ) if ( bAPCost < 1 )
bAPCost = 1; bAPCost = 1;
@@ -3812,73 +3603,8 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTurningCos
INT32 iFullAPs; INT32 iFullAPs;
INT32 iAPCost = APBPConstants[AP_MIN_AIM_ATTACK]; INT32 iAPCost = APBPConstants[AP_MIN_AIM_ATTACK];
UINT16 usInHand; UINT16 usInHand;
#if 0//dnl ch72 180913
UINT16 usTargID;
UINT32 uiMercFlags;
UINT8 ubDirection;
if(pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO)//dnl ch63 240813
usInHand = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]);
else
#endif
// make sure the guy's actually got a throwable item in his hand! // make sure the guy's actually got a throwable item in his hand!
usInHand = pSoldier->inv[HANDPOS].usItem; usInHand = pSoldier->inv[HANDPOS].usItem;
#if 0//dnl ch72 180913 this goes down because of new trait system
if ( ( !(Item[ usInHand ].usItemClass & IC_GRENADE) &&
!(Item[ usInHand ].usItemClass & IC_LAUNCHER)) )
{
//AXP 25.03.2007: See if we are about to throw grenade (grenade was not in hand, but in temp object)
if ( pSoldier->pTempObject != NULL && pSoldier->pThrowParams != NULL &&
pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM && (Item[ pSoldier->pTempObject->usItem ].usItemClass & IC_GRENADE) )
{
//nothing here
}
else
{
#ifdef JA2TESTVERSION
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %d", usInHand );
#endif
return(0);
}
}
if (!TileIsOutOfBounds(sGridNo))
{
// Given a gridno here, check if we are on a guy - if so - get his gridno
if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
{
sGridNo = MercPtrs[ usTargID ]->sGridNo;
}
/*// OK, get a direction and see if we need to turn...
if (ubAddTurningCost)
{
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
// Is it the same as he's facing?
if ( ubDirection != pSoldier->ubDirection )
{
//Lalien: disabled it again
//AXP 25.03.2007: Reenabled look cost
//iAPCost += GetAPsToLook( pSoldier );
}
}*/
}
/*else
{
// Assume we need to add cost!
//iAPCost += GetAPsToLook( pSoldier );
}*/
// if attacking a new target (or if the specific target is uncertain)
//AXP 25.03.2007: Aim-at-same-tile AP cost/bonus doesn't make any sense for thrown objects
//if ( ( sGridNo != pSoldier->sLastTarget ) )
//{
// iAPCost += APBPConstants[AP_CHANGE_TARGET];
//}
//iAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); // moved lower - SANDRO
#endif
// Calculate default top & bottom of the magic "aiming" formula) // Calculate default top & bottom of the magic "aiming" formula)
-52
View File
@@ -798,28 +798,6 @@ void QueryRTLeftButton( UINT32 *puiNewEvent )
{ {
// ATE: Select everybody in squad and make move! // ATE: Select everybody in squad and make move!
{ {
#if 0
SOLDIERTYPE * pTeamSoldier;
INT32 cnt;
SOLDIERTYPE *pFirstSoldier = NULL;
// OK, loop through all guys who are 'multi-selected' and
// check if our currently selected guy is amoung the
// lucky few.. if not, change to a guy who is...
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++ )
{
// Default turn off
pTeamSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED );
// If controllable
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == MercPtrs[ gusSelectedSoldier ]->bAssignment )
{
pTeamSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED;
}
}
EndMultiSoldierSelection( FALSE );
#endif
// Make move! // Make move!
*puiNewEvent = C_MOVE_MERC; *puiNewEvent = C_MOVE_MERC;
@@ -888,36 +866,6 @@ void QueryRTLeftButton( UINT32 *puiNewEvent )
} }
#if 0
fDone = FALSE;
if( GetSoldier( &pSoldier, gusUIFullTargetID ) && gpItemPointer == NULL )
{
if( ( guiUIFullTargetFlags & OWNED_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) &&( pSoldier->bAssignment >= ON_DUTY )&&!( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
fShowAssignmentMenu = TRUE;
gfRTClickLeftHoldIntercepted = TRUE;
CreateDestroyAssignmentPopUpBoxes( );
SetTacticalPopUpAssignmentBoxXY( );
DetermineBoxPositions( );
DetermineWhichAssignmentMenusCanBeShown( );
fFirstClickInAssignmentScreenMask = TRUE;
gfIgnoreScrolling = TRUE;
fDone = TRUE;
}
else
{
fShowAssignmentMenu = FALSE;
CreateDestroyAssignmentPopUpBoxes( );
DetermineWhichAssignmentMenusCanBeShown( );
}
}
if( fDone == TRUE )
{
break;
}
#endif
break; break;
-50
View File
@@ -660,11 +660,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef )
for (ubLoop = 0; ubLoop < pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++) for (ubLoop = 0; ubLoop < pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++)
{ {
ppTile = pDBStructureRef->ppTile; ppTile = pDBStructureRef->ppTile;
#if 0//dnl ch83 080114
sTileGridNo = pCorpseDef->sGridNo + ppTile[ ubLoop ]->sPosRelToBase;
#else
sTileGridNo = AddPosRelToBase(pCorpseDef->sGridNo, ppTile[ubLoop]); sTileGridNo = AddPosRelToBase(pCorpseDef->sGridNo, ppTile[ubLoop]);
#endif
//Remove blood //Remove blood
RemoveBlood( sTileGridNo, pCorpseDef->bLevel ); RemoveBlood( sTileGridNo, pCorpseDef->bLevel );
} }
@@ -1544,52 +1540,6 @@ ROTTING_CORPSE *FindCorpseBasedOnStructure( INT32 sGridNo, INT8 asLevel, STRUCT
void CorpseHit( INT32 sGridNo, INT8 asLevel, UINT16 usStructureID ) void CorpseHit( INT32 sGridNo, INT8 asLevel, UINT16 usStructureID )
{ {
#if 0
STRUCTURE *pStructure, *pBaseStructure;
ROTTING_CORPSE *pCorpse = NULL;
INT32 sBaseGridNo;
pStructure = FindStructureByID( sGridNo, usStructureID );
// Get base....
pBaseStructure = FindBaseStructure( pStructure );
// Find base gridno...
sBaseGridNo = pBaseStructure->sGridNo;
// Get corpse ID.....
pCorpse = FindCorpseBasedOnStructure( sBaseGridNo, asLevel, pBaseStructure );
if ( pCorpse == NULL )
{
#ifdef JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Bullet hit corpse but corpse cannot be found at: %d", sBaseGridNo );
#endif
return;
}
// Twitch the bugger...
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Corpse hit" );
#endif
if ( GridNoOnScreen( sBaseGridNo ) )
{
// Twitch....
// Set frame...
SetAniTileFrame( pCorpse->pAniTile, 1 );
// Go reverse...
pCorpse->pAniTile->uiFlags |= ( ANITILE_BACKWARD | ANITILE_PAUSE_AFTER_LOOP );
// Turn off pause...
pCorpse->pAniTile->uiFlags &= (~ANITILE_PAUSED);
}
// PLay a sound....
PlayJA2Sample( (UINT32)( BULLET_IMPACT_2 ), RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
#endif
} }
void VaporizeCorpse( INT32 sGridNo, INT8 asLevel, UINT16 usStructureID ) void VaporizeCorpse( INT32 sGridNo, INT8 asLevel, UINT16 usStructureID )
-42
View File
@@ -4857,48 +4857,6 @@ BOOLEAN HandleUnjamAnimation( SOLDIERTYPE *pSoldier )
#if 0
//OK, if here, if our health is still good, but we took a lot of damage, try to fall down!
if ( pSoldier->stats.bLife >= OKLIFE )
{
// Randomly fall back or forward, if we are in the standing hit animation
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == RIFLE_STAND_HIT )
{
INT8 bTestDirection = pSoldier->ubDirection;
BOOLEAN fForceDirection = FALSE;
BOOLEAN fDoFallback = FALSE;
// As the damage pretty brutal?
// TRY FALLING BACKWARDS, ( ONLY IF WE ARE A MERC! )
if ( Random( 1000 ) > 40 && IS_MERC_BODY_TYPE( pSoldier ) )
{
// CHECK IF WE HAVE AN ATTACKER, TAKE OPPOSITE DIRECTION!
if ( pSoldier->ubAttackerID != NOBODY )
{
// Find direction!
bTestDirection = (INT8)GetDirectionFromGridNo( MercPtrs[ pSoldier->ubAttackerID ]->sGridNo, pSoldier );
fForceDirection = TRUE;
}
sNewGridNo = NewGridNo( pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( bTestDirection ) ) );
if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->pathing.bLevel ) && OKHeightDest( pSoldier, sNewGridNo ) )
{
// ALL'S OK HERE..... IF WE FORCED DIRECTION, SET!
if ( fForceDirection )
{
pSoldier->EVENT_SetSoldierDirection( bTestDirection );
pSoldier->EVENT_SetSoldierDesiredDirection( bTestDirection );
}
pSoldier->ChangeSoldierState( FALLBACK_HIT_STAND, 0, FALSE );
return;
}
}
}
}
#endif
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState ) BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState )
{ {
-365
View File
@@ -3633,29 +3633,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// Unset paused for no APs..... // Unset paused for no APs.....
this->AdjustNoAPToFinishMove( FALSE ); this->AdjustNoAPToFinishMove( FALSE );
#if 0
// 0verhaul: This is a test. The only time I have been able to make this code hit is when
// the player goes prone while moving. And that is not what this part is intended for. I
// have seen the soldier in the middle of crawling, get up, turn, and then go prone again to
// continue along his path. But this code was not hit for that part. And this code seems
// to be made for that part. So apparently they found another way to deal with it. So
// I disabled the "locked" code for usDontUpdateNewGridNoOnMoveAnimChange since it can cause
// problems of its own. Now we see if we can do without this part too.
if ( usNewState == CRAWLING && this->usDontUpdateNewGridNoOnMoveAnimChange == 1 )
{
if ( this->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE )
{
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_START_UP_FROM_MOVE;
}
// ATE: IF we are starting to crawl, but have to getup to turn first......
if ( this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_START_UP_FROM_MOVE )
{
usNewState = PRONE_UP;
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE;
}
}
#endif
// We are about to start moving // We are about to start moving
// Handle buddy beginning to move... // Handle buddy beginning to move...
@@ -3795,20 +3772,8 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// 0verhaul: Okay, here is a question: Is the "non-interrupt" supposed to be transferrable to other anims? // 0verhaul: Okay, here is a question: Is the "non-interrupt" supposed to be transferrable to other anims?
// That is, if one anim is not interruptable but it chains to another anim, should the "not interruptable" flag // That is, if one anim is not interruptable but it chains to another anim, should the "not interruptable" flag
// remain? I'm going to try out the theory that new animations should reset the "don't interrupt" flag. // remain? I'm going to try out the theory that new animations should reset the "don't interrupt" flag.
#if 0
if ( uiNewAnimFlags & ANIM_NONINTERRUPT )
{
this->flags.fInNonintAnim = TRUE;
}
if ( uiNewAnimFlags & ANIM_RT_NONINTERRUPT )
{
this->flags.fRTInNonintAnim = TRUE;
}
#else
this->flags.fInNonintAnim = (uiNewAnimFlags & ANIM_NONINTERRUPT) != 0; this->flags.fInNonintAnim = (uiNewAnimFlags & ANIM_NONINTERRUPT) != 0;
this->flags.fRTInNonintAnim = (uiNewAnimFlags & ANIM_RT_NONINTERRUPT) != 0; this->flags.fRTInNonintAnim = (uiNewAnimFlags & ANIM_RT_NONINTERRUPT) != 0;
#endif
// CHECK IF WE ARE NOT AIMING, IF NOT, RESET LAST TAGRET! // CHECK IF WE ARE NOT AIMING, IF NOT, RESET LAST TAGRET!
if ( !(gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) && !(gAnimControl[usNewState].uiFlags & ANIM_FIREREADY) ) if ( !(gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) && !(gAnimControl[usNewState].uiFlags & ANIM_FIREREADY) )
@@ -3956,31 +3921,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
{ {
// CHRISL // CHRISL
// SANDRO - APBPConstants[AP_CROUCH] changed to GetAPsCrouch() // SANDRO - APBPConstants[AP_CROUCH] changed to GetAPsCrouch()
#if 0//dnl ch70 160913 this is wrong we cannot just add constants to sAPCost this must be done in GetAPsCrouch and GetAPsProne because all preactions calculation will show incorrect values under cursor
if ( (UsingNewInventorySystem( ) == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND && !this->flags.ZipperFlag )
{
if ( usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF )
{
sAPCost = GetAPsCrouch( this, FALSE ) + 2;
sBPCost = APBPConstants[BP_CROUCH] + 2;
}
else if ( usNewState == KNEEL_DOWN || usNewState == BIGMERC_CROUCH_TRANS_INTO )
{
sAPCost = GetAPsCrouch( this, FALSE ) + 1;
sBPCost = APBPConstants[BP_CROUCH] + 1;
}
else
{
sAPCost = GetAPsCrouch( this, FALSE );
sBPCost = APBPConstants[BP_CROUCH];
}
}
else
{
sAPCost = GetAPsCrouch( this, FALSE );
sBPCost = APBPConstants[BP_CROUCH];
}
#else
if ( UsingNewInventorySystem( ) ) if ( UsingNewInventorySystem( ) )
{ {
if ( usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF ) if ( usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF )
@@ -3999,7 +3939,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
sAPCost = GetAPsCrouch( this, FALSE ); sAPCost = GetAPsCrouch( this, FALSE );
sBPCost = APBPConstants[BP_CROUCH]; sBPCost = APBPConstants[BP_CROUCH];
} }
#endif
DeductPoints( this, sAPCost, sBPCost ); DeductPoints( this, sAPCost, sBPCost );
} }
this->flags.fDontChargeAPsForStanceChange = FALSE; this->flags.fDontChargeAPsForStanceChange = FALSE;
@@ -4017,26 +3956,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
//if ( this->sGridNo == this->pathing.sFinalDestination || this->pathing.usPathIndex == 0 ) //if ( this->sGridNo == this->pathing.sFinalDestination || this->pathing.usPathIndex == 0 )
//{ //{
// CHRISL // CHRISL
#if 0//dnl ch70 160913 this is wrong we cannot just add constants to sAPCost this must be done in GetAPsCrouch and GetAPsProne because all preactions calculation will show incorrect values under cursor
if ( (UsingNewInventorySystem( ) == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND && !this->flags.ZipperFlag )
{
if ( usNewState == PRONE_UP )
{
sAPCost = GetAPsProne( this, FALSE ) + 2;
sBPCost = APBPConstants[BP_PRONE] + 2;
}
else
{
sAPCost = GetAPsProne( this, FALSE ) + 1;
sBPCost = APBPConstants[BP_PRONE] + 1;
}
}
else
{
sAPCost = GetAPsProne( this, FALSE );
sBPCost = APBPConstants[BP_PRONE];
}
#else
if ( UsingNewInventorySystem( ) ) if ( UsingNewInventorySystem( ) )
{ {
if ( usNewState == PRONE_UP ) if ( usNewState == PRONE_UP )
@@ -4055,7 +3974,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
sAPCost = GetAPsProne( this, FALSE ); sAPCost = GetAPsProne( this, FALSE );
sBPCost = APBPConstants[BP_PRONE]; sBPCost = APBPConstants[BP_PRONE];
} }
#endif
DeductPoints( this, sAPCost, sBPCost ); DeductPoints( this, sAPCost, sBPCost );
//} //}
} }
@@ -4394,16 +4312,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
this->flags.fForceShade = FALSE; this->flags.fForceShade = FALSE;
// CHECK IF WE ARE AT AN IDLE ACTION // CHECK IF WE ARE AT AN IDLE ACTION
#if 0
if ( gAnimControl[usNewState].uiFlags & ANIM_IDLE )
{
this->aiData.bAction = ACTION_DONE;
}
else
{
this->aiData.bAction = ACTION_BUSY;
}
#endif
// ATE; For some animations that could use some variations, do so.... // ATE; For some animations that could use some variations, do so....
if ( usNewState == CHARIOTS_OF_FIRE || usNewState == BODYEXPLODING ) if ( usNewState == CHARIOTS_OF_FIRE || usNewState == BODYEXPLODING )
@@ -5030,18 +4938,6 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo )
// break; // break;
//} //}
#if 0
// 0verhaul: This does not go here! In spite of this function's name, it is not the actual "fire" function.
// In fact this sets the muzzle flash even while the soldier may be turning to shoot, which can cause
// problems for real-time shooting.
// The correct place for this is UseGun, which already has code to set or reset the flash.
if ( IsFlashSuppressor( &this->inv[this->ubAttackingHand], this ) )
this->flags.fMuzzleFlash = FALSE;
else
this->flags.fMuzzleFlash = TRUE;
#endif
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "EVENT_FireSoldierWeapon: Muzzle flash = %d", this->flags.fMuzzleFlash ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "EVENT_FireSoldierWeapon: Muzzle flash = %d", this->flags.fMuzzleFlash ) );
@@ -5061,42 +4957,6 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo )
//this->sLastTarget = sTargetGridNo; //this->sLastTarget = sTargetGridNo;
this->ubTargetID = WhoIsThere2( sTargetGridNo, this->bTargetLevel ); this->ubTargetID = WhoIsThere2( sTargetGridNo, this->bTargetLevel );
#if 0
// if (Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN)
{
if ( this->bDoBurst )
{
// This is NOT the bullets to fire. That is done as a check of bDoBurst against the weapon burst count or
// bDoAutofire, or single-fire. So let the bullet count be managed by the firing code.
// Set the TOTAL number of bullets to be fired
// Can't shoot more bullets than we have in our magazine!
if ( this->bDoAutofire )
this->bBulletsLeft = __min( this->bDoAutofire, this->inv[this->ubAttackingHand][0]->data.gun.ubGunShotsLeft );
else
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "EVENT_FireSoldierWeapon: do burst" );
if ( this->bWeaponMode == WM_ATTACHED_GL_BURST )
this->bBulletsLeft = __min( Weapon[GetAttachedGrenadeLauncher( &this->inv[this->ubAttackingHand] )].ubShotsPerBurst, this->inv[this->ubAttackingHand][0]->data.gun.ubGunShotsLeft );
else
this->bBulletsLeft = __min( GetShotsPerBurst( &this->inv[this->ubAttackingHand] ), this->inv[this->ubAttackingHand][0]->data.gun.ubGunShotsLeft );
}
}
else if ( IsValidSecondHandShot( this ) )
{
// two-pistol attack - two bullets!
this->bBulletsLeft = 2;
}
else
{
this->bBulletsLeft = 1;
}
if ( AmmoTypes[this->inv[this->ubAttackingHand][0]->data.gun.ubGunAmmoType].numberOfBullets > 1 )
{
this->bBulletsLeft *= AmmoTypes[this->inv[this->ubAttackingHand][0]->data.gun.ubGunAmmoType].numberOfBullets;
}
}
#endif
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "!!!!!!! Starting attack, bullets left %d", this->bBulletsLeft ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "!!!!!!! Starting attack, bullets left %d", this->bBulletsLeft ) );
// Convert our grid-not into an XY // Convert our grid-not into an XY
@@ -5166,26 +5026,6 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo )
} }
else else
{ {
#if 0//dnl ch72 250913 move this above as need to be done before calling SoldierReadyWeapon
// IF WE ARE IN REAl-TIME, FIRE IMMEDIATELY!
if ( ((gTacticalStatus.uiFlags & REALTIME) || !(gTacticalStatus.uiFlags & INCOMBAT)) )
{
//fDoFireRightAway = TRUE;
}
// Check if our weapon has no intermediate anim...
if ( Item[this->inv[HANDPOS].usItem].rocketlauncher || Item[this->inv[HANDPOS].usItem].grenadelauncher || Item[this->inv[HANDPOS].usItem].mortar )
///* switch( this->inv[ HANDPOS ].usItem )
// {
//case RPG7:
//case ROCKET_LAUNCHER:
//case MORTAR:
//case GLAUNCHER:*/
fDoFireRightAway = TRUE;
// break;
//}
#endif
if ( fDoFireRightAway ) if ( fDoFireRightAway )
{ {
// Set to true so we don't get toasted twice for APs.. // Set to true so we don't get toasted twice for APs..
@@ -5881,24 +5721,6 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "EVENT_SoldierGotHit" ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "EVENT_SoldierGotHit" );
#if 0
// 0verhaul: Under the new ABC system this is no longer necessary.
// ATE: If we have gotten hit, but are still in our attack animation, reduce count!
switch ( this->usAnimState )
{
case SHOOT_ROCKET:
case SHOOT_MORTAR:
case THROW_ITEM:
// <SB> crouch throwing
case THROW_ITEM_CROUCHED:
// <SB> crouch throwing
case LOB_ITEM:
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY HIT ANIMATION, Now %d", gAnimControl[this->usAnimState].zAnimStr, gTacticalStatus.ubAttackBusyCount ) );
ReduceAttackBusyCount( this->ubID, FALSE );
break;
}
#endif
// DO STUFF COMMON FOR ALL TYPES // DO STUFF COMMON FOR ALL TYPES
if ( ubAttackerID != NOBODY ) if ( ubAttackerID != NOBODY )
@@ -5909,22 +5731,6 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
// Set attacker's ID // Set attacker's ID
this->ubAttackerID = ubAttackerID; this->ubAttackerID = ubAttackerID;
#if 0
// 0verhaul: Slashing out more unnecessary and reworked code
if ( !(this->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{
// Increment being attacked count
this->bBeingAttackedCount++;
}
// if defender is a vehicle, there will be no hit animation played!
if ( !(this->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{
// Increment the number of people busy doing stuff because of an attack (busy doing hit anim!)
gTacticalStatus.ubAttackBusyCount++;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "!!!!!!! Person got hit, attack count now %d", gTacticalStatus.ubAttackBusyCount ) );
}
#endif
// ATE; Save hit location info...( for later anim determination stuff ) // ATE; Save hit location info...( for later anim determination stuff )
this->ubHitLocation = ubHitLocation; this->ubHitLocation = ubHitLocation;
@@ -6248,34 +6054,6 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
} }
#if 0
// 0verhaul: None of this hairyness is necessary anymore! Hazaa!
// CJC: moved to after SoldierTakeDamage so that any quotes from the defender
// will not be said if they are knocked out or killed
if ( ubReason != TAKE_DAMAGE_TENTACLES && ubReason != TAKE_DAMAGE_OBJECT )
{
// OK, OK: THis is hairy, however, it's ness. because the normal freeup call uses the
// attckers intended target, and here we want to use thier actual target....
// ATE: If it's from GUNFIRE damage, keep in mind bullets...
if ( Item[usWeaponIndex].usItemClass & IC_GUN )
{
pNewSoldier = FreeUpAttackerGivenTarget( this->ubAttackerID, this->ubID );
}
else
{
pNewSoldier = ReduceAttackBusyGivenTarget( this->ubAttackerID, this->ubID );
}
if ( pNewSoldier != NULL )
{
//warning, if this code is ever uncommented, rename all this
//to this in this function, then init this to this
this = pNewSoldier;
}
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "!!!!!!! Tried to free up attacker, attack count now %d", gTacticalStatus.ubAttackBusyCount ) );
}
#endif
// Flugente: moved the damage calculation into a separate function // Flugente: moved the damage calculation into a separate function
sBreathLoss = max( 1, (INT16)(sBreathLoss * (100 - this->GetDamageResistance( FALSE, TRUE )) / 100) ); sBreathLoss = max( 1, (INT16)(sBreathLoss * (100 - this->GetDamageResistance( FALSE, TRUE )) / 100) );
@@ -7337,14 +7115,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT32 sDestGridNo, UINT16
} }
// we can use the soldier's level here because we don't have pathing across levels right now... // we can use the soldier's level here because we don't have pathing across levels right now...
#if 0
// Uhhmmmm, the name of this function has "NEWPath" in it.
if ( this->pathing.bPathStored )
{
fContinue = TRUE;
}
else
#endif
{ {
iDest = FindBestPath( this, sDestGridNo, this->pathing.bLevel, usMovementAnim, COPYROUTE, fFlags ); iDest = FindBestPath( this, sDestGridNo, this->pathing.bLevel, usMovementAnim, COPYROUTE, fFlags );
fContinue = (iDest != 0); fContinue = (iDest != 0);
@@ -8788,32 +8558,6 @@ UINT8 gRedGlowR[] =
}; };
#if 0
UINT8 gOrangeGlowR[] =
{
0, // Normal shades
20,
40,
60,
80,
100,
120,
140,
160,
180,
0, // For gray palettes
20,
40,
60,
80,
100,
120,
140,
160,
180,
};
#endif
UINT8 gOrangeGlowR[] = UINT8 gOrangeGlowR[] =
{ {
@@ -8842,32 +8586,6 @@ UINT8 gOrangeGlowR[] =
}; };
#if 0
UINT8 gOrangeGlowG[] =
{
0, // Normal shades
5,
10,
25,
30,
35,
40,
45,
50,
55,
0, // For gray palettes
5,
10,
25,
30,
35,
40,
45,
50,
55,
};
#endif
UINT8 gOrangeGlowG[] = UINT8 gOrangeGlowG[] =
{ {
@@ -12036,28 +11754,6 @@ UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier )
return(atan8( sXPos2, sYPos2, sXPos, sYPos )); return(atan8( sXPos2, sYPos2, sXPos, sYPos ));
} }
#if 0
UINT8 atan8( INT16 x1, INT16 y1, INT16 x2, INT16 y2 )
{
static int trig[8] = {2, 3, 4, 5, 6, 7, 8, 1};
// returned values are N=1, NE=2, E=3, SE=4, S=5, SW=6, W=7, NW=8
double dx = (x2 - x1);
double dy = (y2 - y1);
double a;
int i, k;
if ( dx == 0 )
dx = 0.00390625; // 1/256th
#define PISLICES (8)
a = (atan2( dy, dx ) + PI / PISLICES) / (PI / (PISLICES / 2));
i = (int)a;
if ( a>0 )
k = i; else
if ( a<0 )
k = i + (PISLICES - 1); else
k = 0;
return(trig[k]);
}
#endif
//#if 0 //#if 0
UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 ) UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 )
@@ -12420,22 +12116,6 @@ void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT32 sDestGridNo, UINT1
void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance ) void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance )
{ {
#if 0
EV_S_CHANGESTANCE SChangeStance;
#ifdef NETWORKED
if ( !IsTheSolderUnderMyControl( pSoldier->ubID ) )
return;
#endif
SChangeStance.ubNewStance = ubNewStance;
SChangeStance.usSoldierID = pSoldier->ubID;
SChangeStance.sXPos = pSoldier->sX;
SChangeStance.sYPos = pSoldier->sY;
SChangeStance.uiUniqueId = pSoldier->uiUniqueSoldierIdValue;
AddGameEvent( S_CHANGESTANCE, 0, &SChangeStance );
#endif
if ( ((pSoldier->ubID > 19 && !is_server) || (pSoldier->ubID > 119 && is_server)) && is_networked )return; if ( ((pSoldier->ubID > 19 && !is_server) || (pSoldier->ubID > 119 && is_server)) && is_networked )return;
@@ -12458,51 +12138,6 @@ void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo )
AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon ); AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon );
} }
#if 0
// This function is now obsolete. Just call ReduceAttackBusyCount.
// This function just encapolates the check for turnbased and having an attacker in the first place
void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier )
{
INT32 cnt;
UINT8 ubNumToFree;
//if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) )
{
// ATE: Removed...
//if ( pSoldier->ubAttackerID != NOBODY )
{
// JA2 Gold
// set next-to-previous attacker, so long as this isn't a repeat attack
if ( pSoldier->ubPreviousAttackerID != pSoldier->ubAttackerID )
{
pSoldier->ubNextToPreviousAttackerID = pSoldier->ubPreviousAttackerID;
}
// get previous attacker id
pSoldier->ubPreviousAttackerID = pSoldier->ubAttackerID;
// Copy BeingAttackedCount here....
ubNumToFree = pSoldier->bBeingAttackedCount;
// Zero it out BEFORE, as supression may increase it again...
pSoldier->bBeingAttackedCount = 0;
for ( cnt = 0; cnt < ubNumToFree; cnt++ )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "@@@@@@@ Freeing up attacker of %d (attacker is %d) - releasesoldierattacker num to free is %d", pSoldier->ubID, pSoldier->ubAttackerID, ubNumToFree ) );
ReduceAttackBusyCount( pSoldier->ubAttackerID, FALSE );
}
// ATE: Set to NOBODY if this person is NOT dead
// otherise, we keep it so the kill can be awarded!
if ( pSoldier->stats.bLife != 0 && pSoldier->ubBodyType != QUEENMONSTER )
{
pSoldier->ubAttackerID = NOBODY;
}
}
}
}
#endif
BOOLEAN SOLDIERTYPE::MercInWater( void ) BOOLEAN SOLDIERTYPE::MercInWater( void )
{ {
-12
View File
@@ -357,18 +357,6 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b
} }
else else
{ {
#if 0
// Check if there is a reserved marker here at least....
sNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirection ) );
if ( ( gpWorldLevelData[ sNewGridNo ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) )
{
if ( gpWorldLevelData[ sNewGridNo ].ubReservedSoldierID != pSoldier->ubID )
{
return( MOVE_TILE_TEMP_BLOCKED );
}
}
#endif
} }
} }
-23
View File
@@ -2975,14 +2975,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
} }
break; break;
#if 0//dnl ch75 021113
case '\"':
Testing(1);
break;
case '\'':
Testing(2);
break;
#endif
case '`': case '`':
@@ -4232,21 +4224,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
} }
else if ( fCtrl ) else if ( fCtrl )
{ {
#if 0
if ( INFORMATION_CHEAT_LEVEL() )
{
if ( gfUIShowCurIntTile ^= TRUE )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection ON." );
gubIntTileCheckFlags = INTILE_CHECK_FULL;
}
else
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection OFF." );
gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE;
}
}
#endif
} }
else else
{ {
-14
View File
@@ -2018,20 +2018,6 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridN
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
BOOLEAN fMadeCorpse = FALSE; BOOLEAN fMadeCorpse = FALSE;
#if 0
{
// injure someone inside
iRand = Random( gNewVehicle[ pVehicleList[ ubID ].ubVehicleType ].iNewSeatingCapacities );
if( pVehicleList[ ubID ].pPassengers[ iRand ] )
{
// hurt this person
InjurePersonInVehicle( ( INT16 )ubID, pVehicleList[ ubID ].pPassengers[ iRand ], ( UINT8 )( sDmg / 2 ) );
}
}
ScreenMsg( FONT_BLACK, MSG_INTERFACE, sCritLocationStrings[ iCrit ] );
}
#endif
pSoldier = GetSoldierStructureForVehicle( ubID ); pSoldier = GetSoldierStructureForVehicle( ubID );
Assert(pSoldier); Assert(pSoldier);
-13
View File
@@ -875,19 +875,6 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM
{ //all armed bombs are buried { //all armed bombs are buried
dummyItem.bVisible = BURIED; dummyItem.bVisible = BURIED;
} }
#if 0//dnl ch74 201013 this is already done in OBJECTTYPE::Load()
//Madd: ok, so this drives me nuts -- why bother with default attachments if the map isn't going to load them for you?
//this should fix that...
for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++)
{
if(Item [ dummyItem.object.usItem ].defaultattachments[cnt] == 0)
break;
OBJECTTYPE defaultAttachment;
CreateItem(Item [ dummyItem.object.usItem ].defaultattachments[cnt],100,&defaultAttachment);
dummyItem.object.AttachObject(NULL,&defaultAttachment, FALSE);
}
#endif
// sevenfm: don't allow max repair threshold less than current object status // sevenfm: don't allow max repair threshold less than current object status
dummyItem.object[0]->data.sRepairThreshold = __max(dummyItem.object[0]->data.sRepairThreshold, dummyItem.object[0]->data.objectStatus); dummyItem.object[0]->data.sRepairThreshold = __max(dummyItem.object[0]->data.sRepairThreshold, dummyItem.object[0]->data.objectStatus);
AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID, &iItemIndex ); AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID, &iItemIndex );
-10
View File
@@ -189,18 +189,8 @@ lbepocketParseData * pData = (lbepocketParseData *)userData;
else if(strcmp(name, "pName") == 0) else if(strcmp(name, "pName") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
strcpy(pData->curLBEPocket.pName,pData->szCharData);
else
{
strncpy(pData->curLBEPocket.pName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curLBEPocket.pName[MAX_CHAR_DATA_LENGTH] = '\0';
}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curLBEPocket.pName, sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) ); MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curLBEPocket.pName, sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) );
pData->curLBEPocket.pName[sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) - 1] = '\0'; pData->curLBEPocket.pName[sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) - 1] = '\0';
#endif
} }
else if(strcmp(name, "pSilhouette") == 0) else if(strcmp(name, "pSilhouette") == 0)
{ {
-9
View File
@@ -554,15 +554,6 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q
ConvertGridNoToCenterCellXY( pBullet->sGridNo, &sXPos, &sYPos ); ConvertGridNoToCenterCellXY( pBullet->sGridNo, &sXPos, &sYPos );
LightSpritePosition( pBullet->pAniTile->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE)); LightSpritePosition( pBullet->pAniTile->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE));
#if 0
if ( pBullet->pFirer->pathing.bLevel > 0 ) // if firer on roof then
{
if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area
{
LightSpritePower( pBullet->pAniTile->lightSprite, FALSE);
}
}
#endif
return; return;
} }
-10
View File
@@ -1383,16 +1383,6 @@ INT16 DistanceVisible(SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
// let tanks see and be seen further (at night) // let tanks see and be seen further (at night)
if ( (ARMED_VEHICLE( pSoldier ) && sDistVisible > 0) || (pSubject && ARMED_VEHICLE( pSubject )) ) if ( (ARMED_VEHICLE( pSoldier ) && sDistVisible > 0) || (pSubject && ARMED_VEHICLE( pSubject )) )
{ {
#if 0
if ( ARMED_VEHICLE(pSoldier) && sDistVisible > 0 && pSubject)
{
sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) );
}
else
{
sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() );
}
#endif
// 0verhaul: This bit of code 1) seems to have no real reason to exist (MaxDistVisible just calls this function anyway), // 0verhaul: This bit of code 1) seems to have no real reason to exist (MaxDistVisible just calls this function anyway),
// and 2) causes infinite recursion because MaxDistVisible just calls this function, which comes right back here. Just // and 2) causes infinite recursion because MaxDistVisible just calls this function, which comes right back here. Just
// add 5 to sDistVisible and go on. // add 5 to sDistVisible and go on.
-19
View File
@@ -1921,25 +1921,6 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
UINT16 usHandItem = pSoldier->inv[HANDPOS].usItem; UINT16 usHandItem = pSoldier->inv[HANDPOS].usItem;
INT8 bSlot; INT8 bSlot;
#if 0//dnl ch64 260813 decision to use machinegun or cannon is done in DecideAction, this here will just lead into burst with cannon if decision was use machinegun
if (TANK(pSoldier))
{
// No cannon selected to fire
if (!Item[pSoldier->inv[HANDPOS].usItem].cannon)
{
// 50 % chance, that the tank fires with the explosive cannon
UINT32 fireWithCannon = GetRndNum(2);
if (fireWithCannon)
{
UINT32 tankCannonIndex = GetTankCannonIndex();
if (tankCannonIndex > 0)
{
usHandItem = tankCannonIndex;
}
}
}
}
#endif
UINT16 usSoldierIndex; // added by SANDRO UINT16 usSoldierIndex; // added by SANDRO
#ifdef TESTAICONTROL #ifdef TESTAICONTROL
-78
View File
@@ -2946,85 +2946,7 @@ INT32 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp )
BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp )
{ {
#if 1
return FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel) != DIRECTION_IRRELEVANT; return FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel) != DIRECTION_IRRELEVANT;
#else
BUILDING * pBuilding;
INT32 i;
INT32 iSearchRange = 1;
INT16 sMaxLeft, sMaxRight, sMaxUp, sMaxDown, sXOffset, sYOffset;
//DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , "CanClimbFromHere");
// determine maximum horizontal limits
sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL));
sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1));
// determine maximum vertical limits
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
sMaxDown = min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1));
INT32 sGridNo=NOWHERE;
for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++)
{
for (sXOffset = -sMaxLeft; sXOffset <= sMaxRight; sXOffset++)
{
// calculate the next potential gridno
sGridNo = pSoldier->sGridNo + sXOffset + (MAXCOL * sYOffset);
//DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Checking grid %d" , sGridNo ));
//NumMessage("Testing gridno #",gridno);
if ( !(sGridNo >=0 && sGridNo < WORLD_MAX) )
{
continue;
}
if ( sGridNo == pSoldier->pathing.sBlackList )
{
continue;
}
// OK, this place shows potential. How useful is it as cover?
//NumMessage("Promising seems gridno #",gridno);
// Kaiden: From this point down I've removed an unneccessary call to
// FindBuilding, The original code that was from this point till the
// end of the function is now commented out AFTER the function.
pBuilding = FindBuilding ( sGridNo );
if ( pBuilding != NULL)
{
if ( fUp )
{
for (i = 0 ; i < pBuilding->ubNumClimbSpots; i++)
{
if (pBuilding->sUpClimbSpots[ i ] == pSoldier->sGridNo &&
(WhoIsThere2( pBuilding->sUpClimbSpots[ i ], 0 ) == NOBODY)
&& (WhoIsThere2( pBuilding->sDownClimbSpots[ i ], 1 ) == NOBODY) )
return TRUE;
}
}
else
{
for (i = 0 ; i < pBuilding->ubNumClimbSpots; i++)
{
if (pBuilding->sDownClimbSpots[ i ] == pSoldier->sGridNo &&
(WhoIsThere2( pBuilding->sUpClimbSpots[ i ], 0 ) == NOBODY)
&& (WhoIsThere2( pBuilding->sDownClimbSpots[ i ], 1 ) == NOBODY) )
return TRUE;
}
}
}
}
}
return FALSE;
#endif
} }
// OK, this place shows potential. How useful is it as cover? // OK, this place shows potential. How useful is it as cover?
//NumMessage("Promising seems gridno #",gridno); //NumMessage("Promising seems gridno #",gridno);
-131
View File
@@ -12,68 +12,14 @@
#include "SaveLoadMap.h" #include "SaveLoadMap.h"
#include "Text.h" #include "Text.h"
#if 0//dnl ch86 180214
BOOLEAN gfLoadingExitGrids = FALSE;
//used by editor.
EXITGRID gExitGrid = {0,1,1,0};
BOOLEAN gfOverrideInsertionWithExitGrid = FALSE;
//<SB>
#define MAX_EXITGRIDS 4096
EXITGRID gpExitGrids[MAX_EXITGRIDS];
UINT guiExitGridsCount = 0;
//INT32 ConvertExitGridToINT32( EXITGRID *pExitGrid )
//{
// INT32 iExitGridInfo;
// iExitGridInfo = (pExitGrid->ubGotoSectorX-1)<< 28;
// iExitGridInfo += (pExitGrid->ubGotoSectorY-1)<< 24;
// iExitGridInfo += pExitGrid->ubGotoSectorZ << 20;
// iExitGridInfo += pExitGrid->usGridNo & 0x0000ffff;
// return iExitGridInfo;
//}
//
//void ConvertINT32ToExitGrid( INT32 iExitGridInfo, EXITGRID *pExitGrid )
//{
// //convert the int into 4 unsigned bytes.
// pExitGrid->ubGotoSectorX = (UINT8)(((iExitGridInfo & 0xf0000000)>>28)+1);
// pExitGrid->ubGotoSectorY = (UINT8)(((iExitGridInfo & 0x0f000000)>>24)+1);
// pExitGrid->ubGotoSectorZ = (UINT8)((iExitGridInfo & 0x00f00000)>>20);
// pExitGrid->usGridNo = (UINT16)(iExitGridInfo & 0x0000ffff);
//}
#else
BOOLEAN gfLoadingExitGrids = FALSE; BOOLEAN gfLoadingExitGrids = FALSE;
BOOLEAN gfOverrideInsertionWithExitGrid = FALSE; BOOLEAN gfOverrideInsertionWithExitGrid = FALSE;
EXITGRID gExitGrid; EXITGRID gExitGrid;
EXITGRID *ExitGridTable = NULL; EXITGRID *ExitGridTable = NULL;
UINT16 gusNumExitGrids = 0; UINT16 gusNumExitGrids = 0;
#endif
BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid ) BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid )
{ {
#if 0//dnl ch86 170214
LEVELNODE *pShadow;
pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead;
//Search through object layer for an exitgrid
while( pShadow )
{
if ( pShadow->uiFlags & LEVELNODE_EXITGRID )
{
//<SB>
// ConvertINT32ToExitGrid( pShadow->iExitGridInfo, pExitGrid );
memcpy(pExitGrid, pShadow->pExitGridInfo, sizeof(EXITGRID));
//</SB>
return TRUE;
}
pShadow = pShadow->pNext;
}
return FALSE;
#else
INT32 i = 0; INT32 i = 0;
while(i < gusNumExitGrids) while(i < gusNumExitGrids)
{ {
@@ -85,7 +31,6 @@ BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid )
i++; i++;
} }
return(FALSE); return(FALSE);
#endif
} }
BOOLEAN ExitGridAtGridNo( UINT32 usMapIndex ) BOOLEAN ExitGridAtGridNo( UINT32 usMapIndex )
@@ -123,42 +68,6 @@ BOOLEAN GetExitGridLevelNode( UINT32 usMapIndex, LEVELNODE **ppLevelNode )
void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ) void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid )
{ {
#if 0//dnl ch86 180214
LEVELNODE *pShadow, *tail;
pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead;
//Search through object layer for an exitgrid
while( pShadow )
{
tail = pShadow;
if( pShadow->uiFlags & LEVELNODE_EXITGRID )
{ //we have found an existing exitgrid in this node, so replace it with the new information.
memcpy(pShadow->pExitGridInfo, pExitGrid, sizeof(EXITGRID));//dnl ch80 011213
return;
}
pShadow = pShadow->pNext;
}
// Add levelnode
AddShadowToHead( iMapIndex, MOCKFLOOR1 );
// Get new node
pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead;
//fill in the information for the new exitgrid levelnode.
//<SB>
// pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid );
memcpy(gpExitGrids + guiExitGridsCount, pExitGrid, sizeof(EXITGRID));
pShadow->pExitGridInfo = gpExitGrids + guiExitGridsCount;
guiExitGridsCount++;
//</SB>
pShadow->uiFlags |= ( LEVELNODE_EXITGRID | LEVELNODE_HIDDEN );
//Add the exit grid to the sector, only if we call ApplyMapChangesToMapTempFile() first.
if( !gfEditMode && !gfLoadingExitGrids )
{
AddExitGridToMapTempFile( iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
}
#else
pExitGrid->iMapIndex = iMapIndex; pExitGrid->iMapIndex = iMapIndex;
INT32 i = 0, j = -1; INT32 i = 0, j = -1;
while(i < gusNumExitGrids) while(i < gusNumExitGrids)
@@ -196,18 +105,10 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid )
if(!gfEditMode && !gfLoadingExitGrids) if(!gfEditMode && !gfLoadingExitGrids)
AddExitGridToMapTempFile(iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ); AddExitGridToMapTempFile(iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
} }
#endif
} }
void RemoveExitGridFromWorld( INT32 iMapIndex ) void RemoveExitGridFromWorld( INT32 iMapIndex )
{ {
#if 0//dnl ch86 180214
UINT16 usDummy;
if( TypeExistsInShadowLayer( iMapIndex, MOCKFLOOR, &usDummy ) )
{
RemoveAllShadowsOfTypeRange( iMapIndex, MOCKFLOOR, MOCKFLOOR );
}
#else
INT32 i = 0; INT32 i = 0;
while(i < gusNumExitGrids) while(i < gusNumExitGrids)
{ {
@@ -219,7 +120,6 @@ void RemoveExitGridFromWorld( INT32 iMapIndex )
} }
i++; i++;
} }
#endif
} }
void TrashExitGridTable(void)//dnl ch86 170214 void TrashExitGridTable(void)//dnl ch86 170214
@@ -284,37 +184,15 @@ void LoadExitGrids(INT8** hBuffer, FLOAT dMajorMapVersion)
UINT16 usNumExitGrids; UINT16 usNumExitGrids;
INT32 usMapIndex; INT32 usMapIndex;
EXITGRID ExitGrid; EXITGRID ExitGrid;
#if 0//dnl ch86 170214
// New world is loading so trash all old EXITGRID's
memset(gpExitGrids, 0, sizeof(gpExitGrids));
guiExitGridsCount = 0;
#else
TrashExitGridTable(); TrashExitGridTable();
#endif
gfLoadingExitGrids = TRUE; gfLoadingExitGrids = TRUE;
LOADDATA(&usNumExitGrids, *hBuffer, sizeof(usNumExitGrids)); LOADDATA(&usNumExitGrids, *hBuffer, sizeof(usNumExitGrids));
for(int i=0; i<usNumExitGrids; i++) for(int i=0; i<usNumExitGrids; i++)
{ {
#if 0//dnl ch86 170214
if(dMajorMapVersion < 7.0)
{
UINT16 usOldMapIndex;
LOADDATA(&usOldMapIndex, *hBuffer, sizeof(usOldMapIndex));
usMapIndex = usOldMapIndex;
}
else
LOADDATA(&usMapIndex, *hBuffer, sizeof(usMapIndex));
ExitGrid.Load(hBuffer, dMajorMapVersion);
//dnl ch44 280909 EXITGRID translation
gMapTrn.GetTrnCnt(usMapIndex);
//gMapTrn.GetTrnCnt(ExitGrid.usGridNo);//dnl ch56 151009 This is gridno in sector which size you don't know, so no translation here
AddExitGridToWorld(usMapIndex, &ExitGrid);
#else
ExitGrid.Load(hBuffer, dMajorMapVersion); ExitGrid.Load(hBuffer, dMajorMapVersion);
gMapTrn.GetTrnCnt(ExitGrid.iMapIndex); gMapTrn.GetTrnCnt(ExitGrid.iMapIndex);
usMapIndex = ExitGrid.iMapIndex; usMapIndex = ExitGrid.iMapIndex;
AddExitGridToWorld(usMapIndex, &ExitGrid); AddExitGridToWorld(usMapIndex, &ExitGrid);
#endif
} }
gfLoadingExitGrids = FALSE; gfLoadingExitGrids = FALSE;
} }
@@ -329,15 +207,6 @@ void SaveExitGrids(HWFILE hFile, UINT16 usNumExitGrids, FLOAT dMajorMapVersion,
{ {
if(GetExitGrid(i, &ExitGrid)) if(GetExitGrid(i, &ExitGrid))
{ {
#if 0//dnl ch86 170214
if(dMajorMapVersion < 7.0)
{
UINT16 usOldMapIndex = i;
FileWrite(hFile, &usOldMapIndex, sizeof(usOldMapIndex), &uiBytesWritten);
}
else
FileWrite(hFile, &i, sizeof(i), &uiBytesWritten);
#endif
ExitGrid.Save(hFile, dMajorMapVersion, ubMinorMapVersion); ExitGrid.Save(hFile, dMajorMapVersion, ubMinorMapVersion);
usNumSaved++; usNumSaved++;
} }
-8
View File
@@ -821,11 +821,7 @@ INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextC
{ {
if ( !(ppTile[ ubLoop ]->fFlags & TILE_ON_ROOF ) ) if ( !(ppTile[ ubLoop ]->fFlags & TILE_ON_ROOF ) )
{ {
#if 0//dnl ch83 080114
sStructGridNo = pBase->sGridNo + ppTile[ubLoop]->sPosRelToBase;
#else
sStructGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); sStructGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]);
#endif
// there might be two structures in this tile, one on each level, but we just want to // there might be two structures in this tile, one on each level, but we just want to
// delete one on each pass // delete one on each pass
@@ -1456,11 +1452,7 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++) for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
{ {
#if 0//dnl ch83 080114
sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
#else
sNewGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); sNewGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]);
#endif
// look in adjacent tiles // look in adjacent tiles
for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ ) for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ )
{ {
-39
View File
@@ -669,16 +669,6 @@ BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY )
return( TRUE ); return( TRUE );
} }
#if 0
// 0verhaul
// I did that (or actually uncasted a bunch of stuff and re-typed others to correct them), so
// no worries
// (jonathanl) to save me having to cast all the previous code
BOOLEAN GetMouseMapPos( UINT32 *psMapPos )
{
return GetMouseMapPos( (INT32 *)psMapPos );
}
#endif
BOOLEAN GetMouseMapPos( INT32 *psMapPos ) BOOLEAN GetMouseMapPos( INT32 *psMapPos )
{ {
@@ -1309,11 +1299,7 @@ BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo )
// Get screen coordinates for current position of soldier // Get screen coordinates for current position of soldier
GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY); GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY);
#if 0//dnl ch53 151009
if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) && sWorldY > 20 && sWorldY < ( gsBLY - gsTLY - 20 ) )
#else
if ( sWorldX >= 30 && sWorldX <= (gsTRX - gsTLX - 30) && sWorldY >= 20 && sWorldY <= (gsBLY - gsTLY - 10) ) if ( sWorldX >= 30 && sWorldX <= (gsTRX - gsTLX - 30) && sWorldY >= 20 && sWorldY <= (gsBLY - gsTLY - 10) )
#endif
{ {
return GridNoOnWalkableWorldTile(sGridNo); return GridNoOnWalkableWorldTile(sGridNo);
} }
@@ -1321,31 +1307,6 @@ BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo )
return( FALSE ); return( FALSE );
} }
#if 0//dnl ch53 101009
// This function is used when we care about astetics with the top Y portion of the
// gma eplay area
// mostly due to UI bar that comes down....
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT32 sGridNo )
{
INT16 sWorldX;
INT16 sWorldY;
INT16 sXMapPos, sYMapPos;
// Check for valid gridno...
ConvertGridNoToXY( sGridNo, &sXMapPos, &sYMapPos );
// Get screen coordinates for current position of soldier
GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY);
if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) &&
sWorldY > 40 && sWorldY < ( gsBLY - gsTLY - 20 ) )
{
return( TRUE );
}
return( FALSE );
}
#endif
BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection ) BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection )
{ {
-4
View File
@@ -208,11 +208,7 @@ void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo )
for ( ubLoop = 0; ubLoop < pBase->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++ ) for ( ubLoop = 0; ubLoop < pBase->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++ )
{ {
ppTile = pBase->pDBStructureRef->ppTile; ppTile = pBase->pDBStructureRef->ppTile;
#if 0//dnl ch83 080114
sGridNo = pBase->sGridNo + ppTile[ ubLoop ]->sPosRelToBase;
#else
sGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); sGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]);
#endif
if (sGridNo < 0 || sGridNo > WORLD_MAX) if (sGridNo < 0 || sGridNo > WORLD_MAX)
{ {
continue; continue;
-72
View File
@@ -540,12 +540,6 @@ UINT8 ubTravelCost;
//bDirection = atan8( iX, iY, iSrcX, iSrcY ); //bDirection = atan8( iX, iY, iSrcX, iSrcY );
bDirection = atan8( iSrcX, iSrcY, iX, iY ); bDirection = atan8( iSrcX, iSrcY, iX, iY );
#if 0
if ( usTileNo == 20415 && bDirection == 3 )
{
int i = 0;
}
#endif
ubTravelCost = gubWorldMovementCosts[ usTileNo ][ bDirection ][ 0 ]; ubTravelCost = gubWorldMovementCosts[ usTileNo ][ bDirection ][ 0 ];
@@ -564,50 +558,6 @@ UINT8 ubTravelCost;
} }
} }
#if 0
pStruct = gpWorldLevelData[ usTileNo ].pStructHead;
while ( pStruct != NULL )
{
if ( pStruct->usIndex < giNumberOfTiles )
{
GetTileType( pStruct->usIndex, &uiType );
// ATE: Changed to use last decordations rather than last decal
// Could maybe check orientation value? Depends on our
// use of the orientation value flags..
if((uiType >= FIRSTWALL) && (uiType <=LASTDECORATIONS ))
{
GetWallOrientation(pStruct->usIndex, &usWallOrientation);
bWallCount++;
}
}
pStruct=pStruct->pNext;
}
if ( bWallCount )
{
// ATE: If TWO or more - assume it's BLOCKED and return TRUE
if ( bWallCount != 1 )
{
return( TRUE );
}
switch(usWallOrientation)
{
case INSIDE_TOP_RIGHT:
case OUTSIDE_TOP_RIGHT:
return( iSrcX < iX );
case INSIDE_TOP_LEFT:
case OUTSIDE_TOP_LEFT:
return( iSrcY < iY );
}
}
#endif
return(FALSE); return(FALSE);
} }
@@ -2152,28 +2102,6 @@ BOOLEAN LightIlluminateWall(INT16 iSourceX, INT16 iSourceY, INT16 iTileX, INT16
// return( LightTileHasWall( iSourceX, iSourceY, iTileX, iTileY ) ); // return( LightTileHasWall( iSourceX, iSourceY, iTileX, iTileY ) );
#if 0
UINT16 usWallOrientation;
GetWallOrientation(pStruct->usIndex, &usWallOrientation);
switch(usWallOrientation)
{
case NO_ORIENTATION:
return(TRUE);
case INSIDE_TOP_RIGHT:
case OUTSIDE_TOP_RIGHT:
return(iSourceX >= iTileX);
case INSIDE_TOP_LEFT:
case OUTSIDE_TOP_LEFT:
return(iSourceY >= iTileY);
}
return(FALSE);
#endif
return( TRUE ); return( TRUE );
} }
-7
View File
@@ -995,15 +995,8 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
// Black color for the background! // Black color for the background!
//ColorFillVideoSurfaceArea( FRAME_BUFFER, sStartPointX_S, sStartPointY_S, sEndXS, sEndYS, 0 ); //ColorFillVideoSurfaceArea( FRAME_BUFFER, sStartPointX_S, sStartPointY_S, sEndXS, sEndYS, 0 );
#if 0//dnl ch79 291113
if(gfTacticalPlacementGUIActive)//dnl ch45 021009 Skip overwrite buttons area which is not refresh during scroll //dnl ch77 211113
ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-160, 0);
else
ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-120, 0);
#else
if(uiVSurface == FRAME_BUFFER)//dnl ch82 090114 if(uiVSurface == FRAME_BUFFER)//dnl ch82 090114
ColorFillVideoSurfaceArea(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-(gfTacticalPlacementGUIActive?160:120), 0); ColorFillVideoSurfaceArea(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-(gfTacticalPlacementGUIActive?160:120), 0);
#endif
fInterfacePanelDirty = DIRTYLEVEL2; fInterfacePanelDirty = DIRTYLEVEL2;
InvalidateScreen(); InvalidateScreen();
-37
View File
@@ -1457,43 +1457,6 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject )
#if 0
{
LEVELNODE *pNode;
INT32 sNewGridNo;
//Determine new gridno
sNewGridNo = MAPROWCOLTOPOS( ( pObject->Position.y / CELL_Y_SIZE ), ( pObject->Position.x / CELL_X_SIZE ) );
// Look at old gridno
if ( sNewGridNo != pObject->sGridNo )
{
// We're at a new gridno!
// First find levelnode of our object and delete
pNode = gpWorldLevelData[ pObject->sGridNo ].pStructHead;
// LOOP THORUGH OBJECT LAYER
while( pNode != NULL )
{
if ( pNode->uiFlags & LEVELNODE_PHYSICSOBJECT )
{
if ( pNode->iPhysicsObjectID == pObject->iID )
{
RemoveStruct( pObject->sGridNo, pNode->usIndex );
break;
}
}
pNode = ppNode->pNext;
}
// Set new gridno, add
}
// Add new object / update position
}
#endif
void ObjectHitWindow( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ) void ObjectHitWindow( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce )
{ {
-57
View File
@@ -354,14 +354,6 @@ UINT32 uiAdditiveLayerUsedFlags = 0xffffffff;
// Array of shade values to use..... // Array of shade values to use.....
#define NUM_GLOW_FRAMES 30 #define NUM_GLOW_FRAMES 30
#if 0
INT16 gsGlowFrames[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
};
#endif
INT16 gsGlowFrames[] = INT16 gsGlowFrames[] =
{ {
@@ -1608,28 +1600,6 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
{ {
if (fUseTileElem) if (fUseTileElem)
{ {
#if 0
// DONOT RENDER IF IT'S A HIDDEN STRUCT AND TILE IS NOT REVEALED
if (uiTileElemFlags & HIDDEN_TILE)
{
// IF WORLD IS NOT REVEALED, QUIT
#ifdef JA2EDITOR
if (!gfEditMode)
#endif
{
if (!(gpWorldLevelData[uiTileIndex].uiFlags & MAPELEMENT_REVEALED) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS))
{
//CONTINUE, DONOT RENDER
if (!fLinkedListDirection)
pNode = pNode->pPrevNode;
else
pNode = pNode->pNext;
continue;
}
}
}
#endif
} }
} }
@@ -9084,33 +9054,6 @@ void SetMercGlowNormal( )
#if 0
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING )
{
if ( sZOffsetY > 0 )
{
sZOffsetY++;
}
if ( sZOffsetX > 0 )
{
sZOffsetX++;
}
}
sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\
sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\
if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) )\
{\
sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\
sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\
\
sWorldY = GetMapXYWorldY( sMapX + sZOffsetX, sMapY + sZOffsetY );\
}\
else
#endif
void SetRenderCenter( INT16 sNewX, INT16 sNewY ) void SetRenderCenter( INT16 sNewX, INT16 sNewY )
-20
View File
@@ -660,11 +660,7 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
} }
ppTile = pDBStructureRef->ppTile; ppTile = pDBStructureRef->ppTile;
#if 0//dnl ch83 080114
sGridNo = sBaseGridNo + ppTile[ubTileIndex]->sPosRelToBase;
#else
sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubTileIndex]); sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubTileIndex]);
#endif
if (sGridNo < 0 || sGridNo > WORLD_MAX) if (sGridNo < 0 || sGridNo > WORLD_MAX)
{ {
return( FALSE ); return( FALSE );
@@ -835,16 +831,8 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
} }
for (bLoop2 = 0; bLoop2 < pDBStructure->ubNumberOfTiles; bLoop2++) for (bLoop2 = 0; bLoop2 < pDBStructure->ubNumberOfTiles; bLoop2++)
{ {
#if 0//dnl ch83 080114
if ( sBaseGridNo + ppTile[bLoop2]->sPosRelToBase == sOtherGridNo)
{
// obstacle will straddle wall!
return( FALSE );
}
#else
if(AddPosRelToBase(sBaseGridNo, ppTile[bLoop2]) == sOtherGridNo) if(AddPosRelToBase(sBaseGridNo, ppTile[bLoop2]) == sOtherGridNo)
return(FALSE);// obstacle will straddle wall! return(FALSE);// obstacle will straddle wall!
#endif
} }
} }
} }
@@ -1107,11 +1095,7 @@ STRUCTURE * InternalAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRU
MemFree( ppStructure ); MemFree( ppStructure );
return( NULL ); return( NULL );
} }
#if 0//dnl ch83 080114
ppStructure[ubLoop]->sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
#else
ppStructure[ubLoop]->sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); ppStructure[ubLoop]->sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]);
#endif
if (ubLoop != BASE_TILE) if (ubLoop != BASE_TILE)
{ {
#ifdef JA2EDITOR #ifdef JA2EDITOR
@@ -1319,11 +1303,7 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
// Free all the tiles // Free all the tiles
for (ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++) for (ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
{ {
#if 0//dnl ch83 080114
sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
#else
sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]);
#endif
// there might be two structures in this tile, one on each level, but we just want to // there might be two structures in this tile, one on each level, but we just want to
// delete one on each pass // delete one on each pass
pCurrent = FindStructureByID( sGridNo, usStructureID ); pCurrent = FindStructureByID( sGridNo, usStructureID );
-18
View File
@@ -594,23 +594,6 @@ UINT8 gubEncryptionArray2[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_AR
}, },
}; };
#if 0
// These values coorespond to TerrainTypeDefines order
UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] =
{
TRAVELCOST_FLAT, // NO_TERRAIN
TRAVELCOST_FLAT, // FLAT GROUND
TRAVELCOST_FLATFLOOR, // FLAT FLOOR
TRAVELCOST_PAVEDROAD, // PAVED ROAD
TRAVELCOST_DIRTROAD, // DIRT ROAD
TRAVELCOST_GRASS, // LOW_GRASS
TRAVELCOST_THICK, // HIGH GRASS
TRAVELCOST_TRAINTRACKS, // TRAIN TRACKS
TRAVELCOST_SHORE, // LOW WATER
TRAVELCOST_KNEEDEEP, // MED WATER
TRAVELCOST_DEEPWATER, // DEEP WATER
};
#else
// These values coorespond to TerrainTypeDefines order // These values coorespond to TerrainTypeDefines order
UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] = UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] =
{ {
@@ -626,7 +609,6 @@ UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] =
TRAVELCOST_SHORE, // MED WATER TRAVELCOST_SHORE, // MED WATER
TRAVELCOST_SHORE, // DEEP WATER TRAVELCOST_SHORE, // DEEP WATER
}; };
#endif
ADDITIONAL_TILE_PROPERTIES_VALUES zAdditionalTileProperties; ADDITIONAL_TILE_PROPERTIES_VALUES zAdditionalTileProperties;
-9
View File
@@ -2276,15 +2276,6 @@ BOOLEAN SaveWorld(const STR8 puiFilename, FLOAT dMajorMapVersion, UINT8 ubMinorM
{ {
SaveMapLights( hfile ); SaveMapLights( hfile );
} }
#if 0//dnl ch74 191013 from 050611 Scheinworld reported problem with basement levels and similar maps which doesn't need entry points so decide to remove this check completely
if(gMapInformation.sCenterGridNo == -1 || gMapInformation.ubEditorSmoothingType == SMOOTHING_NORMAL && (gMapInformation.sNorthGridNo == -1 && gMapInformation.sEastGridNo == -1 && gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1))//dnl ch17 290909
{
swprintf(gzErrorCatchString, L"SAVE ABORTED! Center and at least one of (N,S,E,W) entry point should be set.");
gfErrorCatch = TRUE;
FileClose(hfile);
return(FALSE);
}
#endif
gMapInformation.ubMapVersion = ubMinorMapVersion;//dnl ch74 241013 all this years MapInfo saves incorrect version :-( gMapInformation.ubMapVersion = ubMinorMapVersion;//dnl ch74 241013 all this years MapInfo saves incorrect version :-(
SaveMapInformation(hfile, dMajorMapVersion, ubMinorMapVersion);//dnl ch33 150909 SaveMapInformation(hfile, dMajorMapVersion, ubMinorMapVersion);//dnl ch33 150909
-4
View File
@@ -2293,10 +2293,6 @@ BOOLEAN RemoveShadow( INT32 iMapIndex, UINT16 usIndex )
{ {
pOldShadow->pNext = pShadow->pNext; pOldShadow->pNext = pShadow->pNext;
} }
#if 0//#ifdef JA2EDITOR//dnl ch80 011213 //dnl ch86 190214
if(pShadow->uiFlags & LEVELNODE_EXITGRID && pShadow->pExitGridInfo)
memset(pShadow->pExitGridInfo, 0, sizeof(EXITGRID));
#endif
// Delete memory assosiated with item // Delete memory assosiated with item
MemFree( pShadow ); MemFree( pShadow );
guiLevelNodes--; guiLevelNodes--;
-69
View File
@@ -1857,32 +1857,6 @@ void DrawMouseText( )
} }
//if ( gpItemPointer != NULL ) //if ( gpItemPointer != NULL )
#if 0
{
if ( gpItemPointer->ubNumberOfObjects > 1 )
{
SetFontDestBuffer( MOUSE_BUFFER , 0, 0, 64, 64, FALSE );
swprintf( pStr, L"x%d", gpItemPointer->ubNumberOfObjects );
FindFontCenterCoordinates( 0, 0, gsCurMouseWidth, gsCurMouseHeight, pStr, TINYFONT1, &sX, &sY );
SetFont( TINYFONT1 );
SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_WHITE );
SetFontShadow( DEFAULT_SHADOW );
if ( !( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) )
{
mprintf( sX + 10, sY - 10, L"x%d", gpItemPointer->ubNumberOfObjects );
}
// reset
SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
}
}
#endif
} }
void UpdateAnimatedCursorFrames( UINT32 uiCursorIndex ) void UpdateAnimatedCursorFrames( UINT32 uiCursorIndex )
@@ -2008,47 +1982,4 @@ HVOBJECT GetCursorFileVideoObject( UINT32 uiCursorFile )
void SyncPairedCursorFrames( UINT32 uiSrcIndex, UINT32 uiDestIndex ) void SyncPairedCursorFrames( UINT32 uiSrcIndex, UINT32 uiDestIndex )
{ {
#if 0
CursorData *pSrcCurData, *pDestCurData;
CursorImage *pSrcCurImage, *pDestCurImage;
UINT32 cnt;
INT32 iCurFrame = -1;
if ( uiSrcIndex == VIDEO_NO_CURSOR || uiDestIndex == VIDEO_NO_CURSOR )
{
return;
}
pSrcCurData = &( CursorDatabase[ uiSrcIndex ] );
pDestCurData = &( CursorDatabase[ uiDestIndex ] );
// Get Current frame from src
for ( cnt = 0; cnt < pSrcCurData->usNumComposites; cnt++ )
{
pSrcCurImage = &( pSrcCurData->Composites[ cnt ] );
if ( CursorFileDatabase[ pSrcCurImage->uiFileIndex ].fFlags & ANIMATED_CURSOR )
{
iCurFrame = pSrcCurImage->uiCurrentFrame;
break;
}
}
// If we are not an animated cursor, return now
if ( iCurFrame == -1 )
{
return;
}
// Update dest
for ( cnt = 0; cnt < pDestCurData->usNumComposites; cnt++ )
{
pDestCurImage = &( pDestCurData->Composites[ cnt ] );
if ( CursorFileDatabase[ pDestCurImage->uiFileIndex ].fFlags & ANIMATED_CURSOR )
{
pDestCurImage->uiCurrentFrame = iCurFrame;
}
}
#endif
} }
-34
View File
@@ -631,40 +631,6 @@ UINT32 CalculateSoundEffectsVolume( UINT32 uiVolume )
} }
#if 0
int x,dif,absDif;
// This function calculates the general LEFT / RIGHT direction of a gridno
// based on the middle of your screen.
x = Gridx(gridno);
dif = ScreenMiddleX - x;
if ( (absDif=abs(dif)) > 32)
{
// OK, NOT the middle.
// Is it outside the screen?
if (absDif > HalfWindowWidth)
{
// yes, outside...
if (dif > 0)
return(25);
else
return(102);
}
else // inside screen
if (dif > 0)
return(LEFTSIDE);
else
return(RIGHTSIDE);
}
else // hardly any difference, so sound should be played from middle
return(MIDDLE);
}
#endif
// == Lesh slightly changed this function ============ // == Lesh slightly changed this function ============
INT32 SoundDir( INT32 sGridNo ) INT32 SoundDir( INT32 sGridNo )
-2
View File
@@ -751,7 +751,6 @@ BOOLEAN HandleTextInput( InputAtom *Event )
} }
//For any number of reasons, these ALT and CTRL combination key presses //For any number of reasons, these ALT and CTRL combination key presses
//will be processed externally //will be processed externally
#if 1
if( Event->usKeyState & CTRL_DOWN ) if( Event->usKeyState & CTRL_DOWN )
{ {
if( Event->usParam == 'c' || Event->usParam == 'C' ) if( Event->usParam == 'c' || Event->usParam == 'C' )
@@ -786,7 +785,6 @@ BOOLEAN HandleTextInput( InputAtom *Event )
return FALSE; return FALSE;
} }
} }
#endif
if( Event->usKeyState & ALT_DOWN || Event->usKeyState & CTRL_DOWN && Event->usParam != DEL ) if( Event->usKeyState & ALT_DOWN || Event->usKeyState & CTRL_DOWN && Event->usParam != DEL )
return FALSE; return FALSE;
//F1-F12 regardless of state are processed externally as well. //F1-F12 regardless of state are processed externally as well.
-911
View File
@@ -11,382 +11,14 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString )
if (pNameString != NULL) if (pNameString != NULL)
{ {
#if 0
j = -1;
for (int i=0;i<80;i++)
{
j++;
if ( j<(int)strlen(Item[ubIndex].szLongItemName ))
{
pNameString[i] = Item[ubIndex].szLongItemName [j];
#ifdef GERMAN
// We have a german special character
if (Item[ubIndex].szLongItemName [j] == -61)
{
// This character determines the special character
switch (Item[ubIndex].szLongItemName [j + 1])
{
// ü
case -68:
pNameString[i] = 252;
// Skip next character, because "umlaute" have 2 chars
j++;
break;
// Ü
case -100:
pNameString[i] = 220;
j++;
break;
// ä
case -92:
pNameString[i] = 228;
j++;
break;
// Ä
case -124:
pNameString[i] = 196;
j++;
break;
// ö
case -74:
pNameString[i] = 246;
j++;
break;
// Ö
case -106:
pNameString[i] = 214;
j++;
break;
// ß
case -97:
pNameString[i] = 223;
j++;
break;
}
}
#endif
#ifdef POLISH
switch( pNameString[ i ] )
{
case 260: pNameString[ i ] = 165; break;
case 262: pNameString[ i ] = 198; break;
case 280: pNameString[ i ] = 202; break;
case 321: pNameString[ i ] = 163; break;
case 323: pNameString[ i ] = 209; break;
case 211: pNameString[ i ] = 211; break;
case 346: pNameString[ i ] = 338; break;
case 379: pNameString[ i ] = 175; break;
case 377: pNameString[ i ] = 143; break;
case 261: pNameString[ i ] = 185; break;
case 263: pNameString[ i ] = 230; break;
case 281: pNameString[ i ] = 234; break;
case 322: pNameString[ i ] = 179; break;
case 324: pNameString[ i ] = 241; break;
case 243: pNameString[ i ] = 243; break;
case 347: pNameString[ i ] = 339; break;
case 380: pNameString[ i ] = 191; break;
case 378: pNameString[ i ] = 376; break;
}
#endif
#ifdef RUSSIAN
if ((unsigned char)Item[ubIndex].szLongItemName [j] == 208) //d0
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szLongItemName [j + 1] )
{
//capital letters
case 129: pNameString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO
case 144: pNameString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A
case 145: pNameString[ i ] = 193; j++; break;
case 146: pNameString[ i ] = 194; j++; break;
case 147: pNameString[ i ] = 195; j++; break;
case 148: pNameString[ i ] = 196; j++; break;
case 149: pNameString[ i ] = 197; j++; break;
case 150: pNameString[ i ] = 198; j++; break;
case 151: pNameString[ i ] = 199; j++; break;
case 152: pNameString[ i ] = 200; j++; break;
case 153: pNameString[ i ] = 201; j++; break;
case 154: pNameString[ i ] = 202; j++; break;
case 155: pNameString[ i ] = 203; j++; break;
case 156: pNameString[ i ] = 204; j++; break;
case 157: pNameString[ i ] = 205; j++; break;
case 158: pNameString[ i ] = 206; j++; break;
case 159: pNameString[ i ] = 207; j++; break;
case 160: pNameString[ i ] = 208; j++; break;
case 161: pNameString[ i ] = 209; j++; break;
case 162: pNameString[ i ] = 210; j++; break;
case 163: pNameString[ i ] = 211; j++; break;
case 164: pNameString[ i ] = 212; j++; break;
case 165: pNameString[ i ] = 213; j++; break;
case 166: pNameString[ i ] = 214; j++; break;
case 167: pNameString[ i ] = 215; j++; break;
case 168: pNameString[ i ] = 216; j++; break;
case 169: pNameString[ i ] = 217; j++; break;
case 170: pNameString[ i ] = 218; j++; break;
case 171: pNameString[ i ] = 219; j++; break;
case 172: pNameString[ i ] = 220; j++; break;
case 173: pNameString[ i ] = 221; j++; break;
case 174: pNameString[ i ] = 222; j++; break;
case 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA
//small letters
case 176: pNameString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A
case 177: pNameString[ i ] = 225; j++; break;
case 178: pNameString[ i ] = 226; j++; break;
case 179: pNameString[ i ] = 227; j++; break;
case 180: pNameString[ i ] = 228; j++; break;
case 181: pNameString[ i ] = 229; j++; break;
case 182: pNameString[ i ] = 230; j++; break;
case 183: pNameString[ i ] = 231; j++; break;
case 184: pNameString[ i ] = 232; j++; break;
case 185: pNameString[ i ] = 233; j++; break;
case 186: pNameString[ i ] = 234; j++; break;
case 187: pNameString[ i ] = 235; j++; break;
case 188: pNameString[ i ] = 236; j++; break;
case 189: pNameString[ i ] = 237; j++; break;
case 190: pNameString[ i ] = 238; j++; break;
case 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE
}
}
if ( ((unsigned char)Item[ubIndex].szLongItemName [j] == 209) ) //d1
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szLongItemName [j + 1] )
{
case 128: pNameString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER
case 129: pNameString[ i ] = 241; j++; break;
case 130: pNameString[ i ] = 242; j++; break;
case 131: pNameString[ i ] = 243; j++; break;
case 132: pNameString[ i ] = 244; j++; break;
case 133: pNameString[ i ] = 245; j++; break;
case 134: pNameString[ i ] = 246; j++; break;
case 135: pNameString[ i ] = 247; j++; break;
case 136: pNameString[ i ] = 248; j++; break;
case 137: pNameString[ i ] = 249; j++; break;
case 138: pNameString[ i ] = 250; j++; break;
case 139: pNameString[ i ] = 251; j++; break;
case 140: pNameString[ i ] = 252; j++; break;
case 141: pNameString[ i ] = 253; j++; break;
case 142: pNameString[ i ] = 254; j++; break;
case 143: pNameString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA
case 145: pNameString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO
}
}
#endif
}
else
{
pNameString[i] ='\0';
}
}
#else
wcsncpy( pNameString, Item[ubIndex].szLongItemName, 80); wcsncpy( pNameString, Item[ubIndex].szLongItemName, 80);
pNameString[79] ='\0'; pNameString[79] ='\0';
#endif
} }
if(pInfoString != NULL) if(pInfoString != NULL)
{ {
#if 0
j = -1;
for (int i=0;i<400;i++)
{
j++;
if ( j<(int)strlen(Item[ubIndex].szItemDesc ))
{
pInfoString[i] = Item[ubIndex].szItemDesc [j];
#ifdef GERMAN
// We have a german special character
if (Item[ubIndex].szItemDesc [j] == -61)
{
// This character determines the special character
switch (Item[ubIndex].szItemDesc [j + 1])
{
// ü
case -68:
pInfoString[i] = 252;
// Skip next character, because "umlaute" have 2 chars
j++;
break;
// Ü
case -100:
pInfoString[i] = 220;
j++;
break;
// ä
case -92:
pInfoString[i] = 228;
j++;
break;
// Ä
case -124:
pInfoString[i] = 196;
j++;
break;
// ö
case -74:
pInfoString[i] = 246;
j++;
break;
// Ö
case -106:
pInfoString[i] = 214;
j++;
break;
// ß
case -97:
pInfoString[i] = 223;
j++;
break;
}
}
#endif
#ifdef POLISH
switch( pNameString[ i ] )
{
case 260: pInfoString[ i ] = 165; break;
case 262: pInfoString[ i ] = 198; break;
case 280: pInfoString[ i ] = 202; break;
case 321: pInfoString[ i ] = 163; break;
case 323: pInfoString[ i ] = 209; break;
case 211: pInfoString[ i ] = 211; break;
case 346: pInfoString[ i ] = 338; break;
case 379: pInfoString[ i ] = 175; break;
case 377: pInfoString[ i ] = 143; break;
case 261: pInfoString[ i ] = 185; break;
case 263: pInfoString[ i ] = 230; break;
case 281: pInfoString[ i ] = 234; break;
case 322: pInfoString[ i ] = 179; break;
case 324: pInfoString[ i ] = 241; break;
case 243: pInfoString[ i ] = 243; break;
case 347: pInfoString[ i ] = 339; break;
case 380: pInfoString[ i ] = 191; break;
case 378: pInfoString[ i ] = 376; break;
}
#endif
#ifdef RUSSIAN
if ((unsigned char)Item[ubIndex].szItemDesc [j] == 208) //d0
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szItemDesc [j + 1] )
{
//capital letters
case 129: pInfoString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO
case 144: pInfoString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A
case 145: pInfoString[ i ] = 193; j++; break;
case 146: pInfoString[ i ] = 194; j++; break;
case 147: pInfoString[ i ] = 195; j++; break;
case 148: pInfoString[ i ] = 196; j++; break;
case 149: pInfoString[ i ] = 197; j++; break;
case 150: pInfoString[ i ] = 198; j++; break;
case 151: pInfoString[ i ] = 199; j++; break;
case 152: pInfoString[ i ] = 200; j++; break;
case 153: pInfoString[ i ] = 201; j++; break;
case 154: pInfoString[ i ] = 202; j++; break;
case 155: pInfoString[ i ] = 203; j++; break;
case 156: pInfoString[ i ] = 204; j++; break;
case 157: pInfoString[ i ] = 205; j++; break;
case 158: pInfoString[ i ] = 206; j++; break;
case 159: pInfoString[ i ] = 207; j++; break;
case 160: pInfoString[ i ] = 208; j++; break;
case 161: pInfoString[ i ] = 209; j++; break;
case 162: pInfoString[ i ] = 210; j++; break;
case 163: pInfoString[ i ] = 211; j++; break;
case 164: pInfoString[ i ] = 212; j++; break;
case 165: pInfoString[ i ] = 213; j++; break;
case 166: pInfoString[ i ] = 214; j++; break;
case 167: pInfoString[ i ] = 215; j++; break;
case 168: pInfoString[ i ] = 216; j++; break;
case 169: pInfoString[ i ] = 217; j++; break;
case 170: pInfoString[ i ] = 218; j++; break;
case 171: pInfoString[ i ] = 219; j++; break;
case 172: pInfoString[ i ] = 220; j++; break;
case 173: pInfoString[ i ] = 221; j++; break;
case 174: pInfoString[ i ] = 222; j++; break;
case 175: pInfoString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA
//small letters
case 176: pInfoString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A
case 177: pInfoString[ i ] = 225; j++; break;
case 178: pInfoString[ i ] = 226; j++; break;
case 179: pInfoString[ i ] = 227; j++; break;
case 180: pInfoString[ i ] = 228; j++; break;
case 181: pInfoString[ i ] = 229; j++; break;
case 182: pInfoString[ i ] = 230; j++; break;
case 183: pInfoString[ i ] = 231; j++; break;
case 184: pInfoString[ i ] = 232; j++; break;
case 185: pInfoString[ i ] = 233; j++; break;
case 186: pInfoString[ i ] = 234; j++; break;
case 187: pInfoString[ i ] = 235; j++; break;
case 188: pInfoString[ i ] = 236; j++; break;
case 189: pInfoString[ i ] = 237; j++; break;
case 190: pInfoString[ i ] = 238; j++; break;
case 191: pInfoString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE
}
}
if ( ((unsigned char)Item[ubIndex].szItemDesc [j] == 209) ) //d1
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szItemDesc [j + 1] )
{
case 128: pInfoString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER
case 129: pInfoString[ i ] = 241; j++; break;
case 130: pInfoString[ i ] = 242; j++; break;
case 131: pInfoString[ i ] = 243; j++; break;
case 132: pInfoString[ i ] = 244; j++; break;
case 133: pInfoString[ i ] = 245; j++; break;
case 134: pInfoString[ i ] = 246; j++; break;
case 135: pInfoString[ i ] = 247; j++; break;
case 136: pInfoString[ i ] = 248; j++; break;
case 137: pInfoString[ i ] = 249; j++; break;
case 138: pInfoString[ i ] = 250; j++; break;
case 139: pInfoString[ i ] = 251; j++; break;
case 140: pInfoString[ i ] = 252; j++; break;
case 141: pInfoString[ i ] = 253; j++; break;
case 142: pInfoString[ i ] = 254; j++; break;
case 143: pInfoString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA
case 145: pInfoString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO
}
}
//if ( ((unsigned char)Item[ubIndex].szItemDesc [j] == 211) ) //d3
//{
// // This character determines the special character
// switch ( (unsigned char)Item[ubIndex].szItemDesc [j + 1] )
// {
// case 162: pInfoString[ i ] = 20; j++; break;//U+04E2 d3a2 CYRILLIC CAPITAL LETTER I WITH MACRON
// case 163: pInfoString[ i ] = 20; j++; break;//U+04E3 d3a3 CYRILLIC SMALL LETTER I WITH MACRON
// }
//}
#endif
}
else
{
pInfoString[i] ='\0';
}
}
#else
wcsncpy( pInfoString, Item[ubIndex].szItemDesc, 400); wcsncpy( pInfoString, Item[ubIndex].szItemDesc, 400);
pInfoString[399] ='\0'; pInfoString[399] ='\0';
#endif
} }
return(TRUE); return(TRUE);
@@ -396,187 +28,8 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString )
{ {
if (pNameString != NULL) if (pNameString != NULL)
{ {
#if 0
int j = -1;
for (int i=0;i<80;i++)
{
j++;
if ( j<(int)strlen(Item[ubIndex].szBRName))
{
pNameString[i] = Item[ubIndex].szBRName [j];
#ifdef GERMAN
// We have a german special character
if (Item[ubIndex].szBRName [j] == -61)
{
// This character determines the special character
switch (Item[ubIndex].szBRName [j + 1])
{
// ü
case -68:
pNameString[i] = 252;
// Skip next character, because "umlaute" have 2 chars
j++;
break;
// Ü
case -100:
pNameString[i] = 220;
j++;
break;
// ä
case -92:
pNameString[i] = 228;
j++;
break;
// Ä
case -124:
pNameString[i] = 196;
j++;
break;
// ö
case -74:
pNameString[i] = 246;
j++;
break;
// Ö
case -106:
pNameString[i] = 214;
j++;
break;
// ß
case -97:
pNameString[i] = 223;
j++;
break;
}
}
#endif
#ifdef POLISH
switch( pNameString[ i ] )
{
case 260: pNameString[ i ] = 165; break;
case 262: pNameString[ i ] = 198; break;
case 280: pNameString[ i ] = 202; break;
case 321: pNameString[ i ] = 163; break;
case 323: pNameString[ i ] = 209; break;
case 211: pNameString[ i ] = 211; break;
case 346: pNameString[ i ] = 338; break;
case 379: pNameString[ i ] = 175; break;
case 377: pNameString[ i ] = 143; break;
case 261: pNameString[ i ] = 185; break;
case 263: pNameString[ i ] = 230; break;
case 281: pNameString[ i ] = 234; break;
case 322: pNameString[ i ] = 179; break;
case 324: pNameString[ i ] = 241; break;
case 243: pNameString[ i ] = 243; break;
case 347: pNameString[ i ] = 339; break;
case 380: pNameString[ i ] = 191; break;
case 378: pNameString[ i ] = 376; break;
}
#endif
#ifdef RUSSIAN
if ((unsigned char)Item[ubIndex].szBRName [j] == 208) //d0
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szBRName [j + 1] )
{
//capital letters
case 129: pNameString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO
case 144: pNameString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A
case 145: pNameString[ i ] = 193; j++; break;
case 146: pNameString[ i ] = 194; j++; break;
case 147: pNameString[ i ] = 195; j++; break;
case 148: pNameString[ i ] = 196; j++; break;
case 149: pNameString[ i ] = 197; j++; break;
case 150: pNameString[ i ] = 198; j++; break;
case 151: pNameString[ i ] = 199; j++; break;
case 152: pNameString[ i ] = 200; j++; break;
case 153: pNameString[ i ] = 201; j++; break;
case 154: pNameString[ i ] = 202; j++; break;
case 155: pNameString[ i ] = 203; j++; break;
case 156: pNameString[ i ] = 204; j++; break;
case 157: pNameString[ i ] = 205; j++; break;
case 158: pNameString[ i ] = 206; j++; break;
case 159: pNameString[ i ] = 207; j++; break;
case 160: pNameString[ i ] = 208; j++; break;
case 161: pNameString[ i ] = 209; j++; break;
case 162: pNameString[ i ] = 210; j++; break;
case 163: pNameString[ i ] = 211; j++; break;
case 164: pNameString[ i ] = 212; j++; break;
case 165: pNameString[ i ] = 213; j++; break;
case 166: pNameString[ i ] = 214; j++; break;
case 167: pNameString[ i ] = 215; j++; break;
case 168: pNameString[ i ] = 216; j++; break;
case 169: pNameString[ i ] = 217; j++; break;
case 170: pNameString[ i ] = 218; j++; break;
case 171: pNameString[ i ] = 219; j++; break;
case 172: pNameString[ i ] = 220; j++; break;
case 173: pNameString[ i ] = 221; j++; break;
case 174: pNameString[ i ] = 222; j++; break;
case 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA
//small letters
case 176: pNameString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A
case 177: pNameString[ i ] = 225; j++; break;
case 178: pNameString[ i ] = 226; j++; break;
case 179: pNameString[ i ] = 227; j++; break;
case 180: pNameString[ i ] = 228; j++; break;
case 181: pNameString[ i ] = 229; j++; break;
case 182: pNameString[ i ] = 230; j++; break;
case 183: pNameString[ i ] = 231; j++; break;
case 184: pNameString[ i ] = 232; j++; break;
case 185: pNameString[ i ] = 233; j++; break;
case 186: pNameString[ i ] = 234; j++; break;
case 187: pNameString[ i ] = 235; j++; break;
case 188: pNameString[ i ] = 236; j++; break;
case 189: pNameString[ i ] = 237; j++; break;
case 190: pNameString[ i ] = 238; j++; break;
case 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE
}
}
if ( ((unsigned char)Item[ubIndex].szBRName [j] == 209) ) //d1
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szBRName [j + 1] )
{
case 128: pNameString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER
case 129: pNameString[ i ] = 241; j++; break;
case 130: pNameString[ i ] = 242; j++; break;
case 131: pNameString[ i ] = 243; j++; break;
case 132: pNameString[ i ] = 244; j++; break;
case 133: pNameString[ i ] = 245; j++; break;
case 134: pNameString[ i ] = 246; j++; break;
case 135: pNameString[ i ] = 247; j++; break;
case 136: pNameString[ i ] = 248; j++; break;
case 137: pNameString[ i ] = 249; j++; break;
case 138: pNameString[ i ] = 250; j++; break;
case 139: pNameString[ i ] = 251; j++; break;
case 140: pNameString[ i ] = 252; j++; break;
case 141: pNameString[ i ] = 253; j++; break;
case 142: pNameString[ i ] = 254; j++; break;
case 143: pNameString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA
case 145: pNameString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO
}
}
#endif
}
else
{
pNameString[i] ='\0';
}
}
#else
wcsncpy( pNameString, Item[ubIndex].szBRName, 80); wcsncpy( pNameString, Item[ubIndex].szBRName, 80);
pNameString[79] ='\0'; pNameString[79] ='\0';
#endif
} }
return TRUE; return TRUE;
} }
@@ -585,188 +38,8 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString )
{ {
if (pDescString != NULL) if (pDescString != NULL)
{ {
#if 0
int j = -1;
for (int i=0;i<400;i++)
{
j++;
if ( j<(int)strlen(Item[ubIndex].szBRDesc))
{
pDescString[i] = Item[ubIndex].szBRDesc [j];
// WANNE: German specific characters
#ifdef GERMAN
// We have a german special character
if (Item[ubIndex].szBRDesc [j] == -61)
{
// This character determines the special character
switch (Item[ubIndex].szBRDesc [j + 1])
{
// ü
case -68:
pDescString[i] = 252;
// Skip next character, because "umlaute" have 2 chars
j++;
break;
// Ü
case -100:
pDescString[i] = 220;
j++;
break;
// ä
case -92:
pDescString[i] = 228;
j++;
break;
// Ä
case -124:
pDescString[i] = 196;
j++;
break;
// ö
case -74:
pDescString[i] = 246;
j++;
break;
// Ö
case -106:
pDescString[i] = 214;
j++;
break;
// ß
case -97:
pDescString[i] = 223;
j++;
break;
}
}
#endif
#ifdef POLISH
switch( pDescString[ i ] )
{
case 260: pDescString[ i ] = 165; break;
case 262: pDescString[ i ] = 198; break;
case 280: pDescString[ i ] = 202; break;
case 321: pDescString[ i ] = 163; break;
case 323: pDescString[ i ] = 209; break;
case 211: pDescString[ i ] = 211; break;
case 346: pDescString[ i ] = 338; break;
case 379: pDescString[ i ] = 175; break;
case 377: pDescString[ i ] = 143; break;
case 261: pDescString[ i ] = 185; break;
case 263: pDescString[ i ] = 230; break;
case 281: pDescString[ i ] = 234; break;
case 322: pDescString[ i ] = 179; break;
case 324: pDescString[ i ] = 241; break;
case 243: pDescString[ i ] = 243; break;
case 347: pDescString[ i ] = 339; break;
case 380: pDescString[ i ] = 191; break;
case 378: pDescString[ i ] = 376; break;
}
#endif
#ifdef RUSSIAN
if ((unsigned char)Item[ubIndex].szBRDesc [j] == 208) //d0
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szBRDesc [j + 1] )
{
//capital letters
case 129: pDescString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO
case 144: pDescString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A
case 145: pDescString[ i ] = 193; j++; break;
case 146: pDescString[ i ] = 194; j++; break;
case 147: pDescString[ i ] = 195; j++; break;
case 148: pDescString[ i ] = 196; j++; break;
case 149: pDescString[ i ] = 197; j++; break;
case 150: pDescString[ i ] = 198; j++; break;
case 151: pDescString[ i ] = 199; j++; break;
case 152: pDescString[ i ] = 200; j++; break;
case 153: pDescString[ i ] = 201; j++; break;
case 154: pDescString[ i ] = 202; j++; break;
case 155: pDescString[ i ] = 203; j++; break;
case 156: pDescString[ i ] = 204; j++; break;
case 157: pDescString[ i ] = 205; j++; break;
case 158: pDescString[ i ] = 206; j++; break;
case 159: pDescString[ i ] = 207; j++; break;
case 160: pDescString[ i ] = 208; j++; break;
case 161: pDescString[ i ] = 209; j++; break;
case 162: pDescString[ i ] = 210; j++; break;
case 163: pDescString[ i ] = 211; j++; break;
case 164: pDescString[ i ] = 212; j++; break;
case 165: pDescString[ i ] = 213; j++; break;
case 166: pDescString[ i ] = 214; j++; break;
case 167: pDescString[ i ] = 215; j++; break;
case 168: pDescString[ i ] = 216; j++; break;
case 169: pDescString[ i ] = 217; j++; break;
case 170: pDescString[ i ] = 218; j++; break;
case 171: pDescString[ i ] = 219; j++; break;
case 172: pDescString[ i ] = 220; j++; break;
case 173: pDescString[ i ] = 221; j++; break;
case 174: pDescString[ i ] = 222; j++; break;
case 175: pDescString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA
//small letters
case 176: pDescString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A
case 177: pDescString[ i ] = 225; j++; break;
case 178: pDescString[ i ] = 226; j++; break;
case 179: pDescString[ i ] = 227; j++; break;
case 180: pDescString[ i ] = 228; j++; break;
case 181: pDescString[ i ] = 229; j++; break;
case 182: pDescString[ i ] = 230; j++; break;
case 183: pDescString[ i ] = 231; j++; break;
case 184: pDescString[ i ] = 232; j++; break;
case 185: pDescString[ i ] = 233; j++; break;
case 186: pDescString[ i ] = 234; j++; break;
case 187: pDescString[ i ] = 235; j++; break;
case 188: pDescString[ i ] = 236; j++; break;
case 189: pDescString[ i ] = 237; j++; break;
case 190: pDescString[ i ] = 238; j++; break;
case 191: pDescString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE
}
}
if ( ((unsigned char)Item[ubIndex].szBRDesc [j] == 209) ) //d1
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szBRDesc [j + 1] )
{
case 128: pDescString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER
case 129: pDescString[ i ] = 241; j++; break;
case 130: pDescString[ i ] = 242; j++; break;
case 131: pDescString[ i ] = 243; j++; break;
case 132: pDescString[ i ] = 244; j++; break;
case 133: pDescString[ i ] = 245; j++; break;
case 134: pDescString[ i ] = 246; j++; break;
case 135: pDescString[ i ] = 247; j++; break;
case 136: pDescString[ i ] = 248; j++; break;
case 137: pDescString[ i ] = 249; j++; break;
case 138: pDescString[ i ] = 250; j++; break;
case 139: pDescString[ i ] = 251; j++; break;
case 140: pDescString[ i ] = 252; j++; break;
case 141: pDescString[ i ] = 253; j++; break;
case 142: pDescString[ i ] = 254; j++; break;
case 143: pDescString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA
case 145: pDescString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO
}
}
#endif
}
else
{
pDescString[i] ='\0';
}
}
#else
wcsncpy( pDescString, Item[ubIndex].szBRDesc, 400); wcsncpy( pDescString, Item[ubIndex].szBRDesc, 400);
pDescString[399] ='\0'; pDescString[399] ='\0';
#endif
} }
return TRUE; return TRUE;
@@ -776,192 +49,8 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString )
{ {
if(pNameString != NULL) if(pNameString != NULL)
{ {
#if 0
int j = -1;
for (int i=0;i<80;i++)
{
j++;
if ( i<(int)wcslen(Item[ubIndex].szItemName))
{
pNameString[i] = Item[ubIndex].szItemName [j];
// WANNE: German specific characters
#ifdef GERMAN
// We have a german special character
if (Item[ubIndex].szItemName [j] == -61)
{
// This character determines the special character
switch (Item[ubIndex].szItemName [j + 1])
{
// ü
case -68:
pNameString[i] = 252;
// Skip next character, because "umlaute" have 2 chars
j++;
break;
// Ü
case -100:
pNameString[i] = 220;
j++;
break;
// ä
case -92:
pNameString[i] = 228;
j++;
break;
// Ä
case -124:
pNameString[i] = 196;
j++;
break;
// ö
case -74:
pNameString[i] = 246;
j++;
break;
// Ö
case -106:
pNameString[i] = 214;
j++;
break;
// ß
case -97:
pNameString[i] = 223;
j++;
break;
}
}
#endif
#ifdef POLISH
switch( pNameString[ i ] )
{
case 260: pNameString[ i ] = 165; break;
case 262: pNameString[ i ] = 198; break;
case 280: pNameString[ i ] = 202; break;
case 321: pNameString[ i ] = 163; break;
case 323: pNameString[ i ] = 209; break;
case 211: pNameString[ i ] = 211; break;
case 346: pNameString[ i ] = 338; break;
case 379: pNameString[ i ] = 175; break;
case 377: pNameString[ i ] = 143; break;
case 261: pNameString[ i ] = 185; break;
case 263: pNameString[ i ] = 230; break;
case 281: pNameString[ i ] = 234; break;
case 322: pNameString[ i ] = 179; break;
case 324: pNameString[ i ] = 241; break;
case 243: pNameString[ i ] = 243; break;
case 347: pNameString[ i ] = 339; break;
case 380: pNameString[ i ] = 191; break;
case 378: pNameString[ i ] = 376; break;
}
#endif
#ifdef RUSSIAN
if ((unsigned char)Item[ubIndex].szItemName [j] == 208) //d0
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szItemName [j + 1] )
{
//capital letters
case 129: pNameString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO
case 144: pNameString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A
case 145: pNameString[ i ] = 193; j++; break;
case 146: pNameString[ i ] = 194; j++; break;
case 147: pNameString[ i ] = 195; j++; break;
case 148: pNameString[ i ] = 196; j++; break;
case 149: pNameString[ i ] = 197; j++; break;
case 150: pNameString[ i ] = 198; j++; break;
case 151: pNameString[ i ] = 199; j++; break;
case 152: pNameString[ i ] = 200; j++; break;
case 153: pNameString[ i ] = 201; j++; break;
case 154: pNameString[ i ] = 202; j++; break;
case 155: pNameString[ i ] = 203; j++; break;
case 156: pNameString[ i ] = 204; j++; break;
case 157: pNameString[ i ] = 205; j++; break;
case 158: pNameString[ i ] = 206; j++; break;
case 159: pNameString[ i ] = 207; j++; break;
case 160: pNameString[ i ] = 208; j++; break;
case 161: pNameString[ i ] = 209; j++; break;
case 162: pNameString[ i ] = 210; j++; break;
case 163: pNameString[ i ] = 211; j++; break;
case 164: pNameString[ i ] = 212; j++; break;
case 165: pNameString[ i ] = 213; j++; break;
case 166: pNameString[ i ] = 214; j++; break;
case 167: pNameString[ i ] = 215; j++; break;
case 168: pNameString[ i ] = 216; j++; break;
case 169: pNameString[ i ] = 217; j++; break;
case 170: pNameString[ i ] = 218; j++; break;
case 171: pNameString[ i ] = 219; j++; break;
case 172: pNameString[ i ] = 220; j++; break;
case 173: pNameString[ i ] = 221; j++; break;
case 174: pNameString[ i ] = 222; j++; break;
case 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA
//small letters
case 176: pNameString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A
case 177: pNameString[ i ] = 225; j++; break;
case 178: pNameString[ i ] = 226; j++; break;
case 179: pNameString[ i ] = 227; j++; break;
case 180: pNameString[ i ] = 228; j++; break;
case 181: pNameString[ i ] = 229; j++; break;
case 182: pNameString[ i ] = 230; j++; break;
case 183: pNameString[ i ] = 231; j++; break;
case 184: pNameString[ i ] = 232; j++; break;
case 185: pNameString[ i ] = 233; j++; break;
case 186: pNameString[ i ] = 234; j++; break;
case 187: pNameString[ i ] = 235; j++; break;
case 188: pNameString[ i ] = 236; j++; break;
case 189: pNameString[ i ] = 237; j++; break;
case 190: pNameString[ i ] = 238; j++; break;
case 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE
}
}
if ( ((unsigned char)Item[ubIndex].szItemName [j] == 209) ) //d1
{
// This character determines the special character
switch ( (unsigned char)Item[ubIndex].szItemName [j + 1] )
{
case 128: pNameString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER
case 129: pNameString[ i ] = 241; j++; break;
case 130: pNameString[ i ] = 242; j++; break;
case 131: pNameString[ i ] = 243; j++; break;
case 132: pNameString[ i ] = 244; j++; break;
case 133: pNameString[ i ] = 245; j++; break;
case 134: pNameString[ i ] = 246; j++; break;
case 135: pNameString[ i ] = 247; j++; break;
case 136: pNameString[ i ] = 248; j++; break;
case 137: pNameString[ i ] = 249; j++; break;
case 138: pNameString[ i ] = 250; j++; break;
case 139: pNameString[ i ] = 251; j++; break;
case 140: pNameString[ i ] = 252; j++; break;
case 141: pNameString[ i ] = 253; j++; break;
case 142: pNameString[ i ] = 254; j++; break;
case 143: pNameString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA
case 145: pNameString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO
}
}
#endif
}
else
{
pNameString[i] ='\0';
}
}
#else
wcsncpy( pNameString, Item[ubIndex].szItemName, 80 ); wcsncpy( pNameString, Item[ubIndex].szItemName, 80 );
pNameString[79] ='\0'; pNameString[79] ='\0';
#endif
} }
return(TRUE); return(TRUE);
-97
View File
@@ -393,115 +393,18 @@ BOOLEAN HandleJA2CDCheck( )
#endif #endif
#ifdef NOCDCHECK
return( TRUE ); return( TRUE );
#else
BOOLEAN fFailed = FALSE;
CHAR8 zCdLocation[ SGPFILENAME_LEN ];
CHAR8 zCdFile[ SGPFILENAME_LEN ];
INT32 cnt;
HWFILE hFile;
// Check for a file on CD....
if( GetCDromDriveLetter( zCdLocation ) )
{
for ( cnt = 0; cnt < 5; cnt++ )
{
// OK, build filename
sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] );
hFile = FileOpen( zCdFile, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
// Check if it exists...
if ( !hFile )
{
fFailed = TRUE;
FileClose( hFile );
break;
}
// Check min size
//#ifndef GERMAN
// if ( FileGetSize( hFile ) < gCheckFileMinSizes[ cnt ] )
// {
// fFailed = TRUE;
// FileClose( hFile );
// break;
// }
//#endif
FileClose( hFile );
}
}
else
{
fFailed = TRUE;
}
if ( fFailed )
{
CHAR8 zErrorMessage[256];
sprintf( zErrorMessage, "%S", gzLateLocalizedString[ 56 ] );
// Pop up message boc and get answer....
if ( MessageBox( NULL, zErrorMessage, "Jagged Alliance 2 v1.13", MB_OK ) == IDOK )
{
return( FALSE );
}
}
return( TRUE );
#endif
} }
BOOLEAN HandleJA2CDCheckTwo( ) BOOLEAN HandleJA2CDCheckTwo( )
{ {
#ifdef NOCDCHECK
return( TRUE ); return( TRUE );
#else
BOOLEAN fFailed = TRUE;
CHAR8 zCdLocation[ SGPFILENAME_LEN ];
CHAR8 zCdFile[ SGPFILENAME_LEN ];
// Check for a file on CD....
if( GetCDromDriveLetter( zCdLocation ) )
{
// OK, build filename
sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ Random( 2 ) ] );
// Check if it exists...
if ( FileExists( zCdFile ) )
{
fFailed = FALSE;
}
}
if ( fFailed )
{
CHAR8 zErrorMessage[256];
sprintf( zErrorMessage, "%S", gzLateLocalizedString[ 56 ] );
// Pop up message boc and get answer....
if ( MessageBox( NULL, zErrorMessage, "Jagged Alliance 2 v1.13", MB_OK ) == IDOK )
{
return( FALSE );
}
}
else
{
return( TRUE );
}
return( FALSE );
#endif
} }
-99
View File
@@ -384,9 +384,6 @@ static void XMLCALL
itemEndElementHandle(void *userData, const XML_Char *name) itemEndElementHandle(void *userData, const XML_Char *name)
{ {
itemParseData * pData = (itemParseData *)userData; itemParseData * pData = (itemParseData *)userData;
#if 0
char temp;
#endif
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
{ {
@@ -438,136 +435,40 @@ itemEndElementHandle(void *userData, const XML_Char *name)
// pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0'; // pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0';
//} //}
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
strcpy(pData->curItem.szItemName,pData->szCharData);
else
{
strncpy(pData->curItem.szItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0';
}
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
pData->curItem.szItemName[i] = temp;
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemname[%d] = %s, temp = %s",i,&pData->curItem.szItemName[i],&temp));
}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemName, sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) ); MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemName, sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) );
pData->curItem.szItemName[sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) - 1] = '\0'; pData->curItem.szItemName[sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) - 1] = '\0';
#endif
} }
else if(strcmp(name, "szLongItemName") == 0) else if(strcmp(name, "szLongItemName") == 0)
{ {
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: longitemname"); //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: longitemname");
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
{
strcpy(pData->curItem.szLongItemName,pData->szCharData);
}
else
{
strncpy(pData->curItem.szLongItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curItem.szLongItemName[MAX_CHAR_DATA_LENGTH] = '\0';
}
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
pData->curItem.szLongItemName[i] = temp;
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: longitemname[%d] = %s, temp = %s",i,&pData->curItem.szLongItemName[i],&temp));
}
//if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
//{
// strcpy(pData->curItem.szLongItemName,pData->szCharData);
//}
//else
//{
// strncpy(pData->curItem.szLongItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
// pData->curItem.szLongItemName[MAX_CHAR_DATA_LENGTH] = '\0';
//}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szLongItemName, sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) ); MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szLongItemName, sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) );
pData->curItem.szLongItemName[sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) - 1] = '\0'; pData->curItem.szLongItemName[sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) - 1] = '\0';
#endif
} }
else if(strcmp(name, "szItemDesc") == 0) else if(strcmp(name, "szItemDesc") == 0)
{ {
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: itemdesc"); //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: itemdesc");
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
strcpy(pData->curItem.szItemDesc,pData->szCharData);
else
{
strncpy(pData->curItem.szItemDesc,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curItem.szItemDesc[MAX_CHAR_DATA_LENGTH] = '\0';
}
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
pData->curItem.szItemDesc[i] = temp;
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemdesc[%d] = %s, temp = %s",i,&pData->curItem.szItemDesc[i],&temp));
}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemDesc, sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) ); MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemDesc, sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) );
pData->curItem.szItemDesc[sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) - 1] = '\0'; pData->curItem.szItemDesc[sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) - 1] = '\0';
#endif
} }
else if(strcmp(name, "szBRName") == 0) else if(strcmp(name, "szBRName") == 0)
{ {
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brname"); //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brname");
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
strcpy(pData->curItem.szBRName,pData->szCharData);
else
{
strncpy(pData->curItem.szBRName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curItem.szBRName[MAX_CHAR_DATA_LENGTH] = '\0';
}
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
pData->curItem.szBRName[i] = temp;
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRname[%d] = %s, temp = %s",i,&pData->curItem.szBRName[i],&temp));
}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRName, sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) ); MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRName, sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) );
pData->curItem.szBRName[sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) - 1] = '\0'; pData->curItem.szBRName[sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) - 1] = '\0';
#endif
} }
else if(strcmp(name, "szBRDesc") == 0) else if(strcmp(name, "szBRDesc") == 0)
{ {
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brdesc"); //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brdesc");
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
strcpy(pData->curItem.szBRDesc,pData->szCharData);
else
{
strncpy(pData->curItem.szBRDesc,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curItem.szBRDesc[MAX_CHAR_DATA_LENGTH] = '\0';
}
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
pData->curItem.szBRDesc[i] = temp;
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRdesc[%d] = %s, temp = %s",i,&pData->curItem.szBRDesc[i],&temp));
}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRDesc, sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) ); MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRDesc, sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) );
pData->curItem.szBRDesc[sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) - 1] = '\0'; pData->curItem.szBRDesc[sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) - 1] = '\0';
#endif
} }
else if(strcmp(name, "usItemClass") == 0) else if(strcmp(name, "usItemClass") == 0)
{ {