diff options
author | Tim Angus <tim@ngus.net> | 2002-10-11 16:14:41 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-10-11 16:14:41 +0000 |
commit | 50b26bd0b69fbdd659c960e9b6227a60d31fb3ca (patch) | |
tree | ddd64ab60595e1a12c7abffdbec10fecbbbb12c8 /src/game | |
parent | 87ec2cf6d4fae86b41330fd835ade3945c313abd (diff) |
* Alien staging health modification
* Fixed a bunch of SIG_SEGV bugs
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_lib.c | 6 | ||||
-rw-r--r-- | src/game/g_client.c | 19 | ||||
-rw-r--r-- | src/game/g_spawn.c | 19 | ||||
-rw-r--r-- | src/game/tremulous.h | 2 |
4 files changed, 38 insertions, 8 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index f5aea779..a1492135 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -1894,9 +1894,15 @@ int sscanf( const char *buffer, const char *fmt, ... ) case 'd': case 'u': **arg = _atoi( &buffer ); + + if( **arg != 0 ) + count++; break; case 'f': *(float *)*arg = _atof( &buffer ); + + if( **arg != 0 ) + count++; break; } diff --git a/src/game/g_client.c b/src/game/g_client.c index 1b5ea37d..7bb6dd73 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1231,6 +1231,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) vec3_t bodyMaxs, classMins, up = { 0, 0, 1 }; int ammo, clips, maxClips; weapon_t weapon; + float hModifier; index = ent - g_entities; @@ -1253,7 +1254,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) // find a spawn point // do it before setting health back up, so farthest // ranging doesn't count this client - if ( client->sess.sessionTeam == TEAM_SPECTATOR ) + if( client->sess.sessionTeam == TEAM_SPECTATOR ) { if( teamLocal == PTE_NONE ) spawnPoint = SelectSpectatorSpawnPoint ( spawn_origin, spawn_angles ); @@ -1368,7 +1369,18 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) BG_FindBBoxForClass( ent->client->pers.pclass, ent->r.mins, ent->r.maxs, NULL, NULL, NULL ); - client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] = BG_FindHealthForClass( ent->client->pers.pclass ); + hModifier = 1.0f; + + if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + if( g_humanStage.integer == S2 ) + hModifier = ALIENSTAGE2_HLTH_MODIFIER; + else if( g_humanStage.integer == S2 ) + hModifier = ALIENSTAGE3_HLTH_MODIFIER; + } + + client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] = + (int)( (float)BG_FindHealthForClass( ent->client->pers.pclass ) * hModifier ); // clear entity values if( ent->client->pers.pclass == PCL_H_BASE ) @@ -1397,7 +1409,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) #define F_VEL 50.0f //give aliens some spawn velocity - if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + if( client->sess.sessionTeam != TEAM_SPECTATOR && + client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) { if( spawnPoint->s.origin2[ 2 ] > 0.0f ) { diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index b66675c0..b8646ddf 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -377,10 +377,11 @@ in a gentity void G_ParseField( const char *key, const char *value, gentity_t *ent ) { field_t *f; - byte *b; - float v; + byte *b; + float v; vec3_t vec; vec4_t vec4; + int i, count; for( f = fields; f->name; f++ ) { @@ -396,14 +397,22 @@ void G_ParseField( const char *key, const char *value, gentity_t *ent ) break; case F_VECTOR: - sscanf( value, "%f %f %f", &vec[ 0 ], &vec[ 1 ], &vec[ 2 ] ); + count = sscanf( value, "%f %f %f", &vec[ 0 ], &vec[ 1 ], &vec[ 2 ] ); + + for( i = 2; i >= count; i-- ) + vec[ i ] = 0.0f; + ( (float *)( b + f->ofs ) )[ 0 ] = vec[ 0 ]; ( (float *)( b + f->ofs ) )[ 1 ] = vec[ 1 ]; ( (float *)( b + f->ofs ) )[ 2 ] = vec[ 2 ]; break; case F_VECTOR4: - sscanf( value, "%f %f %f %f", &vec4[ 0 ], &vec4[ 1 ], &vec4[ 2 ], &vec4[ 3 ] ); + count = sscanf( value, "%f %f %f %f", &vec4[ 0 ], &vec4[ 1 ], &vec4[ 2 ], &vec4[ 3 ] ); + + for( i = 3; i >= count; i-- ) + vec[ i ] = 0.0f; + ( (float *)( b + f->ofs ) )[ 0 ] = vec4[ 0 ]; ( (float *)( b + f->ofs ) )[ 1 ] = vec4[ 1 ]; ( (float *)( b + f->ofs ) )[ 2 ] = vec4[ 2 ]; @@ -474,7 +483,7 @@ void G_SpawnGEntityFromSpawnVars( void ) VectorCopy( ent->s.origin, ent->r.currentOrigin ); // if we didn't get a classname, don't bother spawning anything - if ( !G_CallSpawn( ent ) ) + if( !G_CallSpawn( ent ) ) G_FreeEntity( ent ); } diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 3af26fb5..de1ee3d4 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -252,6 +252,8 @@ */ #define ALIENSENSE_RANGE 1000.0f +#define ALIENSTAGE2_HLTH_MODIFIER 1.2f +#define ALIENSTAGE3_HLTH_MODIFIER 1.5f |