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/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 +++++++------- 19 files changed, 1101 insertions(+), 508 deletions(-) (limited to 'src/game') 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