diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 37ce393e..2f1adace 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -49,6 +49,9 @@ include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GNUINSTALLDIRS) option(CORE "Build the core" ON) option(BASE "Build the base game code" ON) option(D3XP "Build the d3xp game code" ON) +if(MSVC) # TODO: does this work? + option(TOOLS "build the tools game code ( Windows only )" OFF) +endif() option(DEDICATED "Build the dedicated server" OFF) option(ONATIVE "Optimize for the host CPU" OFF) option(SDL2 "Use SDL2 instead of SDL1.2" ON) @@ -149,6 +152,11 @@ else() set(CURL_LIBRARY "") endif() +if(MSVC) + # This is required for tools on windows. + find_package(MFC) +endif() + # compiler specific flags if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_compile_options(-pipe) @@ -509,12 +517,6 @@ set(src_ui add_globbed_headers(src_ui "ui") -set(src_tools - tools/guied/GEWindowWrapper_stub.cpp -) - -# TODO: add_globbed_headers(src_tools "tools/guied") - set(src_idlib idlib/bv/Bounds.cpp idlib/bv/Frustum.cpp @@ -734,6 +736,78 @@ set(src_core set(src_stub_openal sys/stub/openal_stub.cpp) set(src_stub_gl sys/stub/stub_gl.cpp) + +set(src_tools + tools/guied/GEWindowWrapper_stub.cpp +) + +# TODO: add_globbed_headers(src_tools "tools/guied") + +# Begin normal tools code +if (TOOLS AND MFC_FOUND AND MSVC) + set(ALLOWRESOURCES ON) + # Common files. + file(GLOB src_comafx "tools/comafx/*.cpp") + file(GLOB_RECURSE src_tools_common "tools/common/*.cpp") + + #Compilers. + # DG: this is always added, why add it again? file(GLOB src_compiler_renderbump "neo/tools/compilers/renderbump/*.cpp") + file(GLOB src_compiler_roqvq "tools/compilers/roqvq/*.cpp") # FIXME: some of those were added before + add_globbed_headers(src_compiler_roqvq "tools/compilers/roqvq") + #tools + # Articulated Frame editor. + file(GLOB src_afeditor "tools/af/*.cpp") + add_globbed_headers(src_afeditor "tools/af") + # Declaration editor + file(GLOB src_decleditor "tools/decl/*.cpp") + add_globbed_headers(src_decleditor "tools/decl") + # GUI Editor. + file(GLOB src_gui_editor "tools/guied/*.cpp") + add_globbed_headers(src_gui_editor "tools/guied") + # Material editor + file(GLOB src_materialeditor "tools/materialeditor/*.cpp") + add_globbed_headers(src_materialeditor "tools/materialeditor") + # Particle Editor + file(GLOB src_particleeditor "tools/particle/*.cpp") + add_globbed_headers(src_particleeditor "tools/particle") + # PDA editor + file(GLOB src_pdaeditor "tools/pda/*.cpp") + add_globbed_headers(src_pdaeditor "tools/pda") + # Radiant ( Map editor ) + file(GLOB src_map_editor "tools/radiant/*.cpp") + add_globbed_headers(src_map_editor "tools/radiant") + # Script editor + file(GLOB src_script_editor "tools/script/*.cpp") + add_globbed_headers(src_script_editor "tools/script") + # sound editor? + file(GLOB src_sound_editor "tools/sound/*.cpp") + add_globbed_headers(src_sound_editor "tools/sound") + + + # The numerous tools in a nice list. + list(APPEND src_editor_tools + ${src_comafx} + ${src_tools_common} + ${src_compiler_renderbump} + ${src_afeditor} + ${src_decleditor} + ${src_gui_editor} + ${src_materialeditor} + ${src_particleeditor} + ${src_pdaeditor} + ${src_map_editor} + ${src_script_editor} + ${src_sound_editor} + "tools/edit_public.h" + "tools/edit_gui_common.h" + ) + SET(CMAKE_MFC_FLAG 2) + set(TOOLS_DEFINES "ID_ALLOW_TOOLS;__AFXDLL") +else() + set(src_editor_tools "tools/edit_stub.cpp" "tools/edit_public.h") +endif() + + if(AROS) set(DHEWM3BINARY "ADoom3") set(sys_libs ${sys_libs} dll) @@ -799,7 +873,7 @@ elseif(WIN32) sys/win32/win_syscon.cpp sys/win32/SDL_win32_main.c ) - + # adding the few relevant headers in sys/ manually.. set(src_sys_base ${src_sys_base} sys/platform.h @@ -812,6 +886,11 @@ elseif(WIN32) sys/glimp.cpp ${WIN32_RESOURCE_FILES} ) + + if(TOOLS) + set(src_sys_core ${src_sys_core} "sys/win32/rc/doom.rc") + endif() + else() set(src_sys_base sys/cpu.cpp @@ -852,11 +931,12 @@ if(CORE) ${src_core} ${src_sys_base} ${src_sys_core} + ${src_editor_tools} ) - source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_sys_core}) + source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_sys_core} ${src_editor_tools}) - set_target_properties(${DHEWM3BINARY} PROPERTIES COMPILE_DEFINITIONS "__DOOM_DLL__") + set_target_properties(${DHEWM3BINARY} PROPERTIES COMPILE_DEFINITIONS "__DOOM_DLL__;${TOOLS_DEFINES}") set_target_properties(${DHEWM3BINARY} PROPERTIES LINK_FLAGS "${ldflags}") set_target_properties(${DHEWM3BINARY} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist) diff --git a/neo/tools/common/RenderBumpFlatDialog.cpp b/neo/tools/common/RenderBumpFlatDialog.cpp index d105271d..6dcddc94 100644 --- a/neo/tools/common/RenderBumpFlatDialog.cpp +++ b/neo/tools/common/RenderBumpFlatDialog.cpp @@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms #pragma hdrstop #include "../../sys/win32/common_resource.h" - +// FIXME: SteelStorm2 has this whole file commented out idCVar rbfg_DefaultWidth( "rbfg_DefaultWidth", "0", 0, "" ); idCVar rbfg_DefaultHeight( "rbfg_DefaultHeight", "0", 0, "" ); diff --git a/neo/tools/compilers/aas/AASFile.h b/neo/tools/compilers/aas/AASFile.h index 9ae001c3..d5286ab1 100644 --- a/neo/tools/compilers/aas/AASFile.h +++ b/neo/tools/compilers/aas/AASFile.h @@ -88,7 +88,7 @@ If you have questions concerning this license or the applicable additional terms // bits for different bboxes #define AREACONTENTS_BBOX_BIT 24 -#define MAX_REACH_PER_AREA 256 +#define MAX_REACH_PER_AREA 256 // FIXME: SteelStorm2 has this increased to 512 #define MAX_AAS_TREE_DEPTH 128 #define MAX_AAS_BOUNDING_BOXES 4 diff --git a/neo/tools/compilers/renderbump/renderbump.cpp b/neo/tools/compilers/renderbump/renderbump.cpp index 8997835e..d18f902a 100644 --- a/neo/tools/compilers/renderbump/renderbump.cpp +++ b/neo/tools/compilers/renderbump/renderbump.cpp @@ -123,7 +123,7 @@ ResizeWindow =============== */ static void ResizeWindow( int width, int height ) { -#if 0 // FIXME +#if defined(WIN32) && defined(ID_ALLOW_TOOLS) int winWidth, winHeight; if ( glConfig.isFullscreen ) { winWidth = width; @@ -144,7 +144,7 @@ static void ResizeWindow( int width, int height ) { } SetWindowPos( win32.hWnd, HWND_TOP, 0, 0, winWidth, winHeight, SWP_SHOWWINDOW ); - qwglMakeCurrent( win32.hDC, win32.hGLRC ); + // FIXME: ??? qwglMakeCurrent( win32.hDC, win32.hGLRC ); #endif } @@ -154,7 +154,7 @@ RestoreWindow =============== */ static void RestoreWindow( void ) { -#if 0 // FIXME +#if defined(WIN32) && defined(ID_ALLOW_TOOLS) int winWidth, winHeight; if ( glConfig.isFullscreen ) { winWidth = oldWidth; diff --git a/neo/tools/decl/DialogDeclNew.cpp b/neo/tools/decl/DialogDeclNew.cpp index ccd654a5..ec9e1373 100644 --- a/neo/tools/decl/DialogDeclNew.cpp +++ b/neo/tools/decl/DialogDeclNew.cpp @@ -200,6 +200,7 @@ void DialogDeclNew::OnBnClickedFile() { } switch( type ) { + // FIXME: SteelStorm2 has a _v1 suffix for materials, def and fx - why? case DECL_TABLE: folder = "materials"; ext = "(*.mtr)|*.mtr|(*.*)|*.*||"; break; case DECL_MATERIAL: folder = "materials"; ext = "(*.mtr)|*.mtr|(*.*)|*.*||"; break; case DECL_SKIN: folder = "skins"; ext = "(*.skin)|*.skin|(*.*)|*.*||"; break; diff --git a/neo/tools/decl/DialogEntityDefEditor.cpp b/neo/tools/decl/DialogEntityDefEditor.cpp index 2eb4d5a3..805516f4 100644 --- a/neo/tools/decl/DialogEntityDefEditor.cpp +++ b/neo/tools/decl/DialogEntityDefEditor.cpp @@ -26,6 +26,8 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ +#if 0 // TODO: FIX this. - DG: from SteelStorm2 + #include "../../idlib/precompiled.h" #pragma hdrstop @@ -858,3 +860,5 @@ void DialogEntityDefEditor::OnBnClickedDelete() { MessageBox("Cannot delete an inherited value"); } } +#endif + diff --git a/neo/tools/edit_stub.cpp b/neo/tools/edit_stub.cpp index b5a9d3f5..79c2c887 100644 --- a/neo/tools/edit_stub.cpp +++ b/neo/tools/edit_stub.cpp @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms #include "sys/platform.h" #include "framework/Common.h" - +#include "edit_public.h" void RadiantInit( void ) { common->Printf( "The level editor Radiant only runs on Win32\n" ); } void RadiantShutdown( void ) {} void RadiantRun( void ) {} diff --git a/neo/tools/guied/GEViewer.cpp b/neo/tools/guied/GEViewer.cpp index 276c3be6..34312a62 100644 --- a/neo/tools/guied/GEViewer.cpp +++ b/neo/tools/guied/GEViewer.cpp @@ -125,7 +125,8 @@ bool rvGEViewer::OpenFile ( const char* filename ) tempfile.StripPath (); tempfile.StripFileExtension ( ); tempfile = va("guis/temp.guied", tempfile.c_str() ); - ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); + //ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); DG: change from SteelStorm2 + ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_savepath" ); // Make sure the gui directory exists idStr createDir = ospath; @@ -505,11 +506,11 @@ void rvGEViewer::Render ( HDC dc ) qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Render the workspace below - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + qglMatrixMode(GL_PROJECTION); + qglLoadIdentity(); qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + qglMatrixMode(GL_MODELVIEW); + qglLoadIdentity(); if ( mInterface ) { diff --git a/neo/tools/guied/GEWindowWrapper_stub.cpp b/neo/tools/guied/GEWindowWrapper_stub.cpp index 3d928b1c..92ed982d 100644 --- a/neo/tools/guied/GEWindowWrapper_stub.cpp +++ b/neo/tools/guied/GEWindowWrapper_stub.cpp @@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms #include "ui/ChoiceWindow.h" #include "tools/guied/GEWindowWrapper.h" - +#if !defined(ID_ALLOW_TOOLS) static rvGEWindowWrapper stub_wrap( NULL, rvGEWindowWrapper::WT_UNKNOWN ); rvGEWindowWrapper::rvGEWindowWrapper( idWindow* window, EWindowType type ) { } @@ -44,3 +44,4 @@ rvGEWindowWrapper* rvGEWindowWrapper::GetWrapper ( idWindow* window ) { return & void rvGEWindowWrapper::SetStateKey( const char*, const char*, bool ) { } void rvGEWindowWrapper::Finish() { } +#endif diff --git a/neo/tools/guied/GEWorkspace.cpp b/neo/tools/guied/GEWorkspace.cpp index cf3574e7..6fa87e11 100644 --- a/neo/tools/guied/GEWorkspace.cpp +++ b/neo/tools/guied/GEWorkspace.cpp @@ -289,11 +289,11 @@ void rvGEWorkspace::Render ( HDC hdc ) qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Render the workspace below - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + qglMatrixMode(GL_PROJECTION); + qglLoadIdentity(); qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + qglMatrixMode(GL_MODELVIEW); + qglLoadIdentity(); qglColor3f ( mApplication->GetOptions().GetWorkspaceColor()[0], mApplication->GetOptions().GetWorkspaceColor()[1], mApplication->GetOptions().GetWorkspaceColor()[2] ); qglBegin ( GL_QUADS ); @@ -337,11 +337,11 @@ void rvGEWorkspace::Render ( HDC hdc ) qglViewport(0, 0, mWindowWidth, mWindowHeight ); qglScissor(0, 0, mWindowWidth, mWindowHeight ); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + qglMatrixMode(GL_PROJECTION); + qglLoadIdentity(); qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + qglMatrixMode(GL_MODELVIEW); + qglLoadIdentity(); RenderGrid ( ); diff --git a/neo/tools/guied/GEWorkspaceFile.cpp b/neo/tools/guied/GEWorkspaceFile.cpp index 725f96cf..2ee0da79 100644 --- a/neo/tools/guied/GEWorkspaceFile.cpp +++ b/neo/tools/guied/GEWorkspaceFile.cpp @@ -54,7 +54,8 @@ bool rvGEWorkspace::SaveFile ( const char* filename ) idStr ospath; tempfile = "guis/temp.guied"; - ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); + //ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); DG: change from SteelStorm2 + ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_savepath" ); // Open the output file for write if ( !(file = fileSystem->OpenFileWrite ( tempfile ) ) ) @@ -249,7 +250,8 @@ bool rvGEWorkspace::NewFile ( void ) // Make a temporary file with nothing in it so we can just use // load to do all the work - ospath = fileSystem->RelativePathToOSPath ( "guis/Untitled.guiednew", "fs_basepath" ); + //ospath = fileSystem->RelativePathToOSPath ( "guis/Untitled.guiednew", "fs_basepath" ); DG: change from SteelStorm2 + ospath = fileSystem->RelativePathToOSPath ( "guis/Untitled.guiednew", "fs_savepath" ); DeleteFile ( ospath ); file = fileSystem->OpenFileWrite ( "guis/Untitled.guiednew" ); @@ -300,7 +302,8 @@ bool rvGEWorkspace::LoadFile ( const char* filename, idStr* error ) bool result; tempfile = "guis/temp.guied"; - ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); + //ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); DG: change from SteelStorm2 + ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_savepath" ); // Make sure the gui directory exists idStr createDir = ospath; diff --git a/neo/tools/particle/DialogParticleEditor.cpp b/neo/tools/particle/DialogParticleEditor.cpp index 1b71ed50..2c271702 100644 --- a/neo/tools/particle/DialogParticleEditor.cpp +++ b/neo/tools/particle/DialogParticleEditor.cpp @@ -1273,7 +1273,16 @@ BOOL CDialogParticleEditor::OnInitDialog() { void CDialogParticleEditor::OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) { CDialog::OnHScroll( nSBCode, nPos, pScrollBar ); - CSliderCtrl *ctrl = dynamic_cast< CSliderCtrl* >( pScrollBar ); + + // DG: from SteelStorm2: + // Something funky is going on with the RTTI. The dynamic_cast even to a CRangeSlider* + // was not happening correctly. Whatever is getting to this callback from the CRangeSlider + // must not be one of the basic slider types or even a CRangeSlider. What is weird is the + // objects coming in have the same addresses as the various CRangeSliders on the dlg, so they + // should cast correctly. Turns out it does not matter because once the addresses matche up + // this code just uses the dlg member reference so all I need is for the address check to + // go through correctly. + CRangeSlider* ctrl = (CRangeSlider*)pScrollBar; if ( !ctrl ) { return; } diff --git a/neo/tools/radiant/CamWnd.cpp b/neo/tools/radiant/CamWnd.cpp index 425d73e6..b6b3251b 100644 --- a/neo/tools/radiant/CamWnd.cpp +++ b/neo/tools/radiant/CamWnd.cpp @@ -39,6 +39,9 @@ If you have questions concerning this license or the applicable additional terms #include "../../renderer/tr_local.h" #include "../../renderer/model_local.h" // for idRenderModelMD5 + +// TODO: DG: could merge SteelStorm2 "new 3D view navigation" improvements + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -354,7 +357,10 @@ int CCamWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { HFONT hOldFont = (HFONT)SelectObject(hDC, hfont); - wglMakeCurrent (hDC, win32.hGLRC); + //qwglMakeCurrent (hDC, win32.hGLRC); + if( qwglMakeCurrent ( hDC, win32.hGLRC ) == FALSE ) { + common->Warning("wglMakeCurrent failed: %d", ::GetLastError()); + } if ((g_qeglobals.d_font_list = qglGenLists(256)) == 0) { common->Warning( "couldn't create font dlists" ); @@ -2062,11 +2068,13 @@ void CCamWnd::Cam_Render() { return; // not valid yet } - if (!qwglMakeCurrent(dc.m_hDC, win32.hGLRC)) { + // DG: from SteelStorm2 + // Jmarshal23 recommended to disable this to fix lighting render in the Cam window + /* if (!qwglMakeCurrent(dc.m_hDC, win32.hGLRC)) { common->Printf("ERROR: wglMakeCurrent failed..\n "); common->Printf("Please restart " EDITOR_WINDOWTEXT " if the camera view is not working\n"); return; - } + } */ // save the editor state //qglPushAttrib( GL_ALL_ATTRIB_BITS ); diff --git a/neo/tools/radiant/EditorBrush.cpp b/neo/tools/radiant/EditorBrush.cpp index 3c432216..223b0dac 100644 --- a/neo/tools/radiant/EditorBrush.cpp +++ b/neo/tools/radiant/EditorBrush.cpp @@ -44,7 +44,7 @@ bool g_bShowLightVolumes = false; bool g_bShowLightTextures = false; void GLCircle(float x, float y, float z, float r); - +void GLSphere(float r, int lats, int longs); const int POINTS_PER_KNOT = 50; /* @@ -3618,9 +3618,9 @@ void DrawProjectedLight(brush_t *b, bool bSelected, bool texture) { qglColor3f(1, 0, 1); for (i = 0; i < tri->numIndexes; i += 3) { qglBegin(GL_LINE_LOOP); - glVertex3fv(tri->verts[tri->indexes[i]].xyz.ToFloatPtr()); - glVertex3fv(tri->verts[tri->indexes[i + 1]].xyz.ToFloatPtr()); - glVertex3fv(tri->verts[tri->indexes[i + 2]].xyz.ToFloatPtr()); + qglVertex3fv(tri->verts[tri->indexes[i]].xyz.ToFloatPtr()); + qglVertex3fv(tri->verts[tri->indexes[i + 1]].xyz.ToFloatPtr()); + qglVertex3fv(tri->verts[tri->indexes[i + 2]].xyz.ToFloatPtr()); qglEnd(); } @@ -3732,6 +3732,35 @@ void GLCircle(float x, float y, float z, float r) qglEnd(); } +/* +================ +GLSphere - DG: from SteelStorm2 +================ +*/ +void GLSphere(float r, int lats, int longs) { + int i, j; + for(i = 0; i <= lats; i++) { + float lat0 = idMath::PI * (-0.5 + (float) (i - 1) / lats); + float z0 = idMath::Sin(lat0); + float zr0 = idMath::Cos(lat0); + float lat1 = idMath::PI * (-0.5 + (float) i / lats); + float z1 = sin(lat1); + float zr1 = cos(lat1); + + qglBegin(GL_QUAD_STRIP); + for(j = 0; j <= longs; j++) { + float lng = 2 * idMath::PI * (float) (j - 1) / longs; + float x = idMath::Cos(lng); + float y = idMath::Sin(lng); + + qglNormal3f(x * zr0, y * zr0, z0); + qglVertex3f(x * zr0, y * zr0, z0); + qglNormal3f(x * zr1, y * zr1, z1); + qglVertex3f(x * zr1, y * zr1, z1); + } + qglEnd(); + } + } /* ================ DrawSpeaker @@ -3788,10 +3817,9 @@ void DrawSpeaker(brush_t *b, bool bSelected, bool twoD) { qglTranslatef(b->owner->origin.x, b->owner->origin.y, b->owner->origin.z ); qglColor3f( 0.4f, 0.4f, 0.4f ); qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE); - GLUquadricObj* qobj = gluNewQuadric(); - gluSphere(qobj, min, 8, 8); + qglColor3f( 0.8f, 0.8f, 0.8f ); - gluSphere(qobj, max, 8, 8); + GLSphere(max, 8, 8); qglEnable(GL_BLEND); qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -3801,14 +3829,13 @@ void DrawSpeaker(brush_t *b, bool bSelected, bool twoD) { } else { qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.35f ); } - gluSphere(qobj, min, 8, 8); + GLSphere(min, 8, 8); if (bSelected) { qglColor4f( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, 0.1f ); } else { qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.1f ); } - gluSphere(qobj, max, 8, 8); - gluDeleteQuadric(qobj); + GLSphere(max, 8, 8); qglPopMatrix(); } diff --git a/neo/tools/radiant/EditorMap.cpp b/neo/tools/radiant/EditorMap.cpp index 432c6b25..1c43b342 100644 --- a/neo/tools/radiant/EditorMap.cpp +++ b/neo/tools/radiant/EditorMap.cpp @@ -699,10 +699,13 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { if ( _unlink(backup) != 0 && errno != 2 ) { // errno 2 means the file doesn't exist, which we don't care about g_pParentWnd->MessageBox( va("Unable to delete %s: %s", backup.c_str(), strerror(errno) ), "File Error" ); } - - if ( rename(filename, backup) != 0 ) { - g_pParentWnd->MessageBox( va("Unable to rename %s to %s: %s", filename, backup.c_str(), strerror(errno) ), "File Error" ); - } + // DG: from SteelStorm2: +// Removed this check. On the first save, it is valid that the map file does not exist because +// it has not been written to disk yet. +// KJA +// if ( rename(filename, backup) != 0 ) { +// g_pParentWnd->MessageBox( va("Unable to rename %s to %s: %s", filename, backup.c_str(), strerror(errno) ), "File Error" ); +// } } common->Printf("Map_SaveFile: %s\n", filename); diff --git a/neo/tools/radiant/MainFrm.cpp b/neo/tools/radiant/MainFrm.cpp index df956f7c..648268a6 100644 --- a/neo/tools/radiant/MainFrm.cpp +++ b/neo/tools/radiant/MainFrm.cpp @@ -135,6 +135,7 @@ SCommandInfo g_Commands[] = { { "Camera_Down", 'C', 0, ID_CAMERA_DOWN }, { "Camera_AngleUp", 'A', 0, ID_CAMERA_ANGLEUP }, { "Camera_AngleDown", 'Z', 0, ID_CAMERA_ANGLEDOWN }, + // FIXME: DG: SteelStorm2 has bindings for Camera_Left and Camera_StrafeLeft switched (same for Right) { "Camera_StrafeRight", VK_PERIOD, 0, ID_CAMERA_STRAFERIGHT }, { "Camera_StrafeLeft", VK_COMMA, 0, ID_CAMERA_STRAFELEFT }, { "Camera_UpFloor", VK_PRIOR, 0, ID_VIEW_UPFLOOR }, @@ -158,14 +159,20 @@ SCommandInfo g_Commands[] = { { "Grid_Set16", '5', 0, ID_GRID_16 }, { "Grid_Set32", '6', 0, ID_GRID_32 }, { "Grid_Set64", '7', 0, ID_GRID_64 }, - { "Grid_Down", 219, 0, ID_GRID_PREV }, - { "Grid_Up", 221, 0, ID_GRID_NEXT }, + { "Grid_Down", VK_OEM_4, 0, ID_GRID_PREV }, /* [{ in us layout */ + { "Grid_Up", VK_OEM_6, 0, ID_GRID_NEXT }, /* ]} in US layouts */ { "Grid_Toggle", '0', 0, ID_GRID_TOGGLE }, { "Grid_ToggleSizePaint", 'Q', RAD_PRESS, ID_SELECTION_TOGGLESIZEPAINT }, { "Grid_PrecisionCursorMode",VK_F11, 0 , ID_PRECISION_CURSOR_CYCLE}, + /* Begin SS2 Changes */ + { "Grid_SetViewTop", VK_NUMPAD7, 0, ID_SET_VIEW_TOP }, + { "Grid_SetViewSide", VK_NUMPAD3, 0, ID_SET_VIEW_SIDE }, + { "Grid_SetViewFront", VK_NUMPAD1, 0, ID_SET_VIEW_FRONT }, + /* End SS2 Changes */ + { "Grid_NextView", VK_TAB, RAD_CONTROL, ID_VIEW_NEXTVIEW }, { "Grid_ToggleCrosshairs", 'X', RAD_SHIFT, ID_VIEW_CROSSHAIR }, @@ -214,9 +221,9 @@ SCommandInfo g_Commands[] = { { "Clipper_SplitSelected", VK_RETURN, RAD_SHIFT, ID_SPLIT_SELECTED }, { "Clipper_FlipClip", VK_RETURN, RAD_CONTROL, ID_FLIP_CLIP }, - { "CameraClip_ZoomOut", 219, RAD_CONTROL, ID_VIEW_CUBEOUT }, - { "CameraClip_ZoomIn", 221, RAD_CONTROL, ID_VIEW_CUBEIN }, - { "CameraClip_Toggle", 220, RAD_CONTROL, ID_VIEW_CUBICCLIPPING }, + { "CameraClip_ZoomOut", VK_OEM_4, RAD_CONTROL, ID_VIEW_CUBEOUT }, + { "CameraClip_ZoomIn", VK_OEM_5, RAD_CONTROL, ID_VIEW_CUBEIN }, + { "CameraClip_Toggle", VK_OEM_6, RAD_CONTROL, ID_VIEW_CUBICCLIPPING }, { "ViewTab_EntityInfo", 'N', 0, ID_VIEW_ENTITY }, { "ViewTab_Console", 'O', 0, ID_VIEW_CONSOLE }, @@ -289,6 +296,9 @@ SCommandInfo g_Commands[] = { int g_nCommandCount = sizeof(g_Commands) / sizeof(SCommandInfo); SKeyInfo g_Keys[] = { + /* To understand the VK_* information, please read the MSDN: + http://msdn.microsoft.com/en-us/library/ms927178.aspx + */ { "Space", VK_SPACE }, { "Backspace", VK_BACK }, { "Escape", VK_ESCAPE }, @@ -330,9 +340,9 @@ SKeyInfo g_Keys[] = { { "NumPad7", VK_NUMPAD7 }, { "NumPad8", VK_NUMPAD8 }, { "NumPad9", VK_NUMPAD9 }, - { "[", 219 }, - { "]", 221 }, - { "\\", 220 } + { "[", VK_OEM_4 }, /* Was 219, 0xDB */ + { "\\", VK_OEM_5 }, /* Was 220, 0xDC */ + { "]", VK_OEM_6 }, /* Was 221, 0xDD */ }; int g_nKeyCount = sizeof(g_Keys) / sizeof(SKeyInfo); @@ -475,6 +485,9 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_COMMAND(ID_EDIT_MAPINFO, OnEditMapinfo) ON_COMMAND(ID_EDIT_ENTITYINFO, OnEditEntityinfo) ON_COMMAND(ID_VIEW_NEXTVIEW, OnViewNextview) + ON_COMMAND(ID_SET_VIEW_TOP, OnSetViewTop) + ON_COMMAND(ID_SET_VIEW_SIDE, OnSetViewSide) + ON_COMMAND(ID_SET_VIEW_FRONT, OnSetViewFront) ON_COMMAND(ID_HELP_COMMANDLIST, OnHelpCommandlist) ON_COMMAND(ID_FILE_NEWPROJECT, OnFileNewproject) ON_COMMAND(ID_FLIP_CLIP, OnFlipClip) @@ -3878,6 +3891,42 @@ void CMainFrame::OnViewNextview() { Sys_UpdateWindows(W_XY | W_CAMERA); } +/* Begin SS2 Changes */ +void CMainFrame::OnSetViewTop() { + if (m_pXYWnd->GetViewType() != XY) { + m_pXYWnd->SetViewType(XY); + m_pXYWnd->PositionView(); + if (g_qeglobals.flatRotation) { + g_qeglobals.rotateAxis = 2; + } + Sys_UpdateWindows(W_XY | W_CAMERA); + } +} + +void CMainFrame::OnSetViewSide() { + if (m_pXYWnd->GetViewType() != YZ) { + m_pXYWnd->SetViewType(YZ); + m_pXYWnd->PositionView(); + if (g_qeglobals.flatRotation) { + g_qeglobals.rotateAxis = 0; + } + Sys_UpdateWindows(W_XY | W_CAMERA); + } +} + +void CMainFrame::OnSetViewFront() { + if (m_pXYWnd->GetViewType() != XZ) { + m_pXYWnd->SetViewType(XZ); + m_pXYWnd->PositionView(); + if (g_qeglobals.flatRotation) { + g_qeglobals.rotateAxis = 1; + } + Sys_UpdateWindows(W_XY | W_CAMERA); + } +} +/* End SS2 Changes */ + + /* ======================================================================================================================= ======================================================================================================================= diff --git a/neo/tools/radiant/MainFrm.h b/neo/tools/radiant/MainFrm.h index d6ec9019..f5777683 100644 --- a/neo/tools/radiant/MainFrm.h +++ b/neo/tools/radiant/MainFrm.h @@ -198,6 +198,13 @@ public: afx_msg void OnFileSave(); afx_msg void OnFileSaveas(); afx_msg void OnFileSaveCopy(); + + /* Begin SS2 Changes */ + afx_msg void OnSetViewTop(); + afx_msg void OnSetViewSide(); + afx_msg void OnSetViewFront(); + /* end SS2 Changes */ + afx_msg void OnViewShowModels(); afx_msg void OnView100(); afx_msg void OnViewCenter(); diff --git a/neo/tools/radiant/PreviewDlg.cpp b/neo/tools/radiant/PreviewDlg.cpp index 6668f1aa..4bc57677 100644 --- a/neo/tools/radiant/PreviewDlg.cpp +++ b/neo/tools/radiant/PreviewDlg.cpp @@ -303,7 +303,7 @@ void CPreviewDlg::OnTvnSelchangedTreeMedia(NMHDR *pNMHDR, LRESULT *pResult) } // strip the leading "base/" if (id == MATERIALS) { - mediaName.Strip("Materials/"); + mediaName.Strip("Materials/"); // FIXME: SteelStorm2 has a _v1 suffix here } else if (id == WAVES) { mediaName.Strip( "Wave files/" ); } else if (id == PARTICLES) { @@ -608,7 +608,7 @@ void CPreviewDlg::AddMaterials(bool rootItems) { list.Append(mat->GetName()); } list.Sort(); - AddStrList("Materials", list, MATERIALS); + AddStrList("Materials", list, MATERIALS); // FIXME: SteelStorm2 has a _v1 suffix here } }