Updated !nobuild to newer version.

Changed the way qvm_verion was generated yet again, this time it uses q3_shared.h, and should be svn'd automatically.
This commit is contained in:
Paradox460 committed 2008-06-27 22:23:01 +00:00
1 parent b3aa2689e2
commit bedc545f42
5 files changed
+109 -50

No files matched your search

+29 -26
View File
@@ -197,8 +197,8 @@ g_admin_cmd_t g_admin_cmds[ ] =
},
{"nobuild", G_admin_nobuild, "L",
"make an area nobuild",
"[^3game units^7]"
"make an area unbuildable",
"[^3game units area^7] [ ^3game units height^7]"
},
{"nobuildsave", G_admin_nobuildsave, "L",
@@ -7725,16 +7725,11 @@ qboolean G_admin_nobuild( gentity_t *ent, int skiparg )
{
int minargc;
char units[ MAX_STRING_CHARS ];
char units2[ MAX_STRING_CHARS ];
gentity_t *nb;
vec3_t low;
int units2;
minargc = 2 + skiparg;
if( G_SayArgc() < minargc )
{
ADMP( "^3!nobuild: ^7usage: !nobuild [game units]\n" );
return qfalse;
}
int units3;
int units4;
minargc = 3 + skiparg;
if( !ent )
{
@@ -7743,22 +7738,29 @@ qboolean G_admin_nobuild( gentity_t *ent, int skiparg )
}
G_SayArgv( 1 + skiparg, units, sizeof( units ) );
G_SayArgv( 2 + skiparg, units2, sizeof( units2 ) );
units3 = atoi(units);
units4 = atoi(units2);
VectorAdd( ent->s.origin, ent->r.mins, low );
units2 = atoi(units);
low[0] = ent->s.origin[0];
low[1] = ent->s.origin[1];
nb = G_Spawn( );
nb->s.modelindex = 1337;
nb->think = NoThink;
nb->nextthink = level.time;
VectorCopy( low, nb->s.pos.trBase );
VectorCopy( low, nb->r.currentOrigin );
trap_LinkEntity( nb );
nb->nobuilder = qtrue;
nb->nobuildarea = units2;
if( level.nobuild == qfalse ){
if( G_SayArgc() < minargc )
{
ADMP( "^3!nobuild: ^7usage: !nobuild [game units area] [gane units height]\n" );
return qfalse;
}
level.nobuild = qtrue;
level.nobuildArea = units3;
level.nobuildHeight = units4;
AP( va( "print \"^3!nobuild: ^7nobuild mode has been enabled by %s^7\n\"", ( ent ) ? ent->client->pers.netname : "console" ) );
}
else{
level.nobuild = qfalse;
level.nobuildArea = 0.0f;
AP( va( "print \"^3!nobuild: ^7nobuild mode has been disabled by %s^7\n\"", ( ent ) ? ent->client->pers.netname : "console" ) );
}
return qtrue;
}
@@ -7771,3 +7773,4 @@ qboolean G_admin_nobuildsave( gentity_t *ent, int skiparg )
return qtrue;
}
+65 -12
View File
@@ -3067,11 +3067,11 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
invert = BG_FindInvertNormalForBuildable( buildable );
VectorCopy( entity_origin, tmp );
tmp[2] += mins[2];
nb = G_Spawn( );
nb->s.modelindex = 1337; //Coder humor is awesome isn't it?
nb->s.modelindex = 0;
nb->think = NoThink;
nb->nextthink = level.time;
VectorCopy( tmp, nb->s.pos.trBase );
@@ -3084,9 +3084,9 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
if( nbent->nobuilder == qtrue )
{
range[0] = nbent->nobuildarea;
range[1] = nbent->nobuildarea;
range[2] = 5;
range[0] = nbent->nobuildArea;
range[1] = nbent->nobuildArea;
range[2] = nbent->nobuildHeight;
VectorAdd( nbent->r.currentOrigin, range, maxs3 );
VectorSubtract( nbent->r.currentOrigin, range, mins3 );
@@ -3104,7 +3104,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
}
}
G_FreeEntity( nb );
G_FreeEntity( nb );
//can we build at this angle?
if( !( normal[ 2 ] >= minNormal || ( invert && normal[ 2 ] <= -minNormal ) ) )
@@ -3670,6 +3670,40 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
return built;
}
/*
================
G_SpawnMarker
Spawns a nobuild marker
================
*/
static void G_SpawnMarker( vec3_t origin, buildable_t buildable )
{
gentity_t *nb;
vec3_t mins, maxs, tmp;
BG_FindBBoxForBuildable( buildable, mins, maxs );
VectorCopy( origin, tmp );
tmp[2] += mins[2];
nb = G_Spawn( );
nb->s.modelindex = 1337; //Coder humor is win
nb->think = NoThink;
nb->nextthink = level.time;
VectorCopy( tmp, nb->s.pos.trBase );
VectorCopy( tmp, nb->r.currentOrigin );
nb->nobuilder = qtrue;
nb->nobuildArea = level.nobuildArea;
nb->nobuildHeight = level.nobuildHeight;
trap_LinkEntity( nb );
level.nobuild = qfalse;
level.nobuildArea = 0.0f;
level.nobuildHeight = 0.0f;
}
/*
=================
G_BuildIfValid
@@ -3685,6 +3719,10 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
switch( G_CanBuild( ent, buildable, dist, origin ) )
{
case IBE_NONE:
if ( level.nobuild ){
G_SpawnMarker( origin, buildable );
return qtrue;
}
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
@@ -3750,16 +3788,28 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
return qfalse;
case IBE_SPWNWARN:
if ( level.nobuild ){
G_SpawnMarker( origin, buildable );
return qtrue;
}
G_TriggerMenu( ent->client->ps.clientNum, MN_A_SPWNWARN );
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
case IBE_TNODEWARN:
if ( level.nobuild ){
G_SpawnMarker( origin, buildable );
return qtrue;
}
G_TriggerMenu( ent->client->ps.clientNum, MN_H_TNODEWARN );
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
case IBE_RPTWARN:
if ( level.nobuild ){
G_SpawnMarker( origin, buildable );
return qtrue;
}
G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTWARN );
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
@@ -4511,11 +4561,12 @@ void G_NobuildSave( void )
if( ent->nobuilder != qtrue )
continue;
s = va( "%f %f %f %f\n",
s = va( "%f %f %f %f %f\n",
ent->s.pos.trBase[ 0 ],
ent->s.pos.trBase[ 1 ],
ent->s.pos.trBase[ 2 ],
ent->nobuildarea );
ent->nobuildArea,
ent->nobuildHeight );
trap_FS_Write( s, strlen( s ), f );
}
trap_FS_FCloseFile( f );
@@ -4539,6 +4590,7 @@ void G_NobuildLoad( void )
int i = 0;
gentity_t *nb;
float units;
float units2;
trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) );
len = trap_FS_FOpenFile( va( "nobuild/%s.dat", map ),
@@ -4566,17 +4618,18 @@ void G_NobuildLoad( void )
if( *nobuild == '\n' )
{
i = 0;
sscanf( line, "%f %f %f %f\n",
&origin[ 0 ], &origin[ 1 ], &origin[ 2 ], &units );
sscanf( line, "%f %f %f %f %f\n",
&origin[ 0 ], &origin[ 1 ], &origin[ 2 ], &units, &units2 );
nb = G_Spawn( );
nb->s.modelindex = 1337; //Coder humor is awesome isn't it?
nb->s.modelindex = 0; //Coder humor is awesome isn't it?
nb->think = NoThink;
nb->nextthink = level.time;
VectorCopy( origin, nb->s.pos.trBase );
VectorCopy( origin, nb->r.currentOrigin );
nb->nobuilder = qtrue;
nb->nobuildarea = units;
nb->nobuildArea = units;
nb->nobuildHeight = units2;
trap_LinkEntity( nb );
}
+6 -1
View File
@@ -246,7 +246,8 @@ struct gentity_s
int livetime;
qboolean nobuilder;
float nobuildarea;
float nobuildArea;
float nobuildHeight;
};
typedef enum
@@ -769,6 +770,10 @@ typedef struct
int bleeders;
qboolean nobuild;
float nobuildArea;
float nobuildHeight;
statsCounters_t alienStatsCounters;
statsCounters_t humanStatsCounters;
} level_locals_t;
+2 -7
View File
@@ -23,10 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "g_local.h"
#define QVM_VARIANT "P-G-QVM"
//#define QVM_VERSION "SVN r73" //Use this if your releasing a version or dont have svn installed. If you dont have svn, please use a syntax similar to SVN r#
#define QVM_VERSION "SVN r" SVN_VERSION //Use this if you have SVN installed
level_locals_t level;
@@ -785,9 +781,8 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
level.snd_fry = G_SoundIndex( "sound/misc/fry.wav" ); // FIXME standing in lava / slime
trap_Cvar_Set( "qvm_version", va( "%s %s (%s %s)",
QVM_VARIANT,
QVM_VERSION,
trap_Cvar_Set( "qvm_version", va( "%s (%s %s)",
Q3_VERSION,
__DATE__,
__TIME__ ) );
+7 -4
View File
@@ -26,12 +26,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
#define PRODUCT_NAME "p-g-qvm"
#define PRODUCT_VERSION "1.6.1"
#define VERSION_NUMBER "1.1.0"
#define Q3_VERSION "tremulous " VERSION_NUMBER
#ifndef SVN_VERSION
#define SVN_VERSION Q3_VERSION
#ifdef SVN_VERSION
# define Q3_VERSION PRODUCT_NAME " v" PRODUCT_VERSION " SVN r" SVN_VERSION
#else
# define Q3_VERSION PRODUCT_NAME " v" PRODUCT_VERSION
#endif
#define CLIENT_WINDOW_TITLE "Tremulous " VERSION_NUMBER
#define CLIENT_WINDOW_ICON "Tremulous"
#define CONSOLE_WINDOW_TITLE "Tremulous " VERSION_NUMBER " console"