Merged from revision: 7230

Fixes (by Buggler)
- Added first page and last page buttons to history log
- Fixed pick up backpack on the same grid to cost the same as manually picking it up instead of no cost
- Display message when dropping and picking backpacks for all mercs in sector

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7231 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-05-23 19:07:05 +00:00
parent b5aa779b1b
commit 262b1ea128
14 changed files with 116 additions and 32 deletions
+5 -6
View File
@@ -1308,11 +1308,10 @@ void CreateFinanceButtons( void )
giFinanceButton[LAST_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[LAST_PAGE_BUTTON], LAST_PAGE_X, BTN_Y,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceFirstLastPageCallBack);
MSYS_SetBtnUserData( giFinanceButton[LAST_PAGE_BUTTON], 0, 1 );
// set buttons
SetButtonCursor(giFinanceButton[0], CURSOR_LAPTOP_SCREEN);
SetButtonCursor(giFinanceButton[1], CURSOR_LAPTOP_SCREEN);
SetButtonCursor(giFinanceButton[2], CURSOR_LAPTOP_SCREEN);
@@ -2502,7 +2501,7 @@ void SetFinanceButtonStates( void )
if( LoadNextPage( ) )
{
// decrement page
LoadPreviousPage( );
LoadPreviousPage( );
// enable buttons
@@ -2512,8 +2511,8 @@ void SetFinanceButtonStates( void )
}
else
{
DisableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] );
DisableButton( giFinanceButton[ LAST_PAGE_BUTTON ] );
DisableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] );
DisableButton( giFinanceButton[ LAST_PAGE_BUTTON ] );
}
}
+87 -25
View File
@@ -51,8 +51,10 @@
#define SIZE_OF_HISTORY_FILE_RECORD ( sizeof( UINT8 ) + sizeof( UINT8 ) + sizeof( UINT32 ) + sizeof( UINT16 ) + sizeof( UINT16 ) + sizeof( UINT8 ) + sizeof( UINT8 ) )
// button positions
#define NEXT_BTN_X iScreenWidthOffset + 577
#define PREV_BTN_X iScreenWidthOffset + 553
#define FIRST_PAGE_X iScreenWidthOffset + 505
#define NEXT_BTN_X iScreenWidthOffset + 553//577
#define PREV_BTN_X iScreenWidthOffset + 529//553
#define LAST_PAGE_X iScreenWidthOffset + 577
#define BTN_Y iScreenHeightOffset + 53
// graphics handles
@@ -75,13 +77,15 @@ UINT32 guiSHADELINE;
enum{
PREV_PAGE_BUTTON=0,
NEXT_PAGE_BUTTON,
FIRST_PAGE_BUTTON,
LAST_PAGE_BUTTON,
};
// the page flipping buttons
INT32 giHistoryButton[2];
INT32 giHistoryButtonImage[2];
INT32 giHistoryButton[4];
INT32 giHistoryButtonImage[4];
BOOLEAN fInHistoryMode=FALSE;
@@ -139,6 +143,7 @@ void PerformCheckOnHistoryRecord( UINT32 uiErrorCode, INT16 sSectorX, INT16 sSec
// callbacks
void BtnHistoryDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason);
void BtnHistoryDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason);
void BtnHistoryFirstLastPageCallBack(GUI_BUTTON *btn,INT32 reason);
UINT32 SetHistoryFact( UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiDate, INT16 sSectorX, INT16 sSectorY )
{
@@ -428,10 +433,27 @@ void CreateHistoryButtons( void )
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryDisplayNextPageCallBack);
//button to go to the first page
giHistoryButtonImage[FIRST_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,3,-1,4,-1 );
giHistoryButton[FIRST_PAGE_BUTTON] = QuickCreateButton( giHistoryButtonImage[FIRST_PAGE_BUTTON], FIRST_PAGE_X, BTN_Y,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryFirstLastPageCallBack);
MSYS_SetBtnUserData( giHistoryButton[FIRST_PAGE_BUTTON], 0, 0 );
//button to go to the last page
giHistoryButtonImage[LAST_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,9,-1,10,-1 );
giHistoryButton[LAST_PAGE_BUTTON] = QuickCreateButton( giHistoryButtonImage[LAST_PAGE_BUTTON], LAST_PAGE_X, BTN_Y,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryFirstLastPageCallBack);
MSYS_SetBtnUserData( giHistoryButton[LAST_PAGE_BUTTON], 0, 1 );
// set buttons
SetButtonCursor(giHistoryButton[0], CURSOR_LAPTOP_SCREEN);
SetButtonCursor(giHistoryButton[1], CURSOR_LAPTOP_SCREEN);
SetButtonCursor(giHistoryButton[2], CURSOR_LAPTOP_SCREEN);
SetButtonCursor(giHistoryButton[3], CURSOR_LAPTOP_SCREEN);
return;
}
@@ -439,18 +461,14 @@ void CreateHistoryButtons( void )
void DestroyHistoryButtons( void )
{
// remove History buttons and images from memory
UINT32 uiCnt;
// next page button
RemoveButton(giHistoryButton[1] );
UnloadButtonImage(giHistoryButtonImage[1] );
// prev page button
RemoveButton(giHistoryButton[0] );
UnloadButtonImage(giHistoryButtonImage[0] );
return;
for( uiCnt=0; uiCnt<4; uiCnt++ )
{
RemoveButton( giHistoryButton[ uiCnt ] );
UnloadButtonImage( giHistoryButtonImage[ uiCnt ] );
}
}
void BtnHistoryDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason)
@@ -473,7 +491,7 @@ void BtnHistoryDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason)
{
LoadPreviousHistoryPage( );
//iCurrentHistoryPage--;
DrawAPageofHistoryRecords( );
DrawAPageofHistoryRecords( );
}
// set new state
@@ -495,8 +513,8 @@ void BtnHistoryDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason)
// force redraw
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
// increment currentPage
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// increment currentPage
btn->uiFlags&=~(BUTTON_CLICKED_ON);
LoadNextHistoryPage( );
// set new state
SetHistoryButtonStates( );
@@ -507,6 +525,48 @@ void BtnHistoryDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason)
}
void BtnHistoryFirstLastPageCallBack(GUI_BUTTON *btn,INT32 reason)
{
// force redraw
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
fReDrawScreenFlag=TRUE;
}
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
UINT32 uiButton = MSYS_GetBtnUserData( btn, 0 );
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// clear out old list of records, and load in previous page worth of records
ClearHistoryList( );
//if its the first page button
if( uiButton == 0 )
{
iCurrentHistoryPage = 1;
LoadInHistoryRecords( iCurrentHistoryPage );
DrawAPageofHistoryRecords( );
}
//else its the last page button
else
{
LoadInHistoryRecords( GetNumberOfHistoryPages() + 1 );
iCurrentHistoryPage = GetNumberOfHistoryPages() + 1;
}
// set button state
SetHistoryButtonStates( );
pCurrentHistory=pHistoryListHead;
// redraw screen
fReDrawScreenFlag=TRUE;
}
}
BOOLEAN IncrementCurrentPageHistoryDisplay( void )
{
// run through list, from pCurrentHistory, to NUM_RECORDS_PER_PAGE +1 HistoryUnits
@@ -1001,7 +1061,7 @@ void DisplayPageNumberAndDateRange( void )
// get the last page
swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], iCurrentHistoryPage , iLastPage +1 );
swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], iCurrentHistoryPage , iLastPage + 1 );
mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString );
swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], pCurrentHistory->uiDate / ( 24 * 60 ) , uiLastDate/( 24 * 60 ) );
@@ -1204,28 +1264,32 @@ void SetHistoryButtonStates( void )
{
// first page, disable left buttons
DisableButton( giHistoryButton[PREV_PAGE_BUTTON] );
DisableButton( giHistoryButton[FIRST_PAGE_BUTTON] );
}
else
{
// enable buttons
EnableButton( giHistoryButton[PREV_PAGE_BUTTON] );
EnableButton( giHistoryButton[FIRST_PAGE_BUTTON] );
}
if( IncrementCurrentPageHistoryDisplay( ) )
{
// decrement page
iCurrentHistoryPage--;
iCurrentHistoryPage--;
DrawAPageofHistoryRecords( );
// enable buttons
EnableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] );
EnableButton( giHistoryButton[ LAST_PAGE_BUTTON ] );
}
else
{
DisableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] );
DisableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] );
DisableButton( giHistoryButton[ LAST_PAGE_BUTTON ] );
}
}
@@ -1326,7 +1390,7 @@ BOOLEAN LoadInHistoryRecords( UINT32 uiPage )
return( FALSE );
}
// set up current finance
// set up current history
pCurrentHistory = pHistoryListHead;
return( TRUE );
@@ -1430,9 +1494,7 @@ BOOLEAN LoadNextHistoryPage( void )
// clear out old list of records, and load in previous page worth of records
ClearHistoryList( );
// now load in previous page's records, if we can
// now load in next page's records, if we can
if ( LoadInHistoryRecords( iCurrentHistoryPage + 1 ) )
{
iCurrentHistoryPage++;
@@ -1467,7 +1529,7 @@ BOOLEAN LoadPreviousHistoryPage( void )
}
else
{
LoadInHistoryRecords( iCurrentHistoryPage );
LoadInHistoryRecords( iCurrentHistoryPage );
return ( FALSE );
}
}
+2 -1
View File
@@ -4315,7 +4315,8 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus)
iRange = GetRangeInCellCoordsFromGridNoDiff( pSoldier->sGridNo, gWorldItems[wi].sGridNo );
if(gWorldItems[wi].sGridNo == pSoldier->sGridNo) // standing on pack - pickup regardless
{
sAPCost = 0;
// Buggler: pickup should cost the same as manually picking it up
//sAPCost = 0;
break;
}
else if(iRange < 26 && !(gTacticalStatus.uiFlags & INCOMBAT)) // should mean anything within 2 diagonal tiles while not in combat
+2
View File
@@ -7833,6 +7833,7 @@ void HandleTBDropBackpacks( void )
}
fCharacterInfoPanelDirty = TRUE;
fInterfacePanelDirty = DIRTYLEVEL2;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_ALL_DROP] );
}
}
void HandleTBPickUpBackpacks( void )
@@ -7848,6 +7849,7 @@ void HandleTBPickUpBackpacks( void )
ChangeDropPackStatus(pTeamSoldier, FALSE);
}
}
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_ALL_PICKUP] );
}
}
void HandleTBSoldierRun( void )
+2
View File
@@ -2513,6 +2513,8 @@ enum
NIV_SELL_ALL,
NIV_DELETE_ALL,
NIV_NO_CLIMB,
NIV_ALL_DROP,
NIV_ALL_PICKUP,
TEXT_NUM_NIV,
};
+2
View File
@@ -6823,6 +6823,8 @@ STR16 NewInvMessage[] =
L"你确定要变卖该地区所有物品吗?",
L"你确定要销毁该地区所有物品吗?",
L"装备大背包后无法爬上房顶",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6829,6 +6829,8 @@ STR16 NewInvMessage[] =
L"Bent zeker u u wilt alle sectorpunten verkopen?",
L"Bent zeker u u wilt alle sectorpunten schr?",
L"Kan beklimmen niet terwijl het dragen van een rugzak",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6821,6 +6821,8 @@ STR16 NewInvMessage[] =
L"Are you sure you want to sell all sector items?",
L"Are you sure you want to delete all sector items?",
L"Cannot climb while wearing a backpack",
L"All backpacks dropped",
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6826,6 +6826,8 @@ STR16 NewInvMessage[] =
L"Êtes-vous sûr de vouloir vendre tous les articles du secteur ?",
L"Êtes-vous sûr de vouloir supprimer tous les articles du secteur ?",
L"Ne peut pas escalader avec un sac à dos",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6651,6 +6651,8 @@ STR16 NewInvMessage[] =
L"Sind Sie sicher, dass Sie alle Gegenstände im Sektor verkaufen wollen?",
L"Sind Sie sicher, dass Sie alle Gegenstände im Sektor löschen wollen?",
L"Kann nicht beim Tragen eines Rucksacks klettern",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6821,6 +6821,8 @@ STR16 NewInvMessage[] =
L"Siete sicuri voi desiderate vendere tutti gli articoli del settore?",
L"Siete sicuri voi desiderate cancellare tutti gli articoli del settore?",
L"Non può arrampicarsi mentre portano uno zaino",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6834,6 +6834,8 @@ STR16 NewInvMessage[] =
L"Na pewno chcesz sprzedać wszystkie przedmioty z tego sektora?",
L"Na pewno chcesz skasować wszystkie przedmioty z tego sektora?",
L"Nie można wspinać się z plecakiem",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6824,6 +6824,8 @@ STR16 NewInvMessage[] =
L"Вы уверены что хотите продать весь хлам этого сектора голодающему населению Арулько?",
L"Вы уверены что хотите выбросить весь хлам, валяющийся в этом секторе?",
L"Тяжеловато будет взбираться с полным рюкзаком на крышу. Может снимем?",
L"All backpacks dropped", // TODO.Translate
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages
+2
View File
@@ -6829,6 +6829,8 @@ STR16 NewInvMessage[] =
L"Are you sure you want to sell all sector items?",
L"Are you sure you want to delete all sector items?",
L"Cannot climb while wearing a backpack",
L"All backpacks dropped",
L"All owned backpacks picked up",
};
// WANNE - MP: Multiplayer messages