Altered the pName field from Pockets.xml to a CHAR16 value so it will support multilingual code.

Updated the Pockets.xml reader function so that we can include a german.pockets.xml and russian.pockets.xml (and any other language we eventually choose to support) just like we have with Items.xml.
I moved the "Sold Item" and "Delete Item" phrases to the language specific cpp files.
I updated the SHIFT+N hotkey so that it will now work from the strategic screen.  On tactical it handles the entire team.  On strategic, it handles only the one merc who is currently active.
I fixed a problem with the ALT+W cheat key so that it cycles properly.
I fixed a problem with the backpack buttons where the button key wasn't being properly deleted.  This could sometimes cause an "overload" which would result in a crash.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1873 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-03-09 17:26:55 +00:00
parent 43ca24dda8
commit 6d31772abd
17 changed files with 191 additions and 67 deletions
+7 -1
View File
@@ -2000,7 +2000,10 @@ UINT16 DisplayLBEInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight)
}
else
{
mbstowcs(pName,LBEPocketType[count].pName,80);
//mbstowcs(pName,LBEPocketType[count].pName,80);
for(UINT8 i = 0; i<14; i++)
pName[i] = LBEPocketType[count].pName[i];
//pName = LBEPocketType[count].pName;
pName[14] = '\0';
swprintf(sTemp, L"%s(x%d)", pName, pocketNum[count] );
DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
@@ -3409,3 +3412,6 @@ void ReportBobbyROrderError( UINT16 usItemNumber, UINT8 ubPurchaseNum, UINT8 ubQ
@@ -1387,10 +1387,10 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot )
if ( _KeyDown ( 89 )) //Lalien: delete all items of this type on Ctrl+Y
{
DeleteItemsOfType( gItemPointer.usItem );
ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Deleted all items of this type" );
ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, New113Message[MSG113_DELETE_ALL] );
}
else {
ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Deleted item" );
ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, New113Message[MSG113_DELETED] );
}
if ( fShowMapInventoryPool )
HandleButtonStatesWhileMapInventoryActive();
@@ -1420,10 +1420,10 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot )
if ( _KeyDown ( 89 )) //Lalien: sell all items of this type on Alt+Y
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Sold all items of this type" );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_SOLD_ALL] );
}
else {
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Sold item" );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_SOLD] );
}
AddTransactionToPlayersBook( SOLD_ITEMS, 0, GetWorldTotalMin(), iPrice );
+8
View File
@@ -619,6 +619,7 @@ extern UINT16 gusNewItemIndex;
extern BOOLEAN gfDeductPoints;
extern void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj );
extern void SwapGoggles(SOLDIERTYPE *pTeamSoldier);
UINT32 guiCHARLIST;
UINT32 guiCHARINFO;
@@ -6366,6 +6367,13 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
}
#endif
break;
case 'N':
if ( bSelectedInfoChar != -1 && fShowInventoryFlag )
{
SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ];
SwapGoggles(pSoldier);
}
break;
case 'o':
if( fAlt )
{ // toggle if Orta & Tixa have been found
+9 -5
View File
@@ -2813,14 +2813,16 @@ void CycleItemDescriptionItem( INT16 sX, INT16 sY )
{
usOldItem--;
if ( usOldItem < 1 )
{
usOldItem = MAXITEMS-1;
}
while ( usOldItem > 0 && ( Item[usOldItem].usItemClass == IC_NONE || Item[usOldItem].usItemClass == 0 ))
{
usOldItem--;
}
if ( usOldItem < 0 )
{
usOldItem = MAXITEMS-1;
if(usOldItem < 1)
usOldItem = MAXITEMS-1;
}
}
else
@@ -2835,6 +2837,8 @@ void CycleItemDescriptionItem( INT16 sX, INT16 sY )
while (usOldItem < MAXITEMS && (Item[usOldItem].usItemClass == IC_NONE || Item[usOldItem].usItemClass == 0 ))
{
usOldItem++;
if(usOldItem >= MAXITEMS)
usOldItem = 1;
}
}
+3
View File
@@ -1191,6 +1191,7 @@ void RenderBackpackButtons(int bpAction)
RemoveButton( giSMZipperButton );
if(giSMDropPackButton != -1)
RemoveButton( giSMDropPackButton );
RenderBackpackButtons(4);
giSMDropPackImages = -1;
giSMDropPackButton = -1;
giSMZipperImages = -1;
@@ -7010,3 +7011,5 @@ void GoToMapScreenFromTactical( void )
+1 -1
View File
@@ -755,7 +755,7 @@ public:
POCKETTYPE& operator=(const POCKETTYPE&);
~POCKETTYPE();
UINT16 pIndex;
CHAR8 pName[80];
CHAR16 pName[80];
UINT8 pSilhouette;
UINT16 pType;
UINT32 pRestriction;
+117 -55
View File
@@ -191,7 +191,7 @@ extern INT16 ITEMDESC_START_Y;
//Little functions called by keyboard input
void SwapGoggles();
void SwapGoggles(SOLDIERTYPE *pTeamSoldier);
void SeperateItems();
void StackAndSort( BOOLEAN fRestrictToAmmo );
void CreateRandomItem();
@@ -3177,8 +3177,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
// swap sungoggles and nightgoggles
case 'N':
SOLDIERTYPE *pTeamSoldier;
INT8 bLoop;
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++)
{
SwapGoggles();
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
{
SwapGoggles(pTeamSoldier);
}
}
break;
@@ -5460,74 +5466,130 @@ void PopupMilitiaControlMenu( SOLDIERTYPE *pSoldier )
}
void SwapGoggles()
void SwapGoggles(SOLDIERTYPE *pTeamSoldier)
{
/* CHRISL - Adjusted this option to allow the game to search through Helmet attachments
as well as inventory positions.
*/
SOLDIERTYPE *pTeamSoldier;
OBJECTTYPE * pObj;
INT8 bLoop, bSlot1;
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++)
OBJECTTYPE * pGoggles = NULL;
INT8 bSlot1;
int bestBonus;
bool itemFound = false;
//2 head slots
for (bSlot1 = HEAD1POS; bSlot1 <= HEAD2POS; bSlot1++)
{
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
// if wearing sungoggles
if ( Item[pTeamSoldier->inv[bSlot1].usItem].brightlightvisionrangebonus > 0 )
{
//2 head slots
for (bSlot1 = HEAD1POS; bSlot1 <= HEAD2POS; bSlot1++)
itemFound = true;
bestBonus = 0;
pGoggles = FindNightGogglesInInv( pTeamSoldier );
//search for better goggles on the helmet
if (pGoggles)
{
if ( Item[pTeamSoldier->inv[bSlot1].usItem].brightlightvisionrangebonus > 0 )
bestBonus = Item[pGoggles->usItem].nightvisionrangebonus;
}
//search helmet and vest
for(UINT8 gear = HELMETPOS; gear <= VESTPOS; gear++)
{
pObj = &(pTeamSoldier->inv[gear]);
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
{
int bestBonus = 0;
OBJECTTYPE* pGoggles = FindNightGogglesInInv( pTeamSoldier );
//search for better goggles on the helmet
if (pGoggles) {
Item[pGoggles->usItem].nightvisionrangebonus;
}
pObj = &(pTeamSoldier->inv[HELMETPOS]);
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
if ( Item[ iter->usItem ].nightvisionrangebonus > bestBonus
&& Item[ iter->usItem ].usItemClass == IC_FACE )
{
pGoggles = &(*iter);
bestBonus = Item[ iter->usItem ].nightvisionrangebonus;
}
}
if ( pGoggles )
if ( Item[ iter->usItem ].nightvisionrangebonus > bestBonus && Item[ iter->usItem ].usItemClass == IC_FACE )
{
SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE );
break;
}
}
else if(Item[pTeamSoldier->inv[bSlot1].usItem].nightvisionrangebonus > 0)
{
int bestBonus = 0;
OBJECTTYPE* pGoggles = FindSunGogglesInInv( pTeamSoldier );
//search for better goggles on the helmet
if (pGoggles) {
Item[pGoggles->usItem].brightlightvisionrangebonus;
}
pObj = &(pTeamSoldier->inv[HELMETPOS]);
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
if ( Item[ iter->usItem ].brightlightvisionrangebonus > bestBonus
&& Item[ iter->usItem ].usItemClass == IC_FACE )
{
pGoggles = &(*iter);
bestBonus = Item[ iter->usItem ].brightlightvisionrangebonus;
}
}
if ( pGoggles )
{
SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE );
break;
pGoggles = &(*iter);
bestBonus = Item[ iter->usItem ].nightvisionrangebonus;
}
}
}
fCharacterInfoPanelDirty = TRUE;
fInterfacePanelDirty = DIRTYLEVEL2;
pTeamSoldier->DeleteSoldierLight( );
pTeamSoldier->PositionSoldierLight( );
if ( pGoggles )
{
SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE );
break;
}
}
// else if wearing NVGs
else if(Item[pTeamSoldier->inv[bSlot1].usItem].nightvisionrangebonus > 0)
{
itemFound = true;
bestBonus = 0;
pGoggles = FindSunGogglesInInv( pTeamSoldier );
//search for better goggles on the helmet
if (pGoggles)
{
bestBonus = Item[pGoggles->usItem].brightlightvisionrangebonus;
}
//search helmet and vest
for(UINT8 gear = HELMETPOS; gear <= VESTPOS; gear++)
{
pObj = &(pTeamSoldier->inv[gear]);
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
{
if ( Item[ iter->usItem ].brightlightvisionrangebonus > bestBonus && Item[ iter->usItem ].usItemClass == IC_FACE )
{
pGoggles = &(*iter);
bestBonus = Item[ iter->usItem ].brightlightvisionrangebonus;
}
}
}
if ( pGoggles )
{
SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE );
break;
}
}
// else if not wearing anything and no goggles found
else if(itemFound == false && pTeamSoldier->inv[bSlot1].exists() == false)
{
bestBonus = 0;
// search helmet and vest for goggles of some kind
for(UINT8 gear = HELMETPOS; gear <= VESTPOS; gear++)
{
pObj = &(pTeamSoldier->inv[gear]);
for(attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
{
if(DayTime() == TRUE && Item[iter->usItem].brightlightvisionrangebonus > bestBonus && Item[iter->usItem].usItemClass == IC_FACE)
{
pGoggles = &(*iter);
bestBonus = Item[iter->usItem].brightlightvisionrangebonus;
}
else if(NightTime() == TRUE && Item[iter->usItem].nightvisionrangebonus > bestBonus && Item[iter->usItem].usItemClass == IC_FACE)
{
pGoggles = &(*iter);
bestBonus = Item[iter->usItem].nightvisionrangebonus;
}
}
if(pGoggles)
{
pGoggles->MoveThisObjectTo(pTeamSoldier->inv[bSlot1], 1, pTeamSoldier, bSlot1);
pObj->RemoveAttachment(pGoggles);
break;
}
}
if(pTeamSoldier->inv[bSlot1].exists() == false)
{
if(DayTime() == TRUE)
pGoggles = FindSunGogglesInInv( pTeamSoldier );
else
pGoggles = FindNightGogglesInInv( pTeamSoldier );
if(pGoggles)
{
SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE );
break;
}
}
else
{
break;
}
}
}
fCharacterInfoPanelDirty = TRUE;
fTeamPanelDirty = TRUE;
fInterfacePanelDirty = DIRTYLEVEL2;
pTeamSoldier->DeleteSoldierLight( );
pTeamSoldier->PositionSoldierLight( );
}
void SeperateItems()
+6 -1
View File
@@ -133,7 +133,7 @@ lbepocketEndElementHandle(void *userData, const XML_Char *name)
if ( !onlyLocalizedText )
LBEPocketType.push_back(pData->curLBEPocket);
else
strcpy(LBEPocketType[pData->curLBEPocket.pIndex].pName, pData->curLBEPocket.pName);
wcscpy(LBEPocketType[pData->curLBEPocket.pIndex].pName,pData->curLBEPocket.pName);
}
else if(strcmp(name, "pIndex") == 0)
{
@@ -143,6 +143,7 @@ lbepocketEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "pName") == 0)
{
pData->curElement = ELEMENT;
#if 0
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
strcpy(pData->curLBEPocket.pName,pData->szCharData);
else
@@ -150,6 +151,10 @@ lbepocketEndElementHandle(void *userData, const XML_Char *name)
strncpy(pData->curLBEPocket.pName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
pData->curLBEPocket.pName[MAX_CHAR_DATA_LENGTH] = '\0';
}
#else
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curLBEPocket.pName, sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) );
pData->curLBEPocket.pName[sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) - 1] = '\0';
#endif
}
else if(strcmp(name, "pSilhouette") == 0)
{
+4
View File
@@ -1554,6 +1554,10 @@ enum
MSG113_SNIPER,
MSG113_UNABLETOSPLITMONEY,
MSG113_ARRIVINGREROUTED,
MSG113_DELETED,
MSG113_DELETE_ALL,
MSG113_SOLD,
MSG113_SOLD_ALL,
};
//CHRISL: NewInv messages
+4
View File
@@ -4234,6 +4234,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Geschrapt punt",
L"Schrapte alle punten van dit type",
L"Verkocht punt",
L"Verkocht alle punten van dit type",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4229,6 +4229,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Deleted item",
L"Deleted all items of this type",
L"Sold item",
L"Sold all items of this type",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4216,6 +4216,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Article supprimé",
L"A supprimé tous les articles de ce type",
L"Article vendu",
L"A vendu tous les articles de ce type",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4021,6 +4021,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Gegenstand gelöscht",
L"Alle Gegenstände dieses Typs gelöscht",
L"Gegestand verkauft",
L"Alle Gegenstände dieses Typs verkauft",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4213,6 +4213,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Articolo cancellato",
L"Ha cancellato tutti gli articoli di questo tipo",
L"Articolo venduto",
L"Ha venduto tutti gli articoli di questo tipo",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4209,6 +4209,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Deleted item",
L"Deleted all items of this type",
L"Sold item",
L"Sold all items of this type",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4222,6 +4222,10 @@ STR16 New113Message[] =
L"Снайпер!",
L"Невозможно разделить деньги из-за предмета на курсоре.",
L"Точка высадки новых наемников перенесена в %s, так как предыдущая точка высадки %s захвачена противником.",
L"Deleted item",
L"Deleted all items of this type",
L"Sold item",
L"Sold all items of this type",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
+4
View File
@@ -4229,6 +4229,10 @@ STR16 New113Message[] =
L"Sniper!",
L"Unable to split money due to having an item on your cursor.",
L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.",
L"Deleted item",
L"Deleted all items of this type",
L"Sold item",
L"Sold all items of this type",
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends