From 9eb2008147bd27a99c5d73933911abdaae400b36 Mon Sep 17 00:00:00 2001 From: Flugente Date: Wed, 3 Aug 2016 17:36:37 +0000 Subject: [PATCH] Helpful option: if PRINTOUTTILESET is TRUE (default FALSE), pressing [f] over a structure will also print out what tileset the structure's subtileset belongs too, its name, and the specific tile index. This is rather helpful if you set up fortifiction or interactive action xmls, or if you just want to know a sector's tileset. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8279 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 3 ++- GameSettings.h | 3 +++ Tactical/Turn Based Input.cpp | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index c85795c1..c4d61c35 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1724,7 +1724,8 @@ void LoadGameExternalOptions() //################# Tactical Fortification Settings ################## gGameExternalOptions.fFortificationAllowInHostileSector = iniReader.ReadBoolean("Tactical Fortification Settings", "FORTIFICATION_ALLOW_IN_HOSTILE_SECTOR", FALSE); - gGameExternalOptions.fRoofCollapse = iniReader.ReadBoolean( "Tactical Fortification Settings", "ROOF_COLLAPSE", TRUE ); + gGameExternalOptions.fRoofCollapse = iniReader.ReadBoolean("Tactical Fortification Settings", "ROOF_COLLAPSE", TRUE ); + gGameExternalOptions.fPrintStructureTileset = iniReader.ReadBoolean("Tactical Fortification Settings", "PRINTOUTTILESET", FALSE ); //################# Tactical Food Settings ################## gGameExternalOptions.usFoodDigestionHourlyBaseFood = iniReader.ReadInteger("Tactical Food Settings", "FOOD_DIGESTION_HOURLY_BASE_FOOD", 20, 0, 250); diff --git a/GameSettings.h b/GameSettings.h index 602517d6..bf878ecc 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -431,6 +431,9 @@ typedef struct // Flugente: can roofs collapse? BOOLEAN fRoofCollapse; + // Flugente: option to print out tilesets of structure if we press 'f' + BOOLEAN fPrintStructureTileset; + // Flugente: food settings UINT16 usFoodDigestionHourlyBaseFood; UINT16 usFoodDigestionHourlyBaseDrink; diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index c5546b67..81be8a6f 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -3369,6 +3369,42 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) CHAR16 zOutputString[512]; swprintf( zOutputString, L"%s: %d", pUpdateMapInfoText[19], usGridNo); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, zOutputString ); + + // Flugente: print out structure tileset + if ( gGameExternalOptions.fPrintStructureTileset ) + { + STRUCTURE * pStruct = FindStructure( usGridNo, (STRUCTURE_GENERIC) ); + if ( pStruct ) + { + // if this is a multi-tile structure, be sure to use the base gridno + if ( !(pStruct->fFlags & STRUCTURE_BASE_TILE) ) + { + pStruct = FindBaseStructure( pStruct ); + } + + if ( pStruct ) + { + LEVELNODE* pNode = FindLevelNodeBasedOnStructure( pStruct->sGridNo, pStruct ); + + if ( pNode ) + { + UINT32 uiTileType = 0; + if ( GetTileType( pNode->usIndex, &uiTileType ) ) + { + std::string tilesestr = GetNameToTileSet( uiTileType ); + + CHAR16 whcarthing[100]; + + int nChars = MultiByteToWideChar( CP_ACP, 0, tilesestr.c_str(), -1, NULL, 0 ); + MultiByteToWideChar( CP_UTF8, 0, tilesestr.c_str( ), -1, whcarthing, nChars ); + + swprintf( zOutputString, L"Tileset %d: Tilesetname: %s tileindex: %d", giCurrentTilesetID, whcarthing, pStruct->pDBStructureRef->pDBStructure->usStructureNumber ); + ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, zOutputString ); + } + } + } + } + } } } break;