diff options
author | Tim Angus <tim@ngus.net> | 2002-08-19 20:48:38 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-08-19 20:48:38 +0000 |
commit | a394af3d268a7909ecff77c2ef277705d40b0a69 (patch) | |
tree | 2bd1fa6971e29e7fc5f4d160c2d1e1ae753ea4d1 | |
parent | e1bbd6301551617a972d9f63714a1ac785d71970 (diff) |
* Slowblob implemented (WP_POUNCE_UPG)
* Generalised starting weapon mechanism
* Alien booster restores ammo and a 30 second delay
-rw-r--r-- | src/game/bg_misc.c | 33 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 16 | ||||
-rw-r--r-- | src/game/bg_public.h | 57 | ||||
-rw-r--r-- | src/game/g_buildable.c | 17 | ||||
-rw-r--r-- | src/game/g_client.c | 84 |
5 files changed, 102 insertions, 105 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 1946712f..cc97f387 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1294,6 +1294,7 @@ classAttributes_t bg_classList[ ] = 50, //int health; 5, //int regenRate; SCA_TAKESFALLDAMAGE|SCA_FOVWARPS, //int abilities; + WP_ABUILD, //weapon_t startWeapon 95.0f, //float buildDist; 80, //int fov; 0.001f, //float bob; @@ -1321,6 +1322,7 @@ classAttributes_t bg_classList[ ] = 75, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_FOVWARPS|SCA_WALLCLIMBER, //int abilities; + WP_ABUILD2, //weapon_t startWeapon 95.0f, //float buildDist; 110, //int fov; 0.001f, //float bob; @@ -1348,6 +1350,7 @@ classAttributes_t bg_classList[ ] = 25, //int health; 5, //int regenRate; SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS|SCA_ALIENSENSE, //int abilities; + WP_VENOM, //weapon_t startWeapon 0.0f, //float buildDist; 140, //int fov; 0.0f, //float bob; @@ -1375,6 +1378,7 @@ classAttributes_t bg_classList[ ] = 50, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_GRAB_CLAW, //weapon_t startWeapon 0.0f, //float buildDist; 120, //int fov; 0.001f, //float bob; @@ -1402,6 +1406,7 @@ classAttributes_t bg_classList[ ] = 50, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_GRAB_CLAW, //weapon_t startWeapon 0.0f, //float buildDist; 120, //int fov; 0.001f, //float bob; @@ -1429,6 +1434,7 @@ classAttributes_t bg_classList[ ] = 50, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_POUNCE, //weapon_t startWeapon 0.0f, //float buildDist; 120, //int fov; 0.0005f, //float bob; @@ -1456,6 +1462,7 @@ classAttributes_t bg_classList[ ] = 50, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_POUNCE_UPG, //weapon_t startWeapon 0.0f, //float buildDist; 120, //int fov; 0.0005f, //float bob; @@ -1483,6 +1490,7 @@ classAttributes_t bg_classList[ ] = 100, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_AREA_ZAP, //weapon_t startWeapon 0.0f, //float buildDist; 130, //int fov; 0.0f, //float bob; @@ -1510,6 +1518,7 @@ classAttributes_t bg_classList[ ] = 100, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_DIRECT_ZAP, //weapon_t startWeapon 0.0f, //float buildDist; 130, //int fov; 0.0f, //float bob; @@ -1537,6 +1546,7 @@ classAttributes_t bg_classList[ ] = 100, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + WP_VENOM, //weapon_t startWeapon 0.0f, //float buildDist; 130, //int fov; 0.0f, //float bob; @@ -1564,6 +1574,7 @@ classAttributes_t bg_classList[ ] = 100, //int health; 0, //int regenRate; SCA_TAKESFALLDAMAGE|SCA_CANJUMP, //int abilities; + WP_NONE, //special-cased in g_client.c //weapon_t startWeapon 110.0f, //float buildDist; 90, //int fov; 0.002f, //float bob; @@ -1959,6 +1970,26 @@ qboolean BG_ClassHasAbility( int pclass, int ability ) /* ============== +BG_FindStartWeaponForClass +============== +*/ +weapon_t BG_FindStartWeaponForClass( int pclass ) +{ + int i; + + for( i = 0; i < bg_numPclasses; i++ ) + { + if( bg_classList[ i ].classNum == pclass ) + { + return bg_classList[ i ].startWeapon; + } + } + + return WP_NONE; +} + +/* +============== BG_FindBuildDistForClass ============== */ @@ -2460,7 +2491,7 @@ weaponAttributes_t bg_weapons[ ] = "Claw and pounce (upgrade)", //char *weaponHumanName; { "models/weapons2/gauntlet/gauntlet.md3", 0, 0, 0 }, "icons/iconw_gauntlet", - 0, //int quan; + 3, //int quan; 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 2a472cdc..7c948e91 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2325,7 +2325,17 @@ static void PM_Weapon( void ) if( attack3 ) { if( BG_WeaponHasThirdMode( pm->ps->weapon ) ) + { + //hacky special case for slowblob + if( pm->ps->weapon == WP_POUNCE_UPG && !ammo ) + { + PM_AddEvent( EV_NOAMMO ); + pm->ps->weaponTime += 200; + return; + } + PM_AddEvent( EV_FIRE_WEAPON3 ); + } else { pm->ps->weaponTime = 0; @@ -2392,6 +2402,12 @@ static void PM_Weapon( void ) BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); } + else if( pm->ps->weapon == WP_POUNCE_UPG && attack3 ) + { + //special case for slowblob + ammo--; + BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + } addTime = BG_FindRepeatRateForWeapon( pm->ps->weapon ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ec6282d3..ab3a1a61 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -847,43 +847,45 @@ typedef struct gitem_s { //TA: player class record typedef struct { - int classNum; + int classNum; - char *className; - char *humanName; + char *className; + char *humanName; - char *modelName; - char *skinName; + char *modelName; + char *skinName; - char *hudName; + char *hudName; - int stages; + int stages; - vec3_t mins; - vec3_t maxs; - vec3_t crouchMaxs; - vec3_t deadMins; - vec3_t deadMaxs; + vec3_t mins; + vec3_t maxs; + vec3_t crouchMaxs; + vec3_t deadMins; + vec3_t deadMaxs; - int viewheight; - int crouchViewheight; + int viewheight; + int crouchViewheight; + + int health; + int regenRate; - int health; - int regenRate; + int abilities; - int abilities; + weapon_t startWeapon; - float buildDist; + float buildDist; - int fov; - float bob; - int steptime; - float speed; - float sticky; - - int children[ 3 ]; - int timeToEvolve; - int value; + int fov; + float bob; + int steptime; + float speed; + float sticky; + + int children[ 3 ]; + int timeToEvolve; + int value; } classAttributes_t; //stages @@ -1064,6 +1066,7 @@ float BG_FindSpeedForClass( int pclass ); float BG_FindStickyForClass( int pclass ); int BG_FindSteptimeForClass( int pclass ); qboolean BG_ClassHasAbility( int pclass, int ability ); +weapon_t BG_FindStartWeaponForClass( int pclass ); float BG_FindBuildDistForClass( int pclass ); int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num ); int BG_FindEvolveTimeForClass( int pclass ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index b636c650..73cc59ee 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -839,10 +839,21 @@ Called when an alien touches a booster */ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) { - if( !( other->client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) ) + int ammo, clips, maxClips; + gclient_t *client = other->client; + + //only allow boostage once every 30 seconds + if( client->lastBoostedTime + 30000 > level.time ) + 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 ); + + if( !( client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) ) { - other->client->ps.stats[ STAT_STATE ] |= SS_BOOSTED; - other->client->lastBoostedTime = level.time; + client->ps.stats[ STAT_STATE ] |= SS_BOOSTED; + client->lastBoostedTime = level.time; } } diff --git a/src/game/g_client.c b/src/game/g_client.c index 7e28ca62..ac5329fa 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1294,6 +1294,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) int eventSequence; char userinfo[MAX_INFO_STRING]; vec3_t bodyMaxs, classMins, up = { 0, 0, 1 }; + int ammo, clips, maxClips; + weapon_t weapon; index = ent - g_entities; @@ -1436,80 +1438,14 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] = BG_FindHealthForClass( ent->client->pers.pclass ); // clear entity values - switch( ent->client->pers.pclass ) - { - case PCL_A_B_BASE: - BG_packWeapon( WP_ABUILD, client->ps.stats ); - BG_packAmmoArray( WP_ABUILD, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_B_LEV1: - BG_packWeapon( WP_ABUILD2, client->ps.stats ); - BG_packAmmoArray( WP_ABUILD2, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_BASE: - BG_packWeapon( WP_VENOM, client->ps.stats ); - BG_packAmmoArray( WP_VENOM, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV1: - BG_packWeapon( WP_GRAB_CLAW, client->ps.stats ); - BG_packAmmoArray( WP_GRAB_CLAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV1_UPG: - BG_packWeapon( WP_GRAB_CLAW, client->ps.stats ); - BG_packAmmoArray( WP_GRAB_CLAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV2: - BG_packWeapon( WP_POUNCE, client->ps.stats ); - BG_packAmmoArray( WP_POUNCE, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV2_UPG: - BG_packWeapon( WP_POUNCE_UPG, client->ps.stats ); - BG_packAmmoArray( WP_POUNCE_UPG, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV3: - BG_packWeapon( WP_AREA_ZAP, client->ps.stats ); - BG_packAmmoArray( WP_AREA_ZAP, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV3_UPG: - BG_packWeapon( WP_DIRECT_ZAP, client->ps.stats ); - BG_packAmmoArray( WP_DIRECT_ZAP, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_A_O_LEV4: - BG_packWeapon( WP_VENOM, client->ps.stats ); - BG_packAmmoArray( WP_VENOM, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - break; - - case PCL_H_BASE: - if( client->pers.pitem == WP_MACHINEGUN ) - { - int ammo, clips, maxClips; - - BG_FindAmmoForWeapon( WP_MACHINEGUN, &ammo, &clips, &maxClips ); - - BG_packWeapon( WP_MACHINEGUN, client->ps.stats ); - BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); - } - else if( client->pers.pitem == WP_HBUILD ) - { - BG_packWeapon( WP_HBUILD, client->ps.stats ); - BG_packAmmoArray( WP_HBUILD, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); - } - break; - - //eventually remove this case (or report an error) when all classes implemented - default: - BG_packWeapon( WP_MACHINEGUN, client->ps.stats ); - BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, 100, 0, 0 ); - } + if( ent->client->pers.pclass == PCL_H_BASE ) + weapon = client->pers.pitem; + else + weapon = BG_FindStartWeaponForClass( ent->client->pers.pclass ); + + BG_FindAmmoForWeapon( weapon, &ammo, &clips, &maxClips ); + BG_packWeapon( weapon, client->ps.stats ); + BG_packAmmoArray( weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.pclass; ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.pteam; |