diff --git a/dev/3.2-movements/Balance.txt b/dev/3.2-movements/Balance.txt index 374b9d95..9b074038 100644 --- a/dev/3.2-movements/Balance.txt +++ b/dev/3.2-movements/Balance.txt @@ -357,7 +357,7 @@ #define kChargeMaxPushbackForce 100.0 #define kChargePushbackRadius 100.0 #define kChargeSpeed 1.00 -#define kChargeThresholdTime 0.50 +#define kChargeThresholdTime 0.75 #define kChargingEnergyScalar 2.80 #define kClawsEnergyCost 0.07 #define kClawsROF 0.90 diff --git a/dev/3.2-movements/source/cl_dll/ammo.cpp b/dev/3.2-movements/source/cl_dll/ammo.cpp index f60cd534..6479f6a8 100644 --- a/dev/3.2-movements/source/cl_dll/ammo.cpp +++ b/dev/3.2-movements/source/cl_dll/ammo.cpp @@ -41,6 +41,8 @@ WeaponsResource gWR; int g_weaponselect = 0; +extern bool gCanMove; + //Equivalent to DECLARE_COMMAND(lastinv,LastInv) except we use gWR instead of gHud void __CmdFunc_LastInv(void) { gWR.UserCmd_LastInv(); } @@ -737,6 +739,9 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf ) if( !bIsCurrent ) { return 1; } + if (iId == 22 || iId == 11 || iId == 21) + gCanMove = pWeapon->iEnabled; + m_pWeapon = pWeapon; if ( !(gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) ) diff --git a/dev/3.2-movements/source/cl_dll/input.cpp b/dev/3.2-movements/source/cl_dll/input.cpp index 97d8fdaa..7b41e41f 100644 --- a/dev/3.2-movements/source/cl_dll/input.cpp +++ b/dev/3.2-movements/source/cl_dll/input.cpp @@ -1503,8 +1503,8 @@ void InitInput (void) gEngfuncs.pfnAddCommand ("-speed", IN_SpeedUp); gEngfuncs.pfnAddCommand ("+attack", IN_AttackDown); gEngfuncs.pfnAddCommand ("-attack", IN_AttackUp); - gEngfuncs.pfnAddCommand ("+attack2", IN_Attack2Down); - gEngfuncs.pfnAddCommand ("-attack2", IN_Attack2Up); + gEngfuncs.pfnAddCommand ("+moveability", IN_Attack2Down); + gEngfuncs.pfnAddCommand ("-moveability", IN_Attack2Up); gEngfuncs.pfnAddCommand ("+use", IN_UseDown); gEngfuncs.pfnAddCommand ("-use", IN_UseUp); gEngfuncs.pfnAddCommand ("+jump", IN_JumpDown); diff --git a/dev/3.2-movements/source/dlls/weapons.cpp b/dev/3.2-movements/source/dlls/weapons.cpp index c0842dd2..1968df55 100644 --- a/dev/3.2-movements/source/dlls/weapons.cpp +++ b/dev/3.2-movements/source/dlls/weapons.cpp @@ -127,6 +127,7 @@ MULTIDAMAGE gMultiDamage; #define TRACER_FREQ 4 // Tracers fire every fourth bullet +extern bool gCanMove[]; //========================================================= // MaxAmmoCarry - pass in a name and this function will tell @@ -1171,6 +1172,9 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) bSend = TRUE; } + if (m_iId == 22 || m_iId == 11 || m_iId == 21) + gCanMove[pPlayer->entindex() - 1] = m_iEnabled; + if ( bSend ) { NetMsg_CurWeapon( pPlayer->pev, state, m_iId, m_iClip ); diff --git a/dev/3.2-movements/source/mod/AvHHud.h b/dev/3.2-movements/source/mod/AvHHud.h index e6180915..016bcf9e 100644 --- a/dev/3.2-movements/source/mod/AvHHud.h +++ b/dev/3.2-movements/source/mod/AvHHud.h @@ -702,6 +702,7 @@ private: HSPRITE mAlienUIEnergySprite; HSPRITE mBlackSprite; + HSPRITE mChargeSprite; HSPRITE mMembraneSprite; HSPRITE mDigestingSprite; diff --git a/dev/3.2-movements/source/mod/AvHHudRender.cpp b/dev/3.2-movements/source/mod/AvHHudRender.cpp index 447693c6..43861239 100644 --- a/dev/3.2-movements/source/mod/AvHHudRender.cpp +++ b/dev/3.2-movements/source/mod/AvHHudRender.cpp @@ -3650,8 +3650,27 @@ void AvHHud::RenderAlienMovementUIEffect() if (isMoving && (iuser3 == AVH_USER3_ALIEN_PLAYER5)) { + float alpha = 1.0f; float theChargeThresholdTime = (float)BALANCE_VAR(kChargeThresholdTime); float factor = min(this->mMovementTimer / theChargeThresholdTime, 1.0f); + +// if (this->mMovementTimer > 0.0f) +// { +// alpha = min(this->mMovementTimer / theChargeThresholdTime, 1.0f); +// +// AvHSpriteSetColor(1, 1, 1, alpha); +// AvHSpriteSetRenderMode(kRenderTransAlpha); +// +// int theWidth = ScreenWidth(); +// int theHeight = ScreenHeight(); +// +// int theX = mViewport[0]; +// int theY = mViewport[1]; +// int theY1 = mViewport[1]; +// int theY2 = mViewport[3]; +// +// AvHSpriteDraw(mChargeSprite, 0, theX, theY, theX + theWidth, theY + theHeight, 0, 0, 1, 1); +// } } if (isMoving && (iuser3 == AVH_USER3_ALIEN_PLAYER1)) { @@ -4305,6 +4324,9 @@ void AvHHud::VidInit(void) // black sprite this->mBlackSprite = Safe_SPR_Load("sprites/black.spr"); + + // charge sprite + this->mChargeSprite = Safe_SPR_Load("sprites/charge_tint.spr"); // Load background for topdown mode this->mBackgroundSprite = Safe_SPR_Load(kTopDownBGSprite); diff --git a/dev/3.2-movements/source/mod/AvHItemInfo.cpp b/dev/3.2-movements/source/mod/AvHItemInfo.cpp index c9010887..4af20a52 100644 --- a/dev/3.2-movements/source/mod/AvHItemInfo.cpp +++ b/dev/3.2-movements/source/mod/AvHItemInfo.cpp @@ -899,8 +899,8 @@ int AvHDivineWind::iItemSlot(void) int AvHCharge::GetItemInfo(ItemInfo *p) const { - p->iSlot = AVH_FOURTH_SLOT; - p->iPosition = 6; + p->iSlot = AVH_SECOND_SLOT; //AVH_FOURTH_SLOT; + p->iPosition = 5; p->pszName = STRING(pev->classname); p->pszAmmo1 = NULL; @@ -908,7 +908,7 @@ int AvHCharge::GetItemInfo(ItemInfo *p) const p->pszAmmo2 = NULL; p->iMaxAmmo2 = BALANCE_VAR(kChargeDamage); p->iMaxClip = WEAPON_NOCLIP; - p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY | ITEM_FLAG_NOAUTORELOAD | ONE_HIVE_REQUIRED | TWO_HIVES_REQUIRED | THREE_HIVES_REQUIRED; + p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY | ITEM_FLAG_NOAUTORELOAD | ONE_HIVE_REQUIRED; // | TWO_HIVES_REQUIRED | THREE_HIVES_REQUIRED; p->iId = AVH_ABILITY_CHARGE; p->iWeight = kDefaultPrimaryWeaponWeight; @@ -917,7 +917,7 @@ int AvHCharge::GetItemInfo(ItemInfo *p) const int AvHCharge::iItemSlot(void) { - return AVH_FOURTH_SLOT + 1; + return AVH_SECOND_SLOT + 1; } int AvHStomp::GetItemInfo(ItemInfo *p) const @@ -946,8 +946,8 @@ int AvHStomp::iItemSlot(void) int AvHDevour::GetItemInfo(ItemInfo *p) const { - p->iSlot = AVH_SECOND_SLOT; - p->iPosition = 5; + p->iSlot = AVH_FOURTH_SLOT; //AVH_SECOND_SLOT; + p->iPosition = 6; p->pszName = STRING(pev->classname); p->pszAmmo1 = NULL; @@ -955,7 +955,7 @@ int AvHDevour::GetItemInfo(ItemInfo *p) const p->pszAmmo2 = NULL; p->iMaxAmmo2 = BALANCE_VAR(kDevourDamage); p->iMaxClip = WEAPON_NOCLIP; - p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY | ITEM_FLAG_NOAUTORELOAD | ONE_HIVE_REQUIRED; + p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY | ITEM_FLAG_NOAUTORELOAD | ONE_HIVE_REQUIRED | TWO_HIVES_REQUIRED | THREE_HIVES_REQUIRED; p->iId = AVH_WEAPON_DEVOUR; p->iWeight = kDefaultPrimaryWeaponWeight; @@ -964,7 +964,7 @@ int AvHDevour::GetItemInfo(ItemInfo *p) const int AvHDevour::iItemSlot(void) { - return AVH_SECOND_SLOT + 1; + return AVH_FOURTH_SLOT + 1; } 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 a334b3fa..3186615f 100644 --- a/dev/3.2-movements/source/pm_shared/pm_shared.cpp +++ b/dev/3.2-movements/source/pm_shared/pm_shared.cpp @@ -311,6 +311,11 @@ int g_onladder[MAX_CLIENTS]; bool gIsJetpacking[MAX_CLIENTS]; bool gCanJump[MAX_CLIENTS]; +#ifdef AVH_SERVER +bool gCanMove[MAX_CLIENTS]; +#else +bool gCanMove; +#endif // Borrowed from Quake1. @@ -4601,22 +4606,28 @@ bool PM_ChargeMove() if (pmove->onground != -1) { vec3_t forward; + vec3_t sideways; float length = pmove->maxspeed * (1.0f + (float)BALANCE_VAR(kChargeSpeed) * pmove->fuser4 / theChargeThresholdTime); VectorCopy(pmove->forward, forward); + VectorScale(forward, -1 * DotProduct(forward, pmove->velocity), forward); + VectorAdd(pmove->velocity, forward, sideways); + //VectorScale(sideways, 1.5f, sideways); + + VectorCopy(pmove->forward, forward); + forward[2] = 0.0f; 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); + VectorAdd(forward, sideways, pmove->velocity); + //VectorCopy(forward, pmove->velocity); + + // pmove->velocity[2] = 0.0f; + float velocity = Length(pmove->velocity); - float maxvel = (pmove->maxspeed * (1.0f + (float)BALANCE_VAR(kChargeSpeed)) * 1.6f); + float maxvel = (pmove->maxspeed * (1.0f + theChargeSpeed)); if (velocity > maxvel) - { - VectorNormalize(pmove->velocity); - VectorScale(pmove->velocity, maxvel, pmove->velocity); - } + VectorScale(pmove->velocity, maxvel / velocity, pmove->velocity); } return true; @@ -4688,23 +4699,30 @@ void PM_AlienAbilities() } // Movement abilities + + bool canmove = false; +#ifdef AVH_SERVER + canmove = gCanMove[pmove->player_index]; +#else + canmove = gCanMove; +#endif bool success = false; if ((pmove->cmd.buttons & IN_ATTACK2) && (AvHGetIsAlien(pmove->iuser3))) { switch (pmove->iuser3) { case AVH_USER3_ALIEN_PLAYER1: - success = PM_LeapMove(); + success = canmove && PM_LeapMove(); break; case AVH_USER3_ALIEN_PLAYER3: pmove->cmd.buttons |= IN_JUMP; success = PM_FlapMove(); break; case AVH_USER3_ALIEN_PLAYER4: - success = PM_BlinkMove(); + success = canmove && PM_BlinkMove(); break; case AVH_USER3_ALIEN_PLAYER5: - success = PM_ChargeMove(); + success = canmove && PM_ChargeMove(); break; default: { @@ -5197,10 +5215,10 @@ void PM_Jump (void) qboolean cansuperjump = false; - if ((pmove->cmd.buttons & IN_JUMP) && !(pmove->oldbuttons & IN_JUMP)) - { - gCanJump[pmove->player_index] = true; - } +// if ((pmove->cmd.buttons & IN_JUMP) && !(pmove->oldbuttons & IN_JUMP)) +// { +// gCanJump[pmove->player_index] = true; +// } if (pmove->dead || GetHasUpgrade(pmove->iuser4, MASK_ENSNARED)) { @@ -5321,8 +5339,8 @@ void PM_Jump (void) // if ( pmove->oldbuttons & IN_JUMP && (pmove->velocity[0] == 0 || !theIsAlien || pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3) ) //return; // don't pogo stick -// if ( pmove->oldbuttons & IN_JUMP ) - if (gCanJump[pmove->player_index] == false) + if ( pmove->oldbuttons & IN_JUMP ) +// if (gCanJump[pmove->player_index] == false) return; // don't pogo stick // In the air now. @@ -5371,7 +5389,7 @@ void PM_Jump (void) { pmove->velocity[2] = sqrt(2 * 800 * 45.0); // Flag that we jumped. - gCanJump[pmove->player_index] = false; + // gCanJump[pmove->player_index] = false; } pmove->oldbuttons |= IN_JUMP; // don't jump again until released diff --git a/dev/3.2-movements/sprites/charge_tint.spr b/dev/3.2-movements/sprites/charge_tint.spr new file mode 100644 index 00000000..b03a0143 Binary files /dev/null and b/dev/3.2-movements/sprites/charge_tint.spr differ