summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-06-26 01:29:00 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-06-26 01:29:00 +0200
commitb28d5f6dbedd5b895eed4cc5b730581df3b2215d (patch)
tree9bb750d3f30ff731ce2c60f6a845fff25f20b668
parent6c7152aada204bfdfa6e39cdfea5e10440e0ed36 (diff)
Initial implementation of Wraith.
-rw-r--r--assets/gfx/level1/warpOverlay.jpgbin0 -> 308 bytes
-rw-r--r--assets/gfx/level1/warpOverlay2.jpgbin0 -> 9251 bytes
-rw-r--r--assets/gfx/level1/warpOverlayBlocked.jpgbin0 -> 7842 bytes
-rw-r--r--assets/gfx/level1/warpParticle1.jpgbin0 -> 8102 bytes
-rw-r--r--assets/scripts/aw_level1.particle51
-rw-r--r--assets/scripts/aw_level1.shader27
-rw-r--r--assets/sound/player/level1/LICENSE3
-rw-r--r--assets/sound/player/level1/warp1.wavbin0 -> 169696 bytes
-rw-r--r--assets/sound/player/level1/warp2.wavbin0 -> 189412 bytes
-rw-r--r--assets/sound/player/level1/warping-old1.wavbin0 -> 609796 bytes
-rw-r--r--assets/sound/player/level1/warping.wavbin0 -> 609796 bytes
-rw-r--r--src/cgame/cg_draw.c28
-rw-r--r--src/cgame/cg_event.c32
-rw-r--r--src/cgame/cg_local.h10
-rw-r--r--src/cgame/cg_main.c9
-rw-r--r--src/cgame/cg_players.c4
-rw-r--r--src/cgame/cg_predict.c2
-rw-r--r--src/cgame/cg_weapons.c7
-rw-r--r--src/game/bg_misc.c2
-rw-r--r--src/game/bg_pmove.c86
-rw-r--r--src/game/bg_public.h7
-rw-r--r--src/game/g_active.c43
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/tremulous.h6
25 files changed, 318 insertions, 6 deletions
diff --git a/assets/gfx/level1/warpOverlay.jpg b/assets/gfx/level1/warpOverlay.jpg
new file mode 100644
index 0000000..02b1b6b
--- /dev/null
+++ b/assets/gfx/level1/warpOverlay.jpg
Binary files differ
diff --git a/assets/gfx/level1/warpOverlay2.jpg b/assets/gfx/level1/warpOverlay2.jpg
new file mode 100644
index 0000000..702489c
--- /dev/null
+++ b/assets/gfx/level1/warpOverlay2.jpg
Binary files differ
diff --git a/assets/gfx/level1/warpOverlayBlocked.jpg b/assets/gfx/level1/warpOverlayBlocked.jpg
new file mode 100644
index 0000000..cc41910
--- /dev/null
+++ b/assets/gfx/level1/warpOverlayBlocked.jpg
Binary files differ
diff --git a/assets/gfx/level1/warpParticle1.jpg b/assets/gfx/level1/warpParticle1.jpg
new file mode 100644
index 0000000..8bf70eb
--- /dev/null
+++ b/assets/gfx/level1/warpParticle1.jpg
Binary files differ
diff --git a/assets/scripts/aw_level1.particle b/assets/scripts/aw_level1.particle
new file mode 100644
index 0000000..5a230a2
--- /dev/null
+++ b/assets/scripts/aw_level1.particle
@@ -0,0 +1,51 @@
+gfx/level1/warpEnterPS
+{
+ ejector
+ {
+ particle
+ {
+ shader sync gfx/level1/warpParticle1
+ displacement 0 0 0 0
+
+ velocityType static
+ velocityDir linear
+ velocityMagnitude 0
+ velocity 0 0 1 0
+
+ radius 0 100 0
+ alpha 0 1.0 -
+
+ lifeTime 100
+ }
+
+ count 1
+ delay 0
+ period 0 - 0
+ }
+}
+
+gfx/level1/warpExitPS
+{
+ ejector
+ {
+ particle
+ {
+ shader sync gfx/level1/warpParticle1
+ displacement 0 0 0 0
+
+ velocityType static
+ velocityDir linear
+ velocityMagnitude 0
+ velocity 0 0 1 0
+
+ radius 0 100 0
+ alpha 0 1.0 -
+
+ lifeTime 100
+ }
+
+ count 1
+ delay 0
+ period 0 - 0
+ }
+}
diff --git a/assets/scripts/aw_level1.shader b/assets/scripts/aw_level1.shader
new file mode 100644
index 0000000..951c4c0
--- /dev/null
+++ b/assets/scripts/aw_level1.shader
@@ -0,0 +1,27 @@
+gfx/level1/warpOverlay
+{
+ {
+ map gfx/level1/warpOverlay.jpg
+ blendFunc GL_ONE_MINUS_DST_COLOR GL_ONE_MINUS_SRC_COLOR
+ }
+ {
+ map gfx/level1/warpOverlay2.jpg
+ blendFunc filter
+ }
+}
+
+gfx/level1/warpOverlayBlocked
+{
+ {
+ map gfx/level1/warpOverlayBlocked.jpg
+ blendFunc filter
+ }
+}
+
+gfx/level1/warpParticle1
+{
+ {
+ map gfx/level1/warpParticle1.jpg
+ blendFunc add
+ }
+}
diff --git a/assets/sound/player/level1/LICENSE b/assets/sound/player/level1/LICENSE
new file mode 100644
index 0000000..c870b2a
--- /dev/null
+++ b/assets/sound/player/level1/LICENSE
@@ -0,0 +1,3 @@
+warp1.wav and warp2.wav are derivative works of sounds made by Little Robot Sound Factory, released under the terms of Creative Commons Attribution 3.0.
+
+warping.wav is a derivative work of a sound made by Jaredd Gibb, released into the public domain.
diff --git a/assets/sound/player/level1/warp1.wav b/assets/sound/player/level1/warp1.wav
new file mode 100644
index 0000000..067c1c1
--- /dev/null
+++ b/assets/sound/player/level1/warp1.wav
Binary files differ
diff --git a/assets/sound/player/level1/warp2.wav b/assets/sound/player/level1/warp2.wav
new file mode 100644
index 0000000..ee4dbe2
--- /dev/null
+++ b/assets/sound/player/level1/warp2.wav
Binary files differ
diff --git a/assets/sound/player/level1/warping-old1.wav b/assets/sound/player/level1/warping-old1.wav
new file mode 100644
index 0000000..b02cda9
--- /dev/null
+++ b/assets/sound/player/level1/warping-old1.wav
Binary files differ
diff --git a/assets/sound/player/level1/warping.wav b/assets/sound/player/level1/warping.wav
new file mode 100644
index 0000000..f12b62c
--- /dev/null
+++ b/assets/sound/player/level1/warping.wav
Binary files differ
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 754b446..4782c00 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1101,6 +1101,11 @@ static float CG_ChargeProgress( void )
max = LEVEL4_TRAMPLE_CHARGE_MAX;
}
}
+ else if( cg.snap->ps.weapon == WP_ALEVEL1 )
+ {
+ min = 0;
+ max = LEVEL1_WARP_TIME;
+ }
else if( cg.snap->ps.weapon == WP_LUCIFER_CANNON || cg.snap->ps.weapon == WP_FLAMER )
{
@@ -4131,6 +4136,27 @@ static void CG_DrawHealthBars( void )
}
}
+/*
+=================
+CG_DrawWarpOverlay
+=================
+*/
+static void CG_DrawWarpOverlay( void )
+{
+ if( !( cg.predictedPlayerEntity.currentState.eFlags & EF_WARPING ) ||
+ cg.renderingThirdPerson )
+ {
+ return;
+ }
+
+ trap_R_SetColor( NULL );
+ CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlay );
+
+ if( cg.warpExitBlocked )
+ {
+ CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlayBlocked );
+ }
+}
//==================================================================================
@@ -4154,6 +4180,8 @@ static void CG_Draw2D( void )
// (only 2D that can't be disabled)
CG_DrawLighting( );
+ CG_DrawWarpOverlay( );
+
if( cg_draw2D.integer == 0 )
return;
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 436e819..2ff1520 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -976,6 +976,38 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.rocketlPrimeSound );
break;
+ case EV_WARP_ENTER:
+ {
+ particleSystem_t *ps;
+
+ ps = CG_SpawnNewParticleSystem( cgs.media.warpEnterPS );
+
+ if( CG_IsParticleSystemValid( &ps ) )
+ {
+ CG_SetAttachmentPoint( &ps->attachment, position );
+ CG_AttachToPoint( &ps->attachment );
+ }
+
+ trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.warpEnterSound );
+ }
+ break;
+
+ case EV_WARP_EXIT:
+ {
+ particleSystem_t *ps;
+
+ ps = CG_SpawnNewParticleSystem( cgs.media.warpExitPS );
+
+ if( CG_IsParticleSystemValid( &ps ) )
+ {
+ CG_SetAttachmentPoint( &ps->attachment, position );
+ CG_AttachToPoint( &ps->attachment );
+ }
+
+ trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.warpExitSound );
+ }
+ break;
+
//
// missile impacts
//
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 2233414..9a4793c 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1161,6 +1161,8 @@ typedef struct
int nextWeaponClickTime;
float viewQuake;
+
+ qboolean warpExitBlocked;
} cg_t;
@@ -1351,6 +1353,14 @@ typedef struct
sfxHandle_t hitSounds[ 5 ];
sfxHandle_t rocketlPrimeSound;
+
+ sfxHandle_t warpEnterSound;
+ qhandle_t warpEnterPS;
+ sfxHandle_t warpExitSound;
+ qhandle_t warpExitPS;
+ sfxHandle_t warpingSound;
+ qhandle_t warpOverlay;
+ qhandle_t warpOverlayBlocked;
} cgMedia_t;
typedef struct
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index c3f45dd..c224171 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -769,6 +769,10 @@ static void CG_RegisterSounds( void )
cgs.media.hitSounds[ i ] = trap_S_RegisterSound( hit_sounds[ i ], qfalse );
cgs.media.rocketlPrimeSound = trap_S_RegisterSound( "models/weapons/rocketl/prime.wav", qfalse );
+
+ cgs.media.warpEnterSound = trap_S_RegisterSound( "sound/player/level1/warp1.wav", qfalse );
+ cgs.media.warpExitSound = trap_S_RegisterSound( "sound/player/level1/warp2.wav", qfalse );
+ cgs.media.warpingSound = trap_S_RegisterSound( "sound/player/level1/warping.wav", qfalse );
}
@@ -930,6 +934,11 @@ static void CG_RegisterGraphics( void )
cgs.media.lightningImpactPS = CG_RegisterParticleSystem( "models/weapons/lightning/impactPS" );
+ cgs.media.warpEnterPS = CG_RegisterParticleSystem( "gfx/level1/warpEnterPS" );
+ cgs.media.warpExitPS = CG_RegisterParticleSystem( "gfx/level1/warpExitPS" );
+ cgs.media.warpOverlay = trap_R_RegisterShader( "gfx/level1/warpOverlay" );
+ cgs.media.warpOverlayBlocked = trap_R_RegisterShader( "gfx/level1/warpOverlayBlocked" );
+
CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat );
CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat );
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 8cb5e17..e0bb622 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -1964,7 +1964,9 @@ void CG_Player( centity_t *cent )
// add the shadow
if( ( es->number == cg.snap->ps.clientNum && cg.renderingThirdPerson ) ||
es->number != cg.snap->ps.clientNum )
- shadow = CG_PlayerShadow( cent, &shadowPlane, class );
+ {
+ shadow = CG_PlayerShadow( cent, &shadowPlane, class );
+ }
// add a water splash if partially in and out of water
CG_PlayerSplash( cent, class );
diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c
index bba333c..aa62e4d 100644
--- a/src/cgame/cg_predict.c
+++ b/src/cgame/cg_predict.c
@@ -910,6 +910,8 @@ void CG_PredictPlayerState( void )
cg.physicsTime, cg.time, cg.predictedPlayerState.origin );
+ cg.warpExitBlocked = cg.pmext.warpExitBlocked;
+
// fire events and other transition triggered things
CG_TransitionPlayerState( &cg.predictedPlayerState, &oldPlayerState );
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 520d40a..69b8b90 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -1131,6 +1131,13 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
CG_DestroyParticleSystem( &cent->muzzlePS );
}
+
+ if( ps && ( cent->currentState.eFlags & EF_WARPING ) )
+ {
+ trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin,
+ vec3_origin, cgs.media.warpingSound );
+ }
+
// add the flash
if( !weapon->wim[ weaponMode ].continuousFlash || !firing )
{
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)