diff --git a/Editor/EditorBuildings.cpp b/Editor/EditorBuildings.cpp index 1f3e6ccf..ffacff27 100644 --- a/Editor/EditorBuildings.cpp +++ b/Editor/EditorBuildings.cpp @@ -58,7 +58,8 @@ void GameInitEditorBuildingInfo() //BEGINNING OF BUILDING UTILITY FUNCTIONS void UpdateRoofsView()//dnl ch80 011213 { - INT32 x, cnt; + INT32 x, cnt, tiletypecnt; + /* // hide roof structures only UINT16 usType[12] = {FIRSTROOF, SECONDROOF, THIRDROOF, FOURTHROOF, FIRSTSLANTROOF, SECONDSLANTROOF, FIRSTONROOF, SECONDONROOF, FIRSTWALL, SECONDWALL, THIRDWALL, FOURTHWALL}; for(cnt=0; cnt= FIRSTONROOF) && (usUseObjIndex <= SECONDONROOF ) ) + if ( ( (usUseObjIndex >= FIRSTONROOF) && (usUseObjIndex <= SECONDONROOF ) ) || _KeyDown(17) ) { // WANNE: Disabled the next line, because if makes placing sandbags on rooftops impossible! //dnl Remove all onroof things before placing new one to avoid stacking problems of same element @@ -581,6 +600,40 @@ void PasteStructureCommon( INT32 iMapIndex ) fDoPaste = TRUE; } */ + + // anv: add anything on the roof, cause why not + if ( _KeyDown(17) ) + { + if ( /*fDoPaste &&*/ iMapIndex < 0x80000000 ) + { + iRandSelIndex = GetRandomSelection( ); + if ( iRandSelIndex == -1 ) + { + return; + } + + AddToUndoList( iMapIndex ); + + usUseIndex = pSelList[ iRandSelIndex ].usIndex; + usUseObjIndex = (UINT16)pSelList[ iRandSelIndex ].uiObject; + + // Check with Structure Database (aka ODB) if we can put the object here! + fOkayToAdd = OkayToAddStructureToWorld( iMapIndex, 1, gTileDatabase[ (gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].pDBStructureRef, INVALID_STRUCTURE_ID ); + if ( fOkayToAdd || (gTileDatabase[ (gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].pDBStructureRef == NULL) ) + { + //dnl Remove existing structure before adding the same, seems to solve problem with stacking but still need test to be sure that is not removed something what should stay + RemoveStruct( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) );//dnl + // Actual structure info is added by the functions below + AddOnRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + // For now, adjust to shadows by a hard-coded amount, + + // Add mask if in long grass + //GetLandHeadType( iMapIndex, &fHeadType ); + } + return; + } + } + if ( /*fDoPaste &&*/ iMapIndex < 0x80000000 ) { iRandSelIndex = GetRandomSelection( ); diff --git a/GameSettings.cpp b/GameSettings.cpp index 59283110..e631d56e 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -974,6 +974,9 @@ void LoadGameExternalOptions() // New setting to allow thin progressbar gGameExternalOptions.fSmallSizeProgressbar = iniReader.ReadBoolean("Graphics Settings", "SMALL_SIZE_PB", FALSE); + // anv: hide stuff on roof in explored rooms at ground level view (sandbags and other crap) + gGameExternalOptions.fHideExploredRoomRoofStructures = iniReader.ReadBoolean("Graphics Settings", "HIDE_EXPLORED_ROOM_ROOF_STRUCTURES", TRUE); + //################# Sound Settings ################# gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME", 0, 0, 1000 /*1000 = 10x?*/); diff --git a/GameSettings.h b/GameSettings.h index ea584e9c..159efbbf 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -736,6 +736,8 @@ typedef struct // for small progress bar BOOLEAN fSmallSizeProgressbar; + // anv: hide stuff on roof in explored rooms at ground level view (sandbags and other crap) + BOOLEAN fHideExploredRoomRoofStructures; //enable ext mouse key BOOLEAN bAltAimEnabled; BOOLEAN bAimedBurstEnabled; diff --git a/TileEngine/Render Fun.cpp b/TileEngine/Render Fun.cpp index 26dc5a37..7781c486 100644 --- a/TileEngine/Render Fun.cpp +++ b/TileEngine/Render Fun.cpp @@ -121,7 +121,12 @@ void SetGridNoRevealedFlag( INT32 sGridNo ) STRUCTURE *pStructure, *pBase; // Set hidden flag, for any roofs - SetRoofIndexFlagsFromTypeRange( sGridNo, FIRSTROOF, FOURTHROOF, LEVELNODE_HIDDEN ); + //SetRoofIndexFlagsFromTypeRange( sGridNo, FIRSTROOF, FOURTHROOF, LEVELNODE_HIDDEN ); + // anv: we possibly can put other things on roof + SetRoofIndexFlagsFromTypeRange( sGridNo, FIRSTTEXTURE, FIRSTSWITCHES, LEVELNODE_HIDDEN ); + // anv: hide stuff on roof in explored rooms at ground level view (sandbags and other crap) + if( gGameExternalOptions.fHideExploredRoomRoofStructures ) + SetOnRoofIndexFlagsFromTypeRange( sGridNo, FIRSTTEXTURE, FIRSTSWITCHES, LEVELNODE_HIDDEN ); // ATE: Do this only if we are in a room... if ( gusWorldRoomInfo[ sGridNo ] != NO_ROOM ) @@ -280,7 +285,13 @@ void RemoveRoomRoof( INT32 sGridNo, UINT16 usRoomNum, SOLDIERTYPE *pSoldier ) SetGridNoRevealedFlag( cnt );//dnl ch56 141009 - RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL ); + //RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL ); + // anv: we possibly can put other things on roof + RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTTEXTURE, FIRSTSWITCHES, LEVELNODE_REVEAL ); + // anv: hide stuff on roof in explored rooms at ground level view (sandbags and other crap) + if( gGameExternalOptions.fHideExploredRoomRoofStructures ) + RemoveOnRoofIndexFlagsFromTypeRange( cnt, FIRSTTEXTURE, FIRSTSWITCHES, LEVELNODE_REVEAL ); + //RemoveAllOnRoofsOfTypeRange( cnt, FIRSTTEXTURE, FIRSTSWITCHES ); // Reveal any items if here! if ( GetItemPoolFromGround( cnt, &pItemPool ) ) diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index d771563e..17dc3fab 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -1844,7 +1844,11 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( TileElem != NULL ) { // If we are a roof and have SHOW_ALL_ROOFS on, turn off hidden tile check! - if ( ( TileElem->uiFlags & ROOF_TILE ) && ( gTacticalStatus.uiFlags&SHOW_ALL_ROOFS ) ) + //if ( ( TileElem->uiFlags & ROOF_TILE ) && ( gTacticalStatus.uiFlags&SHOW_ALL_ROOFS ) ) + // anv: commented out TileElem->uiFlags & ROOF_TILE because: + // 1. only roof tiles get hidden in this manner anyway + // 2. we might want to his and reveal again other stuff (most importantly - on roof structures) + if ( ( gTacticalStatus.uiFlags&SHOW_ALL_ROOFS ) ) { // Turn off fHiddenTile = FALSE; diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 133464ea..371d64ef 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -2022,20 +2022,35 @@ BOOLEAN HideStructOfGivenType(INT32 iMapIndex, UINT32 fType, BOOLEAN fHide)//dnl { if(fHide) { + /* if(fType >= FIRSTONROOF && fType <= LASTONROOF) SetOnRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); else SetRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); + */ + + // Buggler: set all tiles to their proper roof index flags + if(fType >= FIRSTROOF && fType <= SECONDSLANTROOF) + SetRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); + else + SetOnRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); } else { - // ONLY UNHIDE IF NOT REAVEALED ALREADY + // ONLY UNHIDE IF NOT REVEALED ALREADY if(!(gpWorldLevelData[iMapIndex].uiFlags & MAPELEMENT_REVEALED)) { + /* if(fType >= FIRSTONROOF && fType <= LASTONROOF) RemoveOnRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); else RemoveRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); + */ + + if(fType >= FIRSTROOF && fType <= SECONDSLANTROOF) + RemoveRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); + else + RemoveOnRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN); } } return(TRUE);