From f40ad7c74f940dd0274cd0a82248a5a4e8846eac Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Wed, 31 Aug 2005 03:15:00 +0000 Subject: * Reimplemented how buildables play damage sounds to not use the event system * Reworked the ammo/clips packing system to remove the confusion of concepts * Marauder lightning now requires aim, does damage over time and chains to other entities * Implemented the Medkit -- a means for a human to restore health and cure poison in the field * "Disable Build Warnings" replaced with "Disable Warning Dialogs" and improved * Disabled client side ET_MISSILE collision * Sped spectator move speed up * Implemented "step down" physics for all characters; no more jumping down stairs * Re-adjusted step time values * Increased frequency with which the Acid Tube deals damage * G_RadiusSelectiveDamage no longer applies locational damage * Moved some speed adjustment code into prediction; should prevent some prediction misses * Tyrant can no longer charge up forever and must pass a specific minimum charge level * Wrapped all calls to trap_SendServerCommand in order to circumvent the q3amsgboom.cfg exploit * Implemented command queueing for commands sent to clients in order to prevent overflows even sv_floodProtect is off, but not by dropping commands * Added LOS check to creep slowing * Overmind now only complains if there are 0 spawns * Spawns can no longer be built when there is no Overmind/Reactor * The spawn closest to the point of death is chosen preferably if available * Evolving no longer restores all health * "give weapons" and "give ammo" cheats removed * Fixed restoration of energy weapons bug * When selling the battery pack, max ammo is given * Fixed a bug where locational damage could sometimes scale damage to 0 * Added stage information to the end of game stats * Hacked around trap_LinkEntity to allow missiles to have a bounding box displayed * Added G_ClosestEnt * Reduced Dragoon spitball damage from 120 to 110 * Reduced Tyrant claw damage from 120 to 100 * Reduced Tyrant charge damage from 160 to 110 * Increased Barricade regeneration rate from 12 to 14 * Increased Overmind health from 500 to 750 * Decreased Overmind regeneration rate from 10 to 6 * Doubled Blaster speed from 700 to 1400 * Reduced Painsaw damage from 18 to 15 * Reduced Painsaw range from 48.0 to 40.0 * Reduced Grenade price from 300 to 200 * Reduced Shotgun repeat rate from 1200 to 1000 * Increased Shotgun damage from 6 to 7 * Increased Mass driver damage from 35 to 38 * Increased Chaingun damage from 5 to 6 * Reduced Flamer repeat rate from 300 to 200 * Extended Flamer range * Increased ammo on all human weapons * Reduced splashdamage on MG Turrets * Moved build directory from tremulous to tremulous-dev --- src/cgame/cg_buildable.c | 28 ++++- src/cgame/cg_draw.c | 16 +-- src/cgame/cg_ents.c | 64 +++++++++++- src/cgame/cg_event.c | 23 ++--- src/cgame/cg_local.h | 11 +- src/cgame/cg_main.c | 8 +- src/cgame/cg_predict.c | 2 +- src/cgame/cg_servercmds.c | 217 +++++++++++++++++++++++++++++---------- src/cgame/cg_weapons.c | 42 +------- src/game/bg_misc.c | 190 +++++++++++++++++----------------- src/game/bg_pmove.c | 110 +++++++++++++------- src/game/bg_public.h | 24 +++-- src/game/bg_slidemove.c | 25 ++--- src/game/g_active.c | 129 ++++++++++++++++------- src/game/g_buildable.c | 80 ++++++++------- src/game/g_client.c | 42 ++++---- src/game/g_cmds.c | 253 ++++++++++++++++++++++------------------------ src/game/g_combat.c | 41 ++++---- src/game/g_local.h | 68 ++++++++++++- src/game/g_main.c | 77 ++++++++++---- src/game/g_missile.c | 4 + src/game/g_svcmds.c | 4 +- src/game/g_target.c | 4 +- src/game/g_team.c | 4 +- src/game/g_trigger.c | 6 +- src/game/g_utils.c | 230 ++++++++++++++++++++++++++++++++++++++++- src/game/g_weapon.c | 248 +++++++++++++++++++++++++++++++++++++++------ src/game/tremulous.h | 70 ++++++------- src/ui/ui_main.c | 1 + src/ui/ui_shared.c | 1 + 30 files changed, 1384 insertions(+), 638 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 3b462dec..0c334e7b 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -925,6 +925,8 @@ static void CG_BuildableHealthBar( centity_t *cent ) } } +#define BUILDABLE_SOUND_PERIOD 500 + /* ================== CG_Buildable @@ -940,6 +942,8 @@ void CG_Buildable( centity_t *cent ) float rotAngle; buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex ); float scale; + int health; + float healthScale; //must be before EF_NODRAW check if( team == BIT_ALIENS ) @@ -1132,12 +1136,34 @@ void CG_Buildable( centity_t *cent ) if( weapon->wim[ WPM_PRIMARY ].firingSound ) { - trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, weapon->wim[ WPM_PRIMARY ].firingSound ); + trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, + weapon->wim[ WPM_PRIMARY ].firingSound ); } else if( weapon->readySound ) trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, weapon->readySound ); } + health = es->generic1 & ~( B_POWERED_TOGGLEBIT | B_DCCED_TOGGLEBIT | B_SPAWNED_TOGGLEBIT ); + healthScale = (float)health / B_HEALTH_SCALE; + + if( healthScale < cent->lastBuildableHealthScale && ( es->generic1 & B_SPAWNED_TOGGLEBIT ) ) + { + if( cent->lastBuildableDamageSoundTime + BUILDABLE_SOUND_PERIOD < cg.time ) + { + if( team == BIT_HUMANS ) + { + int i = rand( ) % 4; + trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.humanBuildableDamage[ i ] ); + } + else if( team == BIT_ALIENS ) + trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.alienBuildableDamage ); + + cent->lastBuildableDamageSoundTime = cg.time; + } + } + + cent->lastBuildableHealthScale = healthScale; + //smoke etc for damaged buildables CG_BuildableParticleEffects( cent ); } diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index f5fb5487..9cb1740c 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -896,7 +896,7 @@ static void CG_DrawPlayerPoisonBarbs( rectDef_t *rect, vec4_t color, qhandle_t s qboolean vertical; int iconsize, numBarbs, i; - BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &numBarbs, NULL, NULL ); + BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &numBarbs, NULL ); if( height > width ) { @@ -981,7 +981,7 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color ) break; default: - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL ); break; } @@ -1140,7 +1140,7 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color ) break; default: - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value ); if( value > -1 ) { @@ -1433,7 +1433,7 @@ float CG_GetValue( int ownerDraw ) int value; BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, - &value, NULL, NULL ); + &value, NULL ); return value; } @@ -1444,7 +1444,7 @@ float CG_GetValue( int ownerDraw ) int value; BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, - NULL, &value, NULL ); + NULL, &value ); return value; } @@ -2309,15 +2309,15 @@ CG_DrawWeaponIcon */ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color ) { - int ammo, clips, maxAmmo, maxClips; + int ammo, clips, maxAmmo; centity_t *cent; playerState_t *ps; cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL ); - BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, &maxClips, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips ); + BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, NULL ); // don't display if dead if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 1ed6cb2e..df269155 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -756,6 +756,64 @@ static void CG_LightFlare( centity_t *cent ) trap_R_AddRefEntityToScene( &flare ); } +/* +========================= +CG_Lev2ZapChain +========================= +*/ +static void CG_Lev2ZapChain( centity_t *cent ) +{ + int i = 0; + entityState_t *es; + vec3_t start, end; + centity_t *source, *target; + + es = ¢->currentState; + + if( es->time > 0 ) + { + source = &cg_entities[ es->powerups ]; + target = &cg_entities[ es->time ]; + + if( es->powerups == cg.predictedPlayerState.clientNum ) + VectorCopy( cg.predictedPlayerState.origin, start ); + else + VectorCopy( source->currentState.pos.trBase, start ); + + VectorCopy( target->currentState.pos.trBase, end ); + + CG_DynamicLightningBolt( cgs.media.lightningShader, start, end, + 1+((cg.time%((i+2)*(i+3)))+i)%2, 7 + (float)(i%3)*5 + 6.0*random(), + qtrue, 1.0, 0, i*i*3 ); + } + + if( es->time2 > 0 ) + { + source = &cg_entities[ es->time ]; + target = &cg_entities[ es->time2 ]; + + VectorCopy( source->currentState.pos.trBase, start ); + VectorCopy( target->currentState.pos.trBase, end ); + + CG_DynamicLightningBolt( cgs.media.lightningShader, start, end, + 1+((cg.time%((i+2)*(i+3)))+i)%2, 7 + (float)(i%3)*5 + 6.0*random(), + qtrue, 1.0, 0, i*i*3 ); + } + + if( es->constantLight > 0 ) + { + source = &cg_entities[ es->time2 ]; + target = &cg_entities[ es->constantLight ]; + + VectorCopy( source->currentState.pos.trBase, start ); + VectorCopy( target->currentState.pos.trBase, end ); + + CG_DynamicLightningBolt( cgs.media.lightningShader, start, end, + 1+((cg.time%((i+2)*(i+3)))+i)%2, 7 + (float)(i%3)*5 + 6.0*random(), + qtrue, 1.0, 0, i*i*3 ); + } +} + /* ========================= CG_AdjustPositionForMover @@ -1010,6 +1068,10 @@ static void CG_AddCEntity( centity_t *cent ) case ET_LIGHTFLARE: CG_LightFlare( cent ); break; + + case ET_LEV2_ZAP_CHAIN: + CG_Lev2ZapChain( cent ); + break; } } @@ -1122,7 +1184,7 @@ void CG_AddPacketEntities( void ) mins[ 2 ] = -zd; maxs[ 2 ] = zu; - CG_DrawBoundingBox( es->origin, mins, maxs ); + CG_DrawBoundingBox( cent->lerpOrigin, mins, maxs ); break; default: diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 049cea33..4ac8f984 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -376,7 +376,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) const char *s; int clientNum; clientInfo_t *ci; - int steptime, i; + int steptime; if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) steptime = 200; @@ -767,28 +767,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) CG_AlienBuildableExplosion( position, dir ); break; - case EV_HUMAN_BUILDABLE_DAMAGE: - DEBUGNAME( "EV_HUMAN_BUILDABLE_DAMAGE" ); - i = rand( ) % 4; - trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.humanBuildableDamage[ i ] ); - break; - - case EV_ALIEN_BUILDABLE_DAMAGE: - DEBUGNAME( "EV_ALIEN_BUILDABLE_DAMAGE" ); - trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.alienBuildableDamage ); - break; - case EV_TESLATRAIL: DEBUGNAME( "EV_TESLATRAIL" ); cent->currentState.weapon = WP_TESLAGEN; CG_TeslaTrail( es->origin2, es->pos.trBase, es->generic1, es->clientNum ); break; - case EV_ALIENZAP: - DEBUGNAME( "EV_ALIENZAP" ); - CG_AlienZap( es->origin2, es->pos.trBase, es->generic1, es->clientNum ); - break; - case EV_BULLET_HIT_WALL: DEBUGNAME( "EV_BULLET_HIT_WALL" ); ByteToDir( es->eventParm, dir ); @@ -955,6 +939,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) } break; + case EV_MEDKIT_USED: + DEBUGNAME( "EV_MEDKIT_USED" ); + trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.medkitUseSound ); + break; + case EV_PLAYER_RESPAWN: DEBUGNAME( "EV_PLAYER_RESPAWN" ); if( es->number == cg.clientNum ) diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 821972d9..d12e8001 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -479,6 +479,8 @@ typedef struct centity_s buildableAnimNumber_t buildableAnim; //persistant anim number buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set particleSystem_t *buildablePS; + float lastBuildableHealthScale; + int lastBuildableDamageSoundTime; lightFlareStatus_t lfs; @@ -1194,7 +1196,8 @@ typedef struct qhandle_t jetPackHoverPS; qhandle_t jetPackAscendPS; - //TA: + sfxHandle_t medkitUseSound; + sfxHandle_t alienStageTransition; sfxHandle_t humanStageTransition; @@ -1220,8 +1223,6 @@ typedef struct //TA: for wolf trail effects qhandle_t sparkFlareShader; - //TA: media used for armour switching stuff - //light armour qhandle_t larmourHeadSkin; qhandle_t larmourLegsSkin; @@ -1393,7 +1394,6 @@ extern vmCvar_t cg_debugAnim; extern vmCvar_t cg_debugPosition; extern vmCvar_t cg_debugEvents; extern vmCvar_t cg_teslaTrailTime; -extern vmCvar_t cg_alienZapTime; extern vmCvar_t cg_railTrailTime; extern vmCvar_t cg_errorDecay; extern vmCvar_t cg_nopredict; @@ -1467,7 +1467,7 @@ extern vmCvar_t cg_consoleLatency; extern vmCvar_t cg_lightFlare; extern vmCvar_t cg_debugParticles; extern vmCvar_t cg_debugPVS; -extern vmCvar_t cg_disableBuildWarnings; +extern vmCvar_t cg_disableWarningDialogs; extern vmCvar_t cg_disableScannerPlane; //TA: hack to get class an carriage through to UI module @@ -1663,7 +1663,6 @@ void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboole void CG_ShotgunFire( entityState_t *es ); void CG_TeslaTrail( vec3_t start, vec3_t end, int srcENum, int destENum ); -void CG_AlienZap( vec3_t start, vec3_t end, int srcENum, int destENum ); void CG_AddViewWeapon (playerState_t *ps); void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent ); void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 056fd76f..8a657ab7 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -96,7 +96,6 @@ upgradeInfo_t cg_upgrades[ 32 ]; buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ]; vmCvar_t cg_teslaTrailTime; -vmCvar_t cg_alienZapTime; vmCvar_t cg_railTrailTime; vmCvar_t cg_centertime; vmCvar_t cg_runpitch; @@ -200,7 +199,7 @@ vmCvar_t cg_consoleLatency; vmCvar_t cg_lightFlare; vmCvar_t cg_debugParticles; vmCvar_t cg_debugPVS; -vmCvar_t cg_disableBuildWarnings; +vmCvar_t cg_disableWarningDialogs; vmCvar_t cg_disableScannerPlane; //TA: hack to get class and carriage through to UI module @@ -254,7 +253,6 @@ static cvarTable_t cvarTable[ ] = { &cg_addMarks, "cg_marks", "1", CVAR_ARCHIVE }, { &cg_lagometer, "cg_lagometer", "0", CVAR_ARCHIVE }, { &cg_teslaTrailTime, "cg_teslaTrailTime", "600", CVAR_ARCHIVE }, - { &cg_alienZapTime, "cg_alienZapTime", "500", CVAR_ARCHIVE }, { &cg_railTrailTime, "cg_railTrailTime", "400", CVAR_ARCHIVE }, { &cg_gun_x, "cg_gunX", "0", CVAR_CHEAT }, { &cg_gun_y, "cg_gunY", "0", CVAR_CHEAT }, @@ -305,7 +303,7 @@ static cvarTable_t cvarTable[ ] = { &cg_lightFlare, "cg_lightFlare", "3", CVAR_ARCHIVE }, { &cg_debugParticles, "cg_debugParticles", "0", CVAR_CHEAT }, { &cg_debugPVS, "cg_debugPVS", "0", CVAR_CHEAT }, - { &cg_disableBuildWarnings, "cg_disableBuildWarnings", "0", CVAR_ARCHIVE }, + { &cg_disableWarningDialogs, "cg_disableWarningDialogs", "0", CVAR_ARCHIVE }, { &cg_disableScannerPlane, "cg_disableScannerPlane", "0", CVAR_ARCHIVE }, { &cg_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE}, @@ -680,6 +678,8 @@ static void CG_RegisterSounds( void ) cgs.media.jetpackDescendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/low.wav", qfalse ); cgs.media.jetpackIdleSound = trap_S_RegisterSound( "sound/upgrades/jetpack/idle.wav", qfalse ); cgs.media.jetpackAscendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/hi.wav", qfalse ); + + cgs.media.medkitUseSound = trap_S_RegisterSound( "sound/upgrades/medkit/medkit.wav", qfalse ); cgs.media.alienEvolveSound = trap_S_RegisterSound( "sound/player/alienevolve.wav", qfalse ); diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index 548efb86..d66fd653 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -63,7 +63,7 @@ void CG_BuildSolidList( void ) continue; } - if( cent->nextState.solid ) + if( cent->nextState.solid && ent->eType != ET_MISSILE ) { cg_solidEntities[ cg_numSolidEntities ] = cent; cg_numSolidEntities++; diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index e529d1ab..90b74f8c 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -556,7 +556,8 @@ static void CG_SetUIVars( void ) } for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) ) + if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) && + BG_FindPurchasableForUpgrade( i ) ) strcat( carriageCvar, va( "U%d ", i ) ); } strcat( carriageCvar, "$" ); @@ -598,107 +599,158 @@ void CG_Menu( int menu ) break; case MN_H_NOROOM: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no room to build here. Move until the buildable turns " "translucent green indicating a valid build location." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "There is no room to build here\n" ); + break; case MN_H_NOPOWER: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no power remaining. Free up power by destroying existing " "buildable objects." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "There is no power remaining\n" ); + break; case MN_H_NOTPOWERED: - trap_Cvar_Set( "ui_dialog", "This buildable is not powered. Build a reactor and/or repeater in " - "order to power it." ); - trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "This buildable is not powered. Build a Reactor and/or Repeater in " + "order to power it." ); + trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + } + else + CG_Printf( "This buildable is not powered\n" ); + break; case MN_H_NORMAL: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "Cannot build on this surface. The surface is too steep or unsuitable " "to build on. Please choose another site for this structure." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "Cannot build on this surface\n" ); + break; case MN_H_REACTOR: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { - trap_Cvar_Set( "ui_dialog", "There can only be one reactor. Destroy the existing one if you " + trap_Cvar_Set( "ui_dialog", "There can only be one Reactor. Destroy the existing one if you " "wish to move it." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "There can only be one Reactor\n" ); + break; case MN_H_REPEATER: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no power here. If available, a Repeater may be used to " "transmit power to this location." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "There is no power here\n" ); + break; case MN_H_NODCC: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no Defense Computer. A Defense Computer is needed to build " "this." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "There is no Defense Computer\n" ); + break; case MN_H_TNODEWARN: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { - trap_Cvar_Set( "ui_dialog", "WARNING: This telenode will not be powered. Build near a power " + trap_Cvar_Set( "ui_dialog", "WARNING: This Telenode will not be powered. Build near a power " "structure to prevent seeing this message again." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "This Telenode will not be powered\n" ); + break; case MN_H_RPTWARN: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { - trap_Cvar_Set( "ui_dialog", "WARNING: This repeater will not be powered as there is no parent " - "reactor providing power. Build a reactor." ); + trap_Cvar_Set( "ui_dialog", "WARNING: This Repeater will not be powered as there is no parent " + "Reactor providing power. Build a Reactor." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "This Repeater will not be powered\n" ); + break; case MN_H_RPTWARN2: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { - trap_Cvar_Set( "ui_dialog", "This area already has power. A repeater is not required here." ); + trap_Cvar_Set( "ui_dialog", "This area already has power. A Repeater is not required here." ); trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); } + else + CG_Printf( "This area already has power\n" ); + break; case MN_H_NOSLOTS: - trap_Cvar_Set( "ui_dialog", "You have no room to carry this. Please sell any conflicting " - "upgrades before purchasing this item." ); - trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "You have no room to carry this. Please sell any conflicting " + "upgrades before purchasing this item." ); + trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + } + else + CG_Printf( "You have no room to carry this\n" ); + break; case MN_H_NOFUNDS: - trap_Cvar_Set( "ui_dialog", "Insufficient funds. You do not have enough credits to perform this " - "action." ); - trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "Insufficient funds. You do not have enough credits to perform this " + "action." ); + trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + } + else + CG_Printf( "Insufficient funds\n" ); + break; case MN_H_ITEMHELD: - trap_Cvar_Set( "ui_dialog", "You already hold this item. It is not possible to carry multiple items " - "of the same type." ); - trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "You already hold this item. It is not possible to carry multiple items " + "of the same type." ); + trap_SendConsoleCommand( "menu tremulous_human_dialog\n" ); + } + else + CG_Printf( "You already hold this item\n" ); + break; @@ -706,103 +758,160 @@ void CG_Menu( int menu ) case MN_A_NOROOM: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no room to build here. Move until the structure turns " "translucent green indicating a valid build location." ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "There is no room to build here\n" ); + break; case MN_A_NOCREEP: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no creep here. You must build near existing Eggs or " "the Overmind. Alien structures will not support themselves." ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "There is no creep here\n" ); + break; case MN_A_NOOVMND: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There is no Overmind. An Overmind must be built to control " "the structure you tried to place" ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "There is no Overmind\n" ); + break; case MN_A_OVERMIND: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "There can only be one Overmind. Destroy the existing one if you " "wish to move it." ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "There can only be one Overmind\n" ); + break; case MN_A_NOASSERT: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { - trap_Cvar_Set( "ui_dialog", "The Overmind cannot control anymore structures. Destroy existing " + trap_Cvar_Set( "ui_dialog", "The Overmind cannot control any more structures. Destroy existing " "structures to build more." ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "The Overmind cannot control any more structures\n" ); + break; case MN_A_SPWNWARN: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "WARNING: This spawn will not be controlled by an Overmind. " "Build an Overmind to prevent seeing this message again." ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "This spawn will not be controlled by an Overmind\n" ); + break; case MN_A_NORMAL: - if( !cg_disableBuildWarnings.integer ) + if( !cg_disableWarningDialogs.integer ) { trap_Cvar_Set( "ui_dialog", "Cannot build on this surface. This surface is too steep or unsuitable " "to build on. Please choose another site for this structure." ); trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); } + else + CG_Printf( "Cannot build on this surface\n" ); + break; case MN_A_NOEROOM: - trap_Cvar_Set( "ui_dialog", "There is no room to evolve here. Move away from walls or other " - "nearby objects and try again." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "There is no room to evolve here. Move away from walls or other " + "nearby objects and try again." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + } + else + CG_Printf( "There is no room to evolve here\n" ); + break; case MN_A_TOOCLOSE: - trap_Cvar_Set( "ui_dialog", "This location is too close to the enemy to evolve. " - "Move away until you are no longer aware of the enemy's " - "presence and try again." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "This location is too close to the enemy to evolve. " + "Move away until you are no longer aware of the enemy's " + "presence and try again." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + } + else + CG_Printf( "This location is too close to the enemy to evolve\n" ); + break; case MN_A_NOOVMND_EVOLVE: - trap_Cvar_Set( "ui_dialog", "There is no Overmind. An Overmind must be built to allow " - "you to upgrade." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "There is no Overmind. An Overmind must be built to allow " + "you to upgrade." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + } + else + CG_Printf( "There is no Overmind\n" ); + break; case MN_A_HOVEL_OCCUPIED: - trap_Cvar_Set( "ui_dialog", "This Hovel is occupied by another builder. Please find or build " - "another." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "This Hovel is occupied by another builder. Please find or build " + "another." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + } + else + CG_Printf( "This Hovel is occupied by another builder\n" ); + break; case MN_A_HOVEL_BLOCKED: - trap_Cvar_Set( "ui_dialog", "The exit to this Hovel is currently blocked. Please wait until it " - "becomes clear then try again." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "The exit to this Hovel is currently blocked. Please wait until it " + "becomes clear then try again." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + } + else + CG_Printf( "The exit to this Hovel is currently blocked\n" ); + break; case MN_A_HOVEL_EXIT: - trap_Cvar_Set( "ui_dialog", "The exit to this Hovel will always be blocked. Please choose " - "a more suitable location." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + if( !cg_disableWarningDialogs.integer ) + { + trap_Cvar_Set( "ui_dialog", "The exit to this Hovel would always be blocked. Please choose " + "a more suitable location." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + } + else + CG_Printf( "The exit to this Hovel would always be blocked\n" ); + break; case MN_A_INFEST: diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index afd9bb45..c67eaa04 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -186,36 +186,6 @@ void CG_TeslaTrail( vec3_t start, vec3_t end, int srcENum, int destENum ) VectorCopy( end, re->oldorigin ); } -/* -========================== -CG_AlienZap -========================== -*/ -void CG_AlienZap( vec3_t start, vec3_t end, int srcENum, int destENum ) -{ - localEntity_t *le; - refEntity_t *re; - - //add a bunch of bolt segments - le = CG_AllocLocalEntity(); - re = &le->refEntity; - - le->leType = LE_LIGHTNING_BOLT; - le->startTime = cg.time; - le->endTime = cg.time + cg_alienZapTime.value; - le->lifeRate = 1.0 / ( le->endTime - le->startTime ); - re->customShader = cgs.media.lightningShader; - - le->srcENum = srcENum; - le->destENum = destENum; - le->vOffset = 6.0f; - - le->maxRange = LEVEL2_AREAZAP_RANGE * M_ROOT3; - - VectorCopy( start, re->origin ); - VectorCopy( end, re->oldorigin ); -} - /* ================= @@ -1362,16 +1332,12 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) int length; int selectWindow; qboolean vertical; - int ammo, clips, maxAmmo, maxClips; centity_t *cent; playerState_t *ps; cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL ); - BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, &maxClips, NULL ); - // don't display if dead if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) return; @@ -1504,13 +1470,13 @@ CG_WeaponSelectable */ static qboolean CG_WeaponSelectable( int i ) { - int ammo, clips, maxclips; + int ammo, clips; - BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips, &maxclips ); + BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); //TA: this is a pain in the ass -/* if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) - return qfalse;*/ + //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) + // return qfalse; if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) ) return qfalse; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 9922bf13..3c4134fd 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -153,7 +153,7 @@ buildableAttributes_t bg_buildableList[ ] = BIT_ALIENS, //int team; ( 1 << WP_ABUILD )|( 1 << WP_ABUILD2 ), //weapon_t buildWeapon; BANIM_IDLE1, //int idleAnim; - 500, //int nextthink; + 200, //int nextthink; ACIDTUBE_BT, //int buildTime; qfalse, //qboolean usable; 0, //int turretRange; @@ -1475,7 +1475,7 @@ classAttributes_t bg_classList[ ] = 0.000f, //float bob; 1.0f, //float bobCycle; 350, //int steptime; - 100, //float speed; + 600, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; 6.0f, //float friction; @@ -1512,7 +1512,7 @@ classAttributes_t bg_classList[ ] = 80, //int fov; 0.001f, //float bob; 2.0f, //float bobCycle; - 200, //int steptime; + 150, //int steptime; ABUILDER_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1550,7 +1550,7 @@ classAttributes_t bg_classList[ ] = 110, //int fov; 0.001f, //float bob; 2.0f, //float bobCycle; - 200, //int steptime; + 100, //int steptime; ABUILDER_UPG_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1628,7 +1628,7 @@ classAttributes_t bg_classList[ ] = 120, //int fov; 0.001f, //float bob; 1.8f, //float bobCycle; - 25, //int steptime; + 60, //int steptime; LEVEL1_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1667,7 +1667,7 @@ classAttributes_t bg_classList[ ] = 120, //int fov; 0.001f, //float bob; 1.8f, //float bobCycle; - 25, //int steptime; + 60, //int steptime; LEVEL1_UPG_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1706,7 +1706,7 @@ classAttributes_t bg_classList[ ] = 90, //int fov; 0.001f, //float bob; 1.5f, //float bobCycle; - 60, //int steptime; + 80, //int steptime; LEVEL2_SPEED, //float speed; 10.0f, //float acceleration; 2.0f, //float airAcceleration; @@ -1745,7 +1745,7 @@ classAttributes_t bg_classList[ ] = 90, //int fov; 0.001f, //float bob; 1.5f, //float bobCycle; - 60, //int steptime; + 80, //int steptime; LEVEL2_UPG_SPEED, //float speed; 10.0f, //float acceleration; 2.0f, //float airAcceleration; @@ -1784,7 +1784,7 @@ classAttributes_t bg_classList[ ] = 110, //int fov; 0.0005f, //float bob; 1.3f, //float bobCycle; - 25, //int steptime; + 90, //int steptime; LEVEL3_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1823,7 +1823,7 @@ classAttributes_t bg_classList[ ] = 110, //int fov; 0.0005f, //float bob; 1.3f, //float bobCycle; - 25, //int steptime; + 90, //int steptime; LEVEL3_UPG_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1862,7 +1862,7 @@ classAttributes_t bg_classList[ ] = 90, //int fov; 0.001f, //float bob; 1.1f, //float bobCycle; - 60, //int steptime; + 100, //int steptime; LEVEL4_SPEED, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -1901,7 +1901,7 @@ classAttributes_t bg_classList[ ] = 90, //int fov; 0.002f, //float bob; 1.0f, //float bobCycle; - 200, //int steptime; + 100, //int steptime; 1.0f, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; @@ -2952,8 +2952,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int slots; "blaster", //char *weaponName; "Blaster", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -2976,8 +2975,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "rifle", //char *weaponName; "Rifle", //char *weaponHumanName; - RIFLE_CLIPSIZE, //int quan; - RIFLE_SPAWNCLIPS, //int clips; + RIFLE_CLIPSIZE, //int maxAmmo; RIFLE_MAXCLIPS, //int maxClips; qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3000,8 +2998,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "shotgun", //char *weaponName; "Shotgun", //char *weaponHumanName; - SHOTGUN_SHELLS, //int quan; - SHOTGUN_SPAWNCLIPS, //int clips; + SHOTGUN_SHELLS, //int maxAmmo; SHOTGUN_MAXCLIPS, //int maxClips; qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3024,8 +3021,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "flamer", //char *weaponName; "Flame Thrower", //char *weaponHumanName; - FLAMER_GAS, //int quan; - 0, //int clips; + FLAMER_GAS, //int maxAmmo; 0, //int maxClips; qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3048,8 +3044,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "chaingun", //char *weaponName; "Chaingun", //char *weaponHumanName; - CHAINGUN_BULLETS, //int quan; - 0, //int clips; + CHAINGUN_BULLETS, //int maxAmmo; 0, //int maxClips; qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3072,8 +3067,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "mdriver", //char *weaponName; "Mass Driver", //char *weaponHumanName; - MDRIVER_CLIPSIZE, //int quan; - MDRIVER_SPAWNCLIPS, //int clips; + MDRIVER_CLIPSIZE, //int maxAmmo; MDRIVER_MAXCLIPS, //int maxClips; qfalse, //int infiniteAmmo; qtrue, //int usesEnergy; @@ -3096,8 +3090,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "prifle", //char *weaponName; "Pulse Rifle", //char *weaponHumanName; - PRIFLE_CLIPS, //int quan; - PRIFLE_SPAWNCLIPS, //int clips; + PRIFLE_CLIPS, //int maxAmmo; PRIFLE_MAXCLIPS, //int maxClips; qfalse, //int infiniteAmmo; qtrue, //int usesEnergy; @@ -3120,8 +3113,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "lcannon", //char *weaponName; "Lucifer Cannon", //char *weaponHumanName; - LCANNON_AMMO, //int quan; - 0, //int clips; + LCANNON_AMMO, //int maxAmmo; 0, //int maxClips; qfalse, //int infiniteAmmo; qtrue, //int usesEnergy; @@ -3144,8 +3136,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "lgun", //char *weaponName; "Las Gun", //char *weaponHumanName; - LASGUN_AMMO, //int quan; - 0, //int clips; + LASGUN_AMMO, //int maxAmmo; 0, //int maxClips; qfalse, //int infiniteAmmo; qtrue, //int usesEnergy; @@ -3168,8 +3159,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "psaw", //char *weaponName; "Pain Saw", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3192,8 +3182,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_NONE, //int slots; "grenade", //char *weaponName; "Grenade", //char *weaponHumanName; - 1, //int quan; - 0, //int clips; + 1, //int maxAmmo; 0, //int maxClips; qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3216,8 +3205,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "ckit", //char *weaponName; "Construction Kit", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3240,8 +3228,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "ackit", //char *weaponName; "Adv Construction Kit",//char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3264,8 +3251,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "abuild", //char *weaponName; "Alien build weapon", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3288,8 +3274,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "abuild2", //char *weaponName; "Alien build weapon2",//char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3312,8 +3297,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "bite", //char *weaponName; "Bite", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3336,8 +3320,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "pounce", //char *weaponName; "Claw and pounce", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3360,8 +3343,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "pounce_upgrade", //char *weaponName; "Claw and pounce (upgrade)", //char *weaponHumanName; - 3, //int quan; - 0, //int clips; + 3, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3384,8 +3366,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "grabandclaw", //char *weaponName; "Claws", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3408,8 +3389,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "grabandclaw_upgrade",//char *weaponName; "Claws Upgrade", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3432,8 +3412,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "areazap", //char *weaponName; "Area Zap", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3456,8 +3435,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "directzap", //char *weaponName; "Directed Zap", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3480,8 +3458,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "charge", //char *weaponName; "Charge", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3504,8 +3481,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "lockblob", //char *weaponName; "Lock Blob", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3528,8 +3504,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "hive", //char *weaponName; "Hive", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3552,8 +3527,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "mgturret", //char *weaponName; "Machinegun Turret", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; @@ -3576,8 +3550,7 @@ weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "teslagen", //char *weaponName; "Tesla Generator", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qtrue, //int usesEnergy; @@ -3722,7 +3695,7 @@ char *BG_FindHumanNameForWeapon( int weapon ) BG_FindAmmoForWeapon ============== */ -void BG_FindAmmoForWeapon( int weapon, int *quan, int *clips, int *maxClips ) +void BG_FindAmmoForWeapon( int weapon, int *maxAmmo, int *maxClips ) { int i; @@ -3730,10 +3703,8 @@ void BG_FindAmmoForWeapon( int weapon, int *quan, int *clips, int *maxClips ) { if( bg_weapons[ i ].weaponNum == weapon ) { - if( quan != NULL ) - *quan = bg_weapons[ i ].quan; - if( clips != NULL ) - *clips = bg_weapons[ i ].clips; + if( maxAmmo != NULL ) + *maxAmmo = bg_weapons[ i ].maxAmmo; if( maxClips != NULL ) *maxClips = bg_weapons[ i ].maxClips; @@ -4009,6 +3980,7 @@ upgradeAttributes_t bg_upgrades[ ] = "larmour", //char *upgradeName; "Light Armour", //char *upgradeHumanName; "icons/iconu_larmour", + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { @@ -4019,16 +3991,18 @@ upgradeAttributes_t bg_upgrades[ ] = "helmet", //char *upgradeName; "Helmet", //char *upgradeHumanName; "icons/iconu_helmet", + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { - UP_ANTITOXIN, //int upgradeNum; - ANTITOXIN_PRICE, //int price; + UP_MEDKIT, //int upgradeNum; + MEDKIT_PRICE, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_NONE, //int slots; - "atoxin", //char *upgradeName; - "Anti-toxin", //char *upgradeHumanName; + "medkit", //char *upgradeName; + "Medkit", //char *upgradeHumanName; "icons/iconu_atoxin", + qfalse, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { @@ -4039,6 +4013,7 @@ upgradeAttributes_t bg_upgrades[ ] = "battpack", //char *upgradeName; "Battery Pack", //char *upgradeHumanName; "icons/iconu_battpack", + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { @@ -4049,6 +4024,7 @@ upgradeAttributes_t bg_upgrades[ ] = "jetpack", //char *upgradeName; "Jet Pack", //char *upgradeHumanName; "icons/iconu_jetpack", + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { @@ -4059,6 +4035,7 @@ upgradeAttributes_t bg_upgrades[ ] = "bsuit", //char *upgradeName; "Battlesuit", //char *upgradeHumanName; "icons/iconu_bsuit", + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { @@ -4069,6 +4046,7 @@ upgradeAttributes_t bg_upgrades[ ] = "gren", //char *upgradeName; "Grenade", //char *upgradeHumanName; 0, + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; }, { @@ -4079,6 +4057,7 @@ upgradeAttributes_t bg_upgrades[ ] = "ammo", //char *upgradeName; "Ammunition", //char *upgradeHumanName; 0, + qtrue, //qboolean purchasable WUT_HUMANS //WUTeam_t team; } }; @@ -4224,6 +4203,24 @@ char *BG_FindIconForUpgrade( int upgrade ) return 0; } +/* +============== +BG_FindPurchasableForUpgrade +============== +*/ +qboolean BG_FindPurchasableForUpgrade( int upgrade ) +{ + int i; + + for( i = 0; i < bg_numUpgrades; i++ ) + { + if( bg_upgrades[ i ].upgradeNum == upgrade ) + return bg_upgrades[ i ].purchasable; + } + + return qfalse; +} + /* ============== BG_FindTeamForUpgrade @@ -4420,7 +4417,6 @@ char *eventnames[ ] = "EV_MISSILE_MISS", "EV_MISSILE_MISS_METAL", "EV_TESLATRAIL", - "EV_ALIENZAP", "EV_BULLET", // otherEntity is the shooter "EV_LEV1_GRAB", @@ -4443,9 +4439,9 @@ char *eventnames[ ] = "EV_HUMAN_BUILDABLE_EXPLOSION", "EV_ALIEN_BUILDABLE_EXPLOSION", "EV_ALIEN_ACIDTUBE", - "EV_HUMAN_BUILDABLE_DAMAGE", - "EV_ALIEN_BUILDABLE_DAMAGE", + "EV_MEDKIT_USED", + "EV_ALIEN_EVOLVE", "EV_ALIEN_EVOLVE_FAILED", @@ -4751,25 +4747,22 @@ BG_UnpackAmmoArray Extract the ammo quantity from the array ======================== */ -void BG_UnpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ) +void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ) { - int ammoarray[32]; + int ammoarray[ 32 ]; int i; for( i = 0; i <= 15; i++ ) - ammoarray[ i ] = ammo[ i ]; + ammoarray[ i ] = psAmmo[ i ]; for( i = 16; i <= 31; i++ ) - ammoarray[ i ] = ammo2[ i - 16 ]; + ammoarray[ i ] = psAmmo2[ i - 16 ]; - if( quan != NULL ) - *quan = ammoarray[ weapon ] & 0x03FF; + if( ammo != NULL ) + *ammo = ammoarray[ weapon ] & 0x0FFF; if( clips != NULL ) - *clips = ( ammoarray[ weapon ] >> 10 ) & 0x07; - - if( maxclips != NULL ) - *maxclips = ( ammoarray[ weapon ] >> 13 ) & 0x07; + *clips = ( ammoarray[ weapon ] >> 12 ) & 0x0F; } /* @@ -4779,16 +4772,16 @@ BG_PackAmmoArray Pack the ammo quantity into the array ======================== */ -void BG_PackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ) +void BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ) { int weaponvalue; - weaponvalue = quan | ( clips << 10 ) | ( maxclips << 13 ); + weaponvalue = ammo | ( clips << 12 ); if( weapon <= 15 ) - ammo[ weapon ] = weaponvalue; + psAmmo[ weapon ] = weaponvalue; else if( weapon >= 16 ) - ammo2[ weapon - 16 ] = weaponvalue; + psAmmo2[ weapon - 16 ] = weaponvalue; } /* @@ -4798,15 +4791,18 @@ BG_WeaponIsFull Check if a weapon has full ammo ======================== */ -qboolean BG_WeaponIsFull( weapon_t weapon, int ammo[ ], int ammo2[ ] ) +qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int psAmmo[ ], int psAmmo2[ ] ) { int maxAmmo, maxClips; - int quan, clips; + int ammo, clips; - BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); - BG_UnpackAmmoArray( weapon, ammo, ammo2, &quan, &clips, NULL ); + BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); + BG_UnpackAmmoArray( weapon, psAmmo, psAmmo2, &ammo, &clips ); - return ( maxAmmo == quan ) && ( maxClips == clips ); + if( BG_InventoryContainsUpgrade( UP_BATTPACK, stats ) ) + maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); + + return ( maxAmmo == ammo ) && ( maxClips == clips ); } /* diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index b28366be..e349958d 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -385,6 +385,15 @@ static float PM_CmdScale( usercmd_t *cmd ) modifier *= ( 1.0f + ( pm->ps->stats[ STAT_MISC ] / (float)LEVEL4_CHARGE_TIME ) * ( LEVEL4_CHARGE_SPEED - 1.0f ) ); + //slow player if charging up for a pounce + if( ( pm->ps->weapon == WP_ALEVEL3 || pm->ps->weapon == WP_ALEVEL3_UPG ) && + cmd->buttons & BUTTON_ATTACK2 ) + modifier *= LEVEL3_POUNCE_SPEED_MOD; + + //slow the player if slow locked + if( pm->ps->stats[ STAT_STATE ] & SS_SLOWLOCKED ) + modifier *= ABUILDER_BLOB_SPEED_MOD; + if( pm->ps->pm_type == PM_GRABBED ) modifier = 0.0f; @@ -469,7 +478,8 @@ static void PM_CheckCharge( void ) if( pm->ps->weapon != WP_ALEVEL4 ) return; - if( pm->cmd.buttons & BUTTON_ATTACK2 ) + if( pm->cmd.buttons & BUTTON_ATTACK2 && + !( pm->ps->stats[ STAT_STATE ] & SS_CHARGING ) ) { pm->ps->pm_flags &= ~PMF_CHARGE; return; @@ -2046,43 +2056,66 @@ static void PM_GroundTrace( void ) // if the trace didn't hit anything, we are in free fall if( trace.fraction == 1.0f ) { - PM_GroundTraceMissed( ); - pml.groundPlane = qfalse; - pml.walking = qfalse; - - if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLJUMPER ) ) + qboolean steppedDown = qfalse; + + // try to step down + if( pml.groundPlane != qfalse && PM_PredictStepMove( ) ) { - ProjectPointOnPlane( movedir, pml.forward, refNormal ); - VectorNormalize( movedir ); - - if( pm->cmd.forwardmove < 0 ) - VectorNegate( movedir, movedir ); + //step down + point[ 0 ] = pm->ps->origin[ 0 ]; + point[ 1 ] = pm->ps->origin[ 1 ]; + point[ 2 ] = pm->ps->origin[ 2 ] - STEPSIZE; + pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask ); - //allow strafe transitions - if( pm->cmd.rightmove ) + //if we hit something + if( trace.fraction < 1.0f ) { - VectorCopy( pml.right, movedir ); - - if( pm->cmd.rightmove < 0 ) - VectorNegate( movedir, movedir ); + PM_StepEvent( pm->ps->origin, trace.endpos, refNormal ); + VectorCopy( trace.endpos, pm->ps->origin ); + steppedDown = qtrue; } - - //trace into direction we are moving - VectorMA( pm->ps->origin, 0.25f, movedir, point ); - pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask ); - - if( trace.fraction < 1.0f && !( trace.surfaceFlags & ( SURF_SKY | SURF_SLICK ) ) && - ( trace.entityNum == ENTITYNUM_WORLD ) ) + } + + if( !steppedDown ) + { + PM_GroundTraceMissed( ); + pml.groundPlane = qfalse; + pml.walking = qfalse; + + if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLJUMPER ) ) { - if( !VectorCompare( trace.plane.normal, pm->ps->grapplePoint ) ) + ProjectPointOnPlane( movedir, pml.forward, refNormal ); + VectorNormalize( movedir ); + + if( pm->cmd.forwardmove < 0 ) + VectorNegate( movedir, movedir ); + + //allow strafe transitions + if( pm->cmd.rightmove ) + { + VectorCopy( pml.right, movedir ); + + if( pm->cmd.rightmove < 0 ) + VectorNegate( movedir, movedir ); + } + + //trace into direction we are moving + VectorMA( pm->ps->origin, 0.25f, movedir, point ); + pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask ); + + if( trace.fraction < 1.0f && !( trace.surfaceFlags & ( SURF_SKY | SURF_SLICK ) ) && + ( trace.entityNum == ENTITYNUM_WORLD ) ) { - VectorCopy( trace.plane.normal, pm->ps->grapplePoint ); - PM_CheckWallJump( ); + if( !VectorCompare( trace.plane.normal, pm->ps->grapplePoint ) ) + { + VectorCopy( trace.plane.normal, pm->ps->grapplePoint ); + PM_CheckWallJump( ); + } } } + + return; } - - return; } // check if getting thrown off the ground @@ -2619,7 +2652,7 @@ Generates weapon events and modifes the weapon counter static void PM_Weapon( void ) { int addTime = 200; //default addTime - should never be used - int ammo, clips, maxclips; + int ammo, clips, maxClips; qboolean attack1 = qfalse; qboolean attack2 = qfalse; qboolean attack3 = qfalse; @@ -2717,7 +2750,8 @@ static void PM_Weapon( void ) // start the animation even if out of ammo - BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); + BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips ); + BG_FindAmmoForWeapon( pm->ps->weapon, NULL, &maxClips ); // check for out of ammo if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) @@ -2730,17 +2764,17 @@ static void PM_Weapon( void ) //done reloading so give em some ammo if( pm->ps->weaponstate == WEAPON_RELOADING ) { - if( maxclips > 0 ) + if( maxClips > 0 ) { clips--; - BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL ); + BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL ); } if( BG_FindUsesEnergyForWeapon( pm->ps->weapon ) && BG_InventoryContainsUpgrade( UP_BATTPACK, pm->ps->stats ) ) ammo = (int)( (float)ammo * BATTPACK_MODIFIER ); - BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips ); //allow some time for the weapon to be raised pm->ps->weaponstate = WEAPON_RAISING; @@ -2967,13 +3001,13 @@ static void PM_Weapon( void ) else ammo--; - BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips ); } else if( pm->ps->weapon == WP_ALEVEL3_UPG && attack3 ) { //special case for slowblob ammo--; - BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips ); } //FIXME: predicted angles miss a problem?? @@ -3175,11 +3209,11 @@ void trap_SnapVector( float *v ); void PmoveSingle( pmove_t *pmove ) { - int ammo, clips, maxclips; + int ammo, clips; pm = pmove; - BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); + BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips ); // this counter lets us debug movement problems with a journal // by setting a conditional breakpoint fot the previous frame diff --git a/src/game/bg_public.h b/src/game/bg_public.h index c2b3805f..1104dccb 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -233,6 +233,8 @@ typedef enum #define SS_BOOSTED 0x00000200 #define SS_SLOWLOCKED 0x00000400 #define SS_POISONCLOUDED 0x00000800 +#define SS_MEDKIT_ACTIVE 0x00001000 +#define SS_CHARGING 0x00002000 #define SB_VALID_TOGGLEBIT 0x00004000 @@ -369,7 +371,7 @@ typedef enum UP_LIGHTARMOUR, UP_HELMET, - UP_ANTITOXIN, + UP_MEDKIT, UP_BATTPACK, UP_JETPACK, UP_BATTLESUIT, @@ -527,7 +529,6 @@ typedef enum EV_MISSILE_MISS, EV_MISSILE_MISS_METAL, EV_TESLATRAIL, - EV_ALIENZAP, EV_BULLET, // otherEntity is the shooter EV_LEV1_GRAB, @@ -550,8 +551,8 @@ typedef enum EV_HUMAN_BUILDABLE_EXPLOSION, EV_ALIEN_BUILDABLE_EXPLOSION, EV_ALIEN_ACIDTUBE, - EV_HUMAN_BUILDABLE_DAMAGE, - EV_ALIEN_BUILDABLE_DAMAGE, + + EV_MEDKIT_USED, EV_ALIEN_EVOLVE, EV_ALIEN_EVOLVE_FAILED, @@ -1031,8 +1032,7 @@ typedef struct char *weaponName; char *weaponHumanName; - int quan; - int clips; + int maxAmmo; int maxClips; qboolean infiniteAmmo; qboolean usesEnergy; @@ -1070,14 +1070,16 @@ typedef struct char *icon; + qboolean purchasable; + WUTeam_t team; } upgradeAttributes_t; //TA: -void BG_UnpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ); -void BG_PackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ); -qboolean BG_WeaponIsFull( weapon_t weapon, int ammo[ ], int ammo2[ ] ); +void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ); +void BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ); +qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int psAmmo[ ], int psAmmo2[ ] ); void BG_AddWeaponToInventory( int weapon, int stats[ ] ); void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] ); qboolean BG_InventoryContainsWeapon( int weapon, int stats[ ] ); @@ -1175,7 +1177,7 @@ char *BG_FindModelsForWeapon( int weapon, int modelNum ); char *BG_FindIconForWeapon( int weapon ); char *BG_FindCrosshairForWeapon( int weapon ); int BG_FindCrosshairSizeForWeapon( int weapon ); -void BG_FindAmmoForWeapon( int weapon, int *quan, int *clips, int *maxClips ); +void BG_FindAmmoForWeapon( int weapon, int *maxAmmo, int *maxClips ); qboolean BG_FindInfinteAmmoForWeapon( int weapon ); qboolean BG_FindUsesEnergyForWeapon( int weapon ); int BG_FindRepeatRate1ForWeapon( int weapon ); @@ -1197,6 +1199,7 @@ char *BG_FindNameForUpgrade( int upgrade ); int BG_FindUpgradeNumForName( char *name ); char *BG_FindHumanNameForUpgrade( int upgrade ); char *BG_FindIconForUpgrade( int upgrade ); +qboolean BG_FindPurchasableForUpgrade( int upgrade ); WUTeam_t BG_FindTeamForUpgrade( int upgrade ); // content masks @@ -1235,6 +1238,7 @@ typedef enum ET_ANIMMAPOBJ, ET_MODELDOOR, ET_LIGHTFLARE, + ET_LEV2_ZAP_CHAIN, ET_EVENTS // any of the EV_* events can be added freestanding // by setting eType to ET_EVENTS + eventNum diff --git a/src/game/bg_slidemove.c b/src/game/bg_slidemove.c index e4f7f6c5..2ddd952b 100644 --- a/src/game/bg_slidemove.c +++ b/src/game/bg_slidemove.c @@ -305,21 +305,18 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive ) if( PM_SlideMove( gravity ) == 0 ) { - if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) - { - VectorCopy( start_o, down ); - VectorMA( down, -STEPSIZE, normal, down ); - pm->trace( &trace, start_o, pm->mins, pm->maxs, down, pm->ps->clientNum, pm->tracemask ); + VectorCopy( start_o, down ); + VectorMA( down, -STEPSIZE, normal, down ); + pm->trace( &trace, start_o, pm->mins, pm->maxs, down, pm->ps->clientNum, pm->tracemask ); - //we can step down - if( trace.fraction > 0.01f && trace.fraction < 1.0f && - !trace.allsolid && pml.groundPlane != qfalse ) - { - if( pm->debugLevel ) - Com_Printf( "%d: step down\n", c_pmove ); - - stepped = qtrue; - } + //we can step down + if( trace.fraction > 0.01f && trace.fraction < 1.0f && + !trace.allsolid && pml.groundPlane != qfalse ) + { + if( pm->debugLevel ) + Com_Printf( "%d: step down\n", c_pmove ); + + stepped = qtrue; } } else diff --git a/src/game/g_active.c b/src/game/g_active.c index e3f09d69..581069cc 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -334,7 +334,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) else client->ps.pm_type = PM_SPECTATOR; - client->ps.speed = 400; // faster than normal + client->ps.speed = BG_FindSpeedForClass( client->ps.stats[ STAT_PCLASS ] ); client->ps.stats[ STAT_STAMINA ] = 0; client->ps.stats[ STAT_MISC ] = 0; @@ -440,7 +440,7 @@ qboolean ClientInactivityTimer( gclient_t *client ) if( level.time > client->inactivityTime - 10000 && !client->inactivityWarning ) { client->inactivityWarning = qtrue; - trap_SendServerCommand( client - level.clients, "cp \"Ten seconds until inactivity drop!\n\"" ); + G_SendCommandFromServer( client - level.clients, "cp \"Ten seconds until inactivity drop!\n\"" ); } } @@ -542,23 +542,30 @@ void ClientTimerActions( gentity_t *ent, int msec ) if( client->ps.weapon == WP_ALEVEL4 ) { if( client->ps.stats[ STAT_MISC ] < LEVEL4_CHARGE_TIME && ucmd->buttons & BUTTON_ATTACK2 && - ( ucmd->forwardmove > 0 ) && !client->charging ) + !client->charging ) { client->charging = qfalse; //should already be off, just making sure + client->ps.stats[ STAT_STATE ] &= ~SS_CHARGING; - //trigger charge sound - if( client->ps.stats[ STAT_MISC ] <= 0 ) - G_AddEvent( ent, EV_LEV4_CHARGE_PREPARE, 0 ); - - client->ps.stats[ STAT_MISC ] += (int)( 100 * (float)LEVEL4_CHARGE_CHARGE_RATIO ); - - if( client->ps.stats[ STAT_MISC ] > LEVEL4_CHARGE_TIME ) - client->ps.stats[ STAT_MISC ] = LEVEL4_CHARGE_TIME; + if( ucmd->forwardmove > 0 ) + { + //trigger charge sound...is quite annoying + //if( client->ps.stats[ STAT_MISC ] <= 0 ) + // G_AddEvent( ent, EV_LEV4_CHARGE_PREPARE, 0 ); + + client->ps.stats[ STAT_MISC ] += (int)( 100 * (float)LEVEL4_CHARGE_CHARGE_RATIO ); + + if( client->ps.stats[ STAT_MISC ] > LEVEL4_CHARGE_TIME ) + client->ps.stats[ STAT_MISC ] = LEVEL4_CHARGE_TIME; + } + else + client->ps.stats[ STAT_MISC ] = 0; } - if( !( ucmd->buttons & BUTTON_ATTACK2 ) || client->charging ) + if( !( ucmd->buttons & BUTTON_ATTACK2 ) || client->charging || + client->ps.stats[ STAT_MISC ] == LEVEL4_CHARGE_TIME ) { - if( client->ps.stats[ STAT_MISC ] > 0 ) + if( client->ps.stats[ STAT_MISC ] > LEVEL4_MIN_CHARGE_TIME ) { client->ps.stats[ STAT_MISC ] -= 100; @@ -566,20 +573,25 @@ void ClientTimerActions( gentity_t *ent, int msec ) G_AddEvent( ent, EV_LEV4_CHARGE_START, 0 ); client->charging = qtrue; + client->ps.stats[ STAT_STATE ] |= SS_CHARGING; //if the charger has stopped moving take a chunk of charge away if( VectorLength( client->ps.velocity ) < 64.0f || aRight ) - client->ps.stats[ STAT_MISC ] = client->ps.stats[ STAT_MISC ] >> 1; + client->ps.stats[ STAT_MISC ] = client->ps.stats[ STAT_MISC ] / 2; //can't charge backwards if( ucmd->forwardmove < 0 ) client->ps.stats[ STAT_MISC ] = 0; } + else + client->ps.stats[ STAT_MISC ] = 0; + if( client->ps.stats[ STAT_MISC ] <= 0 ) { client->ps.stats[ STAT_MISC ] = 0; client->charging = qfalse; + client->ps.stats[ STAT_STATE ] &= ~SS_CHARGING; } } } @@ -589,7 +601,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) { int ammo; - BG_UnpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); + BG_UnpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL ); if( client->ps.stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE && ucmd->buttons & BUTTON_ATTACK ) client->ps.stats[ STAT_MISC ] += ( 100.0f / LCANNON_CHARGE_TIME ) * LCANNON_TOTAL_CHARGE; @@ -631,6 +643,43 @@ void ClientTimerActions( gentity_t *ent, int msec ) default: break; } + + if( client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE ) + { + int remainingStartupTime = MEDKIT_STARTUP_TIME - ( level.time - client->lastMedKitTime ); + + if( remainingStartupTime < 0 ) + { + if( ent->health < ent->client->ps.stats[ STAT_MAX_HEALTH ] && + ent->client->medKitHealthToRestore && + ent->client->ps.pm_type != PM_DEAD ) + { + ent->client->medKitHealthToRestore--; + ent->health++; + } + else + ent->client->ps.stats[ STAT_STATE ] &= ~SS_MEDKIT_ACTIVE; + } + else + { + if( ent->health < ent->client->ps.stats[ STAT_MAX_HEALTH ] && + ent->client->medKitHealthToRestore && + ent->client->ps.pm_type != PM_DEAD ) + { + //partial increase + if( level.time > client->medKitIncrementTime ) + { + ent->client->medKitHealthToRestore--; + ent->health++; + + client->medKitIncrementTime = level.time + + ( remainingStartupTime / MEDKIT_STARTUP_SPEED ); + } + } + else + ent->client->ps.stats[ STAT_STATE ] &= ~SS_MEDKIT_ACTIVE; + } + } } while( client->time1000 >= 1000 ) @@ -697,7 +746,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) } if( ent->health < client->ps.stats[ STAT_MAX_HEALTH ] && - ( client->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time ) + ( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time ) ent->health += BG_FindRegenRateForClass( client->ps.stats[ STAT_PCLASS ] ) * modifier; if( ent->health > client->ps.stats[ STAT_MAX_HEALTH ] ) @@ -713,13 +762,13 @@ void ClientTimerActions( gentity_t *ent, int msec ) { int ammo, maxAmmo; - BG_FindAmmoForWeapon( WP_ALEVEL3_UPG, &maxAmmo, NULL, NULL ); - BG_UnpackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); + BG_FindAmmoForWeapon( WP_ALEVEL3_UPG, &maxAmmo, NULL ); + BG_UnpackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, &ammo, NULL ); if( ammo < maxAmmo ) { ammo++; - BG_PackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, ammo, 0, 0 ); + BG_PackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, ammo, 0 ); } } } @@ -833,14 +882,14 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) if( BG_InventoryContainsWeapon( j, ent->client->ps.stats ) ) { - trap_SendServerCommand( ent - g_entities, va( "weaponswitch %d", j ) ); + G_SendCommandFromServer( ent - g_entities, va( "weaponswitch %d", j ) ); break; } } //only got the blaster to switch to if( j == WP_NUM_WEAPONS ) - trap_SendServerCommand( ent - g_entities, va( "weaponswitch %d", WP_BLASTER ) ); + G_SendCommandFromServer( ent - g_entities, va( "weaponswitch %d", WP_BLASTER ) ); //update ClientInfo ClientUserinfoChanged( ent->client->ps.clientNum ); @@ -1022,16 +1071,33 @@ void ClientThink_real( gentity_t *ent ) client->ps.gravity = g_gravity.value; - if( BG_InventoryContainsUpgrade( UP_ANTITOXIN, client->ps.stats ) && - BG_UpgradeIsActive( UP_ANTITOXIN, client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_MEDKIT, client->ps.stats ) && + BG_UpgradeIsActive( UP_MEDKIT, client->ps.stats ) ) { - if( client->ps.stats[ STAT_STATE ] & SS_POISONED ) + //if currently using a medkit or have no need for a medkit now + if( client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE || + ( client->ps.stats[ STAT_HEALTH ] == client->ps.stats[ STAT_MAX_HEALTH ] && + !( client->ps.stats[ STAT_STATE ] & SS_POISONED ) ) ) + { + BG_DeactivateUpgrade( UP_MEDKIT, client->ps.stats ); + } + else { //remove anti toxin - BG_DeactivateUpgrade( UP_ANTITOXIN, client->ps.stats ); - BG_RemoveUpgradeFromInventory( UP_ANTITOXIN, client->ps.stats ); + BG_DeactivateUpgrade( UP_MEDKIT, client->ps.stats ); + BG_RemoveUpgradeFromInventory( UP_MEDKIT, client->ps.stats ); client->ps.stats[ STAT_STATE ] &= ~SS_POISONED; + client->poisonImmunityTime = level.time + MEDKIT_POISON_IMMUNITY_TIME; + + client->ps.stats[ STAT_STATE ] |= SS_MEDKIT_ACTIVE; + client->lastMedKitTime = level.time; + client->medKitHealthToRestore = + client->ps.stats[ STAT_MAX_HEALTH ] - client->ps.stats[ STAT_HEALTH ]; + client->medKitIncrementTime = level.time + + ( MEDKIT_STARTUP_TIME / MEDKIT_STARTUP_SPEED ); + + G_AddEvent( ent, EV_MEDKIT_USED, 0 ); } } @@ -1053,15 +1119,6 @@ void ClientThink_real( gentity_t *ent ) // set speed client->ps.speed = g_speed.value * BG_FindSpeedForClass( client->ps.stats[ STAT_PCLASS ] ); - //TA: slow player if charging up for a pounce - if( ( client->ps.weapon == WP_ALEVEL3 || client->ps.weapon == WP_ALEVEL3_UPG ) && - ucmd->buttons & BUTTON_ATTACK2 ) - client->ps.speed *= LEVEL3_POUNCE_SPEED_MOD; - - //TA: slow the player if slow locked - if( client->ps.stats[ STAT_STATE ] & SS_SLOWLOCKED ) - client->ps.speed *= ABUILDER_BLOB_SPEED_MOD; - if( client->lastCreepSlowTime + CREEP_TIMEOUT < level.time ) client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED; @@ -1069,7 +1126,7 @@ void ClientThink_real( gentity_t *ent ) if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) ) { - if( client->lastDamageTime + JETPACK_DISABLE_TIME > level.time ) + if( ent->lastDamageTime + JETPACK_DISABLE_TIME > level.time ) { if( random( ) > JETPACK_DISABLE_CHANCE ) client->ps.pm_type = PM_NORMAL; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 47815cb5..21a3d059 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -319,7 +319,7 @@ static qboolean findOvermind( gentity_t *self ) continue; //if entity is an overmind calculate the distance to it - if( ent->s.modelindex == BA_A_OVERMIND && ent->spawned ) + if( ent->s.modelindex == BA_A_OVERMIND && ent->spawned && ent->health > 0 ) { self->overmindNode = ent; return qtrue; @@ -424,19 +424,20 @@ creepSlow Set any nearby humans' SS_CREEPSLOWED flag ================ */ -static void creepSlow( buildable_t buildable, vec3_t origin ) +static void creepSlow( gentity_t *self ) { - int entityList[ MAX_GENTITIES ]; - vec3_t range; - vec3_t mins, maxs; - int i, num; - gentity_t *enemy; - float creepSize = (float)BG_FindCreepSizeForBuildable( buildable ); + int entityList[ MAX_GENTITIES ]; + vec3_t range; + vec3_t mins, maxs; + int i, num; + gentity_t *enemy; + buildable_t buildable = self->s.modelindex; + float creepSize = (float)BG_FindCreepSizeForBuildable( buildable ); VectorSet( range, creepSize, creepSize, creepSize ); - VectorAdd( origin, range, maxs ); - VectorSubtract( origin, range, mins ); + VectorAdd( self->s.origin, range, maxs ); + VectorSubtract( self->s.origin, range, mins ); //find humans num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); @@ -445,7 +446,8 @@ static void creepSlow( buildable_t buildable, vec3_t origin ) enemy = &g_entities[ entityList[ i ] ]; if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && - enemy->client->ps.groundEntityNum != ENTITYNUM_NONE ) + enemy->client->ps.groundEntityNum != ENTITYNUM_NONE && + G_Visible( self, enemy ) ) { enemy->client->ps.stats[ STAT_STATE ] |= SS_CREEPSLOWED; enemy->client->lastCreepSlowTime = level.time; @@ -642,7 +644,7 @@ void ASpawn_Think( gentity_t *self ) } } - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -709,7 +711,7 @@ void AOvermind_Think( gentity_t *self ) } //low on spawns - if( level.numAlienSpawns <= 1 && level.time > self->overmindSpawnsTimer ) + if( level.numAlienSpawns <= 0 && level.time > self->overmindSpawnsTimer ) { self->overmindSpawnsTimer = level.time + OVERMIND_SPAWNS_PERIOD; G_BroadcastEvent( EV_OVERMIND_SPAWNS, 0 ); @@ -731,8 +733,10 @@ void AOvermind_Think( gentity_t *self ) self->lastHealth = self->health; } + else + self->overmindSpawnsTimer = level.time + OVERMIND_SPAWNS_PERIOD; - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -829,7 +833,7 @@ void ABarricade_Think( gentity_t *self ) return; } - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -874,7 +878,7 @@ void AAcidTube_Damage( gentity_t *self ) self->splashRadius, self, self->splashMethodOfDeath, PTE_ALIENS ); } - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -926,7 +930,7 @@ void AAcidTube_Think( gentity_t *self ) } } - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -1002,7 +1006,7 @@ void AHive_Think( gentity_t *self ) } } - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); } @@ -1166,7 +1170,7 @@ void AHovel_Think( gentity_t *self ) G_setIdleBuildableAnim( self, BANIM_IDLE1 ); } - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + 200; } @@ -1242,7 +1246,7 @@ Called when an alien touches a booster */ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) { - int ammo, clips, maxClips; + int maxAmmo, maxClips; gclient_t *client = other->client; if( !self->spawned ) @@ -1262,8 +1266,8 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) return; //restore ammo, if any - BG_FindAmmoForWeapon( client->ps.weapon, &ammo, &clips, &maxClips ); - BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); + BG_FindAmmoForWeapon( client->ps.weapon, &maxAmmo, &maxClips ); + BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips ); if( !( client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) ) { @@ -1418,7 +1422,7 @@ void ATrapper_Think( gentity_t *self ) int range = BG_FindRangeForBuildable( self->s.modelindex ); int firespeed = BG_FindFireSpeedForBuildable( self->s.modelindex ); - creepSlow( self->s.modelindex, self->s.origin ); + creepSlow( self ); self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); @@ -1520,14 +1524,14 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) if( !BG_FindUsesEnergyForWeapon( weapon ) ) return; - if( !BG_WeaponIsFull( weapon, ps->ammo, ps->powerups ) ) + if( !BG_WeaponIsFull( weapon, ps->stats, ps->ammo, ps->powerups ) ) { - BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); + BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); if( BG_InventoryContainsUpgrade( UP_BATTPACK, ps->stats ) ) maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); - BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips ); + BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips ); G_AddEvent( activator, EV_RPTUSE_SOUND, 0 ); activator->client->lastRefilTime = level.time; @@ -1737,6 +1741,8 @@ void HMedistat_Think( gentity_t *self ) self->active = qtrue; } } + else if( !BG_InventoryContainsUpgrade( UP_MEDKIT, player->client->ps.stats ) ) + BG_AddUpgradeToInventory( UP_MEDKIT, player->client->ps.stats ); } } } @@ -1754,7 +1760,15 @@ void HMedistat_Think( gentity_t *self ) if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_POISONED ) self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED; + if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE ) + self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_MEDKIT_ACTIVE; + self->enemy->health++; + + //if they're completely healed, give them a medkit + if( self->enemy->health >= self->enemy->client->ps.stats[ STAT_MAX_HEALTH ] && + !BG_InventoryContainsUpgrade( UP_MEDKIT, self->enemy->client->ps.stats ) ) + BG_AddUpgradeToInventory( UP_MEDKIT, self->enemy->client->ps.stats ); } } } @@ -2347,7 +2361,8 @@ void G_BuildableThink( gentity_t *ent, int msec ) if( !ent->spawned ) ent->health += (int)( ceil( (float)bHealth / (float)( bTime * 0.001 ) ) ); - else if( ent->health > 0 && ent->health < bHealth && bRegen ) + else if( ent->biteam == BIT_ALIENS && ent->health > 0 && ent->health < bHealth && + bRegen && ( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time ) ent->health += bRegen; if( ent->health > bHealth ) @@ -2498,12 +2513,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance //if none found... if( i >= level.num_entities && buildable != BA_A_OVERMIND ) - { - if( buildable == BA_A_SPAWN ) - reason = IBE_SPWNWARN; - else - reason = IBE_NOOVERMIND; - } + reason = IBE_NOOVERMIND; //can we only have one of these? if( BG_FindUniqueTestForBuildable( buildable ) ) @@ -2532,10 +2542,6 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance //tell player to build a repeater to provide power if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER ) reason = IBE_REPEATER; - - //warn that the current spawn will not be externally powered - if( buildable == BA_H_SPAWN ) - reason = IBE_TNODEWARN; } //this buildable requires a DCC diff --git a/src/game/g_client.c b/src/game/g_client.c index 23fca525..7c564be9 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -316,11 +316,10 @@ SelectAlienSpawnPoint go to a random point that doesn't telefrag ================ */ -gentity_t *SelectAlienSpawnPoint( void ) +gentity_t *SelectAlienSpawnPoint( vec3_t preference ) { gentity_t *spot; int count; - int selection; gentity_t *spots[ MAX_SPAWN_POINTS ]; if( level.numAlienSpawns <= 0 ) @@ -354,8 +353,7 @@ gentity_t *SelectAlienSpawnPoint( void ) if( !count ) return NULL; - selection = rand() % count; - return spots[ selection ]; + return G_ClosestEnt( preference, spots, count ); } @@ -366,11 +364,10 @@ SelectHumanSpawnPoint go to a random point that doesn't telefrag ================ */ -gentity_t *SelectHumanSpawnPoint( void ) +gentity_t *SelectHumanSpawnPoint( vec3_t preference ) { gentity_t *spot; int count; - int selection; gentity_t *spots[ MAX_SPAWN_POINTS ]; if( level.numHumanSpawns <= 0 ) @@ -404,8 +401,7 @@ gentity_t *SelectHumanSpawnPoint( void ) if( !count ) return NULL; - selection = rand() % count; - return spots[ selection ]; + return G_ClosestEnt( preference, spots, count ); } @@ -429,14 +425,14 @@ SelectTremulousSpawnPoint Chooses a player start, deathmatch start, etc ============ */ -gentity_t *SelectTremulousSpawnPoint( pTeam_t team, vec3_t origin, vec3_t angles ) +gentity_t *SelectTremulousSpawnPoint( pTeam_t team, vec3_t preference, vec3_t origin, vec3_t angles ) { gentity_t *spot = NULL; if( team == PTE_ALIENS ) - spot = SelectAlienSpawnPoint( ); + spot = SelectAlienSpawnPoint( preference ); else if( team == PTE_HUMANS ) - spot = SelectHumanSpawnPoint( ); + spot = SelectHumanSpawnPoint( preference ); //no available spots if( !spot ) @@ -997,7 +993,7 @@ void ClientUserinfoChanged( int clientNum ) { if( strcmp( oldname, client->pers.netname ) ) { - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " renamed to %s\n\"", oldname, + G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " renamed to %s\n\"", oldname, client->pers.netname ) ); } } @@ -1158,7 +1154,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) // don't do the "xxx connected" messages if they were caried over from previous level if( firstTime ) - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " connected\n\"", client->pers.netname ) ); + G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " connected\n\"", client->pers.netname ) ); // count current clients and rank for scoreboard CalculateRanks( ); @@ -1218,10 +1214,12 @@ void ClientBegin( int clientNum ) tent->s.clientNum = ent->s.clientNum; } - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) ); + G_InitCommandQueue( clientNum ); + + G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) ); // request the clients PTR code - trap_SendServerCommand( ent - g_entities, "ptrcrequest" ); + G_SendCommandFromServer( ent - g_entities, "ptrcrequest" ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); @@ -1254,7 +1252,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles int eventSequence; char userinfo[ MAX_INFO_STRING ]; vec3_t up = { 0.0f, 0.0f, 1.0f }; - int ammo, clips, maxClips; + int maxAmmo, maxClips; weapon_t weapon; @@ -1387,6 +1385,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles if( ent->client->pers.classSelection == PCL_HUMAN ) { BG_AddWeaponToInventory( WP_BLASTER, client->ps.stats ); + BG_AddUpgradeToInventory( UP_MEDKIT, client->ps.stats ); weapon = client->pers.humanItemSelection; } else if( client->sess.sessionTeam != TEAM_SPECTATOR ) @@ -1394,9 +1393,9 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles else weapon = WP_NONE; - BG_FindAmmoForWeapon( weapon, &ammo, &clips, &maxClips ); + BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); BG_AddWeaponToInventory( weapon, client->ps.stats ); - BG_PackAmmoArray( weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); + BG_PackAmmoArray( weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips ); ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.classSelection; ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.teamSelection; @@ -1407,6 +1406,13 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles // health will count down towards max_health ent->health = client->ps.stats[ STAT_HEALTH ] = client->ps.stats[ STAT_MAX_HEALTH ]; //* 1.25; + + //if evolving scale health + if( ent == spawn ) + { + ent->health *= ent->client->pers.evolveHealthFraction; + client->ps.stats[ STAT_HEALTH ] *= ent->client->pers.evolveHealthFraction; + } //clear the credits array for( i = 0; i < MAX_CLIENTS; i++ ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index cc5b49c2..a5e9cc3a 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -67,7 +67,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) if( idnum < 0 || idnum >= level.maxclients ) { - trap_SendServerCommand( to - g_entities, va( "print \"Bad client slot: %i\n\"", idnum ) ); + G_SendCommandFromServer( to - g_entities, va( "print \"Bad client slot: %i\n\"", idnum ) ); return -1; } @@ -75,7 +75,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) if( cl->pers.connected != CON_CONNECTED ) { - trap_SendServerCommand( to - g_entities, va( "print \"Client %i is not active\n\"", idnum ) ); + G_SendCommandFromServer( to - g_entities, va( "print \"Client %i is not active\n\"", idnum ) ); return -1; } @@ -96,7 +96,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) return idnum; } - trap_SendServerCommand( to - g_entities, va( "print \"User %s is not on the server\n\"", s ) ); + G_SendCommandFromServer( to - g_entities, va( "print \"User %s is not on the server\n\"", s ) ); return -1; } @@ -170,7 +170,7 @@ void ScoreboardMessage( gentity_t *ent ) stringlength += j; } - trap_SendServerCommand( ent-g_entities, va( "scores %i %i %i%s", i, + G_SendCommandFromServer( ent-g_entities, va( "scores %i %i %i%s", i, level.alienKills, level.humanKills, string ) ); } @@ -198,13 +198,13 @@ qboolean CheatsOk( gentity_t *ent ) { if( !g_cheats.integer ) { - trap_SendServerCommand( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) ); + G_SendCommandFromServer( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) ); return qfalse; } if( ent->health <= 0 ) { - trap_SendServerCommand( ent-g_entities, va( "print \"You must be alive to use this command\n\"" ) ); + G_SendCommandFromServer( ent-g_entities, va( "print \"You must be alive to use this command\n\"" ) ); return qfalse; } @@ -261,7 +261,6 @@ Give items to a client void Cmd_Give_f( gentity_t *ent ) { char *name; - int i; qboolean give_all; if( !CheatsOk( ent ) ) @@ -281,23 +280,6 @@ void Cmd_Give_f( gentity_t *ent ) return; } - if( give_all || Q_stricmp( name, "weapons" ) == 0 ) - { - BG_AddWeaponToInventory( ( 1 << WP_NUM_WEAPONS ) - 1 - ( 1 << WP_NONE ), ent->client->ps.stats ); - - if( !give_all ) - return; - } - - if( give_all || Q_stricmp( name, "ammo" ) == 0 ) - { - for( i = 0; i < MAX_WEAPONS; i++ ) - BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, 999, 0, 0 ); - - if( !give_all ) - return; - } - if( give_all || Q_stricmpn( name, "funds", 5 ) == 0 ) { int credits = atoi( name + 6 ); @@ -336,7 +318,7 @@ void Cmd_God_f( gentity_t *ent ) else msg = "godmode ON\n"; - trap_SendServerCommand( ent - g_entities, va( "print \"%s\"", msg ) ); + G_SendCommandFromServer( ent - g_entities, va( "print \"%s\"", msg ) ); } @@ -363,7 +345,7 @@ void Cmd_Notarget_f( gentity_t *ent ) else msg = "notarget ON\n"; - trap_SendServerCommand( ent - g_entities, va( "print \"%s\"", msg ) ); + G_SendCommandFromServer( ent - g_entities, va( "print \"%s\"", msg ) ); } @@ -388,7 +370,7 @@ void Cmd_Noclip_f( gentity_t *ent ) ent->client->noclip = !ent->client->noclip; - trap_SendServerCommand( ent - g_entities, va( "print \"%s\"", msg ) ); + G_SendCommandFromServer( ent - g_entities, va( "print \"%s\"", msg ) ); } @@ -408,7 +390,7 @@ void Cmd_LevelShot_f( gentity_t *ent ) return; BeginIntermission( ); - trap_SendServerCommand( ent - g_entities, "clientLevelShot" ); + G_SendCommandFromServer( ent - g_entities, "clientLevelShot" ); } /* @@ -429,7 +411,7 @@ void Cmd_Kill_f( gentity_t *ent ) if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) { - trap_SendServerCommand( ent-g_entities, "print \"Leave the hovel first (use your destroy key)\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"Leave the hovel first (use your destroy key)\n\"" ); return; } @@ -446,12 +428,12 @@ void Cmd_Kill_f( gentity_t *ent ) { if( ent->suicideTime == 0 ) { - trap_SendServerCommand( ent-g_entities, "print \"You will suicide in 20 seconds\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"You will suicide in 20 seconds\n\"" ); ent->suicideTime = level.time + 20000; } else if( ent->suicideTime > level.time ) { - trap_SendServerCommand( ent-g_entities, "print \"Suicide cancelled\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"Suicide cancelled\n\"" ); ent->suicideTime = 0; } } @@ -502,7 +484,7 @@ void Cmd_Team_f( gentity_t *ent ) if( !strlen( s ) ) { - trap_SendServerCommand( ent-g_entities, va("print \"team: %i\n\"", ent->client->pers.teamSelection ) ); + G_SendCommandFromServer( ent-g_entities, va("print \"team: %i\n\"", ent->client->pers.teamSelection ) ); return; } @@ -539,16 +521,16 @@ void Cmd_Team_f( gentity_t *ent ) } else { - trap_SendServerCommand( ent-g_entities, va( "print \"Unknown team: %s\n\"", s ) ); + G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown team: %s\n\"", s ) ); return; } G_ChangeTeam( ent, team ); if( team == PTE_ALIENS ) - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) ); + G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) ); else if( team == PTE_HUMANS ) - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", ent->client->pers.netname ) ); + G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", ent->client->pers.netname ) ); } @@ -574,7 +556,7 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons if( mode == SAY_TEAM && !OnSameTeam( ent, other ) ) return; - trap_SendServerCommand( other-g_entities, va( "%s \"%s%c%c%s\"", + G_SendCommandFromServer( other-g_entities, va( "%s \"%s%c%c%s\"", mode == SAY_TEAM ? "tchat" : "chat", name, Q_COLOR_ESCAPE, color, message ) ); } @@ -708,7 +690,7 @@ Cmd_Where_f */ void Cmd_Where_f( gentity_t *ent ) { - trap_SendServerCommand( ent-g_entities, va( "print \"%s\n\"", vtos( ent->s.origin ) ) ); + G_SendCommandFromServer( ent-g_entities, va( "print \"%s\n\"", vtos( ent->s.origin ) ) ); } /* @@ -724,25 +706,25 @@ void Cmd_CallVote_f( gentity_t *ent ) if( !g_allowVote.integer ) { - trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"Voting not allowed here\n\"" ); return; } if( level.voteTime ) { - trap_SendServerCommand( ent-g_entities, "print \"A vote is already in progress\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"A vote is already in progress\n\"" ); return; } if( ent->client->pers.voteCount >= MAX_VOTE_COUNT ) { - trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"You have called the maximum number of votes\n\"" ); return; } if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) { - trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" ); return; } @@ -752,7 +734,7 @@ void Cmd_CallVote_f( gentity_t *ent ) if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) { - trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"Invalid vote string\n\"" ); return; } @@ -764,8 +746,8 @@ void Cmd_CallVote_f( gentity_t *ent ) else if( !Q_stricmp( arg1, "timelimit" ) ) { } else { - trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); - trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map , " + G_SendCommandFromServer( ent-g_entities, "print \"Invalid vote string\n\"" ); + G_SendCommandFromServer( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map , " "kick , clientkick , " "timelimit