diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 1f8d4ffe1..7c570e844 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -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 {