Merged from revision: 7676

Features (by anv)
- new Ja2_Options.ini setting - HIDE_EXPLORED_ROOM_ROOF_STRUCTURES (e.g. sandbags) at ground level view
- Hold CTRL hotkey in mapeditor to place any object on roof

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7677 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-12-06 13:37:25 +00:00
parent bb264d6815
commit eaa153b310
7 changed files with 104 additions and 6 deletions
+11 -1
View File
@@ -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<WORLD_MAX; cnt++)
{
@@ -66,6 +67,15 @@ void UpdateRoofsView()//dnl ch80 011213
while(x--)
HideStructOfGivenType(cnt, usType[x], !fBuildingShowRoofs);
}
*/
// Buggler: hide all tiles on roof
x = FIRSTSWITCHES + 1;
for(cnt=0; cnt<WORLD_MAX; cnt++)
{
for(tiletypecnt=0; tiletypecnt<x; tiletypecnt++)
HideStructOfGivenType(cnt, tiletypecnt, !fBuildingShowRoofs);
}
gfRenderWorld = TRUE;
}
+54 -1
View File
@@ -34,6 +34,8 @@
#include "EditorItems.h"
#endif
#include "input.h"
BOOLEAN PasteHigherTextureFromRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius );
BOOLEAN PasteExistingTexture( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 ubRadius );
@@ -252,6 +254,23 @@ void PasteDebris( INT32 iMapIndex )
{
AddToUndoList( iMapIndex );
// anv: add anything on the roof, cause why not
if ( _KeyDown(17) )
{
// Add debris to the world
usUseIndex = pSelList[ iCurBank ].usIndex;
usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject;
// Add to onroof section!
AddOnRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) );
if ( gTileDatabase[ (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].sBuddyNum != -1 )
{
AddOnRoofToTail( iMapIndex, gTileDatabase[ (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].sBuddyNum );
}
return;
}
// Remove any debris that is currently at this map location
if ( gpWorldLevelData[ iMapIndex ].pObjectHead != NULL )
{
@@ -376,7 +395,7 @@ void PasteSingleWallCommon( INT32 iMapIndex )
usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject;
// TEMP STUFF FOR ONROOF THINGS!
if ( (usUseObjIndex >= 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( );
+3
View File
@@ -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?*/);
+2
View File
@@ -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;
+13 -2
View File
@@ -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 ) )
+5 -1
View File
@@ -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;
+16 -1
View File
@@ -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);