[dhewm3] 01/02: Imported Upstream version 0+git20151005+dfsg
Tobias Frost
tobi at moszumanska.debian.org
Mon Oct 5 17:49:52 UTC 2015
This is an automated email from the git hooks/post-receive script.
tobi pushed a commit to branch master
in repository dhewm3.
commit 8c38a4540d58b5ecd6d8e5b1d011df8c7dec41a8
Author: Tobias Frost <tobi at coldtobi.de>
Date: Mon Oct 5 19:39:26 2015 +0200
Imported Upstream version 0+git20151005+dfsg
---
ChangeLog | 80 +++++++++++++++++++++++++++++++++++
README.md | 54 +++++++----------------
neo/CMakeLists.txt | 79 +++++++++++++++++++---------------
neo/d3xp/Game_local.cpp | 9 +++-
neo/framework/BuildDefines.h | 2 +-
neo/framework/Console.cpp | 14 ++++--
neo/framework/Licensee.h | 2 +-
neo/framework/Session.cpp | 4 +-
neo/game/Game_local.cpp | 9 +++-
neo/idlib/Parser.cpp | 6 +--
neo/renderer/RenderSystem_init.cpp | 56 ++++++++++++++++++++++--
neo/sound/snd_efxfile.cpp | 2 +-
neo/sound/snd_system.cpp | 2 +-
neo/sys/events.cpp | 54 +++++++++++++----------
neo/sys/linux/main.cpp | 6 ++-
neo/sys/posix/posix_main.cpp | 4 +-
neo/tools/compilers/dmap/optimize.cpp | 4 +-
neo/ui/ChoiceWindow.cpp | 14 ++++++
neo/ui/UserInterface.cpp | 19 ++++++++-
neo/ui/Window.cpp | 2 +-
20 files changed, 304 insertions(+), 118 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 101496c..18ab7dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,83 @@
+2015-10-03 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Release Candiate 1 preparations, other small fixes
+
+2015-10-03 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Esc should only open menu if shift isn't pressed (=> shift+esc for console)
+
+2015-10-03 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Merge pull request #121 from svdijk/master
+
+2015-10-03 svdijk <svdijk at users.sourceforge.net>
+
+ * Win32: Add an icon to the dhewm3 executable
+
+2015-10-01 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Update README: Use Homebrew instead of MacPorts for dependencies on OS X
+
+2015-09-30 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Fix mouse cursor moving to fast in fullscreen GUIs (main menu, PDA)
+
+2015-09-30 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Sys_GetEvent(): Don't return res_none when more events are available
+
+2015-09-30 Daniel Gibson <metalcaedes at gmail.com>
+
+ * no allocation per SDL_TEXTINPUT event
+
+2015-06-20 Francisco Magalhães <franmagneto at gmail.com>
+
+ * Add support for brazilian keyboard layout
+
+2015-09-30 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Linux: Fix fallback to look for gamedata in /usr/local/games/doom3/
+
+2015-09-29 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Change default values for some video and sound (EAX) CVars
+
+2015-09-28 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Nasty hack to show more default resolutions in menu
+
+2015-09-28 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Fix input on Windows with SDL2 (fix #100)
+
+2015-09-28 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Fix Windows Build with SDL2
+
+2015-09-27 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Shift+Escape should also open the console
+
+2015-09-27 Daniel Gibson <metalcaedes at gmail.com>
+
+ * make "./dhewm3 +set in_tty 0" actually work
+
+2015-09-27 Daniel Gibson <metalcaedes at gmail.com>
+
+ * print "dhewm 3 1.4.0" in the console, not "dhewm 1.4.0"
+
+2015-09-27 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Fix some compiler warnings (wrong types, superfluous checks, printf-fuckup)
+
+2015-09-27 Daniel Gibson <metalcaedes at gmail.com>
+
+ * (Hopefully) fix crashes in MP if r_aspectRatio = -1, fix #70
+
+2015-09-27 Daniel Gibson <metalcaedes at gmail.com>
+
+ * Prepare for 1.4.0 release, make SDL2 default, update README
+
2015-07-23 Daniel Gibson <metalcaedes at gmail.com>
* Merge pull request #118 from jmtd/patch-1
diff --git a/README.md b/README.md
index 46e9394..4615146 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,7 @@ Compared to the original _DOOM 3_, the changes of _dhewm 3_ worth mentioning are
- SDL for low level OS support, OpenGL and input handling
- OpenAL for audio output, all OS specific audio backends are gone
- OpenAL EFX for EAX reverb effects (read: EAX on all platforms)
+- Better support for widescreen (and arbitrary display resolutions)
- A portable build system based on CMake
- (Cross-)compilation with mingw-w64
@@ -34,7 +35,8 @@ Compared to the original _DOOM 3_, the changes of _dhewm 3_ worth mentioning are
This source release does not contain any game data, the game data is still
covered by the original EULA and must be obeyed as usual.
-You must patch the game to the latest version.
+You must patch the game to the latest version (1.3.1). See the FAQ for details, including
+how to get the game data from Steam on Linux or OSX.
Note that _Doom 3_ and _Doom 3: Resurrection of Evil_ are available from the Steam store at
@@ -42,6 +44,13 @@ http://store.steampowered.com/app/9050/
http://store.steampowered.com/app/9070/
+You can also buy Steam keys at the Humble Store; currently this seems the only way to
+buy a Doom3 Steam key in Germany (Note that Germans still can't buy the RoE Addon there):
+
+https://www.humblebundle.com/store/p/doom3_storefront
+
+https://www.humblebundle.com/store/p/doom3_resofevil_storefront
+
## Compiling
The build system is based on CMake: http://cmake.org/
@@ -49,17 +58,17 @@ The build system is based on CMake: http://cmake.org/
Required libraries are not part of the tree. These are:
- zlib
-- libjpeg (minimum v6, v8 recommended)
+- libjpeg (v8)
- libogg
- libvorbis
- libvorbisfile (may be part of libvorbis)
- OpenAL (OpenAL Soft required, Creative's and Apple's versions are made of fail)
-- SDL v1.2
+- SDL v1.2 or 2.0 (2.0 recommended)
- libcurl (optional, required for server downloads)
For UNIX-like systems these libraries need to be installed (including the
developer files). It is recommended to use the software management tools of
-your OS (apt-get, portage, rpm, BSD ports, MacPorts, ...).
+your OS (apt-get, portage, rpm, BSD ports, [Homebrew for OS X](http://brew.sh), ...).
For Windows there are two options:
@@ -98,7 +107,7 @@ For cross compiling a CMake Toolchain file is required.
For the mingw-w64 toolchain "i686-w64-mingw32" on Ubuntu precise it looks like:
-<pre>
+```
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
@@ -111,7 +120,7 @@ set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-</pre>
+```
Then point CMake at your Toolchain file:
`cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/Toolchain.cmake -DDHEWM3LIBS=/path/to/dhewm3-libs/i686-w64-mingw32 /path/to/repository/neo`
@@ -119,7 +128,7 @@ Then point CMake at your Toolchain file:
## Back End Rendering of Stencil Shadows
The Doom 3 GPL source code release does not include functionality enabling rendering
-of stencil shadows via the depth fail method, a functionality commonly known as
+of stencil shadows via the "depth fail" method, a functionality commonly known as
"Carmack's Reverse".
## MayaImport
@@ -262,37 +271,6 @@ neo/idlib/hashing/CRC32.cpp
Copyright (C) 1995-1998 Mark Adler
-## OpenGL headers
-
-neo/renderer/wglext.h
-
-License Applicability. Except to the extent portions of this file are
-made subject to an alternative license as permitted in the SGI Free
-Software License B, Version 1.1 (the "License"), the contents of this
-file are subject only to the provisions of the License. You may not use
-this file except in compliance with the License. You may obtain a copy
-of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-
-http://oss.sgi.com/projects/FreeB
-
-Note that, as provided in the License, the Software is distributed on an
-"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-
-Original Code. The Original Code is: OpenGL Sample Implementation,
-Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
-Copyright in any portions created by third parties is as indicated
-elsewhere herein. All Rights Reserved.
-
-Additional Notice Provisions: This software was created using the
-OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
-not been independently verified as being compliant with the OpenGL(R)
-version 1.2.1 Specification.
-
## Brandelf utility
neo/sys/linux/setup/brandelf.c
diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt
index 6e92d0c..9d3ea50 100644
--- a/neo/CMakeLists.txt
+++ b/neo/CMakeLists.txt
@@ -1,5 +1,5 @@
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(dhewm3)
-cmake_minimum_required(VERSION 2.6)
# TODO
@@ -17,11 +17,20 @@ cmake_minimum_required(VERSION 2.6)
# LIBC_MALLOC -DUSE_LIBC_MALLOC=0
# ID_NOLANADDRESS -DID_NOLANADDRESS
+# fallback for cmake versions without add_compile_options
+if(NOT COMMAND add_compile_options)
+ function(add_compile_options)
+ foreach(arg ${ARGN})
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${arg}" PARENT_SCOPE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${arg}" PARENT_SCOPE)
+ endforeach()
+ endfunction()
+endif()
+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sys/cmake")
set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
include(CheckCXXCompilerFlag)
-include(CheckFunctionExists)
include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GNUINSTALLDIRS)
option(CORE "Build the core" ON)
@@ -29,7 +38,7 @@ option(BASE "Build the base game code" ON)
option(D3XP "Build the d3xp game code" ON)
option(DEDICATED "Build the dedicated server" OFF)
option(ONATIVE "Optimize for the host CPU" OFF)
-option(SDL2 "Use SDL2 instead of SDL1.2" OFF)
+option(SDL2 "Use SDL2 instead of SDL1.2" ON)
if(NOT CMAKE_SYSTEM_PROCESSOR)
message(FATAL_ERROR "No target CPU architecture set")
@@ -129,13 +138,13 @@ endif()
# compiler specific flags
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
- add_definitions(-pipe)
- add_definitions(-Wall)
+ add_compile_options(-pipe)
+ add_compile_options(-Wall)
if(NOT CMAKE_CROSSCOMPILING AND ONATIVE)
- add_definitions(-march=native)
+ add_compile_options(-march=native)
elseif(NOT APPLE AND cpu STREQUAL "x86")
- add_definitions(-march=pentium3)
+ add_compile_options(-march=pentium3)
endif()
set(CMAKE_C_FLAGS_DEBUG "-g -D_DEBUG -O1")
@@ -148,47 +157,47 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL})
set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})
- add_definitions(-fno-strict-aliasing)
+ add_compile_options(-fno-strict-aliasing)
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
if(NOT cxx_has_fvisibility)
message(FATAL_ERROR "Compiler does not support -fvisibility")
endif()
- add_definitions(-fvisibility=hidden)
+ add_compile_options(-fvisibility=hidden)
# TODO fix these warnings
- add_definitions(-Wno-sign-compare)
- add_definitions(-Wno-switch)
- add_definitions(-Wno-format-security)
+ add_compile_options(-Wno-sign-compare)
+ add_compile_options(-Wno-switch)
+ add_compile_options(-Wno-format-security)
CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual)
if(cxx_has_Woverload_virtual)
- add_definitions(-Woverloaded-virtual)
+ add_compile_options(-Woverloaded-virtual)
endif()
if(APPLE)
add_definitions(-DMACOS_X=1)
if(cpu STREQUAL "x86_64")
- add_definitions(-arch x86_64 -mmacosx-version-min=10.6)
+ add_compile_options(-arch x86_64 -mmacosx-version-min=10.6)
set(ldflags "${ldflags} -arch x86_64 -mmacosx-version-min=10.6")
elseif(cpu STREQUAL "x86")
CHECK_CXX_COMPILER_FLAG("-arch i386" cxx_has_arch_i386)
if(cxx_has_arch_i386)
- add_definitions(-arch i386)
+ add_compile_options(-arch i386)
set(ldflags "${ldflags} -arch i386")
endif()
- add_definitions(-mmacosx-version-min=10.4)
+ add_compile_options(-mmacosx-version-min=10.4)
set(ldflags "${ldflags} -mmacosx-version-min=10.4")
elseif(cpu STREQUAL "ppc")
CHECK_CXX_COMPILER_FLAG("-arch ppc" cxx_has_arch_ppc)
if(cxx_has_arch_ppc)
- add_definitions(-arch ppc)
+ add_compile_options(-arch ppc)
set(ldflags "${ldflags} -arch ppc")
endif()
- add_definitions(-mmacosx-version-min=10.4)
+ add_compile_options(-mmacosx-version-min=10.4)
set(ldflags "${ldflags} -mmacosx-version-min=10.4")
else()
message(FATAL_ERROR "Unsupported CPU architecture for OSX")
@@ -197,21 +206,19 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(sys_libs ${sys_libs} "-framework Carbon -framework Cocoa -framework IOKit")
elseif(WIN32)
set(ldflags "${ldflags} -static-libgcc -static-libstdc++")
- else()
- if(os STREQUAL "linux")
- set(sys_libs ${sys_libs} dl)
- endif()
+ elseif(os STREQUAL "linux")
+ set(sys_libs ${sys_libs} dl)
endif()
elseif(MSVC)
- add_definitions(/W4)
- add_definitions(/wd4100) # unreferenced formal parameter
- add_definitions(/wd4127) # conditional expression is constant
- add_definitions(/wd4244) # possible loss of data
- add_definitions(/wd4245) # signed/unsigned mismatch
- add_definitions(/wd4267) # possible loss of data
- add_definitions(/wd4714) # 'function' marked as __forceinline not inlined
- add_definitions(/wd4996) # 'function': was declared deprecated
- add_definitions(/wd4068) # unknown pragma
+ add_compile_options(/W4)
+ add_compile_options(/wd4100) # unreferenced formal parameter
+ add_compile_options(/wd4127) # conditional expression is constant
+ add_compile_options(/wd4244) # possible loss of data
+ add_compile_options(/wd4245) # signed/unsigned mismatch
+ add_compile_options(/wd4267) # possible loss of data
+ add_compile_options(/wd4714) # 'function' marked as __forceinline not inlined
+ add_compile_options(/wd4996) # 'function': was declared deprecated
+ add_compile_options(/wd4068) # unknown pragma
add_definitions(-D_ALLOW_KEYWORD_MACROS) # because of the "#define private public" and "#define protected public" in TypeInfo.cpp
set(CMAKE_C_FLAGS_DEBUG "-D_DEBUG /Od /Zi /MDd")
set(CMAKE_C_FLAGS_RELEASE "/Ox /Oy /MD")
@@ -235,6 +242,7 @@ if(WIN32)
winmm
iphlpapi
wsock32
+ ole32
)
endif()
@@ -670,8 +678,8 @@ set(src_stub_gl sys/stub/stub_gl.cpp)
if(APPLE)
set(OSX_RESOURCE_FILES
- "${CMAKE_SOURCE_DIR}/sys/osx/Doom3.icns"
- "${CMAKE_SOURCE_DIR}/sys/osx/Doom 3.rsrc"
+ "${CMAKE_SOURCE_DIR}/sys/osx/Doom3.icns"
+ "${CMAKE_SOURCE_DIR}/sys/osx/Doom 3.rsrc"
)
set_source_files_properties(${OSX_RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
@@ -693,6 +701,10 @@ if(APPLE)
${OSX_RESOURCE_FILES}
)
elseif(WIN32)
+ set(WIN32_RESOURCE_FILES
+ "${CMAKE_SOURCE_DIR}/sys/win32/rc/dhewm3.rc"
+ )
+
set(src_sys_base
sys/cpu.cpp
sys/threads.cpp
@@ -708,6 +720,7 @@ elseif(WIN32)
set(src_sys_core
sys/glimp.cpp
+ ${WIN32_RESOURCE_FILES}
)
else()
set(src_sys_base
diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp
index 77614cd..dc09037 100644
--- a/neo/d3xp/Game_local.cpp
+++ b/neo/d3xp/Game_local.cpp
@@ -2653,7 +2653,7 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// FIXME: somehow, this is happening occasionally
assert( fov_y > 0 );
if ( fov_y <= 0 ) {
- Error( "idGameLocal::CalcFov: bad result" );
+ Error( "idGameLocal::CalcFov: bad result, fov_y == %f, base_fov == %f", fov_y, base_fov );
}
switch( r_aspectRatio.GetInteger() ) {
@@ -2662,6 +2662,13 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// auto mode => use aspect ratio from resolution, assuming screen's pixels are squares
ratio_x = renderSystem->GetScreenWidth();
ratio_y = renderSystem->GetScreenHeight();
+ if(ratio_x <= 0.0f || ratio_y <= 0.0f)
+ {
+ // for some reason (maybe this is a dedicated server?) GetScreenWidth()/Height()
+ // returned 0. Assume default 4:3 to avoid assert()/Error() below.
+ fov_x = base_fov;
+ return;
+ }
break;
case 0 :
// 4:3
diff --git a/neo/framework/BuildDefines.h b/neo/framework/BuildDefines.h
index 0298693..67cbf7c 100644
--- a/neo/framework/BuildDefines.h
+++ b/neo/framework/BuildDefines.h
@@ -75,7 +75,7 @@ If you have questions concerning this license or the applicable additional terms
#define ID_ALLOW_TOOLS
#endif
-#define ID_ENFORCE_KEY_CLIENT 0
+#define ID_ENFORCE_KEY 0
#ifndef ID_ENFORCE_KEY
# if !defined( ID_DEDICATED )
diff --git a/neo/framework/Console.cpp b/neo/framework/Console.cpp
index 1b2a5da..7b81b2c 100644
--- a/neo/framework/Console.cpp
+++ b/neo/framework/Console.cpp
@@ -792,8 +792,15 @@ ProcessEvent
==============
*/
bool idConsoleLocal::ProcessEvent( const sysEvent_t *event, bool forceAccept ) {
- bool consoleKey;
- consoleKey = event->evType == SE_KEY && ( event->evValue == Sys_GetConsoleKey( false ) || event->evValue == Sys_GetConsoleKey( true ) );
+ bool consoleKey = false;
+ if(event->evType == SE_KEY)
+ {
+ if( event->evValue == Sys_GetConsoleKey( false ) || event->evValue == Sys_GetConsoleKey( true )
+ || (event->evValue == K_ESCAPE && idKeyInput::IsDown( K_SHIFT )) ) // shift+esc should also open console
+ {
+ consoleKey = true;
+ }
+ }
#if ID_CONSOLE_LOCK
// If the console's not already down, and we have it turned off, check for ctrl+alt
@@ -821,8 +828,9 @@ bool idConsoleLocal::ProcessEvent( const sysEvent_t *event, bool forceAccept ) {
} else {
consoleField.Clear();
keyCatching = true;
- if ( idKeyInput::IsDown( K_SHIFT ) ) {
+ if ( idKeyInput::IsDown( K_SHIFT ) && event->evValue != K_ESCAPE ) {
// if the shift key is down, don't open the console as much
+ // except we used shift+esc.
SetDisplayFraction( 0.2f );
} else {
SetDisplayFraction( 0.5f );
diff --git a/neo/framework/Licensee.h b/neo/framework/Licensee.h
index 9cc20fb..0d7cd4b 100644
--- a/neo/framework/Licensee.h
+++ b/neo/framework/Licensee.h
@@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms
#define GAME_NAME "dhewm 3" // appears on window titles and errors
-#define ENGINE_VERSION "dhewm 1.3.1" // printed in console
+#define ENGINE_VERSION "dhewm 3 1.4.0 RC1" // printed in console
// paths
#define BASE_GAMEDIR "base"
diff --git a/neo/framework/Session.cpp b/neo/framework/Session.cpp
index a2c4c2a..579a662 100644
--- a/neo/framework/Session.cpp
+++ b/neo/framework/Session.cpp
@@ -2148,7 +2148,9 @@ idSessionLocal::ProcessEvent
*/
bool idSessionLocal::ProcessEvent( const sysEvent_t *event ) {
// hitting escape anywhere brings up the menu
- if ( !guiActive && event->evType == SE_KEY && event->evValue2 == 1 && event->evValue == K_ESCAPE ) {
+ // DG: but shift-escape should bring up console instead so ignore that
+ if ( !guiActive && event->evType == SE_KEY && event->evValue2 == 1
+ && event->evValue == K_ESCAPE && !idKeyInput::IsDown( K_SHIFT ) ) {
console->Close();
if ( game ) {
idUserInterface *gui = NULL;
diff --git a/neo/game/Game_local.cpp b/neo/game/Game_local.cpp
index d7c846c..524bc5d 100644
--- a/neo/game/Game_local.cpp
+++ b/neo/game/Game_local.cpp
@@ -2387,7 +2387,7 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// FIXME: somehow, this is happening occasionally
assert( fov_y > 0 );
if ( fov_y <= 0 ) {
- Error( "idGameLocal::CalcFov: bad result" );
+ Error( "idGameLocal::CalcFov: bad result, fov_y == %f, base_fov == %f", fov_y, base_fov );
}
switch( r_aspectRatio.GetInteger() ) {
@@ -2396,6 +2396,13 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// auto mode => use aspect ratio from resolution, assuming screen's pixels are squares
ratio_x = renderSystem->GetScreenWidth();
ratio_y = renderSystem->GetScreenHeight();
+ if(ratio_x <= 0.0f || ratio_y <= 0.0f)
+ {
+ // for some reason (maybe this is a dedicated server?) GetScreenWidth()/Height()
+ // returned 0. Assume default 4:3 to avoid assert()/Error() below.
+ fov_x = base_fov;
+ return;
+ }
break;
case 0 :
// 4:3
diff --git a/neo/idlib/Parser.cpp b/neo/idlib/Parser.cpp
index 931fd52..86a57d3 100644
--- a/neo/idlib/Parser.cpp
+++ b/neo/idlib/Parser.cpp
@@ -712,9 +712,9 @@ int idParser::ExpandBuiltinDefine( idToken *deftoken, define_t *define, idToken
curtime = ctime(&t);
(*token) = "\"";
token->Append( curtime+4 );
- token[7] = '\0';
+ token[7] = NULL;
token->Append( curtime+20 );
- token[10] = '\0';
+ token[10] = NULL;
token->Append( "\"" );
free(curtime);
token->type = TT_STRING;
@@ -731,7 +731,7 @@ int idParser::ExpandBuiltinDefine( idToken *deftoken, define_t *define, idToken
curtime = ctime(&t);
(*token) = "\"";
token->Append( curtime+11 );
- token[8] = '\0';
+ token[8] = NULL;
token->Append( "\"" );
free(curtime);
token->type = TT_STRING;
diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp
index 5b443fb..9c7d575 100644
--- a/neo/renderer/RenderSystem_init.cpp
+++ b/neo/renderer/RenderSystem_init.cpp
@@ -54,9 +54,9 @@ const char *r_rendererArgs[] = { "best", "arb2", NULL };
idCVar r_inhibitFragmentProgram( "r_inhibitFragmentProgram", "0", CVAR_RENDERER | CVAR_BOOL, "ignore the fragment program extension" );
idCVar r_useLightPortalFlow( "r_useLightPortalFlow", "1", CVAR_RENDERER | CVAR_BOOL, "use a more precise area reference determination" );
idCVar r_multiSamples( "r_multiSamples", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "number of antialiasing samples" );
-idCVar r_mode( "r_mode", "3", CVAR_ARCHIVE | CVAR_RENDERER | CVAR_INTEGER, "video mode number" );
+idCVar r_mode( "r_mode", "5", CVAR_ARCHIVE | CVAR_RENDERER | CVAR_INTEGER, "video mode number" );
idCVar r_displayRefresh( "r_displayRefresh", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_NOCHEAT, "optional display refresh rate option for vid mode", 0.0f, 200.0f );
-idCVar r_fullscreen( "r_fullscreen", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "0 = windowed, 1 = full screen" );
+idCVar r_fullscreen( "r_fullscreen", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "0 = windowed, 1 = full screen" );
idCVar r_customWidth( "r_customWidth", "720", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "custom screen width. set r_mode to -1 to activate" );
idCVar r_customHeight( "r_customHeight", "486", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "custom screen height. set r_mode to -1 to activate" );
idCVar r_singleTriangle( "r_singleTriangle", "0", CVAR_RENDERER | CVAR_BOOL, "only draw a single triangle per primitive" );
@@ -84,7 +84,7 @@ idCVar r_znear( "r_znear", "3", CVAR_RENDERER | CVAR_FLOAT, "near Z clip plane d
idCVar r_ignoreGLErrors( "r_ignoreGLErrors", "1", CVAR_RENDERER | CVAR_BOOL, "ignore GL errors" );
idCVar r_finish( "r_finish", "0", CVAR_RENDERER | CVAR_BOOL, "force a call to glFinish() every frame" );
-idCVar r_swapInterval( "r_swapInterval", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "changes the GL swap interval" );
+idCVar r_swapInterval( "r_swapInterval", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "changes the GL swap interval" );
idCVar r_gamma( "r_gamma", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_FLOAT, "changes gamma tables", 0.5f, 3.0f );
idCVar r_brightness( "r_brightness", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_FLOAT, "changes gamma tables", 0.5f, 2.0f );
@@ -449,7 +449,7 @@ R_GetModeInfo
r_mode is normally a small non-negative integer that
looks resolutions up in a table, but if it is set to -1,
-the values from r_customWidth, amd r_customHeight
+the values from r_customWidth, and r_customHeight
will be used instead.
====================
*/
@@ -468,6 +468,20 @@ vidmode_t r_vidModes[] = {
{ "Mode 6: 1152x864", 1152, 864 },
{ "Mode 7: 1280x1024", 1280, 1024 },
{ "Mode 8: 1600x1200", 1600, 1200 },
+ // DG: from here on: modes I added.
+ { "Mode 9: 1280x720", 1280, 720 },
+ { "Mode 10: 1366x768", 1366, 768 },
+ { "Mode 11: 1440x900", 1440, 900 },
+ { "Mode 12: 1400x1050", 1400, 1050 },
+ { "Mode 13: 1600x900", 1600, 900 },
+ { "Mode 14: 1680x1050", 1680, 1050 },
+ { "Mode 15: 1920x1080", 1920, 1080 },
+ { "Mode 16: 1920x1200", 1920, 1200 },
+ { "Mode 17: 2048x1152", 2048, 1152 },
+ { "Mode 18: 2560x1600", 2560, 1600 },
+ { "Mode 19: 3200x2400", 3200, 2400 },
+ { "Mode 20: 3840x2160", 3840, 2160 },
+ { "Mode 21: 4096x2304", 4096, 2304 },
};
static int s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) );
@@ -499,6 +513,40 @@ static bool R_GetModeInfo( int *width, int *height, int mode ) {
return true;
}
+// DG: the following two functions are part of a horrible hack in ChoiceWindow.cpp
+// to overwrite the default resolution list in the system options menu
+
+// "r_custom*;640x480;800x600;1024x768;..."
+idStr R_GetVidModeListString()
+{
+ idStr ret = "r_custom*";
+ // for some reason, modes 0-2 are not used. maybe too small for GUI?
+ for(int mode=3; mode<s_numVidModes; ++mode)
+ {
+ int w, h;
+ if(R_GetModeInfo(&w, &h, mode))
+ {
+ idStr modeStr;
+ sprintf(modeStr, ";%dx%d", w, h);
+ ret += modeStr;
+ }
+ }
+ return ret;
+}
+
+// r_mode values for resolutions from R_GetVidModeListString(): "-1;3;4;5;..."
+idStr R_GetVidModeValsString()
+{
+ idStr ret = "-1"; // for custom resolutions using r_customWidth/r_customHeight
+ for(int mode=3; mode<s_numVidModes; ++mode)
+ {
+ ret += ";";
+ ret += mode;
+ }
+ return ret;
+}
+// DG end
+
/*
==================
diff --git a/neo/sound/snd_efxfile.cpp b/neo/sound/snd_efxfile.cpp
index cbf7fe1..594afe8 100644
--- a/neo/sound/snd_efxfile.cpp
+++ b/neo/sound/snd_efxfile.cpp
@@ -273,7 +273,7 @@ bool idEFXFile::LoadFile( const char *filename, bool OSPath ) {
}
if ( !src.ExpectTokenString( "Version" ) ) {
- return NULL;
+ return false;
}
if ( src.ParseInt() != 1 ) {
diff --git a/neo/sound/snd_system.cpp b/neo/sound/snd_system.cpp
index 27a8fac..a55fb52 100644
--- a/neo/sound/snd_system.cpp
+++ b/neo/sound/snd_system.cpp
@@ -70,7 +70,7 @@ idCVar idSoundSystemLocal::s_enviroSuitVolumeScale( "s_enviroSuitVolumeScale", "
idCVar idSoundSystemLocal::s_skipHelltimeFX( "s_skipHelltimeFX", "0", CVAR_SOUND | CVAR_BOOL, "" );
#if !defined(ID_DEDICATED)
-idCVar idSoundSystemLocal::s_useEAXReverb( "s_useEAXReverb", "0", CVAR_SOUND | CVAR_BOOL | CVAR_ARCHIVE, "use EFX reverb" );
+idCVar idSoundSystemLocal::s_useEAXReverb( "s_useEAXReverb", "1", CVAR_SOUND | CVAR_BOOL | CVAR_ARCHIVE, "use EFX reverb" );
idCVar idSoundSystemLocal::s_decompressionLimit( "s_decompressionLimit", "6", CVAR_SOUND | CVAR_INTEGER | CVAR_ARCHIVE, "specifies maximum uncompressed sample length in seconds" );
#else
idCVar idSoundSystemLocal::s_useEAXReverb( "s_useEAXReverb", "0", CVAR_SOUND | CVAR_BOOL | CVAR_ROM, "EFX not available in this build" );
diff --git a/neo/sys/events.cpp b/neo/sys/events.cpp
index ffb8eb0..9b3a668 100644
--- a/neo/sys/events.cpp
+++ b/neo/sys/events.cpp
@@ -59,7 +59,7 @@ If you have questions concerning this license or the applicable additional terms
#endif
const char *kbdNames[] = {
- "english", "french", "german", "italian", "spanish", "turkish", "norwegian", NULL
+ "english", "french", "german", "italian", "spanish", "turkish", "norwegian", "brazilian", NULL
};
idCVar in_kbd("in_kbd", "english", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_NOCHEAT, "keyboard layout", kbdNames, idCmdSystem::ArgCompletion_String<kbdNames> );
@@ -343,6 +343,9 @@ unsigned char Sys_GetConsoleKey(bool shifted) {
} else if (!lang.Icmp("norwegian")) {
keys[0] = 124; // |
keys[1] = 167; // §
+ } else if (!lang.Icmp("brazilian")) {
+ keys[0] = '\'';
+ keys[1] = '"';
}
}
@@ -390,17 +393,17 @@ sysEvent_t Sys_GetEvent() {
static const sysEvent_t res_none = { SE_NONE, 0, 0, 0, NULL };
#if SDL_VERSION_ATLEAST(2, 0, 0)
- static char *s = NULL;
+ static char s[SDL_TEXTINPUTEVENT_TEXT_SIZE] = {0};
static size_t s_pos = 0;
- if (s) {
+ if (s[0] != '\0') {
res.evType = SE_CHAR;
res.evValue = s[s_pos];
- s_pos++;
- if (!s[s_pos]) {
- free(s);
- s = NULL;
+ ++s_pos;
+
+ if (!s[s_pos] || s_pos == SDL_TEXTINPUTEVENT_TEXT_SIZE) {
+ memset(s, 0, sizeof(s));
s_pos = 0;
}
@@ -419,7 +422,8 @@ sysEvent_t Sys_GetEvent() {
return res;
}
- if (SDL_PollEvent(&ev)) {
+ // loop until there is an event we care about (will return then) or no more events
+ while(SDL_PollEvent(&ev)) {
switch (ev.type) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_WINDOWEVENT:
@@ -443,7 +447,7 @@ sysEvent_t Sys_GetEvent() {
break;
}
- return res_none;
+ continue; // handle next event
#else
case SDL_ACTIVEEVENT:
{
@@ -465,10 +469,10 @@ sysEvent_t Sys_GetEvent() {
GLimp_GrabInput(flags);
}
- return res_none;
+ continue; // handle next event
case SDL_VIDEOEXPOSE:
- return res_none;
+ continue; // handle next event
#endif
case SDL_KEYDOWN:
@@ -492,19 +496,18 @@ sysEvent_t Sys_GetEvent() {
} else {
if (ev.type == SDL_KEYDOWN)
common->Warning("unmapped SDL key %d (0x%x)", ev.key.keysym.sym, ev.key.keysym.unicode);
- return res_none;
+ continue; // handle next event
}
}
#else
if(!key) {
- if (ev.key.keysym.scancode == SDL_SCANCODE_GRAVE) {
+ if (ev.key.keysym.scancode == SDL_SCANCODE_GRAVE) { // TODO: always do this check?
key = Sys_GetConsoleKey(true);
} else {
if (ev.type == SDL_KEYDOWN) {
common->Warning("unmapped SDL key %d", ev.key.keysym.sym);
- return res_none;
}
-
+ continue; // handle next event
}
}
@@ -528,14 +531,19 @@ sysEvent_t Sys_GetEvent() {
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_TEXTINPUT:
- if (ev.text.text && *ev.text.text) {
- if (!ev.text.text[1])
- c = *ev.text.text;
- else
- s = strdup(ev.text.text);
+ if (ev.text.text[0]) {
+ res.evType = SE_CHAR;
+ res.evValue = ev.text.text[0];
+
+ if (ev.text.text[1] != '\0')
+ {
+ memcpy(s, ev.text.text, SDL_TEXTINPUTEVENT_TEXT_SIZE);
+ s_pos = 1; // pos 0 is returned
+ }
+ return res;
}
- return res_none;
+ continue; // handle next event
#endif
case SDL_MOUSEMOTION:
@@ -614,11 +622,11 @@ sysEvent_t Sys_GetEvent() {
return res;
default:
common->Warning("unknown user event %u", ev.user.code);
- return res_none;
+ continue; // handle next event
}
default:
common->Warning("unknown event %u", ev.type);
- return res_none;
+ continue; // handle next event
}
}
diff --git a/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp
index d4b52b0..01cb25f 100644
--- a/neo/sys/linux/main.cpp
+++ b/neo/sys/linux/main.cpp
@@ -65,7 +65,9 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
// try next to the executable..
if (Sys_GetPath(PATH_EXE, path)) {
path = path.StripFilename();
- if (stat(path.c_str(), &st) != -1 && S_ISDIR(st.st_mode)) {
+ // the path should have a base dir in it, otherwise it probably just contains the executable
+ idStr testPath = path + "/" BASE_GAMEDIR;
+ if (stat(testPath.c_str(), &st) != -1 && S_ISDIR(st.st_mode)) {
common->Warning("using path of executable: %s", path.c_str());
return true;
} else {
@@ -75,7 +77,7 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
// fallback to vanilla doom3 install
if (stat(LINUX_DEFAULT_PATH, &st) != -1 && S_ISDIR(st.st_mode)) {
- common->Warning("using hardcoded default base path");
+ common->Warning("using hardcoded default base path: " LINUX_DEFAULT_PATH);
path = LINUX_DEFAULT_PATH;
return true;
diff --git a/neo/sys/posix/posix_main.cpp b/neo/sys/posix/posix_main.cpp
index fb59d05..51538ad 100644
--- a/neo/sys/posix/posix_main.cpp
+++ b/neo/sys/posix/posix_main.cpp
@@ -363,6 +363,8 @@ Posix_InitConsoleInput
void Posix_InitConsoleInput( void ) {
struct termios tc;
+ common->StartupVariable( "in_tty", false );
+
if ( in_tty.GetBool() ) {
if ( isatty( STDIN_FILENO ) != 1 ) {
Sys_Printf( "terminal support disabled: stdin is not a tty\n" );
@@ -415,7 +417,7 @@ void Posix_InitConsoleInput( void ) {
Sys_Printf( "WARNING: terminal type '%s' is unknown. terminal support may not work correctly\n", term );
}
}
- Sys_Printf( "terminal support enabled ( use +set in_tty 0 to disabled )\n" );
+ Sys_Printf( "terminal support enabled ( use +set in_tty 0 to disable )\n" );
} else {
Sys_Printf( "terminal support disabled\n" );
}
diff --git a/neo/tools/compilers/dmap/optimize.cpp b/neo/tools/compilers/dmap/optimize.cpp
index c0747f5..57cf02f 100644
--- a/neo/tools/compilers/dmap/optimize.cpp
+++ b/neo/tools/compilers/dmap/optimize.cpp
@@ -30,7 +30,9 @@ If you have questions concerning this license or the applicable additional terms
//#pragma optimize( "", off )
-#ifdef WIN32
+
+// #ifdef WIN32 // DG: this caused trouble, especially with SDL2
+#if 0
#include <windows.h>
#include <GL/gl.h>
#endif
diff --git a/neo/ui/ChoiceWindow.cpp b/neo/ui/ChoiceWindow.cpp
index 3bf21a5..1c3914e 100644
--- a/neo/ui/ChoiceWindow.cpp
+++ b/neo/ui/ChoiceWindow.cpp
@@ -352,8 +352,22 @@ void idChoiceWindow::UpdateChoicesAndVals( void ) {
}
}
+idStr R_GetVidModeListString();
+idStr R_GetVidModeValsString();
+
void idChoiceWindow::PostParse() {
idWindow::PostParse();
+
+ // DG: HACKHACKFUCKINGUGLYHACK: overwrite resolution list from mainmenu.gui
+ // to support more resolutions and widescreen and stuff.
+ if( idStr::Cmp(GetName(), "OS2Primary") == 0 && cvarStr == "r_mode"
+ && idStr::Icmp(GetGui()->GetSourceFile(), "guis/mainmenu.gui") == 0 )
+ {
+ choicesStr.Set( R_GetVidModeListString() );
+ choiceVals.Set( R_GetVidModeValsString() );
+ }
+ // DG end
+
UpdateChoicesAndVals();
InitVars();
diff --git a/neo/ui/UserInterface.cpp b/neo/ui/UserInterface.cpp
index 1c1647c..3c7ce77 100644
--- a/neo/ui/UserInterface.cpp
+++ b/neo/ui/UserInterface.cpp
@@ -342,8 +342,23 @@ const char *idUserInterfaceLocal::HandleEvent( const sysEvent_t *event, int _tim
}
if ( event->evType == SE_MOUSE ) {
- cursorX += event->evValue;
- cursorY += event->evValue2;
+ if ( !desktop || (desktop->GetFlags() & WIN_MENUGUI) ) {
+ // DG: this is a fullscreen GUI, scale the mousedelta added to cursorX/Y
+ // by 640/w, because the GUI pretends that everything is 640x480
+ // even if the actual resolution is higher => mouse moved too fast
+ float w = renderSystem->GetScreenWidth();
+ float h = renderSystem->GetScreenHeight();
+ if( w <= 0.0f || h <= 0.0f ) {
+ w = 640.0f;
+ h = 480.0f;
+ }
+ cursorX += event->evValue * (640.0f/w);
+ cursorY += event->evValue2 * (480.0f/h);
+ } else {
+ // not a fullscreen GUI but some ingame thing - no scaling needed
+ cursorX += event->evValue;
+ cursorY += event->evValue2;
+ }
if (cursorX < 0) {
cursorX = 0;
diff --git a/neo/ui/Window.cpp b/neo/ui/Window.cpp
index 3242334..6d4cbc9 100644
--- a/neo/ui/Window.cpp
+++ b/neo/ui/Window.cpp
@@ -2053,7 +2053,7 @@ bool idWindow::ParseRegEntry(const char *name, idParser *src) {
work = name;
work.ToLower();
- idWinVar *var = GetWinVarByName(work, NULL);
+ idWinVar *var = GetWinVarByName(work, false);
if ( var ) {
for (int i = 0; i < NumRegisterVars; i++) {
if (idStr::Icmp(work, RegisterVars[i].name) == 0) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/dhewm3.git
More information about the Pkg-games-commits
mailing list