Brief: //dnl ch80

- Polishing and fixing mapeditor.
Details:
- Add scroll map editor items for mouse wheel.
- Fix selection of mapinfo light and smoothing buttons when switching between taskbars.
- UpdateRoofsView now will hide/show onroof tiles and back roof walls too.
- Fix fake light toggle which now will remain after switching to another taskbar also fix incorrect ambient light saving during toggling fake light with HOME key.
- Finish work on HandleMouseClicksInGameScreen function so most draw functions now are single clicked on same tile element instead rapid burst of events which in some situation create stacking tiles problem during save game.
- Fix incorrect value for exit grids if right click on map element without exit grid, also if changing same exit grid then will update same instead to define next available slot from exit grid array.
- Restricted scroll will now disable scrolling when enter in textbox at mapinfo taskbar for basement levels and for proper radar map creation.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6673 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-12-01 22:27:03 +00:00
parent 38be6a389b
commit b2dbc3123b
13 changed files with 371 additions and 394 deletions
+8
View File
@@ -797,6 +797,7 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason)
{ {
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{ {
#if 0//dnl ch80 011213
gfRenderTaskbar = TRUE; gfRenderTaskbar = TRUE;
if (_KeyDown( 17 ) ) // CTRL if (_KeyDown( 17 ) ) // CTRL
{ {
@@ -814,6 +815,9 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason)
DisableButton( iEditorButton[ITEMS_LEFTSCROLL] ); DisableButton( iEditorButton[ITEMS_LEFTSCROLL] );
if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 )
EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
#else
ScrollEditorItemsInfo(FALSE);
#endif
} }
} }
@@ -821,6 +825,7 @@ void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason)
{ {
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{ {
#if 0//dnl ch80 011213
gfRenderTaskbar = TRUE; gfRenderTaskbar = TRUE;
if (_KeyDown( 17 ) ) // CTRL if (_KeyDown( 17 ) ) // CTRL
{ {
@@ -837,6 +842,9 @@ void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason)
EnableButton( iEditorButton[ITEMS_LEFTSCROLL] ); EnableButton( iEditorButton[ITEMS_LEFTSCROLL] );
if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) )
DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
#else
ScrollEditorItemsInfo(TRUE);
#endif
} }
} }
+11 -8
View File
@@ -302,14 +302,17 @@ void HideExitGrids()
void SetEditorMapInfoTaskbarMode( UINT16 usNewMode ) void SetEditorMapInfoTaskbarMode( UINT16 usNewMode )
{ {
BOOLEAN fShowExitGrids = FALSE; BOOLEAN fShowExitGrids = FALSE;
UnclickEditorButton( MAPINFO_ADD_LIGHT1_SOURCE ); if( usNewMode < MAPINFO_RADIO_NORMAL || usNewMode > MAPINFO_RADIO_CAVES )//dnl ch80 011213
UnclickEditorButton( MAPINFO_DRAW_EXITGRIDS ); {
UnclickEditorButton( MAPINFO_NORTH_POINT ); UnclickEditorButton( MAPINFO_ADD_LIGHT1_SOURCE );
UnclickEditorButton( MAPINFO_WEST_POINT ); UnclickEditorButton( MAPINFO_DRAW_EXITGRIDS );
UnclickEditorButton( MAPINFO_CENTER_POINT ); UnclickEditorButton( MAPINFO_NORTH_POINT );
UnclickEditorButton( MAPINFO_EAST_POINT ); UnclickEditorButton( MAPINFO_WEST_POINT );
UnclickEditorButton( MAPINFO_SOUTH_POINT ); UnclickEditorButton( MAPINFO_CENTER_POINT );
UnclickEditorButton( MAPINFO_ISOLATED_POINT ); UnclickEditorButton( MAPINFO_EAST_POINT );
UnclickEditorButton( MAPINFO_SOUTH_POINT );
UnclickEditorButton( MAPINFO_ISOLATED_POINT );
}
ClickEditorButton( usNewMode ); ClickEditorButton( usNewMode );
switch( usNewMode ) switch( usNewMode )
{ {
+3
View File
@@ -402,6 +402,9 @@ void DoTaskbar(void)
iDrawMode = DRAW_MODE_LIGHT; iDrawMode = DRAW_MODE_LIGHT;
TerrainTileDrawMode = TERRAIN_TILES_BRETS_STRANGEMODE; TerrainTileDrawMode = TERRAIN_TILES_BRETS_STRANGEMODE;
SetupTextInputForMapInfo(); SetupTextInputForMapInfo();
//dnl ch80 011213
SetEditorSmoothingMode(gMapInformation.ubEditorSmoothingType);
ChangeLightDefault(gbDefaultLightType);
break; break;
case TASK_OPTIONS: case TASK_OPTIONS:
iDrawMode = DRAW_MODE_NOTHING;//dnl ch22 210909 iDrawMode = DRAW_MODE_NOTHING;//dnl ch22 210909
+7 -8
View File
@@ -50,16 +50,15 @@ void GameInitEditorBuildingInfo()
} }
//BEGINNING OF BUILDING UTILITY FUNCTIONS //BEGINNING OF BUILDING UTILITY FUNCTIONS
void UpdateRoofsView() void UpdateRoofsView()//dnl ch80 011213
{ {
INT32 x; INT32 x, cnt;
UINT16 usType; UINT16 usType[12] = {FIRSTROOF, SECONDROOF, THIRDROOF, FOURTHROOF, FIRSTSLANTROOF, SECONDSLANTROOF, FIRSTONROOF, SECONDONROOF, FIRSTWALL, SECONDWALL, THIRDWALL, FOURTHWALL};
for ( x = 0; x < WORLD_MAX; x++ ) for(cnt=0; cnt<WORLD_MAX; cnt++)
{ {
for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ ) x = 12;
{ while(x--)
HideStructOfGivenType( x, usType, (BOOLEAN)(!fBuildingShowRoofs) ); HideStructOfGivenType(cnt, usType[x], !fBuildingShowRoofs);
}
} }
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
} }
+39 -11
View File
@@ -1722,16 +1722,44 @@ void DisplayItemStatistics()
mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 450, pDisplayItemStatisticsTex[4]); mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 450, pDisplayItemStatisticsTex[4]);
} }
void ScrollEditorItemsInfo(BOOLEAN fForward)//dnl ch80 011213
{
if(fForward)
{
if(eInfo.sScrollIndex < max(0, (eInfo.sNumItems+1)/2-6))
{
if(_KeyDown(17))// CTRL
{
if(_KeyDown(16))// SHIFT
eInfo.sScrollIndex = max(0, (eInfo.sNumItems+1)/2-6);
else
eInfo.sScrollIndex = min(eInfo.sScrollIndex+60, (eInfo.sNumItems+1)/2-6);
}
else if(_KeyDown(16))
eInfo.sScrollIndex = min(eInfo.sScrollIndex+6, (eInfo.sNumItems+1)/2-6);
else
eInfo.sScrollIndex++;
}
}
else
{
if(eInfo.sScrollIndex)
{
if(_KeyDown(17))// CTRL
{
if(_KeyDown(16))// SHIFT
eInfo.sScrollIndex = 0;
else
eInfo.sScrollIndex = max(eInfo.sScrollIndex-60, 0);
}
else if(_KeyDown(16))
eInfo.sScrollIndex = max(eInfo.sScrollIndex-6, 0);
else
eInfo.sScrollIndex--;
}
}
DetermineItemsScrolling();
gfRenderTaskbar = TRUE;
}
#endif #endif
+1
View File
@@ -37,6 +37,7 @@ void RenderEditorItemsInfo();
void ClearEditorItemsInfo(); void ClearEditorItemsInfo();
void DisplayItemStatistics(); void DisplayItemStatistics();
void DetermineItemsScrolling(); void DetermineItemsScrolling();
void ScrollEditorItemsInfo(BOOLEAN fForward);//dnl ch80 011213
//User actions //User actions
void AddSelectedItemToWorld( INT32 sGridNo ); void AddSelectedItemToWorld( INT32 sGridNo );
+16 -13
View File
@@ -131,7 +131,7 @@ void SetupTextInputForMapInfo()
swprintf( str, L"%d", gsLightRadius ); swprintf( str, L"%d", gsLightRadius );
AddTextInputField( iScreenWidthOffset + 120, 2 * iScreenHeightOffset + 394, 25, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); AddTextInputField( iScreenWidthOffset + 120, 2 * iScreenHeightOffset + 394, 25, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gusLightLevel ); swprintf( str, L"%d", gfFakeLights ? gusSavedLightLevel : gusLightLevel );//dnl ch80 011213
AddTextInputField( iScreenWidthOffset + 120, 2 * iScreenHeightOffset + 414, 25, 18, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); AddTextInputField( iScreenWidthOffset + 120, 2 * iScreenHeightOffset + 414, 25, 18, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
//Scroll restriction ID //Scroll restriction ID
@@ -251,25 +251,28 @@ void ExtractAndUpdateMapInfo()
gfEditorForceShadeTableRebuild = FALSE; gfEditorForceShadeTableRebuild = FALSE;
} }
//extract radius //dnl ch80 011213 extract radius
temp = max( min( GetNumericStrictValueFromField( 4 ), 8 ), 1 ); temp = max(min(GetNumericStrictValueFromField(4), 8), 1);
if( temp != -1 ) if(temp != -1)
gsLightRadius = (INT16)temp; gsLightRadius = (INT16)temp;
temp = max( min( GetNumericStrictValueFromField( 5 ), 15 ), 1 ); temp = max(min(GetNumericStrictValueFromField(5), 15), 1);
if( temp != -1 && temp != gusLightLevel ) if(temp != -1 && temp != gusLightLevel)
{ {
gusLightLevel = (UINT16)temp; gusLightLevel = (UINT16)temp;
gfRenderWorld = TRUE; if(gfFakeLights)
ubAmbientLightLevel = (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel); gusLightLevel = EDITOR_LIGHT_FAKE;
LightSetBaseLevel( ubAmbientLightLevel ); LightSetBaseLevel((UINT8)(EDITOR_LIGHT_MAX - gusLightLevel));
LightSpriteRenderAll(); LightSpriteRenderAll();
gfRenderWorld = TRUE;
} }
temp = GetNumericStrictValueFromField(6);
temp = (INT8)GetNumericStrictValueFromField( 6 ); if(temp == -1)
if( temp == -1 )
gMapInformation.ubRestrictedScrollID = 0; gMapInformation.ubRestrictedScrollID = 0;
else else
gMapInformation.ubRestrictedScrollID = (UINT8)temp; {
gMapInformation.ubRestrictedScrollID = (temp ? 1 : 0);
InitRenderParams(gMapInformation.ubRestrictedScrollID);
}
//set up fields for exitgrid information //set up fields for exitgrid information
Get16BitStringFromField( 7, str, 10 ); Get16BitStringFromField( 7, str, 10 );
+233 -333
View File
@@ -1145,6 +1145,7 @@ void HandleJA2ToolbarSelection( void )
gusLightLevel = gusSavedLightLevel; gusLightLevel = gusSavedLightLevel;
LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) ); LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) );
LightSpriteRenderAll(); LightSpriteRenderAll();
gfRenderWorld = TRUE;//dnl ch80 011213
break; break;
case TBAR_MODE_CHANGE_TILESET: case TBAR_MODE_CHANGE_TILESET:
@@ -1448,6 +1449,7 @@ void HandleKeyboardShortcuts( )
} }
LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) ); LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) );
LightSpriteRenderAll(); LightSpriteRenderAll();
gfRenderWorld = TRUE;//dnl ch80 011213
break; break;
case SPACE: case SPACE:
@@ -1483,8 +1485,12 @@ void HandleKeyboardShortcuts( )
} }
else if( iCurrentTaskbar == TASK_MERCS && gsSelectedMercID != -1 ) else if( iCurrentTaskbar == TASK_MERCS && gsSelectedMercID != -1 )
ExtractCurrentMercModeInfo( FALSE ); ExtractCurrentMercModeInfo( FALSE );
else if( iCurrentTaskbar == TASK_MAPINFO ) else if(iCurrentTaskbar == TASK_MAPINFO)//dnl ch80 011213
{
gfFakeLights = FALSE;
UnclickEditorButton(MAPINFO_TOGGLE_FAKE_LIGHTS);
ExtractAndUpdateMapInfo(); ExtractAndUpdateMapInfo();
}
else if( iCurrentTaskbar == TASK_BUILDINGS ) else if( iCurrentTaskbar == TASK_BUILDINGS )
ExtractAndUpdateBuildingInfo(); ExtractAndUpdateBuildingInfo();
else if( gfShowItemStatsPanel && EditingText() ) else if( gfShowItemStatsPanel && EditingText() )
@@ -2060,6 +2066,7 @@ void HandleKeyboardShortcuts( )
// item left scroll // item left scroll
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
{ {
#if 0//dnl ch80 011213
if( eInfo.sScrollIndex ) if( eInfo.sScrollIndex )
{ {
if( EditorInputEvent.usKeyState & CTRL_DOWN ) if( EditorInputEvent.usKeyState & CTRL_DOWN )
@@ -2072,6 +2079,9 @@ void HandleKeyboardShortcuts( )
if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 )
EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
} }
#else
ScrollEditorItemsInfo(FALSE);
#endif
} }
else else
{ {
@@ -2080,12 +2090,13 @@ void HandleKeyboardShortcuts( )
if( !gusPreserveSelectionWidth ) if( !gusPreserveSelectionWidth )
gusPreserveSelectionWidth = 8; gusPreserveSelectionWidth = 8;
} }
gfRenderTaskbar = TRUE; //gfRenderTaskbar = TRUE;
break; break;
case '.': case '.':
// item right scroll // item right scroll
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
{ {
#if 0//dnl ch80 011213
if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) )
{ {
if( EditorInputEvent.usKeyState & CTRL_DOWN ) if( EditorInputEvent.usKeyState & CTRL_DOWN )
@@ -2097,6 +2108,9 @@ void HandleKeyboardShortcuts( )
if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) )
DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
} }
#else
ScrollEditorItemsInfo(TRUE);
#endif
} }
else else
{ {
@@ -2105,12 +2119,13 @@ void HandleKeyboardShortcuts( )
if( gusPreserveSelectionWidth > 8 ) if( gusPreserveSelectionWidth > 8 )
gusPreserveSelectionWidth = 1; gusPreserveSelectionWidth = 1;
} }
gfRenderTaskbar = TRUE; //gfRenderTaskbar = TRUE;
break; break;
case '<': case '<':
// item left scroll by page // item left scroll by page
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
{ {
#if 0//dnl ch80 011213
if( eInfo.sScrollIndex ) if( eInfo.sScrollIndex )
{ {
if( EditorInputEvent.usKeyState & CTRL_DOWN ) if( EditorInputEvent.usKeyState & CTRL_DOWN )
@@ -2123,13 +2138,17 @@ void HandleKeyboardShortcuts( )
if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 )
EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
} }
#else
ScrollEditorItemsInfo(FALSE);
#endif
} }
gfRenderTaskbar = TRUE; //gfRenderTaskbar = TRUE;
break; break;
case '>': case '>':
// item right scroll by page // item right scroll by page
if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE )
{ {
#if 0//dnl ch80 011213
if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) )
{ {
if( EditorInputEvent.usKeyState & CTRL_DOWN ) if( EditorInputEvent.usKeyState & CTRL_DOWN )
@@ -2141,8 +2160,11 @@ void HandleKeyboardShortcuts( )
if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) )
DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] );
} }
#else
ScrollEditorItemsInfo(TRUE);
#endif
} }
gfRenderTaskbar = TRUE; //gfRenderTaskbar = TRUE;
break; break;
case '/': case '/':
// Buggler: create item with keyboard input // Buggler: create item with keyboard input
@@ -3789,239 +3811,94 @@ void HandleMouseClicksInGameScreen()
} }
#else #else
void HandleMouseClicksInGameScreen() void HandleMouseClicksInGameScreen()//dnl ch80 011213
{ {
static UINT32 iLastMapIndexLB(-1), iLastMapIndexRB(-1), iLastMapIndexMB(-1); static UINT32 iLastMapIndexLB(-1), iLastMapIndexRB(-1), iLastMapIndexMB(-1);
INT16 sX, sY; INT16 sX, sY;
BOOLEAN fPrevState; BOOLEAN fPrevState;
if( !GetMouseXY( &sGridX, &sGridY ) ) if(!GetMouseXY(&sGridX, &sGridY))
return; return;
if( iCurrentTaskbar == TASK_OPTIONS || iCurrentTaskbar == TASK_NONE ) if(iCurrentTaskbar == TASK_OPTIONS || iCurrentTaskbar == TASK_NONE)// if in taskbar modes which don't process clicks in the world
{ //if in taskbar modes which don't process clicks in the world.
return; return;
} if(!(gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA))// if mouse cursor not in the game screen
if( !(gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) )
{ //if mouse cursor not in the game screen.
return; return;
} iMapIndex = MAPROWCOLTOPOS(sGridY, sGridX);
iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX );
fPrevState = gfRenderWorld; fPrevState = gfRenderWorld;
if(_LeftButtonDown) if(_LeftButtonDown)
{ {
if(iLastMapIndexLB != iMapIndex && iLastMapIndexLB == -1) if(iLastMapIndexLB != iMapIndex && iLastMapIndexLB == -1)
iLastMapIndexLB = iMapIndex; iLastMapIndexLB = iMapIndex;
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
// Are we trying to erase something? if(iDrawMode >= DRAW_MODE_ERASE)// Are we trying to erase something?
if ( iDrawMode >= DRAW_MODE_ERASE )
{ {
// Erasing can have a brush size larger than 1 tile for(sY=(INT16)gSelectRegion.iTop; sY<=(INT16)gSelectRegion.iBottom; sY++)// Erasing can have a brush size larger than 1 tile
for ( sY = (INT16)gSelectRegion.iTop; sY <= (INT16)gSelectRegion.iBottom; sY++ )
{ {
for ( sX = (INT16)gSelectRegion.iLeft; sX <= (INT16)gSelectRegion.iRight; sX++ ) for(sX=(INT16)gSelectRegion.iLeft; sX<=(INT16)gSelectRegion.iRight; sX++)
{ {
if ( iDrawMode == (DRAW_MODE_LIGHT + DRAW_MODE_ERASE) ) if(iDrawMode == (DRAW_MODE_LIGHT + DRAW_MODE_ERASE))
{ RemoveLight(sX, sY);
RemoveLight( sX, sY );
}
else else
EraseMapTile( MAPROWCOLTOPOS( sY, sX ) ); EraseMapTile(MAPROWCOLTOPOS(sY, sX));
} }
} }
if(iDrawMode == DRAW_MODE_LIGHT + DRAW_MODE_ERASE)
if( iDrawMode == DRAW_MODE_LIGHT + DRAW_MODE_ERASE ) LightSpriteRenderAll();// To adjust building's lighting
LightSpriteRenderAll(); // To adjust building's lighting
return; return;
} }
switch(iDrawMode)
switch ( iDrawMode )
{ {
case DRAW_MODE_SCHEDULEACTION: case DRAW_MODE_FLOORS:
if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) ) case DRAW_MODE_GROUND:
{ case DRAW_MODE_OSTRUCTS:
iDrawMode = DRAW_MODE_SCHEDULECONFIRM; case DRAW_MODE_OSTRUCTS1:
gfFirstPlacement = FALSE; case DRAW_MODE_OSTRUCTS2:
} case DRAW_MODE_DEBRIS:
break; if(fDontUseClick && gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION)
case DRAW_MODE_NORTHPOINT: DrawObjectsBasedOnSelectionRegion();
case DRAW_MODE_WESTPOINT: else
case DRAW_MODE_EASTPOINT:
case DRAW_MODE_SOUTHPOINT:
case DRAW_MODE_CENTERPOINT:
case DRAW_MODE_ISOLATEDPOINT:
if(fDontUseClick)
SpecifyEntryPoint(iMapIndex);
break;
case DRAW_MODE_ENEMY:
case DRAW_MODE_CREATURE:
case DRAW_MODE_REBEL:
case DRAW_MODE_CIVILIAN:
// Handle adding mercs to the world
if( gfFirstPlacement )
{
AddMercToWorld( iMapIndex );
gfFirstPlacement = FALSE;
}
break;
case DRAW_MODE_LIGHT:
// Add a normal light to the world
if( gfFirstPlacement )
{
PlaceLight( gsLightRadius, sGridX, sGridY, 0 );
gfFirstPlacement = FALSE;
}
break;
case DRAW_MODE_SAW_ROOM:
case DRAW_MODE_ROOM:
case DRAW_MODE_CAVES:
if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION )
ProcessAreaSelection( TRUE );
break;
case DRAW_MODE_NEWROOF:
ReplaceBuildingWithNewRoof( iMapIndex );
break;
case DRAW_MODE_WALLS: PasteSingleWall( iMapIndex ); break;
case DRAW_MODE_DOORS: PasteSingleDoor( iMapIndex ); break;
case DRAW_MODE_WINDOWS: PasteSingleWindow( iMapIndex ); break;
case DRAW_MODE_ROOFS: PasteSingleRoof( iMapIndex ); break;
case DRAW_MODE_BROKEN_WALLS: PasteSingleBrokenWall( iMapIndex ); break;
case DRAW_MODE_DECOR: PasteSingleDecoration( iMapIndex ); break;
case DRAW_MODE_DECALS:
if( ValidDecalPlacement( iMapIndex ) )
PasteSingleDecal( iMapIndex );
break;
case DRAW_MODE_TOILET: PasteSingleToilet( iMapIndex ); break;
case DRAW_MODE_SMART_WALLS: PasteSmartWall( iMapIndex ); break;
case DRAW_MODE_SMART_DOORS: PasteSmartDoor( iMapIndex ); break;
case DRAW_MODE_SMART_WINDOWS: PasteSmartWindow( iMapIndex ); break;
case DRAW_MODE_SMART_BROKEN_WALLS: PasteSmartBrokenWall( iMapIndex ); break;
case DRAW_MODE_EXITGRID:
case DRAW_MODE_FLOORS:
case DRAW_MODE_GROUND:
case DRAW_MODE_OSTRUCTS:
case DRAW_MODE_OSTRUCTS1:
case DRAW_MODE_OSTRUCTS2:
case DRAW_MODE_DEBRIS:
if( fDontUseClick && gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION )
{
DrawObjectsBasedOnSelectionRegion();
}
else
gfRenderWorld = fPrevState;
break;
case DRAW_MODE_DOORKEYS:
InitDoorEditing( iMapIndex );
break;
case DRAW_MODE_KILL_BUILDING:
KillBuilding( iMapIndex );
break;
case DRAW_MODE_COPY_BUILDING:
case DRAW_MODE_MOVE_BUILDING:
if( gfFirstPlacement )
{
CopyBuilding( iMapIndex );
gfFirstPlacement = FALSE;
}
gfRenderWorld = fPrevState; gfRenderWorld = fPrevState;
break; break;
case DRAW_MODE_BANKS: case DRAW_MODE_COPY_BUILDING:
if(fDontUseClick) case DRAW_MODE_MOVE_BUILDING:
PasteBanks(iMapIndex, gsBanksSubIndex, TRUE); if(gfFirstPlacement)
break; {
case DRAW_MODE_ROADS: CopyBuilding(iMapIndex);
if(fDontUseClick) gfFirstPlacement = FALSE;
PasteRoads(iMapIndex); }
break; gfRenderWorld = fPrevState;
case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): break;
TerrainFill( iMapIndex ); default:
//BeginFill( iMapIndex ); gfRenderWorld = fPrevState;
break; break;
case DRAW_MODE_PLACE_ITEM:
if(fDontUseClick && gfFirstPlacement)
{
AddSelectedItemToWorld(iMapIndex);//dnl ch43 280909
gfFirstPlacement = FALSE;
}
break;
default:
gfRenderWorld = fPrevState;
break;
} }
} }
else if(_RightButtonDown) else if(_RightButtonDown)
{ {
if(iLastMapIndexRB != iMapIndex && iLastMapIndexRB == -1) if(iLastMapIndexRB != iMapIndex && iLastMapIndexRB == -1)
iLastMapIndexRB = iMapIndex; iLastMapIndexRB = iMapIndex;
#if 0
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
switch( iDrawMode ) switch(iDrawMode)
{ {
// Handle right clicking on a merc (for editing/moving him) default:
case DRAW_MODE_ENEMY: gfRenderWorld = fPrevState;
case DRAW_MODE_CREATURE: break;
case DRAW_MODE_REBEL:
case DRAW_MODE_CIVILIAN:
HandleRightClickOnMerc( iMapIndex );
break;
case DRAW_MODE_PLACE_ITEM:
if(fDontUseClick)
HandleRightClickOnItem(iMapIndex);//dnl ch43 280909
break;
// Handle the right clicks in the main window to bring up the appropriate selection window
case DRAW_MODE_WALLS: iEditorToolbarState = TBAR_MODE_GET_WALL; break;
case DRAW_MODE_DOORS: iEditorToolbarState = TBAR_MODE_GET_DOOR; break;
case DRAW_MODE_WINDOWS: iEditorToolbarState = TBAR_MODE_GET_WINDOW; break;
case DRAW_MODE_ROOFS: iEditorToolbarState = TBAR_MODE_GET_ROOF; break;
case DRAW_MODE_BROKEN_WALLS: iEditorToolbarState = TBAR_MODE_GET_BROKEN_WALL; break;
case DRAW_MODE_DECOR: iEditorToolbarState = TBAR_MODE_GET_DECOR; break;
case DRAW_MODE_DECALS: iEditorToolbarState = TBAR_MODE_GET_DECAL; break;
case DRAW_MODE_FLOORS: iEditorToolbarState = TBAR_MODE_GET_FLOOR; break;
case DRAW_MODE_TOILET: iEditorToolbarState = TBAR_MODE_GET_TOILET; break;
case DRAW_MODE_ROOM: iEditorToolbarState = TBAR_MODE_GET_ROOM; break;
case DRAW_MODE_NEWROOF: iEditorToolbarState = TBAR_MODE_GET_NEW_ROOF; break;
case DRAW_MODE_SLANTED_ROOF: iEditorToolbarState = TBAR_MODE_GET_ROOM; break;
case DRAW_MODE_DEBRIS: iEditorToolbarState = TBAR_MODE_GET_DEBRIS; break;
case DRAW_MODE_OSTRUCTS: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS; break;
case DRAW_MODE_OSTRUCTS1: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS1; break;
case DRAW_MODE_OSTRUCTS2: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS2; break;
case DRAW_MODE_BANKS: iEditorToolbarState = TBAR_MODE_GET_BANKS; break;
case DRAW_MODE_ROADS: iEditorToolbarState = TBAR_MODE_GET_ROADS; break;
case DRAW_MODE_CAVES:
if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION )
ProcessAreaSelection( FALSE );
break;
case DRAW_MODE_SMART_WALLS:
EraseWalls( iMapIndex );
break;
case DRAW_MODE_SMART_BROKEN_WALLS:
case DRAW_MODE_SMART_WINDOWS:
case DRAW_MODE_SMART_DOORS:
RestoreWalls( iMapIndex );
break;
case DRAW_MODE_EXITGRID:
if(GetExitGrid(iMapIndex, &gExitGrid))//dnl ch43 280909
ApplyNewExitGridValuesToTextFields();
break;
default:
gfRenderWorld = fPrevState;
break;
} }
#endif
} }
else if(_MiddleButtonDown) else if(_MiddleButtonDown)
{ {
if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1) if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1)
iLastMapIndexMB = iMapIndex; iLastMapIndexMB = iMapIndex;
#if 0
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
switch(iDrawMode)
{
default:
gfRenderWorld = fPrevState;
break;
}
#endif
} }
else if(!_LeftButtonDown) else if(!_LeftButtonDown)
{ {
@@ -4030,13 +3907,10 @@ void HandleMouseClicksInGameScreen()
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
switch(iDrawMode) switch(iDrawMode)
{ {
// case DRAW_MODE_SCHEDULEACTION: case DRAW_MODE_SCHEDULEACTION:
// if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) ) if(IsLocationSittableExcludingPeople(iMapIndex, FALSE))
// { RegisterCurrentScheduleAction(iMapIndex);
// iDrawMode = DRAW_MODE_SCHEDULECONFIRM; break;
// gfFirstPlacement = FALSE;
// }
// break;
case DRAW_MODE_NORTHPOINT: case DRAW_MODE_NORTHPOINT:
case DRAW_MODE_WESTPOINT: case DRAW_MODE_WESTPOINT:
case DRAW_MODE_EASTPOINT: case DRAW_MODE_EASTPOINT:
@@ -4045,60 +3919,61 @@ void HandleMouseClicksInGameScreen()
case DRAW_MODE_ISOLATEDPOINT: case DRAW_MODE_ISOLATEDPOINT:
SpecifyEntryPoint(iMapIndex); SpecifyEntryPoint(iMapIndex);
break; break;
// case DRAW_MODE_ENEMY: case DRAW_MODE_ENEMY:
// case DRAW_MODE_CREATURE: case DRAW_MODE_CREATURE:
// case DRAW_MODE_REBEL: case DRAW_MODE_REBEL:
// case DRAW_MODE_CIVILIAN: case DRAW_MODE_CIVILIAN:
// // Handle adding mercs to the world AddMercToWorld(iMapIndex);// Handle adding mercs to the world
// if( gfFirstPlacement ) break;
// { case DRAW_MODE_LIGHT:
// AddMercToWorld( iMapIndex ); PlaceLight(gsLightRadius, sGridX, sGridY, 0);// Add a normal light to the world
// gfFirstPlacement = FALSE; break;
// } case DRAW_MODE_SAW_ROOM:
// break; case DRAW_MODE_ROOM:
// case DRAW_MODE_LIGHT: case DRAW_MODE_CAVES:
// // Add a normal light to the world if(gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION)
// if( gfFirstPlacement ) ProcessAreaSelection(TRUE);
// { break;
// PlaceLight( gsLightRadius, sGridX, sGridY, 0 ); case DRAW_MODE_NEWROOF:
// gfFirstPlacement = FALSE; ReplaceBuildingWithNewRoof(iMapIndex);
// } break;
// break; case DRAW_MODE_WALLS:
// PasteSingleWall(iMapIndex);
// case DRAW_MODE_SAW_ROOM: break;
// case DRAW_MODE_ROOM: case DRAW_MODE_DOORS:
// case DRAW_MODE_CAVES: PasteSingleDoor(iMapIndex);
// if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION ) break;
// ProcessAreaSelection( TRUE ); case DRAW_MODE_WINDOWS:
// break; PasteSingleWindow(iMapIndex);
// case DRAW_MODE_NEWROOF: break;
// ReplaceBuildingWithNewRoof( iMapIndex ); case DRAW_MODE_ROOFS:
// break; PasteSingleRoof(iMapIndex);
// case DRAW_MODE_WALLS: PasteSingleWall( iMapIndex ); break; break;
// case DRAW_MODE_DOORS: PasteSingleDoor( iMapIndex ); break; case DRAW_MODE_BROKEN_WALLS:
// case DRAW_MODE_WINDOWS: PasteSingleWindow( iMapIndex ); break; PasteSingleBrokenWall(iMapIndex);
// case DRAW_MODE_ROOFS: PasteSingleRoof( iMapIndex ); break; break;
// case DRAW_MODE_BROKEN_WALLS: PasteSingleBrokenWall( iMapIndex ); break; case DRAW_MODE_DECOR:
// case DRAW_MODE_DECOR: PasteSingleDecoration( iMapIndex ); break; PasteSingleDecoration(iMapIndex);
// case DRAW_MODE_DECALS: break;
// if( ValidDecalPlacement( iMapIndex ) ) case DRAW_MODE_DECALS:
// PasteSingleDecal( iMapIndex ); if(ValidDecalPlacement(iMapIndex))
// break; PasteSingleDecal(iMapIndex);
/// case DRAW_MODE_TOILET: break;
/// PasteSingleToilet(iMapIndex); case DRAW_MODE_TOILET:
/// break; PasteSingleToilet(iMapIndex);
/// case DRAW_MODE_SMART_WALLS: break;
/// PasteSmartWall(iMapIndex); case DRAW_MODE_SMART_WALLS:
/// break; PasteSmartWall(iMapIndex);
/// case DRAW_MODE_SMART_DOORS: break;
/// PasteSmartDoor(iMapIndex); case DRAW_MODE_SMART_DOORS:
/// break; PasteSmartDoor(iMapIndex);
/// case DRAW_MODE_SMART_WINDOWS: break;
/// PasteSmartWindow(iMapIndex); case DRAW_MODE_SMART_WINDOWS:
/// break; PasteSmartWindow(iMapIndex);
/// case DRAW_MODE_SMART_BROKEN_WALLS: break;
/// PasteSmartBrokenWall(iMapIndex); case DRAW_MODE_SMART_BROKEN_WALLS:
/// break; PasteSmartBrokenWall(iMapIndex);
break;
case DRAW_MODE_EXITGRID: case DRAW_MODE_EXITGRID:
case DRAW_MODE_FLOORS: case DRAW_MODE_FLOORS:
case DRAW_MODE_GROUND: case DRAW_MODE_GROUND:
@@ -4111,37 +3986,23 @@ void HandleMouseClicksInGameScreen()
else else
gfRenderWorld = fPrevState; gfRenderWorld = fPrevState;
break; break;
// case DRAW_MODE_DOORKEYS: case DRAW_MODE_DOORKEYS:
// InitDoorEditing( iMapIndex ); InitDoorEditing(iMapIndex);
// break; break;
// case DRAW_MODE_KILL_BUILDING: case DRAW_MODE_KILL_BUILDING:
// KillBuilding( iMapIndex ); KillBuilding(iMapIndex);
// break; break;
// case DRAW_MODE_COPY_BUILDING:
// case DRAW_MODE_MOVE_BUILDING:
// if( gfFirstPlacement )
// {
// CopyBuilding( iMapIndex );
// gfFirstPlacement = FALSE;
// }
// gfRenderWorld = fPrevState;
// break;
case DRAW_MODE_BANKS: case DRAW_MODE_BANKS:
PasteBanks(iMapIndex, gsBanksSubIndex, TRUE); PasteBanks(iMapIndex, gsBanksSubIndex, TRUE);
break; break;
case DRAW_MODE_ROADS: case DRAW_MODE_ROADS:
PasteRoads(iMapIndex); PasteRoads(iMapIndex);
break; break;
// case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA):
// TerrainFill( iMapIndex ); TerrainFill(iMapIndex);
// //BeginFill( iMapIndex ); break;
// break;
case DRAW_MODE_PLACE_ITEM: case DRAW_MODE_PLACE_ITEM:
if(gfFirstPlacement) AddSelectedItemToWorld(iMapIndex);
{
AddSelectedItemToWorld(iMapIndex);//dnl ch43 280909
gfFirstPlacement = FALSE;
}
break; break;
case DRAW_MODE_HIGH_GROUND: case DRAW_MODE_HIGH_GROUND:
if(gpWorldLevelData[iMapIndex].sHeight) if(gpWorldLevelData[iMapIndex].sHeight)
@@ -4162,21 +4023,15 @@ void HandleMouseClicksInGameScreen()
break; break;
} }
} }
if(!gfFirstPlacement)//dnl??? need additional testing here detected some stacking problem when copy building on building and try undo if(!gfFirstPlacement)
{ {
switch( iDrawMode ) switch(iDrawMode)
{ {
case DRAW_MODE_SCHEDULECONFIRM:
if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) )
{
RegisterCurrentScheduleAction( iMapIndex );
}
break;
case DRAW_MODE_COPY_BUILDING: case DRAW_MODE_COPY_BUILDING:
PasteBuilding( iMapIndex ); PasteBuilding(iMapIndex);
break; break;
case DRAW_MODE_MOVE_BUILDING: case DRAW_MODE_MOVE_BUILDING:
MoveBuilding( iMapIndex ); MoveBuilding(iMapIndex);
break; break;
} }
} }
@@ -4187,66 +4042,92 @@ void HandleMouseClicksInGameScreen()
if(iMapIndex == iLastMapIndexRB)// RightClick performed on same tile if(iMapIndex == iLastMapIndexRB)// RightClick performed on same tile
{ {
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
switch(iDrawMode)
switch( iDrawMode ) {
{
/*
// Handle right clicking on a merc (for editing/moving him)
case DRAW_MODE_ENEMY: case DRAW_MODE_ENEMY:
case DRAW_MODE_CREATURE: case DRAW_MODE_CREATURE:
case DRAW_MODE_REBEL: case DRAW_MODE_REBEL:
case DRAW_MODE_CIVILIAN: case DRAW_MODE_CIVILIAN:
HandleRightClickOnMerc( iMapIndex ); HandleRightClickOnMerc(iMapIndex);// Handle right clicking on a merc (for editing/moving him)
break; break;
*/
case DRAW_MODE_PLACE_ITEM: case DRAW_MODE_PLACE_ITEM:
HandleRightClickOnItem(iMapIndex);//dnl ch43 280909 HandleRightClickOnItem(iMapIndex);//dnl ch43 280909
break; break;
/*
// Handle the right clicks in the main window to bring up the appropriate selection window // Handle the right clicks in the main window to bring up the appropriate selection window
case DRAW_MODE_WALLS: iEditorToolbarState = TBAR_MODE_GET_WALL; break; case DRAW_MODE_WALLS:
case DRAW_MODE_DOORS: iEditorToolbarState = TBAR_MODE_GET_DOOR; break; iEditorToolbarState = TBAR_MODE_GET_WALL;
case DRAW_MODE_WINDOWS: iEditorToolbarState = TBAR_MODE_GET_WINDOW; break; break;
case DRAW_MODE_ROOFS: iEditorToolbarState = TBAR_MODE_GET_ROOF; break; case DRAW_MODE_DOORS:
case DRAW_MODE_BROKEN_WALLS: iEditorToolbarState = TBAR_MODE_GET_BROKEN_WALL; break; iEditorToolbarState = TBAR_MODE_GET_DOOR;
case DRAW_MODE_DECOR: iEditorToolbarState = TBAR_MODE_GET_DECOR; break; break;
case DRAW_MODE_DECALS: iEditorToolbarState = TBAR_MODE_GET_DECAL; break; case DRAW_MODE_WINDOWS:
case DRAW_MODE_FLOORS: iEditorToolbarState = TBAR_MODE_GET_FLOOR; break; iEditorToolbarState = TBAR_MODE_GET_WINDOW;
case DRAW_MODE_TOILET: iEditorToolbarState = TBAR_MODE_GET_TOILET; break; break;
case DRAW_MODE_ROOFS:
case DRAW_MODE_ROOM: iEditorToolbarState = TBAR_MODE_GET_ROOM; break; iEditorToolbarState = TBAR_MODE_GET_ROOF;
case DRAW_MODE_NEWROOF: iEditorToolbarState = TBAR_MODE_GET_NEW_ROOF; break; break;
case DRAW_MODE_SLANTED_ROOF: iEditorToolbarState = TBAR_MODE_GET_ROOM; break; case DRAW_MODE_BROKEN_WALLS:
case DRAW_MODE_DEBRIS: iEditorToolbarState = TBAR_MODE_GET_DEBRIS; break; iEditorToolbarState = TBAR_MODE_GET_BROKEN_WALL;
case DRAW_MODE_OSTRUCTS: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS; break; break;
case DRAW_MODE_OSTRUCTS1: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS1; break; case DRAW_MODE_DECOR:
case DRAW_MODE_OSTRUCTS2: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS2; break; iEditorToolbarState = TBAR_MODE_GET_DECOR;
case DRAW_MODE_BANKS: iEditorToolbarState = TBAR_MODE_GET_BANKS; break; break;
case DRAW_MODE_ROADS: iEditorToolbarState = TBAR_MODE_GET_ROADS; break; case DRAW_MODE_DECALS:
iEditorToolbarState = TBAR_MODE_GET_DECAL;
break;
case DRAW_MODE_FLOORS:
iEditorToolbarState = TBAR_MODE_GET_FLOOR;
break;
case DRAW_MODE_TOILET:
iEditorToolbarState = TBAR_MODE_GET_TOILET;
break;
case DRAW_MODE_ROOM:
iEditorToolbarState = TBAR_MODE_GET_ROOM;
break;
case DRAW_MODE_NEWROOF:
iEditorToolbarState = TBAR_MODE_GET_NEW_ROOF;
break;
case DRAW_MODE_SLANTED_ROOF:
iEditorToolbarState = TBAR_MODE_GET_ROOM;
break;
case DRAW_MODE_DEBRIS:
iEditorToolbarState = TBAR_MODE_GET_DEBRIS;
break;
case DRAW_MODE_OSTRUCTS:
iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS;
break;
case DRAW_MODE_OSTRUCTS1:
iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS1;
break;
case DRAW_MODE_OSTRUCTS2:
iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS2;
break;
case DRAW_MODE_BANKS:
iEditorToolbarState = TBAR_MODE_GET_BANKS;
break;
case DRAW_MODE_ROADS:
iEditorToolbarState = TBAR_MODE_GET_ROADS;
break;
case DRAW_MODE_CAVES: case DRAW_MODE_CAVES:
if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION ) if(gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION)
ProcessAreaSelection( FALSE ); ProcessAreaSelection(FALSE);
break; break;
case DRAW_MODE_SMART_WALLS: case DRAW_MODE_SMART_WALLS:
EraseWalls( iMapIndex ); EraseWalls(iMapIndex);
break; break;
case DRAW_MODE_SMART_BROKEN_WALLS: case DRAW_MODE_SMART_BROKEN_WALLS:
case DRAW_MODE_SMART_WINDOWS: case DRAW_MODE_SMART_WINDOWS:
case DRAW_MODE_SMART_DOORS: case DRAW_MODE_SMART_DOORS:
RestoreWalls( iMapIndex ); RestoreWalls(iMapIndex);
break; break;
case DRAW_MODE_EXITGRID: case DRAW_MODE_EXITGRID:
if(GetExitGrid(iMapIndex, &gExitGrid))//dnl ch43 280909 if(GetExitGrid(iMapIndex, &gExitGrid))//dnl ch43 280909
ApplyNewExitGridValuesToTextFields(); ApplyNewExitGridValuesToTextFields();
break; break;
*/
default: default:
gfRenderWorld = fPrevState; gfRenderWorld = fPrevState;
break; break;
} }
} }
iLastMapIndexRB = -1; iLastMapIndexRB = -1;
} }
@@ -4254,17 +4135,36 @@ void HandleMouseClicksInGameScreen()
{ {
if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile
{ {
#if 0
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
switch(iDrawMode)
{
default:
gfRenderWorld = fPrevState;
break;
}
#endif
} }
iLastMapIndexMB = -1; iLastMapIndexMB = -1;
} }
} }
#endif #endif
void HandleMouseWheel(void)//dnl ch4 210909 void HandleMouseWheel(void)//dnl ch4 210909 //dnl ch80 011213
{ {
if(_WheelValue) if(_WheelValue && !gfSummaryWindowActive)
{ {
if(!GetMouseXY(&sGridX, &sGridY) && (iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE))
{
if(_WheelValue > 0)
while(_WheelValue--)
ScrollEditorItemsInfo(FALSE);
else
while(_WheelValue++)
ScrollEditorItemsInfo(TRUE);
_WheelValue = 0;
return;
}
switch(iDrawMode) switch(iDrawMode)
{ {
case DRAW_MODE_SMART_WALLS: case DRAW_MODE_SMART_WALLS:
+1
View File
@@ -84,6 +84,7 @@ void ShowHighGround(INT32 iShowHighGroundCommand);//dnl ch2 210909
extern BOOLEAN fEditorCreateItemFromKeyboard; extern BOOLEAN fEditorCreateItemFromKeyboard;
extern UINT16 usEditorTempItem; extern UINT16 usEditorTempItem;
extern UINT16 gusSavedLightLevel;//dnl ch80 011213
#endif #endif
#endif #endif
+1 -11
View File
@@ -74,10 +74,6 @@ BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid )
} }
pShadow = pShadow->pNext; pShadow = pShadow->pNext;
} }
pExitGrid->ubGotoSectorX = 0;
pExitGrid->ubGotoSectorY = 0;
pExitGrid->ubGotoSectorZ = 0;
pExitGrid->usGridNo = 0;
return FALSE; return FALSE;
} }
@@ -126,13 +122,7 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid )
tail = pShadow; tail = pShadow;
if( pShadow->uiFlags & LEVELNODE_EXITGRID ) if( pShadow->uiFlags & LEVELNODE_EXITGRID )
{ //we have found an existing exitgrid in this node, so replace it with the new information. { //we have found an existing exitgrid in this node, so replace it with the new information.
//<SB> memcpy(pShadow->pExitGridInfo, pExitGrid, sizeof(EXITGRID));//dnl ch80 011213
// pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid );
memcpy(gpExitGrids + guiExitGridsCount, pExitGrid, sizeof(EXITGRID));
pShadow->pExitGridInfo = gpExitGrids + guiExitGridsCount;
guiExitGridsCount++;
//</SB>
//SmoothExitGridRadius( (INT16)iMapIndex, 0 );
return; return;
} }
pShadow = pShadow->pNext; pShadow = pShadow->pNext;
+1
View File
@@ -3474,6 +3474,7 @@ extern INT32 giNumberOfTileTypes; //Madd: for variable number of PItems
#define LASTPOINTERS (SELRING - 1) #define LASTPOINTERS (SELRING - 1)
#define LASTUIELEM (WIREFRAMES - 1) // Change this entry if adding new types to the end #define LASTUIELEM (WIREFRAMES - 1) // Change this entry if adding new types to the end
#define LASTTIELSETELEM (GUNS - 1) #define LASTTIELSETELEM (GUNS - 1)
#define LASTONROOF (MOCKFLOOR - 1)//dnl ch80 011213
//=========================================================================== //===========================================================================
+47 -9
View File
@@ -1779,25 +1779,29 @@ void SetStructIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT3
} }
BOOLEAN HideStructOfGivenType( INT32 iMapIndex, UINT32 fType, BOOLEAN fHide ) BOOLEAN HideStructOfGivenType(INT32 iMapIndex, UINT32 fType, BOOLEAN fHide)//dnl ch80 011213
{ {
if ( fHide ) if(fHide)
{ {
SetRoofIndexFlagsFromTypeRange( iMapIndex, fType, fType, LEVELNODE_HIDDEN ); if(fType >= FIRSTONROOF && fType <= LASTONROOF)
SetOnRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN);
else
SetRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN);
} }
else else
{ {
// ONLY UNHIDE IF NOT REAVEALED ALREADY // ONLY UNHIDE IF NOT REAVEALED ALREADY
if ( !(gpWorldLevelData[ iMapIndex ].uiFlags & MAPELEMENT_REVEALED ) ) if(!(gpWorldLevelData[iMapIndex].uiFlags & MAPELEMENT_REVEALED))
{ {
RemoveRoofIndexFlagsFromTypeRange( iMapIndex, fType, fType, LEVELNODE_HIDDEN ); if(fType >= FIRSTONROOF && fType <= LASTONROOF)
RemoveOnRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN);
else
RemoveRoofIndexFlagsFromTypeRange(iMapIndex, fType, fType, LEVELNODE_HIDDEN);
} }
} }
return( TRUE ); return(TRUE);
} }
void RemoveStructIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) void RemoveStructIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags )
{ {
LEVELNODE *pStruct = NULL; LEVELNODE *pStruct = NULL;
@@ -1938,7 +1942,10 @@ BOOLEAN RemoveShadow( INT32 iMapIndex, UINT16 usIndex )
{ {
pOldShadow->pNext = pShadow->pNext; pOldShadow->pNext = pShadow->pNext;
} }
#ifdef JA2EDITOR//dnl ch80 011213
if(pShadow->uiFlags & LEVELNODE_EXITGRID && pShadow->pExitGridInfo)
memset(pShadow->pExitGridInfo, 0, sizeof(EXITGRID));
#endif
// Delete memory assosiated with item // Delete memory assosiated with item
MemFree( pShadow ); MemFree( pShadow );
guiLevelNodes--; guiLevelNodes--;
@@ -3018,6 +3025,37 @@ BOOLEAN RemoveAllOnRoofsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32
return fRetVal; return fRetVal;
} }
void RemoveOnRoofIndexFlagsFromTypeRange(INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags)//dnl ch80 011213
{
LEVELNODE *pOnRoof, *pOldOnRoof;
UINT32 fTileType;
pOnRoof = gpWorldLevelData[iMapIndex].pOnRoofHead;
while(pOnRoof && pOnRoof->usIndex != NO_TILE)
{
GetTileType(pOnRoof->usIndex, &fTileType);
pOldOnRoof = pOnRoof;
pOnRoof = pOnRoof->pNext;
if(fTileType >= fStartType && fTileType <= fEndType)
pOldOnRoof->uiFlags &= (~uiFlags);
}
}
void SetOnRoofIndexFlagsFromTypeRange(INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags)//dnl ch80 011213
{
LEVELNODE *pOnRoof, *pOldOnRoof;
UINT32 fTileType;
pOnRoof = gpWorldLevelData[iMapIndex].pOnRoofHead;
while(pOnRoof && pOnRoof->usIndex != NO_TILE)
{
GetTileType(pOnRoof->usIndex, &fTileType);
pOldOnRoof = pOnRoof;
pOnRoof = pOnRoof->pNext;
if(fTileType >= fStartType && fTileType <= fEndType)
pOldOnRoof->uiFlags |= uiFlags;
}
}
// Topmost layer // Topmost layer
// ################################################################# // #################################################################
+3 -1
View File
@@ -41,6 +41,8 @@ BOOLEAN RemoveAllOnRoofsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32
void SetAllOnRoofShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel ); void SetAllOnRoofShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllOnRoofShadeLevels( INT32 iMapIndex, INT8 bShadeDiff ); void AdjustAllOnRoofShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );
BOOLEAN RemoveOnRoofFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode ); BOOLEAN RemoveOnRoofFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode );
void RemoveOnRoofIndexFlagsFromTypeRange(INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags);//dnl ch80 011213
void SetOnRoofIndexFlagsFromTypeRange(INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags);//dnl ch80 011213
// Land manipulation functions // Land manipulation functions
@@ -76,7 +78,7 @@ BOOLEAN TypeExistsInStructLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusStruc
BOOLEAN RemoveAllStructsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ); BOOLEAN RemoveAllStructsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace ); BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace );
BOOLEAN ReplaceStructIndex( INT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex ); BOOLEAN ReplaceStructIndex( INT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex );
BOOLEAN HideStructOfGivenType( INT32 iMapIndex, UINT32 fType, BOOLEAN fHide ); BOOLEAN HideStructOfGivenType(INT32 iMapIndex, UINT32 fType, BOOLEAN fHide);//dnl ch80 011213
BOOLEAN InsertStructIndex( INT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ); BOOLEAN InsertStructIndex( INT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel );
void SetAllStructShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel ); void SetAllStructShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllStructShadeLevels( INT32 iMapIndex, INT8 bShadeDiff ); void AdjustAllStructShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );