diff --git a/Editor/Editor Callbacks.cpp b/Editor/Editor Callbacks.cpp index 9db7ddb0..cf6c2d8b 100644 --- a/Editor/Editor Callbacks.cpp +++ b/Editor/Editor Callbacks.cpp @@ -797,6 +797,7 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { +#if 0//dnl ch80 011213 gfRenderTaskbar = TRUE; if (_KeyDown( 17 ) ) // CTRL { @@ -814,6 +815,9 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason) DisableButton( iEditorButton[ITEMS_LEFTSCROLL] ); if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) 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 0//dnl ch80 011213 gfRenderTaskbar = TRUE; if (_KeyDown( 17 ) ) // CTRL { @@ -837,6 +842,9 @@ void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason) EnableButton( iEditorButton[ITEMS_LEFTSCROLL] ); if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); +#else + ScrollEditorItemsInfo(TRUE); +#endif } } diff --git a/Editor/Editor Modes.cpp b/Editor/Editor Modes.cpp index 0746ebf8..fc7164e7 100644 --- a/Editor/Editor Modes.cpp +++ b/Editor/Editor Modes.cpp @@ -302,14 +302,17 @@ void HideExitGrids() void SetEditorMapInfoTaskbarMode( UINT16 usNewMode ) { BOOLEAN fShowExitGrids = FALSE; - UnclickEditorButton( MAPINFO_ADD_LIGHT1_SOURCE ); - UnclickEditorButton( MAPINFO_DRAW_EXITGRIDS ); - UnclickEditorButton( MAPINFO_NORTH_POINT ); - UnclickEditorButton( MAPINFO_WEST_POINT ); - UnclickEditorButton( MAPINFO_CENTER_POINT ); - UnclickEditorButton( MAPINFO_EAST_POINT ); - UnclickEditorButton( MAPINFO_SOUTH_POINT ); - UnclickEditorButton( MAPINFO_ISOLATED_POINT ); + if( usNewMode < MAPINFO_RADIO_NORMAL || usNewMode > MAPINFO_RADIO_CAVES )//dnl ch80 011213 + { + UnclickEditorButton( MAPINFO_ADD_LIGHT1_SOURCE ); + UnclickEditorButton( MAPINFO_DRAW_EXITGRIDS ); + UnclickEditorButton( MAPINFO_NORTH_POINT ); + UnclickEditorButton( MAPINFO_WEST_POINT ); + UnclickEditorButton( MAPINFO_CENTER_POINT ); + UnclickEditorButton( MAPINFO_EAST_POINT ); + UnclickEditorButton( MAPINFO_SOUTH_POINT ); + UnclickEditorButton( MAPINFO_ISOLATED_POINT ); + } ClickEditorButton( usNewMode ); switch( usNewMode ) { diff --git a/Editor/Editor Taskbar Utils.cpp b/Editor/Editor Taskbar Utils.cpp index dbe913bb..d4306b5b 100644 --- a/Editor/Editor Taskbar Utils.cpp +++ b/Editor/Editor Taskbar Utils.cpp @@ -402,6 +402,9 @@ void DoTaskbar(void) iDrawMode = DRAW_MODE_LIGHT; TerrainTileDrawMode = TERRAIN_TILES_BRETS_STRANGEMODE; SetupTextInputForMapInfo(); + //dnl ch80 011213 + SetEditorSmoothingMode(gMapInformation.ubEditorSmoothingType); + ChangeLightDefault(gbDefaultLightType); break; case TASK_OPTIONS: iDrawMode = DRAW_MODE_NOTHING;//dnl ch22 210909 diff --git a/Editor/EditorBuildings.cpp b/Editor/EditorBuildings.cpp index 1392350b..c57a04eb 100644 --- a/Editor/EditorBuildings.cpp +++ b/Editor/EditorBuildings.cpp @@ -50,16 +50,15 @@ void GameInitEditorBuildingInfo() } //BEGINNING OF BUILDING UTILITY FUNCTIONS -void UpdateRoofsView() +void UpdateRoofsView()//dnl ch80 011213 { - INT32 x; - UINT16 usType; - for ( x = 0; x < WORLD_MAX; x++ ) + INT32 x, cnt; + UINT16 usType[12] = {FIRSTROOF, SECONDROOF, THIRDROOF, FOURTHROOF, FIRSTSLANTROOF, SECONDSLANTROOF, FIRSTONROOF, SECONDONROOF, FIRSTWALL, SECONDWALL, THIRDWALL, FOURTHWALL}; + for(cnt=0; cnt 8 ) gusPreserveSelectionWidth = 1; } - gfRenderTaskbar = TRUE; + //gfRenderTaskbar = TRUE; break; case '<': // item left scroll by page if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { +#if 0//dnl ch80 011213 if( eInfo.sScrollIndex ) { if( EditorInputEvent.usKeyState & CTRL_DOWN ) @@ -2123,13 +2138,17 @@ void HandleKeyboardShortcuts( ) if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); } +#else + ScrollEditorItemsInfo(FALSE); +#endif } - gfRenderTaskbar = TRUE; + //gfRenderTaskbar = TRUE; break; case '>': // item right scroll by page if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { +#if 0//dnl ch80 011213 if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) { if( EditorInputEvent.usKeyState & CTRL_DOWN ) @@ -2141,8 +2160,11 @@ void HandleKeyboardShortcuts( ) if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); } +#else + ScrollEditorItemsInfo(TRUE); +#endif } - gfRenderTaskbar = TRUE; + //gfRenderTaskbar = TRUE; break; case '/': // Buggler: create item with keyboard input @@ -3789,239 +3811,94 @@ void HandleMouseClicksInGameScreen() } #else -void HandleMouseClicksInGameScreen() +void HandleMouseClicksInGameScreen()//dnl ch80 011213 { static UINT32 iLastMapIndexLB(-1), iLastMapIndexRB(-1), iLastMapIndexMB(-1); - INT16 sX, sY; BOOLEAN fPrevState; - if( !GetMouseXY( &sGridX, &sGridY ) ) + if(!GetMouseXY(&sGridX, &sGridY)) return; - if( iCurrentTaskbar == TASK_OPTIONS || iCurrentTaskbar == TASK_NONE ) - { //if in taskbar modes which don't process clicks in the world. + if(iCurrentTaskbar == TASK_OPTIONS || iCurrentTaskbar == TASK_NONE)// if in taskbar modes which don't process clicks in the world 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; - } - - iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); - + iMapIndex = MAPROWCOLTOPOS(sGridY, sGridX); fPrevState = gfRenderWorld; - if(_LeftButtonDown) { if(iLastMapIndexLB != iMapIndex && iLastMapIndexLB == -1) iLastMapIndexLB = iMapIndex; gfRenderWorld = TRUE; - // Are we trying to erase something? - if ( iDrawMode >= DRAW_MODE_ERASE ) + if(iDrawMode >= DRAW_MODE_ERASE)// Are we trying to erase something? { - // Erasing can have a brush size larger than 1 tile - for ( sY = (INT16)gSelectRegion.iTop; sY <= (INT16)gSelectRegion.iBottom; sY++ ) + for(sY=(INT16)gSelectRegion.iTop; sY<=(INT16)gSelectRegion.iBottom; sY++)// Erasing can have a brush size larger than 1 tile { - 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) ) - { - RemoveLight( sX, sY ); - } + if(iDrawMode == (DRAW_MODE_LIGHT + DRAW_MODE_ERASE)) + RemoveLight(sX, sY); else - EraseMapTile( MAPROWCOLTOPOS( sY, sX ) ); + EraseMapTile(MAPROWCOLTOPOS(sY, sX)); } } - - if( iDrawMode == DRAW_MODE_LIGHT + DRAW_MODE_ERASE ) - LightSpriteRenderAll(); // To adjust building's lighting + if(iDrawMode == DRAW_MODE_LIGHT + DRAW_MODE_ERASE) + LightSpriteRenderAll();// To adjust building's lighting return; } - - switch ( iDrawMode ) + switch(iDrawMode) { - case DRAW_MODE_SCHEDULEACTION: - if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) ) - { - iDrawMode = DRAW_MODE_SCHEDULECONFIRM; - gfFirstPlacement = FALSE; - } - break; - case DRAW_MODE_NORTHPOINT: - case DRAW_MODE_WESTPOINT: - 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; - } + 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_BANKS: - if(fDontUseClick) - PasteBanks(iMapIndex, gsBanksSubIndex, TRUE); - break; - case DRAW_MODE_ROADS: - if(fDontUseClick) - PasteRoads(iMapIndex); - break; - case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): - TerrainFill( iMapIndex ); - //BeginFill( iMapIndex ); - break; - case DRAW_MODE_PLACE_ITEM: - if(fDontUseClick && gfFirstPlacement) - { - AddSelectedItemToWorld(iMapIndex);//dnl ch43 280909 - gfFirstPlacement = FALSE; - } - break; - default: - gfRenderWorld = fPrevState; - break; + break; + case DRAW_MODE_COPY_BUILDING: + case DRAW_MODE_MOVE_BUILDING: + if(gfFirstPlacement) + { + CopyBuilding(iMapIndex); + gfFirstPlacement = FALSE; + } + gfRenderWorld = fPrevState; + break; + default: + gfRenderWorld = fPrevState; + break; } } else if(_RightButtonDown) { if(iLastMapIndexRB != iMapIndex && iLastMapIndexRB == -1) iLastMapIndexRB = iMapIndex; +#if 0 gfRenderWorld = TRUE; - switch( iDrawMode ) + switch(iDrawMode) { - // Handle right clicking on a merc (for editing/moving him) - case DRAW_MODE_ENEMY: - case DRAW_MODE_CREATURE: - 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; + default: + gfRenderWorld = fPrevState; + break; } +#endif } else if(_MiddleButtonDown) { if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1) iLastMapIndexMB = iMapIndex; +#if 0 gfRenderWorld = TRUE; + switch(iDrawMode) + { + default: + gfRenderWorld = fPrevState; + break; + } +#endif } else if(!_LeftButtonDown) { @@ -4030,13 +3907,10 @@ void HandleMouseClicksInGameScreen() gfRenderWorld = TRUE; switch(iDrawMode) { -// case DRAW_MODE_SCHEDULEACTION: -// if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) ) -// { -// iDrawMode = DRAW_MODE_SCHEDULECONFIRM; -// gfFirstPlacement = FALSE; -// } -// break; + case DRAW_MODE_SCHEDULEACTION: + if(IsLocationSittableExcludingPeople(iMapIndex, FALSE)) + RegisterCurrentScheduleAction(iMapIndex); + break; case DRAW_MODE_NORTHPOINT: case DRAW_MODE_WESTPOINT: case DRAW_MODE_EASTPOINT: @@ -4045,60 +3919,61 @@ void HandleMouseClicksInGameScreen() case DRAW_MODE_ISOLATEDPOINT: 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_ENEMY: + case DRAW_MODE_CREATURE: + case DRAW_MODE_REBEL: + case DRAW_MODE_CIVILIAN: + AddMercToWorld(iMapIndex);// Handle adding mercs to the world + break; + case DRAW_MODE_LIGHT: + PlaceLight(gsLightRadius, sGridX, sGridY, 0);// Add a normal light to the world + 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: @@ -4111,37 +3986,23 @@ void HandleMouseClicksInGameScreen() 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; -// break; + case DRAW_MODE_DOORKEYS: + InitDoorEditing(iMapIndex); + break; + case DRAW_MODE_KILL_BUILDING: + KillBuilding(iMapIndex); + break; case DRAW_MODE_BANKS: PasteBanks(iMapIndex, gsBanksSubIndex, TRUE); break; case DRAW_MODE_ROADS: PasteRoads(iMapIndex); break; -// case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): -// TerrainFill( iMapIndex ); -// //BeginFill( iMapIndex ); -// break; + case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): + TerrainFill(iMapIndex); + break; case DRAW_MODE_PLACE_ITEM: - if(gfFirstPlacement) - { - AddSelectedItemToWorld(iMapIndex);//dnl ch43 280909 - gfFirstPlacement = FALSE; - } + AddSelectedItemToWorld(iMapIndex); break; case DRAW_MODE_HIGH_GROUND: if(gpWorldLevelData[iMapIndex].sHeight) @@ -4162,21 +4023,15 @@ void HandleMouseClicksInGameScreen() 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: - PasteBuilding( iMapIndex ); + PasteBuilding(iMapIndex); break; case DRAW_MODE_MOVE_BUILDING: - MoveBuilding( iMapIndex ); + MoveBuilding(iMapIndex); break; } } @@ -4187,66 +4042,92 @@ void HandleMouseClicksInGameScreen() if(iMapIndex == iLastMapIndexRB)// RightClick performed on same tile { gfRenderWorld = TRUE; - - switch( iDrawMode ) - { -/* - // Handle right clicking on a merc (for editing/moving him) + switch(iDrawMode) + { case DRAW_MODE_ENEMY: case DRAW_MODE_CREATURE: case DRAW_MODE_REBEL: case DRAW_MODE_CIVILIAN: - HandleRightClickOnMerc( iMapIndex ); + HandleRightClickOnMerc(iMapIndex);// Handle right clicking on a merc (for editing/moving him) break; -*/ case DRAW_MODE_PLACE_ITEM: 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_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 ); + if(gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION) + ProcessAreaSelection(FALSE); break; - case DRAW_MODE_SMART_WALLS: - EraseWalls( iMapIndex ); + EraseWalls(iMapIndex); break; case DRAW_MODE_SMART_BROKEN_WALLS: case DRAW_MODE_SMART_WINDOWS: case DRAW_MODE_SMART_DOORS: - RestoreWalls( iMapIndex ); + RestoreWalls(iMapIndex); break; case DRAW_MODE_EXITGRID: if(GetExitGrid(iMapIndex, &gExitGrid))//dnl ch43 280909 ApplyNewExitGridValuesToTextFields(); break; -*/ default: gfRenderWorld = fPrevState; break; - } - + } } iLastMapIndexRB = -1; } @@ -4254,17 +4135,36 @@ void HandleMouseClicksInGameScreen() { if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile { +#if 0 gfRenderWorld = TRUE; + switch(iDrawMode) + { + default: + gfRenderWorld = fPrevState; + break; + } +#endif } iLastMapIndexMB = -1; } } #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) { case DRAW_MODE_SMART_WALLS: diff --git a/Editor/editscreen.h b/Editor/editscreen.h index a0f80aeb..50a51951 100644 --- a/Editor/editscreen.h +++ b/Editor/editscreen.h @@ -84,6 +84,7 @@ void ShowHighGround(INT32 iShowHighGroundCommand);//dnl ch2 210909 extern BOOLEAN fEditorCreateItemFromKeyboard; extern UINT16 usEditorTempItem; +extern UINT16 gusSavedLightLevel;//dnl ch80 011213 #endif #endif diff --git a/TileEngine/Exit Grids.cpp b/TileEngine/Exit Grids.cpp index 6078b801..38a46261 100644 --- a/TileEngine/Exit Grids.cpp +++ b/TileEngine/Exit Grids.cpp @@ -74,10 +74,6 @@ BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid ) } pShadow = pShadow->pNext; } - pExitGrid->ubGotoSectorX = 0; - pExitGrid->ubGotoSectorY = 0; - pExitGrid->ubGotoSectorZ = 0; - pExitGrid->usGridNo = 0; return FALSE; } @@ -126,13 +122,7 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ) tail = pShadow; if( pShadow->uiFlags & LEVELNODE_EXITGRID ) { //we have found an existing exitgrid in this node, so replace it with the new information. -// -// pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid ); - memcpy(gpExitGrids + guiExitGridsCount, pExitGrid, sizeof(EXITGRID)); - pShadow->pExitGridInfo = gpExitGrids + guiExitGridsCount; - guiExitGridsCount++; -// - //SmoothExitGridRadius( (INT16)iMapIndex, 0 ); + memcpy(pShadow->pExitGridInfo, pExitGrid, sizeof(EXITGRID));//dnl ch80 011213 return; } pShadow = pShadow->pNext; diff --git a/TileEngine/TileDat.h b/TileEngine/TileDat.h index 56592ac9..622279bc 100644 --- a/TileEngine/TileDat.h +++ b/TileEngine/TileDat.h @@ -3474,6 +3474,7 @@ extern INT32 giNumberOfTileTypes; //Madd: for variable number of PItems #define LASTPOINTERS (SELRING - 1) #define LASTUIELEM (WIREFRAMES - 1) // Change this entry if adding new types to the end #define LASTTIELSETELEM (GUNS - 1) +#define LASTONROOF (MOCKFLOOR - 1)//dnl ch80 011213 //=========================================================================== diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 8990a844..2679984c 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -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 { // 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 ) { LEVELNODE *pStruct = NULL; @@ -1938,7 +1942,10 @@ BOOLEAN RemoveShadow( INT32 iMapIndex, UINT16 usIndex ) { 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 MemFree( pShadow ); guiLevelNodes--; @@ -3018,6 +3025,37 @@ BOOLEAN RemoveAllOnRoofsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 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 // ################################################################# diff --git a/TileEngine/worldman.h b/TileEngine/worldman.h index db7dbb33..fd313ce4 100644 --- a/TileEngine/worldman.h +++ b/TileEngine/worldman.h @@ -41,6 +41,8 @@ BOOLEAN RemoveAllOnRoofsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 void SetAllOnRoofShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel ); void AdjustAllOnRoofShadeLevels( INT32 iMapIndex, INT8 bShadeDiff ); 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 @@ -76,7 +78,7 @@ BOOLEAN TypeExistsInStructLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusStruc BOOLEAN RemoveAllStructsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ); BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace ); 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 ); void SetAllStructShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel ); void AdjustAllStructShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );