mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Fixes (by Sevenfm):
- put back AIM_VISIBILITY calculation in function "CalcNewChanceToHitGun" - fixed possible NULL pointer condition Added an indicator to the NCTH cursor to show aiming penalty for moving target. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8294 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+9
-9
@@ -15,9 +15,9 @@
|
||||
#ifdef JA2EDITOR
|
||||
|
||||
#ifdef JA2UB
|
||||
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8292 (Development Build)" };
|
||||
#else
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8292 (Development Build)" };
|
||||
#endif
|
||||
|
||||
// ------------------------------
|
||||
@@ -27,11 +27,11 @@
|
||||
|
||||
//DEBUG BUILD VERSION
|
||||
#ifdef JA2UB
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8292 (Development Build)" };
|
||||
#elif defined (JA113DEMO)
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8292 (Development Build)" };
|
||||
#else
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8292 (Development Build)" };
|
||||
#endif
|
||||
|
||||
#elif defined CRIPPLED_VERSION
|
||||
@@ -46,16 +46,16 @@
|
||||
|
||||
//RELEASE BUILD VERSION
|
||||
#ifdef JA2UB
|
||||
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8292 (Development Build)" };
|
||||
#elif defined (JA113DEMO)
|
||||
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8292 (Development Build)" };
|
||||
#else
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.8284 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.8292 (Development Build)" };
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
CHAR8 czVersionNumber[16] = { "Build 16.08.11" }; //YY.MM.DD
|
||||
CHAR8 czVersionNumber[16] = { "Build 16.09.03" }; //YY.MM.DD
|
||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||
|
||||
// SAVE_GAME_VERSION is defined in header, change it there
|
||||
|
||||
@@ -2423,6 +2423,7 @@ BOOLEAN DrawCTHIndicator()
|
||||
|
||||
// Find the shooter.
|
||||
SOLDIERTYPE *pSoldier;
|
||||
SOLDIERTYPE *pTarget;
|
||||
GetSoldier( &pSoldier, gusSelectedSoldier );
|
||||
|
||||
OBJECTTYPE* pWeapon = pSoldier->GetUsedWeapon( &pSoldier->inv[ pSoldier->ubAttackingHand ] );
|
||||
@@ -3300,8 +3301,44 @@ BOOLEAN DrawCTHIndicator()
|
||||
NCTHCorrectMaxAperture( iAperture, iDistanceAperture, usCApertureBar );
|
||||
|
||||
Circ = (INT32)((iDistanceAperture * RADIANS_IN_CIRCLE) * dVerticalBias);
|
||||
|
||||
if(gGameSettings.fOptions[ TOPTION_CTH_CURSOR ])
|
||||
{
|
||||
|
||||
pTarget = SimpleFindSoldier(gCTHDisplay.iTargetGridNo, gsInterfaceLevel);
|
||||
|
||||
// Draw movement indicator
|
||||
if ( pTarget )
|
||||
{
|
||||
|
||||
UINT16 usCApertureMove = 0;
|
||||
FLOAT dMuzzleOffsetX = 0;
|
||||
DOUBLE dShootingAngle = atan2( dDeltaY, dDeltaX );
|
||||
|
||||
CalcTargetMovementOffset( pSoldier, pTarget, pWeapon, &dMuzzleOffsetX, dShootingAngle, (INT32)iAperture );
|
||||
|
||||
UINT8 ubRedValues[10] = { 80, 90, 100, 120, 140, 160, 180, 200, 220, 255 };
|
||||
UINT8 ubOtherValues[10] = { 80, 80, 80, 80, 80, 60, 40, 20, 0, 0 };
|
||||
dMuzzleOffsetX = abs(dMuzzleOffsetX) * 10;
|
||||
UINT8 ubColorIndex = 0;
|
||||
|
||||
for (INT16 cntX = 0; cntX < 4; ++cntX)
|
||||
{
|
||||
INT16 curX = iDistanceAperture + 5 + cntX * 5;
|
||||
INT16 curY = -5;
|
||||
ubColorIndex = __min(9, __max(0, dMuzzleOffsetX - (1 + cntX * 2)) );
|
||||
usCApertureMove = Get16BPPColor( FROMRGB( ubRedValues[ubColorIndex], ubOtherValues[ubColorIndex], ubOtherValues[ubColorIndex]) );
|
||||
|
||||
for (INT16 cntY = 0; cntY < 5; ++cntY, ++curX, ++curY)
|
||||
{
|
||||
DrawCTHPixelToBuffer( ptrBuf, uiPitch, sLeft, sTop, sRight, sBottom, sStartScreenX+curX, sStartScreenY+curY+(INT16)zOffset, usCApertureMove );
|
||||
DrawCTHPixelToBuffer( ptrBuf, uiPitch, sLeft, sTop, sRight, sBottom, sStartScreenX-curX, sStartScreenY+curY+(INT16)zOffset, usCApertureMove );
|
||||
DrawCTHPixelToBuffer( ptrBuf, uiPitch, sLeft, sTop, sRight, sBottom, sStartScreenX+curX, sStartScreenY-curY-(INT16)zOffset, usCApertureMove );
|
||||
DrawCTHPixelToBuffer( ptrBuf, uiPitch, sLeft, sTop, sRight, sBottom, sStartScreenX-curX, sStartScreenY-curY-(INT16)zOffset, usCApertureMove );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw outer circle
|
||||
for (INT32 iCurPoint = 0; iCurPoint < Circ; iCurPoint++)
|
||||
{
|
||||
|
||||
+11
-1
@@ -5317,7 +5317,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
|
||||
if (iSightRange == 0) { // didn't do a bodypart-based test or can't see specific body part aimed at
|
||||
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT, false );
|
||||
}
|
||||
if (iSightRange == 0) { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
|
||||
if (ubTargetID != NOBODY && iSightRange == 0) { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
|
||||
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true );
|
||||
fCantSeeTarget = true;
|
||||
}
|
||||
@@ -5519,6 +5519,16 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
|
||||
// get aimbonus from target
|
||||
fAimModifier += CalcNewChanceToHitAimTargetBonus(pSoldier, pTarget, sGridNo, iRange, ubAimPos, fCantSeeTarget);
|
||||
|
||||
// apply a penalty if target cannot clearly be seen
|
||||
// if target is clearly visible iSightRange == iRange otherwise it is higher
|
||||
if (iRange > 0 && iSightRange > iRange && !fCantSeeTarget)
|
||||
{
|
||||
FLOAT fTempPenalty = (FLOAT)((FLOAT)iSightRange / (FLOAT)iRange);
|
||||
fTempPenalty = (FLOAT)(100 / fTempPenalty);
|
||||
fAimModifier += ((100-fTempPenalty) * gGameCTHConstants.AIM_VISIBILITY)/100;
|
||||
fAimModifier = __max( gGameCTHConstants.AIM_TARGET_INVISIBLE, fAimModifier );
|
||||
}
|
||||
|
||||
// factor in scopes under their range
|
||||
if ( !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user