///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileListWads () { SET_HELP_CONTEXT(List_opened_WAD_files); // Display the dialog box with the list of wad files TWadlistDialog (this).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileBuildMain () { WadPtr wad ; SET_HELP_CONTEXT(Build_new_main); // // Display standard Open dialog box to select a file name. // *FileData.FileName = 0; if (TFileSaveDialog(this, FileData).Execute() == IDOK) { // Check that WAD file isn't opened in our list for (wad = WadFileList; wad != NULL ; wad = wad->next) if (stricmp( FileData.FileName, wad->filename) == 0) break; if (wad) { Notify ("File \"%s\" is opened and cannot be overwritten.", FileData.FileName); goto End; } // Everything is ok, we can build the new file BuildNewMainWad(FileData.FileName, FALSE); } End: RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileOpenWad () { // save current working directory (of windeu32.exe) // the TFileOpenDialog below is going to set // it to the folder of the file being opened... char workdir[256]; GetCurrentDirectory(256, workdir); SET_HELP_CONTEXT(Open_WAD_file); // // Display standard Open dialog box to select a file name. // *FileData.FileName = 0; if (TFileOpenDialog(this, FileData).Execute() == IDOK) { // restore workingdirectory to folder of windeu32.exe SetCurrentDirectory(workdir); #if 0 OpenPatchWad(FileData.FileName); CloseUnusedWadFiles(); #endif // Sets a new client window (the editor) and destroy // the old one (the main client) TMainFrame *MainFrame = TYPESAFE_DOWNCAST (GetApplication()->GetMainWindow(), TMainFrame); MainFrame->EditLevel (FileData.FileName, FALSE) ; } RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileExtractRaw () { static char ObjectName[12]; WadPtr wad; MDirPtr entry; FILE *file; SET_HELP_CONTEXT(Extract_object); // Get objet name // Stupid InputDialog box, would be better with a list box if ( TInputDialog (this, "Enter object name", "Object :", ObjectName, 12).Execute() != IDOK ) goto End; // Check the name of the object exists for (entry = MasterDir ; entry != NULL ; entry = entry->next) if ( strnicmp (entry->dir.name, ObjectName, 8) == 0 ) break; if ( entry == NULL ) { Notify ("The object \"%s\" doesn't exist", ObjectName); goto End; } // // Display standard Open dialog box to select a file name. // *FileData.FileName = 0; if (TFileSaveDialog(this, FileData).Execute() != IDOK) goto End; // Check WAD isn't opened for (wad = WadFileList; wad; wad = wad->next) if (!stricmp(FileData.FileName, wad->filename)) break; if (wad) { Notify ("You may not overwrite an opened Wad file with raw data"); goto End; } // Opening .RAW file in .WAD entry WorkMessage ("Saving directory entry data to \"%s\".", FileData.FileName); file = fopen(FileData.FileName, "wb"); if (file == NULL) { Notify ("Error opening output file \"%s\"", FileData.FileName); } else { SaveEntryToRawFile(file, ObjectName); fclose(file); } End: RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // WinDEUApp // --------- // void WinDEUApp::CmHelpAbout () { // // Show the modal dialog. // SET_HELP_CONTEXT(About_WinDEU); WindeuAboutDlg(GetMainWindow()).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmEditorCreate () { char LevelName[9]; SET_HELP_CONTEXT(Create_level); // Executes the dialog box to get level number #if 0 sprintf(LevelName, "temp.roo"); if (1) #endif { // Sets a new client window (the editor) and destroy // the old one (the main client) TMainFrame *MainFrame = TYPESAFE_DOWNCAST(GetApplication()->GetMainWindow(), TMainFrame); MainFrame->EditLevel (LevelName, TRUE) ; } RESTORE_HELP_CONTEXT(); return; // 'this' is not valid anymore }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmEditorEdit () { return; // We don't like this option ARK #if 0 char LevelName[9]; SET_HELP_CONTEXT(Edit_level); // Executes the dialog box to get level number if (TEpisodeMissionDialog (this, LevelName).Execute() == IDOK) { // Sets a new client window (the editor) and destroy // the old one (the main client) TMainFrame *MainFrame = TYPESAFE_DOWNCAST (GetApplication()->GetMainWindow(), TMainFrame); MainFrame->EditLevel (LevelName, FALSE) ; } RESTORE_HELP_CONTEXT(); return; // 'this' is not valid anymore #endif }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileGroup () { WadPtr wad ; SET_HELP_CONTEXT(Group_WAD_files); if (WadFileList->next == NULL || WadFileList->next->next == NULL) { Notify ("You need at least two open wad files " "if you want to group them."); goto End; } // // Display standard Open dialog box to select a file name. // *FileData.FileName = 0; if (TFileSaveDialog(this, FileData).Execute() == IDOK) { // Check that WAD file isn't opened in our list for (wad = WadFileList ; wad != NULL ; wad = wad->next) if (stricmp( FileData.FileName, wad->filename) == 0) break; if (wad) { Notify ("File \"%s\" is opened and cannot be overwritten.", FileData.FileName); goto End; } // Everithing is ok, wa can build the new file BuildNewMainWad(FileData.FileName, TRUE); } End: RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmEditorViewFTextures () { SET_HELP_CONTEXT(View_Floor_Ceiling_textures); TViewFloorTextureDialog(this).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmEditorViewWTextures () { SET_HELP_CONTEXT(View_Wall_textures); TViewWallTextureDialog(this).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmEditorViewSprites () { SET_HELP_CONTEXT(View_Sprites); TViewSpriteDialog(this).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmEditorDump () { SET_HELP_CONTEXT(Dump_entry); TViewEntryDialog(this).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileListMaster () { SET_HELP_CONTEXT(List_master_directory); TMasterDialog(this).Execute(); RESTORE_HELP_CONTEXT(); }
///////////////////////////////////////////////////////////////// // TMainClient // ----------- // void TMainClient::CmFileInsertRaw () { static char ObjectName[12]; char input[MAX_PATH]; MDirPtr entry; FILE *raw; FILE *file; WadPtr wad; SET_HELP_CONTEXT(Insert_RAW_file); // // Display standard Open dialog box to select a file name. // *FileData.FileName = 0; if (TFileOpenDialog(this, FileData).Execute() != IDOK) goto End; // Get objet name //TODO: Stupid InputDialog box, would be better with a list box if ( TInputDialog (this, "Enter object name", "Object :", ObjectName, 12).Execute() != IDOK ) goto End; // Check the name of the object exists for (entry = MasterDir ; entry != NULL ; entry = entry->next) if ( strnicmp (entry->dir.name, ObjectName, 8) == 0 ) break; if ( entry == NULL ) { Notify ("The object \"%s\" doesn't exist", ObjectName); goto End; } // Check WAD file isn't opened raw = fopen(FileData.FileName, "rb"); if (raw == NULL) { Notify ("Error opening input file \"%s\"", FileData.FileName); goto End; } // kluge: Check WAD isn't opened strcpy (input, ObjectName); strcat (input, ".WAD"); for (wad = WadFileList; wad; wad = wad->next) if (!stricmp( input, wad->filename)) break; if (wad) { Notify ("The Wad file \"%s\" is already in use. You may not " "overwrite it.", input); goto End; } // Opening .RAW file in .WAD entry WorkMessage ("Including new object %s in \"%s\".", ObjectName, input); file = fopen (input, "wb"); if (file == NULL) Notify ("Error opening output file \"%s\"", input); SaveEntryFromRawFile (file, raw, ObjectName); fclose(raw); fclose(file); End: RESTORE_HELP_CONTEXT(); }
////////////////////////////////////////////////////////////////////// // TThingEditDialog // ---------------- // void TThingEditDialog::CmOk () { // Cannot close if edit controls not valid if ( !CanClose() ) return; if (pDontGenerate->GetCheck() == BF_CHECKED) CurThing.flags |= THING_FLAG_DONTGENERATE; else CurThing.flags &= ~THING_FLAG_DONTGENERATE; // Get thing position char tmp[20]; pXPosEdit->GetText(tmp, 9); if ( CurThing.xpos != atoi(tmp) ) ConfirmData.pXPosCheck = TRUE; CurThing.xpos = atoi(tmp); pYPosEdit->GetText(tmp, 9); if ( CurThing.ypos != atoi(tmp) ) ConfirmData.pYPosCheck = TRUE; CurThing.ypos = atoi(tmp); pXExit->GetText(tmp, 9); if ( CurThing.xExitPos != atoi(tmp) ) ConfirmData.pExitCheck = TRUE; CurThing.xExitPos = atoi(tmp); pYExit->GetText(tmp, 9); if ( CurThing.yExitPos != atoi(tmp) ) ConfirmData.pExitCheck = TRUE; CurThing.yExitPos = atoi(tmp); GetAngle(); pComment->GetWindowText(CurThing.comment,sizeof(CurThing.comment)); if (CurThing.type == kodEntrance) { // CurThing.id = SetEntrance(RoomID, CurThing.id, CurThing.xpos, CurThing.ypos, CurThing.angle, CurThing.comment); } // Update confirm data for X and Y pos // DEBUG: This doesn't work !!! (always FALSE) // ConfirmData.pXPosCheck = pXPosEdit->IsModified(); // ConfirmData.pYPosCheck = pYPosEdit->IsModified(); // Do we made changes ? TPtr pThing = &Things[SelThings->objnum]; if ( memcmp (pThing, &CurThing, sizeof(Thing)) != 0 ) { MadeChanges = TRUE; } // Update first thing in list *pThing = CurThing; // If more than one thing, copy selected attributes to them if ( SelThings->next != NULL ) { SET_HELP_CONTEXT(Confirming_copy_of_Thing_attributes); if ( TConfirmThingDialog (this, ConfirmData).Execute() == IDOK ) { // Copy the selected attributes of CurThing to the selection list for (SelPtr cur = SelThings->next ; cur != NULL ; cur = cur->next ) { Thing HUGE *pThing = &Things[cur->objnum]; Thing ThingBefore = *pThing; // Copy before changes if ( ConfirmData.pXPosCheck ) pThing->xpos = CurThing.xpos; if ( ConfirmData.pYPosCheck ) pThing->ypos = CurThing.ypos; if ( ConfirmData.pAngleCheck )pThing->angle = CurThing.angle; if ( ConfirmData.pTypeCheck ) pThing->type = CurThing.type; if ( ConfirmData.pExitCheck ) { pThing->when = CurThing.when; pThing->xExitPos = CurThing.xExitPos; pThing->yExitPos = CurThing.yExitPos; } if ( ConfirmData.pSubTypeCheck) pThing->when = CurThing.when; strcpy(pThing->comment,CurThing.comment); pThing->flags = CurThing.flags; if (pThing->type == kodEntrance) { // pThing->id = SetEntrance(RoomID, pThing->id, pThing->xpos, pThing->ypos, pThing->angle, pThing->comment); } // Did we made changes? if ( memcmp(pThing, &ThingBefore, sizeof(Thing)) != 0 ) MadeChanges; } } RESTORE_HELP_CONTEXT(); } // Close dialog box TDialog::CmOk(); }