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 | |
parent | 87ec2cf6d4fae86b41330fd835ade3945c313abd (diff) |
* Alien staging health modification
* Fixed a bunch of SIG_SEGV bugs
-rw-r--r-- | src/cgame/cg_ents.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_public.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.c | 5 | ||||
-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 | ||||
-rw-r--r-- | src/ui/ui_main.c | 3 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 2 |
9 files changed, 50 insertions, 11 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 55940b34..38e4c798 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -475,10 +475,10 @@ static void CG_LightFlare( centity_t *cent ) //can only see the flare when in front of it flare.radius = len / es->origin2[ 0 ]; - if( es->origin2[ 1 ] == 0 ) + if( es->origin2[ 2 ] == 0 ) srcRadius = srLocal = flare.radius / 2.0f; else - srcRadius = srLocal = len / es->origin2[ 1 ]; + srcRadius = srLocal = len / es->origin2[ 2 ]; maxAngle = es->origin2[ 1 ]; diff --git a/src/cgame/cg_public.h b/src/cgame/cg_public.h index c97b68b9..ecc948c1 100644 --- a/src/cgame/cg_public.h +++ b/src/cgame/cg_public.h @@ -156,6 +156,7 @@ typedef enum CG_GET_ENTITY_TOKEN, CG_R_ADDPOLYSTOSCENE, CG_R_INPVS, + CG_FS_SEEK, CG_MEMSET = 100, CG_MEMCPY, diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index f5383a9d..835ea14d 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -104,6 +104,11 @@ void trap_FS_FCloseFile( fileHandle_t f ) syscall( CG_FS_FCLOSEFILE, f ); } +void trap_FS_Seek( fileHandle_t f, int offset, fsOrigin_t origin ) +{ + syscall( CG_FS_SEEK, f, offset, origin ); +} + void trap_SendConsoleCommand( const char *text ) { syscall( CG_SENDCONSOLECOMMAND, text ); 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 diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 1c223033..a96d9a71 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1575,6 +1575,9 @@ static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x textItem.textscale = scale; textItem.textStyle = textStyle; + textItem.enableCvar = NULL; + textItem.cvarTest = NULL; + //hack to utilise existing autowrap code Item_Text_AutoWrapped_Paint( &textItem ); } diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index f03fb82e..e17416bb 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -2813,7 +2813,7 @@ void Item_TextColor(itemDef_t *item, vec4_t *newColor) { // items can be enabled and disabled based on cvars } - if (item->enableCvar && *item->enableCvar && item->cvarTest && *item->cvarTest) { + if (item->enableCvar != NULL && *item->enableCvar && item->cvarTest != NULL && *item->cvarTest) { if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) { memcpy(newColor, &parent->disableColor, sizeof(vec4_t)); } |