diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 56 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 28 | ||||
-rw-r--r-- | src/game/bg_public.h | 27 | ||||
-rw-r--r-- | src/game/g_active.c | 59 | ||||
-rw-r--r-- | src/game/g_cmds.c | 24 | ||||
-rw-r--r-- | src/game/g_local.h | 4 | ||||
-rw-r--r-- | src/game/g_misc.c | 18 | ||||
-rw-r--r-- | src/game/g_weapon.c | 112 |
8 files changed, 195 insertions, 133 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 43f01c44..eaffd383 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1556,7 +1556,7 @@ classAttributes_t bg_classList[ ] = 100, //int health; 5, //int regenRate; SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; - WP_VENOM, //weapon_t startWeapon + WP_GROUND_POUND, //weapon_t startWeapon 0.0f, //float buildDist; 130, //int fov; 0.0f, //float bob; @@ -1730,7 +1730,7 @@ char *BG_FindHudNameForClass( int pclass ) return bg_classList[ i ].hudName; } - //note: must return a valid modelName! + //note: must return a valid hudName! return bg_classList[ 0 ].hudName; } @@ -2541,6 +2541,28 @@ weaponAttributes_t bg_weapons[ ] = WUT_ALIENS //WUTeam_t team; }, { + WP_GROUND_POUND, //int weaponNum; + 100, //int price; + ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages + SLOT_WEAPON, //int slots; + "groundpound", //char *weaponName; + "Ground Pound", //char *weaponHumanName; + { "models/weapons2/gauntlet/gauntlet.md3", 0, 0, 0 }, + "icons/iconw_gauntlet", + 0, //int quan; + 0, //int clips; + 0, //int maxClips; + qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; + 750, //int repeatRate; + 0, //int reloadTime; + qtrue, //qboolean hasAltMode; + qtrue, //qboolean hasThirdMode; + qfalse, //qboolean purchasable; + 0, //int buildDelay; + WUT_ALIENS //WUTeam_t team; + }, + { WP_LOCKBLOB_LAUNCHER, //int weaponNum; 100, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -2979,32 +3001,6 @@ WUTeam_t BG_FindTeamForWeapon( int weapon ) upgradeAttributes_t bg_upgrades[ ] = { { - UP_TORCH, //int upgradeNum; - 100, //int price; - ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages - SLOT_NONE, //int slots; - "torch", //char *upgradeName; - "Torch", //char *upgradeHumanName; - "icons/iconw_machinegun", - WP_NONE, //weapon_t weaponAmmo; - 0, //int ammo; - 0, //int clips; - WUT_HUMANS //WUTeam_t team; - }, - { - UP_NVG, //int upgradeNum; - 100, //int price; - ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages - SLOT_HEAD, //int slots; - "nvg", //char *upgradeName; - "NVG", //char *upgradeHumanName; - "icons/iconw_plasma", - WP_NONE, //weapon_t weaponAmmo; - 0, //int ammo; - 0, //int clips; - WUT_HUMANS //WUTeam_t team; - }, - { UP_CHESTARMOUR, //int upgradeNum; 100, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -3551,7 +3547,9 @@ char *eventnames[] = { "EV_TAUNT_PATROL", "EV_MENU", //TA: menu event - "EV_POISONCLOUD" //TA: client poisoned + "EV_POISONCLOUD", //TA: client poisoned + "EV_KNOCKOVER" //TA: client knocked over + "EV_GETUP" //TA: client getting up }; /* diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 0539294e..f3158199 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -329,7 +329,7 @@ static float PM_CmdScale( usercmd_t *cmd ) { modifier *= (float)( pm->ps->stats[ STAT_STAMINA ] + 1000 ) / 500.0f; } - if( pm->ps->pm_type == PM_GRABBED ) + if( pm->ps->pm_type == PM_GRABBED || pm->ps->pm_type == PM_KNOCKED ) modifier = 0.0f; if( !BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_CANJUMP ) ) @@ -463,7 +463,7 @@ static qboolean PM_CheckJump( void ) } //can't jump whilst grabbed - if( pm->ps->pm_type == PM_GRABBED ) + if( pm->ps->pm_type == PM_GRABBED && pm->ps->pm_type == PM_KNOCKED ) { pm->cmd.upmove = 0; return qfalse; @@ -2152,6 +2152,9 @@ static void PM_Weapon( void ) if( pm->ps->stats[ STAT_STATE ] & SS_HOVELING ) return; + if( pm->ps->stats[ STAT_STATE ] & SS_KNOCKEDOVER ) + return; + // check for dead player if ( pm->ps->stats[STAT_HEALTH] <= 0 ) { @@ -2561,6 +2564,25 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) ps->delta_angles[ i ] -= ANGLE2SHORT( fabs( diff ) * 0.05f ); } } + + //fiz the view to the lock point + if( ps->pm_type == PM_KNOCKED ) + { + for( i = 0; i < 3; i++ ) + { + float diff = AngleSubtract( ps->viewangles[ i ], ps->grapplePoint[ i ] ); + + while( diff > 180.0f ) + diff -= 360.0f; + while( diff < -180.0f ) + diff += 360.0f; + + if( diff < 0 ) + ps->delta_angles[ i ] += ANGLE2SHORT( fabs( diff ) ); + else if( diff > 0 ) + ps->delta_angles[ i ] -= ANGLE2SHORT( fabs( diff ) ); + } + } } @@ -2714,7 +2736,7 @@ void PmoveSingle (pmove_t *pmove) // update the viewangles PM_UpdateViewAngles( pm->ps, &pm->cmd ); - if ( pm->ps->pm_type == PM_DEAD || pm->ps->pm_type == PM_GRABBED ) + if ( pm->ps->pm_type == PM_DEAD || pm->ps->pm_type == PM_GRABBED || pm->ps->pm_type == PM_KNOCKED ) PM_DeadMove( ); PM_DropTimers( ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 393d278d..2fd58deb 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -50,6 +50,8 @@ #define LC_CHARGE_TIME 2000.0f #define PCLOUD_TIME 10000 +#define KOVER_TIME 2000 +#define GETUP_TIME 1000 // // config strings are a general means of communicating variable length strings @@ -137,6 +139,7 @@ typedef enum { PM_GRABBED, // like dead, but for when the player is still live PM_DEAD, // no acceleration or turning, but free falling PM_FREEZE, // stuck in place with no control + PM_KNOCKED, // knocked over PM_INTERMISSION, // no movement or status bar PM_SPINTERMISSION // no movement or status bar } pmtype_t; @@ -251,6 +254,8 @@ typedef enum { #define SS_BOOSTED 0x00000200 #define SS_SLOWLOCKED 0x00000400 #define SS_POISONCLOUDED 0x00000800 +#define SS_KNOCKEDOVER 0x00001000 +#define SS_GETTINGUP 0x00002000 #define SB_VALID_TOGGLEBIT 0x00004000 @@ -333,12 +338,6 @@ typedef enum { WP_NONE, - WP_MACHINEGUN, - WP_CHAINGUN, - WP_LOCKBLOB_LAUNCHER, - WP_TESLAGEN, - WP_FLAMER, - WP_PLASMAGUN, WP_VENOM, WP_GRAB_CLAW, WP_GRAB_CLAW_UPG, @@ -346,12 +345,21 @@ typedef enum WP_POUNCE_UPG, WP_AREA_ZAP, WP_DIRECT_ZAP, + WP_GROUND_POUND, + + WP_MACHINEGUN, + WP_CHAINGUN, + WP_FLAMER, + WP_PLASMAGUN, WP_MASS_DRIVER, WP_PULSE_RIFLE, WP_LUCIFER_CANON, WP_LAS_GUN, WP_PAIN_SAW, + WP_LOCKBLOB_LAUNCHER, + WP_TESLAGEN, + //build weapons must remain in a block WP_ABUILD, WP_ABUILD2, @@ -366,8 +374,6 @@ typedef enum { UP_NONE, - UP_TORCH, - UP_NVG, UP_CHESTARMOUR, UP_LIMBARMOUR, UP_HELMET, @@ -587,7 +593,9 @@ typedef enum { EV_MENU, //TA: menu event EV_BUILD_DELAY, //TA: can't build yet - EV_POISONCLOUD //TA: client poisoned + EV_POISONCLOUD, //TA: client poisoned + EV_KNOCKOVER, //TA: client knocked over + EV_GETUP //TA: client getting up } entity_event_t; typedef enum @@ -1143,7 +1151,6 @@ typedef enum { ET_INVISIBLE, ET_GRAPPLE, // grapple hooked on wall - ET_TORCH, //TA: torch type ET_CORPSE, ET_SPRITER, ET_ANIMMAPOBJ, diff --git a/src/game/g_active.c b/src/game/g_active.c index 934e2b78..6e6b7f1b 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -800,9 +800,6 @@ void ClientThink_real( gentity_t *ent ) { usercmd_t *ucmd; float speed; - //TA: torch - gentity_t *light; - //TA: creep variables gentity_t *creepNode; vec3_t temp_v; @@ -884,6 +881,9 @@ void ClientThink_real( gentity_t *ent ) { else if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED || client->ps.stats[ STAT_STATE ] & SS_GRABBED ) client->ps.pm_type = PM_GRABBED; + else if( client->ps.stats[ STAT_STATE ] & SS_GETTINGUP || + client->ps.stats[ STAT_STATE ] & SS_KNOCKEDOVER ) + client->ps.pm_type = PM_KNOCKED; else client->ps.pm_type = PM_NORMAL; @@ -903,6 +903,29 @@ void ClientThink_real( gentity_t *ent ) { client->lastPoisonCloudedTime + PCLOUD_TIME < level.time ) client->ps.stats[ STAT_STATE ] &= ~SS_POISONCLOUDED; + if( client->ps.stats[ STAT_STATE ] & SS_KNOCKEDOVER && + client->lastKnockedOverTime + KOVER_TIME < level.time && + ucmd->upmove > 0 ) + { + client->lastGetUpTime = level.time; + G_AddPredictableEvent( ent, EV_GETUP, 0 ); + client->ps.stats[ STAT_STATE ] &= ~SS_KNOCKEDOVER; + client->ps.stats[ STAT_STATE ] |= SS_GETTINGUP; + + //FIXME: getup animation + client->ps.legsAnim = + ( ( client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH2; + client->ps.torsoAnim = + ( ( client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH2; + } + + if( client->ps.stats[ STAT_STATE ] & SS_GETTINGUP && + client->lastGetUpTime + GETUP_TIME < level.time ) + { + client->ps.stats[ STAT_STATE ] &= ~SS_GETTINGUP; + VectorCopy( ent->client->ps.grapplePoint, ent->client->ps.viewangles ); + } + client->ps.gravity = g_gravity.value; if( BG_gotItem( UP_ANTITOXIN, client->ps.stats ) && @@ -965,36 +988,6 @@ void ClientThink_real( gentity_t *ent ) { Weapon_HookFree(client->hook); }*/ - //TA: torch stuff - if( client->torch == NULL && - BG_activated( UP_TORCH, client->ps.stats ) && - BG_gotItem( UP_TORCH, client->ps.stats ) && - !( client->ps.pm_type == PM_DEAD ) - ) - { - light = G_Spawn( ); - light->s.eType = ET_TORCH; - light->r.ownerNum = ent->s.number; - light->parent = ent; - client->torch = light; - } - - if( client->torch != NULL && - ( !BG_activated( UP_TORCH, client->ps.stats ) || - client->ps.pm_type == PM_DEAD || - !BG_gotItem( UP_TORCH, client->ps.stats ) - ) - ) - { - G_FreeEntity( client->torch ); - trap_LinkEntity( client->torch ); - client->torch = NULL; - } - - - if( client->torch != NULL ) - ShineTorch( client->torch ); - // set up for pmove oldEventSequence = client->ps.eventSequence; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index ef2b5b9f..3b789207 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1525,18 +1525,6 @@ void Cmd_Stats_f( gentity_t *ent ) { } -/* -================= -Cmd_TorchOff_f -================= -*/ -void Cmd_TorchOff_f( gentity_t *ent ) -{ - G_FreeEntity( ent->client->torch ); - trap_LinkEntity( ent->client->torch ); - ent->client->torch = NULL; -} - #define NUM_AC 3 /* @@ -2454,9 +2442,15 @@ void Cmd_Spawnbody_f( gentity_t *ent ) void Cmd_Test_f( gentity_t *ent ) { - ent->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED; - ent->client->lastPoisonCloudedTime = level.time; - G_AddPredictableEvent( ent, EV_POISONCLOUD, 0 ); + ent->client->ps.stats[ STAT_STATE ] |= SS_KNOCKEDOVER; + ent->client->lastKnockedOverTime = level.time; + G_AddPredictableEvent( ent, EV_KNOCKOVER, 0 ); + VectorCopy( ent->client->ps.viewangles, ent->client->ps.grapplePoint ); + + ent->client->ps.legsAnim = + ( ( ent->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH1; + ent->client->ps.torsoAnim = + ( ( ent->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH1; } /* diff --git a/src/game/g_local.h b/src/game/g_local.h index bacf2f82..7e70f23d 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -327,8 +327,6 @@ struct gclient_s { int switchTeamTime; // time the player switched teams - gentity_t *torch; //TA: torch entity ( NULL if switched off ) - // timeResidual is used to handle events that happen every second // like health / armor countdowns and regeneration //TA: two timers, one every 100 msecs, another every sec @@ -346,6 +344,8 @@ struct gclient_s { int lastLockTime; int lastSlowTime; int lastBoostedTime; + int lastKnockedOverTime; + int lastGetUpTime; int pouncePayload; //TA: amount of damage pounce attack will do qboolean allowedToPounce; diff --git a/src/game/g_misc.c b/src/game/g_misc.c index 5fcc9ed6..3562a142 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -335,24 +335,6 @@ void SP_shooter_grenade( gentity_t *ent ) { ====================================================================== */ -//TA: position/colour/intensity calculating function -void ShineTorch( gentity_t *self ) -{ - vec3_t origin, angles; - - VectorCopy( self->parent->s.pos.trBase, origin ); - VectorCopy( self->parent->s.apos.trBase, angles ); - - G_SetOrigin( self, origin ); - - VectorCopy( angles, self->s.apos.trBase ); - - //so we can use the predicted values client side if available - self->s.clientNum = self->parent->s.number; - - trap_LinkEntity( self ); -} - //TA: use function for spriter void SP_use_spriter( gentity_t *self, gentity_t *other, gentity_t *activator ) { diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 59fe1877..fc32b16c 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -623,7 +623,6 @@ void poisonCloud( gentity_t *ent ) vec3_t mins, maxs, dir; int i, num; gentity_t *humanPlayer; - float modifier = 1.0f; VectorAdd( ent->client->ps.origin, range, maxs ); VectorSubtract( ent->client->ps.origin, range, mins ); @@ -635,9 +634,12 @@ void poisonCloud( gentity_t *ent ) if( humanPlayer->client && humanPlayer->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { - humanPlayer->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED; - humanPlayer->client->lastPoisonCloudedTime = level.time; - G_AddPredictableEvent( humanPlayer, EV_POISONCLOUD, 0 ); + if( !( humanPlayer->client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED ) ) + { + humanPlayer->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED; + humanPlayer->client->lastPoisonCloudedTime = level.time; + G_AddPredictableEvent( humanPlayer, EV_POISONCLOUD, 0 ); + } } } } @@ -863,6 +865,56 @@ void directZapFire( gentity_t *ent ) } } + +/* +====================================================================== + +GROUND POUND + +====================================================================== +*/ + +/* +=============== +groundPound +=============== +*/ +void groundPound( gentity_t *ent ) +{ + int entityList[ MAX_GENTITIES ]; + vec3_t range = { 200, 200, 200 }; + vec3_t mins, maxs, dir; + int i, num; + gentity_t *humanPlayer; + + VectorAdd( ent->client->ps.origin, range, maxs ); + VectorSubtract( ent->client->ps.origin, range, mins ); + + num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); + for( i = 0; i < num; i++ ) + { + humanPlayer = &g_entities[ entityList[ i ] ]; + + if( humanPlayer->client && humanPlayer->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + { + if( !( humanPlayer->client->ps.stats[ STAT_STATE ] & SS_KNOCKEDOVER ) ) + { + humanPlayer->client->ps.stats[ STAT_STATE ] |= SS_KNOCKEDOVER; + humanPlayer->client->lastKnockedOverTime = level.time; + G_AddPredictableEvent( humanPlayer, EV_KNOCKOVER, 0 ); + + VectorCopy( humanPlayer->client->ps.viewangles, humanPlayer->client->ps.grapplePoint ); + + //FIXME: fallover anim + humanPlayer->client->ps.legsAnim = + ( ( humanPlayer->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH1; + humanPlayer->client->ps.torsoAnim = + ( ( humanPlayer->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH1; + } + } + } +} + //====================================================================== /* @@ -907,6 +959,9 @@ void FireWeapon3( gentity_t *ent ) case WP_POUNCE_UPG: slowBlobFire( ent ); break; + case WP_GROUND_POUND: + slowBlobFire( ent ); + break; default: break; @@ -946,9 +1001,14 @@ void FireWeapon2( gentity_t *ent ) case WP_DIRECT_ZAP: areaZapFire( ent ); break; + case WP_GROUND_POUND: + groundPound( ent ); + break; + case WP_LUCIFER_CANON: LCChargeFire( ent, qtrue ); break; + case WP_ABUILD: case WP_ABUILD2: case WP_HBUILD: @@ -982,9 +1042,24 @@ void FireWeapon( gentity_t *ent ) // fire the specific weapon switch( ent->s.weapon ) { - case WP_TESLAGEN: - teslaFire( ent ); + case WP_GRAB_CLAW: + case WP_GRAB_CLAW_UPG: + meleeAttack( ent, 32.0f, 5 ); + break; + case WP_POUNCE: + case WP_POUNCE_UPG: + meleeAttack( ent, 32.0f, 50 ); + break; + case WP_AREA_ZAP: + areaZapFire( ent ); break; + case WP_DIRECT_ZAP: + directZapFire( ent ); + break; + case WP_GROUND_POUND: + meleeAttack( ent, 32.0f, 150 ); + break; + case WP_MACHINEGUN: bulletFire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); break; @@ -1003,23 +1078,6 @@ void FireWeapon( gentity_t *ent ) case WP_MASS_DRIVER: massDriverFire( ent ); break; - case WP_LOCKBLOB_LAUNCHER: - lockBlobLauncherFire( ent ); - break; - case WP_GRAB_CLAW: - case WP_GRAB_CLAW_UPG: - meleeAttack( ent, 32.0f, 5 ); - break; - case WP_POUNCE: - case WP_POUNCE_UPG: - meleeAttack( ent, 32.0f, 50 ); - break; - case WP_AREA_ZAP: - areaZapFire( ent ); - break; - case WP_DIRECT_ZAP: - directZapFire( ent ); - break; case WP_LUCIFER_CANON: LCChargeFire( ent, qfalse ); break; @@ -1029,6 +1087,14 @@ void FireWeapon( gentity_t *ent ) case WP_PAIN_SAW: painSawFire( ent ); break; + + case WP_LOCKBLOB_LAUNCHER: + lockBlobLauncherFire( ent ); + break; + case WP_TESLAGEN: + teslaFire( ent ); + break; + case WP_ABUILD: buildFire( ent, MN_A_BUILD ); break; |