summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-03-09 08:51:38 +0100
committer/dev/humancontroller <devhc@example.com>2017-03-09 13:51:15 +0100
commit639639c22d45eda949809446e4c29e0ed4c7d290 (patch)
tree3a79a65c71b3c168632af132b7f9d38da0b21368
parent7b0078d927d4685d41fdff91a54c91dafad38644 (diff)
rename g_layouts to g_nextLayout; add a different set of cvars: g_layouts, g_layouts2, ..., g_layouts9
also remove the latching property
-rw-r--r--src/game/g_admin.c4
-rw-r--r--src/game/g_buildable.c15
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_main.c14
-rw-r--r--src/game/g_maprotation.c6
-rw-r--r--src/game/g_svcmds.c4
6 files changed, 31 insertions, 15 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 25e63f46..2d6aeaba 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -2057,7 +2057,7 @@ qboolean G_admin_changemap( gentity_t *ent )
trap_FS_FOpenFile( va( "layouts/%s/%s.dat", map, layout ),
NULL, FS_READ ) > 0 )
{
- trap_Cvar_Set( "g_layouts", layout );
+ trap_Cvar_Set( "g_nextLayout", layout );
}
else
{
@@ -2717,7 +2717,7 @@ qboolean G_admin_restart( gentity_t *ent )
trap_FS_FOpenFile( va( "layouts/%s/%s.dat", map, layout ),
NULL, FS_READ ) > 0 )
{
- trap_Cvar_Set( "g_layouts", layout );
+ trap_Cvar_Set( "g_nextLayout", layout );
}
else
{
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 1425e539..a57a5adc 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -4051,25 +4051,30 @@ int G_LayoutList( const char *map, char *list, int len )
============
G_LayoutSelect
-set level.layout based on g_layouts or g_layoutAuto
+set level.layout based on g_nextLayout, g_layouts or g_layoutAuto
============
*/
void G_LayoutSelect( void )
{
char fileName[ MAX_OSPATH ];
- char layouts[ MAX_CVAR_VALUE_STRING ];
- char layouts2[ MAX_CVAR_VALUE_STRING ];
+ char layouts[ ( MAX_CVAR_VALUE_STRING - 1 ) * 9 + 1 ];
+ char layouts2[ ( MAX_CVAR_VALUE_STRING - 1 ) * 9 + 1 ];
char *l;
char map[ MAX_QPATH ];
char *s;
int cnt = 0;
int layoutNum;
- Q_strncpyz( layouts, g_layouts.string, sizeof( layouts ) );
+ Q_strncpyz( layouts, g_nextLayout.string, sizeof( layouts ) );
+ if( !layouts[ 0 ] )
+ {
+ for( layoutNum = 0; layoutNum < 9; ++layoutNum )
+ Q_strcat( layouts, sizeof( layouts ), g_layouts[ layoutNum ].string );
+ }
trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) );
// one time use cvar
- trap_Cvar_Set( "g_layouts", "" );
+ trap_Cvar_Set( "g_nextLayout", "" );
// pick an included layout at random if no list has been provided
if( !layouts[ 0 ] && g_layoutAuto.integer )
diff --git a/src/game/g_local.h b/src/game/g_local.h
index ea12e342..693b5bb1 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1176,7 +1176,8 @@ extern vmCvar_t g_shove;
extern vmCvar_t g_mapConfigs;
-extern vmCvar_t g_layouts;
+extern vmCvar_t g_nextLayout;
+extern vmCvar_t g_layouts[ 9 ];
extern vmCvar_t g_layoutAuto;
extern vmCvar_t g_emoticonsAllowedInNames;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 4858c75c..4fd2a04e 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -125,7 +125,8 @@ vmCvar_t g_sayAreaRange;
vmCvar_t g_floodMaxDemerits;
vmCvar_t g_floodMinTime;
-vmCvar_t g_layouts;
+vmCvar_t g_nextLayout;
+vmCvar_t g_layouts[ 9 ];
vmCvar_t g_layoutAuto;
vmCvar_t g_emoticonsAllowedInNames;
@@ -257,7 +258,16 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_mapConfigs, "g_mapConfigs", "", CVAR_ARCHIVE, 0, qfalse },
{ NULL, "g_mapConfigsLoaded", "0", CVAR_ROM, 0, qfalse },
- { &g_layouts, "g_layouts", "", CVAR_LATCH, 0, qfalse },
+ { &g_nextLayout, "g_nextLayout", "", 0, 0, qfalse },
+ { &g_layouts[ 0 ], "g_layouts", "", 0, 0, qfalse },
+ { &g_layouts[ 1 ], "g_layouts2", "", 0, 0, qfalse },
+ { &g_layouts[ 2 ], "g_layouts3", "", 0, 0, qfalse },
+ { &g_layouts[ 3 ], "g_layouts4", "", 0, 0, qfalse },
+ { &g_layouts[ 4 ], "g_layouts5", "", 0, 0, qfalse },
+ { &g_layouts[ 5 ], "g_layouts6", "", 0, 0, qfalse },
+ { &g_layouts[ 6 ], "g_layouts7", "", 0, 0, qfalse },
+ { &g_layouts[ 7 ], "g_layouts8", "", 0, 0, qfalse },
+ { &g_layouts[ 8 ], "g_layouts9", "", 0, 0, qfalse },
{ &g_layoutAuto, "g_layoutAuto", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_emoticonsAllowedInNames, "g_emoticonsAllowedInNames", "1", CVAR_LATCH|CVAR_ARCHIVE, 0, qfalse },
diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c
index 0487079c..e6d773e8 100644
--- a/src/game/g_maprotation.c
+++ b/src/game/g_maprotation.c
@@ -891,10 +891,10 @@ static void G_IssueMapChange( int index, int rotation )
node_t *node = mapRotations.rotations[ rotation ].nodes[ index ];
map_t *map = &node->u.map;
- // allow a manually defined g_layouts setting to override the maprotation
- if( !g_layouts.string[ 0 ] && map->layouts[ 0 ] )
+ // allow a manually defined g_nextLayout setting to override the maprotation
+ if( !g_nextLayout.string[ 0 ] && map->layouts[ 0 ] )
{
- trap_Cvar_Set( "g_layouts", map->layouts );
+ trap_Cvar_Set( "g_nextLayout", map->layouts );
}
G_PerformMapChange( map->name );
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index 952c6801..c2d61ec3 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -249,7 +249,7 @@ Svcmd_LayoutLoad_f
layoutload [<name> [<name2> [<name3 [...]]]]
This is just a silly alias for doing:
- set g_layouts "name name2 name3"
+ set g_nextLayout "name name2 name3"
map_restart
===================
*/
@@ -266,7 +266,7 @@ static void Svcmd_LayoutLoad_f( void )
s = ConcatArgs( 1 );
Q_strncpyz( layouts, s, sizeof( layouts ) );
- trap_Cvar_Set( "g_layouts", layouts );
+ trap_Cvar_Set( "g_nextLayout", layouts );
G_PerformMapRestart();
}