From 8171fdbe7efb9d0e4a708e09a278535dcb60bb16 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 11 Aug 2013 15:22:29 +0000 Subject: [PATCH] new feature: 'Move item' assignment allows quick and easy mass transfer of items between city sectors. Warning: GameDir >= r1723 is required. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6280 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 14 +- Strategic/Assignments.cpp | 830 +++++++++++++++++- Strategic/Assignments.h | 19 +- Strategic/Map Screen Interface Border.cpp | 2 +- .../Map Screen Interface Map Inventory.cpp | 119 ++- .../Map Screen Interface Map Inventory.h | 3 + Strategic/Map Screen Interface.cpp | 8 + Strategic/Map Screen Interface.h | 1 + Strategic/mapscreen.cpp | 4 + Tactical/Faces.cpp | 22 +- Tactical/Interface Items.cpp | 1 + Tactical/Soldier Control.h | 5 +- Tactical/World Items.h | 13 +- Utils/_ChineseText.cpp | 5 + Utils/_DutchText.cpp | 5 + Utils/_EnglishText.cpp | 5 + Utils/_FrenchText.cpp | 5 + Utils/_GermanText.cpp | 5 + Utils/_ItalianText.cpp | 7 +- Utils/_PolishText.cpp | 5 + Utils/_RussianText.cpp | 7 +- Utils/_TaiwaneseText.cpp | 5 + 22 files changed, 1045 insertions(+), 45 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 444d2415..276618a4 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2045,15 +2045,17 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) if ( guiCurrentSaveGameVersion >= SOLDIER_PROFILES ) { numBytesRead = ReadFieldByField(hFile, &this->usSoldierProfile, sizeof(usSoldierProfile), sizeof(UINT16), numBytesRead); - + numBytesRead = ReadFieldByField(hFile, &this->usItemMoveSectorID, sizeof(usItemMoveSectorID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead); } else { this->usSoldierProfile = 0; + this->usItemMoveSectorID = 0; // as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore - const UINT8 tmp = sizeof(usSoldierProfile); + const UINT8 tmp = sizeof(usSoldierProfile) + sizeof(usItemMoveSectorID); UINT8 blarg[tmp]; numBytesRead = ReadFieldByField(hFile, &blarg, tmp, sizeof(UINT8), numBytesRead); @@ -2067,10 +2069,11 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) this->usMultiTurnAction = 0; this->bAIIndex = 0; this->usSoldierProfile = 0; + this->usItemMoveSectorID = 0; // as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore // +1 for padding - const UINT8 tmp = sizeof(bOverTurnAPS) + sizeof(this->sMTActionGridNo) + sizeof(usMultiTurnAction) + sizeof(bAIIndex) + 1 + sizeof(usSoldierProfile); + const UINT8 tmp = sizeof(bOverTurnAPS) + sizeof(this->sMTActionGridNo) + sizeof(usMultiTurnAction) + sizeof(bAIIndex) + 1 + sizeof(usSoldierProfile) + sizeof(usItemMoveSectorID); UINT8 blarg[tmp]; numBytesRead = ReadFieldByField(hFile, &blarg, tmp, sizeof(UINT8), numBytesRead); @@ -2125,6 +2128,11 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) while((buffer%4) > 0) buffer++; + for(int i = 0; i < sizeof(usItemMoveSectorID); ++i) + buffer++; + while((buffer%4) > 0) + buffer++; + for(int i = 0; i < sizeof(ubFiller); ++i) buffer++; while((buffer%4) > 0) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 783d17cb..ee51aab2 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -63,6 +63,7 @@ #include "AIInternals.h" #include "Morale.h" #include "Food.h" + #include "Tactical Save.h" // added by Flugente #endif #include #include @@ -120,6 +121,20 @@ enum{ VEHICLE_MENU_CANCEL, }; +enum{ + MOVEITEM_MENU_1 = 0, + MOVEITEM_MENU_2, + MOVEITEM_MENU_3, + MOVEITEM_MENU_4, // WANNE: Allow up to 6 vehicles + MOVEITEM_MENU_5, + MOVEITEM_MENU_6, + MOVEITEM_MENU_7, + MOVEITEM_MENU_8, + MOVEITEM_MENU_9, + MOVEITEM_MENU_10, + MOVEITEM_MENU_CANCEL, +}; + /* CHRISL: Adjusted enumerations to allow for seperation of the three different pocket types in the new inventory system. */ @@ -165,6 +180,7 @@ INT32 ghEpcBox = -1; INT32 ghSquadBox = -1; INT32 ghVehicleBox = -1; INT32 ghRepairBox = -1; +INT32 ghMoveItemBox = -1; INT32 ghTrainingBox = -1; INT32 ghAttributeBox = -1; INT32 ghRemoveMercAssignBox = -1; @@ -188,6 +204,10 @@ MOUSE_REGION gContractMenuRegion[ MAX_CONTRACT_MENU_STRING_COUNT ]; MOUSE_REGION gRemoveMercAssignRegion[ MAX_REMOVE_MERC_COUNT ]; MOUSE_REGION gEpcMenuRegion[ MAX_EPC_MENU_STRING_COUNT ]; MOUSE_REGION gRepairMenuRegion[ 20 ]; +MOUSE_REGION gMoveItem[ 20 ]; + +#define MOVEITEM_MAX_SECTORS 10 +UINT8 usMoveItemSectors[MOVEITEM_MAX_SECTORS]; // mouse region for vehicle menu MOUSE_REGION gVehicleMenuRegion[ 20 ]; @@ -200,6 +220,7 @@ MOUSE_REGION gAssignmentScreenMaskRegion; BOOLEAN fShownAssignmentMenu = FALSE; BOOLEAN fShowVehicleMenu = FALSE; BOOLEAN fShowRepairMenu = FALSE; +BOOLEAN fShowMoveItemMenu = FALSE; BOOLEAN fShownContractMenu = FALSE; BOOLEAN fFirstClickInAssignmentScreenMask = FALSE; @@ -403,6 +424,9 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ); // Flugente: prisons can riot if there aren't enough guards around void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ ); +// Flugente: assigned mercs can move equipemnt in city sectors +void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ ); + // is the character between secotrs in mvt BOOLEAN CharacterIsBetweenSectors( SOLDIERTYPE *pSoldier ); @@ -430,6 +454,7 @@ BOOLEAN fGlowContractRegion = FALSE; void HandleShadingOfLinesForSquadMenu( void ); void HandleShadingOfLinesForVehicleMenu( void ); void HandleShadingOfLinesForRepairMenu( void ); +void HandleShadingOfLinesForMoveItemMenu( void ); void HandleShadingOfLinesForTrainingMenu( void ); void HandleShadingOfLinesForAttributeMenus( void ); // HEADROCK HAM 3.6: Shade Facility Box Lines @@ -448,11 +473,15 @@ BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ); BOOLEAN DisplayFacilityMenu( SOLDIERTYPE *pSoldier ); BOOLEAN DisplayFacilityAssignmentMenu( SOLDIERTYPE *pSoldier, UINT8 ubFacilityType ); +// Flugente: move items menu +BOOLEAN DisplayMoveItemsMenu( SOLDIERTYPE *pSoldier ); + // create menus void CreateEPCBox( void ); void CreateSquadBox( void ); void CreateVehicleBox(); void CreateRepairBox( void ); +void CreateMoveItemBox( void ); // HEADROCK HAM 3.6: Facility Box. void CreateFacilityBox( void ); void CreateFacilityAssignmentBox( void ); @@ -2243,6 +2272,9 @@ void UpdateAssignments() // handle processing of prisoners HandlePrisonerProcessingInSector( sX, sY, bZ ); + + // handle moving of equipment + HandleEquipmentMove( sX, sY, bZ ); } // Flugente: prisons can riot if there aren't enough guards around @@ -5840,6 +5872,204 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ ) } } +// Flugente: assigned mercs can move equipemnt in city sectors +void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ ) +{ + // no underground + if ( bZ ) + return; + + // if sector not under our control, has enemies in it, or is currently in combat mode + if (!SectorOursAndPeaceful( sMapX, sMapY, bZ )) + return; + + // we loop over all mercs with this assignment in this sector, and then do a separate loop over each target sector + std::map sectormercmap; // this map uses the sectors we take stuff from as keys and the number of mercs as elements + + // count any interrogators found here, and sum up their interrogation values + SOLDIERTYPE *pSoldier = NULL; + UINT32 uiCnt = 0; + UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + { + if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) + { + if( ( pSoldier->bAssignment == MOVE_EQUIPMENT ) && ( EnoughTimeOnAssignment( pSoldier ) ) ) + { + // which sector do we want to move stuff to? + UINT8 targetsector = pSoldier->usItemMoveSectorID; + + if ( sectormercmap[targetsector] ) + sectormercmap[targetsector]++; + else + sectormercmap[targetsector] = 1; + } + } + } + + // no mercs that move stuff here, exit + if ( sectormercmap.empty() ) + return; + + CHAR16 wSectorName[ 64 ]; + GetShortSectorString( sMapX, sMapY, wSectorName ); + + // now loop over all sectors from which we take stuff, and move the equipment + std::map::iterator itend = sectormercmap.end(); + for (std::map::iterator it = sectormercmap.begin(); it != itend; ++it) + { + UINT8 sector = (*it).first; + + INT16 targetX = SECTORX(sector); + INT16 targetY = SECTORY(sector); + + // if sector not under our control, has enemies in it, or is currently in combat mode + if (!SectorOursAndPeaceful( targetX, targetY, bZ )) + continue; + + // the longer the distance, the less we can move + UINT8 distance = abs(sMapX - targetX) + abs(sMapY - targetY); + + // if distance is 0, somethings awry + if ( distance == 0 ) + continue; + + // each soldier can carry 30 items, and needs 10 minutes (two way walk) per sector distance, thereby 6 / distance runs possible + UINT16 maxitems = 30 * (*it).second * 6 / distance; + UINT16 maxweight = 400 * (*it).second * 6 / distance; + + // open the inventory of the sector we are taking stuff from + SECTORINFO *pSectorInfo_Target = &( SectorInfo[ SECTOR(targetX, targetY) ] ); + UINT32 uiTotalNumberOfRealItems_Target = 0; + WORLDITEM* pWorldItem_Target = NULL; + + if( ( gWorldSectorX == targetX )&&( gWorldSectorY == targetY ) && (gbWorldSectorZ == bZ ) ) + { + uiTotalNumberOfRealItems_Target = guiNumWorldItems; + pWorldItem_Target = gWorldItems; + } + else + { + // not loaded, load + // get total number, visable and invisible + BOOLEAN fReturn = GetNumberOfWorldItemsFromTempItemFile( targetX, targetY, bZ, &( uiTotalNumberOfRealItems_Target ), FALSE ); + Assert( fReturn ); + + if( uiTotalNumberOfRealItems_Target > 0 ) + { + // allocate space for the list + pWorldItem_Target = new WORLDITEM[ uiTotalNumberOfRealItems_Target ]; + + // now load into mem + LoadWorldItemsFromTempItemFile( targetX, targetY, bZ, pWorldItem_Target ); + } + } + + // move items from Target to Here + UINT16 moveditems = 0; + UINT32 movedweight = 0; + for( UINT32 uiCount = 0; uiCount < uiTotalNumberOfRealItems_Target; ++uiCount ) // ... for all items in the world ... + { + if( pWorldItem_Target[ uiCount ].fExists ) // ... if item exists ... + { + // test wether item is reachable and allowed to be moved by this assignment + if ( (pWorldItem_Target[ uiCount ].usFlags & WORLD_ITEM_REACHABLE) && !(pWorldItem_Target[ uiCount ].usFlags & WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE) && pWorldItem_Target[ uiCount ].bVisible > 0) + { + OBJECTTYPE* pObj = &(pWorldItem_Target[ uiCount ].object); // ... get pointer for this item ... + + if ( pObj != NULL && pObj->exists() ) // ... if pointer is not obviously useless ... + { + moveditems += pObj->ubNumberOfObjects; + movedweight += CalculateObjectWeight(pObj); + + // move + if( ( gWorldSectorX == sMapX )&&( gWorldSectorY == sMapY ) && (gbWorldSectorZ == bZ ) ) + { + AddItemToPool( RandomGridNo(), pObj, 1 , 0, (WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO|WORLD_ITEM_REACHABLE), -1 ); + } + else + { + AddItemsToUnLoadedSector( sMapX, sMapY, bZ, RandomGridNo(), 1, pObj, 0, WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + } + + pWorldItem_Target[ uiCount ].fExists = FALSE; + + if ( moveditems > maxitems ) + break; + + if ( movedweight > maxweight ) + break; + } + } + } + } + + CHAR16 wSectorName_Target[ 64 ]; + GetShortSectorString( targetX, targetY, wSectorName_Target ); + + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%d items moved from %s to %s", moveditems, wSectorName_Target, wSectorName ); + + // if we didn't move any item, no need to save a chanted inventory etc. + if ( !moveditems ) + continue; + + // hack + WORLDITEM* pWorldItem_tmp = new WORLDITEM[ uiTotalNumberOfRealItems_Target ]; + + // copy over old inventory + UINT32 newcount = 0; + for( UINT32 uiCount = 0; uiCount < uiTotalNumberOfRealItems_Target; ++uiCount ) + { + if ( pWorldItem_Target[ uiCount ].fExists ) + { + pWorldItem_tmp[newcount] = pWorldItem_Target[uiCount]; + ++newcount; + } + } + + // use the new map + pWorldItem_Target = pWorldItem_tmp; + + // save the changed inventory + if( ( targetX == gWorldSectorX )&&( gWorldSectorY == targetY ) && (gbWorldSectorZ == bZ ) ) + { + guiNumWorldItems = uiTotalNumberOfRealItems_Target; + gWorldItems = pWorldItem_Target; + } + else + { + //Save the Items to the the file + SaveWorldItemsToTempItemFile( targetX, targetY, bZ, uiTotalNumberOfRealItems_Target, pWorldItem_Target ); + } + + delete[] pWorldItem_tmp; + + // award a bit of experience to the movers + UINT16 itemsperperson = moveditems / (*it).second; + UINT16 weightperperson = movedweight / (*it).second; + for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + { + if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) + { + if( ( pSoldier->bAssignment == MOVE_EQUIPMENT ) && ( EnoughTimeOnAssignment( pSoldier ) ) ) + { + // which sector do we want to move stuff to? + UINT8 targetsector = pSoldier->usItemMoveSectorID; + + if ( sector == targetsector ) + { + UINT16 exppoints = weightperperson / 400; + + StatChange( pSoldier, HEALTHAMT, exppoints, TRUE ); + StatChange( pSoldier, STRAMT, exppoints, TRUE ); + } + } + } + } + } +} + INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) { INT16 sTotalTrainingPts = 0; @@ -7536,6 +7766,16 @@ void HandleShadingOfLinesForAssignmentMenus( void ) ShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_TRAIN ); } + if( CanCharacterPractise( pSoldier ) ) + { + // unshade train line + UnShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_MOVE_ITEMS ); + } + else + { + // shade train line + ShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_MOVE_ITEMS ); + } if( CanCharacterVehicle( pSoldier ) ) { @@ -7568,6 +7808,9 @@ void HandleShadingOfLinesForAssignmentMenus( void ) // repair submenu HandleShadingOfLinesForRepairMenu( ); + // move item submenu + HandleShadingOfLinesForMoveItemMenu(); + // training submenu HandleShadingOfLinesForTrainingMenu( ); @@ -7627,6 +7870,7 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) fShowAssignmentMenu = FALSE; fShowVehicleMenu = FALSE; fShowRepairMenu = FALSE; + fShowMoveItemMenu = FALSE; // HEADROCK HAM 3.6: Reset Facility menu fShowFacilityMenu = FALSE; @@ -7641,6 +7885,7 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) CreateDestroyMouseRegionsForAttributeMenu( ); CreateDestroyMouseRegionsForSquadMenu( TRUE ); CreateDestroyMouseRegionForRepairMenu( ); + CreateDestroyMouseRegionForMoveItemMenu(); // HEADROCK HAM 3.6: Facility Menu, Submenu CreateDestroyMouseRegionForFacilityMenu( ); CreateDestroyMouseRegionsForFacilityAssignmentMenu( ); @@ -7670,6 +7915,12 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) fTeamPanelDirty = TRUE; gfRenderPBInterface = TRUE; } + if ( IsBoxShown( ghMoveItemBox ) ) + { + HideBox( ghMoveItemBox ); + fTeamPanelDirty = TRUE; + gfRenderPBInterface = TRUE; + } if ( IsBoxShown( ghAttributeBox ) ) { HideBox( ghAttributeBox ); @@ -7729,7 +7980,7 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) CreateDestroyMouseRegionsForAttributeMenu( ); CreateDestroyMouseRegionsForSquadMenu( TRUE ); CreateDestroyMouseRegionForRepairMenu( ); - + CreateDestroyMouseRegionForMoveItemMenu(); if( ( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) && ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) ) { @@ -7789,6 +8040,25 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) } } + // Move Item menu + if( fShowMoveItemMenu == TRUE ) + { + HandleShadingOfLinesForMoveItemMenu( ); + ShowBox( ghMoveItemBox ); + } + else + { + // hide box + if( IsBoxShown( ghMoveItemBox ) ) + { + HideBox( ghMoveItemBox ); + fTeamPanelDirty = TRUE; + fMapPanelDirty = TRUE; + gfRenderPBInterface = TRUE; + // SetRenderFlags(RENDER_FLAG_FULL); + } + } + // ATTRIBUTE menu if( fShowAttributeMenu == TRUE ) { @@ -7966,6 +8236,7 @@ void ClearScreenMaskForMapScreenExit( void ) CreateDestroyMouseRegionsForAttributeMenu( ); CreateDestroyMouseRegionsForSquadMenu( TRUE ); CreateDestroyMouseRegionForRepairMenu( ); + CreateDestroyMouseRegionForMoveItemMenu(); // HEADROCK HAM 3.6: Facility Menu CreateDestroyMouseRegionForFacilityMenu( ); @@ -9542,7 +9813,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { // HEADROCK HAM 3.6: Added facility menu. - if( ( fShowAttributeMenu )||( fShowTrainingMenu ) || ( fShowRepairMenu ) || ( fShowVehicleMenu ) ||( fShowSquadMenu ) || ( fShowFacilityMenu ) || ( fShowFacilityAssignmentMenu ) ) + if( ( fShowAttributeMenu )||( fShowTrainingMenu ) || ( fShowRepairMenu ) || fShowMoveItemMenu || ( fShowVehicleMenu ) ||( fShowSquadMenu ) || ( fShowFacilityMenu ) || ( fShowFacilityAssignmentMenu ) ) { return; } @@ -9707,6 +9978,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; fShowRepairMenu = FALSE; + fShowMoveItemMenu = FALSE; } break; case( ASSIGN_MENU_DOCTOR ): @@ -9887,6 +10159,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowTrainingMenu = FALSE; fShowVehicleMenu = FALSE; fShowFacilityMenu = FALSE; // HEADROCK HAM 3.6: Facility Menu + fShowMoveItemMenu = FALSE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -9922,12 +10195,50 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowSquadMenu = FALSE; fShowVehicleMenu = FALSE; fShowRepairMenu = FALSE; + fShowMoveItemMenu = FALSE; fShowFacilityMenu = FALSE; // HEADROCK HAM 3.6: Facility Menu fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; } break; + + case( ASSIGN_MENU_MOVE_ITEMS ): + if( 1 ) + { + + fShowSquadMenu = FALSE; + fShowTrainingMenu = FALSE; + fShowVehicleMenu = FALSE; + fShowFacilityMenu = FALSE; // HEADROCK HAM 3.6: Facility Menu + //fShownAssignmentMenu = FALSE; + fShowRepairMenu = FALSE; + fShownContractMenu = FALSE; + fTeamPanelDirty = TRUE; + fMapScreenBottomDirty = TRUE; + + pSoldier->bOldAssignment = pSoldier->bAssignment; + + if( pSoldier->bSectorZ == 0 ) + { + fShowMoveItemMenu = FALSE; + + if( DisplayMoveItemsMenu( pSoldier ) ) + { + fShowMoveItemMenu = TRUE; + } + } + } + else if( 0 ) + { + fTeamPanelDirty = TRUE; + fMapScreenBottomDirty = TRUE; + swprintf( sString, zMarksMapScreenText[ 18 ], pSoldier->GetName() ); + + DoScreenIndependantMessageBox( sString , MSG_BOX_FLAG_OK, NULL ); + } + break; + // HEADROCK HAM 3.6: New assignments for Facility operation. case( ASSIGN_MENU_FACILITY ): if ( BasicCanCharacterFacility( pSoldier ) ) @@ -9937,6 +10248,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowTrainingMenu = FALSE; fShowVehicleMenu = FALSE; fShowRepairMenu = FALSE; + fShowMoveItemMenu = FALSE; fShowFacilityMenu = TRUE; // HEADROCK HAM 3.6: Facility Menu fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -9971,11 +10283,12 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) else if( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) { // HEADROCK HAM 3.6: Added facility menu - if( ( fShowAttributeMenu )||( fShowTrainingMenu ) || ( fShowRepairMenu ) || ( fShowVehicleMenu ) ||( fShowSquadMenu ) || ( fShowFacilityMenu ) || ( fShowFacilityAssignmentMenu ) ) + if( ( fShowAttributeMenu )||( fShowTrainingMenu ) || ( fShowRepairMenu ) || fShowMoveItemMenu || ( fShowVehicleMenu ) ||( fShowSquadMenu ) || ( fShowFacilityMenu ) || ( fShowFacilityAssignmentMenu ) ) { fShowAttributeMenu = FALSE; fShowTrainingMenu = FALSE; fShowRepairMenu = FALSE; + fShowMoveItemMenu = FALSE; fShowVehicleMenu = FALSE; fShowSquadMenu = FALSE; fShowFacilityMenu = FALSE; // Added facilities @@ -10278,25 +10591,56 @@ BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ) void CreateVehicleBox() { - CreatePopUpBox(&ghVehicleBox, VehicleDimensions, VehiclePosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); - SetBoxBuffer(ghVehicleBox, FRAME_BUFFER); - SetBorderType(ghVehicleBox,guiPOPUPBORDERS); - SetBackGroundSurface(ghVehicleBox, guiPOPUPTEX); - SetMargins( ghVehicleBox, 6, 6, 4, 4 ); - SetLineSpace(ghVehicleBox, 2); + CreatePopUpBox(&ghVehicleBox, VehicleDimensions, VehiclePosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); + SetBoxBuffer(ghVehicleBox, FRAME_BUFFER); + SetBorderType(ghVehicleBox,guiPOPUPBORDERS); + SetBackGroundSurface(ghVehicleBox, guiPOPUPTEX); + SetMargins( ghVehicleBox, 6, 6, 4, 4 ); + SetLineSpace(ghVehicleBox, 2); } -void CreateRepairBox( void ) +void CreateRepairBox() { - CreatePopUpBox(&ghRepairBox, RepairDimensions, RepairPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); - SetBoxBuffer(ghRepairBox, FRAME_BUFFER); - SetBorderType(ghRepairBox,guiPOPUPBORDERS); - SetBackGroundSurface(ghRepairBox, guiPOPUPTEX); - SetMargins( ghRepairBox, 6, 6, 4, 4 ); - SetLineSpace(ghRepairBox, 2); + CreatePopUpBox(&ghRepairBox, RepairDimensions, RepairPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); + SetBoxBuffer(ghRepairBox, FRAME_BUFFER); + SetBorderType(ghRepairBox,guiPOPUPBORDERS); + SetBackGroundSurface(ghRepairBox, guiPOPUPTEX); + SetMargins( ghRepairBox, 6, 6, 4, 4 ); + SetLineSpace(ghRepairBox, 2); } +void CreateMoveItemBox() +{ + // will create a pop up box for squad selection + SGPPoint pPoint; + SGPRect pDimensions; + + CreatePopUpBox(&ghMoveItemBox, FacilityAssignmentDimensions, FacilityAssignmentPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); + SetBoxBuffer(ghMoveItemBox, FRAME_BUFFER); + SetBorderType(ghMoveItemBox,guiPOPUPBORDERS); + SetBackGroundSurface(ghMoveItemBox, guiPOPUPTEX); + SetMargins( ghMoveItemBox, 6, 6, 4, 4 ); + SetLineSpace(ghMoveItemBox, 2); + + // set current box to this one + SetCurrentBox( ghMoveItemBox ); + + // resize box to text + ResizeBoxToText( ghMoveItemBox ); + + DetermineBoxPositions( ); + + GetBoxPosition( ghMoveItemBox, &pPoint); + GetBoxSize( ghMoveItemBox, &pDimensions ); + + if( giBoxY + pDimensions.iBottom > 479 ) + { + pPoint.iY = FacilityAssignmentPosition.iY = 479 - pDimensions.iBottom; + } + + SetBoxPosition( ghMoveItemBox, pPoint ); +} void CreateContractBox( SOLDIERTYPE *pCharacter ) { @@ -10723,7 +11067,8 @@ BOOLEAN CreateDestroyAssignmentPopUpBoxes( void ) CreateTrainingBox( ); CreateAttributeBox(); CreateVehicleBox(); - CreateRepairBox( ); + CreateRepairBox(); + CreateMoveItemBox(); // HEADROCK HAM 3.6: Facility Menu CreateFacilityBox( ); CreateFacilityAssignmentBox( ); @@ -10756,6 +11101,9 @@ BOOLEAN CreateDestroyAssignmentPopUpBoxes( void ) RemoveBox(ghRepairBox); ghRepairBox = -1; + RemoveBox(ghMoveItemBox); + ghMoveItemBox = -1; + RemoveBox(ghTrainingBox); ghTrainingBox = -1; @@ -10833,6 +11181,14 @@ void DetermineBoxPositions( void ) SetBoxPosition( ghRepairBox, pNewPoint ); } + if( ( fShowMoveItemMenu == TRUE ) && ( ghMoveItemBox != -1 ) ) + { + CreateDestroyMouseRegionForMoveItemMenu( ); + pNewPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_MOVE_ITEMS ); + + SetBoxPosition( ghMoveItemBox, pNewPoint ); + } + if( ( fShowTrainingMenu == TRUE ) && ( ghTrainingBox != -1 ) ) { pNewPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ); @@ -11014,6 +11370,36 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) SetBoxPosition( ghRepairBox, pPoint ); } + else if( fShowMoveItemMenu == TRUE ) + { + GetBoxSize( ghMoveItemBox, &pDimensions ); + + if( gsAssignmentBoxesX + pDimensions2.iRight + pDimensions.iRight >= SCREEN_WIDTH ) + { + gsAssignmentBoxesX = ( INT16 ) ( (SCREEN_WIDTH - 1) - ( pDimensions2.iRight + pDimensions.iRight ) ); + SetRenderFlags( RENDER_FLAG_FULL ); + } + + if( pDimensions2.iBottom > pDimensions.iBottom ) + { + sLongest = ( INT16 )pDimensions2.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_MOVE_ITEMS ); + } + else + { + sLongest = ( INT16 )pDimensions.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_MOVE_ITEMS ); + } + + if( gsAssignmentBoxesY + sLongest >= (SCREEN_HEIGHT - 120) ) + { + gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( sLongest ) ); + SetRenderFlags( RENDER_FLAG_FULL ); + } + + pPoint.iX = gsAssignmentBoxesX + pDimensions2.iRight; + pPoint.iY = gsAssignmentBoxesY + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_MOVE_ITEMS ); + + SetBoxPosition( ghMoveItemBox, pPoint ); + } else if( fShowSquadMenu == TRUE ) { GetBoxSize( ghSquadBox, &pDimensions ); @@ -11877,7 +12263,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam gfRenderPBInterface = TRUE; } break; - case( TRAIN_TEAMMATE ): + case( TRAIN_TEAMMATE ): if( CanCharacterTrainStat( pSoldier, ( INT8 )iParam1, FALSE, TRUE ) ) { @@ -11941,6 +12327,40 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam gfRenderPBInterface = TRUE; } break; + + case MOVE_EQUIPMENT: + { + // train stat + pSoldier->bOldAssignment = pSoldier->bAssignment; + + // remove from squad + RemoveCharacterFromSquads( pSoldier ); + + // remove from any vehicle + if( pSoldier->bOldAssignment == VEHICLE ) + { + TakeSoldierOutOfVehicle( pSoldier ); + } + + if( ( pSoldier->bAssignment != MOVE_EQUIPMENT ) ) + { + SetTimeOfAssignmentChangeForMerc( pSoldier ); + } + + ChangeSoldiersAssignment( pSoldier, MOVE_EQUIPMENT ); + + AssignMercToAMovementGroup( pSoldier ); + + // set sector to take stuff from + pSoldier->usItemMoveSectorID = iParam1; + + // set dirty flag + fTeamPanelDirty = TRUE; + fMapScreenBottomDirty = TRUE; + gfRenderPBInterface = TRUE; + } + break; + case( REPAIR ): if( CanCharacterRepair( pSoldier ) ) { @@ -12184,6 +12604,12 @@ BOOLEAN HandleAssignmentExpansionAndHighLightForAssignMenu( SOLDIERTYPE *pSoldie HighLightBoxLine( ghAssignmentBox, ASSIGN_MENU_REPAIR ); return( TRUE ); } + else if( fShowMoveItemMenu ) + { + // highlight repair line the previous menu + HighLightBoxLine( ghAssignmentBox, ASSIGN_MENU_MOVE_ITEMS ); + return( TRUE ); + } else if( fShowVehicleMenu ) { // highlight vehicle line the previous menu @@ -13090,6 +13516,10 @@ void ReEvaluateEveryonesNothingToDo() !ValidTrainingPartnerInSameSectorOnAssignmentFound( pSoldier, TRAIN_TEAMMATE, pSoldier->bTrainStat ); break; + case MOVE_EQUIPMENT: + fNothingToDo = FALSE; + break; + case VEHICLE: default: // squads fNothingToDo = FALSE; @@ -13279,6 +13709,15 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) fItWorked = TRUE; } break; + + case MOVE_EQUIPMENT: + //if( CanCharacterTrainStat( pSoldier, bParam, TRUE, FALSE ) ) + { + pSoldier->bOldAssignment = pSoldier->bAssignment; + SetSoldierAssignment( pSoldier, MOVE_EQUIPMENT, bParam, 0,0 ); + fItWorked = TRUE; + } + break; // HEADROCK HAM 3.6: Facility Staffing case FACILITY_STAFF: @@ -16125,7 +16564,7 @@ void HandleShadingOfLinesForFacilityMenu( void ) // PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch: - // CreateDestroyMouseRegionForRepairMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForRepairMenu(). + // CreateDestroyMouseRegionForMoveItemMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForMoveItemMenu(). // run through list of staff/use facilities in sector and add them to pop up box for ( iCounter = 0; iCounter < MAX_NUM_FACILITY_TYPES; iCounter++ ) @@ -16810,7 +17249,7 @@ void HandleShadingOfLinesForFacilityAssignmentMenu( void ) pSoldier = GetSelectedAssignSoldier( FALSE ); // PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch: - // CreateDestroyMouseRegionForRepairMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForRepairMenu(). + // CreateDestroyMouseRegionForMoveItemMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForMoveItemMenu(). // run through all possible assignments. Shade as necessary for ( iCounter = 0; iCounter < NUM_FACILITY_ASSIGNMENTS; iCounter++ ) @@ -17149,3 +17588,354 @@ void HaveMercSayWhyHeWontLeave( SOLDIERTYPE *pSoldier ) } #endif +// Flugente: move items menu +BOOLEAN DisplayMoveItemsMenu( SOLDIERTYPE *pSoldier ) +{ + INT32 iVehicleIndex=0; + INT32 hStringHandle=0; + INT32 iCount = 0; + + // run through list of vehicles in sector and add them to pop up box + // first, clear pop up box + RemoveBox(ghMoveItemBox); + ghMoveItemBox = -1; + + CreateMoveItemBox(); + SetCurrentBox(ghMoveItemBox); + + // PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch: + // CreateDestroyMouseRegionForMoveItemMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForMoveItemMenu(). + + // delete old sectors + for (UINT8 i = 0; i < MOVEITEM_MAX_SECTORS; ++i) + { + usMoveItemSectors[i] = 0; + } + + // we now have to show every sector of the town we are in + INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); + + if ( bTownId != BLANK_SECTOR ) + { + for (UINT16 X = 0; X < 256; ++X) + { + INT16 sectorX = SECTORX(X); + INT16 sectorY = SECTORY(X); + + // if sector not under our control, has enemies in it, or is currently in combat mode + if (!SectorOursAndPeaceful( sectorX, sectorY, 0 ) ) + continue; + + if ( sectorX == pSoldier->sSectorX && sectorY == pSoldier->sSectorY ) + continue; + + if ( GetTownIdForSector( sectorX, sectorY ) == bTownId ) + { + usMoveItemSectors[iCount] = (UINT8)X; + + CHAR16 wSectorName[ 64 ]; + GetShortSectorString( sectorX, sectorY, wSectorName ); + + AddMonoString( (UINT32 *)&hStringHandle, wSectorName ); + + iCount++; + if ( iCount >= MOVEITEM_MAX_SECTORS ) + break; + } + } + } + + // cancel + AddMonoString((UINT32 *)&hStringHandle, L"Cancel" ); + + SetBoxFont(ghMoveItemBox, MAP_SCREEN_FONT); + SetBoxHighLight(ghMoveItemBox, FONT_WHITE); + SetBoxShade(ghMoveItemBox, FONT_GRAY7); + SetBoxForeground(ghMoveItemBox, FONT_LTGREEN); + SetBoxBackground(ghMoveItemBox, FONT_BLACK); + + // resize box to text + ResizeBoxToText( ghMoveItemBox ); + + CheckAndUpdateTacticalAssignmentPopUpPositions( ); + + return TRUE; +} + + +void HandleShadingOfLinesForMoveItemMenu( void ) +{ + SOLDIERTYPE *pSoldier = NULL; + INT32 iVehicleIndex = 0; + INT32 iCount = 0; + + if( ( fShowMoveItemMenu == FALSE ) || ( ghMoveItemBox == -1 ) ) + { + return; + } + + pSoldier = GetSelectedAssignSoldier( FALSE ); + + + // PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch: + // CreateDestroyMouseRegionForMoveItemMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForMoveItemMenu(). + + // we now have to show every sector of the town we are in + INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); + + // only in towns + if ( bTownId != BLANK_SECTOR && pSoldier->bSectorZ == 0 ) + { + for(UINT i = 0; i < MOVEITEM_MAX_SECTORS; ++i) + { + UINT8 sector = usMoveItemSectors[i]; + + if ( sector > 0 ) + { + INT16 sectorX = SECTORX(sector); + INT16 sectorY = SECTORY(sector); + + UINT32 uiTotalNumberOfRealItems = 0; + GetNumberOfWorldItemsFromTempItemFile( sectorX, sectorY, 0, &( uiTotalNumberOfRealItems ), FALSE ); + + if ( uiTotalNumberOfRealItems > 0 ) + { + // unshade vehicle line + UnShadeStringInBox( ghMoveItemBox, iCount ); + } + else + { + // shade vehicle line + ShadeStringInBox( ghMoveItemBox, iCount ); + } + } + } + } + + //if ( DoesCharacterHaveAnyItemsToRepair( pSoldier, FINAL_REPAIR_PASS ) ) + if ( 1 ) + { + // unshade items line + UnShadeStringInBox( ghMoveItemBox, iCount ); + } + else + { + // shade items line + ShadeStringInBox( ghMoveItemBox, iCount ); + } + + iCount++; + + + return; +} + + +void CreateDestroyMouseRegionForMoveItemMenu( void ) +{ + static BOOLEAN fCreated = FALSE; + + UINT32 uiCounter = 0; + INT32 iCount = 0; + INT32 iFontHeight = 0; + INT32 iBoxXPosition = 0; + INT32 iBoxYPosition = 0; + SGPPoint pPosition; + INT32 iBoxWidth = 0; + SGPRect pDimensions; + SOLDIERTYPE *pSoldier = NULL; + INT32 iVehicleIndex = 0; + + if( ( fShowMoveItemMenu == TRUE ) && ( fCreated == FALSE ) ) + { + CheckAndUpdateTacticalAssignmentPopUpPositions( ); + + if( ( fShowMoveItemMenu ) && ( guiCurrentScreen == MAP_SCREEN ) ) + { + //SetBoxPosition( ghMoveItemBox ,RepairPosition); + } + + // grab height of font + iFontHeight = GetLineSpace( ghMoveItemBox ) + GetFontHeight( GetBoxFont( ghMoveItemBox ) ); + + // get x.y position of box + GetBoxPosition( ghMoveItemBox, &pPosition); + + // grab box x and y position + iBoxXPosition = pPosition.iX; + iBoxYPosition = pPosition.iY; + + // get dimensions..mostly for width + GetBoxSize( ghMoveItemBox, &pDimensions ); + + // get width + iBoxWidth = pDimensions.iRight; + + SetCurrentBox( ghMoveItemBox ); + + pSoldier = GetSelectedAssignSoldier( FALSE ); + + // PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch: + // CreateDestroyMouseRegionForMoveItemMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForMoveItemMenu(). + + // we now have to show every sector of the town we are in + INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); + + // only in towns + if ( bTownId != BLANK_SECTOR && pSoldier->bSectorZ == 0 ) + { + for(UINT i = 0; i < MOVEITEM_MAX_SECTORS; ++i) + { + UINT8 sector = usMoveItemSectors[i]; + + if ( sector > 0 ) + { + // add mouse region for each line of text..and set user data + MSYS_DefineRegion( &gMoveItem[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , + MSYS_NO_CURSOR, MoveItemMenuMvtCallback, MoveItemMenuBtnCallback ); + + MSYS_SetRegionUserData( &gMoveItem[ iCount ], 0, iCount ); + // 2nd user data is the vehicle index, which can easily be different from the region index! + MSYS_SetRegionUserData( &gMoveItem[ iCount ], 1, iCount ); + iCount++; + + if ( iCount >= MOVEITEM_MAX_SECTORS ) + break; + } + } + } + + // cancel + MSYS_DefineRegion( &gMoveItem[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , + MSYS_NO_CURSOR, MoveItemMenuMvtCallback, MoveItemMenuBtnCallback ); + + MSYS_SetRegionUserData( &gMoveItem[ iCount ], 0, iCount ); + MSYS_SetRegionUserData( &gMoveItem[ iCount ], 1, MOVEITEM_MENU_CANCEL ); + + + PauseGame( ); + + // unhighlight all strings in box + UnHighLightBox( ghMoveItemBox ); + + fCreated = TRUE; + } + else if( ( ( fShowMoveItemMenu == FALSE ) || ( fShowAssignmentMenu == FALSE ) ) && ( fCreated == TRUE ) ) + { + fCreated = FALSE; + + // remove these regions + for( uiCounter = 0; uiCounter < GetNumberOfLinesOfTextInBox( ghMoveItemBox ); uiCounter++ ) + { + MSYS_RemoveRegion( &gMoveItem[ uiCounter ] ); + } + + fShowMoveItemMenu = FALSE; + + SetRenderFlags( RENDER_FLAG_FULL ); + + HideBox( ghRepairBox ); + + if ( fShowAssignmentMenu ) + { + // remove highlight on the parent menu + UnHighLightBox( ghAssignmentBox ); + } + } + + return; +} + +void MoveItemMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + // btn callback handler for assignment region + SOLDIERTYPE *pSoldier = NULL; + INT32 iWhat; + + INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 ); + + // ignore clicks on disabled lines + if( GetBoxShadeFlag( ghMoveItemBox, iValue ) == TRUE ) + { + return; + } + + // WHAT is being repaired is stored in the second user data argument + iWhat = MSYS_GetRegionUserData( pRegion, 1 ); + + pSoldier = GetSelectedAssignSoldier( FALSE ); + + if ( pSoldier && pSoldier->bActive && ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) ) + { + if( iWhat < MOVEITEM_MENU_CANCEL ) + { + pSoldier->bOldAssignment = pSoldier->bAssignment; + + if( pSoldier->bAssignment != MOVE_EQUIPMENT ) + { + SetTimeOfAssignmentChangeForMerc( pSoldier ); + } + + if( pSoldier->bOldAssignment == VEHICLE ) + { + TakeSoldierOutOfVehicle( pSoldier ); + } + + // remove from squad + RemoveCharacterFromSquads( pSoldier ); + + ChangeSoldiersAssignment( pSoldier, MOVE_EQUIPMENT ); + + if ( iWhat < MOVEITEM_MAX_SECTORS ) + pSoldier->usItemMoveSectorID = usMoveItemSectors[iWhat]; + + // assign to a movement group + AssignMercToAMovementGroup( pSoldier ); + + // set assignment for group + SetAssignmentForList( ( INT8 ) MOVE_EQUIPMENT, pSoldier->usItemMoveSectorID ); + fShowAssignmentMenu = FALSE; + } + else + { + // CANCEL + fShowMoveItemMenu = FALSE; + } + + // update mapscreen + fCharacterInfoPanelDirty = TRUE; + fTeamPanelDirty = TRUE; + fMapScreenBottomDirty = TRUE; + + giAssignHighLine = -1; + } +} + + +void MoveItemMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + // mvt callback handler for assignment region + INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 ); + + if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + if( iValue < MOVEITEM_MENU_CANCEL ) + { + if( GetBoxShadeFlag( ghMoveItemBox, iValue ) == FALSE ) + { + // highlight choice + HighLightBoxLine( ghMoveItemBox, iValue ); + } + } + else + { + // highlight cancel line + HighLightBoxLine( ghMoveItemBox, GetNumberOfLinesOfTextInBox( ghMoveItemBox ) - 1 ); + } + } + else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + // unhighlight all strings in box + UnHighLightBox( ghMoveItemBox ); + } +} \ No newline at end of file diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 48d7acb8..5d73a298 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -58,12 +58,13 @@ enum REPAIR, TRAIN_SELF, TRAIN_TOWN, - TRAIN_MOBILE, // HEADROCK HAM 3.6: Training mobile militia. + TRAIN_MOBILE, // HEADROCK HAM 3.6: Training mobile militia. TRAIN_TEAMMATE, TRAIN_BY_OTHER, - FACILITY_STAFF, // HEADROCK HAM 3.6: Operating a facility for strategic gain. - FACILITY_EAT, // added by Flugente - FACILITY_REST, // HEADROCK HAM 3.6: Facility equivalent of resting (no assignment) + MOVE_EQUIPMENT, // added by Flugente: move items from one city sector to another + FACILITY_STAFF, // HEADROCK HAM 3.6: Operating a facility for strategic gain. + FACILITY_EAT, // added by Flugente + FACILITY_REST, // HEADROCK HAM 3.6: Facility equivalent of resting (no assignment) FACILITY_INTERROGATE_PRISONERS, // added by Flugente ASSIGNMENT_DEAD, ASSIGNMENT_UNCONCIOUS, // unused @@ -194,6 +195,8 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ); UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ); +// Flugente: determine max items we can move, and the sector distance + // get bonus tarining pts due to an instructor for this student // HEADROCK HAM 3.5: Three functions below have lost an argument which is no longer required ("uiAtGunRange", which was "uiAtFacility" in HAM 3.4) INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE *pStudent, INT8 bTrainStat, UINT16 *pusMaxPts ); @@ -217,6 +220,7 @@ extern INT32 ghSquadBox; extern INT32 ghVehicleBox; extern INT32 ghRepairBox; extern INT32 ghTrainingBox; +extern INT32 ghMoveItemBox; extern INT32 ghAttributeBox; extern INT32 ghRemoveMercAssignBox; extern INT32 ghContractBox; @@ -243,6 +247,7 @@ extern MOUSE_REGION gFacilityMenuRegion[]; extern BOOLEAN fShownContractMenu; extern BOOLEAN fShownAssignmentMenu; extern BOOLEAN fShowRepairMenu; +extern BOOLEAN fShowMoveItemMenu; extern BOOLEAN fFirstClickInAssignmentScreenMask; @@ -279,6 +284,12 @@ void VehicleMenuBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ); void CreateDestroyMouseRegionForRepairMenu( void ); void RepairMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ); + +// Flugente: move item menu +void CreateDestroyMouseRegionForMoveItemMenu( void ); +void MoveItemMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void MoveItemMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ); + // HEADROCK HAM 3.6: Facility Menu void CreateDestroyMouseRegionForFacilityMenu( void ); void FacilityMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); diff --git a/Strategic/Map Screen Interface Border.cpp b/Strategic/Map Screen Interface Border.cpp index 5aef06eb..5e22177b 100644 --- a/Strategic/Map Screen Interface Border.cpp +++ b/Strategic/Map Screen Interface Border.cpp @@ -99,7 +99,7 @@ BOOLEAN fZoomFlag = FALSE; extern POPUP* gMapInventoryFilterPopup; extern BOOLEAN gfMapInventoryFilterPopupVisible; extern BOOLEAN gfQueueRecreateMapInventoryFilterMenu; -extern UINT32 guiMapInvenFilterButton[ 9 ]; +extern UINT32 guiMapInvenFilterButton[ MAP_INVENTORY_FILTER_BUTTONS ]; extern void CreateMapInventoryFilterMenu( ); // used for ETA border drawing diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index b677809a..171cceca 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -193,8 +193,8 @@ UINT32 guiMapInvenZoomButton; UINT32 guiMapInvenSortButtonImage[4]; UINT32 guiMapInvenSortButton[4]; -UINT32 guiMapInvenFilterButtonImage[9]; -UINT32 guiMapInvenFilterButton[9]; +UINT32 guiMapInvenFilterButtonImage[MAP_INVENTORY_FILTER_BUTTONS]; +UINT32 guiMapInvenFilterButton[MAP_INVENTORY_FILTER_BUTTONS]; @@ -281,6 +281,7 @@ void MapInventoryPoolSortAttachmentsBtn( GUI_BUTTON *btn, INT32 reason ); void MapInventoryPoolEjectAmmoBtn( GUI_BUTTON *btn, INT32 reason ); // HEADROCK HAM 5: Preliminary Filter Button void MapInventoryPoolFilterBtn( GUI_BUTTON *btn, INT32 reason ); +void MapInventoryPoolFilterBtnMoveItemDisplay( GUI_BUTTON *btn, INT32 reason ); // Flugente void DisplayCurrentSector( void ); void ResizeInventoryList( void ); void ClearUpTempUnSeenList( void ); @@ -341,6 +342,18 @@ void MapInventoryFilterToggle( UINT32 uiFlags ); void MapInventoryFilterSet( UINT32 uiFlags ); void HandleSetFilterButtons(); +// Flugente: show wether an item is set to be ignored by the 'move item' assignment. This can be toggled in strategic inventory. +static BOOLEAN fShowMoveItem = TRUE; +BOOLEAN IsShowMoveItem() +{ + return (fShowMoveItem && guiCurrentScreen == MAP_SCREEN); +} + +void ToggleShowMoveItem() +{ + fShowMoveItem = !fShowMoveItem; +} + // load the background panel graphics for inventory BOOLEAN LoadInventoryPoolGraphic( void ) { @@ -495,7 +508,6 @@ void RenderItemsForCurrentPageOfInventoryPool( void ) return; } - BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) { // render item in this slot of the list @@ -611,6 +623,7 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) } } + // Flugente: militia equipment if( gGameExternalOptions.fMilitiaUseSectorInventory && ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].usFlags & WORLD_ITEM_TABOO_FOR_MILITIA_EQ_ALL ) ) { //Shade the item, but only if it is an active item! @@ -627,6 +640,19 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) } } + // Flugente: move item assignment ignore marker + if( ( IsShowMoveItem() && pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].usFlags & WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE ) ) + { + //Shade the item, but only if it is an active item! + if ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == true) + { + // colour depends on flag + UINT16 usColor = Get16BPPColor( FROMRGB( 254, 190, 133 ) ); + + DrawHatchOnInventory_MilitiaAccess( guiSAVEBUFFER, sX, sY, MAP_INVEN_SLOT_WIDTH, MAP_INVEN_SLOT_IMAGE_HEIGHT , usColor); + } + } + // the name wcscpy( sString, ShortItemNames[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem ] ); @@ -1330,7 +1356,14 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) { if ( gpItemPointer == NULL ) { - if ( _KeyDown ( TAB ) && gGameExternalOptions.fMilitiaUseSectorInventory ) + if ( _KeyDown ( TAB ) && _KeyDown ( CTRL ) ) + { + if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags & WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE ) + pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags &= ~WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE; + else + pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags |= WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE; + } + else if ( _KeyDown ( TAB ) && gGameExternalOptions.fMilitiaUseSectorInventory ) { pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object[0]->data.sObjectFlag &= ~(TAKEN_BY_MILITIA_TABOO_GREEN|TAKEN_BY_MILITIA_TABOO_BLUE); @@ -1403,7 +1436,14 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) */ } - if ( _KeyDown ( TAB ) && gGameExternalOptions.fMilitiaUseSectorInventory ) + if ( _KeyDown ( TAB ) && _KeyDown ( CTRL ) ) + { + if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags & WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE ) + pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags &= ~WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE; + else + pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags |= WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE; + } + else if ( _KeyDown ( TAB ) && gGameExternalOptions.fMilitiaUseSectorInventory ) { pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object[0]->data.sObjectFlag &= ~(TAKEN_BY_MILITIA_TABOO_GREEN|TAKEN_BY_MILITIA_TABOO_BLUE); @@ -1694,6 +1734,18 @@ void CreateMapInventoryButtons( void ) ButtonList[ guiMapInvenFilterButton[ 8 ] ]->UserData[2] = 0; ButtonList[ guiMapInvenFilterButton[ 8 ] ]->UserData[3] = IC_MAPFILTER_MISC; + // Flugente: toggle button for move item display + guiMapInvenFilterButtonImage[ 9 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 36, 36, -1, 37, -1 ); + guiMapInvenFilterButton[ 9 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 9 ], INVEN_POOL_X+345 + xResOffset, INVEN_POOL_Y+10, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtnMoveItemDisplay ); + + SetButtonFastHelpText( guiMapInvenFilterButton[ 9 ], pMapScreenInvenButtonHelpText[ 17 ] ); + ButtonList[ guiMapInvenFilterButton[ 9 ] ]->UserData[0] = 0; + ButtonList[ guiMapInvenFilterButton[ 9 ] ]->UserData[1] = IC_MAPFILTER_MISC; + ButtonList[ guiMapInvenFilterButton[ 9 ] ]->UserData[2] = 0; + ButtonList[ guiMapInvenFilterButton[ 9 ] ]->UserData[3] = IC_MAPFILTER_MISC; + /* guiMapInvenFilterButtonImage[ 9 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 19, 17, -1, 18, -1 ); guiMapInvenFilterButton[ 9 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 9 ], INVEN_POOL_X+349 + xResOffset, INVEN_POOL_Y+10, @@ -1745,7 +1797,7 @@ void DestroyMapInventoryButtons( void ) // HEADROCK HAM 5: Filter button if (iResolution >= _800x600 ) { - for (INT32 iCounter = 0; iCounter < 9; iCounter++) + for (INT32 iCounter = 0; iCounter < MAP_INVENTORY_FILTER_BUTTONS; iCounter++) { RemoveButton( guiMapInvenFilterButton[ iCounter ] ); UnloadButtonImage( guiMapInvenFilterButtonImage[ iCounter ] ); @@ -2555,6 +2607,51 @@ void MapInventoryPoolFilterBtn( GUI_BUTTON *btn, INT32 reason ) } } +// Flugente: display wether items that shoul be ignored for 'move item' assignment should be marked +void MapInventoryPoolFilterBtnMoveItemDisplay( GUI_BUTTON *btn, INT32 reason ) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN || + reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) + { + if (!(btn->uiFlags & (BUTTON_CLICKED_ON))) + { + // Set as "clicked on", but do nothing until the mouse is released. + btn->uiFlags |= (BUTTON_CLICKED_ON); + } + } + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if (btn->uiFlags & (BUTTON_CLICKED_ON)) + { + ToggleShowMoveItem(); + + // The refresh function moves the necessary items from the Seen to the Unseen inventories, and vice versa. + RefreshSeenAndUnseenPools(); + + BlitInventoryPoolGraphic( ); + + HandleSetFilterButtons(); + } + } + /*if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + if (btn->uiFlags & (BUTTON_CLICKED_ON)) + { + if (btn->UserData[2] == 0) + { + MapInventoryFilterSet( btn->UserData[3] ); + } + else + { + MapInventoryFilterToggle( btn->UserData[3] ); + } + + // HEADROCK HAM 5: Disabled for now, as we've got buttons for this. + //CreateMapInventoryFilterMenu( ); + } + }*/ +} + // HEADROCK HAM 5: Zoom button. // This button handles toggling between the small-scale inventory (items shown at normal size, similar to merc's inventory) // and the big-item inventory (which shows BigItem pics and is therefore much easier to examine in detail). @@ -5091,6 +5188,16 @@ void HandleSetFilterButtons() { ButtonList[guiMapInvenFilterButton[ 8 ]]->uiFlags &=~ (BUTTON_CLICKED_ON); } + + // Flugente: move item display + if ( IsShowMoveItem() ) + { + ButtonList[guiMapInvenFilterButton[ 9 ]]->uiFlags |= (BUTTON_CLICKED_ON); + } + else + { + ButtonList[guiMapInvenFilterButton[ 9 ]]->uiFlags &=~ (BUTTON_CLICKED_ON); + } } // Flugente: handle various cooldown functions in a sector diff --git a/Strategic/Map Screen Interface Map Inventory.h b/Strategic/Map Screen Interface Map Inventory.h index 382caa5e..cfad2852 100644 --- a/Strategic/Map Screen Interface Map Inventory.h +++ b/Strategic/Map Screen Interface Map Inventory.h @@ -7,6 +7,9 @@ // this is how close one has to be in the loaded sector to pickup an item #define MAX_DISTANCE_TO_PICKUP_ITEM 5 +// Flugente: number of map inventory filter buttons +#define MAP_INVENTORY_FILTER_BUTTONS 10 // Flugente: 9 -> 10 + // number of inventory slots //#define MAP_INVENTORY_POOL_SLOT_COUNT 84 //45 //45 diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 7dc2d28e..86932598 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -2274,6 +2274,14 @@ void UpdateMapScreenAssignmentPositions( void ) SetBoxPosition( ghRepairBox, pPoint ); } + if( fShowMoveItemMenu ) + { + GetBoxPosition( ghMoveItemBox, &pPoint); + pPoint.iY = giBoxY + ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_MOVE_ITEMS; + + SetBoxPosition( ghMoveItemBox, pPoint ); + } + // HEADROCK HAM 3.6: Facility Menu if( fShowFacilityMenu ) { diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index a49d4dff..4a8538e2 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -126,6 +126,7 @@ enum { ASSIGN_MENU_VEHICLE, ASSIGN_MENU_REPAIR, ASSIGN_MENU_TRAIN, + ASSIGN_MENU_MOVE_ITEMS, // added by Flugente ASSIGN_MENU_FACILITY, // HEAROCK HAM 3.6: Facility List menu ASSIGN_MENU_CANCEL, MAX_ASSIGN_STRING_COUNT, diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index f460dde7..d34cb422 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -6912,6 +6912,10 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { fShowRepairMenu = FALSE; } + else if( fShowMoveItemMenu == TRUE ) + { + fShowMoveItemMenu = FALSE; + } // HEADROCK HAM 3.6: Facility Menu else if( fShowFacilityMenu == TRUE ) { diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 02f45f68..40deeaf0 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -1652,6 +1652,8 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE BOOLEAN drawOpponentCount = FALSE; + CHAR16 wShortText[ 8 ]; // added by Flugente to display sector names + // If we are using an extern buffer... if ( fUseExternBuffer ) { @@ -2413,6 +2415,18 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE break; + case MOVE_EQUIPMENT: + { + sIconIndex = 25; + fDoIcon = TRUE; + + GetShortSectorString( SECTORX(pSoldier->usItemMoveSectorID), SECTORY(pSoldier->usItemMoveSectorID), wShortText ); + + fShowNumber = TRUE; + fShowMaximum = TRUE; + } + break; + case FACILITY_INTERROGATE_PRISONERS: sIconIndex = 23; fDoIcon = TRUE; @@ -2452,10 +2466,10 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE if ( fShowMaximum ) { - /*if ( pSoldier->bAssignment == FACILITY_INTERROGATE_PRISONERS ) - swprintf( sString, L"%2.2f/%d", bPtsAvailable, usMaximumPts ); - else*/ - swprintf( sString, L"%d/%d", sPtsAvailable, usMaximumPts ); + if ( pSoldier->bAssignment == MOVE_EQUIPMENT ) + swprintf( sString, L"%s", wShortText ); + else + swprintf( sString, L"%d/%d", sPtsAvailable, usMaximumPts ); } else { diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 3bcd040d..60571850 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -266,6 +266,7 @@ UINT32 guiAttachmentSlot; // HEADROCK HAM 4: This replaces "Misc" icons. extern UINT32 guiItemInfoAdvancedIcon; // added here by Flugente +UINT32 guiItemInfoMoveItemDisplay; // added here by Flugente. We need a second name, otherwise the two displays in Strategic Inventory and UDB will interfere with each other UINT32 guiItemGraphic; UINT32 guiMoneyGraphicsForDescBox; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 6f0b1599..9bf8af72 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1274,9 +1274,12 @@ public: UINT16 usSoldierProfile; // Flugente: allow linking to a xml-based profile specifiying name, visuals, traits etc. + // Flugente: sector ID for move items assignemnt + UINT8 usItemMoveSectorID; + // Flugente: Decrease this filler by 1 for each new UINT8 / BOOLEAN variable, so we can maintain savegame compatibility!! // Note that we also have to account for padding, so you might need to substract more than just the size of the new variables - UINT8 ubFiller[8]; + UINT8 ubFiller[7]; #ifdef JA2UB //ja25 diff --git a/Tactical/World Items.h b/Tactical/World Items.h index 1156a0a7..2a3f4b6a 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -6,20 +6,25 @@ #define WORLD_ITEM_DONTRENDER 0x0001 -#define WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO 0x0002 +#define WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO 0x0002 + #define WORLD_ITEM_ARMED_BOMB 0x0040 #define WORLD_ITEM_SCIFI_ONLY 0x0080 -#define WORLD_ITEM_REALISTIC_ONLY 0x0100 + +#define WORLD_ITEM_REALISTIC_ONLY 0x0100 #define WORLD_ITEM_REACHABLE 0x0200 -#define WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT 0x0400 +#define WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT 0x0400 //Kaiden: This constant is to flag items that an enemy drops when they die. -#define WORLD_ITEM_DROPPED_FROM_ENEMY 0x0800 +#define WORLD_ITEM_DROPPED_FROM_ENEMY 0x0800 // Flugente: when equipping militia from inventory, do not consider this item #define WORLD_ITEM_TABOO_FOR_MILITIA_EQ_ELITE 0x1000 #define WORLD_ITEM_TABOO_FOR_MILITIA_EQ_BLUE 0x2000 #define WORLD_ITEM_TABOO_FOR_MILITIA_EQ_GREEN 0x4000 +// Flugente: when moving items via 'move items' assignment, ignore this item +#define WORLD_ITEM_MOVE_ASSIGNMENT_IGNORE 0x8000 + #define WORLD_ITEM_TABOO_FOR_MILITIA_EQ_ALL 0x7000 class WORLDITEM;//dnl ch33 120909 diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 8e53f3b2..f81f0a4d 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -1651,6 +1651,7 @@ STR16 pAssignmentStrings[] = L"游击队", //L"M.Militia", //training moving militia units //ham3.6 L"教练", // training a teammate L"学员", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"工作", // L"Staff", // operating a strategic facility //ham3.6 L"饮食", // eating at a facility (cantina etc.) L"休息", //L"Rest",// Resting at a facility //ham3.6 @@ -1737,6 +1738,7 @@ STR16 pPersonnelAssignmentStrings[] = L"训练游击队", L"教练", L"学员", + L"MoveItem", // move items // TODO.Translate L"设施职员", L"饮食", // eating at a facility (cantina etc.) L"在设施里休养", @@ -1784,6 +1786,7 @@ STR16 pLongAssignmentStrings[] = L"训练游击队", //L"Train Mobiles", L"训练队友", L"学员", + L"MoveItem", // move items // TODO.Translate L"设施职员", //L"Staff Facility", L"休息", //L"Rest at Facility", L"审讯俘虏", // L"Interrogate prisoners", @@ -1908,6 +1911,7 @@ STR16 pAssignMenuStrings[] = L"交通工具", L"修理", L"训练", + L"MoveItem", // move items // TODO.Translate L"设施", // L"Facility", // the merc is using/staffing a facility //ham3.6 L"取消", }; @@ -3254,6 +3258,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: 切换是否显示套装包\n|R|i|g|h|t |C|l|i|c|k: 只显示套装包", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: 切换是否显示杂项物品\n|R|i|g|h|t |C|l|i|c|k: 只显示杂项物品", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index ec0aa17f..b6956dff 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -1647,6 +1647,7 @@ STR16 pAssignmentStrings[] = L"M.Militia", //training moving militia units // TODO.Translate L"Trainer", // training a teammate L"Student", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Staff", // operating a strategic facility // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Rest", // Resting at a facility // TODO.Translate @@ -1733,6 +1734,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Training Mobile Militia", // TODO.Translate L"Trainer", // training a teammate L"Student", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Facility Staff", // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Resting at Facility", // TODO.Translate @@ -1780,6 +1782,7 @@ STR16 pLongAssignmentStrings[] = L"Train Mobiles", // TODO.Translate L"Trainer", // training a teammate L"Student", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Staff Facility", // TODO.Translate L"Rest at Facility", // TODO.Translate L"Interrogate prisoners", // Flugente: interrogate prisoners TODO.Translate @@ -1904,6 +1907,7 @@ STR16 pAssignMenuStrings[] = L"Vehicle", // the merc is in a vehicle L"Repair", // the merc is repairing items L"Train", // the merc is training + L"MoveItem", // move items // TODO.Translate L"Facility", // the merc is using/staffing a facility // TODO.Translate L"Stop", // cancel this menu }; @@ -3254,6 +3258,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: Toggle Kits\n|R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items\n|R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 06c56a5f..87290f53 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -1651,6 +1651,7 @@ STR16 pAssignmentStrings[] = L"M.Militia", //training moving militia units L"Trainer", // training a teammate L"Student", // being trained by someone else + L"MoveItem", // move items L"Staff", // operating a strategic facility L"Eat", // eating at a facility (cantina etc.) L"Rest", // Resting at a facility @@ -1737,6 +1738,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Training Mobile Militia", // Missing L"Trainer", L"Student", + L"MoveItem", // move items L"Facility Staff", // Missing L"Eat", // eating at a facility (cantina etc.) L"Resting at Facility", // Missing @@ -1784,6 +1786,7 @@ STR16 pLongAssignmentStrings[] = L"Train Mobiles", // Missing L"Train Teammate", L"Student", + L"MoveItem", // move items L"Staff Facility", // Missing L"Rest at Facility", // Missing L"Interrogate prisoners", // Flugente: interrogate prisoners @@ -1908,6 +1911,7 @@ STR16 pAssignMenuStrings[] = L"Vehicle", // the merc is in a vehicle L"Repair", // the merc is repairing items L"Train", // the merc is training + L"MoveItem", // move items L"Facility", // the merc is using/staffing a facility L"Cancel", // cancel this menu }; @@ -3254,6 +3258,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: Toggle Kits\n|R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items\n|R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index b31a0c90..b3eff380 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -1655,6 +1655,7 @@ STR16 pAssignmentStrings[] = L"Milice M.", //training moving militia units L"Entraîneur", // training a teammate //!!! Too long ? (11 char) -> 11 chars is OK L"Élève", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Exploitation", // operating a strategic facility L"Mange", // eating at a facility (cantina etc.) // TODO.Translate L"Repos", // Resting at a facility @@ -1741,6 +1742,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Forme la milice mobile",//!!! Too long ? -> It is OK L"Entraîneur", L"Élève", + L"MoveItem", // move items // TODO.Translate L"Exploitation infras.", //!!! Idem ? -> The current translation is OK L"Manger", // eating at a facility (cantina etc.) L"Repos infras.", @@ -1788,6 +1790,7 @@ STR16 pLongAssignmentStrings[] = L"Milice mobile", L"Entraîneur", L"Elève", + L"MoveItem", // move items // TODO.Translate L"Exploitation infras.", //!!! Idem ? -> Current translation is OK L"Repos infras.", L"Interrogate prisoners", // Flugente: interrogate prisoners // TODO.Translate @@ -1912,6 +1915,7 @@ STR16 pAssignMenuStrings[] = L"Transport", // the merc is in a vehicle L"Réparation", // the merc is repairing items L"Formation", // the merc is training + L"MoveItem", // move items // TODO.Translate L"Construction", // the merc is using/staffing a facility L"Annuler", // cancel this menu }; @@ -3261,6 +3265,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: Toggle Kits\n|R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items\n|R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index bb3eb368..6ce8ea9d 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -1660,6 +1660,7 @@ STR16 pAssignmentStrings[] = L"M.Miliz", //training moving militia units L"Trainer", // training a teammate L"Rekrut", // being trained by someone else + L"Umzug", // move items // TODO.Translate L"Betrieb", // operating a strategic facility L"Essen", // eating at a facility (cantina etc.) L"Pause", // Resting at a facility @@ -1742,6 +1743,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Trainiere Mobile Miliz", L"Trainer", L"Rekrut", + L"Umzug/ move items L"Betriebspersonal", L"Essen", // eating at a facility (cantina etc.) L"Betriebspause", @@ -1787,6 +1789,7 @@ STR16 pLongAssignmentStrings[] = L"Trainiere Mobile", L"Trainer", L"Rekrut", + L"MoveItem", // move items L"Betriebspersonal", L"Betriebspause", L"Gefangene verhören", // Flugente: interrogate prisoners @@ -1907,6 +1910,7 @@ STR16 pAssignMenuStrings[] = L"Fahrzeug", // the merc is in a vehicle L"Repar.", // the merc is repairing items L"Training", // the merc is training + L"Umzug", // move items L"Betrieb", // the merc is using/staffing a facility L"Abbrechen", // cancel this menu }; @@ -3241,6 +3245,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|i|n|k|e|r |K|l|i|c|k: Ein-/Ausblenden von Ausrüstung\n|R|e|c|h|t|e|r |K|l|i|c|k: Nur Ausrüstung anzeigen", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|i|n|k|e|r |K|l|i|c|k: Ein-/Ausblenden von anderen Gegenständen\n|R|e|c|h|t|e|r |K|l|i|c|k: Nur andere Gegenstände anzeigen", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 4126b6b3..47850e74 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -1642,7 +1642,8 @@ STR16 pAssignmentStrings[] = L"Esercit.", // training a town to revolt L"M.Militia", //training moving militia units // TODO.Translate L"Istrutt.", // training a teammate - L"Studente", // being trained by someone else + L"Studente", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Staff", // operating a strategic facility // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Rest", // Resting at a facility // TODO.Translate @@ -1729,6 +1730,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Training Mobile Militia", // TODO.Translate L"Allenatore", L"Studente", + L"MoveItem", // move items // TODO.Translate L"Facility Staff", // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Resting at Facility", // TODO.Translate @@ -1776,6 +1778,7 @@ STR16 pLongAssignmentStrings[] = L"Train Mobiles", // TODO.Translate L"Allena squadra", L"Studente", + L"MoveItem", // move items // TODO.Translate L"Staff Facility", // TODO.Translate L"Rest at Facility", // TODO.Translate L"Interrogate prisoners", // Flugente: interrogate prisoners TODO.Translate @@ -1900,6 +1903,7 @@ STR16 pAssignMenuStrings[] = L"Veicolo", // the merc is in a vehicle L"Ripara", // the merc is repairing items L"Si esercita", // the merc is training + L"MoveItem", // move items // TODO.Translate L"Facility", // the merc is using/staffing a facility // TODO.Translate L"Annulla", // cancel this menu }; @@ -3248,6 +3252,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: Toggle Kits\n|R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items\n|R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 77ed355b..d5d894cb 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -1659,6 +1659,7 @@ STR16 pAssignmentStrings[] = L"R.Samoobr.", //training moving militia units L"Instruk.", // training a teammate L"Uczeń", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Staff", // operating a strategic facility // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Rest", // Resting at a facility // TODO.Translate @@ -1745,6 +1746,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Training Mobile Militia", // TODO.Translate L"Instruktor", L"Uczeń", + L"MoveItem", // move items // TODO.Translate L"Facility Staff", // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Resting at Facility", // TODO.Translate @@ -1792,6 +1794,7 @@ STR16 pLongAssignmentStrings[] = L"Train Mobiles", // TODO.Translate L"Trenuj oddział", L"Uczeń", + L"MoveItem", // move items // TODO.Translate L"Staff Facility", // TODO.Translate L"Rest at Facility", // TODO.Translate L"Interrogate prisoners", // Flugente: interrogate prisoners TODO.Translate @@ -1916,6 +1919,7 @@ STR16 pAssignMenuStrings[] = L"Pojazd", // the merc is in a vehicle L"Naprawa", // the merc is repairing items L"Szkolenie", // the merc is training + L"MoveItem", // move items // TODO.Translate L"Facility", // the merc is using/staffing a facility // TODO.Translate L"Anuluj", // cancel this menu }; @@ -3264,6 +3268,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: Toggle Kits\n|R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items\n|R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 9ac31976..20bf4bf7 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -1650,7 +1650,8 @@ STR16 pAssignmentStrings[] = L"Ополчение", // training a town to revolt L"Мобил.гр.", //training moving militia units //M.Militia L"Тренер", // training a teammate - L"Ученик", // being trained by someone else + L"Ученик", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Штат", // operating a strategic facility //Staff L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Отдых", // Resting at a facility //Rest @@ -1737,6 +1738,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Тренирует мобильную группу", //Training Mobile Militia L"Тренер", L"Ученик", + L"MoveItem", // move items // TODO.Translate L"Работает с населением", //Facility Staff L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Отдыхает", //Resting at Facility @@ -1784,6 +1786,7 @@ STR16 pLongAssignmentStrings[] = L"Тренирует мобильную группу", //Train Mobiles L"Тренирует", L"Обучается", + L"MoveItem", // move items // TODO.Translate L"Работает с населением", //Staff Facility L"Отдыхает в заведении", //Resting at Facility L"Interrogate prisoners", // Flugente: interrogate prisoners TODO.Translate @@ -1908,6 +1911,7 @@ STR16 pAssignMenuStrings[] = L"Машина", // the merc is in a vehicle L"Ремонт", // the merc is repairing items L"Обучение", // the merc is training + L"MoveItem", // move items // TODO.Translate L"Удобства", // the merc is using/staffing a facility //Facility L"Отмена", // cancel this menu }; @@ -3253,6 +3257,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|Л|е|в|ы|й| |щ|е|л|ч|о|к|: Скрыть наборы\n|П|р|а|в|ы|й| |щ|е|л|ч|о|к|: Показать наборы", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|Л|е|в|ы|й| |щ|е|л|ч|о|к|: Скрыть прочие предметы\n|П|р|а|в|ы|й| |щ|е|л|ч|о|к|: Показать прочие предметы", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] = diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 8b5f23b2..b9305438 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -1651,6 +1651,7 @@ STR16 pAssignmentStrings[] = L"M.Militia", //training moving militia units // TODO.Translate L"Trainer", // training a teammate L"Student", // being trained by someone else + L"MoveItem", // move items // TODO.Translate L"Staff", // operating a strategic facility // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Rest", // Resting at a facility // TODO.Translate @@ -1737,6 +1738,7 @@ STR16 pPersonnelAssignmentStrings[] = L"Training Mobile Militia", // TODO.Translate L"Trainer", L"Student", + L"MoveItem", // move items // TODO.Translate L"Facility Staff", // TODO.Translate L"Eat", // eating at a facility (cantina etc.) // TODO.Translate L"Resting at Facility", // TODO.Translate @@ -1784,6 +1786,7 @@ STR16 pLongAssignmentStrings[] = L"Train Mobiles", // TODO.Translate L"Train Teammate", L"Student", + L"MoveItem", // move items // TODO.Translate L"Staff Facility", // TODO.Translate L"Rest at Facility", // TODO.Translate L"Interrogate prisoners", // Flugente: interrogate prisoners TODO.Translate @@ -1908,6 +1911,7 @@ STR16 pAssignMenuStrings[] = L"Vehicle", // the merc is in a vehicle L"Repair", // the merc is repairing items L"Train", // the merc is training + L"MoveItem", // move items // TODO.Translate L"Facility", // the merc is using/staffing a facility // TODO.Translate L"Cancel", // cancel this menu }; @@ -3258,6 +3262,7 @@ STR16 pMapScreenInvenButtonHelpText[] = L"|L|e|f|t |C|l|i|c|k: Toggle Kits\n|R|i|g|h|t |C|l|i|c|k: Show only Kits", // HEADROCK HAM 5: Filter Button // 16 - 20 L"|L|e|f|t |C|l|i|c|k: Toggle Misc. Items\n|R|i|g|h|t |C|l|i|c|k: Show only Misc. Items", // HEADROCK HAM 5: Filter Button + L"|L|e|f|t |C|l|i|c|k: Toggle Move Item Display", // Flugente: move item display // TODO.Translate }; STR16 pMapScreenBottomFastHelp[] =