code improvement: added a much easier way to add items in cheat mode. 'ALT' + '.' allows the user to input the item number he wants and spawns the item on the selected merc. 'CTRL' + 'ALT' + '.' spawns the previously selected item. (by IoP)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5794 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-01-20 05:03:39 +00:00
parent d55a57007d
commit 8c60796982
+46 -21
View File
@@ -266,6 +266,9 @@ void QueryTBWheel( UINT32 *puiNewEvent );
void QueryTBX1Button( UINT32 *puiNewEvent );
void QueryTBX2Button( UINT32 *puiNewEvent );
void ItemCreationCallBack( UINT8 ubResult );
void CheatCreateItem();
void GetTBMouseButtonInput( UINT32 *puiNewEvent )
{
QueryTBLeftButton( puiNewEvent );
@@ -1448,6 +1451,34 @@ void GetPolledKeyboardInput( UINT32 *puiNewEvent )
}
}
UINT16 usitem = 1623;
void CheatCreateItem( )
{
if ( gusSelectedSoldier != NOBODY )
{
INT16 status = 100;
FLOAT temperature = 0.0;
// Flugente: spawn items while debugging
OBJECTTYPE newobj;
CreateItem( usitem, status, &newobj );
(newobj)[0]->data.bTemperature = temperature;
if ( !AutoPlaceObject( MercPtrs[ gusSelectedSoldier ], &newobj, FALSE ) )
AddItemToPool( MercPtrs[ gusSelectedSoldier ]->sGridNo, &newobj, 1, 0, 0, -1 );
}
}
void ItemCreationCallBack( UINT8 ubResult )
{
if (ubResult == MSG_BOX_RETURN_OK && wcscmp(gszMsgBoxInputString,L"") > 0)
{
usitem = _wtoi( gszMsgBoxInputString );
CheatCreateItem( );
}
memset(gszMsgBoxInputString,0,sizeof(gszMsgBoxInputString));
}
extern BOOLEAN gfDisableRegionActive;
extern BOOLEAN gfUserTurnRegionActive;
@@ -4450,7 +4481,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
// added by Flugente
case '.':
if ( fCtrl )
if ( fCtrl && fAlt ) //jikuja: Create item by reusing old entered number
{
if ( CHEATER_CHEAT_LEVEL( ) )
{
CheatCreateItem( );
}
}
else if ( fCtrl )
{
if ( gusSelectedSoldier != NOBODY )
{
@@ -4459,26 +4497,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
else if ( fAlt )
{
// Flugente: spawn items while debugging
/*if ( gusSelectedSoldier != NOBODY )
{
static UINT16 usitem = 1623;
static INT16 status = 100;
static FLOAT temperature = 0.0;
OBJECTTYPE newobj;
CreateItem( usitem, status, &newobj );
(newobj)[0]->data.bTemperature = temperature;
if ( !AutoPlaceObject( MercPtrs[ gusSelectedSoldier ], &newobj, FALSE ) )
AddItemToPool( MercPtrs[ gusSelectedSoldier ]->sGridNo, &newobj, 1, 0, 0, -1 );
CreateItem( usitem, status, &newobj );
(newobj)[0]->data.bTemperature = temperature;
if ( !AutoPlaceObject( MercPtrs[ gusSelectedSoldier ], &newobj, FALSE ) )
AddItemToPool( MercPtrs[ gusSelectedSoldier ]->sGridNo, &newobj, 1, 0, 0, -1 );
}*/
if ( CHEATER_CHEAT_LEVEL( ) )
{
if ( gusSelectedSoldier != NOBODY )
{
DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, L"Enter ItemID", GAME_SCREEN, MSG_BOX_FLAG_INPUTBOX, ItemCreationCallBack, NULL );
}
}
}
else
{