From 0f6252b2cad262104b57fb28f0423dc5d216b7b2 Mon Sep 17 00:00:00 2001 From: tankefugl Date: Mon, 14 Nov 2005 20:21:06 +0000 Subject: [PATCH] - Fade blink reworked - Onos charge reworked - +attack2 git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@349 67975925-1194-0748-b3d5-c16f83f1a3a1 --- dev/3.2-movements/Balance.txt | 11 +- dev/3.2-movements/source/cl_dll/chud.h | 1 + dev/3.2-movements/source/cl_dll/hud.cpp | 2 + .../source/cl_dll/hud_redraw.cpp | 17 +- dev/3.2-movements/source/dlls/client.cpp | 14 +- dev/3.2-movements/source/dlls/ggrenade.cpp | 5 + dev/3.2-movements/source/dlls/weapons.cpp | 3 + .../source/mod/AvHBaseBuildable.cpp | 5 +- .../source/mod/AvHEntityHierarchy.cpp | 3 +- dev/3.2-movements/source/mod/AvHGamerules.cpp | 5 + dev/3.2-movements/source/mod/AvHHud.cpp | 12 ++ dev/3.2-movements/source/mod/AvHHud.h | 8 + dev/3.2-movements/source/mod/AvHHudRender.cpp | 79 ++++++++ .../source/mod/AvHMarineEquipment.cpp | 6 + .../source/mod/AvHMovementUtil.cpp | 26 +-- dev/3.2-movements/source/mod/AvHPlayer.cpp | 120 +++++++++-- dev/3.2-movements/source/mod/AvHPlayer.h | 1 + .../source/mod/AvHServerUtil.cpp | 5 +- dev/3.2-movements/source/mod/AvHSpecials.h | 3 +- .../source/pm_shared/pm_shared.cpp | 186 +++++++++++++++++- 20 files changed, 459 insertions(+), 53 deletions(-) diff --git a/dev/3.2-movements/Balance.txt b/dev/3.2-movements/Balance.txt index 08dad3ed..bc263d29 100644 --- a/dev/3.2-movements/Balance.txt +++ b/dev/3.2-movements/Balance.txt @@ -47,7 +47,7 @@ #define kCatalystDuration 8 #define kCatalystResearchCost 20 #define kCatalystResearchTime 40 -#define kChargeDamage 320 +#define kChargeDamage 20 #define kClawsDamage 90 #define kCombatBaseExperience 100 #define kCombatBaseRespawnTime 5 @@ -345,13 +345,16 @@ #define kBite2ROF 0.64 #define kBiteEnergyCost 0.05 #define kBiteROF 0.80 -#define kBlinkEnergyCost 0.04 +#define kBlinkEnergyCost 0.20 #define kBlinkROF 0.05 +#define kBlinkThresholdTime 1.00 #define kCarapaceSlowFactor 0.00 #define kCatalystDamagePercent 0.25 #define kCatalystROFFactor 0.25 #define kCatalystSpeedIncrease 0.25 -#define kChargeEnergyCost 0.07 +#define kChargeEnergyCost 0.15 +#define kChargeThresholdTime 0.50 +#define kChargeSpeed 1.00 #define kChargingEnergyScalar 2.80 #define kClawsEnergyCost 0.07 #define kClawsROF 0.90 @@ -447,7 +450,7 @@ #define kStompTime 1.00 #define kSwipeEnergyCost 0.06 #define kSwipeROF 0.95 -#define kTouchDamageInterval 0.05 +#define kTouchDamageInterval 0.30 #define kTurretBaseRateOfFire 0.70 #define kTurretTrackingRate 1.60 #define kUmbraEnergyCost 0.30 diff --git a/dev/3.2-movements/source/cl_dll/chud.h b/dev/3.2-movements/source/cl_dll/chud.h index a00779af..5b9abce7 100644 --- a/dev/3.2-movements/source/cl_dll/chud.h +++ b/dev/3.2-movements/source/cl_dll/chud.h @@ -31,6 +31,7 @@ public: int m_iRes; cvar_t *m_pCvarStealMouse; cvar_t *m_pCvarDraw; + bool m_bConserveFOV; int m_iFontHeight; int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b ); diff --git a/dev/3.2-movements/source/cl_dll/hud.cpp b/dev/3.2-movements/source/cl_dll/hud.cpp index 0056a7c4..7b5581dd 100644 --- a/dev/3.2-movements/source/cl_dll/hud.cpp +++ b/dev/3.2-movements/source/cl_dll/hud.cpp @@ -200,6 +200,8 @@ void CHud :: Init( void ) g_bDuckToggled = false; // :tankefugl + m_bConserveFOV = false; + CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 ); default_fov = CVAR_CREATE( "default_fov", "90", 0 ); m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE ); diff --git a/dev/3.2-movements/source/cl_dll/hud_redraw.cpp b/dev/3.2-movements/source/cl_dll/hud_redraw.cpp index a768562f..c310f435 100644 --- a/dev/3.2-movements/source/cl_dll/hud_redraw.cpp +++ b/dev/3.2-movements/source/cl_dll/hud_redraw.cpp @@ -53,14 +53,15 @@ void CHud::Think(void) } newfov = HUD_GetFOV(); - if ( newfov == 0 ) - { - m_iFOV = default_fov->value; - } - else - { - m_iFOV = newfov; - } + if (this->m_bConserveFOV == false) + if ( newfov == 0 ) + { + m_iFOV = default_fov->value; + } + else + { + m_iFOV = newfov; + } if(cl_forcedefaultfov->value) { diff --git a/dev/3.2-movements/source/dlls/client.cpp b/dev/3.2-movements/source/dlls/client.cpp index bbc4895e..fc4e11e2 100644 --- a/dev/3.2-movements/source/dlls/client.cpp +++ b/dev/3.2-movements/source/dlls/client.cpp @@ -2714,8 +2714,11 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h if(theCanSeeCloaked) { - theBaseOpacity = kAlienSelfCloakingBaseOpacity; - theOpacityRange = 255 - theBaseOpacity; + if (!((ent->v.iuser3 == AVH_USER3_ALIEN_PLAYER4) && (ent->v.iuser4 & MASK_ALIEN_MOVEMENT)) || host == ent) + { + theBaseOpacity = kAlienSelfCloakingBaseOpacity; + theOpacityRange = 255 - theBaseOpacity; + } } int theOpacity = theBaseOpacity + theOpacityScalar*theOpacityRange; @@ -2799,8 +2802,11 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h if(( marineGlow || (ent->v.team == theReceivingPlayer->pev->team)) && (ent != theReceivingPlayer->edict()) && (ent->v.team != 0)) { - state->rendermode = kRenderTransAdd; - state->renderamt = 150; + if (!((ent->v.iuser3 == AVH_USER3_ALIEN_PLAYER4) && (ent->v.iuser4 & MASK_ALIEN_MOVEMENT))) + { + state->rendermode = kRenderTransAdd; + state->renderamt = 150; + } } } diff --git a/dev/3.2-movements/source/dlls/ggrenade.cpp b/dev/3.2-movements/source/dlls/ggrenade.cpp index 9c8fd2e5..029d5e5d 100644 --- a/dev/3.2-movements/source/dlls/ggrenade.cpp +++ b/dev/3.2-movements/source/dlls/ggrenade.cpp @@ -279,6 +279,11 @@ void CGrenade::BounceTouch( CBaseEntity *pOther ) // don't hit the guy that launched this grenade if ( pOther->edict() == pev->owner ) return; + + // don't hit blinking dudes + bool inOtherIsBlinking = (pOther->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (pOther->pev->iuser4 & MASK_ALIEN_MOVEMENT); + if (inOtherIsBlinking) + return; // Grenades to tend to get "stuck" on sloped surfaces due to the HL physics diff --git a/dev/3.2-movements/source/dlls/weapons.cpp b/dev/3.2-movements/source/dlls/weapons.cpp index 5774bacc..d22af4e2 100644 --- a/dev/3.2-movements/source/dlls/weapons.cpp +++ b/dev/3.2-movements/source/dlls/weapons.cpp @@ -582,6 +582,9 @@ void W_Precache(void) // For grunts. Careful, this uses the same weapon id that the grenade gun uses //UTIL_PrecacheOtherWeapon("weapon_9mmAR"); + PRECACHE_UNMODIFIED_SOUND("player/metabolize_fire.wav"); + PRECACHE_UNMODIFIED_SOUND("player/metabolize_fire_reverse.wav"); + // common world objects // UTIL_PrecacheOther( "item_suit" ); // UTIL_PrecacheOther( "item_battery" ); diff --git a/dev/3.2-movements/source/mod/AvHBaseBuildable.cpp b/dev/3.2-movements/source/mod/AvHBaseBuildable.cpp index 245f94cf..9026b8e8 100644 --- a/dev/3.2-movements/source/mod/AvHBaseBuildable.cpp +++ b/dev/3.2-movements/source/mod/AvHBaseBuildable.cpp @@ -1120,8 +1120,11 @@ void AvHBaseBuildable::WorldUpdate() while(((theBaseEntity = UTIL_FindEntityInSphere(theBaseEntity, this->pev->origin, BALANCE_VAR(kElectricalRange))) != NULL) && (theNumEntsDamaged < BALANCE_VAR(kElectricalMaxTargets))) { + + bool theIsBlinking = (theBaseEntity->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (theBaseEntity->pev->iuser4 & MASK_ALIEN_MOVEMENT); + // When "electric" cheat is enabled, shock all non-self entities, else shock enemies - if((GetGameRules()->GetIsCheatEnabled(kcElectric) && (theBaseEntity != this)) || ((theBaseEntity->pev->team != this->pev->team) && theBaseEntity->IsAlive())) + if((GetGameRules()->GetIsCheatEnabled(kcElectric) && (theBaseEntity != this)) || ((theBaseEntity->pev->team != this->pev->team) && theBaseEntity->IsAlive()) && (theIsBlinking == false)) { // Make sure it's not blocked TraceResult theTraceResult; diff --git a/dev/3.2-movements/source/mod/AvHEntityHierarchy.cpp b/dev/3.2-movements/source/mod/AvHEntityHierarchy.cpp index b3978f3f..2ac55587 100644 --- a/dev/3.2-movements/source/mod/AvHEntityHierarchy.cpp +++ b/dev/3.2-movements/source/mod/AvHEntityHierarchy.cpp @@ -150,6 +150,7 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType bool theEntityIsVisible = (theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber())) || GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_SIGHTED); bool theEntityIsDetected = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_DETECTED); + bool theEntityIsBlinking = (theBaseEntity->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (theBaseEntity->pev->iuser4 & MASK_ALIEN_MOVEMENT); // Don't send ammo, health, weapons, or scans bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan)); @@ -189,7 +190,7 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType { sendEntity = true; } - else if ((theEntityIsVisible || theEntityIsDetected) && !(theBaseEntity->pev->effects & EF_NODRAW) && !theIsTransient) + else if ((theEntityIsVisible || theEntityIsDetected) && !(theBaseEntity->pev->effects & EF_NODRAW) && !theIsTransient && !theEntityIsBlinking) { AvHPlayer* thePlayer = dynamic_cast(theBaseEntity); diff --git a/dev/3.2-movements/source/mod/AvHGamerules.cpp b/dev/3.2-movements/source/mod/AvHGamerules.cpp index b05cebe8..b285b5c4 100644 --- a/dev/3.2-movements/source/mod/AvHGamerules.cpp +++ b/dev/3.2-movements/source/mod/AvHGamerules.cpp @@ -989,6 +989,7 @@ bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBas bool theAttackerIsReceiver = false; float theScalar = 1.0f; bool theReceiverIsWorld = false; + bool theReceiverIsBlinking = (inReceiver->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (inReceiver->pev->iuser4 & MASK_ALIEN_MOVEMENT); // Never dynamic_cast any entities that could be non-NS entities if(!AvHSUGetIsExternalClassName(STRING(inAttacker->pev->classname))) @@ -1057,6 +1058,10 @@ bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBas { theCanDoDamage = false; } + if(theReceiverIsBlinking) + { + theCanDoDamage = false; + } if(theCanDoDamage && outScalar) { *outScalar = theScalar; diff --git a/dev/3.2-movements/source/mod/AvHHud.cpp b/dev/3.2-movements/source/mod/AvHHud.cpp index 97aee177..44a65b2e 100644 --- a/dev/3.2-movements/source/mod/AvHHud.cpp +++ b/dev/3.2-movements/source/mod/AvHHud.cpp @@ -654,6 +654,10 @@ void AvHHud::ClearData() this->mDisplayOrderTime = 0; this->mDisplayOrderType = 0; // :tankefugl + + this->mMovementTimer = 0.0f; + + this->m_bConserveFOV = false; } @@ -1387,6 +1391,8 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) this->UpdateCommonUI(); + this->UpdateMovementTimer(inCurrentTime - this->mTimeOfLastUpdate); + this->UpdateAlienUI(inCurrentTime); this->UpdateMarineUI(inCurrentTime); @@ -1510,6 +1516,12 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) // } //} +void AvHHud::UpdateMovementTimer(float inTimeSinceLastUpdate) +{ + cl_entity_t* theEntity = GetHUDEntity(); + this->mMovementTimer = max(theEntity->curstate.fuser4, theEntity->curstate.fuser4 * -1.0f); +} + bool AvHHud::GetAndClearTechEvent(AvHMessageID& outMessageID) { bool theTechEventWaiting = false; diff --git a/dev/3.2-movements/source/mod/AvHHud.h b/dev/3.2-movements/source/mod/AvHHud.h index d9677fdd..db5f0625 100644 --- a/dev/3.2-movements/source/mod/AvHHud.h +++ b/dev/3.2-movements/source/mod/AvHHud.h @@ -286,6 +286,7 @@ public: AvHUser3 GetHUDUser3() const; AvHPlayMode GetHUDPlayMode() const; AvHTeamNumber GetHUDTeam() const; + cl_entity_t* GetHUDEntity() const; int GetHUDUpgrades() const; int GetHUDMaxArmor() const; int GetHUDMaxHealth() const; @@ -362,6 +363,7 @@ public: void RenderCommonUI(); void RenderMarineUI(); void RenderCommanderUI(); + void RenderAlienMovementUIEffect(); void RenderAlienUI(); void RenderMiniMap(int inX, int inY, int inWidth, int inHeight); @@ -439,8 +441,12 @@ public: void ClearCenterText(); // :tankefugl + void UpdateMovementTimer(float inTimeSinceLastUpdate); + private: + float mMovementTimer; + // tankefugl: std::string mCenterText; float mCenterTextTime; @@ -694,6 +700,8 @@ private: HSPRITE mAlienUIEnergySprite; + HSPRITE mBlackSprite; + HSPRITE mMembraneSprite; HSPRITE mDigestingSprite; HSPRITE mBackgroundSprite; diff --git a/dev/3.2-movements/source/mod/AvHHudRender.cpp b/dev/3.2-movements/source/mod/AvHHudRender.cpp index 33d68cc1..c576e39a 100644 --- a/dev/3.2-movements/source/mod/AvHHudRender.cpp +++ b/dev/3.2-movements/source/mod/AvHHudRender.cpp @@ -1883,6 +1883,27 @@ float AvHHud::GetHUDHandicap() const return theHandicap; } +cl_entity_t* AvHHud::GetHUDEntity() const +{ + cl_entity_t* thePlayer = null; + cl_entity_s* theLocalPlayer = gEngfuncs.GetLocalPlayer(); + if(theLocalPlayer) + { + thePlayer = theLocalPlayer; + } + + if(g_iUser1 == OBS_IN_EYE) + { + cl_entity_t* theEnt = gEngfuncs.GetEntityByIndex(g_iUser2); + if(theEnt) + { + thePlayer = theEnt; + } + } + return thePlayer; +} + + AvHUser3 AvHHud::GetHUDUser3() const { AvHUser3 theUser3 = AVH_USER3_NONE; @@ -3611,6 +3632,58 @@ void AvHHud::RenderStructureRange(vec3_t inOrigin, int inRadius, HSPRITE inSprit } +void AvHHud::RenderAlienMovementUIEffect() +{ + this->m_bConserveFOV = false; + + int iuser3 = GetHUDUser3(); + bool isMoving = (GetHUDUpgrades() & MASK_ALIEN_MOVEMENT); + + if (isMoving && (iuser3 == AVH_USER3_ALIEN_PLAYER5)) + { + float theChargeThresholdTime = (float)BALANCE_VAR(kChargeThresholdTime); + float factor = min(this->mMovementTimer / theChargeThresholdTime, 1.0f); + } + if (isMoving && (iuser3 == AVH_USER3_ALIEN_PLAYER1)) + { + // render leap effects + } + else if (iuser3 == AVH_USER3_ALIEN_PLAYER4) + { + float alpha = 1.0f; + float theBlinkThresholdTime = (float)BALANCE_VAR(kBlinkThresholdTime); + + if (this->mMovementTimer > 0.0f) + { + alpha = min(this->mMovementTimer / theBlinkThresholdTime, 1.0f); + } + if (isMoving || this->mMovementTimer > 0.0f) + { + + this->m_bConserveFOV = true; + this->m_iFOV = 90.0f + alpha * 25.0f; + + this->mMovementTimer = min(this->mMovementTimer, theBlinkThresholdTime); + + // render overlay + // alpha *= 0.5f; + + AvHSpriteSetColor(1, 1, 1); + AvHSpriteSetRenderMode(kRenderTransTexture); + + int theWidth = 1.0 * ScreenWidth(); + int theHeight = 0.15 * ScreenHeight(); + + int theX = mViewport[0]; + int theY1 = mViewport[1]; + int theY2 = mViewport[3]; + + AvHSpriteDraw(mBlackSprite, 0, theX, theY1, theX + theWidth, theY1 + theHeight * alpha, 0, 0, 1, alpha); + AvHSpriteDraw(mBlackSprite, 0, theX, theY2 - theHeight * alpha, theX + theWidth, theY2, 0, 0, 1, alpha); + } + } +} + void AvHHud::RenderAlienUI() { @@ -3629,6 +3702,9 @@ void AvHHud::RenderAlienUI() return; } + // render alien movement effects + this->RenderAlienMovementUIEffect(); + AvHSpriteSetRenderMode(kRenderTransAlpha); int theWidth = kResourceEnergyBarWidth*ScreenWidth(); @@ -4218,6 +4294,9 @@ void AvHHud::VidInit(void) theSpriteName = UINameToSprite(kAlienEnergySprite, theScreenWidth); this->mAlienUIEnergySprite = Safe_SPR_Load(theSpriteName.c_str()); + // black sprite + this->mBlackSprite = Safe_SPR_Load("sprites/black.spr"); + // Load background for topdown mode this->mBackgroundSprite = Safe_SPR_Load(kTopDownBGSprite); diff --git a/dev/3.2-movements/source/mod/AvHMarineEquipment.cpp b/dev/3.2-movements/source/mod/AvHMarineEquipment.cpp index 8ae125a3..9b5c6655 100644 --- a/dev/3.2-movements/source/mod/AvHMarineEquipment.cpp +++ b/dev/3.2-movements/source/mod/AvHMarineEquipment.cpp @@ -195,6 +195,12 @@ void AvHDeployedMine::ActiveTouch(CBaseEntity* inOther) bool theEntityCanDoDamage = GetGameRules()->CanEntityDoDamageTo(this, inOther); //this->pev->owner = theTempOwner; // Check team here and only emit warning beep for friendlies + + // check for blinking + bool inOtherIsBlinking = (inOther->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (inOther->pev->iuser4 & MASK_ALIEN_MOVEMENT); + if(inOtherIsBlinking) + return; + if(theEntityCanDoDamage && (this->pev->team != inOther->pev->team)) { GetGameRules()->MarkDramaticEvent(kMineExplodePriority, inOther, this); diff --git a/dev/3.2-movements/source/mod/AvHMovementUtil.cpp b/dev/3.2-movements/source/mod/AvHMovementUtil.cpp index a2fa4800..5340ee7a 100644 --- a/dev/3.2-movements/source/mod/AvHMovementUtil.cpp +++ b/dev/3.2-movements/source/mod/AvHMovementUtil.cpp @@ -312,7 +312,8 @@ void AvHMUUpdateAlienEnergy(float inTimePassed, int inUser3, int inUser4, float& (inUser3 == AVH_USER3_ALIEN_PLAYER2) || (inUser3 == AVH_USER3_ALIEN_PLAYER3) || (inUser3 == AVH_USER3_ALIEN_PLAYER4) || - (inUser3 == AVH_USER3_ALIEN_PLAYER5)) + (inUser3 == AVH_USER3_ALIEN_PLAYER5) || + (inUser3 == AVH_USER3_ALIEN_PLAYER6)) { if(!GetHasUpgrade(inUser4, MASK_PLAYER_STUNNED)) { @@ -336,18 +337,19 @@ void AvHMUUpdateAlienEnergy(float inTimePassed, int inUser3, int inUser4, float& float theNewEnergy = theCurrentEnergy + inTimePassed*theAlienEnergyRate*theUpgradeFactor; - // If we're charging, reduce energy - if(GetHasUpgrade(inUser4, MASK_ALIEN_MOVEMENT)) - { - if(inUser3 == AVH_USER3_ALIEN_PLAYER4) - { +// // If we're charging, reduce energy +// // Removed: Charge only reduces energy when active +// if(GetHasUpgrade(inUser4, MASK_ALIEN_MOVEMENT)) +// { +// if(inUser3 == AVH_USER3_ALIEN_PLAYER4) +// { // theNewEnergy += inTimePassed*kFadeChargingDeplectionRate; - } - else - { - theNewEnergy += inTimePassed*kChargingDepletionRate; - } - } +// } +// else +// { +// theNewEnergy += inTimePassed*kChargingDepletionRate; +// } +// } theNewEnergy = min(max(theNewEnergy, 0.0f), 1.0f); diff --git a/dev/3.2-movements/source/mod/AvHPlayer.cpp b/dev/3.2-movements/source/mod/AvHPlayer.cpp index a62cd722..5ac4f335 100644 --- a/dev/3.2-movements/source/mod/AvHPlayer.cpp +++ b/dev/3.2-movements/source/mod/AvHPlayer.cpp @@ -250,6 +250,7 @@ #include "mod/AvHParticleConstants.h" #include "util/MathUtil.h" #include "types.h" +// #include "mod/CollisionUtil.h" #include "mod/AvHNetworkMessages.h" #include "mod/AvHNexusServer.h" @@ -2259,7 +2260,57 @@ void AvHPlayer::PlayerTouch(CBaseEntity* inOther) this->Uncloak(); } - // Don't do "touch" damage too quickly + // charge + float chargedamage = 0.0f; + if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) && (GetUser3() == AVH_USER3_ALIEN_PLAYER5)) // && !this->GetIsBlinking() ) + { + // push the target away + if (inOther->IsPlayer() && inOther->IsAlive()) + { + vec3_t direction, otherdir, playerdir, displacement; + + VectorSubtract(inOther->pev->origin, this->pev->origin, direction); + direction[2] = 0.0f; + VectorNormalize(direction); + + float velocityfactor = DotProduct(this->pev->velocity, inOther->pev->velocity) / (Length(this->pev->velocity) * Length(this->pev->velocity)); + + if (velocityfactor < 0.7f) + { + // push away + chargedamage = min(max(DotProduct(this->pev->velocity, direction), 100.0f), 500.0f); + VectorScale(direction, 10.0f, displacement); + + // try moving directly to the bumped location + VectorAdd(displacement, inOther->pev->origin, displacement); + + bool ducking = inOther->pev->flags & FL_DUCKING; + int hull = AvHMUGetHull(ducking, inOther->pev->iuser3); + int valvehull = AvHSUGetValveHull(hull); + + TraceResult trace; + UTIL_TraceHull(inOther->pev->origin, displacement, dont_ignore_monsters, valvehull, inOther->edict(), &trace); + + if (trace.flFraction == 1.0f) + VectorCopy(trace.vecEndPos, inOther->pev->origin); + + int duck = 0; + if (ducking) + duck = 1; + ALERT(at_console, UTIL_VarArgs("frac %f duck %d hull %d valvehull %d\n", trace.flFraction, duck, hull, valvehull)); + + VectorScale(direction, chargedamage, direction); + VectorAdd(direction, inOther->pev->velocity, inOther->pev->velocity); + inOther->pev->velocity[2] = 10.0f; + + // deal damage + chargedamage = true; + } + } + } + + + // Don't do "touch" damage too quickly float theTouchDamageInterval = BALANCE_VAR(kTouchDamageInterval); if((this->mTimeOfLastTouchDamage == -1) || (gpGlobals->time > (this->mTimeOfLastTouchDamage + theTouchDamageInterval))) { @@ -2278,9 +2329,28 @@ void AvHPlayer::PlayerTouch(CBaseEntity* inOther) this->mTimeOfLastTouchDamage = gpGlobals->time; } } - - // Are we charging? - if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) /*&& !this->GetIsBlinking()*/) + + if((chargedamage > 0.0f) && GetGameRules()->CanEntityDoDamageTo(this, inOther, &theScalar)) + { + float basedamage = (float)BALANCE_VAR(kChargeDamage); + float theDamage = basedamage * theScalar * chargedamage; + +#ifdef AVH_SERVER + ALERT(at_console, UTIL_VarArgs("basedamage %f scalar %f charge %f damage %f\n", basedamage, theScalar, chargedamage, theDamage)); +#endif + + inOther->TakeDamage(theInflictor, theAttacker, theDamage, NS_DMG_NORMAL); + + if(inOther->IsPlayer() && !inOther->IsAlive()) + { + EMIT_SOUND(ENT(this->pev), CHAN_WEAPON, kChargeKillSound, 1.0, ATTN_NORM); + } + } + + + // Are we charging? +/* TODO: Rework charge + if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT)) // && !this->GetIsBlinking() ) { if(GetGameRules()->CanEntityDoDamageTo(this, inOther, &theScalar)) { @@ -2296,6 +2366,7 @@ void AvHPlayer::PlayerTouch(CBaseEntity* inOther) this->mTimeOfLastTouchDamage = gpGlobals->time; } } +*/ } } } @@ -3060,11 +3131,11 @@ void AvHPlayer::GetSpeeds(int& outBaseSpeed, int& outUnemcumberedSpeed) const //theAlienBaseSpeed = this->mMaxGallopSpeed; theAlienBaseSpeed = BALANCE_VAR(kOnosBaseSpeed); - if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT)) - { - theAlienBaseSpeed *= kChargingFactor; - theSpeedUpgradeAmount *= kChargingFactor; - } +// if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT)) +// { +// theAlienBaseSpeed *= kChargingFactor; +// theSpeedUpgradeAmount *= kChargingFactor; +// } break; } @@ -3668,11 +3739,19 @@ bool AvHPlayer::GetCanBeAffectedByEnemies() const float AvHPlayer::GetOpacity() const { float theOpacity = AvHCloakable::GetOpacity(); + float theBlinkThresholdTime = (float)BALANCE_VAR(kBlinkThresholdTime); - //if(this->GetIsBlinking()) - //{ - // theOpacity = .05f; - //} + int entIndex = ENTINDEX(ENT(this->pev)); + if (entIndex > 0 && entIndex < 32) + if (this->GetIsBlinking()) + { + theOpacity = 0.0f; + } + else + if ((this->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (this->pev->fuser4 > 0.0)) + { + theOpacity = 1.0 - this->pev->fuser4 / theBlinkThresholdTime; + } return theOpacity; } @@ -6106,11 +6185,14 @@ void AvHPlayer::ProcessEntityBlip(CBaseEntity* inEntity) //bool theHasHiveSightUpgrade = true;//GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_UPGRADE_11) || GetGameRules()->GetIsTesting(); bool theEntityIsInSight = this->GetIsEntityInSight(inEntity); - + + // don't draw blinking players + bool theEntityIsNotBlinking = !(inEntity->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (inEntity->pev->iuser4 & MASK_ALIEN_MOVEMENT); + // If we're processing a relevant player AvHPlayer* theOtherPlayer = dynamic_cast(inEntity); bool theIsSpectatingEntity = this->GetIsSpectatingPlayer(inEntity->entindex()); - if(theOtherPlayer && (theOtherPlayer != this) && !theIsSpectatingEntity && theOtherPlayer->GetIsRelevant()) + if(theOtherPlayer && (theOtherPlayer != this) && !theIsSpectatingEntity && theOtherPlayer->GetIsRelevant() && theEntityIsNotBlinking) { // Calculate angle and distance to player Vector theVectorToEntity = inEntity->pev->origin - this->pev->origin; @@ -9019,6 +9101,14 @@ bool AvHPlayer::GetIsDigesting() const return theIsDigesting; } +bool AvHPlayer::GetIsBlinking() const +{ + if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) && (this->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4)) + return true; + else + return false; +} + void AvHPlayer::UpdateAmbientSounds() { AvHClassType theClassType = this->GetClassType(); diff --git a/dev/3.2-movements/source/mod/AvHPlayer.h b/dev/3.2-movements/source/mod/AvHPlayer.h index 949ca913..be0dd205 100644 --- a/dev/3.2-movements/source/mod/AvHPlayer.h +++ b/dev/3.2-movements/source/mod/AvHPlayer.h @@ -242,6 +242,7 @@ public: bool GetIsInTopDownMode(bool inIncludeSpectating = false) const; bool GetIsBeingDigested() const; bool GetIsDigesting() const; + bool GetIsBlinking() const; bool GetIsEntityInSight(CBaseEntity* inEntity); bool GetIsValidReinforcementFor(AvHTeamNumber inTeam) const; AvHTeamNumber GetTeam(bool inIncludeSpectating = false) const; diff --git a/dev/3.2-movements/source/mod/AvHServerUtil.cpp b/dev/3.2-movements/source/mod/AvHServerUtil.cpp index a5049456..271b4595 100644 --- a/dev/3.2-movements/source/mod/AvHServerUtil.cpp +++ b/dev/3.2-movements/source/mod/AvHServerUtil.cpp @@ -1232,10 +1232,11 @@ void AvHTraceLine(const Vector& vecStart, const Vector& vecEnd, IGNORE_MONSTERS edict_t* theEdict = pList[i]->edict(); // tankefugl: 0000941 -- added check to remove testing of spectators - if ((!(pList[i]->pev->iuser1 > 0 || pList[i]->pev->flags & FL_SPECTATOR)) && theEdict != pentIgnore) + if ((!(pList[i]->pev->iuser1 > 0 || pList[i]->pev->flags & FL_SPECTATOR)) + && !((pList[i]->pev->iuser3 == AVH_USER3_ALIEN_PLAYER4) && (pList[i]->pev->iuser4 & MASK_ALIEN_MOVEMENT)) + && theEdict != pentIgnore) // if (theEdict != pentIgnore) { - float t = NS_TraceLineAgainstEntity(pList[i]->entindex(), gpGlobals->time, theRayOrigin, theRayDirection); if (t != AVH_INFINITY && t < ptr->flFraction) diff --git a/dev/3.2-movements/source/mod/AvHSpecials.h b/dev/3.2-movements/source/mod/AvHSpecials.h index 2c2083b3..f450b8ca 100644 --- a/dev/3.2-movements/source/mod/AvHSpecials.h +++ b/dev/3.2-movements/source/mod/AvHSpecials.h @@ -118,6 +118,7 @@ typedef enum AVH_USER3_MENU_ASSIST, AVH_USER3_MENU_EQUIP, AVH_USER3_MINE, + AVH_USER3_ALIEN_PLAYER6, AVH_USER3_UNKNOWN, AVH_USER3_MAX } AvHUser3; @@ -165,7 +166,7 @@ typedef enum MASK_UPGRADE_13 = 0x00008000, // Movement level 3, marine heavy armor MASK_UPGRADE_14 = 0x00010000, // Sensory level 2 MASK_UPGRADE_15 = 0x00020000, // Sensory level 3 - MASK_ALIEN_MOVEMENT = 0x00040000, // Onos is charging + MASK_ALIEN_MOVEMENT = 0x00040000, // Alien is invoking movement ability MASK_WALLSTICKING = 0x00080000, // Flag for wall-sticking MASK_BUFFED = 0x00100000, // Alien is in range of active primal scream, or marine is under effects of catalyst MASK_UMBRA = 0x00200000, diff --git a/dev/3.2-movements/source/pm_shared/pm_shared.cpp b/dev/3.2-movements/source/pm_shared/pm_shared.cpp index a7a046f0..8e06c279 100644 --- a/dev/3.2-movements/source/pm_shared/pm_shared.cpp +++ b/dev/3.2-movements/source/pm_shared/pm_shared.cpp @@ -4338,14 +4338,146 @@ bool NS_PositionFreeForPlayer(vec3_t& inPosition) } */ +// Fade blink +bool PM_BlinkMove (void) +{ + float theEnergyCost = (float)BALANCE_VAR(kBlinkEnergyCost) * (float)pmove->frametime; + float theBlinkThresholdTime = (float)BALANCE_VAR(kBlinkThresholdTime); + if (AvHMUHasEnoughAlienEnergy(pmove->fuser3, theEnergyCost) && (pmove->fuser4 >= 0.0f)) + { + AvHMUDeductAlienEnergy(pmove->fuser3, theEnergyCost); + if (pmove->fuser4 == 0.0f) + { + int theSilenceUpgradeLevel = AvHGetAlienUpgradeLevel(pmove->iuser4, MASK_UPGRADE_6); + float theVolumeScalar = 1.0f - theSilenceUpgradeLevel/3.0f; + PM_NSPlaySound( CHAN_WEAPON, "player/metabolize_fire.wav", theVolumeScalar, ATTN_NORM, 0, PITCH_NORM ); + } + pmove->fuser4 += (float)pmove->frametime; + pmove->fuser4 = max(0, min(pmove->fuser4, theBlinkThresholdTime)); + } + else + return false; + + if (pmove->fuser4 >= theBlinkThresholdTime) + { + SetUpgradeMask(&pmove->iuser4, MASK_ALIEN_MOVEMENT, true); + + vec3_t wishvel, dest; + pmtrace_t trace; + float fmove, smove; + + // Copy movement amounts + fmove = pmove->cmd.forwardmove; + smove = pmove->cmd.sidemove; + + VectorNormalize(pmove->forward); + VectorScale(pmove->forward, 800, wishvel); + + VectorMA(pmove->origin, pmove->frametime, wishvel, dest); + + // first try moving directly to the next spot + trace = pmove->PM_PlayerTrace(pmove->origin, dest, PM_NORMAL, -1 ); + // If we made it all the way, then copy trace end as new player position. + if (trace.fraction == 1) + { + VectorCopy(trace.endpos, pmove->origin); + } + else + { + // if we can't move, adjust velocity to slite along the plane we collided with + // and retry + int attempts = 0; // in case we continue to collide vs. the old planes + while (true) { + PM_ClipVelocity(wishvel, trace.plane.normal, wishvel, 1.0); + VectorMA(pmove->origin, pmove->frametime, wishvel, dest); + + trace = pmove->PM_PlayerTrace(pmove->origin, dest, PM_NORMAL, -1 ); + if (trace.fraction == 1) + { + VectorCopy(trace.endpos, pmove->origin); + break; + } + if (attempts++ > 5) { + break; + } + } + + } + VectorClear(pmove->velocity); + } + else + { + SetUpgradeMask(&pmove->iuser4, MASK_ALIEN_MOVEMENT, false); + } + return true; +} + +// Lerk flight +void PM_FlapMove() +{ + PM_Jump(); +} + +// Onos charge +bool PM_ChargeMove() +{ + float theEnergyCost = (float)BALANCE_VAR(kChargeEnergyCost) * (float)pmove->frametime; + float theChargeThresholdTime = (float)BALANCE_VAR(kChargeThresholdTime); + float theChargeSpeed = (float)BALANCE_VAR(kChargeSpeed); + if (AvHMUHasEnoughAlienEnergy(pmove->fuser3, theEnergyCost) && (pmove->fuser4 >= 0.0f)) + { + AvHMUDeductAlienEnergy(pmove->fuser3, theEnergyCost); + if (pmove->fuser4 == 0.0f) + { + int theSilenceUpgradeLevel = AvHGetAlienUpgradeLevel(pmove->iuser4, MASK_UPGRADE_6); + float theVolumeScalar = 1.0f - theSilenceUpgradeLevel/3.0f; + PM_NSPlaySound( CHAN_WEAPON, "player/pl_fallpain3-7.wav", theVolumeScalar, ATTN_NORM, 0, PITCH_NORM ); + } + pmove->fuser4 += (float)pmove->frametime; + pmove->fuser4 = max(0, min(pmove->fuser4, theChargeThresholdTime)); + } + else + return false; + + SetUpgradeMask(&pmove->iuser4, MASK_ALIEN_MOVEMENT, true); + + if (pmove->onground != -1) + { + vec3_t forward; + float length = pmove->maxspeed * (1.0f + (float)BALANCE_VAR(kChargeSpeed) * pmove->fuser4 / theChargeThresholdTime); + + VectorCopy(pmove->forward, forward); + VectorNormalize(forward); + VectorScale(forward, length, forward); + + float boostfactor = DotProduct(forward, pmove->velocity) / (length * length); + VectorScale(forward, (1.0f - boostfactor), forward); + VectorAdd(forward, pmove->velocity, pmove->velocity); + float velocity = Length(pmove->velocity); + float maxvel = (pmove->maxspeed * (1.0f + (float)BALANCE_VAR(kChargeSpeed)) * 1.6f); + if (velocity > maxvel) + { + VectorNormalize(pmove->velocity); + VectorScale(pmove->velocity, maxvel, pmove->velocity); + } + } + + return true; +} + +// Skulk leap +void PM_LeapMove() +{ + +} void PM_AlienAbilities() { // Give some energy back if we're an alien and not evolving string theExt; + float theTimePassed = (float)pmove->frametime; if(NS_GetIsPlayerAlien(theExt)) { - float theTimePassed = pmove->cmd.msec*0.001f; AvHMUUpdateAlienEnergy(theTimePassed, pmove->iuser3, pmove->iuser4, pmove->fuser3); // Stop charging when we're out of energy @@ -4360,16 +4492,59 @@ void PM_AlienAbilities() //#endif - if (PM_GetIsLeaping() || PM_GetIsBlinking()) + // Movement abilities + bool success = false; + if ((pmove->cmd.buttons & IN_ATTACK2) && (AvHGetIsAlien(pmove->iuser3))) + { + switch (pmove->iuser3) + { + case AVH_USER3_ALIEN_PLAYER1: + PM_LeapMove(); + break; + case AVH_USER3_ALIEN_PLAYER3: + PM_FlapMove(); + break; + case AVH_USER3_ALIEN_PLAYER4: + success = PM_BlinkMove(); + break; + case AVH_USER3_ALIEN_PLAYER5: + success = PM_ChargeMove(); + break; + default: + { + break; + } + } + } + if (!success) + { + SetUpgradeMask(&pmove->iuser4, MASK_ALIEN_MOVEMENT, false); + + float theBlinkThresholdTime = (float)BALANCE_VAR(kBlinkThresholdTime); + if (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER4 && pmove->fuser4 == theBlinkThresholdTime) + { + int theSilenceUpgradeLevel = AvHGetAlienUpgradeLevel(pmove->iuser4, MASK_UPGRADE_6); + float theVolumeScalar = 1.0f - theSilenceUpgradeLevel/3.0f; + PM_NSPlaySound( CHAN_WEAPON, "player/metabolize_fire_reverse.wav", theVolumeScalar, ATTN_NORM, 0, PITCH_NORM ); + } + + if (pmove->fuser4 >= 0.0f) + pmove->fuser4 *= -1.0f; + pmove->fuser4 += theTimePassed; + pmove->fuser4 = min(pmove->fuser4, 0.0f); + } + return; + + if (PM_GetIsLeaping() || PM_GetIsBlinking()) { float theScalar = 500; float theEnergyCost = 0; if (PM_GetIsBlinking()) { - theScalar = 225; - AvHMUGetEnergyCost(AVH_WEAPON_BLINK, theEnergyCost); - } + PM_BlinkMove(); + return; + } else { AvHMUGetEnergyCost(AVH_ABILITY_LEAP, theEnergyCost); @@ -4412,6 +4587,7 @@ void PM_AlienAbilities() // } //pmove->velocity[2] += 300; //} + } // else if((pmove->cmd.impulse == ALIEN_ABILITY_BLINK) && (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER4))