MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GameToEditor

Function GameToEditor

editor/gameeditor.cpp:601–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599uint16_t *Save_sky_data = NULL;
600
601void GameToEditor(bool set_viewer_from_player) {
602 /* We have to reinitialize the DDGR system for windowed mode.
603 This will annihilate all previous DDGR settings.
604 */
605 Cinematic_Close();
606
607 ddio_init_info io_info;
608
609 theApp.pause();
610 // Sleep to prevent race conditions with the display drivers
611 Sleep(2000);
612
613 // Close down whatever renderer we were using and restore the software renderer
614 rend_Init(RENDERER_OPENGL, Saved_editor_app, NULL);
615
616 if (Game_screen)
617 delete Game_screen;
618
619 // Restore saved game if one exists
620 if (Temp_level_saved) {
621 char filename[_MAX_PATH];
622
623 ddio_MakePath(filename, Base_directory, "GameSave.D3L", NULL); // make explicit path
624 LoadLevel(filename);
625 Temp_level_saved = 0;
626 }
627
628 // if no player vars back from the game, use the viewer from the file
629 if (editor_player_roomnum == -1) {
630 set_viewer_from_player = 0;
631 editor_player_roomnum = Player_object->roomnum;
632 }
633
634 // Set editor to mine or terrain mode based on current player position
635 Editor_view_mode = ROOMNUM_OUTSIDE(editor_player_roomnum) ? VM_TERRAIN : VM_MINE;
636
637 // Make sure there's a viewer object
638 SetEditorViewer();
639
640 // Move the viewer to the player's (pre-restore) position, if wasn't playing from the editor
641 if (set_viewer_from_player)
642 ObjSetPos(Viewer_object, &editor_player_pos, editor_player_roomnum, &editor_player_orient, false);
643
644 // Reset previous working directory
645 ddio_SetWorkingDir(Editor_dir);
646
647 // close down video system only!
648 ddvid_Close();
649
650 ASSERT((OBJECT_OUTSIDE(Viewer_object) != 0) == (Editor_view_mode == VM_TERRAIN));
651
652 SlewStop(Viewer_object);
653
654 // Close forcefeedback
655 ForceClose();
656
657 // restore Current OS object.
658 ddio_Close();

Callers 1

RunGameFromEditorFunction · 0.85

Calls 15

Cinematic_CloseFunction · 0.85
LoadLevelFunction · 0.85
SetEditorViewerFunction · 0.85
ObjSetPosFunction · 0.85
ddvid_CloseFunction · 0.85
SlewStopFunction · 0.85
ForceCloseFunction · 0.85
ddio_CloseFunction · 0.85
CloseD3MusicFunction · 0.85
ddio_InitFunction · 0.85
Cinematic_InitFunction · 0.85
ForceInitFunction · 0.85

Tested by

no test coverage detected