Client: View_EjectShell is now replaced by three different variations.

This commit is contained in:
Marco Cawthorne 2021-03-17 14:34:26 +01:00
parent 69b087c7e4
commit 48d1b1ad0d
5 changed files with 43 additions and 16 deletions

View file

@ -24,7 +24,12 @@ struct
entity m_eViewModel;
entity m_eMuzzleflash;
int m_iVMBones;
int m_iVMEjectBone;
/* viewmodel shell ejection */
float m_fEjectModel;
vector m_vecEjectPos;
vector m_vecEjectVel;
int m_iLastWeapon;
int m_iOldWeapon;
float m_flBobTime;

View file

@ -47,5 +47,4 @@ View_UpdateWeapon(entity vm, entity mflash)
skel_delete(mflash.skeletonindex);
mflash.skeletonindex = skel_create(vm.modelindex);
pSeat->m_iVMBones = skel_get_numbones(mflash.skeletonindex) + 1;
pSeat->m_iVMEjectBone = pSeat->m_iVMBones + 1;
}

View file

@ -89,7 +89,11 @@ drawstring_r(vector p, string t, vector s, vector c, float a, float f)
void GameMessage_Setup(string, int);
void Game_Input(void);
void View_SetMuzzleflash(int);
void View_EjectShell(int, int);
void View_EjectShellBone(int index, int ofs, vector range);
void View_EjectShellAttachment(int index, int ofs, vector range);
void View_EjectShellPos(int index, vector pos, vector range);
void View_PlayAnimation(int);
void View_PlayAnimation(int);
void Vox_Play(string);

View file

@ -27,32 +27,30 @@ Event_EjectShell(void)
static void Event_EjectShell_Death(void) {
remove(self);
}
vector vEndPos;
if (!pSeat->m_fEjectModel)
return;
vector vOrigin = pSeat->m_vecPredictedOrigin + [0, 0, getstatf(STAT_VIEWHEIGHT)];
vector vEndPos = gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMEjectBone);
makevectors(input_angles);
vOrigin += (v_forward * vEndPos[0]);
vOrigin += (v_right * -vEndPos[1]);
vOrigin += (v_up * vEndPos[2]) ;
entity eShell = spawn();
eShell.modelindex = pSeat->m_fEjectModel;
eShell.movetype = MOVETYPE_BOUNCE;
eShell.drawmask = MASK_ENGINE;
eShell.angles = [input_angles[0], input_angles[1], 0];
eShell.angles = [pSeat->m_eViewModel.angles[0], pSeat->m_eViewModel.angles[1], 0];
eShell.velocity = pSeat->m_vecPredictedVelocity;
eShell.velocity += (v_up * random(70, 120));
eShell.velocity += (v_right * -random(50, 70));
makevectors(pSeat->m_eViewModel.angles);
eShell.velocity += (v_forward * pSeat->m_vecEjectVel[0]);
eShell.velocity += (v_right * pSeat->m_vecEjectVel[1]);
eShell.velocity += (v_up * pSeat->m_vecEjectVel[2]);
eShell.avelocity = [0,45,900];
eShell.think = Event_EjectShell_Death;
eShell.nextthink = time + 2.5f;
pSeat->m_fEjectModel = 0;
setsize(eShell, [0,0,0], [0,0,0]);
setorigin(eShell, vEndPos);
setorigin(eShell, pSeat->m_vecEjectPos);
}
/*

View file

@ -49,10 +49,31 @@ View_SetMuzzleflash(int index)
}
void
View_EjectShell(int index, int ofs)
View_EjectShellBone(int index, int ofs, vector range)
{
pSeat->m_fEjectModel = (float)index;
pSeat->m_iVMEjectBone = pSeat->m_iVMBones + 1 + ofs;
pSeat->m_vecEjectPos = gettaginfo(pSeat->m_eViewModel, ofs);
pSeat->m_vecEjectVel = range;
}
void
View_EjectShellAttachment(int index, int ofs, vector range)
{
pSeat->m_fEjectModel = (float)index;
pSeat->m_vecEjectPos = gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMBones + 1 + ofs);
pSeat->m_vecEjectVel = range;
}
void
View_EjectShellPos(int index, vector pos, vector range)
{
makevectors(view_angles);
pSeat->m_fEjectModel = (float)index;
pSeat->m_vecEjectPos = gettaginfo(pSeat->m_eViewModel, 0) + pSeat->m_ePlayer.view_ofs;
pSeat->m_vecEjectPos += v_forward * pos[0];
pSeat->m_vecEjectPos += v_right * pos[1];
pSeat->m_vecEjectPos += v_up * pos[2];
pSeat->m_vecEjectVel = range;
}
void