- New feature: sector fortification allows to construct structures in sectors in a much easier way than by using amerc to build 'by hand'. Fortification nodes are in a subfolder in Profiles and can easily be altered and exchanged, even in an ongoing game.

Fully savegame compatible.
GameDir >= r2296 is recommended, but not required.
- Cleaned up cover display functions.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8094 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-03-06 12:44:57 +00:00
parent 7e7476a4ea
commit 12ae810316
36 changed files with 5175 additions and 3307 deletions
+177 -195
View File
@@ -69,13 +69,9 @@ CoverCell gCoverViewArea[ COVER_X_CELLS ][ COVER_Y_CELLS ][ COVER_Z_CELLS ];
DWORD guiCoverNextUpdateTime = 0;
COVER_DRAW_MODE gubDrawMode = COVER_DRAW_OFF;
COVER_DRAW_MODE gubDrawMode = DRAW_MODE_OFF;
MINES_DRAW_MODE gubDrawModeMine = MINES_DRAW_OFF; // Flugente: mines display
TRAIT_DRAW_MODE gubDrawModeTrait = TRAIT_DRAW_OFF; // Flugente: mines display
TRACKER_DRAW_MODE gubDrawModeTracker = TRACKER_DRAW_OFF; // Flugente: tracker display
BOOLEAN gNoRedraw = FALSE;
//******* Local Function Prototypes ***********************************
@@ -84,8 +80,8 @@ CHAR16* GetTerrainName( const UINT8& ubTerrainType );
// anv: additional tile properties
CHAR16* GetDetailedTerrainName( ADDITIONAL_TILE_PROPERTIES_VALUES zGivenTileProperties );
void AddCoverObjectToWorld( const INT32& sGridNo, const UINT16& usGraphic, const BOOLEAN& fRoof, BOOLEAN fNightTime );
void RemoveCoverObjectFromWorld( const INT32 sGridNo, const UINT16& usGraphic, const BOOLEAN& fRoof );
void AddCoverObjectToWorld( INT32 sGridNo, UINT16 usGraphic, BOOLEAN fRoof, BOOLEAN fNightTime );
void RemoveCoverObjectFromWorld( INT32 sGridNo, UINT16 usGraphic, BOOLEAN fRoof );
void AddCoverObjectsToViewArea();
void RemoveCoverObjectsFromViewArea();
@@ -94,6 +90,7 @@ void CalculateCover();
void CalculateMines();
void CalculateTraitRange();
void CalculateTrackerRange();
void CalculateFortify();
void GetGridNoForViewPort( const INT32& ubX, const INT32& ubY, INT32& sGridNo );
@@ -102,16 +99,7 @@ BOOLEAN GridNoOnScreenAndAround( const INT32& sGridNo, const UINT8& ubRadius=2 )
BOOLEAN IsTheRoofVisible( const INT32& sGridNo );
BOOLEAN HasAdjTile( const INT32& ubX, const INT32& ubY );
// resets the overlay modes so that everything will be reset at the NEXT display cycle
void ResetOverlayModes()
{
gubDrawMode = COVER_DRAW_OFF;
gubDrawModeMine = MINES_DRAW_OFF;
gubDrawModeTrait = TRAIT_DRAW_OFF;
gubDrawModeTracker = TRACKER_DRAW_OFF;
}
TileDefines GetOverlayIndex( const INT8& bOverlayType )
TileDefines GetOverlayIndex( INT8 bOverlayType )
{
switch ( bOverlayType )
{
@@ -125,6 +113,8 @@ TileDefines GetOverlayIndex( const INT8& bOverlayType )
case MINES_LVL_4:
case TRACKS_BLOOD:
case FORTIFICATIONNODE_REMOVE:
return SPECIALTILE_COVER_1; // red
case MIN_COVER:
@@ -138,6 +128,8 @@ TileDefines GetOverlayIndex( const INT8& bOverlayType )
case TRAIT_2:
case TRACKS_VERYOLD:
case FORTIFICATIONNODE_ADJACENTADJUSTMENT:
return SPECIALTILE_COVER_2; // orange
case MED_COVER:
@@ -151,6 +143,8 @@ TileDefines GetOverlayIndex( const INT8& bOverlayType )
case TRAIT_ALL:
case TRACKS_OLD:
case FORTIFICATIONNODE_NORMAL:
return SPECIALTILE_COVER_3; // yellow
case MAX_COVER:
@@ -197,10 +191,10 @@ void SwitchToEnemyView()
void SwitchViewOff()
{
if (gubDrawMode == COVER_DRAW_OFF)
if ( gubDrawMode == DRAW_MODE_OFF )
return;
gubDrawMode = COVER_DRAW_OFF;
gubDrawMode = DRAW_MODE_OFF;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzDisplayCoverText[DC_MSG__COVER_DRAW_OFF]);
DisplayCover(TRUE);
}
@@ -314,7 +308,7 @@ CHAR16* GetDetailedTerrainName( ADDITIONAL_TILE_PROPERTIES_VALUES zGivenTileProp
}
}
void AddCoverObjectToWorld( const INT32& sGridNo, const UINT16& usGraphic, const BOOLEAN& fRoof, BOOLEAN fNightTime )
void AddCoverObjectToWorld( INT32 sGridNo, UINT16 usGraphic, BOOLEAN fRoof, BOOLEAN fNightTime )
{
LEVELNODE *pNode;
@@ -338,7 +332,7 @@ void AddCoverObjectToWorld( const INT32& sGridNo, const UINT16& usGraphic, const
}
}
void RemoveCoverObjectFromWorld( const INT32 sGridNo, const UINT16& usGraphic, const BOOLEAN& fRoof )
void RemoveCoverObjectFromWorld( INT32 sGridNo, UINT16 usGraphic, BOOLEAN fRoof )
{
if( fRoof )
{
@@ -380,7 +374,7 @@ BOOLEAN HasAdjTile( const INT32& ubX, const INT32& ubY, const INT32& ubZ )
void AddCoverObjectsToViewArea()
{
if (gsMaxCellY == -1)
if ( gsMaxCellY < 0 )
return;
register INT32 ubX, ubY, ubZ;
@@ -394,14 +388,9 @@ void AddCoverObjectsToViewArea()
{
for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT8& bOverlayType = gCoverViewArea[ubX][ubY][ubZ].bOverlayType;
if ( bOverlayType != INVALID_COVER && ((bOverlayType != MAX_COVER && bOverlayType != NO_SEE) || HasAdjTile( ubX, ubY, ubZ )) )
if ( gCoverViewArea[ubX][ubY][ubZ].bOverlayType != INVALID_COVER && ((gCoverViewArea[ubX][ubY][ubZ].bOverlayType != MAX_COVER && gCoverViewArea[ubX][ubY][ubZ].bOverlayType != NO_SEE) || HasAdjTile( ubX, ubY, ubZ )) )
{
INT32& sGridNo = gCoverViewArea[ubX][ubY][ubZ].sGridNo;
TileDefines tile = GetOverlayIndex( bOverlayType );
AddCoverObjectToWorld( sGridNo, tile, (BOOLEAN)ubZ, fNightTime );
AddCoverObjectToWorld( gCoverViewArea[ubX][ubY][ubZ].sGridNo, GetOverlayIndex( gCoverViewArea[ubX][ubY][ubZ].bOverlayType ), (BOOLEAN)ubZ, fNightTime );
fChanged = TRUE;
}
}
@@ -417,10 +406,15 @@ void AddCoverObjectsToViewArea()
void RemoveCoverObjectsFromViewArea()
{
if (gsMaxCellY == -1)
{
if ( gubDrawMode == DRAW_MODE_OFF && gNoRedraw )
return;
}
INT16 usTmp;
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, &gsMinCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_END_Y, &gsMaxCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_START_Y, &usTmp, &gsMinCellY );
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_END_Y, &usTmp, &gsMaxCellY );
register INT32 ubX, ubY, ubZ;
BOOLEAN fChanged = FALSE;
@@ -431,12 +425,14 @@ void RemoveCoverObjectsFromViewArea()
{
for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT32& sGridNo = gCoverViewArea[ubX][ubY][ubZ].sGridNo;
GetGridNoForViewPort( ubX, ubY, sGridNo );
INT8& bOverlayType = gCoverViewArea[ubX][ubY][ubZ].bOverlayType;
if ( bOverlayType != INVALID_COVER )
{
INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo;
TileDefines tile = GetOverlayIndex( bOverlayType );
RemoveCoverObjectFromWorld( sGridNo, tile, (BOOLEAN) ubZ );
bOverlayType = INVALID_COVER;
@@ -445,12 +441,14 @@ void RemoveCoverObjectsFromViewArea()
}
}
}
// Re-render the scene!
if ( fChanged )
{
SetRenderFlags( RENDER_FLAG_FULL );
}
gNoRedraw = (gubDrawMode == DRAW_MODE_OFF);
}
// ubRadius in times of y or x cell sizes
@@ -485,14 +483,38 @@ void DisplayCover( BOOLEAN forceUpdate )
if ( forceUpdate || ( !gfScrollPending && !gfScrollInertia && GetTickCount() > guiCoverNextUpdateTime ) )
{
if ( gubDrawMode != COVER_DRAW_OFF )
// remove old cover objects
RemoveCoverObjectsFromViewArea();
switch ( gubDrawMode )
{
case COVER_DRAW_MERC_VIEW:
case COVER_DRAW_ENEMY_VIEW:
CalculateCover();
else if ( gubDrawModeMine != MINES_DRAW_OFF )
CalculateMines( );
else if ( gubDrawModeTrait != TRAIT_DRAW_OFF )
CalculateTraitRange( );
else //if ( gubDrawModeTracker != TRAIT_DRAW_OFF )
CalculateTrackerRange( );
break;
case MINES_DRAW_DETECT_ENEMY:
case MINES_DRAW_PLAYERTEAM_NETWORKS:
case MINES_DRAW_NETWORKCOLOURING:
case MINES_DRAW_NET_A:
case MINES_DRAW_NET_B:
case MINES_DRAW_NET_C:
case MINES_DRAW_NET_D:
CalculateMines();
break;
case DRAW_MODE_TRAIT_RANGE:
CalculateTraitRange();
break;
case DRAW_MODE_TRACKER_SMELL:
CalculateTrackerRange();
break;
case DRAW_MODE_FORTIFY:
CalculateFortify( );
break;
}
guiCoverNextUpdateTime = GetTickCount() + gGameExternalOptions.ubCoverDisplayUpdateWait;
}
@@ -504,26 +526,11 @@ void CalculateCover()
register INT8 ubZ;
SOLDIERTYPE* pSoldier;
RemoveCoverObjectsFromViewArea();
if( gubDrawMode == COVER_DRAW_OFF )
{
return;
}
if( gusSelectedSoldier == NOBODY )
{
return;
}
GetSoldier( &pSoldier, gusSelectedSoldier );
INT16 usTmp;
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, &gsMinCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_END_Y, &gsMaxCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_START_Y, &usTmp, &gsMinCellY );
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_END_Y, &usTmp, &gsMaxCellY );
for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX )
{
for ( ubY=gsMinCellY; ubY<=gsMaxCellY; ++ubY )
@@ -531,8 +538,6 @@ void CalculateCover()
for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo;
GetGridNoForViewPort( ubX, ubY, sGridNo );
if( !GridNoOnScreenAndAround( sGridNo, 2 ) )
continue;
@@ -879,37 +884,37 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
///BEGIN key binding functions
void SwitchToTrapNetworkView()
{
if (gubDrawModeMine == MINES_DRAW_PLAYERTEAM_NETWORKS)
if ( gubDrawMode == MINES_DRAW_PLAYERTEAM_NETWORKS )
return;
gubDrawModeMine = MINES_DRAW_PLAYERTEAM_NETWORKS;
gubDrawMode = MINES_DRAW_PLAYERTEAM_NETWORKS;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network");
DisplayCover( TRUE );
}
void SwitchToHostileTrapsView()
{
if (gubDrawModeMine == MINES_DRAW_DETECT_ENEMY)
if ( gubDrawMode == MINES_DRAW_DETECT_ENEMY )
return;
gubDrawModeMine = MINES_DRAW_DETECT_ENEMY;
gubDrawMode = MINES_DRAW_DETECT_ENEMY;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display nearby traps");
DisplayCover( TRUE );
}
void SwitchMineViewOff()
{
if (gubDrawModeMine == MINES_DRAW_OFF)
if ( gubDrawMode < MINES_DRAW_DETECT_ENEMY || gubDrawMode > MINES_DRAW_NET_D )
return;
gubDrawModeMine = MINES_DRAW_OFF;
gubDrawMode = DRAW_MODE_OFF;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Turning off trap display");
DisplayCover( TRUE );
}
void ToggleHostileTrapsView()
{
if (gubDrawModeMine == MINES_DRAW_DETECT_ENEMY) {
if ( gubDrawMode == MINES_DRAW_DETECT_ENEMY ) {
SwitchMineViewOff();
} else {
SwitchToHostileTrapsView();
@@ -918,44 +923,41 @@ void ToggleHostileTrapsView()
void ToggleTrapNetworkView()
{
SwitchMinesDrawModeForNetworks();
}
void SwitchMinesDrawModeForNetworks()
{
switch ( gubDrawModeMine )
switch ( gubDrawMode )
{
case MINES_DRAW_OFF:
case MINES_DRAW_DETECT_ENEMY:
gubDrawModeMine = MINES_DRAW_PLAYERTEAM_NETWORKS;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network");
break;
case MINES_DRAW_PLAYERTEAM_NETWORKS:
gubDrawModeMine = MINES_DRAW_NETWORKCOLOURING;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network colouring");
break;
case MINES_DRAW_NETWORKCOLOURING:
gubDrawModeMine = MINES_DRAW_NET_A;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network A");
break;
case MINES_DRAW_NET_A:
gubDrawModeMine = MINES_DRAW_NET_B;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network B");
break;
case MINES_DRAW_NET_B:
gubDrawModeMine = MINES_DRAW_NET_C;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network C");
break;
case MINES_DRAW_NET_C:
gubDrawModeMine = MINES_DRAW_NET_D;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network D");
break;
case MINES_DRAW_NET_D:
case MINES_DRAW_MAX:
default:
gubDrawModeMine = MINES_DRAW_OFF;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Turning off trap display");
break;
case MINES_DRAW_DETECT_ENEMY:
gubDrawMode = MINES_DRAW_PLAYERTEAM_NETWORKS;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network" );
break;
case MINES_DRAW_PLAYERTEAM_NETWORKS:
gubDrawMode = MINES_DRAW_NETWORKCOLOURING;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network colouring" );
break;
case MINES_DRAW_NETWORKCOLOURING:
gubDrawMode = MINES_DRAW_NET_A;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network A" );
break;
case MINES_DRAW_NET_A:
gubDrawMode = MINES_DRAW_NET_B;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network B" );
break;
case MINES_DRAW_NET_B:
gubDrawMode = MINES_DRAW_NET_C;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network C" );
break;
case MINES_DRAW_NET_C:
gubDrawMode = MINES_DRAW_NET_D;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trap network D" );
break;
case MINES_DRAW_NET_D:
gubDrawMode = DRAW_MODE_OFF;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Turning off trap display" );
break;
default:
gubDrawMode = MINES_DRAW_DETECT_ENEMY;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display enemy traps" );
break;
}
DisplayCover( TRUE );
@@ -964,7 +966,7 @@ void SwitchMinesDrawModeForNetworks()
void AddMinesObjectsToViewArea()
{
if (gsMaxCellY == -1)
if ( gsMaxCellY < 0 )
return;
register INT32 ubX, ubY, ubZ;
@@ -974,7 +976,7 @@ void AddMinesObjectsToViewArea()
BOOLEAN fSearchAdjTile = TRUE;
// no search for adjacent tiles when looking at a specific network (we have only 4 colours, need them all :-)
if ( gubDrawModeMine == MINES_DRAW_NETWORKCOLOURING || gubDrawModeMine == MINES_DRAW_NET_A || gubDrawModeMine == MINES_DRAW_NET_B || gubDrawModeMine == MINES_DRAW_NET_C || gubDrawModeMine == MINES_DRAW_NET_D )
if ( gubDrawMode == MINES_DRAW_NETWORKCOLOURING || gubDrawMode == MINES_DRAW_NET_A || gubDrawMode == MINES_DRAW_NET_B || gubDrawMode == MINES_DRAW_NET_C || gubDrawMode == MINES_DRAW_NET_D )
fSearchAdjTile = FALSE;
for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX )
@@ -983,16 +985,11 @@ void AddMinesObjectsToViewArea()
{
for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT8& bOverlayType = gCoverViewArea[ubX][ubY][ubZ].bOverlayType;
if ( bOverlayType != INVALID_COVER && (bOverlayType != MAX_MINES || (fSearchAdjTile && HasAdjTile( ubX, ubY, ubZ ))) )
if ( gCoverViewArea[ubX][ubY][ubZ].bOverlayType != INVALID_COVER && (gCoverViewArea[ubX][ubY][ubZ].bOverlayType != MAX_MINES || (fSearchAdjTile && HasAdjTile( ubX, ubY, ubZ ))) )
{
INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo;
if ( !TileIsOutOfBounds( sGridNo ) )
if ( !TileIsOutOfBounds( gCoverViewArea[ubX][ubY][ubZ].sGridNo ) )
{
TileDefines tile = GetOverlayIndex( bOverlayType );
AddCoverObjectToWorld( sGridNo, tile, (BOOLEAN)ubZ, fNightTime );
AddCoverObjectToWorld( gCoverViewArea[ubX][ubY][ubZ].sGridNo, GetOverlayIndex( gCoverViewArea[ubX][ubY][ubZ].bOverlayType ), (BOOLEAN)ubZ, fNightTime );
fChanged = TRUE;
}
}
@@ -1012,41 +1009,23 @@ void CalculateMines()
INT32 ubX, ubY;
INT8 ubZ;
SOLDIERTYPE* pSoldier;
RemoveCoverObjectsFromViewArea( );
if( gubDrawModeMine == MINES_DRAW_OFF )
{
return;
}
if ( gusSelectedSoldier == NOBODY || !GetSoldier( &pSoldier, gusSelectedSoldier ) || !pSoldier->bInSector )
return;
// if we want to detect hostile mines and we have an metal detector in our hands, allow seeking
BOOLEAN fWithMineDetector = FALSE;
if ( pSoldier && gubDrawModeMine == MINES_DRAW_DETECT_ENEMY )
if ( pSoldier && gubDrawMode == MINES_DRAW_DETECT_ENEMY )
{
if ( FindMetalDetectorInHand(pSoldier) != NO_SLOT )
fWithMineDetector = TRUE;
// TODO: perhaps even consume batteries one day...
}
// if we are looking for mines via mine detector, but don't have one equipped, return, we won't detect anything
if ( gubDrawModeMine == MINES_DRAW_DETECT_ENEMY && !fWithMineDetector )
{
return;
// if we are looking for mines via mine detector, but don't have one equipped, return, we won't detect anything
else
return;
}
const INT32& sSelectedSoldierGridNo = MercPtrs[ gusSelectedSoldier ]->sGridNo;
INT16 usTmp;
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, &gsMinCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_END_Y, &gsMaxCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_START_Y, &usTmp, &gsMinCellY );
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_END_Y, &usTmp, &gsMaxCellY );
for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX )
{
for ( ubY=gsMinCellY; ubY<=gsMaxCellY; ++ubY )
@@ -1054,8 +1033,6 @@ void CalculateMines()
for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo;
GetGridNoForViewPort( ubX, ubY, sGridNo );
if( !GridNoOnScreenAndAround( sGridNo, 2 ) )
continue;
@@ -1074,7 +1051,7 @@ void CalculateMines()
}
// if we are looking for hostile mines, but the tile is out of our' detectors range, skip looking for mines
if ( gubDrawModeMine == MINES_DRAW_DETECT_ENEMY && fWithMineDetector )
if ( gubDrawMode == MINES_DRAW_DETECT_ENEMY && fWithMineDetector )
{
if ( PythSpacesAway(sSelectedSoldierGridNo, sGridNo) > 4 )
continue;
@@ -1108,7 +1085,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
{
// we are looking for hostile mines and have got an detector equipped
// some bombs cannot be found via metal detector
if ( gubDrawModeMine == MINES_DRAW_DETECT_ENEMY && fWithMineDetector && !( HasItemFlag(pObj->usItem, NO_METAL_DETECTION) || HasItemFlag((*pObj)[0]->data.misc.usBombItem, NO_METAL_DETECTION) ) )
if ( gubDrawMode == MINES_DRAW_DETECT_ENEMY && fWithMineDetector && !(HasItemFlag( pObj->usItem, NO_METAL_DETECTION ) || HasItemFlag( (*pObj)[0]->data.misc.usBombItem, NO_METAL_DETECTION )) )
{
// display all mines
bOverlayType = MINE_BOMB;
@@ -1118,7 +1095,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
// look for mines from our own team
if ( (*pObj)[0]->data.misc.ubBombOwner > 1 )
{
switch ( gubDrawModeMine )
switch ( gubDrawMode )
{
case MINES_DRAW_PLAYERTEAM_NETWORKS:
{
@@ -1193,7 +1170,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
if ( Item[pObj->usItem].tripwire == 1 )
{
UINT32 specificnet = 0;
switch ( gubDrawModeMine )
switch ( gubDrawMode )
{
case MINES_DRAW_NET_A: specificnet = TRIPWIRE_NETWORK_NET_1; break;
case MINES_DRAW_NET_B: specificnet = TRIPWIRE_NETWORK_NET_2; break;
@@ -1222,7 +1199,6 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
break;
case MINES_DRAW_DETECT_ENEMY:
case MINES_DRAW_MAX:
default:
break;
}
@@ -1247,20 +1223,16 @@ INT32 sTraitgridNo = NOWHERE;
void ToggleTraitRangeView(BOOLEAN fOn)
{
if ( fOn )
{
gubDrawModeTrait = TRAIT_DRAW_RANGE;
gubDrawMode = COVER_DRAW_OFF;
gubDrawModeMine = MINES_DRAW_OFF;
gubDrawModeTracker = TRACKER_DRAW_OFF;
{
gubDrawMode = DRAW_MODE_TRAIT_RANGE;
}
else
{
gubDrawModeTrait = TRAIT_DRAW_OFF;
gubDrawMode = DRAW_MODE_OFF;
SetTraitToDisplay( NO_SKILLTRAIT_NT );
SetGridNoForTraitDisplay( NOWHERE );
}
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Display trait ranges");
DisplayCover( TRUE );
}
@@ -1280,12 +1252,7 @@ void CalculateTraitRange()
INT32 ubX, ubY;
INT8 ubZ;
SOLDIERTYPE* pSoldier;
RemoveCoverObjectsFromViewArea( );
if ( gubDrawModeTrait == TRAIT_DRAW_OFF )
return;
if ( gusSelectedSoldier == NOBODY || !GetSoldier( &pSoldier, gusSelectedSoldier ) || !pSoldier->bInSector )
return;
@@ -1313,12 +1280,6 @@ void CalculateTraitRange()
const INT32& sSelectedSoldierGridNo = MercPtrs[ gusSelectedSoldier ]->sGridNo;
INT16 usTmp;
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, &gsMinCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_END_Y, &gsMaxCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_START_Y, &usTmp, &gsMinCellY );
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_END_Y, &usTmp, &gsMaxCellY );
for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX )
{
for ( ubY=gsMinCellY; ubY<=gsMaxCellY; ++ubY )
@@ -1327,8 +1288,6 @@ void CalculateTraitRange()
{
INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo;
GetGridNoForViewPort( ubX, ubY, sGridNo );
if( !GridNoOnScreenAndAround( sGridNo, 2 ) )
continue;
@@ -1366,7 +1325,7 @@ void CalculateTraitRange()
void AddTraitObjectsToViewArea()
{
if (gsMaxCellY == -1)
if ( gsMaxCellY < 0 )
return;
register INT32 ubX, ubY, ubZ;
@@ -1380,13 +1339,9 @@ void AddTraitObjectsToViewArea()
{
for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT8& bOverlayType = gCoverViewArea[ubX][ubY][ubZ].bOverlayType;
if ( bOverlayType == TRAIT_1 || bOverlayType == TRAIT_2 )
if ( gCoverViewArea[ubX][ubY][ubZ].bOverlayType == TRAIT_1 || gCoverViewArea[ubX][ubY][ubZ].bOverlayType == TRAIT_2 )
{
INT32& sGridNo = gCoverViewArea[ubX][ubY][ubZ].sGridNo;
TileDefines tile = GetOverlayIndex( bOverlayType );
AddCoverObjectToWorld( sGridNo, tile, (BOOLEAN)ubZ, fNightTime );
AddCoverObjectToWorld( gCoverViewArea[ubX][ubY][ubZ].sGridNo, GetOverlayIndex( gCoverViewArea[ubX][ubY][ubZ].bOverlayType ), (BOOLEAN)ubZ, fNightTime );
fChanged = TRUE;
}
}
@@ -1450,12 +1405,7 @@ void CalculateTrackerRange( )
INT32 ubX, ubY;
INT8 ubZ;
SOLDIERTYPE* pSoldier;
RemoveCoverObjectsFromViewArea( );
if ( gubDrawModeTracker == TRACKER_DRAW_OFF )
return;
if ( gusSelectedSoldier == NOBODY || !GetSoldier( &pSoldier, gusSelectedSoldier ) || !pSoldier->bInSector )
return;
@@ -1467,13 +1417,7 @@ void CalculateTrackerRange( )
UINT16 range = gSkillTraitValues.usSVTrackerMaxRange * trackerskill;
const INT32& sSelectedSoldierGridNo = MercPtrs[gusSelectedSoldier]->sGridNo;
INT16 usTmp;
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, &gsMinCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_END_Y, &gsMaxCellX, &usTmp );
GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_START_Y, &usTmp, &gsMinCellY );
GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_END_Y, &usTmp, &gsMaxCellY );
for ( ubX = gsMinCellX; ubX <= gsMaxCellX; ++ubX )
{
for ( ubY = gsMinCellY; ubY <= gsMaxCellY; ++ubY )
@@ -1482,8 +1426,6 @@ void CalculateTrackerRange( )
{
INT32& sGridNo = gCoverViewArea[ubX][ubY][ubZ].sGridNo;
GetGridNoForViewPort( ubX, ubY, sGridNo );
if ( !GridNoOnScreenAndAround( sGridNo, 2 ) )
continue;
@@ -1537,7 +1479,7 @@ void CalculateTrackerRange( )
void AddTrackerObjectsToViewArea( )
{
if ( gsMaxCellY == -1 )
if ( gsMaxCellY < 0 )
return;
register INT32 ubX, ubY, ubZ;
@@ -1551,13 +1493,9 @@ void AddTrackerObjectsToViewArea( )
{
for ( ubZ = 0; ubZ<COVER_Z_CELLS; ++ubZ )
{
INT8& bOverlayType = gCoverViewArea[ubX][ubY][ubZ].bOverlayType;
if ( bOverlayType == TRACKS_VERYOLD || bOverlayType == TRACKS_OLD || bOverlayType == TRACKS_RECENT || bOverlayType == TRACKS_BLOOD )
if ( gCoverViewArea[ubX][ubY][ubZ].bOverlayType == TRACKS_VERYOLD || gCoverViewArea[ubX][ubY][ubZ].bOverlayType == TRACKS_OLD || gCoverViewArea[ubX][ubY][ubZ].bOverlayType == TRACKS_RECENT || gCoverViewArea[ubX][ubY][ubZ].bOverlayType == TRACKS_BLOOD )
{
INT32& sGridNo = gCoverViewArea[ubX][ubY][ubZ].sGridNo;
TileDefines tile = GetOverlayIndex( bOverlayType );
AddCoverObjectToWorld( sGridNo, tile, (BOOLEAN)ubZ, fNightTime );
AddCoverObjectToWorld( gCoverViewArea[ubX][ubY][ubZ].sGridNo, GetOverlayIndex( gCoverViewArea[ubX][ubY][ubZ].bOverlayType ), (BOOLEAN)ubZ, fNightTime );
fChanged = TRUE;
}
}
@@ -1600,3 +1538,47 @@ BOOLEAN TrackerTileHasAdjTile( const INT32& ubX, const INT32& ubY, const INT32&
return FALSE;
}
void CalculateFortify( )
{
// simply get all fortified gridnos and colour them
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > vec = GetAllForticationGridNo( );
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > >::iterator itend = vec.end( );
for ( std::vector< std::pair<INT16, std::pair<UINT8, INT8> > >::iterator it = vec.begin( ); it != itend; ++it )
{
INT16 sX, sY;
ConvertGridNoToXY( (*it).first, &sX, &sY );
gCoverViewArea[sX][sY][(*it).second.second].bOverlayType = (*it).second.first;
}
if ( gsMaxCellY < 0 )
return;
register INT32 ubX, ubY, ubZ;
BOOLEAN fChanged = FALSE;
BOOLEAN fNightTime = NightTime( );
for ( ubX = gsMinCellX; ubX <= gsMaxCellX; ++ubX )
{
for ( ubY = gsMinCellY; ubY <= gsMaxCellY; ++ubY )
{
for ( ubZ = 0; ubZ<COVER_Z_CELLS; ++ubZ )
{
if ( gCoverViewArea[ubX][ubY][ubZ].bOverlayType != INVALID_COVER )
{
AddCoverObjectToWorld( gCoverViewArea[ubX][ubY][ubZ].sGridNo, GetOverlayIndex( gCoverViewArea[ubX][ubY][ubZ].bOverlayType ), (BOOLEAN)ubZ, fNightTime );
fChanged = TRUE;
}
}
}
}
// Re-render the scene!
if ( fChanged )
{
SetRenderFlags( RENDER_FLAG_FULL );
}
}
+22 -38
View File
@@ -1,9 +1,6 @@
#ifndef _DISPLAY_COVER__H_
#define _DISPLAY_COVER__H_
// resets the overlay modes so that everything will be reset at the NEXT display cycle
void ResetOverlayModes();
void DisplayRangeToTarget( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo );
void DisplayCover( BOOLEAN forceUpdate = FALSE);
@@ -56,12 +53,32 @@ enum OVERLAY_VALUES
TRACKS_RECENT,
TRACKS_BLOOD,
MAX_TRACKS,
FORTIFICATIONNODE_REMOVE,
FORTIFICATIONNODE_ADJACENTADJUSTMENT,
FORTIFICATIONNODE_NORMAL,
MAX_FORTIFICATION,
};
enum COVER_DRAW_MODE {
COVER_DRAW_OFF,
DRAW_MODE_OFF,
COVER_DRAW_MERC_VIEW,
COVER_DRAW_ENEMY_VIEW
COVER_DRAW_ENEMY_VIEW,
MINES_DRAW_DETECT_ENEMY,
MINES_DRAW_PLAYERTEAM_NETWORKS,
MINES_DRAW_NETWORKCOLOURING,
MINES_DRAW_NET_A,
MINES_DRAW_NET_B,
MINES_DRAW_NET_C,
MINES_DRAW_NET_D,
DRAW_MODE_TRAIT_RANGE,
DRAW_MODE_TRACKER_SMELL,
DRAW_MODE_FORTIFY,
};
void ChangeSizeOfDisplayCover( INT32 iNewSize );
@@ -74,19 +91,6 @@ INT8 CalcCoverForGridNoBasedOnTeamKnownEnemies( SOLDIERTYPE *pSoldier, INT16 sTa
// ----------------------------- Mines display after this ----------------------------------------
// added by Flugente: display of mine, bombs and tripwire
// Flugente: mines display - stuff needs to be here
// Sevenfm: moved here from DisplayCover.cpp
enum MINES_DRAW_MODE {
MINES_DRAW_OFF,
MINES_DRAW_DETECT_ENEMY,
MINES_DRAW_PLAYERTEAM_NETWORKS,
MINES_DRAW_NETWORKCOLOURING,
MINES_DRAW_NET_A,
MINES_DRAW_NET_B,
MINES_DRAW_NET_C,
MINES_DRAW_NET_D,
MINES_DRAW_MAX
};
void SwitchToTrapNetworkView();
void SwitchToHostileTrapsView();
@@ -95,31 +99,11 @@ void SwitchMineViewOff();
void ToggleTrapNetworkView();
void ToggleHostileTrapsView();
void SwitchMinesDrawModeForNetworks();
// ----------------------------- trait range display after this ----------------------------------------
// added by Flugente: display of ranges and areas of effects for traits
// Flugente: trait draw mode
enum TRAIT_DRAW_MODE {
TRAIT_DRAW_OFF,
TRAIT_DRAW_RANGE,
TRAIT_DRAW_MAX
};
void ToggleTraitRangeView(BOOLEAN fOn = TRUE);
void SetTraitToDisplay( UINT32 aTrait );
void SetGridNoForTraitDisplay( INT32 sGridNo );
// ----------------------------- tracker display after this ----------------------------------------
// added by Flugente: display of ranges and areas of effects for traits
// Flugente: trait draw mode
enum TRACKER_DRAW_MODE {
TRACKER_DRAW_OFF,
TRACKER_DRAW_SMELL,
TRACKER_DRAW_MAX
};
extern TRACKER_DRAW_MODE gubDrawModeTracker;
#endif
+29
View File
@@ -41,6 +41,7 @@
#include "Campaign Types.h"
#include "Strategic Event Handler.h"
#include "Food.h" // added by Flugente
#include "Queen Command.h" // added by Flugente for FindUnderGroundSector(...)
#endif
#ifdef JA2UB
@@ -2403,6 +2404,34 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
sPtsAvailable = (sPtsAvailable + 5) / 10;
usMaximumPts = (usMaximumPts + 5) / 10;
break;
case FORTIFICATION:
sIconIndex_Assignment = 14;
fDoIcon_Assignment = TRUE;
sPtsAvailable = (INT16)(MercPtrs[pFace->ubSoldierID]->GetConstructionPoints( ));
fShowNumber = TRUE;
fShowMaximum = TRUE;
{
if ( MercPtrs[pFace->ubSoldierID]->bSectorZ )
{
UNDERGROUND_SECTORINFO *pSectorInfo;
pSectorInfo = FindUnderGroundSector( MercPtrs[pFace->ubSoldierID]->sSectorX, MercPtrs[pFace->ubSoldierID]->sSectorY, MercPtrs[pFace->ubSoldierID]->bSectorZ );
if ( pSectorInfo )
usMaximumPts = (INT16)(pSectorInfo->dFortification_MaxPossible);
}
else
{
SECTORINFO *pSectorInfo;
pSectorInfo = &SectorInfo[SECTOR( MercPtrs[pFace->ubSoldierID]->sSectorX, MercPtrs[pFace->ubSoldierID]->sSectorY )];
if ( pSectorInfo )
usMaximumPts = (INT16)(pSectorInfo->dFortification_MaxPossible);
}
}
break;
}
// Check for being serviced...
+1274 -22
View File
File diff suppressed because it is too large Load Diff
+37
View File
@@ -84,7 +84,9 @@ typedef struct {
UINT16 usDeconstructItem; // the item that has to be used to deconstruct the structure
UINT16 usItemToCreate; // the item that will be created when we deconstruct a structure
UINT8 usCreatedItemStatus; // status of the item to create
char szTileSetDisplayName[20]; // name of this structure to the player (tileset names are obscure)
char szTileSetName[20]; // name of the tileset
FLOAT dCreationCost; // assignment cost per structure built
std::vector<UINT8> tilevector; // structures in the tileset that we can deconstruct
} STRUCTURE_DECONSTRUCT;
@@ -95,7 +97,10 @@ extern STRUCTURE_DECONSTRUCT gStructureDeconstruct[STRUCTURE_DECONSTRUCT_MAX];
typedef struct {
UINT16 usCreationItem; // the item that will be consumed when creating the structure
UINT8 usItemStatusLoss; // item will lose this number of status points
char szTileSetDisplayName[20]; // name of this structure to the player (tileset names are obscure)
char szTileSetName[20]; // name of the tileset
FLOAT dCreationCost; // assignment cost per structure built
BOOLEAN fFortifyAdjacentAdjustment; // if true, try to fit adjacent fortifications
std::vector<UINT8> northtilevector; // structures in the tileset we can create while facing north
std::vector<UINT8> southtilevector; // structures in the tileset we can create while facing south
std::vector<UINT8> easttilevector; // structures in the tileset we can create while facing east
@@ -214,6 +219,38 @@ BOOLEAN IsStructureDeconstructItem( UINT16 usItem, INT32 sGridNo, SOLDIERTYPE* p
BOOLEAN BuildFortification( INT32 sGridNo, SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ); // build a structure, return true if sucessful
BOOLEAN RemoveFortification( INT32 sGridNo, SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ); // remove a structure, return true if sucessful
// Flugente: functions for fortification
UINT8 CheckBuildFortification( INT32 sGridNo, INT8 sLevel, UINT8 usIndex, UINT32 usStructureconstructindex );
BOOLEAN BuildFortification( INT32 sGridNo, INT8 sLevel, UINT8 usIndex, UINT32 usStructureconstructindex );
BOOLEAN CanRemoveFortification( INT32 sGridNo, INT8 sLevel, UINT32 usStructureconstructindex );
BOOLEAN RemoveFortification( INT32 sGridNo, INT8 sLevel, UINT32 usStructureconstructindex );
void UpdateFortificationPossibleAmount();
void HandleFortificationUpdate();
// get a vector of all tilesets the current sector has
std::vector<std::pair<INT16, STR16> > GetCurrentSectorTileSetVector();
// get a vector of all tilesets that are allowed to be built in this sector (the above filtered by structure construct/deconstruct basically)
std::vector<std::pair<INT16, STR16> > GetCurrentSectorAllowedFortificationTileSetVector( INT32 asTileSetId );
// get all allowed indizes for a specific tileset. 'Allowed' as in: used in our structure construct entries
std::vector<std::pair<INT16, STR16> > GetTileSetIndexVector( INT16 aKey );
std::string GetNameToTileSet( UINT8 aIndex );
INT16 GetStructureConstructIndexToTileset( INT16 aTileset );
INT16 GetStructureDeConstructIndexToTileset( INT16 aTileset );
std::set<UINT8> GetStructureConstructDirectionIndizes( INT16 aEntry, BOOLEAN afNorth, BOOLEAN afEast, BOOLEAN afSouth, BOOLEAN afWest );
void AddFortificationPlanNode( INT32 sGridNo, INT8 sLevel, INT16 sFortificationStructure, UINT8 usFortificationTileLibraryIndex, BOOLEAN fAdd );
void LoadSectorFortificationPlan( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ );
void SaveSectorFortificationPlan( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ );
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > GetAllForticationGridNo( );
INT32 GetFirstObjectInSectorPosition( UINT16 ausItem );
extern ITEM_POOL *gpItemPool;//dnl ch26 210909
#endif
+1
View File
@@ -196,6 +196,7 @@ enum {
BG_DISLIKEBG, // dislike any other background that has the negative of this value set
BG_SMOKERTYPE, // 0: doesnt care about smoking 1: will consume cigarettes, dislikes non-smokers 2: will refuse to smoke, dislikes smokers
BG_CROUCHEDDEFENSE, // lowers enemy cth if they fire at us while we are crouched against cover in the direction the shots come from
BG_FORTIFY_ASSIGNMENT, // modifies effectivity of 'FORTIFICATION' assignemnt
BG_MAX,
};
+21 -2
View File
@@ -18965,6 +18965,25 @@ BOOLEAN SOLDIERTYPE::IsCrouchedAgainstCoverFromDir( UINT8 aDirection )
}
// Flugente: fortification
FLOAT SOLDIERTYPE::GetConstructionPoints( )
{
if ( this->stats.bLife < OKLIFE || this->flags.fMercAsleep || this->bCollapsed || (this->usSoldierFlagMask & SOLDIER_POW) )
return 0;
UINT32 val = EffectiveStrength( this, FALSE );
ReducePointsForFatigue( this, &val );
FLOAT dval = val;
dval = dval * (100 + this->GetBackgroundValue( BG_FORTIFY_ASSIGNMENT )) / 100.0f;
dval = (dval * this->stats.bLife / this->stats.bLifeMax);
return dval;
}
INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
{
INT8 bBandaged; //,savedOurTurn;
@@ -22773,13 +22792,13 @@ void HandleVolunteerRecruitment( SOLDIERTYPE* pRecruiter, SOLDIERTYPE* pTarget )
}
// several factors determine whether we can successfully recruit this guy
FLOAT leadershipfactor = EffectiveLeadership( pRecruiter ) / 100.0;
FLOAT leadershipfactor = EffectiveLeadership( pRecruiter ) / 100.0f;
// bonus for assertive characters
if ( DoesMercHavePersonality( pRecruiter, CHAR_TRAIT_ASSERTIVE ) )
leadershipfactor *= 1.05;
FLOAT recruitmodifier = (100 + pRecruiter->GetBackgroundValue( BG_PERC_APPROACH_RECRUIT )) / 100.0;
FLOAT recruitmodifier = (100 + pRecruiter->GetBackgroundValue( BG_PERC_APPROACH_RECRUIT )) / 100.0f;
FLOAT rating = leadershipfactor * recruitmodifier * gMercProfiles[pRecruiter->ubProfile].usApproachFactor[3];
+3
View File
@@ -1914,6 +1914,9 @@ public:
// Flugente: are we crouched against cover from a specific direction? WARNING: This does not suffice to determine our cover!
BOOLEAN IsCrouchedAgainstCoverFromDir( UINT8 aDirection );
// Flugente: fortification
FLOAT GetConstructionPoints( );
//////////////////////////////////////////////////////////////////////////////
}; // SOLDIERTYPE;
+146 -48
View File
@@ -121,6 +121,7 @@
#include "DisplayCover.h" // added by Sevenfm
#include "InterfaceItemImages.h" // added by Sevenfm
#include "DynamicDialogueWidget.h" // added by Flugente for DelayBoxDestructionBy(...)
#include "Utilities.h" // added by Flugente
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -161,7 +162,6 @@ UINT32 guiUITargetSoldierId = NOBODY;
// sevenfm: for cover dialog
extern COVER_DRAW_MODE gubDrawMode;
extern MINES_DRAW_MODE gubDrawModeMine;
extern MOUSE_REGION gMPanelRegion;
@@ -193,6 +193,12 @@ extern INT32 giSMStealthButton;
SOLDIERTYPE *gpExchangeSoldier1;
SOLDIERTYPE *gpExchangeSoldier2;
// Flugente: fortification
INT16 gCurrentFortificationStructure = -1;
UINT8 gCurrentFortificationTileLibraryIndex = 0;
extern UINT32 guiMessageBoxImage;
extern UINT16 guiMessageBoxImageIndex;
BOOLEAN ConfirmActionCancel( INT32 usMapPos, INT32 usOldMapPos );
@@ -338,6 +344,7 @@ INT32 InvItemType( UINT16 usItem );
void HandleTacticalInventoryMenu( void );
void HandleTacticalMoveItems( void );
void TacticalInventoryMessageBoxCallBack( UINT8 ubExitValue );
void FortificationSettingCallBack( UINT8 ubExitValue );
void HandleTacticalCoverMenu( void );
void TacticalCoverMessageBoxCallBack( UINT8 ubExitValue );
void ActivateCheatsMessageBoxCallBack( UINT8 ubExitValue );
@@ -3000,9 +3007,93 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
case 'a':
if ( fCtrl )
if ( fCtrl && fAlt )
{
// free to use
// Flugente: fortification
// set details on how to place fortification nodes
// loop over all structure constructs, and select those entries that are possible in this map
std::vector<std::pair<INT16, STR16> > dropdownvector_1 = GetCurrentSectorAllowedFortificationTileSetVector( giCurrentTilesetID );
DropDownTemplate<DROPDOWNNR_MSGBOX_1>::getInstance( ).SetEntries( dropdownvector_1 );
if ( !dropdownvector_1.empty() )
{
BOOLEAN found = FALSE;
for ( std::vector<std::pair<INT16, STR16> >::iterator it = dropdownvector_1.begin( ); it != dropdownvector_1.end(); ++it )
{
if ( (*it).first == gCurrentFortificationStructure )
{
found = TRUE;
break;
}
}
if ( !found )
gCurrentFortificationStructure = dropdownvector_1[0].first;
}
DropDownTemplate<DROPDOWNNR_MSGBOX_1>::getInstance( ).SetSelectedEntryKey( gCurrentFortificationStructure );
std::vector<std::pair<INT16, STR16> > dropdownvector_2 = GetTileSetIndexVector( gCurrentFortificationStructure );
DropDownTemplate<DROPDOWNNR_MSGBOX_2>::getInstance( ).SetEntries( dropdownvector_2 );
if ( !dropdownvector_2.empty( ) )
{
BOOLEAN found = FALSE;
for ( std::vector<std::pair<INT16, STR16> >::iterator it = dropdownvector_2.begin( ); it != dropdownvector_2.end( ); ++it )
{
if ( (*it).first == guiMessageBoxImageIndex )
{
found = TRUE;
break;
}
}
if ( !found )
guiMessageBoxImageIndex = dropdownvector_2[0].first;
}
DropDownTemplate<DROPDOWNNR_MSGBOX_2>::getInstance( ).SetSelectedEntryKey( guiMessageBoxImageIndex );
if ( dropdownvector_1.empty( ) || dropdownvector_2.empty() )
{
CHAR16 text[100];
swprintf( text, szFortificationText[4], giCurrentTilesetID, gTilesets[giCurrentTilesetID].zName );
DoMessageBox( MSG_BOX_BASIC_STYLE, text, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
}
else
{
CHAR16 text[100];
swprintf( text, szFortificationText[5], giCurrentTilesetID, gTilesets[giCurrentTilesetID].zName );
VOBJECT_DESC VObjectDesc;
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
sprintf( VObjectDesc.ImageFile, "TILESETS\\%d\\%s", giCurrentTilesetID, gStructureConstruct[gCurrentFortificationStructure].szTileSetName );
// even if AddVideoObject fails, we still set MSG_BOX_FLAG_IMAGE, as we might 'repair' it while the box is open
if ( !AddVideoObject( &VObjectDesc, &guiMessageBoxImage ) )
{
sprintf( VObjectDesc.ImageFile, "TILESETS\\0\\%s", gStructureConstruct[gCurrentFortificationStructure].szTileSetName );
AddVideoObject( &VObjectDesc, &guiMessageBoxImage );
}
DoMessageBox( MSG_BOX_BASIC_STYLE, text, GAME_SCREEN, (MSG_BOX_FLAG_OK | MSG_BOX_FLAG_DROPDOWN | MSG_BOX_FLAG_IMAGE), FortificationSettingCallBack, NULL );
}
}
else if ( fCtrl )
{
// Flugente: fortification
INT32 sGridNo;
//Get the gridno the cursor is at
GetMouseMapPos( &sGridNo );
// a node to add a structure
AddFortificationPlanNode( sGridNo, gsInterfaceLevel, gCurrentFortificationStructure, gCurrentFortificationTileLibraryIndex, TRUE );
}
else if ( fAlt )
{
@@ -3047,7 +3138,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
else if( fCtrl )
{
// free to use
// Flugente: fortification
INT32 sGridNo;
//Get the gridno the cursor is at
GetMouseMapPos( &sGridNo );
// a node to delete a structure
AddFortificationPlanNode( sGridNo, gsInterfaceLevel, gCurrentFortificationStructure, gCurrentFortificationTileLibraryIndex, FALSE );
}
else
{
@@ -3066,7 +3164,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
break;
case 'c':
if( fAlt )
if ( fAlt && fCtrl )
{
if ( CHEATER_CHEAT_LEVEL( ) )
{
ToggleCliffDebug( );
}
}
else if ( fAlt )
{
if ( CHEATER_CHEAT_LEVEL( ) )
{
@@ -3075,14 +3180,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
else if( fCtrl )
{
if ( CHEATER_CHEAT_LEVEL( ) )
{
ToggleCliffDebug();
}
else
{
HandleTacticalCoverMenu();
}
HandleTacticalCoverMenu();
}
else
{
@@ -8093,6 +8191,12 @@ void TacticalInventoryMessageBoxCallBack( UINT8 ubExitValue )
}
}
void FortificationSettingCallBack( UINT8 ubExitValue )
{
gCurrentFortificationStructure = (UINT8)(DropDownTemplate<DROPDOWNNR_MSGBOX_1>::getInstance( ).GetSelectedEntryKey( ));
gCurrentFortificationTileLibraryIndex = (UINT8)(DropDownTemplate<DROPDOWNNR_MSGBOX_2>::getInstance( ).GetSelectedEntryKey( ));
}
void HandleTacticalCoverMenu( void )
{
for( INT32 cnt = 0; cnt < TACTICAL_COVER_DIALOG_NUM; ++cnt)
@@ -8101,17 +8205,21 @@ void HandleTacticalCoverMenu( void )
gzUserDefinedButtonColor[cnt] = 0;
}
gzUserDefinedButtonColor[0] = 0;
gzUserDefinedButtonColor[1] = FONT_MCOLOR_LTYELLOW;
gzUserDefinedButtonColor[2] = FONT_MCOLOR_LTYELLOW;
gzUserDefinedButtonColor[1] = (gubDrawMode != COVER_DRAW_ENEMY_VIEW) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[2] = (gubDrawMode != COVER_DRAW_MERC_VIEW) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[3] = 0;
gzUserDefinedButtonColor[4] = gDisplayEnemyRoles ? FONT_MCOLOR_LTGREEN : FONT_LTRED;
gzUserDefinedButtonColor[6] = (gubDrawModeTracker == TRACKER_DRAW_OFF) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[8] = FONT_ORANGE;
gzUserDefinedButtonColor[9] = FONT_ORANGE;
gzUserDefinedButtonColor[10] = FONT_ORANGE;
gzUserDefinedButtonColor[12] = FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[13] = FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[14] = FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[15] = FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[5] = (gubDrawMode != DRAW_MODE_FORTIFY) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[6] = (gubDrawMode != DRAW_MODE_TRACKER_SMELL) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[7] = 0;
gzUserDefinedButtonColor[8] = (gubDrawMode != MINES_DRAW_PLAYERTEAM_NETWORKS) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;;
gzUserDefinedButtonColor[9] = (gubDrawMode != MINES_DRAW_NETWORKCOLOURING) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;;
gzUserDefinedButtonColor[10] = (gubDrawMode != MINES_DRAW_DETECT_ENEMY) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;;
gzUserDefinedButtonColor[11] = 0;
gzUserDefinedButtonColor[12] = (gubDrawMode != MINES_DRAW_NET_A) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
gzUserDefinedButtonColor[13] = (gubDrawMode != MINES_DRAW_NET_B) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;;
gzUserDefinedButtonColor[14] = (gubDrawMode != MINES_DRAW_NET_C) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;;
gzUserDefinedButtonColor[15] = (gubDrawMode != MINES_DRAW_NET_D) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;;
DoMessageBox( MSG_BOX_BASIC_STYLE, szTacticalCoverDialogString[0], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS, TacticalCoverMessageBoxCallBack, NULL );
}
@@ -8121,14 +8229,12 @@ void TacticalCoverMessageBoxCallBack( UINT8 ubExitValue )
switch( ubExitValue )
{
case 1:
ResetOverlayModes( );
gubDrawMode = DRAW_MODE_OFF;
break;
case 2:
ResetOverlayModes( );
gubDrawMode = COVER_DRAW_ENEMY_VIEW;
break;
case 3:
ResetOverlayModes( );
gubDrawMode = COVER_DRAW_MERC_VIEW;
break;
case 4:
@@ -8137,49 +8243,41 @@ void TacticalCoverMessageBoxCallBack( UINT8 ubExitValue )
gDisplayEnemyRoles = !gDisplayEnemyRoles;
break;
case 6:
if ( gubDrawMode == DRAW_MODE_FORTIFY )
gubDrawMode = DRAW_MODE_OFF;
else
gubDrawMode = DRAW_MODE_FORTIFY;
break;
case 7:
if ( gubDrawModeTracker == TRACKER_DRAW_SMELL )
{
ResetOverlayModes( );
}
if ( gubDrawMode == DRAW_MODE_TRACKER_SMELL )
gubDrawMode = DRAW_MODE_OFF;
else
{
ResetOverlayModes( );
gubDrawModeTracker = TRACKER_DRAW_SMELL;
}
gubDrawMode = DRAW_MODE_TRACKER_SMELL;
break;
case 8:
break;
case 9:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_PLAYERTEAM_NETWORKS;
gubDrawMode = MINES_DRAW_PLAYERTEAM_NETWORKS;
break;
case 10:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_NETWORKCOLOURING;
gubDrawMode = MINES_DRAW_NETWORKCOLOURING;
break;
case 11:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_DETECT_ENEMY;
gubDrawMode = MINES_DRAW_DETECT_ENEMY;
break;
case 12:
break;
case 13:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_NET_A;
gubDrawMode = MINES_DRAW_NET_A;
break;
case 14:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_NET_B;
gubDrawMode = MINES_DRAW_NET_B;
break;
case 15:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_NET_C;
gubDrawMode = MINES_DRAW_NET_C;
break;
case 16:
ResetOverlayModes( );
gubDrawModeMine = MINES_DRAW_NET_D;
gubDrawMode = MINES_DRAW_NET_D;
break;
}
+6
View File
@@ -133,6 +133,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
strcmp(name, "dislikebackground" ) == 0 ||
strcmp(name, "smoker" ) == 0 ||
strcmp(name, "croucheddefense" ) == 0 ||
strcmp(name, "fortify_assignment" ) == 0 ||
strcmp(name, "druguse") == 0 ||
strcmp(name, "xenophobic") == 0 ||
strcmp(name, "corruptionspread") == 0 ||
@@ -567,6 +568,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curBackground.value[BG_CROUCHEDDEFENSE] = min( 30, max( -30, (INT16)atol( pData->szCharData ) ) );
}
else if ( strcmp( name, "fortify_assignment" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curBackground.value[BG_FORTIFY_ASSIGNMENT] = min( 200, max( -50, (INT16)atol( pData->szCharData ) ) );
}
else if(strcmp(name, "druguse") == 0)
{
pData->curElement = ELEMENT;
+31 -6
View File
@@ -51,7 +51,10 @@ structureconstructStartElementHandle(void *userData, const XML_Char *name, const
else if(pData->curElement == ELEMENT &&
(strcmp(name, "usCreationItem") == 0 ||
strcmp(name, "usItemStatusLoss") == 0 ||
strcmp(name, "szTileSetName") == 0 ||
strcmp(name, "szTileSetDisplayName") == 0 ||
strcmp(name, "szTileSetName" ) == 0 ||
strcmp(name, "dCreationCost" ) == 0 ||
strcmp(name, "fFortifyAdjacentAdjustment" ) == 0 ||
strcmp(name, "northfacingtile") == 0 ||
strcmp(name, "southfacingtile" ) == 0 ||
strcmp(name, "eastfacingtile" ) == 0 ||
@@ -107,7 +110,10 @@ structureconstructEndElementHandle(void *userData, const XML_Char *name)
// for now, copy over the content by hand
pData->curArray[structureconstructcnt].usCreationItem = pData->curFood.usCreationItem;
pData->curArray[structureconstructcnt].usItemStatusLoss= pData->curFood.usItemStatusLoss;
strncpy(pData->curArray[structureconstructcnt].szTileSetName, pData->curFood.szTileSetName, 20);
strncpy( pData->curArray[structureconstructcnt].szTileSetDisplayName, pData->curFood.szTileSetDisplayName, 20 );
strncpy( pData->curArray[structureconstructcnt].szTileSetName, pData->curFood.szTileSetName, 20 );
pData->curArray[structureconstructcnt].dCreationCost = pData->curFood.dCreationCost;
pData->curArray[structureconstructcnt].fFortifyAdjacentAdjustment = pData->curFood.fFortifyAdjacentAdjustment;
pData->curArray[structureconstructcnt].northtilevector = staticnorthtilevector;
pData->curArray[structureconstructcnt].southtilevector = staticsouthtilevector;
pData->curArray[structureconstructcnt].easttilevector = staticeasttilevector;
@@ -136,11 +142,27 @@ structureconstructEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curFood.usItemStatusLoss = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "szTileSetName") == 0)
else if(strcmp(name, "szTileSetDisplayName") == 0)
{
pData->curElement = ELEMENT;
strncpy(pData->curFood.szTileSetName, pData->szCharData, 20);
strncpy( pData->curFood.szTileSetDisplayName, pData->szCharData, 20 );
}
else if ( strcmp( name, "szTileSetName" ) == 0 )
{
pData->curElement = ELEMENT;
strncpy( pData->curFood.szTileSetName, pData->szCharData, 20 );
}
else if ( strcmp( name, "dCreationCost" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curFood.dCreationCost = (FLOAT)atof( pData->szCharData );
}
else if ( strcmp( name, "fFortifyAdjacentAdjustment" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curFood.fFortifyAdjacentAdjustment = (BOOLEAN)atol( pData->szCharData );
}
else if(strcmp(name, "northfacingtile") == 0)
{
@@ -251,8 +273,11 @@ BOOLEAN WriteStructureConstructStats()
FilePrintf(hFile,"\t\t<usCreationItem>%d</usCreationItem>\r\n", gStructureConstruct[cnt].usCreationItem );
FilePrintf(hFile,"\t\t<usItemStatusLoss>%d</usItemStatusLoss>\r\n", gStructureConstruct[cnt].usItemStatusLoss );
FilePrintf(hFile,"\t\t<szTileSetName>%s</szTileSetName>\r\n", gStructureConstruct[cnt].szTileSetName );
FilePrintf(hFile,"\t\t<szTileSetDisplayName>%s</szTileSetDisplayName>\r\n", gStructureConstruct[cnt].szTileSetDisplayName );
FilePrintf(hFile,"\t\t<szTileSetName>%s</szTileSetName>\r\n", gStructureConstruct[cnt].szTileSetName );
FilePrintf(hFile,"\t\t<dCreationCost>%d</dCreationCost>\r\n", gStructureConstruct[cnt].dCreationCost );
FilePrintf(hFile,"\t\t<fFortifyAdjacentAdjustment>%d</fFortifyAdjacentAdjustment>\r\n", gStructureConstruct[cnt].fFortifyAdjacentAdjustment );
FilePrintf(hFile,"\t</STRUCTURE>\r\n");
}
FilePrintf(hFile,"</STRUCTURESLIST>\r\n");
+22 -6
View File
@@ -52,8 +52,10 @@ structuredeconstructStartElementHandle(void *userData, const XML_Char *name, con
(strcmp(name, "usDeconstructItem") == 0 ||
strcmp( name, "usItemToCreate" ) == 0 ||
strcmp( name, "usCreatedItemStatus" ) == 0 ||
strcmp(name, "szTileSetName") == 0 ||
strcmp(name, "allowedtile") == 0 ))
strcmp( name, "szTileSetDisplayName" ) == 0 ||
strcmp( name, "szTileSetName") == 0 ||
strcmp( name, "dCreationCost" ) == 0 ||
strcmp( name, "allowedtile") == 0 ))
{
pData->curElement = ELEMENT_PROPERTY;
@@ -105,9 +107,11 @@ structuredeconstructEndElementHandle(void *userData, const XML_Char *name)
pData->curArray[structuredeconstructcnt].usDeconstructItem = pData->curFood.usDeconstructItem;
pData->curArray[structuredeconstructcnt].usItemToCreate= pData->curFood.usItemToCreate;
pData->curArray[structuredeconstructcnt].usCreatedItemStatus = pData->curFood.usCreatedItemStatus;
strncpy(pData->curArray[structuredeconstructcnt].szTileSetName, pData->curFood.szTileSetName, 20);
strncpy( pData->curArray[structuredeconstructcnt].szTileSetDisplayName, pData->curFood.szTileSetDisplayName, 20 );
strncpy( pData->curArray[structuredeconstructcnt].szTileSetName, pData->curFood.szTileSetName, 20 );
pData->curArray[structuredeconstructcnt].dCreationCost = pData->curFood.dCreationCost;
pData->curArray[structuredeconstructcnt].tilevector = statictilevector;
statictilevector.clear();
}
@@ -128,11 +132,22 @@ structuredeconstructEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curFood.usCreatedItemStatus = (UINT8)atol( pData->szCharData );
}
else if(strcmp(name, "szTileSetName") == 0)
else if(strcmp(name, "szTileSetDisplayName") == 0)
{
pData->curElement = ELEMENT;
strncpy(pData->curFood.szTileSetName, pData->szCharData, 20);
strncpy( pData->curFood.szTileSetDisplayName, pData->szCharData, 20 );
}
else if ( strcmp( name, "szTileSetName" ) == 0 )
{
pData->curElement = ELEMENT;
strncpy( pData->curFood.szTileSetName, pData->szCharData, 20 );
}
else if ( strcmp( name, "dCreationCost" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curFood.dCreationCost = (FLOAT)atof( pData->szCharData );
}
else if(strcmp(name, "allowedtile") == 0)
{
@@ -234,6 +249,7 @@ BOOLEAN WriteStructureDeconstructStats()
FilePrintf(hFile,"\t\t<usDeconstructItem>%d</usDeconstructItem>\r\n", gStructureDeconstruct[cnt].usDeconstructItem );
FilePrintf(hFile,"\t\t<usItemToCreate>%d</usItemToCreate>\r\n", gStructureDeconstruct[cnt].usItemToCreate );
FilePrintf(hFile,"\t\t<usCreatedItemStatus>%d</usCreatedItemStatus>\r\n", gStructureDeconstruct[cnt].usCreatedItemStatus );
FilePrintf(hFile,"\t\t<szTileSetDisplayName>%s</szTileSetDisplayName>\r\n", gStructureDeconstruct[cnt].szTileSetDisplayName );
FilePrintf(hFile,"\t\t<szTileSetName>%s</szTileSetName>\r\n", gStructureDeconstruct[cnt].szTileSetName );
FilePrintf(hFile,"\t</STRUCTURE>\r\n");