diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-06-26 01:29:00 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-06-26 01:29:00 +0200 |
commit | b28d5f6dbedd5b895eed4cc5b730581df3b2215d (patch) | |
tree | 9bb750d3f30ff731ce2c60f6a845fff25f20b668 /src/game | |
parent | 6c7152aada204bfdfa6e39cdfea5e10440e0ed36 (diff) |
Initial implementation of Wraith.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 2 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 86 | ||||
-rw-r--r-- | src/game/bg_public.h | 7 | ||||
-rw-r--r-- | src/game/g_active.c | 43 | ||||
-rw-r--r-- | src/game/g_client.c | 5 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/tremulous.h | 6 |
7 files changed, 146 insertions, 5 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 33d4138..bd498c6 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3024,7 +3024,7 @@ static const weaponAttributes_t bg_weapons[ ] = "level1", //char *weaponName; "Claws", //char *humanName; "", - 1, //int maxAmmo; + 0, //int maxAmmo; 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 8ab7282..78bc15a 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -1663,7 +1663,7 @@ static void PM_CheckLadder( void ) VectorMA( pm->ps->origin, 1.0f, forward, end ); - pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, end, pm->ps->clientNum, MASK_PLAYERSOLID ); + pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, end, pm->ps->clientNum, pm->tracemask ); if( ( trace.fraction < 1.0f ) && ( trace.surfaceFlags & SURF_LADDER ) ) pml.ladder = qtrue; @@ -2625,7 +2625,8 @@ static void PM_Footsteps( void ) pm->xyspeed = sqrt( pm->ps->velocity[ 0 ] * pm->ps->velocity[ 0 ] + pm->ps->velocity[ 1 ] * pm->ps->velocity[ 1 ] ); - if( pm->ps->groundEntityNum == ENTITYNUM_NONE ) + if( pm->ps->groundEntityNum == ENTITYNUM_NONE || + ( pm->ps->eFlags & EF_WARPING ) ) { // airborne leaves position in cycle intact, but doesn't advance if( pm->waterlevel > 1 ) @@ -3836,6 +3837,82 @@ void PM_ForceFields( void ) /* ================ +PM_WraithMechanics +================ +*/ + +void PM_WraithMechanics( void ) +{ + qboolean target, force_exit; + + pm->pmext->warpExitBlocked = qfalse; + pm->pmext->warpExitedBlocked = qfalse; + + target = !!( pm->cmd.buttons & BUTTON_ATTACK2 ); + force_exit = qfalse; + + if( pm->ps->stats[ STAT_MISC ] <= 0 ) + { + target = qfalse; + force_exit = qtrue; +#ifdef GAME + //Com_Printf( "out of ammo\n" ); +#endif + } + + if( !!( pm->ps->eFlags & EF_WARPING ) == target ) + { + goto done; + } + + if( target ) + { + pm->ps->eFlags |= EF_WARPING; + PM_AddEvent( EV_WARP_ENTER ); + } + else + { + trace_t tr; + vec3_t mins, maxs; + + BG_ClassBoundingBox( PCL_ALIEN_LEVEL1, mins, maxs, NULL, NULL, NULL ); + + pm->trace( &tr, pm->ps->origin, mins, maxs, pm->ps->origin, pm->ps->clientNum, MASK_PLAYERSOLID ); + + if( tr.startsolid ) + { + if( force_exit ) + { + pm->pmext->warpExitedBlocked = qtrue; + } + else + { + pm->pmext->warpExitBlocked = qtrue; + goto done; + } + } + + pm->ps->eFlags &= ~EF_WARPING; + PM_AddEvent( EV_WARP_EXIT ); + } + +done: + + if( pm->ps->eFlags & EF_WARPING ) + { + pm->tracemask = MASK_SOLID; + pm->ps->stats[ STAT_MISC ] -= pml.msec; + pm->ps->eFlags |= EF_NODRAW; + } + else + { + pm->tracemask = MASK_PLAYERSOLID; + pm->ps->eFlags &= ~EF_NODRAW; + } +} + +/* +================ PmoveSingle ================ @@ -3948,6 +4025,11 @@ void PmoveSingle( pmove_t *pmove ) pm->cmd.upmove = 0; } + if( pm->ps->weapon == WP_ALEVEL1 ) + { + PM_WraithMechanics( ); + } + if( pm->ps->pm_type == PM_SPECTATOR ) { // update the viewangles diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 8f12356..bd4d47c 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -174,6 +174,8 @@ typedef struct { int pouncePayload; float fallVelocity; + qboolean warpExitBlocked; + qboolean warpExitedBlocked; } pmoveExt_t; #define MAXTOUCH 32 @@ -321,6 +323,7 @@ typedef enum #define EF_FIRING2 0x0400 // alt fire #define EF_FIRING3 0x0800 // third fire #define EF_MOVER_STOP 0x1000 // will push otherwise +#define EF_WARPING 0x2000 // Wraith warping #define EF_CONNECTION 0x4000 // draw a connection trouble sprite typedef enum @@ -568,7 +571,9 @@ typedef enum EV_RPTUSE_SOUND, // trigger a sound EV_LEV2_ZAP, EV_ACIDBOMB_BOUNCE, - EV_ROCKETL_PRIME + EV_ROCKETL_PRIME, + EV_WARP_ENTER, + EV_WARP_EXIT } entity_event_t; typedef enum diff --git a/src/game/g_active.c b/src/game/g_active.c index b15c5a5..cac7e7f 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1669,6 +1669,17 @@ void ClientThink_real( gentity_t *ent ) } } + if( client->ps.weapon == WP_ALEVEL1 && + client->lastWarpTime + LEVEL1_WARP_REGEN_DELAY <= level.time ) + { + client->ps.stats[ STAT_MISC ] += msec * LEVEL1_WARP_REGEN_RATE; + + if( client->ps.stats[ STAT_MISC ] > LEVEL1_WARP_TIME ) + { + client->ps.stats[ STAT_MISC ] = LEVEL1_WARP_TIME; + } + } + if( BG_InventoryContainsUpgrade( UP_GRENADE, client->ps.stats ) && BG_UpgradeIsActive( UP_GRENADE, client->ps.stats ) ) { @@ -1801,6 +1812,38 @@ void ClientThink_real( gentity_t *ent ) } break; + case WP_ALEVEL1: + if( pm.pmext->warpExitedBlocked ) + { + G_Damage( ent, NULL, ent, NULL, NULL, 10000, DAMAGE_NO_KNOCKBACK, MOD_CRUSH ); + } + else + { + int old_contents; + + old_contents = ent->r.contents; + + if( ent->s.eFlags & EF_WARPING ) + { + ent->r.contents = 0; + ent->clipmask = 0; + ent->flags |= FL_NOTARGET; + ent->client->lastWarpTime = level.time; + } + else + { + ent->r.contents = CONTENTS_BODY; + ent->clipmask = MASK_PLAYERSOLID; + ent->flags &= ~FL_NOTARGET; + } + + if( ent->r.contents != old_contents ) + { + trap_LinkEntity( ent ); + } + } + break; + case WP_ALEVEL3: case WP_ALEVEL3_UPG: if( !CheckPounceAttack( ent ) ) diff --git a/src/game/g_client.c b/src/game/g_client.c index 9c999de..ccf65e8 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1480,6 +1480,11 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles client->ps.ammo = maxAmmo; client->ps.clips = maxClips; + if( weapon == WP_ALEVEL1 ) + { + client->ps.stats[ STAT_MISC ] = LEVEL1_WARP_TIME; + } + // We just spawned, not changing weapons client->ps.persistant[ PERS_NEWWEAPON ] = 0; diff --git a/src/game/g_local.h b/src/game/g_local.h index fad91ee..c11df7c 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -507,6 +507,8 @@ struct gclient_s g_damageIndicator_t diBuffer[ MAX_BUFFERED_DAMAGE_INDICATORS ]; int diBufferCounter; + + int lastWarpTime; }; diff --git a/src/game/tremulous.h b/src/game/tremulous.h index f548b58..92bf74e 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -125,7 +125,7 @@ TREMULOUS EDGE MOD SRC FILE #define LEVEL0_BITE_REPEAT 500 #define LEVEL0_BITE_K_SCALE 1.0f -//Basilik +//Wraith #define LEVEL1_SPEED 1.25f #define LEVEL1_VALUE AVM(270) #define LEVEL1_HEALTH AHM(60) @@ -139,6 +139,10 @@ TREMULOUS EDGE MOD SRC FILE #define LEVEL1_CLAW_REPEAT 600 #define LEVEL1_CLAW_K_SCALE 1.0f +#define LEVEL1_WARP_TIME 5000 +#define LEVEL1_WARP_REGEN_DELAY 2000 +#define LEVEL1_WARP_REGEN_RATE 1 + //Marauder #define LEVEL2_SPEED 1.2f #define LEVEL2_VALUE AVM(420) |