various network-related movement modifier fixes, ejected shells bouncing off player while moving backwards fixed
This commit is contained in:
parent
0c9b8537e4
commit
abfc215d27
16 changed files with 542 additions and 258 deletions
|
@ -53,6 +53,12 @@ CTSShellEject::generate(int arg_iShellEjectType){
|
|||
setmodel(eShell, (*mySED).sModelPath);
|
||||
//setmodel(eShell, "models/powerup.mdl");
|
||||
|
||||
// Setting the owner stops the shell from bouncing off the firing player, most
|
||||
// noticeable on firing while moving backwards at close to max speed but
|
||||
// sometimes still at max speed. From what I can tell, no side-effects to this.
|
||||
// Possibly an issue in original TS too.
|
||||
player pl = (player) pSeat->m_ePlayer;
|
||||
eShell.owner = pl;
|
||||
|
||||
eShell.solid = SOLID_BBOX;
|
||||
eShell.movetype = MOVETYPE_BOUNCE;
|
||||
|
|
|
@ -102,7 +102,7 @@ HUD_Draw(void)
|
|||
//TAGGG - new
|
||||
//////////////////////////////////////////////////////////////
|
||||
drawTimer();
|
||||
drawPlayerStats();
|
||||
drawPlayerStats();
|
||||
|
||||
// ---OLD LOCATION for weapon stats drawing (Weapons_DrawCrosshair)
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -64,4 +64,5 @@ struct
|
|||
vector m_vCam;
|
||||
} g_viewBobVars[4], *pViewBob;
|
||||
|
||||
void pViewBob_reset(void);
|
||||
|
||||
|
|
|
@ -13,3 +13,13 @@ pSeatLocal_init(void)
|
|||
pSeatLocal->m_inputMouseClicked = FALSE;
|
||||
}
|
||||
|
||||
//TAGGG - BobNEW. helper method
|
||||
void
|
||||
pViewBob_reset(void)
|
||||
{
|
||||
pViewBob->m_flBobTime = 0;
|
||||
pViewBob->m_flBob = 0;
|
||||
pViewBob->m_flBobCycle = 0;
|
||||
pViewBob->m_flSpeed = 0;
|
||||
pViewBob->m_vCam = [0,0,0];
|
||||
}
|
||||
|
|
|
@ -211,14 +211,18 @@ TS_View_ChangeViewModelPost(void)
|
|||
// on changing models, right?
|
||||
pSeat->m_pEventCall = NULL;
|
||||
|
||||
|
||||
skel_delete( mflash.skeletonindex );
|
||||
mflash.skeletonindex = skel_create( vm.modelindex );
|
||||
pSeat->m_iVMBones = skel_get_numbones( mflash.skeletonindex ) + 1;
|
||||
|
||||
// assuming cloning above for the akimbo muzzleflash is a good idea
|
||||
skel_delete(mflashAkimbo.skeletonindex);
|
||||
// TODO: could we just reuse the mflash.skeletonindex here? I don't know
|
||||
mflashAkimbo.skeletonindex = skel_create(vm.modelindex);
|
||||
|
||||
///skel_delete(mflashAkimbo.skeletonindex);
|
||||
|
||||
// could we just reuse the mflash.skeletonindex here?
|
||||
//mflashAkimbo.skeletonindex = skel_create(vm.modelindex);
|
||||
mflashAkimbo.skeletonindex = mflash.skeletonindex;
|
||||
|
||||
// no need to set m_iVMBones again, nor have a separate copy. How could it
|
||||
// be any different for the akimbo one (clone of mflash)
|
||||
|
||||
|
@ -248,7 +252,7 @@ TS_View_ResetViewModel(void)
|
|||
pSeat->m_iVMBones = 0 + 1;
|
||||
|
||||
// ! If the skeletonindex becomes shared, skel_delete for each will not be necessary
|
||||
skel_delete(mflashAkimbo.skeletonindex);
|
||||
//skel_delete(mflashAkimbo.skeletonindex);
|
||||
mflashAkimbo.skeletonindex = 0;
|
||||
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ TS_playerEquippedWeapon(player pl, int newWeaponEquipped, BOOL useAkimbo){
|
|||
// EXPERIMENTAL
|
||||
pl.equippedWeaponWaitingForCallback = TRUE;
|
||||
// Not sure how you'd deal with a ping worse than 0.5 seconds
|
||||
pl.equippedWeaponWaitingForCallback_maxWaitTime = time + 0.6;
|
||||
pl.equippedWeaponWaitingForCallback_maxWaitTime = time + 0.8;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
|
||||
void processInputs(void);
|
||||
#ifdef CLIENT
|
||||
void PreSpawn_Input(void);
|
||||
#endif
|
||||
|
||||
|
||||
// WARNING! This is only called by PMove_Run, which is only called
|
||||
|
@ -34,38 +37,14 @@ Game_Input(void)
|
|||
{
|
||||
player pl = (player)self;
|
||||
|
||||
//
|
||||
// TODO: in the CSQC_Input_Frame event might be better when supported
|
||||
// (but still do a 'return' on not being spawned here regardless)
|
||||
//
|
||||
if(pl.iState != PLAYER_STATE::SPAWNED){
|
||||
// not ingame (fake spectator)? Do another check instead: spawning.
|
||||
#ifdef CLIENT
|
||||
|
||||
|
||||
if(
|
||||
pSeatLocal->m_flUI_Display == UI_SCREEN::NONE &&
|
||||
(input_buttons & INPUT_BUTTON0) &&
|
||||
!(pl.gflags & GF_SEMI_TOGGLED) &&
|
||||
pSeatLocal->flBlockSpawnTime <= time
|
||||
){
|
||||
sendevent( "GamePlayerSpawn", "");
|
||||
}
|
||||
|
||||
/*
|
||||
if(
|
||||
((input_buttons & INPUT_BUTTON0) && pSeatLocal->flBlockSpawnTime > time) ||
|
||||
pSeat->m_flInputBlockTime > time
|
||||
)
|
||||
{
|
||||
pSeatLocal->flBlockSpawnTime = time + 0.20f;
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// since the rest of this method is about to be skipped.
|
||||
if(input_buttons & INPUT_BUTTON0){
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
}else{
|
||||
pl.gflags &= ~GF_SEMI_TOGGLED;
|
||||
}
|
||||
PreSpawn_Input();
|
||||
#endif
|
||||
// client or server, don't pay attention to the rest of this file if not spawned
|
||||
return;
|
||||
|
@ -73,7 +52,7 @@ Game_Input(void)
|
|||
#ifdef CLIENT
|
||||
else{
|
||||
// not spawned? Some notes on possible things to involve, all dummied for now
|
||||
|
||||
|
||||
|
||||
// This was removed? Legacy VGUI
|
||||
// If we are inside a UI, don't let the client do stuff outside
|
||||
|
@ -94,14 +73,10 @@ Game_Input(void)
|
|||
// Must be ingame to reach beyond here
|
||||
|
||||
|
||||
//TAGGG - good place for this? Cloned from w_attack_next as a separate counter
|
||||
// for akimbo firing to use.
|
||||
// This method, Game_Input, is called by Nuclide's pmove.qc in the same place
|
||||
// w_attack_next is adjusted by the current frame time.
|
||||
pl.w_attack_akimbo_next = max(0, pl.w_attack_akimbo_next - input_timelength);
|
||||
pl.updateTimers();
|
||||
|
||||
pl.akimboDualFireToleranceTime = max(0, pl.akimboDualFireToleranceTime - input_timelength);
|
||||
|
||||
#ifdef SERVER
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
|
||||
|
@ -412,6 +387,44 @@ void processInputs(void){
|
|||
|
||||
#ifdef CLIENT
|
||||
|
||||
// called when not ingame for sending a spawn request.
|
||||
void PreSpawn_Input(void){
|
||||
player pl = (player)self;
|
||||
|
||||
if(
|
||||
pSeatLocal->m_flUI_Display == UI_SCREEN::NONE &&
|
||||
(input_buttons & INPUT_BUTTON0) &&
|
||||
!(pl.gflags & GF_SEMI_TOGGLED) &&
|
||||
pSeatLocal->flBlockSpawnTime <= time
|
||||
){
|
||||
sendevent( "GamePlayerSpawn", "");
|
||||
}
|
||||
|
||||
/*
|
||||
if(
|
||||
((input_buttons & INPUT_BUTTON0) && pSeatLocal->flBlockSpawnTime > time) ||
|
||||
pSeat->m_flInputBlockTime > time
|
||||
)
|
||||
{
|
||||
pSeatLocal->flBlockSpawnTime = time + 0.20f;
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// since the rest of this method is about to be skipped.
|
||||
if(input_buttons & INPUT_BUTTON0){
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
}else{
|
||||
pl.gflags &= ~GF_SEMI_TOGGLED;
|
||||
}
|
||||
}//PreSpawn_Input
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void HUD_DrawWeaponSelect_Trigger(void);
|
||||
BOOL TS_HUD_CloseWeaponSelect(BOOL);
|
||||
|
||||
|
@ -432,18 +445,24 @@ void ClientGame_Input_Frame(void){
|
|||
// CSQC_Input_Frame (defined by Nuclide) letting the gamemod block right-click
|
||||
// inputs per some condition, like weapon-select being up.
|
||||
|
||||
// TODO - changing what m_flInputBlockTime affects might be a good idea,
|
||||
// affecting other inputs like crouch is unnecessary, that causes the player to uncrouch
|
||||
// if changing weapons while crouched.
|
||||
|
||||
if(pSeat->m_iHUDWeaponSelected && pSeat->m_iInputAttack2){ //input_buttons & INPUT_BUTTON3
|
||||
if(TS_HUD_CloseWeaponSelect(TRUE)){
|
||||
pSeat->m_flInputBlockTime = time + 0.2;
|
||||
// might not even need this much, but verify.
|
||||
// might change going to weapons that have an immediate secondary fire
|
||||
//pSeat->m_flInputBlockTime = time + 0.2;
|
||||
input_impulse = 0;
|
||||
input_buttons = 0;
|
||||
//input_buttons = 0; no need for the whole buttons reset
|
||||
input_buttons &= ~INPUT_BUTTON3;
|
||||
pSeat->m_iInputAttack2 = FALSE;
|
||||
}else{
|
||||
//pSeat->m_iInputAttack2 = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// !!!
|
||||
// An override for this to go in CSQC_Input_Frame would be very nice I think,
|
||||
// unless there is some other way that I'm missing.
|
||||
|
|
|
@ -210,27 +210,29 @@ class player:base_player
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// should be better networked when it's better understood what the block feature
|
||||
// (reload with karate out, I assume?) is supposed to do.
|
||||
float flKarateBlockCooldown;
|
||||
|
||||
int iMeleeCycler;
|
||||
PREDICTED_INT(iMeleeCycler);
|
||||
|
||||
//SHARED!!!
|
||||
vector vViewAngleOffsetTarget;
|
||||
float fAccuracyKickback;
|
||||
// don't send to the client. ...unless it can account for the difference
|
||||
// from server time.
|
||||
float fAccuracyKickbackStartCooldown;
|
||||
PREDICTED_FLOAT(fAccuracyKickback);
|
||||
PREDICTED_FLOAT(fAccuracyKickbackStartCooldown);
|
||||
|
||||
// The client can keep its own in mind as prediction between frames if needed. Server
|
||||
// time and client time aren't really compatible to send like this.
|
||||
|
||||
|
||||
|
||||
float fMoveBlockDelay;
|
||||
float fUncrouchBlockDelay;
|
||||
PREDICTED_FLOAT(fMoveBlockDelay);
|
||||
PREDICTED_FLOAT(fUncrouchBlockDelay);
|
||||
// not networked, set by the player individually client and serverside on picking
|
||||
// the weapon. Might not even be necessary to do this.
|
||||
float fMoveBlockCapSpeed;
|
||||
float fKarateStamina;
|
||||
PREDICTED_FLOAT(fKarateStamina);
|
||||
|
||||
|
||||
//These will be shared and help with slowdown logic.
|
||||
|
@ -472,6 +474,7 @@ class player:base_player
|
|||
|
||||
virtual void(void) preThink;
|
||||
virtual void(void) postThink;
|
||||
virtual void(void) preThinkShared;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -479,7 +482,7 @@ class player:base_player
|
|||
virtual void(BOOL resetInventory) reset;
|
||||
|
||||
virtual vector(vector vecInputAngles)View_approachAngleOffsetTarget;
|
||||
virtual void (void)handleAccuracyKickback;
|
||||
virtual void (void)updateTimers;
|
||||
|
||||
virtual void(float arg_theZoom) setZoom;
|
||||
virtual void(void) resetZoom;
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
// little test
|
||||
//var float otherTimer = 0;
|
||||
|
||||
//#define FORCE_NETWORK_ALL_INVENTORY
|
||||
|
||||
|
@ -209,18 +210,27 @@ player::ReceiveEntity(float new, float fl)
|
|||
armor = readbyte();
|
||||
iTotalSlots = readbyte();
|
||||
|
||||
fAccuracyKickback = readfloat();
|
||||
|
||||
fMoveBlockDelay = readfloat();
|
||||
fUncrouchBlockDelay = readfloat();
|
||||
fKarateStamina = readfloat();
|
||||
|
||||
|
||||
//flKarateBlockCooldown
|
||||
iMeleeCycler = readbyte();
|
||||
|
||||
//vViewAngleOffsetTarget[0] = readcoord();
|
||||
//vViewAngleOffsetTarget[1] = readcoord();
|
||||
//vViewAngleOffsetTarget[2] = readcoord();
|
||||
fAccuracyKickback = readfloat();
|
||||
fAccuracyKickbackStartCooldown = readfloat();
|
||||
|
||||
|
||||
|
||||
float fMoveBlockDelay_temp = readfloat();
|
||||
float fUncrouchBlockDelay_temp = readfloat();
|
||||
|
||||
if(!equippedWeaponWaitingForCallback){
|
||||
fMoveBlockDelay = fMoveBlockDelay_temp;
|
||||
fUncrouchBlockDelay = fUncrouchBlockDelay_temp;
|
||||
}
|
||||
|
||||
fKarateStamina = readfloat();
|
||||
|
||||
|
||||
|
||||
|
@ -255,7 +265,10 @@ player::ReceiveEntity(float new, float fl)
|
|||
if(i != -1){
|
||||
ReceiveEntity_ary_myWeapons(i);
|
||||
|
||||
int myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
|
||||
//int myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
int betterID = ary_myWeapons[inventoryEquippedIndex].weaponID;
|
||||
int myAmmoType = getAmmoTypeOfWeapon(betterID);
|
||||
if(myAmmoType != -1){
|
||||
i = myAmmoType;
|
||||
//UNNECESSARY. This array is of fixed length, so known at all times.
|
||||
|
@ -266,7 +279,12 @@ player::ReceiveEntity(float new, float fl)
|
|||
ary_ammoTotal[i] = readlong();
|
||||
//}
|
||||
}
|
||||
}/*else{
|
||||
// STUPID.
|
||||
ReceiveEntity_ary_myWeapons(0);
|
||||
ary_ammoTotal[0] = readlong();
|
||||
}
|
||||
*/
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
@ -383,6 +401,21 @@ player::PredictPreFrame(void)
|
|||
SAVE_STATE(grenadeFireIndex);
|
||||
SAVE_STATE(bGrenadeToss);
|
||||
|
||||
|
||||
//flKarateBlockCooldown
|
||||
SAVE_STATE(iMeleeCycler);
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[0] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[1] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[2] );
|
||||
SAVE_STATE(fAccuracyKickback);
|
||||
SAVE_STATE(fAccuracyKickbackStartCooldown);
|
||||
|
||||
SAVE_STATE(fMoveBlockDelay);
|
||||
SAVE_STATE(fUncrouchBlockDelay);
|
||||
SAVE_STATE(fKarateStamina);
|
||||
|
||||
|
||||
|
||||
SAVE_STATE(shotgunReloadIndex);
|
||||
|
||||
SAVE_STATE(shotgunAddAmmoTime);
|
||||
|
@ -482,6 +515,19 @@ player::PredictPostFrame(void)
|
|||
ROLL_BACK(grenadeFireIndex);
|
||||
ROLL_BACK(bGrenadeToss);
|
||||
|
||||
//flKarateBlockCooldown
|
||||
ROLL_BACK(iMeleeCycler);
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[0] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[1] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[2] );
|
||||
ROLL_BACK(fAccuracyKickback);
|
||||
ROLL_BACK(fAccuracyKickbackStartCooldown);
|
||||
|
||||
ROLL_BACK(fMoveBlockDelay);
|
||||
ROLL_BACK(fUncrouchBlockDelay);
|
||||
ROLL_BACK(fKarateStamina);
|
||||
|
||||
|
||||
ROLL_BACK(shotgunReloadIndex);
|
||||
|
||||
ROLL_BACK(shotgunAddAmmoTime);
|
||||
|
@ -526,6 +572,7 @@ player::EvaluateEntity(void)
|
|||
|
||||
int i;
|
||||
int myAmmoType;
|
||||
int betterID;
|
||||
|
||||
/* animation */
|
||||
if (ATTR_CHANGED(anim_bottom) || ATTR_CHANGED(anim_bottom_time))
|
||||
|
@ -636,7 +683,9 @@ player::EvaluateEntity(void)
|
|||
if(ATTR_CHANGED(ary_myWeapons[i].bNeedsPump)) SendFlags |= PLAYER_UNUSED1;
|
||||
|
||||
//}
|
||||
myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
//myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
betterID = ary_myWeapons[inventoryEquippedIndex].weaponID;
|
||||
myAmmoType = getAmmoTypeOfWeapon(betterID);
|
||||
if(myAmmoType != -1){
|
||||
i = myAmmoType;
|
||||
//UNNECESSARY. This array is of fixed length, so known at all times.
|
||||
|
@ -672,6 +721,18 @@ player::EvaluateEntity(void)
|
|||
SAVE_STATE(grenadeFireIndex);
|
||||
SAVE_STATE(bGrenadeToss);
|
||||
|
||||
//flKarateBlockCooldown
|
||||
SAVE_STATE(iMeleeCycler);
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[0] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[1] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[2] );
|
||||
SAVE_STATE(fAccuracyKickback);
|
||||
SAVE_STATE(fAccuracyKickbackStartCooldown);
|
||||
|
||||
SAVE_STATE(fMoveBlockDelay);
|
||||
SAVE_STATE(fUncrouchBlockDelay);
|
||||
SAVE_STATE(fKarateStamina);
|
||||
|
||||
|
||||
SAVE_STATE(shotgunReloadIndex);
|
||||
|
||||
|
@ -704,7 +765,9 @@ player::EvaluateEntity(void)
|
|||
//}
|
||||
|
||||
|
||||
myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
//myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
betterID = ary_myWeapons[inventoryEquippedIndex].weaponID;
|
||||
myAmmoType = getAmmoTypeOfWeapon(betterID);
|
||||
if(myAmmoType != -1){
|
||||
i = myAmmoType;
|
||||
//UNNECESSARY. This array is of fixed length, so known at all times.
|
||||
|
@ -830,21 +893,19 @@ player::SendEntity(entity ePEnt, float fChanged)
|
|||
WriteByte(MSG_ENTITY, armor );
|
||||
WriteByte(MSG_ENTITY, iTotalSlots );
|
||||
|
||||
//flKarateBlockCooldown
|
||||
WriteByte(MSG_ENTITY, iMeleeCycler);
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[0] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[1] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[2] );
|
||||
WriteFloat(MSG_ENTITY, fAccuracyKickback);
|
||||
|
||||
|
||||
WriteFloat(MSG_ENTITY, fAccuracyKickbackStartCooldown);
|
||||
|
||||
WriteFloat(MSG_ENTITY, fMoveBlockDelay);
|
||||
WriteFloat(MSG_ENTITY, fUncrouchBlockDelay);
|
||||
WriteFloat(MSG_ENTITY, fKarateStamina);
|
||||
|
||||
|
||||
WriteByte(MSG_ENTITY, iMeleeCycler);
|
||||
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[0] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[1] );
|
||||
//WriteCoord(MSG_ENTITY, vViewAngleOffsetTarget[2] );
|
||||
|
||||
|
||||
WriteByte(MSG_ENTITY, shotgunReloadIndex );
|
||||
WriteFloat(MSG_ENTITY, shotgunAddAmmoTime );
|
||||
|
@ -879,7 +940,9 @@ player::SendEntity(entity ePEnt, float fChanged)
|
|||
if(i != -1){
|
||||
SendEntity_ary_myWeapons(i);
|
||||
|
||||
int myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
//int myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
|
||||
int betterID = ary_myWeapons[inventoryEquippedIndex].weaponID;
|
||||
int myAmmoType = getAmmoTypeOfWeapon(betterID);
|
||||
if(myAmmoType != -1){
|
||||
i = myAmmoType;
|
||||
//UNNECESSARY. This array is of fixed length, so known at all times.
|
||||
|
@ -1005,7 +1068,7 @@ player::player(void){
|
|||
printfline("player: %i", someThingy.player);
|
||||
printfline("reset: %i", someThingy.reset);
|
||||
printfline("View_approachAngleOffsetTarget: %i", someThingy.View_approachAngleOffsetTarget);
|
||||
printfline("handleAccuracyKickback: %i", someThingy.handleAccuracyKickback);
|
||||
printfline("updateTimers: %i", someThingy.updateTimers);
|
||||
printfline("frameThink: %i", someThingy.frameThink);
|
||||
printfline("frameThink_fromServer: %i", someThingy.frameThink_fromServer);
|
||||
printfline("preThink: %i", someThingy.preThink);
|
||||
|
@ -1057,17 +1120,6 @@ player::reset(BOOL resetInventory){
|
|||
|
||||
flRecentGroundTime = 0;
|
||||
|
||||
//TAGGG - BobNEW.
|
||||
// Reset the vars here? Or only on an inventory wipe?
|
||||
pViewBob = &g_viewBobVars[s];
|
||||
pViewBob->m_flBobTime = 0;
|
||||
pViewBob->m_flBob = 0;
|
||||
pViewBob->m_flBobCycle = 0;
|
||||
pViewBob->m_flSpeed = 0;
|
||||
pViewBob->m_vCam = [0,0,0];
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
flViewShake = 0;
|
||||
|
||||
recentLaserHitPosSet = FALSE;
|
||||
|
@ -1090,25 +1142,7 @@ player::reset(BOOL resetInventory){
|
|||
|
||||
|
||||
iMeleeCycler = 0;
|
||||
|
||||
// do this at spawn too. oh right, this 'reset' method is called from there.
|
||||
vViewAngleOffsetTarget = '0 0 0';
|
||||
fAccuracyKickback = 0;
|
||||
fAccuracyKickbackStartCooldown = -1;
|
||||
|
||||
fMoveBlockDelay = -1;
|
||||
fUncrouchBlockDelay = -1;
|
||||
fMoveBlockCapSpeed = 0;
|
||||
fKarateStamina = 1.0;
|
||||
|
||||
flBaseSpeedMulti = 1;
|
||||
flMoveSpeedMulti = 1;
|
||||
flSoundSpeedMulti = 1;
|
||||
flFireDelayMulti = 1;
|
||||
flBulletSpeedMulti = 1;
|
||||
flProjectileSpeedMulti = 1;
|
||||
|
||||
|
||||
//shotgun stuff.
|
||||
//NOTICE - all networked now, testing.
|
||||
|
||||
|
@ -1144,6 +1178,30 @@ player::reset(BOOL resetInventory){
|
|||
|
||||
if(resetInventory){
|
||||
|
||||
|
||||
#ifdef CLIENT
|
||||
//TAGGG - BobNEW.
|
||||
pViewBob = &g_viewBobVars[s];
|
||||
pViewBob_reset();
|
||||
#endif
|
||||
|
||||
// do this at spawn too. oh right, this 'reset' method is called from there.
|
||||
vViewAngleOffsetTarget = [0, 0, 0];
|
||||
fAccuracyKickback = 0;
|
||||
fAccuracyKickbackStartCooldown = -1;
|
||||
|
||||
fMoveBlockDelay = 0;
|
||||
fUncrouchBlockDelay = 0;
|
||||
fMoveBlockCapSpeed = 0;
|
||||
fKarateStamina = 1.0;
|
||||
|
||||
flBaseSpeedMulti = 1;
|
||||
flMoveSpeedMulti = 1;
|
||||
flSoundSpeedMulti = 1;
|
||||
flFireDelayMulti = 1;
|
||||
flBulletSpeedMulti = 1;
|
||||
flProjectileSpeedMulti = 1;
|
||||
|
||||
// could this be done for resets outside of resetInventory? unsure
|
||||
flags = 0;
|
||||
gflags = 0;
|
||||
|
@ -1227,24 +1285,58 @@ player::View_approachAngleOffsetTarget(vector vecInputAngles)
|
|||
}//View_approachAngleOffsetTarget
|
||||
|
||||
|
||||
// TODO - make this better shared probably?
|
||||
|
||||
// little test
|
||||
var float input_timelengthSum = 0;
|
||||
|
||||
// Count down my custom timers, called by ts/src/shared/input.qc, which is called
|
||||
// by Nuclide's PMove, same place that counts down w_attack_next.
|
||||
// Best to put things here that involve input_timelength.
|
||||
void
|
||||
player::handleAccuracyKickback(void){
|
||||
player::updateTimers(void){
|
||||
|
||||
|
||||
|
||||
// good place for this? Cloned from w_attack_next as a separate counter
|
||||
// for akimbo firing to use.
|
||||
w_attack_akimbo_next = max(0, w_attack_akimbo_next - input_timelength);
|
||||
|
||||
akimboDualFireToleranceTime = max(0, akimboDualFireToleranceTime - input_timelength);
|
||||
|
||||
fMoveBlockDelay = max(0, fMoveBlockDelay - input_timelength);
|
||||
fUncrouchBlockDelay = max(0, fUncrouchBlockDelay - input_timelength);
|
||||
|
||||
/*
|
||||
// little test. See input_timelengthSum shoot up with packet latency.
|
||||
input_timelengthSum += input_timelength;
|
||||
if(otherTimer >= 1.0){
|
||||
otherTimer -= 1.0;
|
||||
printfline("input_timelengthSum: %.2f", input_timelengthSum);
|
||||
input_timelengthSum = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
fAccuracyKickbackStartCooldown = max(0, fAccuracyKickbackStartCooldown - input_timelength);
|
||||
|
||||
if(fKarateStamina < 1.0){
|
||||
//fKarateStamina = bound(0, fKarateStamina + frametime * 0.1667, 1);
|
||||
fKarateStamina = bound(0, fKarateStamina + input_timelength * 0.1667, 1);
|
||||
}
|
||||
if(fAccuracyKickbackStartCooldown != -1){
|
||||
if(time >= fAccuracyKickbackStartCooldown){
|
||||
//begin reducing the kickback cumula.
|
||||
fAccuracyKickback -= frametime * 0.1;
|
||||
if(fAccuracyKickbackStartCooldown <= 0){
|
||||
// begin reducing
|
||||
//fAccuracyKickback -= frametime * 0.1;
|
||||
fAccuracyKickback = max(0, fAccuracyKickback - input_timelength);
|
||||
|
||||
if(fAccuracyKickback <= 0){
|
||||
//stop!
|
||||
fAccuracyKickback = 0;
|
||||
// stop!
|
||||
fAccuracyKickbackStartCooldown = -1;
|
||||
}
|
||||
}
|
||||
}//kickbackStartCooldown check
|
||||
|
||||
}
|
||||
}//updateTimers
|
||||
|
||||
|
||||
void
|
||||
|
@ -1519,12 +1611,11 @@ player::frameThink_fromServer(void){
|
|||
printfline("STATUS: %d, %i", activeweapon, inventoryEquippedIndex);
|
||||
}
|
||||
|
||||
// no, leave that to shared/input.qc
|
||||
//updateTimers();
|
||||
|
||||
if(fKarateStamina < 1.0){
|
||||
fKarateStamina = bound(0, fKarateStamina + frametime * 0.1667, 1);
|
||||
}
|
||||
preThinkShared();
|
||||
|
||||
handleAccuracyKickback();
|
||||
|
||||
}// frameThink_fromServer
|
||||
|
||||
|
@ -1619,6 +1710,8 @@ player::preThink(void){
|
|||
}// inventoryEquippedIndex
|
||||
}// w_freeze_idle_next check
|
||||
|
||||
preThinkShared();
|
||||
|
||||
}//preThink
|
||||
|
||||
|
||||
|
@ -1676,6 +1769,27 @@ player::postThink(void){
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
// timer vars modified in here should use 'frametime'.
|
||||
// could/should clframetime be used for clientside intead? Unsure.
|
||||
void
|
||||
player::preThinkShared(void){
|
||||
|
||||
// little test
|
||||
//otherTimer += frametime;
|
||||
|
||||
//changedWeaponRecentlyTimer = max(0, changedWeaponRecentlyTimer - frametime);
|
||||
|
||||
//if(fUncrouchBlockDelay > 0){
|
||||
// printfline("WHAT IS IT %.2f", fUncrouchBlockDelay);
|
||||
//}
|
||||
//fMoveBlockDelay = max(0, fMoveBlockDelay - frametime);
|
||||
//fUncrouchBlockDelay = max(0, fUncrouchBlockDelay - frametime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -21,7 +21,32 @@
|
|||
// Most methods have been changed to player-methods instead, see much further
|
||||
// down. Keeping mine as they are to be inserted as needed.
|
||||
// If they're not called in here, they never get called.
|
||||
|
||||
|
||||
|
||||
|
||||
// This file was the source of the "GamePMove_..." format physics methods.
|
||||
// Now, the new base_player-overridable forms are used.
|
||||
|
||||
// Also, some physics constants can be overridden like so:
|
||||
// #define PMOVE_STEPHEIGHT 18
|
||||
// FreeHL doesn't do anything like that, so assuming original TS did nothing
|
||||
// too special in that regard, but say so if that looks to be the case.
|
||||
|
||||
|
||||
|
||||
// TODO - are the default player and crouch collision bounds still fitting for TS?
|
||||
// Foggy on the details there, could've been some change in height
|
||||
|
||||
|
||||
// First something config-oriented. If uncommented, a modified clone of Nuclide's
|
||||
// base_player::Physics_Crouch (overridden by player) is used to insert the checks for
|
||||
// stopping uncrouching too soon after certain melee attacks. Example: katana melee attack.
|
||||
// Otherwise, a simpler way is done: in player::Physics_InputPreMove, force INPUT_BUTTON8
|
||||
// if the uncrouch block has not expired.
|
||||
//#define UNCROUCHBLOCK_FORKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
@ -51,63 +76,26 @@ const vector VEC_CHULL_MAX = [16,16,18];
|
|||
PMove_Acceleration -> PMoveCustom_Acceleration
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
.float waterlevel;
|
||||
.float watertype;
|
||||
// From Nuclide, needed for cloned crouch logic
|
||||
#define PHY_VIEWPOS [0,0,24]
|
||||
#define PHY_VIEWPOS_CROUCHED [0,0,12]
|
||||
#define PHY_HULL_MIN [-16,-16,-36]
|
||||
#define PHY_HULL_MAX [16,16,36]
|
||||
#define PHY_HULL_CROUCHED_MIN [-16,-16,-18]
|
||||
#define PHY_HULL_CROUCHED_MAX [16,16,18]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// new methods for physics to tap into
|
||||
// WARNING: Far, far too many edits into pmove for this to be feasible yet,
|
||||
// but needed for local slowdown (slow-mo / slow-pause effects) to be effective.
|
||||
float Game_MoveModMulti(player eTarget){
|
||||
return autocvar_movemodmulti;
|
||||
}
|
||||
|
||||
|
||||
float GamePMove_MaxspeedRaw(player target){
|
||||
return ( serverkeyfloat("phy_maxspeed") * 1.0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Don't involve phy_friction anymore! This gives a divisor for that instead.
|
||||
// (returning 0 means nothing happens, just like giving 1 to divide by)
|
||||
float Game_GetFriction(player eTarget){
|
||||
|
||||
if(time <= eTarget.fMoveBlockDelay){
|
||||
// don't move much until this has passed. Further slowdowns need not apply.
|
||||
//return serverkeyfloat("phy_friction") * 3.6;
|
||||
return 0.2777777778;
|
||||
}
|
||||
|
||||
// default, nothing special
|
||||
//return serverkeyfloat("phy_friction");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// This file was the source of the "GamePMove_..." format physics methods.
|
||||
// Now, the new base_player-overridable forms are used.
|
||||
|
||||
// Also, some physics constants can be overridden like so:
|
||||
// #define PMOVE_STEPHEIGHT 18
|
||||
// FreeHL doesn't do anything like that, so assuming original TS did nothing
|
||||
// too special in that regard, but say so if that looks to be the case.
|
||||
|
||||
// I forget if TS did anything too weird about player hitbox height compared
|
||||
// to HL, for instance.
|
||||
|
||||
|
||||
// CHEEZY PROTOTYPE
|
||||
// Prototype for Nuclide methods involved
|
||||
int PMove_IsStuck(entity eTarget, vector vOffset, vector vecMins, vector vecMaxs);
|
||||
int PMoveCustom_Contents(vector org);
|
||||
|
||||
// Prototypes for new helper methods
|
||||
float Game_MoveModMulti(player eTarget);
|
||||
float GamePMove_MaxspeedRaw(player target);
|
||||
float Game_GetFriction(player eTarget);
|
||||
void TS_Physics_LedgeCheck(player pl);
|
||||
|
||||
|
||||
|
||||
// TODO! Is this accurate to TS? Copied from FreeHL.
|
||||
|
@ -145,8 +133,67 @@ player::Physics_Fall(float flDownforce)
|
|||
void
|
||||
player::Physics_Crouch(void)
|
||||
{
|
||||
#ifndef UNCROUCHBLOCK_FORKED
|
||||
// simple simple
|
||||
base_player::Physics_Crouch();
|
||||
#else
|
||||
// would this be better somewhere, in CSQC_InputFrame or Physics_InputPreMove?
|
||||
// probably the latter to make hacking less rewarding
|
||||
// Oh! That actually worked. No need to fork this method then.
|
||||
|
||||
int iFixCrouch = FALSE;
|
||||
if (input_buttons & INPUT_BUTTON8) {
|
||||
flags |= FL_CROUCHING;
|
||||
} else {
|
||||
|
||||
|
||||
if(this.fUncrouchBlockDelay <= 0){
|
||||
if (PMove_IsStuck(this, [0,0,36], PHY_HULL_MIN, PHY_HULL_MAX) == FALSE) {
|
||||
flags &= ~FL_CROUCHING;
|
||||
iFixCrouch = TRUE;
|
||||
}
|
||||
|
||||
}else{
|
||||
flags |= FL_CROUCHING;
|
||||
}
|
||||
|
||||
/*
|
||||
// If we aren't holding down duck anymore and 'attempt' to stand up, prevent it
|
||||
if (flags & FL_CROUCHING) {
|
||||
//TAGGG - only allow uncrouching if uncrouchBlockDelay isn't on.
|
||||
// Surrounded with condition
|
||||
if(this.fUncrouchBlockDelay <= 0){
|
||||
//printfline("uncrouch time? %.2f", time);
|
||||
////////////////////////////////////////////////////////////////////
|
||||
if (PMove_IsStuck(this, [0,0,36], PHY_HULL_MIN, PHY_HULL_MAX) == FALSE) {
|
||||
flags &= ~FL_CROUCHING;
|
||||
iFixCrouch = TRUE;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
} else {
|
||||
flags &= ~FL_CROUCHING;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (flags & FL_CROUCHING) {
|
||||
setsize(this, PHY_HULL_CROUCHED_MIN, PHY_HULL_CROUCHED_MAX);
|
||||
view_ofs = PHY_VIEWPOS_CROUCHED;
|
||||
} else {
|
||||
setsize(this, PHY_HULL_MIN, PHY_HULL_MAX);
|
||||
if (iFixCrouch && PMove_IsStuck(this, [0,0,0], PHY_HULL_MIN, PHY_HULL_MAX)) {
|
||||
for (int i = 0; i < 36; i++) {
|
||||
origin[2] += 1;
|
||||
if (PMove_IsStuck(this, [0,0,0], mins, maxs) == FALSE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
setorigin(this, origin);
|
||||
view_ofs = PHY_VIEWPOS;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -188,66 +235,19 @@ player::Physics_Jump(void)
|
|||
}
|
||||
|
||||
|
||||
// used to be called GamePMove_JumpPressed
|
||||
// Check to see if the player can ascend up a nearby surface interpreted
|
||||
// as a "ledge". At least I think that's what the original TS was going for.
|
||||
// This may even be a little more likely to work than in the original, I don't
|
||||
// think that's too bad.
|
||||
void LedgeCheck(player pl){
|
||||
|
||||
//if(pl.velocity.z != 0 && !(pl.velocity.z >= -45 && pl.velocity.z <= 50)){
|
||||
// printfline("that VELOCITY is bad %.2f", pl.velocity.z);
|
||||
//}
|
||||
|
||||
//&& pl.velocity.z >= -45 && pl.velocity.z <= 50
|
||||
if(
|
||||
!(pl.flags & FL_ONGROUND) &&
|
||||
GET_VIEW_ANGLES.x >= -70 && GET_VIEW_ANGLES.x <= 80
|
||||
&& (pl.velocity.z >= -90 && pl.velocity.z <= 160)
|
||||
){
|
||||
|
||||
makevectors(GET_VIEW_ANGLES);
|
||||
vector v_forward_proj = normalize([v_forward.x, v_forward.y, 0]);
|
||||
|
||||
// Does a line from the bottom of the player model to a little further below
|
||||
// find anything?
|
||||
vector vBottomStart = pl.origin + [0,0,pl.mins.z + 2];
|
||||
vector vBottomDown = pl.origin + [0,0,pl.mins.z - 2];
|
||||
traceline(vBottomStart, vBottomDown, FALSE, pl);
|
||||
if(trace_fraction == 1.0){
|
||||
//printfline("tracetest A");
|
||||
// If not, proceed. Does a line from a little below the player outward
|
||||
// find something?
|
||||
vector vBottomDownForward = vBottomDown + v_forward_proj * (pl.maxs.x * 1.7);
|
||||
|
||||
traceline(vBottomDown, vBottomDownForward, FALSE, pl);
|
||||
if(trace_fraction < 1.0){
|
||||
//ok. And does a line from the top of the model going forwards work?
|
||||
|
||||
vector vTopStart = pl.origin + [0,0,pl.maxs.z + 1];
|
||||
vector vTopForward = vTopStart + v_forward_proj * (pl.maxs.x * 1.7);
|
||||
|
||||
traceline(vTopStart, vTopForward, FALSE, pl);
|
||||
//printfline("tracetest B trace: %.2f", trace_fraction);
|
||||
if(trace_fraction == 1.0){
|
||||
//printfline("tracetest C");
|
||||
//ok! do it
|
||||
pl.velocity.z += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
player::Physics_CheckJump(float premove)
|
||||
{
|
||||
base_player::Physics_CheckJump(premove);
|
||||
|
||||
if(this.movetype == MOVETYPE_NOCLIP){
|
||||
// no ledge checks
|
||||
return;
|
||||
}
|
||||
|
||||
// is this at all a good idea.
|
||||
if (input_buttons & INPUT_BUTTON2){
|
||||
LedgeCheck(this);
|
||||
TS_Physics_LedgeCheck(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -300,13 +300,15 @@ player::Physics_MaxSpeed(void)
|
|||
}
|
||||
|
||||
|
||||
if(time <= this.fMoveBlockDelay){
|
||||
if(this.fMoveBlockDelay > 0){
|
||||
// don't move much until this has passed. Further slowdowns need not apply.
|
||||
// !
|
||||
// "fMoveBlockCapSpeed" must be set by a weapon before it is involved.
|
||||
// Is that the best way to handle this? Being a field in all weapon data would
|
||||
// not make sense though, not much uses this
|
||||
|
||||
targetSpeed = min(targetSpeed, this.fMoveBlockCapSpeed);
|
||||
//targetSpeed *= 0.07;
|
||||
return targetSpeed;
|
||||
}
|
||||
|
||||
|
@ -336,16 +338,29 @@ player::Physics_InputPreMove(void)
|
|||
// input_movevalues *= 0.25;
|
||||
//}
|
||||
|
||||
// also, reduce the up/down noclip movement a bit, no need to be that quite that fast in
|
||||
// most cases
|
||||
if (input_buttons & INPUT_BUTTON2) {
|
||||
input_movevalues[2] *= 0.7;
|
||||
}
|
||||
if (input_buttons & INPUT_BUTTON8) {
|
||||
input_movevalues[2] *= 0.7;
|
||||
}
|
||||
|
||||
}
|
||||
if(this.movetype == MOVETYPE_NOCLIP){
|
||||
// also, reduce the up/down noclip movement a bit, no need to be that quite that fast in
|
||||
// most cases
|
||||
if (input_buttons & INPUT_BUTTON2) {
|
||||
input_movevalues[2] *= 0.7;
|
||||
}
|
||||
if (input_buttons & INPUT_BUTTON8) {
|
||||
input_movevalues[2] *= 0.7;
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
#ifndef UNCROUCHBLOCK_FORKED
|
||||
if(this.fUncrouchBlockDelay > 0 && (flags & FL_CROUCHING)){
|
||||
// still crouched while the time hasn't expired? Keep the crouch
|
||||
input_buttons |= INPUT_BUTTON8;
|
||||
}
|
||||
#endif
|
||||
|
||||
}// noclip check
|
||||
|
||||
}// Physics_InputPreMove
|
||||
|
||||
void
|
||||
player::Physics_InputPostMove(void)
|
||||
|
@ -372,6 +387,13 @@ player::Physics_Run(void)
|
|||
// This call is pretty damn important
|
||||
base_player::Physics_Run();
|
||||
|
||||
|
||||
if(this.movetype == MOVETYPE_NOCLIP){
|
||||
// no custom logic below makes sense for noclip
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// !!!
|
||||
// Copied from PMoveCustom_Categorize / PMove_Categorize, whatever we're calling it,
|
||||
// from Nuclide.
|
||||
|
@ -460,3 +482,95 @@ player::Physics_Run(void)
|
|||
}// Physics_Run
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// !!!
|
||||
// New methods for physics to tap into, helper methods not called by Nuclide
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// WARNING: Far, far too many edits into pmove for this to be feasible yet,
|
||||
// but needed for local slowdown (slow-mo / slow-pause effects) to be effective.
|
||||
float Game_MoveModMulti(player eTarget){
|
||||
return autocvar_movemodmulti;
|
||||
}
|
||||
|
||||
|
||||
float GamePMove_MaxspeedRaw(player target){
|
||||
return ( serverkeyfloat("phy_maxspeed") * 1.0 );
|
||||
}
|
||||
|
||||
|
||||
// Don't involve phy_friction anymore! This gives a divisor for that instead.
|
||||
// (returning 0 means nothing happens, just like giving 1 to divide by)
|
||||
// Noclip doesn't pay attention to friction so don't bother with a check for that
|
||||
float Game_GetFriction(player eTarget){
|
||||
|
||||
if(eTarget.fMoveBlockDelay > 0){
|
||||
// don't move much until this has passed. Further slowdowns need not apply.
|
||||
//return serverkeyfloat("phy_friction") * 3.6;
|
||||
return 0.2777777778;
|
||||
}
|
||||
|
||||
// default, nothing special
|
||||
//return serverkeyfloat("phy_friction");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// used to be called GamePMove_JumpPressed
|
||||
// Check to see if the player can ascend up a nearby surface interpreted
|
||||
// as a "ledge". At least I think that's what the original TS was going for.
|
||||
// This may even be a little more likely to work than in the original, I don't
|
||||
// think that's too bad.
|
||||
void TS_Physics_LedgeCheck(player pl){
|
||||
|
||||
//if(pl.velocity.z != 0 && !(pl.velocity.z >= -45 && pl.velocity.z <= 50)){
|
||||
// printfline("that VELOCITY is bad %.2f", pl.velocity.z);
|
||||
//}
|
||||
|
||||
//&& pl.velocity.z >= -45 && pl.velocity.z <= 50
|
||||
if(
|
||||
!(pl.flags & FL_ONGROUND) &&
|
||||
GET_VIEW_ANGLES.x >= -70 && GET_VIEW_ANGLES.x <= 80
|
||||
&& (pl.velocity.z >= -90 && pl.velocity.z <= 160)
|
||||
){
|
||||
|
||||
makevectors(GET_VIEW_ANGLES);
|
||||
vector v_forward_proj = normalize([v_forward.x, v_forward.y, 0]);
|
||||
|
||||
// Does a line from the bottom of the player model to a little further below
|
||||
// find anything?
|
||||
vector vBottomStart = pl.origin + [0,0,pl.mins.z + 2];
|
||||
vector vBottomDown = pl.origin + [0,0,pl.mins.z - 2];
|
||||
traceline(vBottomStart, vBottomDown, FALSE, pl);
|
||||
if(trace_fraction == 1.0){
|
||||
//printfline("tracetest A");
|
||||
// If not, proceed. Does a line from a little below the player outward
|
||||
// find something?
|
||||
vector vBottomDownForward = vBottomDown + v_forward_proj * (pl.maxs.x * 1.7);
|
||||
|
||||
traceline(vBottomDown, vBottomDownForward, FALSE, pl);
|
||||
if(trace_fraction < 1.0){
|
||||
//ok. And does a line from the top of the model going forwards work?
|
||||
|
||||
vector vTopStart = pl.origin + [0,0,pl.maxs.z + 1];
|
||||
vector vTopForward = vTopStart + v_forward_proj * (pl.maxs.x * 1.7);
|
||||
|
||||
traceline(vTopStart, vTopForward, FALSE, pl);
|
||||
//printfline("tracetest B trace: %.2f", trace_fraction);
|
||||
if(trace_fraction == 1.0){
|
||||
//printfline("tracetest C");
|
||||
//ok! do it
|
||||
pl.velocity.z += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#undef printf
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CLIENT
|
||||
#define printf_starter print("CL")
|
||||
#define printf(s1, ...) print(sprintf(s1, ##__VA_ARGS__))
|
||||
|
@ -79,7 +80,13 @@
|
|||
#define printlinef(s1, ...) print(sprintf("SV: "s1"\n", ##__VA_ARGS__))
|
||||
#endif
|
||||
|
||||
|
||||
// could dummy printouts by enabling this block instead of the above
|
||||
/*
|
||||
#define printf_starter
|
||||
#define printf(s1, ...)
|
||||
#define printfline(s1, ...)
|
||||
#define printlinef(s1, ...)
|
||||
*/
|
||||
|
||||
// Safe way to declare an entity seen in FreeHL. Think of it as:
|
||||
// arg_dest = spawnfunc_ClassNameHere;
|
||||
|
|
|
@ -157,9 +157,6 @@ weapon_base_onPrimaryAttack_melee_fromCustomDirection(
|
|||
vSource = ( pl.origin + pl.view_ofs );
|
||||
traceline( vSource, vSource + ( vTraceDirection * range ), MOVE_HITMODEL, pl );
|
||||
|
||||
// regardless of hitting, delay is set all the same
|
||||
weapon_base_setWholeAttackDelay(pl, baseRef.fAttackDelay);
|
||||
|
||||
|
||||
if ( trace_fraction == 1.0 ) {
|
||||
// did not hit anything
|
||||
|
@ -305,10 +302,6 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
|
|||
|
||||
float angleRange = 115;
|
||||
float finalAng = ( 90 - (angleRange/2) + randoAngFactor*( angleRange ) ) *(M_PI/180);
|
||||
|
||||
// OLD LOC OF setWholeAttackDelay
|
||||
|
||||
//TODO - factor in 'fAccuracyKickback' too. Or a cumulative var really in this case.
|
||||
float baseAcc = baseRef.firestats.fAccuracy;
|
||||
float kickbackToApply = pl.fAccuracyKickback;
|
||||
|
||||
|
@ -391,7 +384,7 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
|
|||
// Properly predicted shotgun firing would be a good demonstration of that too,
|
||||
// so what happens instantly (client sees) and what actually happened (server sees; everyone
|
||||
// else sees) line up.
|
||||
pl.fAccuracyKickbackStartCooldown = time + 0.14;
|
||||
pl.fAccuracyKickbackStartCooldown = 0.14;
|
||||
pl.fAccuracyKickback += baseRef.firestats.fAccuracyKickback;
|
||||
if(pl.fAccuracyKickback >= 0.1){
|
||||
//cap it.
|
||||
|
@ -1559,6 +1552,7 @@ weapon_base_onEquip(
|
|||
|
||||
printfline("weapon_base_onEquip: activeweap:%d sName:%s sName2:%s", pl.activeweapon, baseRef.sDisplayName, g_weapons[pl.activeweapon].name);
|
||||
|
||||
|
||||
#ifdef CLIENT
|
||||
TS_View_SetViewModelFromStats();
|
||||
//sound(pl, CHAN_ITEM, "weapons/draw.wav", 1, ATTN_NORM, 100, SOUNDFLAG_PLAYER_COMMON);
|
||||
|
|
|
@ -129,6 +129,8 @@ w_combatknife_primary(void)
|
|||
weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::COMBATKNIFE];
|
||||
MELEE_HIT_RESPONSE hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::COMBATKNIFE], arg_thisWeapon, baseRef.fAttackDamage, 58);
|
||||
|
||||
weapon_base_setWholeAttackDelay(pl, (ary_weaponData[WEAPON_ID::COMBATKNIFE])->fAttackDelay);
|
||||
|
||||
// Only the server is doing traces so far to get results for this to be worth checking.
|
||||
#ifdef SERVER
|
||||
//printfline("melee hit reponse: %d soft? %d", hitRep, (hitRep==MELEE_HIT_RESPONSE::SOFT));
|
||||
|
|
|
@ -135,8 +135,8 @@ w_karate_primary(void)
|
|||
|
||||
|
||||
weapon_base_setWholeAttackDelay(pl, 0.175f);
|
||||
pl.fMoveBlockDelay = time + 0.09f;
|
||||
//pl.fUncrouchBlockDelay = time + 1.0f;
|
||||
pl.fMoveBlockDelay = 0.09;
|
||||
//pl.fUncrouchBlockDelay = 1.0f;
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -188,13 +188,13 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE& hitRep, int& meleeAni
|
|||
|
||||
curSpeed = vlen(pl.velocity);
|
||||
|
||||
if(input_buttons & INPUT_BUTTON8){
|
||||
if(pl.flags & FL_CROUCHING){
|
||||
//crouching?
|
||||
//spin kick
|
||||
meleeAnimToPlay = 1;
|
||||
hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 40 * pl.fKarateStamina, 72);
|
||||
weapon_base_setWholeAttackDelay(pl, 1);
|
||||
pl.fMoveBlockDelay = time + 1;
|
||||
pl.fMoveBlockDelay = 1.0;
|
||||
pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.25, 1);
|
||||
|
||||
// curSpeed > 160
|
||||
|
@ -215,7 +215,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE& hitRep, int& meleeAni
|
|||
meleeAnimToPlay = 2;
|
||||
hitRep = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 76, -v_forward);
|
||||
weapon_base_setWholeAttackDelay(pl, 1);
|
||||
pl.fMoveBlockDelay = time + 1;
|
||||
pl.fMoveBlockDelay = 1.0;
|
||||
//TAGGG - NOTE. Why is this stamina-loss in original TS so high?
|
||||
// Changing. Original was 67%, but really now? 40% is plenty.
|
||||
// Original TS behavior seesm to scale the stamina lost with the player speed,
|
||||
|
@ -226,7 +226,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE& hitRep, int& meleeAni
|
|||
meleeAnimToPlay = 0;
|
||||
hitRep = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 74, v_forward);
|
||||
weapon_base_setWholeAttackDelay(pl, 0.53);
|
||||
pl.fMoveBlockDelay = time + 0.46;
|
||||
pl.fMoveBlockDelay = 0.46;
|
||||
pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.16, 1);
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE& hitRep, int& meleeAni
|
|||
meleeAnimToPlay = 2;
|
||||
hitRep = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 74, -v_forward);
|
||||
weapon_base_setWholeAttackDelay(pl, 1);
|
||||
pl.fMoveBlockDelay = time + 1;
|
||||
pl.fMoveBlockDelay = 1.0;
|
||||
pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.3, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE& hitRep, int& meleeAni
|
|||
meleeAnimToPlay = 0;
|
||||
hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 66);
|
||||
weapon_base_setWholeAttackDelay(pl, 0.53);
|
||||
pl.fMoveBlockDelay = time + 0.46;
|
||||
pl.fMoveBlockDelay = 0.46;
|
||||
|
||||
// Original behavior was this has the same stamina drain as a punch, but does that really make sense?
|
||||
// A kick has a longer cooldown so it's impossible to run out of stamina just from doing standing kicks.
|
||||
|
@ -282,7 +282,7 @@ w_karate_secondary(void)
|
|||
|
||||
w_karate_determineSecondaryAttack(hitRep, meleeAnimToPlay);
|
||||
|
||||
//pl.fUncrouchBlockDelay = time + 1.0f;
|
||||
pl.fUncrouchBlockDelay = 1.0f;
|
||||
//Animation_ShootWeapon( self );
|
||||
|
||||
#ifdef SERVER
|
||||
|
|
|
@ -128,7 +128,8 @@ w_katana_primary(void)
|
|||
|
||||
pl.fMoveBlockCapSpeed = 4;
|
||||
|
||||
if(input_buttons & INPUT_BUTTON8){
|
||||
// probably better than an input (input_buttons & INPUT_BUTTON8) check
|
||||
if(pl.flags & FL_CROUCHING){
|
||||
//okay, do the crouch attack! Always use slash1 for it, resets cycler.
|
||||
// TODO - the duration of a crouch attack locks the player in crouch, let pmove.c know sometime!!
|
||||
pl.iMeleeCycler = 0;
|
||||
|
@ -137,10 +138,16 @@ w_katana_primary(void)
|
|||
hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon, 80, 72);
|
||||
|
||||
weapon_base_setWholeAttackDelay(pl, 0.70);
|
||||
pl.fMoveBlockDelay = time + 1.0f;
|
||||
pl.fUncrouchBlockDelay = time + 1.0f;
|
||||
pl.fMoveBlockDelay = 1.0f;
|
||||
pl.fUncrouchBlockDelay = 1.0f;
|
||||
|
||||
// So this works now? Or not.
|
||||
#ifdef CLIENT
|
||||
//SAVE_STATE(pl.fUncrouchBlockDelay);
|
||||
#endif
|
||||
|
||||
}else{
|
||||
//Check. Are we moving backwards, enough?? And not looking up/down too far?
|
||||
// Check. Are we moving backwards, enough?? And not looking up/down too far?
|
||||
if(input_movevalues.x < -40 && GET_VIEW_ANGLES.x >= -55 && GET_VIEW_ANGLES.x <= 55){
|
||||
//okay!
|
||||
pl.iMeleeCycler = 0;
|
||||
|
@ -150,16 +157,18 @@ w_katana_primary(void)
|
|||
hitRep = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon, 80, 74, -v_forward);
|
||||
|
||||
weapon_base_setWholeAttackDelay(pl, 0.75);
|
||||
pl.fMoveBlockDelay = time + 1.0f;
|
||||
//pl.fUncrouchBlockDelay = time + 1.0f;
|
||||
pl.fMoveBlockDelay = 1.0f;
|
||||
//pl.fUncrouchBlockDelay = 1.0f;
|
||||
}else{
|
||||
//nothin special
|
||||
// nothin special
|
||||
meleeAnimToPlay = pl.iMeleeCycler;
|
||||
pl.iMeleeCycler++;
|
||||
if(pl.iMeleeCycler >= 2 || pl.iMeleeCycler < 0){
|
||||
pl.iMeleeCycler = 0;
|
||||
}
|
||||
hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon, 80, 66);
|
||||
|
||||
weapon_base_setWholeAttackDelay(pl, (ary_weaponData[WEAPON_ID::KATANA])->fAttackDelay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,6 +121,8 @@ w_sealknife_primary(void)
|
|||
weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::SEALKNIFE];
|
||||
MELEE_HIT_RESPONSE hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::SEALKNIFE], arg_thisWeapon, baseRef.fAttackDamage, 55);
|
||||
|
||||
weapon_base_setWholeAttackDelay(pl, (ary_weaponData[WEAPON_ID::SEALKNIFE])->fAttackDelay);
|
||||
|
||||
// Only the server is doing traces so far to get results for this to be worth checking.
|
||||
#ifdef SERVER
|
||||
//printfline("melee hit reponse: %d soft? %d", hitRep, (hitRep==MELEE_HIT_RESPONSE::SOFT));
|
||||
|
@ -152,7 +154,6 @@ w_sealknife_primary(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
w_sealknife_secondary(void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue