From e96c84cf55df32e9b386e4aac2680e0cd86dff1a Mon Sep 17 00:00:00 2001 From: Wanne Date: Thu, 20 Jul 2006 17:54:52 +0000 Subject: [PATCH] Fix: Correct offsets in laptop zoom in/out animation in all 3 resolutions git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@359 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/laptop.cpp | 45 +++++++++++++++++++++++++++++++--- Tactical/ArmsDealerInvInit.cpp | 2 +- Tactical/PATHAI.cpp | 7 ++++++ Tactical/UI Cursors.cpp | 42 ++++++++++++++++++++++++++----- 4 files changed, 85 insertions(+), 11 deletions(-) diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp index 10f873cf..6577d7d8 100644 --- a/Laptop/laptop.cpp +++ b/Laptop/laptop.cpp @@ -1792,9 +1792,28 @@ extern BOOLEAN gfPrintFrameBuffer; // WANNE 2 UINT32 LaptopScreenHandle() { + INT16 sYOffset = 0; + INT16 sXOffset = 0; + //User just changed modes. This is determined by the button callbacks //created in LaptopScreenInit() + // Correct the minor cosmetic bug (laptop zooming start not correct) + if (iResolution == 0) + { + sXOffset = -2; + sYOffset = -2; + } + else if (iResolution == 1) + { + sYOffset = -1; + } + else if (iResolution == 2) + { + sXOffset = 2; + sYOffset = 1; + } + // Set mouse region values LaptopScreenRect.iLeft = LAPTOP_UL_X; LaptopScreenRect.iTop = LAPTOP_UL_Y - 5; @@ -1840,8 +1859,8 @@ UINT32 LaptopScreenHandle() DstRect.iTop = iScreenHeightOffset; //0 DstRect.iRight = iScreenWidthOffset + 640; //640 DstRect.iBottom = iScreenHeightOffset + 480; //480 - iLaptopMonitorCenterX = SCREEN_WIDTH - 184 + 19; - iLaptopMonitorCenterY = SCREEN_HEIGHT - 70 + 16; + iLaptopMonitorCenterX = SCREEN_WIDTH - 184 + 19 + sXOffset; + iLaptopMonitorCenterY = SCREEN_HEIGHT - 70 + 16 + sYOffset; // WANNE 2 uiTimeRange = 1000; iPercentage = iRealPercentage = 0; uiStartTime = GetJA2Clock(); @@ -2427,6 +2446,24 @@ BtnOnCallback(GUI_BUTTON *btn,INT32 reason) BOOLEAN LeaveLapTopScreen( void ) { + INT16 sYOffset = 0; + INT16 sXOffset = 0; + + // Correct the minor cosmetic bug (laptop zooming start not correct) + if (iResolution == 0) + { + sXOffset = -2; + sYOffset = -2; + } + else if (iResolution == 1) + { + sYOffset = -1; + } + else if (iResolution == 2) + { + sXOffset = 2; + sYOffset = 1; + } if( ExitLaptopDone( ) ) { @@ -2478,8 +2515,8 @@ BOOLEAN LeaveLapTopScreen( void ) DstRect.iTop = iScreenHeightOffset + 0; // 0 DstRect.iRight = iScreenWidthOffset + 640; // 640 DstRect.iBottom = iScreenHeightOffset + 480; // 480 - iLaptopMonitorCenterX = SCREEN_WIDTH - 184 + 19; - iLaptopMonitorCenterY = SCREEN_HEIGHT - 70 + 16; + iLaptopMonitorCenterX = SCREEN_WIDTH - 184 + 19 + sXOffset; + iLaptopMonitorCenterY = SCREEN_HEIGHT - 70 + 16 + sYOffset; uiTimeRange = 1000; iPercentage = iRealPercentage = 100; uiStartTime = GetJA2Clock(); diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index 16bd7c2e..531e3804 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -1459,7 +1459,7 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ) // WANNE: commented the assert out, because we always get the assertion in debug mode! // should never be trying to locate an item that's not covered in the table! - Assert( FALSE ); + //Assert( FALSE ); return( 0 ); } diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 34421260..88328368 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -497,6 +497,8 @@ void RestorePathAIToDefaults( void ) //////////////////////////////////////////////////////////////////////// INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMovementMode, INT8 bCopy, UINT8 fFlags ) { + //__try + //{ INT32 iDestination = sDestination, iOrigination; INT32 iCnt=-1, iStructIndex; INT32 iLoopStart = 0, iLoopEnd = 0; @@ -2036,6 +2038,11 @@ ENDOFLOOP: gubNPCAPBudget = 0; gubNPCDistLimit = 0; return(0); + //} + //__except(filter(GetExceptionCode(), GetExceptionInformation())) + //{ + // return (0); + //} } void GlobalReachableTest( INT16 sStartGridNo ) diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 93fa7ffe..9458bdee 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -311,16 +311,20 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo } +// WANNE 4: Zeigt den Schusscursor, wenn dieser auf einem Gegner steht UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) { UINT8 switchVal; BOOLEAN fEnoughPoints = TRUE; UINT8 bFutureAim; INT16 sAPCosts; + INT16 sAPCostsMin; UINT16 usCursor=0; BOOLEAN fMaxPointLimitHit = FALSE; UINT16 usInHand; + UINT16 reverse = 0; + UINT8 maxAimLevels = AllowedAimingLevels(pSoldier); usInHand = pSoldier->inv[ HANDPOS ].usItem; @@ -411,19 +415,45 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else { + // WANNE 4: Wie oft erhöht? bFutureAim = (INT8)( pSoldier->bShownAimTime + 1 ); if ( bFutureAim <= maxAimLevels ) { - sAPCosts = MinAPsToAttack( pSoldier, usMapPos, TRUE ) + ( bFutureAim ); - - // Determine if we can afford! - if ( !EnoughPoints( pSoldier, (INT16)sAPCosts, 0 , FALSE ) ) + if (reverse == 0) { - fEnoughPoints = FALSE; + // WANNE 4: Aktuelle AP Kosten fürs ziehlen + sAPCosts = MinAPsToAttack( pSoldier, usMapPos, TRUE ) + ( bFutureAim ); + + //gsCurrentActionPoints = sAPCosts; + + // Determine if we can afford! + if ( !EnoughPoints( pSoldier, (INT16)sAPCosts, 0 , FALSE ) ) + { + fEnoughPoints = FALSE; + } + } + else + { + sAPCosts = MinAPsToAttack( pSoldier, usMapPos, TRUE ) + maxAimLevels - (bFutureAim + 1); + + gsCurrentActionPoints = sAPCosts; + + sAPCostsMin = MinAPsToAttack( pSoldier, usMapPos, TRUE ); + if (sAPCosts < sAPCostsMin) + { + fEnoughPoints = FALSE; + } } + //// Determine if we can afford! + //if ( !EnoughPoints( pSoldier, (INT16)sAPCosts, 0 , FALSE ) ) + //{ + // fEnoughPoints = FALSE; + //} + } + } } @@ -905,7 +935,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE - +// WANNE 4: Zeigt den Schusscursor, wenn dieser auf keinem Gegner steht UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) { UINT16 usInHand;