From f02de44a32808cdfc124ba3983b6781a79030c67 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Mon, 19 Apr 2021 05:37:36 +0000 Subject: [PATCH] Fixes by Shadooow: - fixed queen alternative gridno feature spawning her behind walls in basement instead of in front of the throne in palace - fixed queen alternative gridno feature triggering even when palace was cleared - added missing sanity checks when Climbing/Jumping via UI button git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8961 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Player Command.cpp | 2 +- Tactical/Interface Panels.cpp | 68 +++++++++++++++++++++++++++++++--- Tactical/Soldier Init List.cpp | 1 + 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index b5f3e892d..404a5e78c 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -394,7 +394,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B #else if( sMapX == gModSettings.ubQueenBasementSectorX && sMapY == gModSettings.ubQueenBasementSectorY - && bMapZ == gModSettings.ubQueenBasementSectorZ ) + && bMapZ == gModSettings.ubQueenBasementSectorZ && !SectorInfo[SECTOR(sMapX, sMapY)].fSurfaceWasEverPlayerControlled) { //Basement sector gfUseAlternateQueenPosition = TRUE; } diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index a8e8be6c9..791aa040a 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -4626,24 +4626,70 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); + if (!IsValidStance(gpSMCurrentMerc, ANIM_CROUCH)) + { + if (gpSMCurrentMerc->bCollapsed && gpSMCurrentMerc->bBreath < OKBREATH) + { + ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, gzLateLocalizedString[4], gpSMCurrentMerc->GetName()); + } + return; + } + GetMercClimbDirection( gpSMCurrentMerc->ubID, &fNearLowerLevel, &fNearHeigherLevel ); if ( fNearLowerLevel ) { - gpSMCurrentMerc->BeginSoldierClimbDownRoof( ); + if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true + //JMich.BackpackClimb + && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) + && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) + { + ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]); + return; + } + + if (EnoughPoints(gpSMCurrentMerc, GetAPsToClimbRoof(gpSMCurrentMerc, TRUE), GetBPsToClimbRoof(gpSMCurrentMerc, TRUE), FALSE)) + { + gpSMCurrentMerc->BeginSoldierClimbDownRoof(); + } } + if ( fNearHeigherLevel ) { - gpSMCurrentMerc->BeginSoldierClimbUpRoof( ); + if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true + //JMich.BackpackClimb + && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) + && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) + { + ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]); + return; + } + + if (EnoughPoints(gpSMCurrentMerc, GetAPsToClimbRoof(gpSMCurrentMerc, FALSE), GetBPsToClimbRoof(gpSMCurrentMerc, FALSE), FALSE)) + { + gpSMCurrentMerc->BeginSoldierClimbUpRoof(); + } } //---------------Legion by JAzz----------- if (gGameExternalOptions.fCanClimbOnWalls == TRUE) - { + { + if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true + //JMich.BackpackClimb + && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) + && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) + { + ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]); + return; + } + if ( FindWallJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) ) { - gpSMCurrentMerc->BeginSoldierClimbWall( ); + if (EnoughPoints(gpSMCurrentMerc, GetAPsToJumpWall(gpSMCurrentMerc, FALSE), GetBPsToJumpWall(gpSMCurrentMerc, FALSE), FALSE)) + { + gpSMCurrentMerc->BeginSoldierClimbWall(); + } } } @@ -4651,7 +4697,19 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason) if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) ) { - gpSMCurrentMerc->BeginSoldierClimbFence( ); + if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true + //JMich.BackpackClimb + && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) + && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) + { + ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]); + return; + } + + if (EnoughPoints(gpSMCurrentMerc, GetAPsToJumpFence(gpSMCurrentMerc, FALSE), GetBPsToJumpFence(gpSMCurrentMerc, FALSE), FALSE)) + { + gpSMCurrentMerc->BeginSoldierClimbFence(); + } } } else if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 1b174fd70..258d93577 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -737,6 +737,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) if( gfUseAlternateQueenPosition && tempDetailedPlacement.ubProfile == QUEEN ) { tempDetailedPlacement.sInsertionGridNo = gModSettings.iQueenAlternateGridNo;//dnl!!! + tempDetailedPlacement.bSectorZ = 0; } if( tempDetailedPlacement.ubCivilianGroup != QUEENS_CIV_GROUP ) { //The free civilians aren't added if queen is alive