* code fixes
	* packer: !FAIL! msg for missing ingame resources, ~fail for the rest
	* bumped stack size to 4Mb to fix crash for huge skies, using old shaders with fairly useless q3map_surfacelight + q3map_lightsubdivide < 999 combo


Radiant:

binds...
	* F5: run first in the list or recently invoked build option
	* F11: fullscreen

misc...
	* opening *.map, sent via cmd line: enabled for non win32 too
	* fix: textures find/replace wnd better default pos, size
	* fix: crash in CSG::Subtract
	* fix crash: main wnd maximized + 'start on primary monitor' off + monitors > 1
	* correct save/restore of main wnd pos/size and maximized/fullscreened states
	* scale widgets consistently along with main wnd, while using regular layout
This commit is contained in:
Garux 2017-08-02 09:06:17 +03:00
parent bf6dd1f2d1
commit e7c45da823
18 changed files with 127 additions and 76 deletions

View File

@ -483,7 +483,9 @@ endif
%.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
$(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--large-address-aware
ifeq ($(OS),Win32)
$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--large-address-aware,--stack,4194304
endif
$(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_ZLIB)
$(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) -Itools/quake3/common -Ilibs -Iinclude
$(INSTALLDIR)/q3map2.$(EXE): \

View File

@ -148,6 +148,11 @@ inline bool string_equal_suffix( const char* string, const char* suffix){
return string_equal_n( s , suffix, string_length( suffix ) );
}
inline bool string_equal_suffix_nocase( const char* string, const char* suffix){
const char *s = string + string_length( string ) - string_length( suffix );
return string_equal_nocase_n( s , suffix, string_length( suffix ) );
}
/// \brief Copies \p other into \p string and returns \p string.
/// Assumes that the space allocated for \p string is at least string_length(other) + 1.
/// O(n)

View File

@ -954,6 +954,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
namespace
{
CopiedString g_buildMenu;
CopiedString g_lastExecutedBuild;
}
void LoadBuildMenu();
@ -996,6 +997,7 @@ BuildMenuItem( const char* name, GtkMenuItem* item )
: m_name( name ), m_item( item ){
}
void run(){
g_lastExecutedBuild = m_name;
RunBSP( m_name );
}
typedef MemberCaller<BuildMenuItem, &BuildMenuItem::run> RunCaller;
@ -1069,3 +1071,13 @@ void BuildMenu_Construct(){
void BuildMenu_Destroy(){
SaveBuildMenu();
}
void Build_runRecentExecutedBuild(){
if( g_lastExecutedBuild.empty() ){
g_BuildMenuItems.begin()->run();
}
else{
RunBSP( g_lastExecutedBuild.c_str() );
}
}

View File

@ -40,5 +40,6 @@ typedef struct _GtkMenu GtkMenu;
void Build_constructMenu( GtkMenu* menu );
extern GtkMenu* g_bsp_menu;
void Build_runRecentExecutedBuild();
#endif

View File

@ -670,8 +670,9 @@ void post( const scene::Path& path, scene::Instance& instance ) const {
delete ( *i );
}
}
scene::Node& parent = path.parent();
Path_deleteTop( path );
if( Node_getTraversable( path.parent() )->empty() ){
if( Node_getTraversable( parent )->empty() ){
m_eraseParent = true;
}
}

View File

@ -180,6 +180,20 @@ bool portable_app_setup(){
return false;
}
char* openCmdMap;
void cmdMap(){
openCmdMap = NULL;
for ( int i = 1; i < g_argc; ++i )
{
//if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){
if( string_equal_suffix_nocase( g_argv[i], ".map" ) ){
openCmdMap = g_argv[i];
}
}
}
#if defined( POSIX )
#include <stdlib.h>
@ -251,24 +265,13 @@ void environment_init( int argc, char* argv[] ){
home_path = home.c_str();
}
gamedetect();
cmdMap();
}
#elif defined( WIN32 )
#include <windows.h>
char* openCmdMap;
void cmdMap(){
openCmdMap = NULL;
for ( int i = 1; i < g_argc; ++i )
{
if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){
openCmdMap = g_argv[i];
}
}
}
void environment_init( int argc, char* argv[] ){
args_init( argc, argv );

View File

@ -29,9 +29,7 @@ const char* environment_get_app_path();
extern int g_argc;
extern char** g_argv;
#if defined( WIN32 )
extern char* openCmdMap;
#endif
#endif

View File

@ -133,7 +133,7 @@ static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer
FindTextureDialog::FindTextureDialog(){
m_bSelectedOnly = FALSE;
//m_position_tracker.setPosition( c_default_window_pos );
m_position_tracker.setPosition( WindowPosition( -1, -1, 0, 0 ) );
}
FindTextureDialog::~FindTextureDialog(){

View File

@ -652,13 +652,10 @@ int main( int argc, char* argv[] ){
hide_splash();
#ifdef WIN32
if( openCmdMap && *openCmdMap ){
Map_LoadFile( openCmdMap );
}
else
#endif // WIN32
if ( g_bLoadLastMap && !g_strLastMap.empty() ) {
else if ( g_bLoadLastMap && !g_strLastMap.empty() ) {
Map_LoadFile( g_strLastMap.c_str() );
}
else

View File

@ -135,11 +135,11 @@ struct layout_globals_t
layout_globals_t() :
m_position( -1, -1, 640, 480 ),
nXYHeight( 300 ),
nXYWidth( 300 ),
nCamWidth( 200 ),
nCamHeight( 200 ),
nState( GDK_WINDOW_STATE_MAXIMIZED ){
nXYHeight( 350 ),
nXYWidth( 600 ),
nCamWidth( 300 ),
nCamHeight( 210 ),
nState( 0 ){
}
};
@ -2117,6 +2117,7 @@ GtkMenuItem* create_bsp_menu(){
}
create_menu_item_with_mnemonic( menu, "Customize...", "BuildMenuCustomize" );
create_menu_item_with_mnemonic( menu, "Run recent build", "Build_runRecentExecutedBuild" );
menu_separator( menu );
@ -2158,6 +2159,7 @@ GtkMenuItem* create_misc_menu(){
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=394
// create_menu_item_with_mnemonic(menu, "_Print XY View", FreeCaller<WXY_Print>());
create_menu_item_with_mnemonic( menu, "_Background select", FreeCaller<WXY_BackgroundSelect>() );
create_menu_item_with_mnemonic( menu, "Fullscreen", "Fullscreen" );
return misc_menu_item;
}
@ -2866,19 +2868,9 @@ void MainFrame::Create(){
#ifdef WIN32
if ( g_multimon_globals.m_bStartOnPrimMon ) {
PositionWindowOnPrimaryScreen( g_layout_globals.m_position );
window_set_position( window, g_layout_globals.m_position );
}
else
#endif
if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ) {
gtk_window_maximize( window );
WindowPosition default_position( -1, -1, 640, 480 );
window_set_position( window, default_position );
}
else
{
window_set_position( window, g_layout_globals.m_position );
}
window_set_position( window, g_layout_globals.m_position );
m_window = window;
@ -2898,22 +2890,22 @@ void MainFrame::Create(){
gtk_widget_show( vsplit2 );
m_vSplit2 = vsplit2;
if ( CurrentStyle() == eRegular ){
gtk_paned_add1( GTK_PANED( hsplit ), vsplit );
gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 );
gtk_paned_pack1( GTK_PANED( hsplit ), vsplit, TRUE, TRUE );
gtk_paned_pack2( GTK_PANED( hsplit ), vsplit2, TRUE, TRUE );
}
else{
gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 );
gtk_paned_pack2( GTK_PANED( hsplit ), vsplit, TRUE, TRUE );
gtk_paned_pack1( GTK_PANED( hsplit ), vsplit2, TRUE, TRUE );
}
// console
GtkWidget* console_window = Console_constructWindow( window );
gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
gtk_paned_pack2( GTK_PANED( vsplit ), console_window, TRUE, TRUE );
// xy
m_pXYWnd = new XYWnd();
m_pXYWnd->SetViewType( XY );
GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) );
gtk_paned_add1( GTK_PANED( vsplit ), xy_window );
gtk_paned_pack1( GTK_PANED( vsplit ), xy_window, TRUE, TRUE );
{
// camera
m_pCamWnd = NewCamWnd();
@ -2921,27 +2913,15 @@ void MainFrame::Create(){
CamWnd_setParent( *m_pCamWnd, window );
GtkFrame* camera_window = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) );
gtk_paned_add1( GTK_PANED( vsplit2 ), GTK_WIDGET( camera_window ) );
gtk_paned_pack1( GTK_PANED( vsplit2 ), GTK_WIDGET( camera_window ), TRUE, TRUE );
// textures
GtkFrame* texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) );
gtk_paned_add2( GTK_PANED( vsplit2 ), GTK_WIDGET( texture_window ) );
gtk_paned_pack2( GTK_PANED( vsplit2 ), GTK_WIDGET( texture_window ), TRUE, TRUE );
}
}
}
gtk_paned_set_position( GTK_PANED( m_vSplit ), g_layout_globals.nXYHeight );
if ( CurrentStyle() == eRegular ) {
gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nXYWidth );
}
else
{
gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nCamWidth );
}
gtk_paned_set_position( GTK_PANED( m_vSplit2 ), g_layout_globals.nCamHeight );
}
else if ( CurrentStyle() == eFloating ) {
{
@ -3089,6 +3069,25 @@ void MainFrame::Create(){
EverySecondTimer_enable();
if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ) {
gtk_window_maximize( window );
}
if ( g_layout_globals.nState & GDK_WINDOW_STATE_FULLSCREEN ) {
gtk_window_fullscreen( window );
}
if ( !FloatingGroupDialog() ) {
gtk_paned_set_position( GTK_PANED( m_vSplit ), g_layout_globals.nXYHeight );
if ( CurrentStyle() == eRegular ) {
gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nXYWidth );
}
else
{
gtk_paned_set_position( GTK_PANED( m_hSplit ), g_layout_globals.nCamWidth );
}
gtk_paned_set_position( GTK_PANED( m_vSplit2 ), g_layout_globals.nCamHeight );
}
//GlobalShortcuts_reportUnregistered();
}
@ -3107,7 +3106,9 @@ void MainFrame::SaveWindowInfo(){
g_layout_globals.nCamHeight = gtk_paned_get_position( GTK_PANED( m_vSplit2 ) );
}
g_layout_globals.m_position = m_position_tracker.getPosition();
if( gdk_window_get_state( GTK_WIDGET( m_window )->window ) == 0 ){
g_layout_globals.m_position = m_position_tracker.getPosition();
}
g_layout_globals.nState = gdk_window_get_state( GTK_WIDGET( m_window )->window );
}
@ -3272,6 +3273,26 @@ void Layout_registerPreferencesPage(){
PreferencesDialog_addInterfacePage( FreeCaller1<PreferenceGroup&, Layout_constructPage>() );
}
void MainFrame_toggleFullscreen(){
GtkWindow* wnd = MainFrame_getWindow();
if( gdk_window_get_state( GTK_WIDGET( wnd )->window ) & GDK_WINDOW_STATE_FULLSCREEN ){
//some portion of buttsex, because gtk_window_unfullscreen doesn't work correctly after calling some modal window
bool maximize = ( gdk_window_get_state( GTK_WIDGET( wnd )->window ) & GDK_WINDOW_STATE_MAXIMIZED );
gtk_window_unfullscreen( wnd );
if( maximize ){
gtk_window_unmaximize( wnd );
gtk_window_maximize( wnd );
}
else{
gtk_window_move( wnd, g_layout_globals.m_position.x, g_layout_globals.m_position.y );
gtk_window_resize( wnd, g_layout_globals.m_position.w, g_layout_globals.m_position.h );
}
}
else{
gtk_window_fullscreen( wnd );
}
}
#include "preferencesystem.h"
#include "stringio.h"
@ -3334,6 +3355,7 @@ void MainFrame_Construct(){
GlobalCommands_insert( "ArbitraryScale", FreeCaller<DoScaleDlg>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalCommands_insert( "BuildMenuCustomize", FreeCaller<DoBuildMenu>() );
GlobalCommands_insert( "Build_runRecentExecutedBuild", FreeCaller<Build_runRecentExecutedBuild>(), Accelerator( GDK_F5 ) );
GlobalCommands_insert( "FindBrush", FreeCaller<DoFind>() );
@ -3369,6 +3391,8 @@ void MainFrame_Construct(){
GlobalCommands_insert( "ChooseClipperColor", makeCallback( g_ColoursMenu.m_clipper ) );
GlobalCommands_insert( "ChooseOrthoViewNameColor", makeCallback( g_ColoursMenu.m_viewname ) );
GlobalCommands_insert( "Fullscreen", FreeCaller<MainFrame_toggleFullscreen>(), Accelerator( GDK_F11 ) );
GlobalCommands_insert( "CSGSubtract", FreeCaller<CSG_Subtract>(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalCommands_insert( "CSGMerge", FreeCaller<CSG_Merge>(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) );

View File

@ -1842,9 +1842,7 @@ void SaveMap(){
}
else if ( Map_Modified( g_map ) ) {
Map_Save();
#ifdef WIN32
MRU_AddFile( g_map.m_name.c_str() ); //add on saving, but not opening via cmd line: spoils the list
#endif
}
}

View File

@ -144,6 +144,10 @@ FunctionPointer findSymbol( const char* symbol ){
#include <dlfcn.h>
#ifndef RTLD_DEEPBIND
#define RTLD_DEEPBIND 0
#endif
class DynamicLibrary
{
void* m_library;
@ -151,7 +155,7 @@ public:
typedef int ( *FunctionPointer )();
DynamicLibrary( const char* filename ){
m_library = dlopen( filename, RTLD_NOW );
m_library = dlopen( filename, RTLD_NOW | (RTLD_DEEPBIND + 0) );
}
~DynamicLibrary(){
if ( !failed() ) {

View File

@ -95,10 +95,11 @@ brush_t *AllocBrush( int numSides ){
/* allocate and clear */
if ( numSides <= 0 ) {
/*if ( numSides <= 0 ) {
Error( "AllocBrush called with numsides = %d", numSides );
}
c = (size_t)&( ( (brush_t*) 0 )->sides[ numSides ] );
c = (size_t)&( ( (brush_t*) 0 )->sides[ numSides ] );*/
c = sizeof(*bb) + (numSides > 6 ? sizeof(side_t)*(numSides - 6) : 0);
bb = safe_malloc( c );
memset( bb, 0, c );
if ( numthreads == 1 ) {

View File

@ -630,10 +630,9 @@ void InjectCommandLine( char **argv, int beginArgs, int endArgs ){
char *sentinel = newCommandLine + sizeof( newCommandLine ) - 1;
int i;
if (nocmdline)
{
return;
}
if ( nocmdline ){
return;
}
previousCommandLine = ValueForKey( &entities[0], "_q3map2_cmdline" );
if ( previousCommandLine && *previousCommandLine ) {
inpos = previousCommandLine;

View File

@ -2383,8 +2383,14 @@ skipEXfile:
Sys_Printf( "++%s\n", temp );
continue;
}
Sys_Printf( " !FAIL! %s\n", pk3Shaders + i*65 );
if ( i != pk3ShadersN - 1 ) packFAIL = qtrue; //levelshot typically
if ( i == pk3ShadersN - 1 ){ //levelshot typically
Sys_Printf( " ~fail %s\n", pk3Shaders + i*65 );
}
else{
Sys_Printf( " !FAIL! %s\n", pk3Shaders + i*65 );
packFAIL = qtrue;
}
}
}
@ -2443,7 +2449,7 @@ skipEXfile:
Sys_Printf( "++%s\n", temp );
}
else{
Sys_Printf( " !FAIL! %s\n", temp );
Sys_Printf( " ~fail %s\n", temp );
}
sprintf( temp, "scripts/%s.arena", nameOFmap );
@ -2451,7 +2457,7 @@ skipEXfile:
Sys_Printf( "++%s\n", temp );
}
else{
Sys_Printf( " !FAIL! %s\n", temp );
Sys_Printf( " ~fail %s\n", temp );
}
sprintf( temp, "scripts/%s.defi", nameOFmap );
@ -2459,7 +2465,7 @@ skipEXfile:
Sys_Printf( "++%s\n", temp );
}
else{
Sys_Printf( " !FAIL! %s\n", temp );
Sys_Printf( " ~fail %s\n", temp );
}
if ( !packFAIL ){

View File

@ -2003,11 +2003,10 @@ Q_EXTERN qboolean warnImage Q_ASSIGN( qtrue );
/* ydnar: sinusoid samples */
Q_EXTERN float jitters[ MAX_JITTERS ];
/*can't code*/
/* can't code */
Q_EXTERN qboolean doingBSP Q_ASSIGN( qfalse );
/* commandline arguments */
Q_EXTERN qboolean nocmdline Q_ASSIGN( qfalse );
Q_EXTERN qboolean verbose;
Q_EXTERN qboolean verboseEntities Q_ASSIGN( qfalse );
Q_EXTERN qboolean force Q_ASSIGN( qfalse );
@ -2030,6 +2029,7 @@ Q_EXTERN qboolean skyFixHack Q_ASSIGN( qfalse ); /* ydnar */
Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */
Q_EXTERN qboolean deepBSP Q_ASSIGN( qfalse ); /* div0 */
Q_EXTERN qboolean maxAreaFaceSurface Q_ASSIGN( qfalse ); /* divVerent */
Q_EXTERN qboolean nocmdline Q_ASSIGN( qfalse );
Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */

View File

@ -1276,7 +1276,7 @@ static void ParseShaderFile( const char *filename ){
else if ( !Q_stricmp( token, "sun" ) /* sof2 */ || !Q_stricmp( token, "q3map_sun" ) || !Q_stricmp( token, "q3map_sunExt" ) ) {
float a, b;
sun_t *sun;
qboolean ext;
qboolean ext = qfalse;
/* ydnar: extended sun directive? */

View File

@ -1164,7 +1164,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh
/* spew forth errors */
if ( VectorLength( plane ) < 0.001f ) {
Sys_Printf( "BOGUS " );
Sys_Printf( "DrawSurfaceForMesh: bogus plane\n" );
}
/* test each vert */