Merge branch 'master' of https://github.com/zinal/dhewm3 (after cloning)

This commit is contained in:
Maksim Zinal 2018-11-05 17:39:19 +03:00
commit 4657dba8e2
7 changed files with 65 additions and 9 deletions

View file

@ -154,12 +154,12 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-march=pentium3)
endif()
set(CMAKE_C_FLAGS_DEBUG "-g -D_DEBUG -O1")
set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -D_DEBUG -O0")
set(CMAKE_C_FLAGS_DEBUGALL "-g -ggdb -D_DEBUG")
set(CMAKE_C_FLAGS_PROFILE "-g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "-O2 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "-O2 -fno-unsafe-math-optimizations -fno-math-errno -fno-trapping-math -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -fno-unsafe-math-optimizations -fno-math-errno -fno-trapping-math -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -fno-unsafe-math-optimizations -fno-math-errno -fno-trapping-math -fomit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL})
set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})

View file

@ -1779,6 +1779,13 @@ void idPlayer::Spawn( void ) {
cursor = uiManager->FindGui( temp, true, gameLocal.isMultiplayer, gameLocal.isMultiplayer );
}
if ( cursor ) {
// DG: make it scale to 4:3 so crosshair looks properly round
// yes, like so many scaling-related things this is a bit hacky
// and note that this is special cased in StateChanged and you
// can *not* generally set windowDef properties like this.
cursor->SetStateBool("scaleto43", true);
cursor->StateChanged(gameLocal.time); // DG end
cursor->Activate( true, gameLocal.time );
}
@ -2466,6 +2473,12 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( focusTime );
savefile->ReadObject( reinterpret_cast<idClass *&>( focusVehicle ) );
savefile->ReadUserInterface( cursor );
// DG: make it scale to 4:3 so crosshair looks properly round
// yes, like so many scaling-related things this is a bit hacky
// and note that this is special cased in StateChanged and you
// can *not* generally set windowDef properties like this.
cursor->SetStateBool("scaleto43", true);
cursor->StateChanged(gameLocal.time); // DG end
savefile->ReadInt( oldMouseX );
savefile->ReadInt( oldMouseY );

View file

@ -1464,6 +1464,13 @@ void idPlayer::Spawn( void ) {
cursor = uiManager->FindGui( temp, true, gameLocal.isMultiplayer, gameLocal.isMultiplayer );
}
if ( cursor ) {
// DG: make it scale to 4:3 so crosshair looks properly round
// yes, like so many scaling-related things this is a bit hacky
// and note that this is special cased in StateChanged and you
// can *not* generally set windowDef properties like this.
cursor->SetStateBool("scaleto43", true);
cursor->StateChanged(gameLocal.time); // DG end
cursor->Activate( true, gameLocal.time );
}
@ -2026,6 +2033,13 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
savefile->ReadObject( reinterpret_cast<idClass *&>( focusVehicle ) );
savefile->ReadUserInterface( cursor );
// DG: make it scale to 4:3 so crosshair looks properly round
// yes, like so many scaling-related things this is a bit hacky
// and note that this is special cased in StateChanged and you
// can *not* generally set windowDef properties like this.
cursor->SetStateBool("scaleto43", true);
cursor->StateChanged(gameLocal.time); // DG end
savefile->ReadInt( oldMouseX );
savefile->ReadInt( oldMouseY );

View file

@ -44,7 +44,7 @@ class idSaveGame;
class idRestoreGame;
#define MAX_STRING_LEN 128
#define MAX_GLOBALS 196608 // in bytes
#define MAX_GLOBALS 296608 // in bytes - DG: increased this for better support of mods that use the vanilla game dll
#define MAX_STRINGS 1024
#define MAX_FUNCS 3072
#define MAX_STATEMENTS 81920 // statement_t - 18 bytes last I checked

View file

@ -462,6 +462,19 @@ float idUserInterfaceLocal::GetStateFloat( const char *varName, const char* defa
void idUserInterfaceLocal::StateChanged( int _time, bool redraw ) {
time = _time;
if (desktop) {
// DG: little hack: allow game DLLs to do
// ui->SetStateBool("scaleto43", true);
// ui->StateChanged(gameLocal.time);
// so we can force cursors.gui (crosshair) to be scaled, for example
bool scaleTo43 = false;
if(state.GetBool("scaleto43", "0", scaleTo43)) {
if(scaleTo43)
desktop->SetFlag(WIN_SCALETO43);
else
desktop->ClearFlag(WIN_SCALETO43);
}
// DG end
desktop->StateChanged( redraw );
}
if ( state.GetBool( "noninteractive" ) ) {

View file

@ -1215,10 +1215,15 @@ void idWindow::Redraw(float x, float y) {
// DG: allow scaling menus to 4:3
bool fixupFor43 = false;
if ( (flags & (WIN_MENUGUI | WIN_DESKTOP)) == (WIN_MENUGUI | WIN_DESKTOP)
&& r_scaleMenusTo43.GetBool() ) {
fixupFor43 = true;
dc->SetMenuScaleFix(true);
if ( flags & WIN_DESKTOP ) {
// only scale desktop windows (will automatically scale its sub-windows)
// that EITHER have the scaleto43 flag set OR are fullscreen menus and r_scaleMenusTo43 is 1
if( (flags & WIN_SCALETO43) ||
((flags & WIN_MENUGUI) && r_scaleMenusTo43.GetBool()) )
{
fixupFor43 = true;
dc->SetMenuScaleFix(true);
}
}
if ( flags & WIN_SHOWTIME ) {
@ -1946,6 +1951,15 @@ bool idWindow::ParseInternalVar(const char *_name, idParser *src) {
}
return true;
}
// DG: added this window flag for Windows that should be scaled to 4:3
// (with "empty" bars left/right or above/below)
if (idStr::Icmp(_name, "scaleto43") == 0) {
if ( src->ParseBool() ) {
flags |= WIN_SCALETO43;
}
return true;
}
// DG end
if (idStr::Icmp(_name, "forceaspectwidth") == 0) {
forceAspectWidth = src->ParseFloat();
return true;

View file

@ -65,6 +65,8 @@ const int WIN_WANTENTER = 0x01000000;
const int WIN_DESKTOP = 0x10000000;
const int WIN_SCALETO43 = 0x20000000; // DG: for the "scaleto43" window flag (=> scale window to 4:3 with "empty" bars left/right or above/below)
const char CAPTION_HEIGHT[] = "16.0";
const char SCROLLER_SIZE[] = "16.0";
const int SCROLLBAR_SIZE = 16;