mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Fix from Heinz:
1) Fixed error creating new soldiers in DoReinforcementAsPendingEnemy 2) Fixed some bugs in Shopkeeper interface. 3) Fixed CTD when pressing Alt-Y not in cheat mode 4) Save/load screen shouldn't appear during quickload git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2612 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4280,6 +4280,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
|
||||
OutputDebugString( "Resetting attack busy due to load game.\n");
|
||||
#endif
|
||||
gTacticalStatus.ubAttackBusyCount = 0;
|
||||
gfPendingEnemies = CheckPendingEnemies();
|
||||
}
|
||||
|
||||
// ATE: if we are within this window where skyridder was foobared, fix!
|
||||
|
||||
@@ -1600,7 +1600,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
{
|
||||
ubNumElites--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateEliteEnemy();
|
||||
Assert(pSoldier = TacticalCreateEliteEnemy());
|
||||
if( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -1623,7 +1623,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
{
|
||||
ubNumTroops--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateArmyTroop();
|
||||
Assert(pSoldier = TacticalCreateArmyTroop());
|
||||
if( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -1646,7 +1646,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
{
|
||||
ubNumAdmins--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateAdministrator();
|
||||
Assert(pSoldier = TacticalCreateAdministrator());
|
||||
if( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -2184,4 +2184,21 @@ BOOLEAN OnlyHostileCivsInSector()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN CheckPendingEnemies()
|
||||
{
|
||||
if( gbWorldSectorZ ) return FALSE;
|
||||
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
if( (pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins) > ( pSector->ubElitesInBattle + pSector->ubTroopsInBattle + pSector->ubAdminsInBattle) )
|
||||
return TRUE;
|
||||
for (GROUP *pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
||||
{
|
||||
if( !pGroup->fPlayer
|
||||
&& !pGroup->fVehicle
|
||||
&& pGroup->ubSectorX == gWorldSectorX
|
||||
&& pGroup->ubSectorY == gWorldSectorY
|
||||
&& pGroup->ubGroupSize > pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,4 +56,6 @@ BOOLEAN OnlyHostileCivsInSector();
|
||||
|
||||
extern INT16 gsInterrogationGridNo[3];
|
||||
|
||||
BOOLEAN CheckPendingEnemies();
|
||||
|
||||
#endif
|
||||
@@ -247,7 +247,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
GROUP *pGroup;
|
||||
//ENEMYGROUP *pEnemyGroup;
|
||||
SECTORINFO *pThisSector, *pSector;
|
||||
|
||||
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
return 255;
|
||||
|
||||
@@ -274,7 +274,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
}
|
||||
}
|
||||
|
||||
while( ubDirNumber > 0)
|
||||
while( ubDirNumber > 0 )
|
||||
{
|
||||
ubIndex = Random(ubDirNumber);
|
||||
|
||||
@@ -286,26 +286,22 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
(pThisSector->ubNumElites)++;
|
||||
(pSector->ubNumElites)--;
|
||||
(pThisSector->ubElitesInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 0, 1, FALSE );
|
||||
}else if( pSector->ubNumTroops )
|
||||
{
|
||||
(pThisSector->ubNumTroops)++;
|
||||
(pSector->ubNumTroops)--;
|
||||
(pThisSector->ubTroopsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 1, 0, FALSE );
|
||||
}else if( pSector->ubNumAdmins )
|
||||
{
|
||||
(pThisSector->ubNumAdmins)++;
|
||||
(pSector->ubNumAdmins)--;
|
||||
(pThisSector->ubAdminsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 1, 0, 0, FALSE );
|
||||
}
|
||||
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ],
|
||||
pThisSector->ubNumAdmins - pThisSector->ubAdminsInBattle,
|
||||
pThisSector->ubNumTroops - pThisSector->ubTroopsInBattle,
|
||||
pThisSector->ubNumElites - pThisSector->ubElitesInBattle,
|
||||
FALSE );
|
||||
|
||||
pThisSector->ubAdminsInBattle = pThisSector->ubNumAdmins;
|
||||
pThisSector->ubTroopsInBattle = pThisSector->ubNumTroops;
|
||||
pThisSector->ubElitesInBattle = pThisSector->ubNumElites;
|
||||
|
||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||
}
|
||||
else
|
||||
@@ -458,3 +454,4 @@ void AddPossiblePendingMilitiaToBattle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2828,7 +2828,7 @@ void InitItemDescriptionBoxStartCoords( BOOLEAN fIsEnhanced )
|
||||
{
|
||||
ITEMDESC_START_X = 259;
|
||||
ITEMDESC_START_Y = (1 + INV_INTERFACE_START_Y);
|
||||
ITEMDESC_HEIGHT = 195;
|
||||
ITEMDESC_HEIGHT = guiCurrentItemDescriptionScreen == SHOPKEEPER_SCREEN ? 133 : 195;
|
||||
ITEMDESC_WIDTH = 320; // OIV only
|
||||
}
|
||||
else // ODB/OIV
|
||||
|
||||
@@ -3011,7 +3011,8 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
else
|
||||
{
|
||||
// Send message
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_DO_INV_STUFF_STR ] );
|
||||
//Heinz: 23.02.09 BUGFIX: Don't send message when SKI is on
|
||||
if( !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_DO_INV_STUFF_STR ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,6 @@ extern BOOLEAN BltVSurfaceUsingDD( HVSURFACE hDestVSurface, HVSURFACE hSrcVSurf
|
||||
|
||||
extern UINT8 gubLastSpecialItemAddedAtElement;
|
||||
|
||||
|
||||
//Enums for the various Atm modes
|
||||
enum
|
||||
{
|
||||
@@ -790,12 +789,18 @@ UINT32 ShopKeeperScreenHandle()
|
||||
// render buttons marked dirty
|
||||
//ATM:
|
||||
DisableSMPpanelButtonsWhenInShopKeeperInterface( FALSE );
|
||||
//Heinz: 22.02.09 BUGFIX: buttons should not render upon shopkeeper's message
|
||||
if( gfIsTheShopKeeperTalking && !gfInItemDescBox )
|
||||
{
|
||||
ButtonList[ guiSKI_TransactionButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
ButtonList[ guiSKI_DoneButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
}
|
||||
RenderButtons( );
|
||||
|
||||
RenderItemDescriptionBox( );
|
||||
// render help
|
||||
SaveBackgroundRects( );
|
||||
RenderButtonsFastHelp( );
|
||||
|
||||
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
|
||||
@@ -912,8 +917,12 @@ BOOLEAN EnterShopKeeperInterface()
|
||||
|
||||
// Create a video surface to blt corner of the tactical screen that still shines through
|
||||
vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE;
|
||||
vs_desc.usWidth = SKI_TACTICAL_BACKGROUND_START_WIDTH;
|
||||
vs_desc.usHeight = SKI_TACTICAL_BACKGROUND_START_HEIGHT;
|
||||
//Heinz: 22.02.09 BUGFIX: best way - to update whole tactical screen around SKI
|
||||
//vs_desc.usWidth = SKI_TACTICAL_BACKGROUND_START_WIDTH;
|
||||
//vs_desc.usHeight = SKI_TACTICAL_BACKGROUND_START_HEIGHT;
|
||||
vs_desc.usWidth = SCREEN_WIDTH;
|
||||
vs_desc.usHeight = SCREEN_HEIGHT;
|
||||
|
||||
vs_desc.ubBitDepth = 16;
|
||||
if( !AddVideoSurface( &vs_desc, &guiCornerWhereTacticalIsStillSeenImage) )
|
||||
{
|
||||
@@ -923,8 +932,10 @@ BOOLEAN EnterShopKeeperInterface()
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Heinz: 22.02.09 shadowing of tactical screen for further using as a background
|
||||
ShadowVideoSurfaceRect( guiCornerWhereTacticalIsStillSeenImage, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
//Clear out all the save background rects
|
||||
EmptyBackgroundRects( );
|
||||
|
||||
@@ -1361,8 +1372,9 @@ void HandleShopKeeperInterface()
|
||||
//make sure the buttons dont render
|
||||
// ButtonList[ guiSKI_InvPageUpButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
// ButtonList[ guiSKI_InvPageDownButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
ButtonList[ guiSKI_TransactionButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
ButtonList[ guiSKI_DoneButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
//Heinz: 22.02.09 BUGFIX: buttons should render for items in inventory with EDB
|
||||
//ButtonList[ guiSKI_TransactionButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
//ButtonList[ guiSKI_DoneButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
|
||||
|
||||
|
||||
// make sure the shop keeper doesn't start talking ( reset the timing variable )
|
||||
@@ -1450,8 +1462,9 @@ void HandleShopKeeperInterface()
|
||||
//if the merc is talking and there is an item currently being highlighted
|
||||
// ( this gets rid of the item burning through the dealers text box )
|
||||
if( gfIsTheShopKeeperTalking )
|
||||
if( gpHighLightedItemObject != NULL || gubSkiDirtyLevel != SKI_DIRTY_LEVEL0 )
|
||||
RenderMercPopUpBoxFromIndex( giPopUpBoxId, gusPositionOfSubTitlesX, SKI_POSITION_SUBTITLES_Y, FRAME_BUFFER);
|
||||
//Heinz: 23.02.09 BUGFIX: if shopkeeper is talking we should render popup in all cases
|
||||
//if( gpHighLightedItemObject != NULL || gubSkiDirtyLevel != SKI_DIRTY_LEVEL0 )
|
||||
RenderMercPopUpBoxFromIndex( giPopUpBoxId, gusPositionOfSubTitlesX, SKI_POSITION_SUBTITLES_Y, FRAME_BUFFER);
|
||||
|
||||
|
||||
//if we are to display the drop item to ground text
|
||||
@@ -1515,8 +1528,9 @@ BOOLEAN RenderShopKeeperInterface()
|
||||
InsertDollarSignInToString( zMoney );
|
||||
DrawTextToScreen( zMoney, SKI_PLAYERS_CURRENT_BALANCE_X, SKI_PLAYERS_CURRENT_BALANCE_OFFSET_TO_VALUE, SKI_PLAYERS_CURRENT_BALANCE_WIDTH, FONT10ARIAL, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, TRUE, CENTER_JUSTIFIED );
|
||||
|
||||
BlitBufferToBuffer( guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SKI_TACTICAL_BACKGROUND_START_X, SKI_TACTICAL_BACKGROUND_START_HEIGHT );
|
||||
|
||||
//Heinz: 22.02.09 BUGFIX: best way - to update whole tactical screen around SKI
|
||||
//BlitBufferToBuffer( guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SKI_TACTICAL_BACKGROUND_START_X, SKI_TACTICAL_BACKGROUND_START_HEIGHT );
|
||||
BlitBufferToBuffer( guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
//At this point the background is pure, copy it to the save buffer
|
||||
if( gfRenderScreenOnNextLoop )
|
||||
{
|
||||
@@ -1524,12 +1538,17 @@ BOOLEAN RenderShopKeeperInterface()
|
||||
GetVideoSurface( &hDestVSurface, guiCornerWhereTacticalIsStillSeenImage );
|
||||
GetVideoSurface( &hSrcVSurface, guiSAVEBUFFER );
|
||||
|
||||
SrcRect.iLeft = SKI_TACTICAL_BACKGROUND_START_X;
|
||||
SrcRect.iTop = SKI_TACTICAL_BACKGROUND_START_Y;
|
||||
SrcRect.iRight = SKI_TACTICAL_BACKGROUND_START_X + SKI_TACTICAL_BACKGROUND_START_WIDTH;
|
||||
SrcRect.iBottom = SKI_TACTICAL_BACKGROUND_START_Y + SKI_TACTICAL_BACKGROUND_START_HEIGHT;
|
||||
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SKI_TACTICAL_BACKGROUND_START_X, SKI_TACTICAL_BACKGROUND_START_Y, (RECT*)&SrcRect );
|
||||
//Heinz: 22.02.09 BUGFIX: best way - to update whole tactical screen around SKI
|
||||
//SrcRect.iLeft = SKI_TACTICAL_BACKGROUND_START_X;
|
||||
//SrcRect.iTop = SKI_TACTICAL_BACKGROUND_START_Y;
|
||||
//SrcRect.iRight = SKI_TACTICAL_BACKGROUND_START_X + SKI_TACTICAL_BACKGROUND_START_WIDTH;
|
||||
//SrcRect.iBottom = SKI_TACTICAL_BACKGROUND_START_Y + SKI_TACTICAL_BACKGROUND_START_HEIGHT;
|
||||
//BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SKI_TACTICAL_BACKGROUND_START_X, SKI_TACTICAL_BACKGROUND_START_Y, (RECT*)&SrcRect );
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = 0;
|
||||
SrcRect.iRight = SCREEN_WIDTH;
|
||||
SrcRect.iBottom = SCREEN_HEIGHT;
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, 0, 0, (RECT*)&SrcRect );
|
||||
|
||||
gfRenderScreenOnNextLoop = FALSE;
|
||||
}
|
||||
@@ -1574,14 +1593,37 @@ void RestoreTacticalBackGround()
|
||||
GetVideoSurface( &hDestVSurface, guiRENDERBUFFER );
|
||||
GetVideoSurface( &hSrcVSurface, guiCornerWhereTacticalIsStillSeenImage );
|
||||
|
||||
//Heinz: 22.02.09 BUGFIX: best way - to update whole tactical screen around SKI
|
||||
//SrcRect.iLeft = SKI_TACTICAL_BACKGROUND_START_X; //0;
|
||||
//SrcRect.iTop = SKI_TACTICAL_BACKGROUND_START_Y; //0;
|
||||
//SrcRect.iRight = SKI_TACTICAL_BACKGROUND_START_WIDTH; //SKI_TACTICAL_BACKGROUND_START_WIDTH;
|
||||
//SrcRect.iBottom = SKI_TACTICAL_BACKGROUND_START_HEIGHT; //SKI_TACTICAL_BACKGROUND_START_HEIGHT;
|
||||
|
||||
//BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SKI_TACTICAL_BACKGROUND_START_X, SKI_TACTICAL_BACKGROUND_START_Y, (RECT*)&SrcRect );
|
||||
// Top
|
||||
SrcRect.iLeft = SKI_TACTICAL_BACKGROUND_START_X; //0;
|
||||
SrcRect.iTop = SKI_TACTICAL_BACKGROUND_START_Y; //0;
|
||||
SrcRect.iRight = SKI_TACTICAL_BACKGROUND_START_WIDTH; //SKI_TACTICAL_BACKGROUND_START_WIDTH;
|
||||
SrcRect.iBottom = SKI_TACTICAL_BACKGROUND_START_HEIGHT; //SKI_TACTICAL_BACKGROUND_START_HEIGHT;
|
||||
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SKI_TACTICAL_BACKGROUND_START_X, SKI_TACTICAL_BACKGROUND_START_Y, (RECT*)&SrcRect );
|
||||
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = 0;
|
||||
SrcRect.iRight = SCREEN_WIDTH;
|
||||
SrcRect.iBottom = SCREEN_Y_OFFSET;
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SrcRect.iLeft, SrcRect.iTop, (RECT*)&SrcRect );
|
||||
// Bottom
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = SCREEN_Y_OFFSET + SKI_INTERFACE_HEIGHT;
|
||||
SrcRect.iRight = SCREEN_WIDTH;
|
||||
SrcRect.iBottom = SCREEN_HEIGHT - INV_INTERFACE_HEIGHT;
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SrcRect.iLeft, SrcRect.iTop, (RECT*)&SrcRect );
|
||||
// Left
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = SCREEN_Y_OFFSET;
|
||||
SrcRect.iRight = SCREEN_X_OFFSET;
|
||||
SrcRect.iBottom = SCREEN_Y_OFFSET + SKI_INTERFACE_HEIGHT;
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SrcRect.iLeft, SrcRect.iTop, (RECT*)&SrcRect );
|
||||
// Right
|
||||
SrcRect.iLeft = SCREEN_X_OFFSET + SKI_INTERFACE_WIDTH;
|
||||
SrcRect.iTop = SCREEN_Y_OFFSET;
|
||||
SrcRect.iRight = SCREEN_WIDTH;
|
||||
SrcRect.iBottom = SCREEN_Y_OFFSET + SKI_INTERFACE_HEIGHT;
|
||||
BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, SrcRect.iLeft, SrcRect.iTop, (RECT*)&SrcRect );
|
||||
// WANNE: I think it is not used.
|
||||
//InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
@@ -1542,7 +1542,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
gfCameDirectlyFromGame = TRUE;
|
||||
|
||||
guiPreviousOptionScreen = GAME_SCREEN;
|
||||
LeaveTacticalScreen( SAVE_LOAD_SCREEN );
|
||||
//Heinz: 28.02.09 BUGFIX: player doesn't need to see save/load screen
|
||||
//LeaveTacticalScreen( SAVE_LOAD_SCREEN );
|
||||
DoQuickLoad();
|
||||
}
|
||||
}
|
||||
@@ -3834,15 +3835,15 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
|
||||
// Recruit!
|
||||
RecruitEPC( MARIA );
|
||||
|
||||
//Heinz: 28.02.09 BUGFIX: giving G41 to Maria only in cheat mode
|
||||
// Create object and set
|
||||
CreateItem( (UINT16) G41, 100, &Object );
|
||||
|
||||
pSoldier = FindSoldierByProfileID( MARIA, FALSE );
|
||||
|
||||
AutoPlaceObject( pSoldier, &Object, FALSE );
|
||||
}
|
||||
|
||||
// Create object and set
|
||||
CreateItem( (UINT16) G41, 100, &Object );
|
||||
|
||||
pSoldier = FindSoldierByProfileID( MARIA, FALSE );
|
||||
|
||||
AutoPlaceObject( pSoldier, &Object, FALSE );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user