| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/editor/editorView.cpp $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003-08-26 03:57:37 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Main Editor View which contains the different views of the mine |
| 26 | * |
| 27 | * $Log: not supported by cvs2svn $ |
| 28 | * |
| 29 | * 72 10/14/99 4:21p Matt |
| 30 | * Added code to remove duplicate faces from a room. |
| 31 | * |
| 32 | * 71 10/07/99 3:12p Matt |
| 33 | * Added a function to flip the view 180 degrees. |
| 34 | * |
| 35 | * 70 9/15/99 1:55p Matt |
| 36 | * Added the option to allow rooms or groups placed on the terrain to |
| 37 | * either align with the terrain or with gravity. |
| 38 | * |
| 39 | * 69 9/07/99 12:10p Matt |
| 40 | * Added a function to propagate a texture to all adjacent coplanar faces |
| 41 | * in a room. |
| 42 | * |
| 43 | * 68 8/24/99 4:24p Matt |
| 44 | * Added a function to rotate a placed room by 45 degrees. |
| 45 | * |
| 46 | * 67 5/08/99 6:39p Matt |
| 47 | * Added a function to delete a face and all faces connected to it. |
| 48 | * |
| 49 | * 66 5/08/99 1:38a Matt |
| 50 | * Fixed typo. |
| 51 | * |
| 52 | * 65 4/30/99 6:52p Matt |
| 53 | * Added a function to merge an object's geometry into a room. |
| 54 | * |
| 55 | * 64 4/28/99 12:51a Matt |
| 56 | * Added some funtions to edit face geometry. |
| 57 | * |
| 58 | * 63 4/19/99 12:10a Matt |
| 59 | * Added a menu item to delete a vertex from a face. |
| 60 | * |
| 61 | * 62 4/06/99 10:23a Matt |
| 62 | * |
| 63 | * 61 3/31/99 12:58p Matt |
| 64 | * Added snap-point-to-face |
| 65 | * |
| 66 | * 60 3/29/99 6:46p Matt |
| 67 | * Added menu item to fix/remove degenerate faces |
| 68 | * |
| 69 | * 59 3/27/99 7:10p Matt |
| 70 | * Strip leading & trailing spaces before check for duplicate names. |
| 71 | * |
| 72 | * 58 3/23/99 11:15p Matt |
| 73 | * Added message when rooms combined. |
| 74 | * |
| 75 | * 57 3/23/99 5:12p Matt |
| 76 | * Added function to combine rooms. |
| 77 | * |
| 78 | * 56 3/01/99 10:39p Matt |
| 79 | * Added menu options to set & clear room center points |
| 80 | * |
| 81 | * 55 3/01/99 10:39a Matt |
| 82 | * Strip leading and trailing spaces from object, trigger, and room names |
| 83 | * on level load and when the names are entered. |
| 84 | * |
| 85 | * 54 2/28/99 10:40p Matt |
| 86 | * Check for name already in use when entering a name. |
| 87 | * |
| 88 | * 53 2/28/99 6:31p Matt |
| 89 | * Disable z-buffer button if OpenGL is being used in the editor. |
| 90 | * |
| 91 | * 52 2/03/99 1:10p Matt |
| 92 | * Changed the paletted room current faces to be stored in a seperate |
| 93 | * array, instead of in the room structure. |
| 94 | * |
| 95 | * 51 1/25/99 11:12a Matt |
| 96 | * If the marked face is deleted, reset it. |
| 97 | * |
| 98 | * 50 1/21/99 11:15p Jeff |
| 99 | * pulled out some structs and defines from header files and moved them |
| 100 | * into seperate header files so that multiplayer dlls don't require major |
| 101 | * game headers, just those new headers. Side effect is a shorter build |
| 102 | * time. Also cleaned up some header file #includes that weren't needed. |
| 103 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 104 | * manage.h and multi.h |
| 105 | * |
| 106 | * 49 1/15/99 10:50a Matt |
| 107 | * Added rename room to Room menu & added shortcut key |
| 108 | * |
| 109 | * 48 12/30/98 6:49p Matt |
| 110 | * When un-placing a door, free the room that the placed door was using |
| 111 | * |
| 112 | * 47 12/23/98 10:53a Matt |
| 113 | * Added functions to create a face |
| 114 | * |
| 115 | * 46 10/05/98 9:45a Matt |
| 116 | * Use windows function to get cursor position instead of ddio function. |
| 117 | * |
| 118 | * 45 10/03/98 11:21p Matt |
| 119 | * Added system to seperately control outline mode for mine, terrain, sky, |
| 120 | * & objects |
| 121 | * |
| 122 | * 44 10/03/98 8:31p Matt |
| 123 | * Added Join Rooms Exact function. |
| 124 | * |
| 125 | * 43 9/18/98 1:27p Jason |
| 126 | * cleaned up renderer initting |
| 127 | * |
| 128 | * 42 9/09/98 4:07p Matt |
| 129 | * Added Smooth Bridge function |
| 130 | * |
| 131 | * 41 9/08/98 6:12p Matt |
| 132 | * Added code to check for and fix duplicate and unused points. |
| 133 | * |
| 134 | * 40 9/08/98 12:06p Jason |
| 135 | * added ReInit openGL button |
| 136 | * |
| 137 | * 39 9/07/98 10:58p Matt |
| 138 | * Added snap point to point. |
| 139 | * |
| 140 | * 38 9/04/98 3:34p Matt |
| 141 | * Added groovy vertex snap code |
| 142 | * |
| 143 | * 37 9/04/98 12:29p Matt |
| 144 | * Added marked edge & vertex in the editor |
| 145 | * |
| 146 | * 36 8/31/98 4:36p Matt |
| 147 | * Added status message |
| 148 | * |
| 149 | * 35 6/25/98 7:15p Matt |
| 150 | * Added a function to delete a pair of portals. |
| 151 | * |
| 152 | * 34 6/23/98 2:45p Matt |
| 153 | * Added option when propagating to all faces in a room to only do so to |
| 154 | * ones with the same texture. |
| 155 | * |
| 156 | * 33 6/08/98 12:28p Matt |
| 157 | * Added a function to triangulate a face |
| 158 | * |
| 159 | * 32 5/22/98 4:47p Matt |
| 160 | * Added menu item to propagate a texture to all the faces in a room. |
| 161 | * |
| 162 | * 31 4/27/98 6:41p Matt |
| 163 | * Added code to join all adjacent faces between two rooms |
| 164 | * |
| 165 | * 30 4/16/98 11:50a Matt |
| 166 | * Made snap code work for placed groups. |
| 167 | * |
| 168 | * 29 2/16/98 1:27p Matt |
| 169 | * Added function to snap the placed room to a vertex/edge on the base |
| 170 | * room/face |
| 171 | * |
| 172 | * 28 2/11/98 12:39p Matt |
| 173 | * Implemented Delete Face menu item. |
| 174 | * |
| 175 | * 27 1/29/98 2:15p Samir |
| 176 | * Implemented ObjectListModeless and Toolbar button. |
| 177 | * |
| 178 | * 26 1/27/98 6:15p Samir |
| 179 | * Added Object toolbar button. |
| 180 | * |
| 181 | * 25 1/20/98 4:08p Matt |
| 182 | * Added function to swap current and marked room:face. Added some |
| 183 | * addition error checking to bridge function. |
| 184 | * |
| 185 | * 24 1/06/98 12:39p Matt |
| 186 | * Added some error checking |
| 187 | * |
| 188 | * 23 11/05/97 7:13p Matt |
| 189 | * Added join rooms function |
| 190 | * |
| 191 | * 22 10/03/97 3:37p Matt |
| 192 | * Added menu item to place a building on the terrain |
| 193 | * |
| 194 | * 21 9/24/97 3:22p Matt |
| 195 | * Added Drop Room function |
| 196 | * |
| 197 | * 20 9/17/97 1:24p Matt |
| 198 | * Ripped out segment code |
| 199 | * |
| 200 | * 19 9/17/97 11:21a Matt |
| 201 | * Ripped out segment code |
| 202 | * |
| 203 | * 18 9/16/97 4:09p Jason |
| 204 | * implemented software zbuffer |
| 205 | * |
| 206 | * 17 9/14/97 11:06p Matt |
| 207 | * Fixed up Room menu |
| 208 | * |
| 209 | * 16 9/11/97 5:46p Jason |
| 210 | * first pass at getting doors to work with room engine |
| 211 | * |
| 212 | * 15 8/29/97 3:37p Samir |
| 213 | * Took out segment tab constant. |
| 214 | * |
| 215 | * 14 8/22/97 9:32a Matt |
| 216 | * Don't allow place room to a face that already has a room on it. |
| 217 | * |
| 218 | * 13 8/21/97 6:00p Matt |
| 219 | * Added delete current room function |
| 220 | * |
| 221 | * 12 8/19/97 5:58p Samir |
| 222 | * OLE additions |
| 223 | * |
| 224 | * 11 8/19/97 10:54a Matt |
| 225 | * Added remove placed room option |
| 226 | * |
| 227 | * 10 8/18/97 6:59p Matt |
| 228 | * Implemented Place Room/Attach room system |
| 229 | * |
| 230 | * 9 8/04/97 12:52p Matt |
| 231 | * Added hooks for mark & bridge |
| 232 | * |
| 233 | * 8 8/01/97 6:10p Matt |
| 234 | * Added hooks for attach room |
| 235 | * |
| 236 | * 7 7/28/97 11:29a Samir |
| 237 | * Fixed editor->game goofiness. Isolated GrWnd creation and destruction |
| 238 | * to a couple of functions. |
| 239 | * |
| 240 | * 6 7/25/97 6:16p Samir |
| 241 | * Fixed the tile-cascade switching/default madness. |
| 242 | * |
| 243 | * 5 7/22/97 7:07p Matt |
| 244 | * Cleaned up D3EditState, moving some vars in and some out, and renaming |
| 245 | * and changing a few others |
| 246 | * |
| 247 | * 4 7/22/97 10:33a Matt |
| 248 | * Added functions for new room menu |
| 249 | * |
| 250 | * 29 6/30/97 1:29p Jason |
| 251 | * added netherspace stuff |
| 252 | * |
| 253 | * 28 6/03/97 4:55p Mark |
| 254 | * |
| 255 | * 28 6/3/97 4:38p Jeff |
| 256 | * Added Context Sensitive Help for Keypads |
| 257 | * |
| 258 | * 27 5/27/97 3:30p Matt |
| 259 | * Added editor button to toggle lighting |
| 260 | * |
| 261 | * 26 5/08/97 7:29p Matt |
| 262 | * Made seperate viewers for mine & terrain, and cleaned up code the |
| 263 | * switched between modes |
| 264 | * |
| 265 | * 25 5/06/97 3:49p Matt |
| 266 | * Unlink/relink viewer object when switching between mine and terrain |
| 267 | * views |
| 268 | * |
| 269 | * 24 5/06/97 1:17p Jason |
| 270 | * checked in for matt |
| 271 | * |
| 272 | * 23 4/03/97 1:17p Matt |
| 273 | * Took out support for toolbar movement mode toggle button, now that that |
| 274 | * function has been moved to the object keypad. |
| 275 | * |
| 276 | * 22 4/02/97 8:07p Matt |
| 277 | * Added variable & button to toggle object move state |
| 278 | * |
| 279 | * 21 3/31/97 5:57p Matt |
| 280 | * Revamped mine update flags |
| 281 | * |
| 282 | * 20 3/21/97 5:02p Jason |
| 283 | * make player_object switch the OF_OVER_TERRAIN flag to on when changing |
| 284 | * to terrain view...temporary |
| 285 | * |
| 286 | * 19 3/17/97 7:41p Samir |
| 287 | * Fixed editor interface problems with updating triggers and doorways in |
| 288 | * keypads when loading new levels (must fix some more). |
| 289 | * |
| 290 | * 18 3/13/97 6:12p Jason |
| 291 | * set default height above terrain |
| 292 | * |
| 293 | * 17 3/07/97 4:54p Jason |
| 294 | * made editor save position of terrain/mine when switching between modes |
| 295 | * |
| 296 | * |
| 297 | * 16 3/07/97 4:18p Jason |
| 298 | * implemented terrain functionality in the editor |
| 299 | * |
| 300 | * 15 2/28/97 6:37p Matt |
| 301 | * Added variable & toggle button for box selection mode |
| 302 | * |
| 303 | * 14 2/20/97 1:30p Samir |
| 304 | * Defined main_view. |
| 305 | * |
| 306 | * 13 2/11/97 1:42p Samir |
| 307 | * Moved file opening and closing to editorDoc where it should be. |
| 308 | * |
| 309 | * 12 2/10/97 5:40p Matt |
| 310 | * Code to handle several File menu options |
| 311 | * |
| 312 | * 11 2/07/97 7:41p Matt |
| 313 | * Hooked in next & prev segment & side funcs |
| 314 | * |
| 315 | * 10 1/23/97 4:09p Samir |
| 316 | * Added stuff for toggling wireframe, texture windows, tiling or |
| 317 | * cascading |
| 318 | * |
| 319 | * 9 1/21/97 12:51p Samir |
| 320 | * GrWnds created based on D3EditState info |
| 321 | * |
| 322 | * $NoKeywords: $ |
| 323 | */ |
| 324 | |
| 325 | #include "stdafx.h" |
| 326 | #include "editor.h" |
| 327 | |
| 328 | #include "editorDoc.h" |
| 329 | #include "editorView.h" |
| 330 | #include "MainFrm.h" |
| 331 | #include "TextureDialog.h" |
| 332 | #include "EditLineDialog.h" |
| 333 | #include "RoomKeypadDialog.h" |
| 334 | #include "game.h" |
| 335 | |
| 336 | #include "d3edit.h" |
| 337 | #include "mono.h" |
| 338 | |
| 339 | #include "render.h" |
| 340 | #include "HRoom.h" |
| 341 | #include "HFile.h" |
| 342 | #include "erooms.h" |
| 343 | #include "args.h" |
| 344 | |
| 345 | #include "terrain.h" |
| 346 | |
| 347 | #include "mem.h" |
| 348 | |
| 349 | #ifdef _DEBUG |
| 350 | #define new DEBUG_NEW |
| 351 | #undef THIS_FILE |
| 352 | static char THIS_FILE[] = __FILE__; |
| 353 | #endif |
| 354 | |
| 355 | ///////////////////////////////////////////////////////////////////////////// |
| 356 | // CEditorView |
| 357 | |
| 358 | IMPLEMENT_DYNCREATE(CEditorView, CView) |
| 359 | |
| 360 | BEGIN_MESSAGE_MAP(CEditorView, CView) |
| 361 | //{{AFX_MSG_MAP(CEditorView) |
| 362 | ON_WM_SIZE() |
| 363 | ON_WM_DESTROY() |
| 364 | ON_COMMAND(ID_BUTTON_OUTLINE, OnButtonOutline) |
| 365 | ON_UPDATE_COMMAND_UI(ID_BUTTON_OUTLINE, OnUpdateButtonOutline) |
| 366 | ON_UPDATE_COMMAND_UI(ID_VIEW_TEXTUREMINE, OnUpdateViewTexturemine) |
| 367 | ON_COMMAND(ID_VIEW_TEXTUREMINE, OnViewTexturemine) |
| 368 | ON_UPDATE_COMMAND_UI(ID_VIEW_WIREFRAMEMINE, OnUpdateViewWireframemine) |
| 369 | ON_COMMAND(ID_VIEW_WIREFRAMEMINE, OnViewWireframemine) |
| 370 | ON_WM_PARENTNOTIFY() |
| 371 | ON_COMMAND(ID_WINDOW_TILE, OnWindowTile) |
| 372 | ON_COMMAND(ID_WINDOW_CASCADE, OnWindowCascade) |
| 373 | ON_COMMAND(ID_BUTTON_WINDOWSELECTION, OnButtonWindowSelection) |
| 374 | ON_UPDATE_COMMAND_UI(ID_BUTTON_WINDOWSELECTION, OnUpdateButtonWindowSelection) |
| 375 | ON_COMMAND(ID_BUTTON_LIGHTING, OnButtonLighting) |
| 376 | ON_UPDATE_COMMAND_UI(ID_BUTTON_LIGHTING, OnUpdateButtonLighting) |
| 377 | ON_WM_HELPINFO() |
| 378 | ON_COMMAND(ID_ROOM_ADD, OnRoomAdd) |
| 379 | ON_COMMAND(ID_ROOM_GRABTEXTURE, OnRoomGrabTexture) |
| 380 | ON_COMMAND(ID_ROOM_NEXTFACE, OnRoomNextFace) |
| 381 | ON_COMMAND(ID_ROOM_PREVIOUSFACE, OnRoomPreviousFace) |
| 382 | ON_COMMAND(ID_ROOM_SELECTBYNUMBER, OnRoomSelectByNumber) |
| 383 | ON_COMMAND(ID_ROOM_ATTACHROOM, OnRoomAttachRoom) |
| 384 | ON_COMMAND(ID_ROOM_BUILDBRIDGE, OnRoomBuildBridge) |
| 385 | ON_COMMAND(ID_ROOM_MARK, OnRoomMark) |
| 386 | ON_COMMAND(ID_ROOM_PLACEROOM, OnRoomPlaceRoom) |
| 387 | ON_UPDATE_COMMAND_UI(ID_ROOM_ATTACHROOM, OnUpdateRoomAttachRoom) |
| 388 | ON_COMMAND(ID_ROOM_UNPLACEROOM, OnRoomUnPlaceRoom) |
| 389 | ON_UPDATE_COMMAND_UI(ID_ROOM_UNPLACEROOM, OnUpdateRoomUnPlaceRoom) |
| 390 | ON_COMMAND(ID_ROOM_DELETE, OnRoomDelete) |
| 391 | ON_COMMAND(ID_ROOM_SELECTFACEBYNUMBER, OnRoomSelectFaceByNumber) |
| 392 | ON_COMMAND(ID_ROOM_SAVECURRENTROOM, OnRoomSaveCurrentRoom) |
| 393 | ON_COMMAND(ID_ZBUTTON, OnZbutton) |
| 394 | ON_UPDATE_COMMAND_UI(ID_ZBUTTON, OnUpdateZbutton) |
| 395 | ON_COMMAND(ID_ROOM_DROPROOM, OnRoomDropRoom) |
| 396 | ON_COMMAND(ID_ROOM_PLACETERRAINROOM, OnRoomPlaceTerrainRoom) |
| 397 | ON_COMMAND(ID_ROOM_JOINROOMS, OnRoomJoinRooms) |
| 398 | ON_COMMAND(ID_ROOM_SWAPMAKEDANDCURRENTROOMFACE, OnRoomSwapMarkedAndCurrentRoomFace) |
| 399 | ON_COMMAND(ID_ROOM_DELETEFACE, OnRoomDeleteFace) |
| 400 | ON_COMMAND(ID_ROOM_SNAPPLACEDROOM, OnRoomSnapPlacedRoom) |
| 401 | ON_UPDATE_COMMAND_UI(ID_ROOM_SNAPPLACEDROOM, OnUpdateRoomSnapPlacedRoom) |
| 402 | ON_COMMAND(ID_ROOM_JOIN_ADJACENT_FACES, OnRoomJoinAdjacentFaces) |
| 403 | ON_COMMAND(ID_ROOM_PROPAGATETOALL, OnRoomPropagateToAll) |
| 404 | ON_COMMAND(ID_ROOM_SPLITFACE, OnRoomSplitFace) |
| 405 | ON_COMMAND(ID_ROOM_DELETEPORTAL, OnRoomDeletePortal) |
| 406 | ON_COMMAND(ID_ROOM_SNAPPOINTTOEDGE, OnRoomSnapPointToEdge) |
| 407 | ON_COMMAND(ID_ROOM_UNDOSNAP, OnRoomUndoSnap) |
| 408 | ON_UPDATE_COMMAND_UI(ID_ROOM_UNDOSNAP, OnUpdateRoomUndoSnap) |
| 409 | ON_COMMAND(ID_ROOM_SNAPPOINTTOPOINT, OnRoomSnapPointToPoint) |
| 410 | ON_COMMAND(ID_REINIT_OPENGL, OnReinitOpengl) |
| 411 | ON_UPDATE_COMMAND_UI(ID_REINIT_OPENGL, OnUpdateReinitOpengl) |
| 412 | ON_COMMAND(ID_FILE_REMOVEEXTRAPOINTS, OnFileRemoveExtraPoints) |
| 413 | ON_COMMAND(ID_ROOM_BUILDSMOOTHBRIDGE, OnRoomBuildSmoothBridge) |
| 414 | ON_COMMAND(ID_ROOM_JOINROOMSEXACT, OnRoomJoinRoomsExact) |
| 415 | ON_COMMAND(ID_ROOM_STARTNEWFACE, OnRoomStartNewFace) |
| 416 | ON_COMMAND(ID_ROOM_FINISHNEWFACE, OnRoomFinishNewFace) |
| 417 | ON_COMMAND(ID_ROOM_ADDVERTTONEWFACE, OnRoomAddVertToNewFace) |
| 418 | ON_COMMAND(ID_ROOM_RENAMEROOM, OnRoomRenameRoom) |
| 419 | ON_COMMAND(ID_ROOM_SETCENTERFROMVIEWER, OnRoomSetCenterFromViewer) |
| 420 | ON_COMMAND(ID_ROOM_CLEARCENTERPOINT, OnRoomClearCenterPoint) |
| 421 | ON_UPDATE_COMMAND_UI(ID_ROOM_CLEARCENTERPOINT, OnUpdateRoomClearCenterPoint) |
| 422 | ON_UPDATE_COMMAND_UI(ID_ROOM_SETCENTERFROMVIEWER, OnUpdateRoomSetCenterFromViewer) |
| 423 | ON_COMMAND(ID_ROOM_COMBINE, OnRoomCombine) |
| 424 | ON_COMMAND(ID_FILE_FIXDEGENERATEFACES, OnFileFixDegenerateFaces) |
| 425 | ON_COMMAND(ID_ROOM_SNAPPOINTTOFACE, OnRoomSnapPointToFace) |
| 426 | ON_COMMAND(ID_ROOM_LINKTONEWEXTERNAL, OnRoomLinkToNewExternal) |
| 427 | ON_COMMAND(ID_ROOM_DELETEVERT, OnRoomDeleteVert) |
| 428 | ON_COMMAND(ID_ROOM_FACE_ADDVERTTOEDGE, OnRoomFaceAddVertToEdge) |
| 429 | ON_COMMAND(ID_ROOM_FACE_MOVEVERTONEDGE, OnRoomFaceMoveVertOnEdge) |
| 430 | ON_COMMAND(ID_ROOM_FACE_SPLITFACE, OnRoomFaceSplitFace) |
| 431 | ON_COMMAND(ID_ROOM_FACE_DELETEVERTONEDGE, OnRoomFaceDeleteVertOnEdge) |
| 432 | ON_COMMAND(ID_ROOM_MERGEOBJECTINTOROOM, OnRoomMergeObjectIntoRoom) |
| 433 | ON_COMMAND(ID_ROOM_DELETECONNECTEDFACES, OnRoomDeleteConnectedFaces) |
| 434 | ON_COMMAND(ID_ROOM_ROTATEPLACEDROOM45DEGREES, OnRoomRotatePlacedRoom45Degrees) |
| 435 | ON_COMMAND(ID_ROOM_PROPAGATETOADJACENTCOPLANARFACES, OnRoomPropagateToAdjacentCoplanarFaces) |
| 436 | ON_COMMAND(ID_VIEW_FLIP, OnViewFlip) |
| 437 | ON_COMMAND(ID_FILE_REMOVEDUPLICATEFACESFROMCURRENTROOM, OnFileRemoveDuplicateFacesFromCurrentRoom) |
| 438 | //}}AFX_MSG_MAP |
| 439 | // Standard printing commands |
| 440 | ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) |
| 441 | ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) |
| 442 | ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) |
| 443 | |
| 444 | END_MESSAGE_MAP() |
| 445 | |
| 446 | // ON_COMMAND(ID_FILE_SAVE, OnFileSave) |
| 447 | // ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs) |
| 448 | |
| 449 | ///////////////////////////////////////////////////////////////////////////// |
| 450 | // CEditorView construction/destruction |
| 451 | |
| 452 | CEditorView::CEditorView() { |
| 453 | // TODO: add construction code here |
| 454 | m_grwndCreated = FALSE; |
| 455 | m_grwndActive = FALSE; |
| 456 | } |
| 457 | |
| 458 | CEditorView::~CEditorView() {} |
| 459 | |
| 460 | BOOL CEditorView::PreCreateWindow(CREATESTRUCT &cs) { |
| 461 | // TODO: Modify the Window class or styles here by modifying |
| 462 | // the CREATESTRUCT cs |
| 463 | |
| 464 | m_grwndActive = TRUE; // This should be moved to OnCreate or something like it |
| 465 | |
| 466 | return CView::PreCreateWindow(cs); |
| 467 | } |
| 468 | |
| 469 | ///////////////////////////////////////////////////////////////////////////// |
| 470 | // CEditorView printing |
| 471 | |
| 472 | BOOL CEditorView::OnPreparePrinting(CPrintInfo *pInfo) { |
| 473 | // default preparation |
| 474 | return DoPreparePrinting(pInfo); |
| 475 | } |
| 476 | |
| 477 | void CEditorView::OnBeginPrinting(CDC * /*pDC*/, CPrintInfo * /*pInfo*/) { |
| 478 | // TODO: add extra initialization before printing |
| 479 | } |
| 480 | |
| 481 | void CEditorView::OnEndPrinting(CDC * /*pDC*/, CPrintInfo * /*pInfo*/) { |
| 482 | // TODO: add cleanup after printing |
| 483 | } |
| 484 | |
| 485 | ///////////////////////////////////////////////////////////////////////////// |
| 486 | // OLE Server support |
| 487 | |
| 488 | // The following command handler provides the standard keyboard |
| 489 | // user interface to cancel an in-place editing session. Here, |
| 490 | // the server (not the container) causes the deactivation. |
| 491 | void CEditorView::OnCancelEditSrvr() { GetDocument()->OnDeactivateUI(FALSE); } |
| 492 | |
| 493 | ///////////////////////////////////////////////////////////////////////////// |
| 494 | // CEditorView drawing |
| 495 | |
| 496 | void CEditorView::OnDraw(CDC *pDC) { |
| 497 | CEditorDoc *pDoc = GetDocument(); |
| 498 | ASSERT_VALID(pDoc); |
| 499 | |
| 500 | // TODO: add draw code for native data here |
| 501 | if (!theApp.paused()) { |
| 502 | if (theApp.wireframe_view) |
| 503 | m_grwndWireframe.Render(); |
| 504 | if (theApp.textured_view) |
| 505 | m_grwndTexture.Render(); |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | ///////////////////////////////////////////////////////////////////////////// |
| 510 | // CEditorView diagnostics |
| 511 | |
| 512 | #ifdef _DEBUG |
| 513 | void CEditorView::AssertValid() const { CView::AssertValid(); } |
| 514 | |
| 515 | void CEditorView::Dump(CDumpContext &dc) const { CView::Dump(dc); } |
| 516 | |
| 517 | CEditorDoc *CEditorView::GetDocument() // non-debug version is inline |
| 518 | { |
| 519 | ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEditorDoc))); |
| 520 | return (CEditorDoc *)m_pDocument; |
| 521 | } |
| 522 | #endif //_DEBUG |
| 523 | |
| 524 | ///////////////////////////////////////////////////////////////////////////// |
| 525 | // CEditorView message handlers |
| 526 | |
| 527 | void CEditorView::OnInitialUpdate() { |
| 528 | CView::OnInitialUpdate(); |
| 529 | |
| 530 | // TODO: Add your specialized code here and/or call the base class |
| 531 | theApp.main_view = this; |
| 532 | |
| 533 | CWnd *wnd = GetParent(); |
| 534 | |
| 535 | wnd->Invalidate(FALSE); |
| 536 | |
| 537 | mprintf(0, "CEditorView::OnInitialUpdate.\n"); |
| 538 | } |
| 539 | |
| 540 | void CEditorView::OnSize(UINT nType, int cx, int cy) { |
| 541 | CView::OnSize(nType, cx, cy); |
| 542 | |
| 543 | // TODO: Add your message handler code here |
| 544 | // ReCreate wireframe and texture screen/windows |
| 545 | if (!m_grwndActive) |
| 546 | return; |
| 547 | |
| 548 | KillChildViews(); |
| 549 | |
| 550 | if (cx && cy) { |
| 551 | CreateChildViews(); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | void CEditorView::OnDestroy() { |
| 556 | theApp.main_view = NULL; |
| 557 | CView::OnDestroy(); |
| 558 | } |
| 559 | |
| 560 | void CEditorView::DeactivateView() { |
| 561 | KillChildViews(); |
| 562 | m_grwndActive = FALSE; // Tell system that this view should not function |
| 563 | } |
| 564 | |
| 565 | void CEditorView::ActivateView() { |
| 566 | CreateChildViews(); |
| 567 | m_grwndActive = TRUE; // This view is active and functional |
| 568 | } |
| 569 | |
| 570 | /* Since this code is shared by a couple of functions, and is critical that the code |
| 571 | is the same for both functions, I place all the code here. |
| 572 | */ |
| 573 | void CEditorView::KillChildViews() { |
| 574 | if (m_grwndCreated) { |
| 575 | if (theApp.wireframe_view) |
| 576 | m_grwndWireframe.DestroyWindow(); |
| 577 | if (theApp.textured_view) |
| 578 | m_grwndTexture.DestroyWindow(); |
| 579 | m_grwndCreated = FALSE; |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | void CEditorView::CreateChildViews() { |
| 584 | RECT view_rect, wire_rect, texture_rect; |
| 585 | |
| 586 | if (m_grwndCreated) |
| 587 | return; |
| 588 | |
| 589 | GetClientRect(&view_rect); |
| 590 | SetRect(&texture_rect, 0, 0, 0, 0); |
| 591 | |
| 592 | // if we tile windows, then texture window will be reset to default width, height |
| 593 | // wireframe window will be sized depending on the existance of the texture view. |
| 594 | if (D3EditState.texscr_visible) { |
| 595 | if (D3EditState.tile_views) |
| 596 | SetRect(&texture_rect, view_rect.left, view_rect.top, view_rect.left + CALC_PIXELS_WITH_ASPECTX(TEXSCREEN_WIDTH), |
| 597 | view_rect.top + CALC_PIXELS_WITH_ASPECTY(TEXSCREEN_HEIGHT)); |
| 598 | else |
| 599 | SetRect(&texture_rect, D3EditState.texscr_x, D3EditState.texscr_y, D3EditState.texscr_x + D3EditState.texscr_w, |
| 600 | D3EditState.texscr_y + D3EditState.texscr_h); |
| 601 | m_grwndTexture.Create(texture_rect, !D3EditState.tile_views, this); |
| 602 | } |
| 603 | |
| 604 | if (D3EditState.wirescr_visible) { |
| 605 | if (D3EditState.tile_views) |
| 606 | SetRect(&wire_rect, view_rect.left, view_rect.top + texture_rect.bottom + 2, view_rect.right, view_rect.bottom); |
| 607 | else |
| 608 | SetRect(&wire_rect, D3EditState.wirescr_x, D3EditState.wirescr_y, D3EditState.wirescr_x + D3EditState.wirescr_w, |
| 609 | D3EditState.wirescr_y + D3EditState.wirescr_h); |
| 610 | m_grwndWireframe.Create(wire_rect, !D3EditState.tile_views, this); |
| 611 | } |
| 612 | |
| 613 | m_grwndCreated = TRUE; |
| 614 | } |
| 615 | |
| 616 | #include "ddio.h" |
| 617 | |
| 618 | void CEditorView::OnButtonOutline() { |
| 619 | CMenu popup; |
| 620 | |
| 621 | if (popup.CreatePopupMenu()) |
| 622 | if (!SetupPopup(&popup)) |
| 623 | Int3(); |
| 624 | |
| 625 | POINT pnt; |
| 626 | GetCursorPos(&pnt); |
| 627 | |
| 628 | if (!popup.TrackPopupMenu(TPM_LEFTALIGN, pnt.x - 20, pnt.y - 10, this, NULL)) |
| 629 | mprintf(0, "TrackPopupMenu error!\n"); |
| 630 | |
| 631 | // Outline_mode ^= OM_ON; |
| 632 | // EditorStatus("Outline mode turned %s",OUTLINE_ON(0)?"ON":"OFF"); |
| 633 | // State_changed = 1; |
| 634 | } |
| 635 | |
| 636 | void CEditorView::OnUpdateButtonOutline(CCmdUI *pCmdUI) { pCmdUI->SetCheck(OUTLINE_ON(0)); } |
| 637 | |
| 638 | void CEditorView::OnUpdateViewTexturemine(CCmdUI *pCmdUI) { pCmdUI->SetCheck(D3EditState.texscr_visible); } |
| 639 | |
| 640 | void CEditorView::OnViewTexturemine() { |
| 641 | RECT texture_rect; |
| 642 | |
| 643 | D3EditState.texscr_visible = !D3EditState.texscr_visible; |
| 644 | |
| 645 | if (!D3EditState.texscr_visible) { |
| 646 | if (D3EditState.tile_views) { |
| 647 | DeactivateView(); |
| 648 | ActivateView(); |
| 649 | } else if (theApp.textured_view) |
| 650 | m_grwndTexture.DestroyWindow(); |
| 651 | } else { |
| 652 | if (D3EditState.tile_views) { // for tiling, reinit the views. |
| 653 | DeactivateView(); |
| 654 | ActivateView(); |
| 655 | } else { |
| 656 | SetRect(&texture_rect, D3EditState.texscr_x, D3EditState.texscr_y, D3EditState.texscr_x + D3EditState.texscr_w, |
| 657 | D3EditState.texscr_y + D3EditState.texscr_h); |
| 658 | m_grwndTexture.Create(texture_rect, TRUE, this); |
| 659 | } |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | void CEditorView::OnUpdateViewWireframemine(CCmdUI *pCmdUI) { pCmdUI->SetCheck(D3EditState.wirescr_visible); } |
| 664 | |
| 665 | void CEditorView::OnViewWireframemine() { |
| 666 | RECT wire_rect; |
| 667 | |
| 668 | D3EditState.wirescr_visible = !D3EditState.wirescr_visible; |
| 669 | |
| 670 | if (!D3EditState.wirescr_visible) { |
| 671 | if (D3EditState.tile_views) { |
| 672 | DeactivateView(); |
| 673 | ActivateView(); |
| 674 | } else if (theApp.wireframe_view) |
| 675 | m_grwndWireframe.DestroyWindow(); |
| 676 | } else { |
| 677 | if (D3EditState.tile_views) { // for tiling, reinit the views |
| 678 | DeactivateView(); |
| 679 | ActivateView(); |
| 680 | } else { |
| 681 | SetRect(&wire_rect, D3EditState.wirescr_x, D3EditState.wirescr_y, D3EditState.wirescr_x + D3EditState.wirescr_w, |
| 682 | D3EditState.wirescr_y + D3EditState.wirescr_h); |
| 683 | m_grwndWireframe.Create(wire_rect, TRUE, this); |
| 684 | } |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | // We do this so that we can tell if the texture or wireframe views were closed by the user |
| 689 | // |
| 690 | void CEditorView::OnParentNotify(UINT message, LPARAM lParam) { |
| 691 | CView::OnParentNotify(message, lParam); |
| 692 | |
| 693 | // Is the texture or wireframe window closing? |
| 694 | switch (message) { |
| 695 | case WM_CREATE: |
| 696 | if (HIWORD(lParam) == IDC_TEXTURE_WND) { |
| 697 | GetParent()->GetMenu()->CheckMenuItem(ID_VIEW_TEXTUREMINE, MF_BYCOMMAND | MF_CHECKED); |
| 698 | } else if (HIWORD(lParam) == IDC_WIREFRAME_WND) { |
| 699 | GetParent()->GetMenu()->CheckMenuItem(ID_VIEW_WIREFRAMEMINE, MF_BYCOMMAND | MF_CHECKED); |
| 700 | } |
| 701 | break; |
| 702 | |
| 703 | case WM_DESTROY: |
| 704 | if (HIWORD(lParam) == IDC_TEXTURE_WND) { |
| 705 | GetParent()->GetMenu()->CheckMenuItem(ID_VIEW_TEXTUREMINE, MF_BYCOMMAND | MF_UNCHECKED); |
| 706 | } else if (HIWORD(lParam) == IDC_WIREFRAME_WND) { |
| 707 | GetParent()->GetMenu()->CheckMenuItem(ID_VIEW_WIREFRAMEMINE, MF_BYCOMMAND | MF_UNCHECKED); |
| 708 | } |
| 709 | break; |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | // ---------------------------------------------------------------------------- |
| 714 | // window menu options |
| 715 | |
| 716 | void CEditorView::OnWindowTile() { |
| 717 | // TODO: Add your command handler code here |
| 718 | D3EditState.tile_views = 1; |
| 719 | ((CMainFrame *)GetParentFrame())->DockKeypad(TRUE); |
| 720 | DeactivateView(); |
| 721 | ActivateView(); |
| 722 | } |
| 723 | |
| 724 | void CEditorView::OnWindowCascade() { |
| 725 | // TODO: Add your command handler code here |
| 726 | D3EditState.tile_views = 0; |
| 727 | ((CMainFrame *)GetParentFrame())->DockKeypad(FALSE); |
| 728 | DeactivateView(); |
| 729 | ActivateView(); |
| 730 | } |
| 731 | |
| 732 | void CEditorView::OnButtonWindowSelection() { |
| 733 | D3EditState.box_selection_mode = -(D3EditState.box_selection_mode - IN_WINDOW - ACROSS_EDGE); |
| 734 | EditorStatus("Box selection set to %s", (D3EditState.box_selection_mode == IN_WINDOW) ? "IN WINDOW" : "ACROSS EDGE"); |
| 735 | } |
| 736 | |
| 737 | void CEditorView::OnUpdateButtonWindowSelection(CCmdUI *pCmdUI) { |
| 738 | pCmdUI->SetCheck(D3EditState.box_selection_mode == ACROSS_EDGE); |
| 739 | } |
| 740 | |
| 741 | void CEditorView::OnButtonLighting() { |
| 742 | Lighting_on = !Lighting_on; |
| 743 | EditorStatus("Lighting turned %s", Lighting_on ? "ON" : "OFF"); |
| 744 | State_changed = 1; |
| 745 | } |
| 746 | |
| 747 | void CEditorView::OnUpdateButtonLighting(CCmdUI *pCmdUI) { pCmdUI->SetCheck(Lighting_on); } |
| 748 | |
| 749 | BOOL CEditorView::OnHelpInfo(HELPINFO *pHelpInfo) { |
| 750 | // TODO: Add your message handler code here and/or call default |
| 751 | switch (D3EditState.keypad_current) { |
| 752 | case TAB_TEXTURE_KEYPAD: |
| 753 | WinHelp(HID_TEXTURETAB, HELP_CONTEXT); |
| 754 | break; |
| 755 | |
| 756 | case TAB_OBJECTS_KEYPAD: |
| 757 | WinHelp(HID_OBJECTTAB, HELP_CONTEXT); |
| 758 | break; |
| 759 | |
| 760 | case TAB_LIGHTING_KEYPAD: |
| 761 | WinHelp(HID_LIGHTINGTAB, HELP_CONTEXT); |
| 762 | break; |
| 763 | |
| 764 | case TAB_PATHS_KEYPAD: |
| 765 | WinHelp(HID_PATHSTAB, HELP_CONTEXT); |
| 766 | break; |
| 767 | |
| 768 | case TAB_TRIGGER_KEYPAD: |
| 769 | WinHelp(HID_TRIGGERTAB, HELP_CONTEXT); |
| 770 | break; |
| 771 | |
| 772 | case TAB_DOORWAY_KEYPAD: |
| 773 | WinHelp(HID_DOORWAYTAB, HELP_CONTEXT); |
| 774 | break; |
| 775 | |
| 776 | case TAB_TERRAIN_KEYPAD: |
| 777 | WinHelp(HID_TERRAINTAB, HELP_CONTEXT); |
| 778 | break; |
| 779 | |
| 780 | case TAB_MEGACELL_KEYPAD: |
| 781 | WinHelp(HID_MEGACELLTAB, HELP_CONTEXT); |
| 782 | break; |
| 783 | |
| 784 | case TAB_ROOM_KEYPAD: |
| 785 | WinHelp(HID_ROOMTAB, HELP_CONTEXT); |
| 786 | break; |
| 787 | |
| 788 | default: |
| 789 | WinHelp(HID_DEFAULT, HELP_CONTEXT); |
| 790 | // return CView::OnHelpInfo(pHelpInfo); |
| 791 | } |
| 792 | return TRUE; |
| 793 | } |
| 794 | |
| 795 | void CEditorView::OnRoomAdd() { AddRoom(); } |
| 796 | |
| 797 | void CEditorView::OnRoomDelete() { |
| 798 | if (OutrageMessageBox(MBOX_YESNO, "Are you sure you want to delete Room %d?", ROOMNUM(Curroomp)) != IDYES) |
| 799 | return; |
| 800 | |
| 801 | DeleteRoomFromMine(Curroomp); |
| 802 | |
| 803 | World_changed = 1; |
| 804 | } |
| 805 | |
| 806 | void CEditorView::OnRoomGrabTexture() { theApp.main_frame->m_TextureDialog->OnTexpadGrab(); } |
| 807 | |
| 808 | void CEditorView::OnRoomNextFace() { |
| 809 | SelectNextFace(); |
| 810 | |
| 811 | EditorStatus("Face %d selected.", Curface); |
| 812 | } |
| 813 | |
| 814 | void CEditorView::OnRoomPreviousFace() { |
| 815 | SelectPrevFace(); |
| 816 | |
| 817 | EditorStatus("Face %d selected.", Curface); |
| 818 | } |
| 819 | |
| 820 | void CEditorView::OnRoomSelectByNumber() { |
| 821 | int n; |
| 822 | |
| 823 | if (InputNumber(&n, "Select Room", "Enter room number to select", this)) { |
| 824 | |
| 825 | if ((n > Highest_room_index) || !Rooms[n].used) { |
| 826 | OutrageMessageBox("Invalid room number."); |
| 827 | return; |
| 828 | } |
| 829 | |
| 830 | Curroomp = &Rooms[n]; |
| 831 | Curface = Curedge = Curvert = 0; |
| 832 | Curportal = -1; |
| 833 | |
| 834 | EditorStatus("Room %d selected.", n); |
| 835 | |
| 836 | State_changed = 1; |
| 837 | } |
| 838 | } |
| 839 | |
| 840 | void CEditorView::OnRoomPlaceRoom() { |
| 841 | if (D3EditState.current_room == -1) { |
| 842 | OutrageMessageBox("You must have a current room for this operation"); |
| 843 | return; |
| 844 | } |
| 845 | |
| 846 | if (Curroomp->faces[Curface].portal_num != -1) { |
| 847 | OutrageMessageBox("There's already a connection at the current room:face."); |
| 848 | return; |
| 849 | } |
| 850 | |
| 851 | PlaceRoom(Curroomp, Curface, D3EditState.current_room, Current_faces[D3EditState.current_room - FIRST_PALETTE_ROOM], |
| 852 | -1); |
| 853 | } |
| 854 | |
| 855 | void CEditorView::OnRoomAttachRoom() { |
| 856 | ASSERT(Placed_room != -1); |
| 857 | |
| 858 | AttachRoom(); |
| 859 | } |
| 860 | |
| 861 | void CEditorView::OnRoomBuildBridge() { |
| 862 | if ((Markedroomp == NULL) || (Markedface == -1)) { |
| 863 | OutrageMessageBox("You must have a marked face to use this function."); |
| 864 | return; |
| 865 | } |
| 866 | |
| 867 | if ((Markedroomp == Curroomp) && (Markedface == Curface)) { |
| 868 | OutrageMessageBox("The marked room:face must be different from the current room:face."); |
| 869 | return; |
| 870 | } |
| 871 | |
| 872 | BuildBridge(Curroomp, Curface, Markedroomp, Markedface); |
| 873 | } |
| 874 | |
| 875 | void CEditorView::OnRoomJoinRooms() { |
| 876 | if ((Markedroomp == NULL) || (Markedface == -1)) { |
| 877 | OutrageMessageBox("You must have a marked face to use this function."); |
| 878 | return; |
| 879 | } |
| 880 | |
| 881 | JoinRooms(Curroomp, Curface, Markedroomp, Markedface); |
| 882 | } |
| 883 | |
| 884 | void CEditorView::OnRoomMark() { SetMarkedRoom(); } |
| 885 | |
| 886 | void CEditorView::OnUpdateRoomAttachRoom(CCmdUI *pCmdUI) { pCmdUI->Enable(Placed_room != -1); } |
| 887 | |
| 888 | void CEditorView::OnRoomUnPlaceRoom() { |
| 889 | if (Placed_door != -1) { |
| 890 | FreeRoom(&Rooms[Placed_room]); |
| 891 | Placed_door = -1; |
| 892 | } |
| 893 | |
| 894 | Placed_room = -1; |
| 895 | Placed_group = NULL; |
| 896 | |
| 897 | State_changed = 1; |
| 898 | } |
| 899 | |
| 900 | void CEditorView::OnUpdateRoomUnPlaceRoom(CCmdUI *pCmdUI) { |
| 901 | if (Placed_room != -1) { |
| 902 | pCmdUI->SetText((Placed_door != -1) ? "Un-place Door" : "Un-place Room"); |
| 903 | pCmdUI->Enable(1); |
| 904 | } else if (Placed_group != NULL) { |
| 905 | pCmdUI->SetText("Un-place Group"); |
| 906 | pCmdUI->Enable(1); |
| 907 | } else |
| 908 | pCmdUI->Enable(0); |
| 909 | } |
| 910 | |
| 911 | void CEditorView::OnRoomSelectFaceByNumber() { |
| 912 | int n; |
| 913 | |
| 914 | if (InputNumber(&n, "Select Face", "Enter face number to select", this)) { |
| 915 | |
| 916 | if (n >= Curroomp->num_faces) { |
| 917 | OutrageMessageBox("Invalid face number."); |
| 918 | return; |
| 919 | } |
| 920 | |
| 921 | Curface = n; |
| 922 | Curedge = Curvert = 0; |
| 923 | |
| 924 | EditorStatus("Face %d selected.", Curface); |
| 925 | |
| 926 | State_changed = 1; |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | void CEditorView::OnRoomSaveCurrentRoom() { theApp.main_frame->m_RoomDialog->OnSaveRoomLocally(); } |
| 931 | |
| 932 | void CEditorView::OnZbutton() { |
| 933 | // TODO: Add your command handler code here |
| 934 | Use_software_zbuffer = !Use_software_zbuffer; |
| 935 | // tex_SetZBufferState (Use_software_zbuffer); // LGT: not defined |
| 936 | State_changed = 1; |
| 937 | } |
| 938 | |
| 939 | void CEditorView::OnUpdateZbutton(CCmdUI *pCmdUI) { |
| 940 | static bool first_time = 1, opengl; |
| 941 | if (first_time) { |
| 942 | first_time = 0; |
| 943 | opengl = (FindArg("-WindowGL") != 0); |
| 944 | } |
| 945 | |
| 946 | pCmdUI->Enable(!opengl); |
| 947 | pCmdUI->SetCheck(opengl || Use_software_zbuffer); |
| 948 | } |
| 949 | |
| 950 | void CEditorView::OnRoomDropRoom() { |
| 951 | if (D3EditState.current_room == -1) { |
| 952 | OutrageMessageBox("You must have a current room for this operation"); |
| 953 | return; |
| 954 | } |
| 955 | |
| 956 | DropRoom(Curroomp, Curface, D3EditState.current_room); |
| 957 | } |
| 958 | |
| 959 | void CEditorView::OnRoomPlaceTerrainRoom() { |
| 960 | int cellnum; |
| 961 | |
| 962 | if (D3EditState.current_room == -1) { |
| 963 | OutrageMessageBox("You must have a current room for this operation"); |
| 964 | return; |
| 965 | } |
| 966 | |
| 967 | if (Current_faces[D3EditState.current_room - FIRST_PALETTE_ROOM] == -1) { |
| 968 | OutrageMessageBox("You must have a face selected on the current room for this operation"); |
| 969 | return; |
| 970 | } |
| 971 | |
| 972 | if (Num_terrain_selected != 1) { |
| 973 | OutrageMessageBox("You must have one and only one cell selected this operation"); |
| 974 | return; |
| 975 | } else { |
| 976 | for (cellnum = 0; cellnum < TERRAIN_WIDTH * TERRAIN_DEPTH; cellnum++) |
| 977 | if (TerrainSelected[cellnum]) |
| 978 | break; |
| 979 | |
| 980 | ASSERT(cellnum != TERRAIN_WIDTH * TERRAIN_DEPTH); |
| 981 | } |
| 982 | |
| 983 | int result = OutrageMessageBox(MBOX_YESNOCANCEL, "Do you want to align to the terrain? NO will align with gravity."); |
| 984 | |
| 985 | if (result == IDCANCEL) |
| 986 | return; |
| 987 | |
| 988 | PlaceExternalRoom(cellnum, D3EditState.current_room, Current_faces[D3EditState.current_room - FIRST_PALETTE_ROOM], |
| 989 | (result == IDYES)); |
| 990 | } |
| 991 | |
| 992 | void CEditorView::OnRoomSwapMarkedAndCurrentRoomFace() { |
| 993 | if (Markedroomp == NULL) |
| 994 | return; |
| 995 | |
| 996 | room *troomp = Markedroomp; |
| 997 | int tface = Markedface, tedge = Markededge, tvert = Markedvert; |
| 998 | |
| 999 | Markedroomp = Curroomp; |
| 1000 | Markedface = Curface; |
| 1001 | Markededge = Curedge; |
| 1002 | Markedvert = Curvert; |
| 1003 | |
| 1004 | Curroomp = troomp; |
| 1005 | Curface = tface; |
| 1006 | Curedge = tedge; |
| 1007 | Curvert = tvert; |
| 1008 | |
| 1009 | State_changed = 1; |
| 1010 | |
| 1011 | EditorStatus("Current room:face set to %d:%d; marked room:face set to %d:%d", ROOMNUM(Curroomp), Curface, |
| 1012 | ROOMNUM(Markedroomp), Markedface); |
| 1013 | } |
| 1014 | |
| 1015 | void CEditorView::OnRoomDeleteFace() { |
| 1016 | if (Curroomp->faces[Curface].portal_num != -1) { |
| 1017 | OutrageMessageBox("You cannot delete a face that is part of a portal."); |
| 1018 | return; |
| 1019 | } |
| 1020 | |
| 1021 | if (Curroomp->num_faces == 1) { |
| 1022 | OutrageMessageBox("You cannot delete the only face in a room."); |
| 1023 | return; |
| 1024 | } |
| 1025 | |
| 1026 | if (OutrageMessageBox(MBOX_YESNO, "Are you sure you want to delete Face %d from Room %d?", Curface, |
| 1027 | ROOMNUM(Curroomp)) != IDYES) |
| 1028 | return; |
| 1029 | |
| 1030 | DeleteRoomFace(Curroomp, Curface); |
| 1031 | |
| 1032 | EditorStatus("Face %d deleted from room %d.", ROOMNUM(Curroomp), Curface); |
| 1033 | |
| 1034 | if (Curface == Curroomp->num_faces) |
| 1035 | Curface--; |
| 1036 | |
| 1037 | if (Markedface == Curroomp->num_faces) |
| 1038 | Markedface--; |
| 1039 | |
| 1040 | World_changed = 1; |
| 1041 | } |
| 1042 | |
| 1043 | void CEditorView::OnRoomSnapPlacedRoom() { |
| 1044 | ASSERT((Placed_room != -1) || (Placed_group != NULL)); |
| 1045 | |
| 1046 | if ((Curroomp != Placed_baseroomp) || (Curface != Placed_baseface)) { |
| 1047 | OutrageMessageBox("The current room & face must be the same as the base room & face for this operation."); |
| 1048 | return; |
| 1049 | } |
| 1050 | |
| 1051 | SnapRoom(Curvert); |
| 1052 | } |
| 1053 | |
| 1054 | void CEditorView::OnUpdateRoomSnapPlacedRoom(CCmdUI *pCmdUI) { |
| 1055 | pCmdUI->Enable(((Placed_room != -1) || (Placed_group != NULL)) && (Placed_baseroomp != NULL)); |
| 1056 | |
| 1057 | if (Placed_room != -1) { |
| 1058 | pCmdUI->SetText((Placed_door != -1) ? "Snap Placed Door" : "Snap Placed Room"); |
| 1059 | pCmdUI->Enable(1); |
| 1060 | } else if (Placed_group != NULL) { |
| 1061 | pCmdUI->SetText("Snap Placed Group"); |
| 1062 | pCmdUI->Enable(1); |
| 1063 | } else |
| 1064 | pCmdUI->Enable(0); |
| 1065 | } |
| 1066 | |
| 1067 | void CEditorView::OnRoomJoinAdjacentFaces() { |
| 1068 | if (Markedroomp == NULL) { |
| 1069 | OutrageMessageBox("You must have a Marked Room for this operation."); |
| 1070 | return; |
| 1071 | } |
| 1072 | |
| 1073 | if (Markedroomp == Curroomp) { |
| 1074 | OutrageMessageBox("The Marked room cannot be the same as the Current room for this operation."); |
| 1075 | return; |
| 1076 | } |
| 1077 | |
| 1078 | JoinAllAdjacentFaces(Curroomp, Markedroomp); |
| 1079 | } |
| 1080 | |
| 1081 | void CEditorView::OnRoomPropagateToAll() { |
| 1082 | int answer; |
| 1083 | |
| 1084 | answer = OutrageMessageBox( |
| 1085 | MBOX_YESNOCANCEL, |
| 1086 | "Propagate only to faces with the same texture?\n(Answering No will propagate to all faces in the room.)"); |
| 1087 | |
| 1088 | if (answer == IDCANCEL) |
| 1089 | return; |
| 1090 | |
| 1091 | PropagateToAllFaces(Curroomp, Curface, (answer == IDYES)); |
| 1092 | } |
| 1093 | |
| 1094 | void CEditorView::OnRoomSplitFace() { |
| 1095 | if (OutrageMessageBox(MBOX_YESNO, "Are you sure you want to triangulate the current face?") == IDYES) |
| 1096 | TriangulateFace(Curroomp, Curface, Curvert); |
| 1097 | } |
| 1098 | |
| 1099 | void CEditorView::OnRoomDeletePortal() { |
| 1100 | if (Curportal == -1) { |
| 1101 | OutrageMessageBox("You must have a current portal for this operation."); |
| 1102 | return; |
| 1103 | } |
| 1104 | |
| 1105 | if (OutrageMessageBox(MBOX_YESNO, "Are you sure you want to delete portal %d from room %d (& its connecting portal)?", |
| 1106 | Curportal, ROOMNUM(Curroomp)) == IDYES) { |
| 1107 | DeletePortalPair(Curroomp, Curportal); |
| 1108 | Curportal = -1; |
| 1109 | } |
| 1110 | } |
| 1111 | |
| 1112 | void CEditorView::OnRoomSnapPointToEdge() { |
| 1113 | if (Markedroomp == NULL) { |
| 1114 | OutrageMessageBox("You must have a marked vertex to use this function."); |
| 1115 | return; |
| 1116 | } |
| 1117 | |
| 1118 | SnapPointToEdge( |
| 1119 | Markedroomp, Markedroomp->faces[Markedface].face_verts[Markedvert], |
| 1120 | &Curroomp->verts[Curroomp->faces[Curface].face_verts[Curedge]], |
| 1121 | &Curroomp->verts[Curroomp->faces[Curface].face_verts[(Curedge + 1) % Curroomp->faces[Curface].num_verts]]); |
| 1122 | } |
| 1123 | |
| 1124 | void CEditorView::OnRoomUndoSnap() { UndoSnap(); } |
| 1125 | |
| 1126 | void CEditorView::OnUpdateRoomUndoSnap(CCmdUI *pCmdUI) { pCmdUI->Enable(Snap_roomnum != -1); } |
| 1127 | |
| 1128 | void CEditorView::OnRoomSnapPointToPoint() { |
| 1129 | if (Markedroomp == NULL) { |
| 1130 | OutrageMessageBox("You must have a marked vertex to use this function."); |
| 1131 | return; |
| 1132 | } |
| 1133 | |
| 1134 | SnapPointToPoint(Markedroomp, Markedroomp->faces[Markedface].face_verts[Markedvert], Curroomp, |
| 1135 | Curroomp->faces[Curface].face_verts[Curvert]); |
| 1136 | } |
| 1137 | |
| 1138 | void CEditorView::OnReinitOpengl() { |
| 1139 | // TODO: Add your command handler code here |
| 1140 | if (FindArg("-WindowGL")) { |
| 1141 | EditorStatus("Reinitting OpenGL"); |
| 1142 | rend_Close(); |
| 1143 | rend_Init(RENDERER_OPENGL, Descent, &Render_preferred_state); |
| 1144 | } else { |
| 1145 | EditorStatus("OpenGL command line argument not set."); |
| 1146 | } |
| 1147 | } |
| 1148 | |
| 1149 | void CEditorView::OnUpdateReinitOpengl(CCmdUI *pCmdUI) {} |
| 1150 | |
| 1151 | void CEditorView::OnFileRemoveExtraPoints() { RemoveAllDuplicateAndUnusedPoints(); } |
| 1152 | |
| 1153 | void CEditorView::OnRoomBuildSmoothBridge() { |
| 1154 | if ((Markedroomp == NULL) || (Markedface == -1)) { |
| 1155 | OutrageMessageBox("You must have a marked face to use this function."); |
| 1156 | return; |
| 1157 | } |
| 1158 | |
| 1159 | if ((Markedroomp == Curroomp) && (Markedface == Curface)) { |
| 1160 | OutrageMessageBox("The marked room:face must be different from the current room:face."); |
| 1161 | return; |
| 1162 | } |
| 1163 | |
| 1164 | BuildSmoothBridge(Markedroomp, Markedface, Curroomp, Curface); |
| 1165 | } |
| 1166 | |
| 1167 | void CEditorView::OnRoomJoinRoomsExact() { |
| 1168 | if ((Markedroomp == NULL) || (Markedface == -1)) { |
| 1169 | OutrageMessageBox("You must have a marked face to use this function."); |
| 1170 | return; |
| 1171 | } |
| 1172 | |
| 1173 | JoinRoomsExact(Curroomp, Curface, Markedroomp, Markedface); |
| 1174 | } |
| 1175 | |
| 1176 | #define POPUP_OUTLINE_ON 0x60 |
| 1177 | #define POPUP_OUTLINE_MINE 0x61 |
| 1178 | #define POPUP_OUTLINE_TERRAIN 0x62 |
| 1179 | #define POPUP_OUTLINE_SKY 0x63 |
| 1180 | #define POPUP_OUTLINE_OBJECTS 0x64 |
| 1181 | |
| 1182 | bool CEditorView::SetupPopup(CMenu *popup) { |
| 1183 | bool ret; |
| 1184 | ret = true; |
| 1185 | int grayed = (Outline_mode & OM_ON) ? 0 : MF_GRAYED; |
| 1186 | |
| 1187 | if (!popup->AppendMenu((Outline_mode & OM_ON) ? MF_CHECKED : MF_UNCHECKED, POPUP_OUTLINE_ON, "On")) |
| 1188 | ret = false; |
| 1189 | if (!popup->AppendMenu(grayed + ((Outline_mode & OM_MINE) ? MF_CHECKED : MF_UNCHECKED), POPUP_OUTLINE_MINE, "Mine")) |
| 1190 | ret = false; |
| 1191 | if (!popup->AppendMenu(grayed + ((Outline_mode & OM_TERRAIN) ? MF_CHECKED : MF_UNCHECKED), POPUP_OUTLINE_TERRAIN, |
| 1192 | "Terrain")) |
| 1193 | ret = false; |
| 1194 | if (!popup->AppendMenu(grayed + ((Outline_mode & OM_SKY) ? MF_CHECKED : MF_UNCHECKED), POPUP_OUTLINE_SKY, "Sky")) |
| 1195 | ret = false; |
| 1196 | if (!popup->AppendMenu(grayed + ((Outline_mode & OM_OBJECTS) ? MF_CHECKED : MF_UNCHECKED), POPUP_OUTLINE_OBJECTS, |
| 1197 | "Objects")) |
| 1198 | ret = false; |
| 1199 | |
| 1200 | return ret; |
| 1201 | } |
| 1202 | |
| 1203 | BOOL CEditorView::OnCommand(WPARAM wParam, LPARAM lParam) { |
| 1204 | int old_outline_mode = Outline_mode; |
| 1205 | |
| 1206 | if (HIWORD(wParam) == 0) { |
| 1207 | switch (LOWORD(wParam)) { |
| 1208 | case POPUP_OUTLINE_ON: |
| 1209 | Outline_mode ^= OM_ON; |
| 1210 | EditorStatus("Outline mode turned %s", OUTLINE_ON(0) ? "ON" : "OFF"); |
| 1211 | break; |
| 1212 | case POPUP_OUTLINE_MINE: |
| 1213 | Outline_mode ^= OM_MINE; |
| 1214 | EditorStatus("Mine outline turned %s", OUTLINE_ON(OM_MINE) ? "ON" : "OFF"); |
| 1215 | break; |
| 1216 | case POPUP_OUTLINE_TERRAIN: |
| 1217 | Outline_mode ^= OM_TERRAIN; |
| 1218 | EditorStatus("Terrain outline turned %s", OUTLINE_ON(OM_TERRAIN) ? "ON" : "OFF"); |
| 1219 | break; |
| 1220 | case POPUP_OUTLINE_SKY: |
| 1221 | Outline_mode ^= OM_SKY; |
| 1222 | EditorStatus("Sky outline turned %s", OUTLINE_ON(OM_SKY) ? "ON" : "OFF"); |
| 1223 | break; |
| 1224 | case POPUP_OUTLINE_OBJECTS: |
| 1225 | Outline_mode ^= OM_OBJECTS; |
| 1226 | EditorStatus("Object outline turned %s", OUTLINE_ON(OM_OBJECTS) ? "ON" : "OFF"); |
| 1227 | break; |
| 1228 | } |
| 1229 | } |
| 1230 | |
| 1231 | State_changed = (Outline_mode != old_outline_mode); |
| 1232 | |
| 1233 | return CView::OnCommand(wParam, lParam); |
| 1234 | } |
| 1235 | |
| 1236 | void CEditorView::OnRoomStartNewFace() { StartNewFace(); } |
| 1237 | |
| 1238 | void CEditorView::OnRoomFinishNewFace() { EndNewFace(); } |
| 1239 | |
| 1240 | void CEditorView::OnRoomAddVertToNewFace() { AddNewFaceVert(); } |
| 1241 | |
| 1242 | #include "osiris_predefs.h" |
| 1243 | extern bool StripLeadingTrailingSpaces(char *s); |
| 1244 | |
| 1245 | void RenameRoom() { |
| 1246 | char tempname[ROOM_NAME_LEN + 1] = ""; |
| 1247 | |
| 1248 | if (Curroomp->name) { |
| 1249 | ASSERT(strlen(Curroomp->name) <= ROOM_NAME_LEN); |
| 1250 | strcpy(tempname, Curroomp->name); |
| 1251 | } |
| 1252 | |
| 1253 | try_again:; |
| 1254 | if (!InputString(tempname, ROOM_NAME_LEN, "Room Name", "Enter a new name:")) |
| 1255 | return; |
| 1256 | |
| 1257 | if (StripLeadingTrailingSpaces(tempname)) |
| 1258 | EditorMessageBox("Note: Leading and/or trailing spaces have been removed from this name (\"%s\")", tempname); |
| 1259 | |
| 1260 | int n = osipf_FindRoomName(tempname); |
| 1261 | if ((n != -1) && (n != ROOMNUM(Curroomp))) { |
| 1262 | EditorMessageBox("Room %d already has this name.", n); |
| 1263 | goto try_again; |
| 1264 | } |
| 1265 | |
| 1266 | if (Curroomp->name) { |
| 1267 | mem_free(Curroomp->name); |
| 1268 | Curroomp->name = NULL; |
| 1269 | } |
| 1270 | |
| 1271 | if (strlen(tempname)) { |
| 1272 | Curroomp->name = (char *)mem_malloc(strlen(tempname) + 1); |
| 1273 | strcpy(Curroomp->name, tempname); |
| 1274 | } |
| 1275 | |
| 1276 | World_changed = 1; |
| 1277 | } |
| 1278 | |
| 1279 | void CEditorView::OnRoomRenameRoom() { RenameRoom(); } |
| 1280 | |
| 1281 | void CEditorView::OnUpdateRoomSetCenterFromViewer(CCmdUI *pCmdUI) { pCmdUI->Enable(!OBJECT_OUTSIDE(Viewer_object)); } |
| 1282 | |
| 1283 | void CEditorView::OnRoomSetCenterFromViewer() { |
| 1284 | ASSERT(!OBJECT_OUTSIDE(Viewer_object)); |
| 1285 | |
| 1286 | if (Viewer_object->roomnum != ROOMNUM(Curroomp)) { |
| 1287 | EditorMessageBox("The viewer must be in the current room for this operation."); |
| 1288 | return; |
| 1289 | } |
| 1290 | |
| 1291 | room *rp = &Rooms[Viewer_object->roomnum]; |
| 1292 | |
| 1293 | rp->path_pnt = Viewer_object->pos; |
| 1294 | rp->flags |= RF_MANUAL_PATH_PNT; |
| 1295 | |
| 1296 | EditorStatus("Center point set for room %d", ROOMNUM(Curroomp)); |
| 1297 | |
| 1298 | World_changed = 1; |
| 1299 | } |
| 1300 | |
| 1301 | void CEditorView::OnUpdateRoomClearCenterPoint(CCmdUI *pCmdUI) { |
| 1302 | pCmdUI->Enable((Editor_view_mode == VM_MINE) && ((Curroomp->flags & RF_MANUAL_PATH_PNT) != 0)); |
| 1303 | } |
| 1304 | |
| 1305 | void CEditorView::OnRoomClearCenterPoint() { |
| 1306 | ASSERT(Curroomp->flags & RF_MANUAL_PATH_PNT); |
| 1307 | |
| 1308 | Curroomp->flags &= ~RF_MANUAL_PATH_PNT; |
| 1309 | |
| 1310 | EditorStatus("Center point cleared for room %d", ROOMNUM(Curroomp)); |
| 1311 | |
| 1312 | World_changed = 1; |
| 1313 | } |
| 1314 | |
| 1315 | void CEditorView::OnRoomCombine() { |
| 1316 | if (Markedroomp == NULL) { |
| 1317 | OutrageMessageBox("You must have a Marked Room for this operation."); |
| 1318 | return; |
| 1319 | } |
| 1320 | |
| 1321 | int marked_roomnum = ROOMNUM(Markedroomp); |
| 1322 | |
| 1323 | if (CombineRooms(Curroomp, Markedroomp)) |
| 1324 | EditorStatus("Room %d merged into room %d\n", marked_roomnum, ROOMNUM(Curroomp)); |
| 1325 | } |
| 1326 | |
| 1327 | void FixDegenerateFaces(); |
| 1328 | |
| 1329 | void CEditorView::OnFileFixDegenerateFaces() { FixDegenerateFaces(); } |
| 1330 | |
| 1331 | void CEditorView::OnRoomSnapPointToFace() { |
| 1332 | if (Markedroomp == NULL) { |
| 1333 | OutrageMessageBox("You must have a marked vertex to use this function."); |
| 1334 | return; |
| 1335 | } |
| 1336 | |
| 1337 | SnapPointToFace(Markedroomp, Markedroomp->faces[Markedface].face_verts[Markedvert], |
| 1338 | &Curroomp->verts[Curroomp->faces[Curface].face_verts[Curedge]], &Curroomp->faces[Curface].normal); |
| 1339 | } |
| 1340 | |
| 1341 | #define MARK_TEXTURE 1 |
| 1342 | |
| 1343 | void CEditorView::OnRoomLinkToNewExternal() { |
| 1344 | void LinkToExternalRoom(room * rp, int nfaces, int *facenums); |
| 1345 | int n = 0, facelist[MAX_FACES_PER_ROOM]; |
| 1346 | |
| 1347 | for (int i = 0; i < Curroomp->num_faces; i++) { |
| 1348 | if ((Curroomp->faces[i].portal_num == -1) && (Curroomp->faces[i].tmap == MARK_TEXTURE)) |
| 1349 | facelist[n++] = i; |
| 1350 | } |
| 1351 | |
| 1352 | if (n) { |
| 1353 | if (OutrageMessageBox(MBOX_YESNO, "Do you want to create a new room linked to the %d selected faces in room %d?", n, |
| 1354 | ROOMNUM(Curroomp)) != IDYES) |
| 1355 | return; |
| 1356 | |
| 1357 | LinkToExternalRoom(Curroomp, n, facelist); |
| 1358 | } else |
| 1359 | OutrageMessageBox("You have no faces selected in room %d.\n\nTo select a face, texture it with Texture %d, \"%s\".", |
| 1360 | ROOMNUM(Curroomp), MARK_TEXTURE, GameTextures[MARK_TEXTURE].name); |
| 1361 | } |
| 1362 | |
| 1363 | void CEditorView::OnRoomDeleteVert() { |
| 1364 | if (Curroomp->faces[Curface].num_verts <= 3) { |
| 1365 | OutrageMessageBox("You cannot delete a vertex from a face with three or fewer vertices."); |
| 1366 | return; |
| 1367 | } |
| 1368 | |
| 1369 | if (OutrageMessageBox(MBOX_YESNO, "Are you sure you want to delete vertex %d (%d) from room %d face %d?", Curvert, |
| 1370 | Curroomp->faces[Curface].face_verts[Curvert], ROOMNUM(Curroomp), Curface) == IDYES) { |
| 1371 | DeletePointFromFace(Curroomp, Curface, Curvert); |
| 1372 | Curvert = 0; |
| 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | void CEditorView::OnRoomFaceAddVertToEdge() { |
| 1377 | void SplitEdge(room * rp, int facenum, int edgenum, float position); |
| 1378 | |
| 1379 | char buf[10] = "0.5"; |
| 1380 | |
| 1381 | if (InputString(buf, sizeof(buf), "New point position", |
| 1382 | "Please enter the position of the new point, from 0.0 to 1.0")) { |
| 1383 | SplitEdge(Curroomp, Curface, Curedge, atof(buf)); |
| 1384 | Curvert = Curedge + 1; |
| 1385 | } |
| 1386 | } |
| 1387 | |
| 1388 | void CEditorView::OnRoomFaceMoveVertOnEdge() { |
| 1389 | void MoveVert(room * rp, int facenum, int vertnum, float new_position); |
| 1390 | |
| 1391 | char buf[10] = "0.5"; |
| 1392 | |
| 1393 | if (InputString(buf, sizeof(buf), "New point position", |
| 1394 | "Please enter the new position of the point, from 0.0 to 1.0")) { |
| 1395 | MoveVert(Curroomp, Curface, Curvert, atof(buf)); |
| 1396 | } |
| 1397 | } |
| 1398 | |
| 1399 | void CEditorView::OnRoomFaceSplitFace() { |
| 1400 | void SplitFace(room * rp, int facenum, int v0, int v1); |
| 1401 | |
| 1402 | if ((Curroomp != Markedroomp) || (Curface != Markedface)) { |
| 1403 | OutrageMessageBox("Cannot split face: the Marked & Current faces must be the same for this operation."); |
| 1404 | return; |
| 1405 | } |
| 1406 | |
| 1407 | int n_faces = Curroomp->num_faces; |
| 1408 | |
| 1409 | SplitFace(Curroomp, Curface, Curvert, Markedvert); |
| 1410 | |
| 1411 | Curface = n_faces - 1; |
| 1412 | Curedge = Curvert = 0; |
| 1413 | Markedroomp = NULL; |
| 1414 | } |
| 1415 | |
| 1416 | void CEditorView::OnRoomFaceDeleteVertOnEdge() { |
| 1417 | void DeleteVert(room * rp, int facenum, int vertnum); |
| 1418 | |
| 1419 | DeleteVert(Curroomp, Curface, Curvert); |
| 1420 | } |
| 1421 | |
| 1422 | void CEditorView::OnRoomMergeObjectIntoRoom() { |
| 1423 | if (MergeObjectIntoRoom(Curroomp, Cur_object_index)) |
| 1424 | Cur_object_index = -1; |
| 1425 | } |
| 1426 | |
| 1427 | void CEditorView::OnRoomDeleteConnectedFaces() { |
| 1428 | if (OutrageMessageBox( |
| 1429 | MBOX_YESNO, |
| 1430 | "This function will delete all faces connected to room %d face %d. This could be very dangerous.\n\n" |
| 1431 | "Are you sure you want to continue?", |
| 1432 | ROOMNUM(Curroomp), Curface) != IDYES) |
| 1433 | return; |
| 1434 | |
| 1435 | DeleteAllConnectedFaces(Curroomp, Curface); |
| 1436 | |
| 1437 | Curface = 0; |
| 1438 | |
| 1439 | if (Markedroomp == Curroomp) |
| 1440 | Markedroomp = NULL; |
| 1441 | } |
| 1442 | |
| 1443 | void CEditorView::OnRoomRotatePlacedRoom45Degrees() { |
| 1444 | Placed_room_angle += 65536 / 8; |
| 1445 | |
| 1446 | ComputePlacedRoomMatrix(); |
| 1447 | |
| 1448 | State_changed = 1; |
| 1449 | } |
| 1450 | |
| 1451 | void CEditorView::OnRoomPropagateToAdjacentCoplanarFaces() { |
| 1452 | extern void PropagateToConnectedFaces(room * rp, int facenum); |
| 1453 | |
| 1454 | PropagateToConnectedFaces(Curroomp, Curface); |
| 1455 | } |
| 1456 | |
| 1457 | void CEditorView::OnViewFlip() { |
| 1458 | Viewer_object->orient.fvec = -Viewer_object->orient.fvec; |
| 1459 | Viewer_object->orient.rvec = -Viewer_object->orient.rvec; |
| 1460 | |
| 1461 | Viewer_moved = 1; |
| 1462 | } |
| 1463 | |
| 1464 | void CEditorView::OnFileRemoveDuplicateFacesFromCurrentRoom() { RemoveDuplicateFaces(Curroomp); } |