Adjusting Project Settings dialog for games

This commit is contained in:
Pan7 2017-03-03 16:35:26 +01:00
parent d91edda475
commit 4f0c07282f
1 changed files with 270 additions and 603 deletions

View File

@ -332,138 +332,143 @@ static const char* sSOF2ModComboItem = "Custom Sof2 modification";
static const char* sSOF2SPCombo = "Single Player mapping mode"; static const char* sSOF2SPCombo = "Single Player mapping mode";
static const char* sSOF2MPCombo = "Multiplayer mapping mode"; static const char* sSOF2MPCombo = "Multiplayer mapping mode";
static GtkWidget* game_select; // GTK_COMBO struct gamemode_s {
static GtkEntry* fsgame_entry; const char *gameFile;
const char *name;
const char *mode;
qboolean base; //default mode
};
typedef struct gamemode_s gamemode_t;
gint OnSelchangeComboWhatgame( GtkWidget *widget, GdkEvent* event, gpointer data ){ gamemode_t gameModeList[] = {
const char *dir = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ) ); { "wolf.game", sWolfSPCombo, "sp", qtrue },
// HACK: Wolf { "wolf.game", sWolfMPCombo, "mp", qfalse },
if ( g_pGameDescription->mGameFile == "wolf.game" ) {
if ( !strcmp( dir,sWolfComboItem ) ) {
// disable the fs_game text entry
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
}
else
{
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true );
}
} { "jk2.game", sJK2SPCombo, "sp", qtrue },
// HACK: ET { "jk2.game", sJK2MPCombo, "mp", qfalse },
else if ( g_pGameDescription->mGameFile == "et.game" ) {
if ( !strcmp( dir,sETComboItem ) ) {
// disable the fs_game text entry
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
}
else
{
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true );
}
} { "ja.game", sJASPCombo, "sp", qtrue },
else if ( g_pGameDescription->mGameFile == "hl.game" ) { { "ja.game", sJAMPCombo, "mp", qfalse },
if ( !strcmp( dir,sHLComboItem ) ) {
// disable the fs_game text entry
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
}
else
{
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true );
}
} { "stvef.game", sSTVEFSPCombo, "sp", qtrue },
// RIANT { "stvef.game", sSTVEFMPCombo, "mp", qfalse },
// HACK: JK2
else if ( g_pGameDescription->mGameFile == "jk2.game" ) { { "sof2.game", sSOF2SPCombo, "sp", qtrue },
if ( !strcmp( dir,sJK2ComboItem ) ) { { "sof2.game", sSOF2MPCombo, "mp", qfalse },
// disable the fs_game text entry
gtk_entry_set_text( fsgame_entry, "" ); };
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
} struct game_s {
else const char *gameFile;
const char *name;
const char *fs_game; //filesystem gamename
qboolean base; //default basegame, ie baseq3
qboolean custom; //ie Custom Quake III modification
};
typedef struct game_s game_t;
game_t gameList[] = {
{ "q3.game", sQ3ComboItem, "baseq3", qtrue, qfalse },
{ "q3.game", sTAComboItem, "missionpack", qfalse, qfalse },
{ "q3.game", "Defrag", "defrag", qfalse, qfalse },
{ "q3.game", sModComboItem, "", qfalse, qtrue },
{ "wolf.game", sWolfComboItem, "main", qtrue, qfalse },
{ "wolf.game", sWolfModComboItem, "", qfalse, qfalse },
{ "hl.game", sHLComboItem, "valve", qtrue, qfalse },
{ "hl.game", sHLModComboItem, "", qfalse, qtrue },
{ "et.game", sETComboItem, "etmain", qtrue, qfalse },
{ "et.game", sETModComboItem, "", qfalse, qtrue },
{ "jk2.game", sJK2ComboItem, "base", qtrue, qfalse },
{ "jk2.game", sJK2ModComboItem, "", qfalse, qtrue },
{ "ja.game", sJAComboItem, "base", qtrue, qfalse },
{ "ja.game", sJAModComboItem, "", qfalse, qtrue },
{ "stvef.game", sSTVEFComboItem, "baseEf", qtrue, qfalse },
{ "stvef.game", sSTVEFModComboItem, "", qfalse, qtrue },
{ "sof2.game", sSOF2ComboItem, "base", qtrue, qfalse },
{ "sof2.game", sSOF2ModComboItem, "", qfalse, qtrue },
};
GList *newMappingModesListForGameFile( Str & mGameFile ){
GList *mode_list;
size_t x;
mode_list = NULL;
for( x = 0; x < G_N_ELEMENTS( gameModeList ); x++ )
{ {
gtk_entry_set_text( fsgame_entry, "" ); if( strcmp( mGameFile.GetBuffer(), gameModeList[x].gameFile ) == 0 ) {
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true ); mode_list = g_list_append( mode_list, &gameModeList[x] );
} }
} }
// TTimo return mode_list;
// HACK: JA }
else if ( g_pGameDescription->mGameFile == "ja.game" ) {
if ( !strcmp( dir,sJAComboItem ) ) { GList *newModListForGameFile( Str & mGameFile ){
// disable the fs_game text entry GList *mod_list;
gtk_entry_set_text( fsgame_entry, "" ); size_t x;
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
} mod_list = NULL;
else for( x = 0; x < G_N_ELEMENTS( gameList ); x++ )
{ {
gtk_entry_set_text( fsgame_entry, "" ); if( strcmp( mGameFile.GetBuffer(), gameList[x].gameFile ) == 0 ) {
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true ); mod_list = g_list_append( mod_list, &gameList[x] );
} }
} }
// RIANT return mod_list;
// HACK: STVEF }
else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
if ( !strcmp( dir,sSTVEFComboItem ) ) { void OnSelchangeComboWhatgame( GtkWidget *widget, gpointer data ){
// disable the fs_game text entry GtkWidget *fs_game_entry;
gtk_entry_set_text( fsgame_entry, "" ); GtkWidget* game_select;
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false ); size_t x;
const gchar *name;
game_select = GTK_WIDGET( g_object_get_data( G_OBJECT( data ), "game_select" ) );
name = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ) );
if( !name ) {
return;
} }
else fs_game_entry = GTK_WIDGET( g_object_get_data( G_OBJECT( data ), "fs_game_entry" ) );
for( x = 0; x < G_N_ELEMENTS( gameList ); x++ )
{ {
gtk_entry_set_text( fsgame_entry, "" ); if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gameList[x].gameFile ) == 0
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true ); && strcmp( name, gameList[x].name ) == 0 ) {
if( gameList[x].custom ) {
gtk_entry_set_text( GTK_ENTRY( fs_game_entry ), gameList[x].fs_game );
gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), true );
gtk_widget_grab_focus( GTK_WIDGET( fs_game_entry ) );
} else {
gtk_entry_set_text( GTK_ENTRY( fs_game_entry ), gameList[x].fs_game );
gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), false );
} }
} break;
// RIANT
// HACK: SOF2
else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
if ( !strcmp( dir,sSOF2ComboItem ) ) {
// disable the fs_game text entry
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
}
else
{
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true );
}
}
// QUAKE 3
else
{
if ( !strcmp( dir,sQ3ComboItem ) ) {
// disable the fs_game text entry
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
}
else if ( !strcmp( dir,sTAComboItem ) ) {
gtk_entry_set_text( fsgame_entry, "missionpack" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), false );
}
else
{
gtk_entry_set_text( fsgame_entry, "" );
gtk_widget_set_sensitive( GTK_WIDGET( fsgame_entry ), true );
} }
} }
return TRUE;
} }
void DoProjectSettings(){ void DoProjectSettings(){
GtkWidget *project; GtkWidget *project;
GtkWidget *frame, *label, *vbox, *table1, *table2, *button; GtkWidget *frame, *label, *vbox, *table1, *table2, *button;
GtkWidget *brush; GtkWidget *brush;
GtkWidget *scr; GtkWidget *scr, *entry;
GtkWidget *base, *game; GtkWidget *base, *game_select;
GtkWidget *gamemode_combo; GtkWidget *gamemode_combo, *fs_game_entry;
GList *mod_list, *gamemode_list;
GList *lst;
GList *combo_list = (GList*)NULL; GList *combo_list = (GList*)NULL;
const char *fs_game;
qboolean isBasegame;
int loop = 1, ret = IDCANCEL; int loop = 1, ret = IDCANCEL;
@ -585,127 +590,96 @@ void DoProjectSettings(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
// HACK: hardcoded game stuff
if ( g_pGameDescription->mGameFile == "wolf.game" ||
g_pGameDescription->mGameFile == "et.game" ||
g_pGameDescription->mGameFile == "jk2.game" ||
g_pGameDescription->mGameFile == "stvef.game" ||
g_pGameDescription->mGameFile == "sof2.game" ||
g_pGameDescription->mGameFile == "ja.game" ) {
table2 = gtk_table_new( 9, 2, FALSE ); table2 = gtk_table_new( 9, 2, FALSE );
}
else
{
table2 = gtk_table_new( 8, 2, FALSE );
}
gtk_widget_show( table2 ); gtk_widget_show( table2 );
gtk_container_add( GTK_CONTAINER( frame ), table2 ); gtk_container_add( GTK_CONTAINER( frame ), table2 );
gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 );
/* mod_list = newModListForGameFile( g_pGameDescription->mGameFile );
fill in the game selection combo
HACK: hardcoded Q3/Wolf/HL switch
\todo that stuff would be faster to write with implementation of property bags and associated code to edit
*/
if ( g_pGameDescription->mGameFile == "wolf.game" ) {
combo_list = g_list_append( combo_list, (void *)sWolfComboItem );
combo_list = g_list_append( combo_list, (void *)sWolfModComboItem );
}
else if ( g_pGameDescription->mGameFile == "et.game" ) {
combo_list = g_list_append( combo_list, (void *)sETComboItem );
combo_list = g_list_append( combo_list, (void *)sETModComboItem );
}
else if ( g_pGameDescription->mGameFile == "hl.game" ) {
combo_list = g_list_append( combo_list, (void *)sHLComboItem );
combo_list = g_list_append( combo_list, (void *)sHLModComboItem );
}
// RIANT
// JK2 HACK
else if ( g_pGameDescription->mGameFile == "jk2.game" ) {
combo_list = g_list_append( combo_list, (void *)sJK2ComboItem );
combo_list = g_list_append( combo_list, (void *)sJK2ModComboItem );
}
// TTimo
// JA HACK
else if ( g_pGameDescription->mGameFile == "ja.game" ) {
combo_list = g_list_append( combo_list, (void *)sJAComboItem );
combo_list = g_list_append( combo_list, (void *)sJAModComboItem );
}
// RIANT
// STVEF HACK
else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
combo_list = g_list_append( combo_list, (void *)sSTVEFComboItem );
combo_list = g_list_append( combo_list, (void *)sSTVEFModComboItem );
}
// RIANT
// SOF2 HACK A LA JK2 A LA WOLF
else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
combo_list = g_list_append( combo_list, (void *)sSOF2ComboItem );
combo_list = g_list_append( combo_list, (void *)sSOF2ModComboItem );
}
else
{
// Q3 or default
combo_list = g_list_append( combo_list, (void *)sQ3ComboItem );
combo_list = g_list_append( combo_list, (void *)sTAComboItem );
combo_list = g_list_append( combo_list, (void *)sModComboItem );
}
game_select = gtk_combo_new(); game_select = gtk_combo_new();
for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 ) {
combo_list = g_list_append( combo_list, (void *)game_x->name );
}
}
gtk_combo_set_popdown_strings( GTK_COMBO( game_select ), combo_list ); gtk_combo_set_popdown_strings( GTK_COMBO( game_select ), combo_list );
g_list_free( combo_list );
gtk_widget_show( game_select ); gtk_widget_show( game_select );
gtk_table_attach( GTK_TABLE( table2 ), game_select, 1, 2, 6, 7, gtk_table_attach( GTK_TABLE( table2 ), game_select, 1, 2, 6, 7,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_signal_connect( GTK_OBJECT( GTK_COMBO( game_select )->entry ), "changed", gtk_signal_connect( GTK_OBJECT( GTK_COMBO( game_select )->entry ), "changed",
GTK_SIGNAL_FUNC( OnSelchangeComboWhatgame ), NULL ); GTK_SIGNAL_FUNC( OnSelchangeComboWhatgame ), project );
g_object_set_data( G_OBJECT( project ), "game_select", game_select );
g_list_free( combo_list );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( game_select )->entry ), FALSE ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( game_select )->entry ), FALSE );
game = gtk_entry_new(); fs_game_entry = entry = gtk_entry_new();
fsgame_entry = GTK_ENTRY( game ); gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), false );
gtk_widget_show( game ); gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table2 ), game, 1, 2, 7, 8, gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 7, 8,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_object_set_data( G_OBJECT( project ), "fs_game_entry", entry );
/* fs_game = ValueForKey( g_qeglobals.d_project_entity, "gamename" );
wolf specific: select MP or SP mode isBasegame = qtrue;
*/ if( fs_game && strlen( fs_game ) > 0 ) {
if ( g_pGameDescription->mGameFile == "wolf.game" ) { for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
combo_list = NULL; {
combo_list = g_list_append( combo_list, (void *)sWolfSPCombo ); const game_t *game_x = (const game_t *)lst->data;
combo_list = g_list_append( combo_list, (void *)sWolfMPCombo ); if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && strcmp( game_x->fs_game, fs_game ) == 0 ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), game_x->name );
isBasegame = qfalse;
break;
}
}
if( isBasegame ) {
for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && game_x->custom ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), game_x->name );
gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), true );
isBasegame = qfalse;
break;
}
}
}
}
if( isBasegame ) {
for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && game_x->base ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), game_x->name );
fs_game = game_x->fs_game;
break;
}
}
}
gtk_entry_set_text( GTK_ENTRY( fs_game_entry ), fs_game );
gamemode_combo = gtk_combo_new(); gamemode_list = newMappingModesListForGameFile( g_pGameDescription->mGameFile );
gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list ); if( gamemode_list ) {
gtk_widget_show( gamemode_combo ); const char *gamemode;
gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9, qboolean isBasemode;
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_list_free( combo_list );
combo_list = NULL; combo_list = NULL;
label = gtk_label_new( _( "Mapping mode" ) ); for( lst = gamemode_list; lst != NULL; lst = g_list_next( lst ) )
gtk_widget_show( label ); {
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9, const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
(GtkAttachOptions) ( GTK_FILL ), if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 ) {
(GtkAttachOptions) ( 0 ), 0, 0 ); combo_list = g_list_append( combo_list, (void *)gamemode_x->name );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); }
} }
// RIANT
// JK2 HACK
if ( g_pGameDescription->mGameFile == "jk2.game" ) {
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)sJK2SPCombo );
combo_list = g_list_append( combo_list, (void *)sJK2MPCombo );
gamemode_combo = gtk_combo_new(); gamemode_combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list ); gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
gtk_widget_show( gamemode_combo ); gtk_widget_show( gamemode_combo );
@ -722,78 +696,28 @@ void DoProjectSettings(){
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
isBasemode = qtrue;
for( lst = gamemode_list; lst != NULL; lst = g_list_next( lst ) )
{
const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 && strcmp( gamemode_x->mode, gamemode ) == 0 ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), gamemode_x->name );
isBasemode = qfalse;
break;
}
}
if( isBasemode ) {
for( lst = gamemode_list; lst != NULL; lst = g_list_next( lst ) )
{
const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 && gamemode_x->base ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), gamemode_x->name );
break;
} }
// TTimo
// JA HACK
if ( g_pGameDescription->mGameFile == "ja.game" ) {
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)sJASPCombo );
combo_list = g_list_append( combo_list, (void *)sJAMPCombo );
gamemode_combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
gtk_widget_show( gamemode_combo );
gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_list_free( combo_list );
combo_list = NULL;
label = gtk_label_new( _( "Mapping mode" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
} }
// RIANT
// STVEF HACK
if ( g_pGameDescription->mGameFile == "stvef.game" ) {
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)sSTVEFSPCombo );
combo_list = g_list_append( combo_list, (void *)sSTVEFMPCombo );
gamemode_combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
gtk_widget_show( gamemode_combo );
gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_list_free( combo_list );
combo_list = NULL;
label = gtk_label_new( _( "Mapping mode" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
} }
// RIANT
// SOF2 HACK
if ( g_pGameDescription->mGameFile == "sof2.game" ) {
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)sSOF2SPCombo );
combo_list = g_list_append( combo_list, (void *)sSOF2MPCombo );
gamemode_combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
gtk_widget_show( gamemode_combo );
gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_list_free( combo_list );
combo_list = NULL;
label = gtk_label_new( _( "Mapping mode" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
} }
/* /*
@ -835,207 +759,6 @@ void DoProjectSettings(){
UpdateBSPCommandList( project ); UpdateBSPCommandList( project );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( brush ), ( g_qeglobals.m_bBrushPrimitMode ) ? TRUE : FALSE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( brush ), ( g_qeglobals.m_bBrushPrimitMode ) ? TRUE : FALSE );
// initialise the fs_game selection from the project settings into the dialog
const char *dir = ValueForKey( g_qeglobals.d_project_entity, "gamename" );
// HACK: hardcoded wolf stuff
if ( g_pGameDescription->mGameFile == "wolf.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"main" ) ) {
// no fs_game set, we are running stock Quake III Arena editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sWolfComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sWolfModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// HACK: hardcoded et stuff
if ( g_pGameDescription->mGameFile == "et.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"etmain" ) ) {
// no fs_game set, we are running stock Quake III Arena editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sETComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sETModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// HACK: hardcoded half-life stuff
else if ( g_pGameDescription->mGameFile == "hl.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"valve" ) ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sHLComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sHLModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// RIANT
// JK2 HACK
else if ( g_pGameDescription->mGameFile == "jk2.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"base" ) ) {
// no fs_game set, we are running stock Quake III Arena editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJK2ComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJK2ModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// TTimo
// JA HACK
else if ( g_pGameDescription->mGameFile == "ja.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"base" ) ) {
// no fs_game set, we are running stock editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJAComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJAModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// RIANT
// STVEF2 HACK
else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"baseEf" ) ) {
// no fs_game set, we are running stock Quake III Arena editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSTVEFComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSTVEFModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// RIANT
// SOF2 HACK
else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"base" ) ) {
// no fs_game set, we are running stock Quake III Arena editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSOF2ComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSOF2ModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
else
{
if ( ( strlen( dir ) == 0 ) || !strcmp( dir,"baseq3" ) ) {
// no fs_game set, we are running stock Quake III Arena editing
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sQ3ComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "" );
gtk_widget_set_sensitive( game, false );
}
else if ( !strcmp( dir,"missionpack" ) ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sTAComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), "missionpack" );
gtk_widget_set_sensitive( game, false );
}
else
{
// this is a custom mod
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sModComboItem );
gtk_entry_set_text( GTK_ENTRY( game ), dir );
gtk_widget_set_sensitive( game, true );
}
}
// HACK: hardcoded wolf stuff
if ( g_pGameDescription->mGameFile == "wolf.game" ) {
const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
// nothing set yet, or single player
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sWolfSPCombo );
}
else
{
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sWolfMPCombo );
}
}
// JK2 HACK
else if ( g_pGameDescription->mGameFile == "jk2.game" ) {
const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
// nothing set yet, or single player
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJK2SPCombo );
}
else
{
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJK2MPCombo );
}
}
// JA HACK
else if ( g_pGameDescription->mGameFile == "ja.game" ) {
const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
// nothing set yet, or single player
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJASPCombo );
}
else
{
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJAMPCombo );
}
}
// STVEF HACK
else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
// nothing set yet, or single player
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSTVEFSPCombo );
}
else
{
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSTVEFMPCombo );
}
}
// SOF2 HACK
else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
// nothing set yet, or single player
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSOF2SPCombo );
}
else
{
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSOF2MPCombo );
}
}
gtk_grab_add( project ); gtk_grab_add( project );
gtk_widget_show( project ); gtk_widget_show( project );
@ -1048,6 +771,7 @@ void DoProjectSettings(){
char buf[1024]; char buf[1024];
const char *r; const char *r;
char *w; char *w;
const char *custom_fs_game, *selected_game, *new_fs_game;
// convert path to unix format // convert path to unix format
for ( r = gtk_entry_get_text( GTK_ENTRY( base ) ), w = buf; *r != '\0'; r++, w++ ) for ( r = gtk_entry_get_text( GTK_ENTRY( base ) ), w = buf; *r != '\0'; r++, w++ )
@ -1060,119 +784,73 @@ void DoProjectSettings(){
*w = '\0'; *w = '\0';
SetKeyValue( g_qeglobals.d_project_entity, "basepath", buf ); SetKeyValue( g_qeglobals.d_project_entity, "basepath", buf );
dir = gtk_entry_get_text( GTK_ENTRY( game ) ); selected_game = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ) );
// Hack: hard coded wolf stuff custom_fs_game = gtk_entry_get_text( GTK_ENTRY( fs_game_entry ) );
if ( g_pGameDescription->mGameFile == "wolf.game" ) {
if ( !strlen( dir ) || !stricmp( dir,"main" ) ) { isBasegame = qfalse;
new_fs_game = NULL;
if( !selected_game ) {
isBasegame = qtrue; //should never happen that none is selected
} else {
for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && strcmp( game_x->name, selected_game ) == 0 ) {
if( game_x->base ) {
isBasegame = qtrue;
} else if( game_x->custom ) {
if( !custom_fs_game || strlen( custom_fs_game ) == 0 ) {
isBasegame = qtrue;
} else {
new_fs_game = custom_fs_game;
}
} else {
new_fs_game = game_x->fs_game;
}
}
}
}
if( new_fs_game == NULL ) {
isBasegame = qtrue;
}
if( isBasegame ) {
DeleteKey( g_qeglobals.d_project_entity, "gamename" ); DeleteKey( g_qeglobals.d_project_entity, "gamename" );
} } else {
else SetKeyValue( g_qeglobals.d_project_entity, "gamename", new_fs_game );
{
SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
}
}
// Hack: hard coded ET stuff
else if ( g_pGameDescription->mGameFile == "et.game" ) {
if ( !strlen( dir ) || !stricmp( dir,"etmain" ) ) {
DeleteKey( g_qeglobals.d_project_entity, "gamename" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
}
}
// Hack: hard coded Half-life stuff
else if ( g_pGameDescription->mGameFile == "hl.game" ) {
if ( !strlen( dir ) || !stricmp( dir,"valve" ) ) {
DeleteKey( g_qeglobals.d_project_entity, "gamename" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
}
}
else if ( g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game" ) {
if ( !strlen( dir ) || !stricmp( dir,"base" ) ) {
DeleteKey( g_qeglobals.d_project_entity, "gamename" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
}
}
// RIANT
// STVEF HACK
else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
if ( !strlen( dir ) || !stricmp( dir,"baseEf" ) ) {
DeleteKey( g_qeglobals.d_project_entity, "gamename" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
}
}
else
{
if ( !strlen( dir ) || !strcmp( dir,"baseq3" ) ) {
DeleteKey( g_qeglobals.d_project_entity, "gamename" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
}
} }
// HACK: hardcoded wolf stuff if( gamemode_list ) {
if ( g_pGameDescription->mGameFile == "wolf.game" ) { const char *selected_mode;
// read from gamemode_combo const char *new_mode;
const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
if ( !strlen( gamemode ) || !strcmp( gamemode, sWolfSPCombo ) ) {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
}
}
// RIANT selected_mode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
// JK2 HACK new_mode = NULL;
if ( g_pGameDescription->mGameFile == "jk2.game" ) {
// read from gamemode_combo
const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
if ( !strlen( gamemode ) || !strcmp( gamemode, sJK2SPCombo ) ) {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
}
}
// TTimo
// JA HACK
if ( g_pGameDescription->mGameFile == "ja.game" ) {
// read from gamemode_combo
const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
if ( !strlen( gamemode ) || !strcmp( gamemode, sJASPCombo ) ) {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
}
}
// RIANT if( !selected_mode ) {
// STVEF HACK new_mode = NULL;
if ( g_pGameDescription->mGameFile == "stvef.game" ) { } else {
// read from gamemode_combo for( lst = gamemode_list; lst != NULL; lst = g_list_next( lst ) )
const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
if ( !strlen( gamemode ) || !strcmp( gamemode, sSTVEFSPCombo ) ) {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
}
else
{ {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" ); const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 && strcmp( gamemode_x->mode, selected_mode ) == 0 ) {
new_mode = selected_mode;
break;
}
}
}
if( !new_mode ) {
for( lst = gamemode_list; lst != NULL; lst = g_list_next( lst ) )
{
const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 ) {
new_mode = gamemode_x->mode;
break;
}
}
}
if( new_mode ) {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", new_mode );
} }
} }
@ -1184,20 +862,6 @@ void DoProjectSettings(){
g_qeglobals.m_strHomeMaps += str; g_qeglobals.m_strHomeMaps += str;
g_qeglobals.m_strHomeMaps += G_DIR_SEPARATOR; g_qeglobals.m_strHomeMaps += G_DIR_SEPARATOR;
// RIANT
// SOF2 HACK
if ( g_pGameDescription->mGameFile == "sof2.game" ) {
// read from gamemode_combo
const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
if ( !strlen( gamemode ) || !strcmp( gamemode, sSOF2SPCombo ) ) {
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
}
else
{
SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
}
}
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( brush ) ) ) { if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( brush ) ) ) {
g_qeglobals.m_bBrushPrimitMode = TRUE; g_qeglobals.m_bBrushPrimitMode = TRUE;
} }
@ -1210,6 +874,9 @@ void DoProjectSettings(){
QE_SaveProject( g_PrefsDlg.m_strLastProject.GetBuffer() ); QE_SaveProject( g_PrefsDlg.m_strLastProject.GetBuffer() );
} }
g_list_free( mod_list );
g_list_free( gamemode_list );
gtk_grab_remove( project ); gtk_grab_remove( project );
gtk_widget_destroy( project ); gtk_widget_destroy( project );
} }