mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
New display mode: "CTH mode" displays a very rough cth indication in the current merc's firing cone. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=344441&#msg_344441
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8099 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -326,8 +326,6 @@ BOOLEAN EnterPMCContract( )
|
||||
if ( SectorOursAndPeaceful( sX, sY, 0 ) )
|
||||
{
|
||||
// if militia can land in this sector, add it to our list
|
||||
// Is there a prison in this sector?
|
||||
UINT16 prisonerbaselimit = 0;
|
||||
for ( UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt )
|
||||
{
|
||||
// Is this facility here?
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
// HEADROCK HAM B2.7: Allow calling a CTH approximation function for the CTH display ("F" key)
|
||||
#include "UI Cursors.h"
|
||||
#include "soldier profile type.h"
|
||||
#include "Interface Cursors.h" // added by Flugente for UICursorDefines
|
||||
#endif
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
@@ -91,6 +92,7 @@ void CalculateMines();
|
||||
void CalculateTraitRange();
|
||||
void CalculateTrackerRange();
|
||||
void CalculateFortify();
|
||||
void CalculateWeapondata();
|
||||
|
||||
void GetGridNoForViewPort( const INT32& ubX, const INT32& ubY, INT32& sGridNo );
|
||||
|
||||
@@ -514,6 +516,10 @@ void DisplayCover( BOOLEAN forceUpdate )
|
||||
case DRAW_MODE_FORTIFY:
|
||||
CalculateFortify( );
|
||||
break;
|
||||
|
||||
case DRAW_MODE_WEAPONDATA:
|
||||
CalculateWeapondata();
|
||||
break;
|
||||
}
|
||||
|
||||
guiCoverNextUpdateTime = GetTickCount() + gGameExternalOptions.ubCoverDisplayUpdateWait;
|
||||
@@ -1582,3 +1588,181 @@ void CalculateFortify( )
|
||||
SetRenderFlags( RENDER_FLAG_FULL );
|
||||
}
|
||||
}
|
||||
|
||||
extern INT32 gsPhysicsImpactPointGridNo;
|
||||
extern UINT32 guiNewUICursor;
|
||||
|
||||
void CalculateWeapondata()
|
||||
{
|
||||
if ( gsMaxCellY < 0 )
|
||||
return;
|
||||
|
||||
INT32 ubX, ubY;
|
||||
INT8 ubZ;
|
||||
SOLDIERTYPE* pSoldier;
|
||||
|
||||
if ( gusSelectedSoldier == NOBODY || !GetSoldier( &pSoldier, gusSelectedSoldier ) || !pSoldier->bInSector )
|
||||
return;
|
||||
|
||||
BOOLEAN guninhand = WeaponInHand( pSoldier );
|
||||
|
||||
INT32 sSelectedSoldierGridNo = MercPtrs[gusSelectedSoldier]->sGridNo;
|
||||
|
||||
if ( TileIsOutOfBounds( sSelectedSoldierGridNo ) )
|
||||
return;
|
||||
|
||||
//Get the gridno the cursor is at
|
||||
INT32 sMouseGridNo = NOWHERE;
|
||||
GetMouseMapPos( &sMouseGridNo );
|
||||
|
||||
// depending on whether we have a grenade fire or a bomb to plant, different gridnos are relevant for explosives
|
||||
INT32 explosivetargetgridno = NOWHERE;
|
||||
|
||||
// grenade cursor is stored in gsPhysicsImpactPointGridNo, we have to check whether that's valid, and whether we use that cursor right now
|
||||
BOOLEAN tosscursorisvalid = FALSE;
|
||||
if ( !TileIsOutOfBounds( gsPhysicsImpactPointGridNo ) && (guiNewUICursor == GOOD_THROW_UICURSOR || guiNewUICursor == BAD_THROW_UICURSOR) )
|
||||
{
|
||||
tosscursorisvalid = TRUE;
|
||||
|
||||
explosivetargetgridno = gsPhysicsImpactPointGridNo;
|
||||
}
|
||||
else if ( !TileIsOutOfBounds( sMouseGridNo ) && (guiNewUICursor == PLACE_BOMB_GREY_UICURSOR || guiNewUICursor == PLACE_BOMB_RED_UICURSOR) )
|
||||
{
|
||||
tosscursorisvalid = TRUE;
|
||||
|
||||
explosivetargetgridno = sMouseGridNo;
|
||||
}
|
||||
|
||||
UINT16 gunrange = 0;
|
||||
INT16 laserrange = 0;
|
||||
UINT16 explosionradius = 0;
|
||||
UINT16 fragrange = 0;
|
||||
|
||||
OBJECTTYPE* pObjPlatform = NULL;
|
||||
OBJECTTYPE* pObjUsed = NULL;
|
||||
|
||||
if ( &pSoldier->inv[HANDPOS] && Item[(pSoldier->inv[HANDPOS]).usItem].usItemClass & IC_WEAPON )
|
||||
{
|
||||
pObjPlatform = pSoldier->GetUsedWeapon( &pSoldier->inv[HANDPOS] );
|
||||
|
||||
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )
|
||||
{
|
||||
pObjUsed = FindAttachment_GrenadeLauncher( &pSoldier->inv[HANDPOS] );
|
||||
}
|
||||
else
|
||||
{
|
||||
pObjUsed = pObjPlatform;
|
||||
}
|
||||
|
||||
gunrange = GunRange( pObjUsed, pSoldier ) / 10;
|
||||
laserrange = GetBestLaserRange( pObjPlatform ) / 10;
|
||||
|
||||
if ( Item[pObjUsed->usItem].usItemClass & IC_LAUNCHER )
|
||||
{
|
||||
OBJECTTYPE *pAttachment = FindLaunchableAttachment( pObjPlatform, pObjUsed->usItem );
|
||||
|
||||
if ( pAttachment )
|
||||
{
|
||||
explosionradius = Explosive[Item[pAttachment->usItem].ubClassIndex].ubRadius;
|
||||
|
||||
fragrange = Explosive[Item[pAttachment->usItem].ubClassIndex].ubFragRange / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( &pSoldier->inv[HANDPOS] && Item[(pSoldier->inv[HANDPOS]).usItem].usItemClass & IC_EXPLOSV )
|
||||
{
|
||||
pObjPlatform = &pSoldier->inv[HANDPOS];
|
||||
|
||||
pObjUsed = pObjPlatform;
|
||||
|
||||
explosionradius = Explosive[Item[pObjUsed->usItem].ubClassIndex].ubRadius;
|
||||
|
||||
fragrange = Explosive[Item[pObjUsed->usItem].ubClassIndex].ubFragRange / 10;
|
||||
}
|
||||
|
||||
// we have to store and later reset the soldier's target level
|
||||
INT8 bTempTargetLevel = pSoldier->bTargetLevel;
|
||||
|
||||
for ( ubX = gsMinCellX; ubX <= gsMaxCellX; ++ubX )
|
||||
{
|
||||
for ( ubY = gsMinCellY; ubY <= gsMaxCellY; ++ubY )
|
||||
{
|
||||
for ( ubZ = 0; ubZ<COVER_Z_CELLS; ++ubZ )
|
||||
{
|
||||
INT32& sGridNo = gCoverViewArea[ubX][ubY][ubZ].sGridNo;
|
||||
|
||||
if ( !GridNoOnScreenAndAround( sGridNo, 2 ) )
|
||||
continue;
|
||||
|
||||
if ( IsTheRoofVisible( sGridNo ) )
|
||||
{
|
||||
// do not show stuff on ground if roof is shown
|
||||
if ( ubZ == I_GROUND_LEVEL )
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do not show stuff on roofs if ground is shown
|
||||
if ( ubZ == I_ROOF_LEVEL )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !NewOKDestination( pSoldier, sGridNo, false, ubZ ) )
|
||||
continue;
|
||||
|
||||
if ( tosscursorisvalid && explosionradius > 0 && PythSpacesAway( explosivetargetgridno, sGridNo ) <= explosionradius )
|
||||
gCoverViewArea[ubX][ubY][ubZ].bOverlayType = NO_COVER;
|
||||
else if ( tosscursorisvalid && fragrange > 0 && PythSpacesAway( explosivetargetgridno, sGridNo ) <= fragrange )
|
||||
gCoverViewArea[ubX][ubY][ubZ].bOverlayType = MIN_COVER;
|
||||
else
|
||||
{
|
||||
if ( GetDirectionToGridNoFromGridNo( sSelectedSoldierGridNo, sGridNo ) != pSoldier->ubDirection )
|
||||
continue;
|
||||
|
||||
if ( guninhand && gunrange > 0 && PythSpacesAway( sSelectedSoldierGridNo, sGridNo ) <= gunrange )
|
||||
{
|
||||
pSoldier->bTargetLevel = ubZ;
|
||||
UINT32 uiHitChance = CalcChanceToHitGun( pSoldier, sGridNo, (INT8)(pSoldier->aiData.bShownAimTime), pSoldier->bAimShotLocation );
|
||||
|
||||
if ( uiHitChance > 75 )
|
||||
gCoverViewArea[ubX][ubY][ubZ].bOverlayType = MAX_COVER;
|
||||
else if ( uiHitChance > 50 )
|
||||
gCoverViewArea[ubX][ubY][ubZ].bOverlayType = MED_COVER;
|
||||
else if ( uiHitChance > 25 )
|
||||
gCoverViewArea[ubX][ubY][ubZ].bOverlayType = MIN_COVER;
|
||||
else if ( uiHitChance > 0 )
|
||||
gCoverViewArea[ubX][ubY][ubZ].bOverlayType = NO_COVER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// important: reset target level to what it really was
|
||||
pSoldier->bTargetLevel = bTempTargetLevel;
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ enum COVER_DRAW_MODE {
|
||||
DRAW_MODE_TRACKER_SMELL,
|
||||
|
||||
DRAW_MODE_FORTIFY,
|
||||
|
||||
DRAW_MODE_WEAPONDATA,
|
||||
};
|
||||
|
||||
void ChangeSizeOfDisplayCover( INT32 iNewSize );
|
||||
|
||||
@@ -5609,8 +5609,8 @@ void GetLaunchItemParamsFromUI( )
|
||||
|
||||
|
||||
static BOOLEAN gfDisplayPhysicsUI = FALSE;
|
||||
static INT32 gsPhysicsImpactPointGridNo;
|
||||
static INT8 gbPhysicsImpactPointLevel;
|
||||
INT32 gsPhysicsImpactPointGridNo = NOWHERE;
|
||||
static INT8 gbPhysicsImpactPointLevel = 0;
|
||||
static BOOLEAN gfBadPhysicsCTGT = FALSE;
|
||||
|
||||
void BeginPhysicsTrajectoryUI( INT32 sGridNo, INT8 bLevel, BOOLEAN fBadCTGT )
|
||||
|
||||
@@ -8211,15 +8211,15 @@ void HandleTacticalCoverMenu( void )
|
||||
gzUserDefinedButtonColor[4] = gDisplayEnemyRoles ? FONT_MCOLOR_LTGREEN : FONT_LTRED;
|
||||
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[7] = (gubDrawMode != DRAW_MODE_WEAPONDATA) ? FONT_LTRED : FONT_MCOLOR_LTGREEN;
|
||||
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;;
|
||||
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 );
|
||||
}
|
||||
@@ -8255,6 +8255,10 @@ void TacticalCoverMessageBoxCallBack( UINT8 ubExitValue )
|
||||
gubDrawMode = DRAW_MODE_TRACKER_SMELL;
|
||||
break;
|
||||
case 8:
|
||||
if ( gubDrawMode == DRAW_MODE_WEAPONDATA )
|
||||
gubDrawMode = DRAW_MODE_OFF;
|
||||
else
|
||||
gubDrawMode = DRAW_MODE_WEAPONDATA;
|
||||
break;
|
||||
case 9:
|
||||
gubDrawMode = MINES_DRAW_PLAYERTEAM_NETWORKS;
|
||||
|
||||
@@ -9793,7 +9793,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"角色", //L"Roles",
|
||||
L"Fortification", // TODO.Translate
|
||||
L"跟踪者",// L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"陷阱",
|
||||
L"绊线网",
|
||||
|
||||
@@ -9806,7 +9806,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Roles", // TODO.Translate
|
||||
L"Fortification", // TODO.Translate
|
||||
L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Traps",
|
||||
L"Network",
|
||||
|
||||
@@ -9844,7 +9844,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Roles",
|
||||
L"Fortification",
|
||||
L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Traps",
|
||||
L"Network",
|
||||
|
||||
@@ -9791,7 +9791,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Roles", // TODO.Translate
|
||||
L"Fortification", // TODO.Translate
|
||||
L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Pièges",
|
||||
L"Réseau",
|
||||
|
||||
@@ -9622,7 +9622,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Roles", // TODO.Translate
|
||||
L"Fortification", // TODO.Translate
|
||||
L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Traps",
|
||||
L"Network",
|
||||
|
||||
@@ -9800,7 +9800,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Roles", // TODO.Translate
|
||||
L"Fortification", // TODO.Translate
|
||||
L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Traps",
|
||||
L"Network",
|
||||
|
||||
@@ -9813,7 +9813,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Roles", // TODO.Translate
|
||||
L"Fortification", // TODO.Translate
|
||||
L"Tracker",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Traps",
|
||||
L"Network",
|
||||
|
||||
@@ -9844,7 +9844,7 @@ STR16 szTacticalCoverDialogString[]=
|
||||
L"Задачи",
|
||||
L"Fortification", // TODO.Translate
|
||||
L"Слежение",
|
||||
L"",
|
||||
L"CTH mode",
|
||||
|
||||
L"Ловушки",
|
||||
L"Сеть",
|
||||
|
||||
Reference in New Issue
Block a user