GUI Editor code/integration from SteelStorm2, doesn't build yet

This commit is contained in:
Daniel Gibson 2019-01-07 02:42:00 +01:00
parent 08970f186d
commit c60f630eea
18 changed files with 253 additions and 60 deletions

View file

@ -49,6 +49,9 @@ include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GNUINSTALLDIRS)
option(CORE "Build the core" ON) option(CORE "Build the core" ON)
option(BASE "Build the base game code" ON) option(BASE "Build the base game code" ON)
option(D3XP "Build the d3xp 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(DEDICATED "Build the dedicated server" OFF)
option(ONATIVE "Optimize for the host CPU" OFF) option(ONATIVE "Optimize for the host CPU" OFF)
option(SDL2 "Use SDL2 instead of SDL1.2" ON) option(SDL2 "Use SDL2 instead of SDL1.2" ON)
@ -149,6 +152,11 @@ else()
set(CURL_LIBRARY "") set(CURL_LIBRARY "")
endif() endif()
if(MSVC)
# This is required for tools on windows.
find_package(MFC)
endif()
# compiler specific flags # compiler specific flags
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-pipe) add_compile_options(-pipe)
@ -509,12 +517,6 @@ set(src_ui
add_globbed_headers(src_ui "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 set(src_idlib
idlib/bv/Bounds.cpp idlib/bv/Bounds.cpp
idlib/bv/Frustum.cpp idlib/bv/Frustum.cpp
@ -734,6 +736,78 @@ set(src_core
set(src_stub_openal sys/stub/openal_stub.cpp) set(src_stub_openal sys/stub/openal_stub.cpp)
set(src_stub_gl sys/stub/stub_gl.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) if(AROS)
set(DHEWM3BINARY "ADoom3") set(DHEWM3BINARY "ADoom3")
set(sys_libs ${sys_libs} dll) set(sys_libs ${sys_libs} dll)
@ -799,7 +873,7 @@ elseif(WIN32)
sys/win32/win_syscon.cpp sys/win32/win_syscon.cpp
sys/win32/SDL_win32_main.c sys/win32/SDL_win32_main.c
) )
# adding the few relevant headers in sys/ manually.. # adding the few relevant headers in sys/ manually..
set(src_sys_base ${src_sys_base} set(src_sys_base ${src_sys_base}
sys/platform.h sys/platform.h
@ -812,6 +886,11 @@ elseif(WIN32)
sys/glimp.cpp sys/glimp.cpp
${WIN32_RESOURCE_FILES} ${WIN32_RESOURCE_FILES}
) )
if(TOOLS)
set(src_sys_core ${src_sys_core} "sys/win32/rc/doom.rc")
endif()
else() else()
set(src_sys_base set(src_sys_base
sys/cpu.cpp sys/cpu.cpp
@ -852,11 +931,12 @@ if(CORE)
${src_core} ${src_core}
${src_sys_base} ${src_sys_base}
${src_sys_core} ${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 LINK_FLAGS "${ldflags}")
set_target_properties(${DHEWM3BINARY} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist) set_target_properties(${DHEWM3BINARY} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist)

View file

@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
#pragma hdrstop #pragma hdrstop
#include "../../sys/win32/common_resource.h" #include "../../sys/win32/common_resource.h"
// FIXME: SteelStorm2 has this whole file commented out
idCVar rbfg_DefaultWidth( "rbfg_DefaultWidth", "0", 0, "" ); idCVar rbfg_DefaultWidth( "rbfg_DefaultWidth", "0", 0, "" );
idCVar rbfg_DefaultHeight( "rbfg_DefaultHeight", "0", 0, "" ); idCVar rbfg_DefaultHeight( "rbfg_DefaultHeight", "0", 0, "" );

View file

@ -88,7 +88,7 @@ If you have questions concerning this license or the applicable additional terms
// bits for different bboxes // bits for different bboxes
#define AREACONTENTS_BBOX_BIT 24 #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_TREE_DEPTH 128
#define MAX_AAS_BOUNDING_BOXES 4 #define MAX_AAS_BOUNDING_BOXES 4

View file

@ -123,7 +123,7 @@ ResizeWindow
=============== ===============
*/ */
static void ResizeWindow( int width, int height ) { static void ResizeWindow( int width, int height ) {
#if 0 // FIXME #if defined(WIN32) && defined(ID_ALLOW_TOOLS)
int winWidth, winHeight; int winWidth, winHeight;
if ( glConfig.isFullscreen ) { if ( glConfig.isFullscreen ) {
winWidth = width; winWidth = width;
@ -144,7 +144,7 @@ static void ResizeWindow( int width, int height ) {
} }
SetWindowPos( win32.hWnd, HWND_TOP, 0, 0, winWidth, winHeight, SWP_SHOWWINDOW ); SetWindowPos( win32.hWnd, HWND_TOP, 0, 0, winWidth, winHeight, SWP_SHOWWINDOW );
qwglMakeCurrent( win32.hDC, win32.hGLRC ); // FIXME: ??? qwglMakeCurrent( win32.hDC, win32.hGLRC );
#endif #endif
} }
@ -154,7 +154,7 @@ RestoreWindow
=============== ===============
*/ */
static void RestoreWindow( void ) { static void RestoreWindow( void ) {
#if 0 // FIXME #if defined(WIN32) && defined(ID_ALLOW_TOOLS)
int winWidth, winHeight; int winWidth, winHeight;
if ( glConfig.isFullscreen ) { if ( glConfig.isFullscreen ) {
winWidth = oldWidth; winWidth = oldWidth;

View file

@ -200,6 +200,7 @@ void DialogDeclNew::OnBnClickedFile() {
} }
switch( type ) { 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_TABLE: folder = "materials"; ext = "(*.mtr)|*.mtr|(*.*)|*.*||"; break;
case DECL_MATERIAL: folder = "materials"; ext = "(*.mtr)|*.mtr|(*.*)|*.*||"; break; case DECL_MATERIAL: folder = "materials"; ext = "(*.mtr)|*.mtr|(*.*)|*.*||"; break;
case DECL_SKIN: folder = "skins"; ext = "(*.skin)|*.skin|(*.*)|*.*||"; break; case DECL_SKIN: folder = "skins"; ext = "(*.skin)|*.skin|(*.*)|*.*||"; break;

View file

@ -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" #include "../../idlib/precompiled.h"
#pragma hdrstop #pragma hdrstop
@ -858,3 +860,5 @@ void DialogEntityDefEditor::OnBnClickedDelete() {
MessageBox("Cannot delete an inherited value"); MessageBox("Cannot delete an inherited value");
} }
} }
#endif

View file

@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
#include "sys/platform.h" #include "sys/platform.h"
#include "framework/Common.h" #include "framework/Common.h"
#include "edit_public.h"
void RadiantInit( void ) { common->Printf( "The level editor Radiant only runs on Win32\n" ); } void RadiantInit( void ) { common->Printf( "The level editor Radiant only runs on Win32\n" ); }
void RadiantShutdown( void ) {} void RadiantShutdown( void ) {}
void RadiantRun( void ) {} void RadiantRun( void ) {}

View file

@ -125,7 +125,8 @@ bool rvGEViewer::OpenFile ( const char* filename )
tempfile.StripPath (); tempfile.StripPath ();
tempfile.StripFileExtension ( ); tempfile.StripFileExtension ( );
tempfile = va("guis/temp.guied", tempfile.c_str() ); 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 // Make sure the gui directory exists
idStr createDir = ospath; idStr createDir = ospath;
@ -505,11 +506,11 @@ void rvGEViewer::Render ( HDC dc )
qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Render the workspace below // Render the workspace below
glMatrixMode(GL_PROJECTION); qglMatrixMode(GL_PROJECTION);
glLoadIdentity(); qglLoadIdentity();
qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1); qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1);
glMatrixMode(GL_MODELVIEW); qglMatrixMode(GL_MODELVIEW);
glLoadIdentity(); qglLoadIdentity();
if ( mInterface ) if ( mInterface )
{ {

View file

@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms
#include "ui/ChoiceWindow.h" #include "ui/ChoiceWindow.h"
#include "tools/guied/GEWindowWrapper.h" #include "tools/guied/GEWindowWrapper.h"
#if !defined(ID_ALLOW_TOOLS)
static rvGEWindowWrapper stub_wrap( NULL, rvGEWindowWrapper::WT_UNKNOWN ); static rvGEWindowWrapper stub_wrap( NULL, rvGEWindowWrapper::WT_UNKNOWN );
rvGEWindowWrapper::rvGEWindowWrapper( idWindow* window, EWindowType type ) { } 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::SetStateKey( const char*, const char*, bool ) { }
void rvGEWindowWrapper::Finish() { } void rvGEWindowWrapper::Finish() { }
#endif

View file

@ -289,11 +289,11 @@ void rvGEWorkspace::Render ( HDC hdc )
qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Render the workspace below // Render the workspace below
glMatrixMode(GL_PROJECTION); qglMatrixMode(GL_PROJECTION);
glLoadIdentity(); qglLoadIdentity();
qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1); qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1);
glMatrixMode(GL_MODELVIEW); qglMatrixMode(GL_MODELVIEW);
glLoadIdentity(); qglLoadIdentity();
qglColor3f ( mApplication->GetOptions().GetWorkspaceColor()[0], mApplication->GetOptions().GetWorkspaceColor()[1], mApplication->GetOptions().GetWorkspaceColor()[2] ); qglColor3f ( mApplication->GetOptions().GetWorkspaceColor()[0], mApplication->GetOptions().GetWorkspaceColor()[1], mApplication->GetOptions().GetWorkspaceColor()[2] );
qglBegin ( GL_QUADS ); qglBegin ( GL_QUADS );
@ -337,11 +337,11 @@ void rvGEWorkspace::Render ( HDC hdc )
qglViewport(0, 0, mWindowWidth, mWindowHeight ); qglViewport(0, 0, mWindowWidth, mWindowHeight );
qglScissor(0, 0, mWindowWidth, mWindowHeight ); qglScissor(0, 0, mWindowWidth, mWindowHeight );
glMatrixMode(GL_PROJECTION); qglMatrixMode(GL_PROJECTION);
glLoadIdentity(); qglLoadIdentity();
qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1); qglOrtho(0,mWindowWidth, mWindowHeight, 0, -1, 1);
glMatrixMode(GL_MODELVIEW); qglMatrixMode(GL_MODELVIEW);
glLoadIdentity(); qglLoadIdentity();
RenderGrid ( ); RenderGrid ( );

View file

@ -54,7 +54,8 @@ bool rvGEWorkspace::SaveFile ( const char* filename )
idStr ospath; idStr ospath;
tempfile = "guis/temp.guied"; 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 // Open the output file for write
if ( !(file = fileSystem->OpenFileWrite ( tempfile ) ) ) 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 // Make a temporary file with nothing in it so we can just use
// load to do all the work // 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 ); DeleteFile ( ospath );
file = fileSystem->OpenFileWrite ( "guis/Untitled.guiednew" ); file = fileSystem->OpenFileWrite ( "guis/Untitled.guiednew" );
@ -300,7 +302,8 @@ bool rvGEWorkspace::LoadFile ( const char* filename, idStr* error )
bool result; bool result;
tempfile = "guis/temp.guied"; 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 // Make sure the gui directory exists
idStr createDir = ospath; idStr createDir = ospath;

View file

@ -1273,7 +1273,16 @@ BOOL CDialogParticleEditor::OnInitDialog() {
void CDialogParticleEditor::OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) { void CDialogParticleEditor::OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) {
CDialog::OnHScroll( nSBCode, nPos, 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 ) { if ( !ctrl ) {
return; return;
} }

View file

@ -39,6 +39,9 @@ If you have questions concerning this license or the applicable additional terms
#include "../../renderer/tr_local.h" #include "../../renderer/tr_local.h"
#include "../../renderer/model_local.h" // for idRenderModelMD5 #include "../../renderer/model_local.h" // for idRenderModelMD5
// TODO: DG: could merge SteelStorm2 "new 3D view navigation" improvements
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
@ -354,7 +357,10 @@ int CCamWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) {
HFONT hOldFont = (HFONT)SelectObject(hDC, hfont); 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) { if ((g_qeglobals.d_font_list = qglGenLists(256)) == 0) {
common->Warning( "couldn't create font dlists" ); common->Warning( "couldn't create font dlists" );
@ -2062,11 +2068,13 @@ void CCamWnd::Cam_Render() {
return; // not valid yet 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("ERROR: wglMakeCurrent failed..\n ");
common->Printf("Please restart " EDITOR_WINDOWTEXT " if the camera view is not working\n"); common->Printf("Please restart " EDITOR_WINDOWTEXT " if the camera view is not working\n");
return; return;
} } */
// save the editor state // save the editor state
//qglPushAttrib( GL_ALL_ATTRIB_BITS ); //qglPushAttrib( GL_ALL_ATTRIB_BITS );

View file

@ -44,7 +44,7 @@ bool g_bShowLightVolumes = false;
bool g_bShowLightTextures = false; bool g_bShowLightTextures = false;
void GLCircle(float x, float y, float z, float r); void GLCircle(float x, float y, float z, float r);
void GLSphere(float r, int lats, int longs);
const int POINTS_PER_KNOT = 50; const int POINTS_PER_KNOT = 50;
/* /*
@ -3618,9 +3618,9 @@ void DrawProjectedLight(brush_t *b, bool bSelected, bool texture) {
qglColor3f(1, 0, 1); qglColor3f(1, 0, 1);
for (i = 0; i < tri->numIndexes; i += 3) { for (i = 0; i < tri->numIndexes; i += 3) {
qglBegin(GL_LINE_LOOP); qglBegin(GL_LINE_LOOP);
glVertex3fv(tri->verts[tri->indexes[i]].xyz.ToFloatPtr()); qglVertex3fv(tri->verts[tri->indexes[i]].xyz.ToFloatPtr());
glVertex3fv(tri->verts[tri->indexes[i + 1]].xyz.ToFloatPtr()); qglVertex3fv(tri->verts[tri->indexes[i + 1]].xyz.ToFloatPtr());
glVertex3fv(tri->verts[tri->indexes[i + 2]].xyz.ToFloatPtr()); qglVertex3fv(tri->verts[tri->indexes[i + 2]].xyz.ToFloatPtr());
qglEnd(); qglEnd();
} }
@ -3732,6 +3732,35 @@ void GLCircle(float x, float y, float z, float r)
qglEnd(); 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 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 ); qglTranslatef(b->owner->origin.x, b->owner->origin.y, b->owner->origin.z );
qglColor3f( 0.4f, 0.4f, 0.4f ); qglColor3f( 0.4f, 0.4f, 0.4f );
qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE); qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
GLUquadricObj* qobj = gluNewQuadric();
gluSphere(qobj, min, 8, 8);
qglColor3f( 0.8f, 0.8f, 0.8f ); qglColor3f( 0.8f, 0.8f, 0.8f );
gluSphere(qobj, max, 8, 8); GLSphere(max, 8, 8);
qglEnable(GL_BLEND); qglEnable(GL_BLEND);
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -3801,14 +3829,13 @@ void DrawSpeaker(brush_t *b, bool bSelected, bool twoD) {
} else { } else {
qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.35f ); 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) { 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 ); 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 { } else {
qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.1f ); qglColor4f( b->owner->eclass->color.x, b->owner->eclass->color.y, b->owner->eclass->color.z, 0.1f );
} }
gluSphere(qobj, max, 8, 8); GLSphere(max, 8, 8);
gluDeleteQuadric(qobj);
qglPopMatrix(); qglPopMatrix();
} }

View file

@ -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 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" ); g_pParentWnd->MessageBox( va("Unable to delete %s: %s", backup.c_str(), strerror(errno) ), "File Error" );
} }
// DG: from SteelStorm2:
if ( rename(filename, backup) != 0 ) { // Removed this check. On the first save, it is valid that the map file does not exist because
g_pParentWnd->MessageBox( va("Unable to rename %s to %s: %s", filename, backup.c_str(), strerror(errno) ), "File Error" ); // 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); common->Printf("Map_SaveFile: %s\n", filename);

View file

@ -135,6 +135,7 @@ SCommandInfo g_Commands[] = {
{ "Camera_Down", 'C', 0, ID_CAMERA_DOWN }, { "Camera_Down", 'C', 0, ID_CAMERA_DOWN },
{ "Camera_AngleUp", 'A', 0, ID_CAMERA_ANGLEUP }, { "Camera_AngleUp", 'A', 0, ID_CAMERA_ANGLEUP },
{ "Camera_AngleDown", 'Z', 0, ID_CAMERA_ANGLEDOWN }, { "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_StrafeRight", VK_PERIOD, 0, ID_CAMERA_STRAFERIGHT },
{ "Camera_StrafeLeft", VK_COMMA, 0, ID_CAMERA_STRAFELEFT }, { "Camera_StrafeLeft", VK_COMMA, 0, ID_CAMERA_STRAFELEFT },
{ "Camera_UpFloor", VK_PRIOR, 0, ID_VIEW_UPFLOOR }, { "Camera_UpFloor", VK_PRIOR, 0, ID_VIEW_UPFLOOR },
@ -158,14 +159,20 @@ SCommandInfo g_Commands[] = {
{ "Grid_Set16", '5', 0, ID_GRID_16 }, { "Grid_Set16", '5', 0, ID_GRID_16 },
{ "Grid_Set32", '6', 0, ID_GRID_32 }, { "Grid_Set32", '6', 0, ID_GRID_32 },
{ "Grid_Set64", '7', 0, ID_GRID_64 }, { "Grid_Set64", '7', 0, ID_GRID_64 },
{ "Grid_Down", 219, 0, ID_GRID_PREV }, { "Grid_Down", VK_OEM_4, 0, ID_GRID_PREV }, /* [{ in us layout */
{ "Grid_Up", 221, 0, ID_GRID_NEXT }, { "Grid_Up", VK_OEM_6, 0, ID_GRID_NEXT }, /* ]} in US layouts */
{ "Grid_Toggle", '0', 0, ID_GRID_TOGGLE }, { "Grid_Toggle", '0', 0, ID_GRID_TOGGLE },
{ "Grid_ToggleSizePaint", 'Q', RAD_PRESS, ID_SELECTION_TOGGLESIZEPAINT }, { "Grid_ToggleSizePaint", 'Q', RAD_PRESS, ID_SELECTION_TOGGLESIZEPAINT },
{ "Grid_PrecisionCursorMode",VK_F11, 0 , ID_PRECISION_CURSOR_CYCLE}, { "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_NextView", VK_TAB, RAD_CONTROL, ID_VIEW_NEXTVIEW },
{ "Grid_ToggleCrosshairs", 'X', RAD_SHIFT, ID_VIEW_CROSSHAIR }, { "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_SplitSelected", VK_RETURN, RAD_SHIFT, ID_SPLIT_SELECTED },
{ "Clipper_FlipClip", VK_RETURN, RAD_CONTROL, ID_FLIP_CLIP }, { "Clipper_FlipClip", VK_RETURN, RAD_CONTROL, ID_FLIP_CLIP },
{ "CameraClip_ZoomOut", 219, RAD_CONTROL, ID_VIEW_CUBEOUT }, { "CameraClip_ZoomOut", VK_OEM_4, RAD_CONTROL, ID_VIEW_CUBEOUT },
{ "CameraClip_ZoomIn", 221, RAD_CONTROL, ID_VIEW_CUBEIN }, { "CameraClip_ZoomIn", VK_OEM_5, RAD_CONTROL, ID_VIEW_CUBEIN },
{ "CameraClip_Toggle", 220, RAD_CONTROL, ID_VIEW_CUBICCLIPPING }, { "CameraClip_Toggle", VK_OEM_6, RAD_CONTROL, ID_VIEW_CUBICCLIPPING },
{ "ViewTab_EntityInfo", 'N', 0, ID_VIEW_ENTITY }, { "ViewTab_EntityInfo", 'N', 0, ID_VIEW_ENTITY },
{ "ViewTab_Console", 'O', 0, ID_VIEW_CONSOLE }, { "ViewTab_Console", 'O', 0, ID_VIEW_CONSOLE },
@ -289,6 +296,9 @@ SCommandInfo g_Commands[] = {
int g_nCommandCount = sizeof(g_Commands) / sizeof(SCommandInfo); int g_nCommandCount = sizeof(g_Commands) / sizeof(SCommandInfo);
SKeyInfo g_Keys[] = { SKeyInfo g_Keys[] = {
/* To understand the VK_* information, please read the MSDN:
http://msdn.microsoft.com/en-us/library/ms927178.aspx
*/
{ "Space", VK_SPACE }, { "Space", VK_SPACE },
{ "Backspace", VK_BACK }, { "Backspace", VK_BACK },
{ "Escape", VK_ESCAPE }, { "Escape", VK_ESCAPE },
@ -330,9 +340,9 @@ SKeyInfo g_Keys[] = {
{ "NumPad7", VK_NUMPAD7 }, { "NumPad7", VK_NUMPAD7 },
{ "NumPad8", VK_NUMPAD8 }, { "NumPad8", VK_NUMPAD8 },
{ "NumPad9", VK_NUMPAD9 }, { "NumPad9", VK_NUMPAD9 },
{ "[", 219 }, { "[", VK_OEM_4 }, /* Was 219, 0xDB */
{ "]", 221 }, { "\\", VK_OEM_5 }, /* Was 220, 0xDC */
{ "\\", 220 } { "]", VK_OEM_6 }, /* Was 221, 0xDD */
}; };
int g_nKeyCount = sizeof(g_Keys) / sizeof(SKeyInfo); 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_MAPINFO, OnEditMapinfo)
ON_COMMAND(ID_EDIT_ENTITYINFO, OnEditEntityinfo) ON_COMMAND(ID_EDIT_ENTITYINFO, OnEditEntityinfo)
ON_COMMAND(ID_VIEW_NEXTVIEW, OnViewNextview) 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_HELP_COMMANDLIST, OnHelpCommandlist)
ON_COMMAND(ID_FILE_NEWPROJECT, OnFileNewproject) ON_COMMAND(ID_FILE_NEWPROJECT, OnFileNewproject)
ON_COMMAND(ID_FLIP_CLIP, OnFlipClip) ON_COMMAND(ID_FLIP_CLIP, OnFlipClip)
@ -3878,6 +3891,42 @@ void CMainFrame::OnViewNextview() {
Sys_UpdateWindows(W_XY | W_CAMERA); 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 */
/* /*
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================

View file

@ -198,6 +198,13 @@ public:
afx_msg void OnFileSave(); afx_msg void OnFileSave();
afx_msg void OnFileSaveas(); afx_msg void OnFileSaveas();
afx_msg void OnFileSaveCopy(); 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 OnViewShowModels();
afx_msg void OnView100(); afx_msg void OnView100();
afx_msg void OnViewCenter(); afx_msg void OnViewCenter();

View file

@ -303,7 +303,7 @@ void CPreviewDlg::OnTvnSelchangedTreeMedia(NMHDR *pNMHDR, LRESULT *pResult)
} }
// strip the leading "base/" // strip the leading "base/"
if (id == MATERIALS) { if (id == MATERIALS) {
mediaName.Strip("Materials/"); mediaName.Strip("Materials/"); // FIXME: SteelStorm2 has a _v1 suffix here
} else if (id == WAVES) { } else if (id == WAVES) {
mediaName.Strip( "Wave files/" ); mediaName.Strip( "Wave files/" );
} else if (id == PARTICLES) { } else if (id == PARTICLES) {
@ -608,7 +608,7 @@ void CPreviewDlg::AddMaterials(bool rootItems) {
list.Append(mat->GetName()); list.Append(mat->GetName());
} }
list.Sort(); list.Sort();
AddStrList("Materials", list, MATERIALS); AddStrList("Materials", list, MATERIALS); // FIXME: SteelStorm2 has a _v1 suffix here
} }
} }