networked random vm sequences, view.qc reorganization, one-frame-off laser/flashlight fixed, akimbo muzzleflash and shell eject setup/idea

This commit is contained in:
Christopher Dawalt 2021-08-14 05:16:25 -04:00
parent 931d7c72f8
commit 6ba566a616
62 changed files with 936 additions and 864 deletions

View File

@ -29,23 +29,61 @@ extern var string g_damage_spr_r;
void drawPainArrows(void);
void drawPainFlash(void);
void ClientGame_DamageDraw(void);
void Custom_DamageDraw(void);
// WARNING: don't try drawing any 2D things on screen here, they'll be rendered on top of
// and ultimately lost, at least I think that's how it goes
void
ClientGame_PreDraw(void)
{
}
void
Player_HandleWeaponModel(base_player pp, float thirdperson);
// Happens right before the CSQC_RenderScene call seen in Nuclide's client/draw.qc.
// PostDraw further down is too late.
// NOT A NUCLIDE EVENT - called by the end of ViewModel_ApplyBob (viewmodel.qc) so that
// other changes to viewmodel position are already done.
void
Custom_LatePreDraw(void)
{
player pl = (player)pSeat->m_ePlayer;
Player_DrawViewModelCustom(pl);
int thirdperson = (autocvar_cl_thirdperson == TRUE || pl.entnum != player_localentnum);
Player_DrawViewModelExtraEffects(pl, thirdperson);
}
void
ClientGame_PostDraw(void)
{
ClientGame_DamageDraw();
// This is just the right place - occurs right beofre a HUD_Draw call so that the HUD
// is drawn on top of the potentially bright-red pain flash, rather than obscurred by it
Custom_DamageDraw();
// To replicate what Nuclide does for the normal muzzle flash entity in frame-logic:
// reduce the alpha every frame to quickly fade away
entity m_eMuzzleflashAkimbo = pSeatLocal->m_eMuzzleflashAkimbo;
// Take away alpha once it has drawn fully at least once
//printfline("View_PostDraw, muzzleflash? %.2f - %.2f", m_eMuzzleflash.alpha, clframetime);
if (m_eMuzzleflashAkimbo.alpha > 0.0f) {
m_eMuzzleflashAkimbo.alpha -= (clframetime * 16);
}
}
// copied from Nuclide
void
drawPainArrows(void)
@ -118,7 +156,7 @@ drawPainFlash(void)
void
ClientGame_DamageDraw(void){
Custom_DamageDraw(void){
// No alpha, or dead? No pain drawing
if(
@ -128,8 +166,8 @@ ClientGame_DamageDraw(void){
return;
}
drawPainArrows();
drawPainFlash();
drawPainArrows();
// Nuclide's default had no modifier on clframetime ( * 1).
pSeat->m_flDamageAlpha -= clframetime * 1.7;

View File

@ -10,7 +10,8 @@ class CTSShellEject{
void(void) CTSShellEject;
static void(void) precache;
static CTSShellEject(int arg_iShellEjectType) generate;
static CTSShellEject(int arg_iShellEjectType) generateForViewmodel;
static CTSShellEject(int arg_iShellEjectType, vector arg_vOrigin, vector arg_vDir) generate;
static CTSShellEject(int arg_iShellEjectType, vector arg_vOrigin, vector arg_vDir) generate2;
virtual void(void) touch;
};

View File

@ -42,16 +42,10 @@ CTSShellEject::precache(void)
}
// The practical constructor, manually call this after spawning.
// NOTE: assumes pSeat->m_eViewModel is valid for involving in determining
// origin, angles, velocity
CTSShellEject
CTSShellEject::generateForViewmodel(int arg_iShellEjectType)
{
CTSShellEject::generate(int arg_iShellEjectType){
CTSShellEject eShell = spawn(CTSShellEject);
vector vOrigin; // tempvar
eShell.iShellEjectType = arg_iShellEjectType;
//setmodel(eShell, "models/shell.mdl");
@ -75,9 +69,22 @@ CTSShellEject::generateForViewmodel(int arg_iShellEjectType)
eShell.nextthink = time + 10.0f;
setsize(eShell, [0,0,0], [0,0,0]);
// TODO: I think attachments supply a direction too, fuzzy on the details,
// player predraw (client/player.qc) definitely has something like that to put the
// viewmodel laser-start or flashlight sprite glow effect in the right place.
return eShell;
}
// TODO! Take akimbochoice as well.
// That will mean not returning what is generated, which will be fine, that was never used
// anyway. Because this might generate two for dual-fire akimbo
// The practical constructor, manually call this after spawning.
// NOTE: assumes pSeat->m_eViewModel is valid for involving in determining
// origin, angles, velocity
CTSShellEject
CTSShellEject::generateForViewmodel(int arg_iShellEjectType)
{
// give me an origin!
CTSShellEject eShell = CTSShellEject::generate(arg_iShellEjectType);
vector vOrigin;
// FreeHL way (forget all the rest if so)
//vOrigin = pSeat->m_eViewModel.origin + (v_forward * 26) + (v_right * 8) + (v_up * -4);
@ -90,10 +97,10 @@ CTSShellEject::generateForViewmodel(int arg_iShellEjectType)
//vOrigin = pSeat->m_vecPredictedOrigin + [0, 0, getstatf(STAT_VIEWHEIGHT)];
// way #3
// "pSeat->m_iVMBones + 1" gets the first attachment, add more to get other
// attachments, or places on the model that can be helpful to tie into
// Although this is still making shell ejections happen at the end of the muzzle
// and the other attachments just go further out?
// "pSeat->m_iVMBones + 1" gets the 2nd attachment (#1, counting starting at 0),
// add more to get other attachments, or places on the model that can be helpful
// to tie into. Why the example I got a long time ago started at the 2nd attachment,
// no idea
vector vOffset = gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMBones + 1);
printfline("WHAT?! %.2f %.2f %.2f", vOffset[0], vOffset[1], vOffset[2]);
@ -108,7 +115,8 @@ CTSShellEject::generateForViewmodel(int arg_iShellEjectType)
vOrigin = vOffset;
*/
// way #4:
// way #4 (grabs how player predraw, client/player.qc, gets a direction for pushing some effects
// relatively forward/backwards/sideways from 2 attachment positions):
vector gunpos;
vector gunpos_tempEnd;
vector dirGun;
@ -135,13 +143,16 @@ CTSShellEject::generateForViewmodel(int arg_iShellEjectType)
setorigin(eShell, vOrigin);
return eShell;
}
// TODO. For playermodels as seen in thirdperson (local one) or looking at other players
// that called for shell ejecting.
CTSShellEject
CTSShellEject::generate(int arg_iShellEjectType, vector arg_vOrigin, vector arg_vDir){
CTSShellEject::generate2(int arg_iShellEjectType, vector arg_vOrigin, vector arg_vDir){
return NULL;
}
@ -151,7 +162,7 @@ CTSShellEject::touch(void)
if(other == world){
shellejectdata_t* mySED = ary_shellEjectData[iShellEjectType];
// self? this? Is there a difference in this context?
// TODO: should shell-toucch sounds have reduced volume? Unsure
Sound_Play(this, CHAN_BODY, (*mySED).sTouchSound);
// TODO: should shell-touch sounds have reduced volume? Unsure
Sound_Play(this, CHAN_BODY, mySED->sTouchSound);
}
}

View File

@ -18,11 +18,6 @@ void
ClientGame_EventParse(float fHeader)
{
player pl = (player)pSeat->m_ePlayer;
vector vecOrigin;
int iSequence;
float fDuration;
float fIdleEndOffset;
int iType;
// !
// Any need for a m_ePlayer classname check here?
@ -30,10 +25,10 @@ ClientGame_EventParse(float fHeader)
// buymenu spectator (player with that is not PLAYER_STATE::SPAWNED)
switch(fHeader){
case EV_OBITUARY:
case EV_OBITUARY:{
Obituary_Parse();
break;
case EV_SPARK:
}break;
case EV_SPARK:{
vector vSparkPos, vSparkAngle;
vSparkPos[0] = readcoord();
vSparkPos[1] = readcoord();
@ -42,15 +37,15 @@ ClientGame_EventParse(float fHeader)
vSparkAngle[1] = readcoord();
vSparkAngle[2] = readcoord();
FX_Spark(vSparkPos, vSparkAngle);
break;
case EV_GIBHUMAN:
}break;
case EV_GIBHUMAN:{
vector vGibPos;
vGibPos[0] = readcoord();
vGibPos[1] = readcoord();
vGibPos[2] = readcoord();
FX_GibHuman(vGibPos);
break;
case EV_BLOOD:
}break;
case EV_BLOOD:{
vector vBloodPos;
vector vBloodColor;
@ -63,8 +58,8 @@ ClientGame_EventParse(float fHeader)
vBloodColor[2] = readbyte() / 255;
FX_Blood(vBloodPos, vBloodColor);
break;
case EV_EXPLOSION:
}break;
case EV_EXPLOSION:{
vector vExploPos;
vExploPos[0] = readcoord();
@ -72,8 +67,8 @@ ClientGame_EventParse(float fHeader)
vExploPos[2] = readcoord();
FX_Explosion(vExploPos);
break;
case EVENT_TS::FX_TS_EXPLOSION_GRENADE:
}break;
case EVENT_TS::FX_TS_EXPLOSION_GRENADE:{
vector vExploPos2;
vExploPos2[0] = readcoord();
@ -81,8 +76,8 @@ ClientGame_EventParse(float fHeader)
vExploPos2[2] = readcoord();
FX_TS_Explosion_Grenade(vExploPos2);
break;
case EV_MODELGIB:
}break;
case EV_MODELGIB:{
vector vecPos;
vecPos[0] = readcoord();
vecPos[1] = readcoord();
@ -96,9 +91,9 @@ ClientGame_EventParse(float fHeader)
float fStyle = readbyte();
int count = readbyte();
FX_BreakModel(count, vecPos, vSize, [0,0,0], fStyle);
break;
case EV_IMPACT:
//int iType;
}break;
case EV_IMPACT:{
int iType;
vector vOrigin, vNormal;
iType = (int)readbyte();
@ -111,8 +106,8 @@ ClientGame_EventParse(float fHeader)
vNormal[2] = readcoord();
FX_Impact(iType, vOrigin, vNormal);
break;
case EVENT_TS::EV_IMPACT_MELEE:
}break;
case EVENT_TS::EV_IMPACT_MELEE:{
int iType3;
vector vOrigin3;
vector vNormal3;
@ -127,28 +122,28 @@ ClientGame_EventParse(float fHeader)
vNormal3[2] = readcoord();
FX_Impact_Melee(iType3, vOrigin3, vNormal3);
break;
case EV_CHAT:
}break;
case EV_CHAT:{
float fSender = readbyte();
float fTeam = readbyte();
string sMessage = readstring();
CSQC_Parse_Print(sprintf("%s: %s", getplayerkeyvalue(fSender, "name"), sMessage), PRINT_CHAT);
break;
case EV_CHAT_TEAM:
}break;
case EV_CHAT_TEAM:{
float fSender2 = readbyte();
float fTeam2 = readbyte();
string sMessage2 = readstring();
CSQC_Parse_Print(sprintf("[TEAM] %s: %s", getplayerkeyvalue(fSender2, "name"), sMessage2), PRINT_CHAT);
break;
case EV_CHAT_VOX:
}break;
case EV_CHAT_VOX:{
Vox_Play(readstring());
break;
case EV_VIEWMODEL:
}break;
case EV_VIEWMODEL:{
View_PlayAnimation(readbyte());
break;
case EV_WEAPON_PICKUP:
}break;
case EV_WEAPON_PICKUP:{
int w = readbyte();
// NOTE!
@ -165,8 +160,8 @@ ClientGame_EventParse(float fHeader)
*/
HUD_WeaponPickupNotify(w);
break;
case EVENT_TS::SPAWN:
}break;
case EVENT_TS::SPAWN:{
// time to read the config to send in the weapons one-by-one.
deployConfig();
@ -176,38 +171,38 @@ ClientGame_EventParse(float fHeader)
// so that any choice of weapon, same as before or even nothing, will still
// let client/view.qc do the whole viewmodel routine again
pSeat->m_iLastWeapon = -2;
break;
case EVENT_TS::RESET_VIEW_MODEL:
}break;
case EVENT_TS::RESET_VIEW_MODEL:{
EV_TS_resetViewModel();
break;
case EVENT_TS::RESET_PLAYER:
}break;
case EVENT_TS::RESET_PLAYER:{
int resetInventory = readbyte();
EV_TS_resetPlayer(pl, resetInventory);
break;
case EVENT_TS::PLAYER_DEATH:
}break;
case EVENT_TS::PLAYER_DEATH:{
EV_PlayerDeath();
break;
case EVENT_TS::EQUIP_CALLBACK:
}break;
case EVENT_TS::EQUIP_CALLBACK:{
EV_EquipCallback();
break;
case EVENT_TS::SOUNDPITCHED:
}break;
case EVENT_TS::SOUNDPITCHED:{
SoundPitched_Receive();
break;
case EVENT_TS::SOUNDPITCHED_CHANNEL:
}break;
case EVENT_TS::SOUNDPITCHED_CHANNEL:{
SoundPitched_Channel_Receive();
break;
}break;
/*
// can this even happen anymore?
// If a drop-weapon call can be signaled by the server, not shared with the
// client and server reaching a drop call independently, then yes.
case EVENT_TS::DROP_WEAPON:
case EVENT_TS::DROP_WEAPON:{
EV_TS_playerDropWeapon(pl);
break;
}break;
*/
case EVENT_TS::TEST:
case EVENT_TS::TEST:{
//printfline("EVENT_TS::TEST HAPPENED");
//clearscene();
break;
}break;
}
}

View File

@ -84,10 +84,11 @@ HUD_Draw(void)
//TAGGG - NEw
//////////////////////////////////////////////////////////////
//View_HandleZoom();
// moved to shared/player.qc, clientside player::preThink
//TS_View_HandleZoom();
//printfline("SCOPE LEVEL %.2f", pl.flZoomCurrent);
if(pl.flZoomCurrent < 0.5){ //is this < 40? yes.
if(pl.flZoomCurrent < 0.5){ //is this < 40/80 mag? yes.
HUD_DrawScope();
}else{
// We'll leave details like extra details for the lasersight and the
@ -122,7 +123,7 @@ HUD_Draw(void)
// (draw.qc) instead. Might stop the pain flash from affecting the color of
// HUD draw's.
//Damage_Draw();
//ClientGame_DamageDraw();
//Custom_DamageDraw();
}else{
// Fake spectator, or the temporary forced third-person on death (not yet implemented).

View File

@ -145,6 +145,24 @@ ClientGame_InitDone(void)
{
}
// keeping this here, not called by Nuclide but to be obvious what it's mirroring.
// Sets up the akimbo muzzleflash entity as Nuclide would have:
void
Custom_ViewInit(void){
int s;
for (s = g_seats.length; s-- > numclientseats;) {
pSeatLocal = &g_seatslocal[s];
if(!pSeatLocal->m_eMuzzleflashAkimbo){
pSeatLocal->m_eMuzzleflashAkimbo = spawn();
pSeatLocal->m_eMuzzleflashAkimbo.classname = "mflash";
pSeatLocal->m_eMuzzleflashAkimbo.renderflags = RF_ADDITIVE;
pSeatLocal->m_eMuzzleflashAkimbo.effects |= EF_NOSHADOW;
setsize(pSeatLocal->m_eMuzzleflashAkimbo, [0,0,0], [0,0,0]);
}
}
}
void
ClientGame_RendererRestart(string rstr)
{
@ -169,7 +187,7 @@ ClientGame_RendererRestart(string rstr)
numclientseats_highest = numclientseats;
}
Custom_ViewInit();
// Hook into precache.qc
ClientGame_Precache();

3
src/client/player.h Normal file
View File

@ -0,0 +1,3 @@
void Player_DrawViewModelCustom(player pl);
void Player_DrawViewModelExtraEffects(player pl, int thirdperson);

View File

@ -122,11 +122,13 @@ Player_HandleWeaponModel(base_player pp, float thirdperson)
/* set the new skeletonindex */
pl.p_model.skeletonindex = skel_create(pl.p_model.modelindex);
/* hack this thing in here FIXME: this should be done when popping in/out of a pvs */
if (autocvar(cl_himodels, 1, "Use high-quality player models over lower-definition ones"))
setcustomskin(self, "", "geomset 0 2\n");
else
setcustomskin(self, "", "geomset 0 1\n");
//TAGGG - change. Pretty sure TS has nothing like hi models
// hack this thing in here FIXME: this should be done when popping in/out of a pvs
//if (autocvar(cl_himodels, 1, "Use high-quality player models over lower-definition ones"))
// setcustomskin(self, "", "geomset 0 2\n");
//else
// setcustomskin(self, "", "geomset 0 1\n");
}
/* follow player at all times */
@ -169,6 +171,86 @@ Player_DestroyWeaponModel(entity pp)
// implementation parameter names if that ever happened.
void
Player_PreDraw(base_player pp, int thirdperson)
{
player pl = (player)pp;
// OLD WAY. Now called from draw.c's Custom_LatePreDraw to avoid a one-frame-lag issue
// on lasersight/flashlight effects
//Player_DrawViewmodelExtraEffects(pl, thirdperson);
pl.Physics_SetViewParms();
Animation_PlayerUpdate((player)pl);
Animation_TimerUpdate((player)pl, clframetime);
Player_HandleWeaponModel(pl, thirdperson);
}
// NEW, helper method, not called by Nuclide
// Does the same Nuclide script to draw the normal viewmodel at viewzooms between 0.5
// and 1.0, Nuclide skips drawing it on any zoom below 1.0 unlike original TS.
// Also, handles drawing the akimbo muzzle flash.
void
Player_DrawViewModelCustom(player pl){
// Same forbidding conditions from Nuclide's src/client/view.qc
if (pl.health <= 0) {
return;
}
if (cvar("r_drawviewmodel") == 0 || autocvar_cl_thirdperson == TRUE) {
return;
}
// Nuclide does not draw the viewmodel at any zoom other than 1.0 (unmodified).
// So, this draws the viewmodel the othertimes TS did, in lower zoom choices.
// At viewzoom 0.5 and above, the scope graphic is not drawn so it is safe to
// do this.
if(pl.viewzoom >= 0.5){
entity m_eViewModel = pSeat->m_eViewModel;
entity m_eMuzzleflash = pSeat->m_eMuzzleflash;
entity m_eMuzzleflashAkimbo = pSeatLocal->m_eMuzzleflashAkimbo;
// (only re-do the default Nuclide viewmodel + normal muzzleflash script if we have reason
// to believe Nuclide didn't, i.e., a zoom under 1.0)
if(pl.viewzoom < 1.0){
// CLONE OF NUCLIDE SCRIPT
/////////////////////////////////////////////////////////////////////////////
if (m_eMuzzleflash.alpha > 0.0f) {
makevectors(getproperty(VF_ANGLES));
m_eMuzzleflash.origin = gettaginfo(m_eViewModel, m_eMuzzleflash.skin);
m_eMuzzleflash.angles = m_eViewModel.angles;
m_eMuzzleflash.angles[2] += (random() * 10) - 5;
/*dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 400 * m_eMuzzleflash.alpha, [1,0.45,0]);*/
setorigin(m_eMuzzleflash, m_eMuzzleflash.origin);
addentity(m_eMuzzleflash);
}
setorigin(m_eViewModel, m_eViewModel.origin);
addentity(m_eViewModel);
/////////////////////////////////////////////////////////////////////////////
}
// Regardless of being 1.0 or not (Nuclide certainly isn't doing this),
// handle the other muzzleflash too
if (m_eMuzzleflashAkimbo.alpha > 0.0f) {
makevectors(getproperty(VF_ANGLES));
m_eMuzzleflashAkimbo.origin = gettaginfo(m_eViewModel, m_eMuzzleflashAkimbo.skin);
m_eMuzzleflashAkimbo.angles = m_eViewModel.angles;
m_eMuzzleflashAkimbo.angles[2] += (random() * 10) - 5;
/*dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 400 * m_eMuzzleflashAkimbo.alpha, [1,0.45,0]);*/
setorigin(m_eMuzzleflashAkimbo, m_eMuzzleflashAkimbo.origin);
addentity(m_eMuzzleflashAkimbo);
}
}
}
// another helper method
// Draw the lasersight, and flashlight effects
void
Player_DrawViewModelExtraEffects(player pl, int thirdperson)
{
//int thirdperson = (autocvar_cl_thirdperson == TRUE || this.entnum != player_localentnum);
//base_player pp = (base_player)this;
@ -176,7 +258,7 @@ Player_PreDraw(base_player pp, int thirdperson)
BOOL canRenderFlashlight = FALSE;
BOOL canRenderLaserSight = FALSE;
player pl = (player)pp;
//player pl = (player)pp;
//we're going to use the buyopts of our current weapon + the one actually turned on, yah?
// DEBUG: printouts about the other player.
@ -571,9 +653,10 @@ Player_PreDraw(base_player pp, int thirdperson)
pl.recentLaserHitPosSet = FALSE;
}//END OF canRenderLaserSight || canRenderFlashlight
pl.Physics_SetViewParms();
Animation_PlayerUpdate((player)pl);
Animation_TimerUpdate((player)pl, clframetime);
Player_HandleWeaponModel(pl, thirdperson);
}

View File

@ -1,6 +1,11 @@
#pragma target fte
#pragma progs_dat "../../csprogs.dat"
//---WARNINGS DISABLED---
#pragma warning disable Q302 /*uninitialised locals*/
/////////////////////////////////////////////////////////////////
#define CSQC
#define CLIENT
#define TS
@ -37,6 +42,7 @@ entity/ts_shelleject.h
clientinfo.h
seatlocal.h
player.h
precache.h
ui.h

View File

@ -7,6 +7,13 @@
struct
{
// Clone of the Nuclide muzzleflash so that dual akimbo fire (both at the same time)
// can be shown.
// No need to handle Event_ProcessModel - TS doesn't even have model events for muzzle
// flashes, modify the way of setting up muzzleflash-related variables to support this
// when needed.
entity m_eMuzzleflashAkimbo;
// PENDING - probably safe to remove these
int m_iHealthOld;
float m_flHealthAlpha;

View File

@ -5,9 +5,9 @@
void
pSeatLocal_init(void)
{
pSeatLocal->m_eMuzzleflashAkimbo = NULL;
pSeatLocal->m_flUI_Display = UI_SCREEN::NONE;
pSeatLocal->m_inputKeyTapped = 0;
pSeatLocal->m_inputKeyDown = 0;
pSeatLocal->m_inputMouseClicked = FALSE;

View File

@ -139,14 +139,11 @@ UI_ChangeScreen(UI_SCREEN arg_NewScreenID)
}
// helper method to load the MoTD text from the server into this client's memory
void
UI_Init(void)
{
UI_loadMOTD(void){
int iMOTDLength;
int i;
int s;
// First load the MESSAGE OF THE DAY from the sever
//sMOTD_total = serverkey("motd_total");
@ -166,6 +163,15 @@ UI_Init(void)
// NOPE! Let this be handled elsewhere in case of a different color choice!
//sMOTD_total = strcat("^xFA0", sMOTD_total);
}
void
UI_Init(void)
{
int s;
UI_loadMOTD();
// someVar = loadMapDescription();
loadMapDescription();

View File

@ -1,10 +1,12 @@
void TS_SetViewModelFromStats(void);
void View_RoutineCheck(void);
void View_UpdateWeapon(entity vm, entity mflash);
void resetViewModel(void);
void View_HandleZoom(void);
void View_ShowMuzzleflash(int index);
void View_ShowMuzzleflashAkimbo(int index);
void TS_View_SetViewModelFromStats(void);
void TS_View_RoutineCheck(void);
void TS_View_ChangeViewModelPost(void);
void TS_View_ResetViewModel(void);
void TS_View_HandleZoom(void);

View File

@ -15,22 +15,115 @@
*/
// Also, Nuclide offers Weapons_SetGeomset for calling "setcustomskin" too, but one string
// Nuclide offers Weapons_SetGeomset for calling "setcustomskin" too, but one string
// at a time. Don't really know if that way or the current way (cumulative string for
// many commands delimited in one setcustomskin call) is any better, so leaving this as
// it is for now.
// vm is pSeat->m_eViewModel passed along from Nuclide's View_DrawViewModel
void
TS_SetViewModelFromStats(void)
View_UpdateWeapon(entity vm, entity mflash)
{
player pl = (player)pSeat->m_ePlayer;
if(autocvar_cl_printoutspam == 1){
printfline("STATUS: %i==%d - %i", pSeat->m_iLastWeapon, pl.activeweapon, pl.inventoryEquippedIndex);
}
/* only bother upon change */
if (pSeat->m_iLastWeapon == pl.activeweapon) {
/*
if(pl.activeweapon == 0 && pl.inventoryEquippedIndex != -1){
// what??
pl.setInventoryEquippedIndex(pl.inventoryEquippedIndex);
}else{
TS_View_RoutineCheck();
return;
}
*/
TS_View_RoutineCheck();
return;
}
printfline("View_UpdateWeapon: change detected: %i -> %d", pSeat->m_iLastWeapon, pl.activeweapon);
printfline("and how about the others %d %i", pl.activeweapon, pl.inventoryEquippedIndex);
pSeat->m_iOldWeapon = pSeat->m_iLastWeapon;
pSeat->m_iLastWeapon = pl.activeweapon;
if (!pl.activeweapon /*|| pl.inventoryEquippedIndex < 0*/) {
// can't work with this!
TS_View_ResetViewModel();
return;
}
//printfline("View_UpdateWeapon: change: %d vs %d", pSeat->m_iLastWeapon, pl.activeweapon);
// Call this to do a few other things for any weapon change
TS_Weapon_Draw_extra();
// hack, we changed the wep, move this into Game_Input/PMove
// ... And yes, it seems this bound check is indeed needed, zany sync issues.
if(pl.inventoryEquippedIndex != -1){
Weapons_Draw();
}
TS_View_ChangeViewModelPost();
}
//TAGGG - NEW. Similar to Nuclide's provided "View_SetMuzzleflash", but also acts
// as though the first frame were an event by doing the same lines as a 5000-ish
// event. This is because TS weapons don't have events for the muzzle flash
// unlike HL ones, must be hardcoded to show up.
// Figuring out what muzzle flash for what weapon will come another time.
// For now using the same HL set, but TS comes with some muzzle-flash looking sprites.
// ALSO - for now, always assuming attachment #0.
// For the model event in case that changes, see Nuclide's src/client/modelevent.qc,
// Event_ProcessModel.
void
View_ShowMuzzleflash(int index)
{
pSeat->m_eMuzzleflash.modelindex = (float)index;
// Event_ProcessModel: force it.
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;
// attachment #0 is m_iVMBones + 0. Add for #1 to #3, I think.
// No idea if any weapons play with attachments, #0 should always
// be the end of the weapon for flashes
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 0;
}
void
View_ShowMuzzleflashAkimbo(int index)
{
pSeatLocal->m_eMuzzleflashAkimbo.modelindex = (float)index;
// Event_ProcessModel: force it.
pSeatLocal->m_eMuzzleflashAkimbo.alpha = 1.0f;
pSeatLocal->m_eMuzzleflashAkimbo.scale = 0.25;
// akimbo attachments are in pairs:
// 0 on one weapon, 1 further out along that weapon's direction,
// 2 on the other weapon, 3 further along the other weapon's direction.
// ALSO: on akimbo weapons, attachments 0 and 1 are for the right weapon,
// 1 and 2 for the left.
pSeatLocal->m_eMuzzleflashAkimbo.skin = pSeat->m_iVMBones + 2;
}
void
TS_View_SetViewModelFromStats(void)
{
player pl = (player)pSeat->m_ePlayer;
entity vm = pSeat->m_eViewModel;
entity mflash = pSeat->m_eMuzzleflash;
entity mflashAkimbo = pSeatLocal->m_eMuzzleflashAkimbo;
weapondata_basic_t* basicP;
weapondynamic_t dynaRef;
printfline("TS_SetViewModelFromStats: I happen? activeweap:%d", pl.activeweapon);
printfline("TS_View_SetViewModelFromStats: I happen? activeweap:%d", pl.activeweapon);
basicP = pl.getEquippedWeaponData();
dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -83,40 +176,28 @@ TS_SetViewModelFromStats(void)
}
}//END OF gun type check (is a gun of some sort)
if(dynaRef.forceBodygroup1Submodel > 0){
cumulativeCommandString = sprintf("%sgeomset 0 %i\n", cumulativeCommandString, dynaRef.forceBodygroup1Submodel );
if(dynaRef.iForceBodygroup1Submodel > 0){
cumulativeCommandString = sprintf("%sgeomset 0 %i\n", cumulativeCommandString, dynaRef.iForceBodygroup1Submodel );
}
// no need to do that geomset with the same value again.
pl.prev_forceBodygroup1Submodel = dynaRef.forceBodygroup1Submodel;
pl.prev_iForceBodygroup1Submodel = dynaRef.iForceBodygroup1Submodel;
setcustomskin(vm, "", cumulativeCommandString);
// leftovers following a draw call, that likely lead here to begin with.
SAVE_STATE(pl.w_attack_next);
SAVE_STATE(pl.w_idle_next);
SAVE_STATE(pl.viewzoom);
SAVE_STATE(pl.weapontime);
//TAGGG - NEW VAR
SAVE_STATE(pl.w_attack_akimbo_next);
SAVE_STATE(pl.flZoomTarget);
skel_delete( mflash.skeletonindex );
mflash.skeletonindex = skel_create( vm.modelindex );
pSeat->m_iVMBones = skel_get_numbones( mflash.skeletonindex ) + 1;
TS_View_ChangeViewModelPost();
// Don't let View_UpdateWeapon do this all over.
pSeat->m_iLastWeapon = pl.activeweapon;
}//TS_View_SetViewModelFromStats
}//TS_SetViewModelFromStats
// On any frame, see if something about the current viewmodel needs to be changed
void
View_RoutineCheck(void)
TS_View_RoutineCheck(void)
{
player pl = (player)pSeat->m_ePlayer;
entity vm = pSeat->m_eViewModel;
weapondynamic_t dynaRef;
@ -128,89 +209,42 @@ View_RoutineCheck(void)
dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.prev_forceBodygroup1Submodel != dynaRef.forceBodygroup1Submodel){
if(pl.prev_iForceBodygroup1Submodel != dynaRef.iForceBodygroup1Submodel){
if(dynaRef.forceBodygroup1Submodel > 0){
if(dynaRef.iForceBodygroup1Submodel > 0){
string commandString;
commandString = sprintf("geomset 0 %i\n", dynaRef.forceBodygroup1Submodel );
commandString = sprintf("geomset 0 %i\n", dynaRef.iForceBodygroup1Submodel );
setcustomskin(vm, "", commandString);
}
pl.prev_forceBodygroup1Submodel = dynaRef.forceBodygroup1Submodel;
pl.prev_iForceBodygroup1Submodel = dynaRef.iForceBodygroup1Submodel;
}
}//View_RoutineCheck
}//TS_View_RoutineCheck
// vm is pSeat->m_eViewModel passed along from Nuclide's View_DrawViewModel
// Used to be in View_UpdateWeapon, now also called for manual changes clientside too
// (TS_View_SetViewModelFromStats above).
void
View_UpdateWeapon(entity vm, entity mflash)
TS_View_ChangeViewModelPost(void)
{
player pl = (player)pSeat->m_ePlayer;
entity vm = pSeat->m_eViewModel;
entity mflash = pSeat->m_eMuzzleflash;
entity mflashAkimbo = pSeatLocal->m_eMuzzleflashAkimbo;
if(autocvar_cl_printoutspam == 1){
printfline("STATUS: %i==%d - %i", pSeat->m_iLastWeapon, pl.activeweapon, pl.inventoryEquippedIndex);
}
/* only bother upon change */
if (pSeat->m_iLastWeapon == pl.activeweapon) {
/*
if(pl.activeweapon == 0 && pl.inventoryEquippedIndex != -1){
// what??
pl.setInventoryEquippedIndex(pl.inventoryEquippedIndex);
}else{
View_RoutineCheck();
return;
}
*/
View_RoutineCheck();
return;
}
printfline("View_UpdateWeapon: change detected: %i -> %d", pSeat->m_iLastWeapon, pl.activeweapon);
printfline("and how about the others %d %i", pl.activeweapon, pl.inventoryEquippedIndex);
pSeat->m_iOldWeapon = pSeat->m_iLastWeapon;
pSeat->m_iLastWeapon = pl.activeweapon;
if (!pl.activeweapon /*|| pl.inventoryEquippedIndex < 0*/) {
// can't work with this!
resetViewModel();
return;
}
//printfline("View_UpdateWeapon: change: %d vs %d", pSeat->m_iLastWeapon, pl.activeweapon);
// Call this to do a few other things for any weapon change
TS_Weapon_Draw_extra();
// hack, we changed the wep, move this into Game_Input/PMove
//... And yes, it seems this bound check is indeed needed, zany sync issues.
if(pl.inventoryEquippedIndex != -1){
Weapons_Draw();
}
//No longer a var! Oops
//pSeat->m_iVMEjectBone = pSeat->m_iVMBones + 1;
/* we forced a weapon call outside the prediction,
* thus we need to update all the net variables to
* make sure these updates are recognized. this is
* vile but it'll have to do for now */
SAVE_STATE(pl.w_attack_next);
SAVE_STATE(pl.w_idle_next);
SAVE_STATE(pl.viewzoom);
SAVE_STATE(pl.weapontime);
//TAGGG - NEW VAR.
//TAGGG - NEW VAR
SAVE_STATE(pl.w_attack_akimbo_next);
SAVE_STATE(pl.flZoomTarget);
//TAGGG - also new line. It is a good idea to reset the event
// on changing models, right?
pSeat->m_pEventCall = NULL;
@ -219,43 +253,55 @@ View_UpdateWeapon(entity vm, entity mflash)
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);
// 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)
}
}//TS_View_ChangeViewModelPost
void
resetViewModel(void)
TS_View_ResetViewModel(void)
{
printfline("resetViewModel called.");
printfline("TS_View_ResetViewModel called.");
if(pSeat->m_ePlayer == NULL){
printfline("resetViewModel: early end #1, client ent NULL");
printfline("TS_View_ResetViewModel: early end #1, client ent NULL");
return;
}
//was m_eViewModel and m_eMuzzleflash
// was m_eViewModel and m_eMuzzleflash
entity vm = pSeat->m_eViewModel;
entity mflash = pSeat->m_eMuzzleflash;
entity mflashAkimbo = pSeatLocal->m_eMuzzleflashAkimbo;
setmodel( vm, "" );
skel_delete( mflash.skeletonindex );
mflash.skeletonindex = 0; //er wat. would -1 be better or not?
mflash.skeletonindex = 0;
pSeat->m_iVMBones = 0 + 1;
//pSeat->m_iVMEjectBone = pSeat->m_iVMBones + 1;
// ! If the skeletonindex becomes shared, skel_delete for each will not be necessary
skel_delete(mflashAkimbo.skeletonindex);
mflashAkimbo.skeletonindex = 0;
/*
player pl = (player) pSeat->m_ePlayer;
pl.setInventoryEquippedIndex(-1); //do we have to?
*/
}// resetViewModel
}// TS_View_ResetViewModel
//TAGGG - loaned from The Wastes.
void View_HandleZoom(void){
void TS_View_HandleZoom(void)
{
player pl = (player)pSeat->m_ePlayer;
if(pl == NULL){
@ -323,28 +369,3 @@ void View_HandleZoom(void){
}
//TAGGG - NEW. Similar to Nuclide's provided "View_SetMuzzleflash", but also acts
// as though the first frame were an event by doing the same lines as a 5000-ish
// event. This is because TS weapons don't have events for the muzzle flash
// unlike HL ones, must be hardcoded to show up.
// Figuring out what muzzle flash for what weapon will come another time.
// For now using the same HL set, but TS comes with some muzzle-flash looking sprites.
// ALSO - for now, always assuming attachment #0.
// For the model event in case that changes, see Nuclide's src/client/modelevent.qc,
// Event_ProcessModel.
void
View_ShowMuzzleflash(int index)
{
pSeat->m_eMuzzleflash.modelindex = (float)index;
// Event_ProcessModel: force it.
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;
// attachment #0 is m_iVMBones + 0. Add for #1 to #3, I think.
// No idea if any weapons play with attachments, #0 should always
// be the end of the weapon for flashes
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 0;
}

View File

@ -165,6 +165,9 @@ Viewmodel_CalcBob(void)
setVCam();
}
void Custom_LatePreDraw(void);
//TAGGG - BobNEW. REPLACED.
void
Viewmodel_ApplyBob(entity gun)
@ -176,4 +179,6 @@ Viewmodel_ApplyBob(entity gun)
gun.origin += v_right * (autocvar_v_gunofs[1] + (pViewBob->m_flBob * (-0.2 + 0.308 * sin(pViewBob->m_flBobCycle)) ) + 0.98 * pViewBob->m_vCam[1] );
gun.origin += v_up * (0.5 + autocvar_v_gunofs[2] + (pViewBob->m_flBob * (-0.48 + 0.196 * fabs(sin(pViewBob->m_flBobCycle)) )) + 0.98 * pViewBob->m_vCam[2] );
//TAGGG - mock-event
Custom_LatePreDraw();
}

View File

@ -7,8 +7,9 @@
void CTSThrownProjectile::CTSThrownProjectile(void){
void
CTSThrownProjectile::CTSThrownProjectile(void)
{
CTSWorldGun::CTSWorldGun();
startAngularVelocityDelay = -1;
@ -21,22 +22,25 @@ void CTSThrownProjectile::CTSThrownProjectile(void){
}
CTSThrownProjectile CTSThrownProjectile::generate(player arg_player, int arg_weaponID){
CTSThrownProjectile
CTSThrownProjectile::generate(player arg_player, int arg_weaponID)
{
weapondynamic_t dynaRefPRE = arg_player.ary_myWeapons[arg_weaponID];
return CTSThrownProjectile::generate2(arg_player, dynaRefPRE);
}
// Static method called from elsewhere to create and initialize a
// weapon drop entity, given a player and what weapon to copy information from.
CTSThrownProjectile CTSThrownProjectile::generate2(player arg_player, weapondynamic_t dynaRefPRE){
CTSThrownProjectile
CTSThrownProjectile::generate2(player arg_player, weapondynamic_t dynaRefPRE)
{
CTSThrownProjectile eDrop = spawn(CTSThrownProjectile);
//eDrop.setup(arg_player, arg_weaponID);
//weapondynamic_t dynaRefPRE = arg_player.ary_myWeapons[arg_weaponID];
weapondata_basic_t* basicPointerPRE = (weapondata_basic_t*) ary_weaponData[dynaRefPRE.weaponID];
weapondata_basic_t basicRefPRE = *(basicPointerPRE);
weapondata_throwable_t throwableRef = *((weapondata_throwable_t*)basicPointerPRE);
weapondata_basic_t* basicP = (weapondata_basic_t*) ary_weaponData[dynaRefPRE.weaponID];
weapondata_throwable_t* throwableP = ((weapondata_throwable_t*)basicP);
makevectors( arg_player.v_angle );
@ -45,7 +49,7 @@ CTSThrownProjectile CTSThrownProjectile::generate2(player arg_player, weapondyna
eDrop.solid = SOLID_TRIGGER; //or CORPSE
setorigin( eDrop, arg_player.origin + arg_player.view_ofs + v_forward * 16 );
setmodel( eDrop, basicRefPRE.sWorldModelPath );
setmodel( eDrop, throwableP->sWorldModelPath );
//printfline("CTSThrownProjectile::generate2 v_up: %.2f %.2f %.2f", v_up.x, v_up.y, v_up.z);
@ -54,9 +58,9 @@ CTSThrownProjectile CTSThrownProjectile::generate2(player arg_player, weapondyna
//eDrop.velocity = arg_player.velocity + v_forward * 256;
// relying on the 'makevectors' call from earlier!
vector vDir = aim ( arg_player, 100000 );
//eDrop.velocity = ( arg_player.velocity + vDir * throwableRef.fThrowSpeed );
//eDrop.velocity = ( arg_player.velocity + vDir * throwableP->fThrowSpeed );
// we'll let player velocity influence the knives a little..
eDrop.velocity = ( arg_player.velocity*0.4 + vDir * throwableRef.fThrowSpeed );
eDrop.velocity = ( arg_player.velocity*0.4 + vDir * throwableP->fThrowSpeed );
//modify the vector we send a bit...
@ -83,7 +87,7 @@ CTSThrownProjectile CTSThrownProjectile::generate2(player arg_player, weapondyna
// "use" does nothing to me... yet.
eDrop.PlayerUse = NULL;
eDrop.gravity = throwableRef.fThrowGravity;
eDrop.gravity = throwableP->fThrowGravity;
eDrop.copyFrom2(arg_player, dynaRefPRE);
@ -105,12 +109,12 @@ CTSThrownProjectile CTSThrownProjectile::generate2(player arg_player, weapondyna
// it worldspawn anyway.
// W. H. A. T.
//TAGGG - TODO. then. apparently.
//setsize( eKnife, '-1.7 -1.7 -1.7', '1.7 1.7 1.7' );
//setsize( eKnife, '-1.4 -1.4 -1.4', '1.4 1.4 1.4' );
//setsize( eKnife, '-1 -1 -1', '1 1 1' );
setsize( eDrop, '-1 -1 0', '1 1 1' );
//setsize( eKnife, [-1.7, -1.7, -1.7], [1.7, 1.7, 1.7] );
//setsize( eKnife, [-1.4, -1.4, -1.4], [1.4, 1.4, 1.4] );
//setsize( eKnife, [-1, -1, -1], [1, 1, 1] );
setsize( eDrop, [-1, -1, 0], [1, 1, 1] );
//setsize( eDrop, '-16 -16 0', '16 16 16' );
//setsize( eDrop, [-16, -16, 0], [16, 16, 16] );
//And lastly, assume I need to expire at some point.
@ -126,10 +130,14 @@ CTSThrownProjectile CTSThrownProjectile::generate2(player arg_player, weapondyna
eDrop.friction = 0.78;
return eDrop;
}//END OF generate
}// generate
void CTSThrownProjectile::becomePickupable(BOOL becomeStuck, optional vector dir, optional entity stuckTo, optional BOOL touchedBreakableGlass){
void
CTSThrownProjectile::becomePickupable(
BOOL becomeStuck, optional vector dir, optional entity stuckTo,
optional BOOL touchedBreakableGlass
){
forceBecomePickupableTime = -1;
@ -191,83 +199,75 @@ void CTSThrownProjectile::becomePickupable(BOOL becomeStuck, optional vector dir
this.expireTime = time + 30;
this.avelocity = [0,0,0];
}//END OF becomePickupable
}// becomePickupable
void CTSThrownProjectile::copyFrom(player arg_player, int arg_weaponID){
void
CTSThrownProjectile::copyFrom(player arg_player, int arg_weaponID)
{
weapondynamic_t tempRef = arg_player.ary_myWeapons[arg_weaponID];
copyFrom2(arg_player, tempRef);
}
// From what index in the player's inventory should I copy stats from?
// Called as we're being filled to be thrown from the player.
void CTSThrownProjectile::copyFrom2(player arg_player, weapondynamic_t tempRef){
void
CTSThrownProjectile::copyFrom2(player arg_player, weapondynamic_t tempRef)
{
myInfo.weaponID = tempRef.weaponID;
myInfo.weaponTypeID = tempRef.weaponTypeID;
//weapondynamic_t tempRef = arg_player.ary_myWeapons[arg_weaponID];
COPYVARFROM(weaponID)
COPYVARFROM(weaponTypeID)
//COPYVARFROM(iBitsUpgrade)
//actually want to exclude the AKIMBO and FULLLOAD bits. They were only for the shop really.
// actually want to exclude the AKIMBO and FULLLOAD bits. They were only for the shop really.
myInfo.iBitsUpgrade = tempRef.iBitsUpgrade & ~(BITS_WEAPONOPT_AKIMBO | BITS_WEAPONOPT_FULLLOAD);
//COPYVARFROM(iCount)
weapondata_basic_t* weaponPointer = ary_weaponData[tempRef.weaponID];
weapondata_basic_t basicRef = *((weapondata_basic_t*) weaponPointer);
weapondata_basic_t* basicP = ary_weaponData[tempRef.weaponID];
// only one throwable is 'thrown' at a time ever.
myInfo.iCount = 1;
COPYVARFROM(iPrice) //who cares.
//COPYVARFROM(iSlots)
//re-calculate the slots now.
myInfo.iSlots = myInfo.iCount * basicRef.iSlots;
// Not important to really preserve through any changes as far as I know
myInfo.iPrice = tempRef.iPrice;
// re-calculate the slots
myInfo.iSlots = myInfo.iCount * basicP->iSlots;
//doesn't use these. We're a throwable.
myInfo.iClipLeft = 0;
myInfo.iClipAkimboLeft = 0;
COPYVARFROM(iBitsUpgrade_on)
COPYVARFROM(iFireMode)
COPYVARFROM(iFireModeAkimbo)
//COPYVARFROM(iIronSight)
myInfo.iBitsUpgrade_on = tempRef.iBitsUpgrade_on;
myInfo.iFireMode = tempRef.iFireMode;
myInfo.iFireModeAkimbo = tempRef.iFireModeAkimbo;
COPYVARFROM(forceBodygroup1Submodel)
myInfo.iForceBodygroup1Submodel = tempRef.iForceBodygroup1Submodel;
myInfo.iIronSight = 0; //default: not using it.
}//END OF copyFrom
}// copyFrom
// From what index in the player's inventory should I copy stats from?
// Called as we're being picked up by a player to fill one of their weapon slots.
void CTSThrownProjectile::copyTo(player arg_player, int arg_weaponID){
void
CTSThrownProjectile::copyTo(player arg_player, int arg_weaponID)
{
weapondynamic_t tempRef = arg_player.ary_myWeapons[arg_weaponID];
COPYVARTO(weaponID)
COPYVARTO(weaponTypeID)
//COPYVARTO(iBitsUpgrade)
//COPYVARTO(iCount)
COPYVARTO(iPrice) //no one cares.
//COPYVARTO(iSlots) //re-calculated.
//COPYVARTO(iClipLeft)
//COPYVARTO(iClipAkimboLeft)
//COPYVARTO(iBitsUpgrade_on)
//COPYVARTO(iFireMode)
//COPYVARTO(iFireModeAkimbo)
//COPYVARTO(iIronSight)
COPYVARTO(forceBodygroup1Submodel)
tempRef.weaponID = myInfo.weaponID;
tempRef.weaponTypeID = myInfo.weaponTypeID;
// ?
tempRef.iPrice = myInfo.iPrice;
tempRef.iForceBodygroup1Submodel = myInfo.iForceBodygroup1Submodel;
tempRef.iIronSight = 0; //default: not using it.
}//END OF copyTo
}// copyTo
void CTSThrownProjectile::Touch( void ) {
void
CTSThrownProjectile::Touch(void)
{
if ( other.solid == SOLID_TRIGGER ) {
return;
@ -332,7 +332,7 @@ void CTSThrownProjectile::Touch( void ) {
}
//notice, ATTN_NORM. Sound goes further.,
sound( this, CHAN_WEAPON, "weapons/knife/knife_hit.wav", 1, ATTN_NORM - 0.15 );
sound(this, CHAN_AUTO, "weapons/knife/knife_hit.wav", 1, ATTN_NORM - 0.15 );
//printfline("trace_fraction %.2f", trace_fraction);
@ -422,16 +422,15 @@ void CTSThrownProjectile::Touch( void ) {
//is it something we can deal damage to?
if(other.takedamage == DAMAGE_YES){
//is it fleshy? eh, assume it is.
//there is always a "trace_ent.iBleeds" check though.
sound( this, CHAN_WEAPON, "weapons/knife/knife_hitbody.wav", 1, ATTN_IDLE );
// is it fleshy? eh, assume it is.
// there is always a "trace_ent.iBleeds" check though.
sound(this, CHAN_AUTO, "weapons/knife/knife_hitbody.wav", 1, ATTN_IDLE );
weapondata_basic_t* basicPointerPRE = (weapondata_basic_t*) ary_weaponData[this.myInfo.weaponID];
//weapondata_basic_t basicRefPRE = *(basicPointerPRE);
weapondata_throwable_t throwableRef = *((weapondata_throwable_t*)basicPointerPRE);
weapondata_basic_t* basicP = (weapondata_basic_t*) ary_weaponData[this.myInfo.weaponID];
weapondata_throwable_t* throwableP = ((weapondata_throwable_t*)basicP);
// tell the thing being damaged that my OWNER was what damaged it.
Damage_Apply(other, this.m_owner, throwableRef.fThrowDamage, myInfo.weaponID, DMG_SLASH);
Damage_Apply(other, this.m_owner, throwableP->fThrowDamage, myInfo.weaponID, DMG_SLASH);
remove(this);
return;
@ -439,7 +438,7 @@ void CTSThrownProjectile::Touch( void ) {
//oh. bounce off I guess.
//TAGGG - TODO. Spark effect!
//TODO - bounce the opposite direction floor-wise?
sound( this, CHAN_WEAPON, "weapons/knife/knife_hit.wav", 1, ATTN_NORM - 0.15 );
sound( this, CHAN_AUTO, "weapons/knife/knife_hit.wav", 1, ATTN_NORM - 0.15 );
becomePickupable(FALSE);
//setsize( this, '-16 -16 0', '16 16 16' );
@ -454,18 +453,22 @@ void CTSThrownProjectile::Touch( void ) {
}
}//END OF touch method
}// touch method
void CTSThrownProjectile::PlayerUse( void ) {
void
CTSThrownProjectile::PlayerUse(void)
{
//EMPTY. Use CTSWorldGun's PlayerUse once we dropped,
// OR have logic that redirects to that in here when we want to make this pickup-able.
// Whichever works.
}
void CTSThrownProjectile::Think( void ) {
void
CTSThrownProjectile::Think(void)
{
if(this.startAngularVelocityDelay != -1 && time >= this.startAngularVelocityDelay){
this.startAngularVelocityDelay = -1;

View File

@ -1,37 +1,38 @@
void CTSWorldGun::CTSWorldGun(void){
void
CTSWorldGun::CTSWorldGun(void)
{
accessibleCooldownTime = -1;
myInfo = spawn(weapondynamic_t);
}
CTSWorldGun CTSWorldGun::generate(player arg_player, int arg_weaponID){
CTSWorldGun
CTSWorldGun::generate(player arg_player, int arg_weaponID)
{
weapondynamic_t dynaRefPRE = arg_player.ary_myWeapons[arg_weaponID];
return CTSWorldGun::generate2(arg_player, dynaRefPRE);
}
// Static method called from elsewhere to create and initialize a
// weapon drop entity, given a player and what weapon to copy information from.
CTSWorldGun CTSWorldGun::generate2(player arg_player, weapondynamic_t dynaRefPRE){
CTSWorldGun
CTSWorldGun::generate2(player arg_player, weapondynamic_t dynaRefPRE)
{
CTSWorldGun eDrop = spawn(CTSWorldGun);
//eDrop.setup(arg_player, arg_weaponID);
//weapondynamic_t dynaRefPRE = arg_player.ary_myWeapons[arg_weaponID];
weapondata_basic_t* basicPointerPRE = (weapondata_basic_t*) ary_weaponData[dynaRefPRE.weaponID];
weapondata_basic_t basicRefPRE = *(basicPointerPRE);
weapondata_basic_t* basicP = ary_weaponData[dynaRefPRE.weaponID];
eDrop.movetype = MOVETYPE_TOSS;
eDrop.solid = SOLID_TRIGGER; //or CORPSE
//CTSWorldGun eDrop = spawn(CTSWorldGun);
setorigin( eDrop, arg_player.origin + arg_player.view_ofs );
setmodel( eDrop, basicRefPRE.sWorldModelPath );
setmodel( eDrop, basicP->sWorldModelPath );
eDrop.angles = [0, randomInRange_f(0, 360), 0];
eDrop.avelocity = [0, randomInRange_f(100, 500), 0];
@ -64,36 +65,35 @@ CTSWorldGun CTSWorldGun::generate2(player arg_player, weapondynamic_t dynaRefPRE
return eDrop;
}//END OF generate
}// generate
void CTSWorldGun::copyFrom(player arg_player, int arg_weaponID){
void
CTSWorldGun::copyFrom(player arg_player, int arg_weaponID)
{
weapondynamic_t tempRef = arg_player.ary_myWeapons[arg_weaponID];
copyFrom2(arg_player, tempRef);
}
// From what index in the player's inventory should I copy stats from?
// Called as we're being filled to be thrown from the player.
void CTSWorldGun::copyFrom2(player arg_player, weapondynamic_t tempRef){
void
CTSWorldGun::copyFrom2(player arg_player, weapondynamic_t tempRef)
{
//weapondynamic_t tempRef = arg_player.ary_myWeapons[arg_weaponID];
myInfo.weaponID = tempRef.weaponID;
myInfo.weaponTypeID = tempRef.weaponTypeID;
COPYVARFROM(weaponID)
COPYVARFROM(weaponTypeID)
//COPYVARFROM(iBitsUpgrade)
//actually want to exclude the AKIMBO and FULLLOAD bits. They were only for the shop really.
myInfo.iBitsUpgrade = tempRef.iBitsUpgrade & ~(BITS_WEAPONOPT_AKIMBO | BITS_WEAPONOPT_FULLLOAD);
//COPYVARFROM(iCount)
weapondata_basic_t* weaponPointer = ary_weaponData[tempRef.weaponID];
weapondata_basic_t basicRef = *((weapondata_basic_t*) weaponPointer);
if(basicRef.typeID == WEAPONDATA_TYPEID_THROWABLE){
weapondata_basic_t* basicP = ary_weaponData[tempRef.weaponID];
if(basicP->typeID == WEAPONDATA_TYPEID_THROWABLE){
//we're a throwable? Send the count over.
COPYVARFROM(iCount)
myInfo.iCount = tempRef.iCount;
}else{
// Always a count of 1. Any dropped weapon from akimbo is really just "one" of the two pickups needed.
// Even weapons that only come in akimbo, like goldencolts, don't hurt by being called a count of "1".
@ -101,24 +101,19 @@ void CTSWorldGun::copyFrom2(player arg_player, weapondynamic_t tempRef){
myInfo.iCount = 1;
}
// Not important to really preserve through any changes as far as I know
myInfo.iPrice = tempRef.iPrice;
// re-calculate the slots
myInfo.iSlots = myInfo.iCount * basicP->iSlots;
COPYVARFROM(iPrice) //who cares.
//COPYVARFROM(iSlots)
//re-calculate the slots now.
myInfo.iSlots = myInfo.iCount * basicRef.iSlots;
//Hold on... this isn't so simple.
if(basicRef.typeID == WEAPONDATA_TYPEID_GUN || basicRef.typeID == WEAPONDATA_TYPEID_IRONSIGHT){
if(basicRef.iBitsUpgradeAuto & BITS_WEAPONOPT_AKIMBO){
//Hold on, this isn't so simple.
if(basicP->typeID == WEAPONDATA_TYPEID_GUN || basicP->typeID == WEAPONDATA_TYPEID_IRONSIGHT){
if(basicP->iBitsUpgradeAuto & BITS_WEAPONOPT_AKIMBO){
//If the weapon we're spawned from is forced akimbo, the intuitive way works.
//iClipLeft & iClipAkimboLeft can be filled, this is a singular drop to represent akimbo.
COPYVARFROM(iClipLeft)
COPYVARFROM(iClipAkimboLeft)
}else if(basicRef.iBitsUpgrade & BITS_WEAPONOPT_AKIMBO && tempRef.iBitsUpgrade & BITS_WEAPONOPT_AKIMBO){
myInfo.iClipLeft = tempRef.iClipLeft;
myInfo.iClipAkimboLeft = tempRef.iClipAkimboLeft;
}else if(basicP->iBitsUpgrade & BITS_WEAPONOPT_AKIMBO && tempRef.iBitsUpgrade & BITS_WEAPONOPT_AKIMBO){
//If the weapon supports akimbo and we have it, assume the thing dropped is the 2nd weapon.
//That is, the one tied to "iClipAkimboLeft".
@ -144,44 +139,43 @@ void CTSWorldGun::copyFrom2(player arg_player, weapondynamic_t tempRef){
COPYVARFROM(iBitsUpgrade_on)
COPYVARFROM(iFireMode) //we can always copy both firemodes to any individual weapon, can't really hurt.
COPYVARFROM(iFireModeAkimbo)
//COPYVARFROM(iIronSight)
myInfo.iBitsUpgrade_on = tempRef.iBitsUpgrade_on;
myInfo.iFireMode = tempRef.iFireMode; //we can always copy both firemodes to any individual weapon, can't really hurt.
myInfo.iFireModeAkimbo = tempRef.iFireModeAkimbo;
COPYVARFROM(forceBodygroup1Submodel)
myInfo.iForceBodygroup1Submodel = tempRef.iForceBodygroup1Submodel;
myInfo.bNeedsPump = tempRef.bNeedsPump;
myInfo.iIronSight = 0; //default: not using it.
}//END OF copyFrom
}// copyFrom
// From what index in the player's inventory should I copy stats from?
// Called as we're being picked up by a player to fill one of their weapon slots.
void CTSWorldGun::copyTo(player arg_player, int arg_weaponID){
void
CTSWorldGun::copyTo(player arg_player, int arg_weaponID)
{
weapondynamic_t tempRef = arg_player.ary_myWeapons[arg_weaponID];
COPYVARTO(weaponID)
COPYVARTO(weaponTypeID)
//COPYVARTO(iBitsUpgrade)
//COPYVARTO(iCount)
COPYVARTO(iPrice) //no one cares.
//COPYVARTO(iSlots) //re-calculated.
//COPYVARTO(iClipLeft)
//COPYVARTO(iClipAkimboLeft)
//COPYVARTO(iBitsUpgrade_on)
//COPYVARTO(iFireMode)
//COPYVARTO(iFireModeAkimbo)
//COPYVARTO(iIronSight)
COPYVARTO(forceBodygroup1Submodel)
tempRef.weaponID = myInfo.weaponID;
tempRef.weaponTypeID = myInfo.weaponTypeID;
// ?
tempRef.iPrice = myInfo.iPrice;
tempRef.iForceBodygroup1Submodel = myInfo.iForceBodygroup1Submodel;
tempRef.bNeedsPump = myInfo.bNeedsPump;
tempRef.iIronSight = 0; //default: not using it.
}//END OF copyTo
}// copyTo
void CTSWorldGun::Touch( void ) {
void
CTSWorldGun::Touch(void)
{
if ( other.classname != "player" ) {
// assume it's the world.. play this sound?
@ -194,11 +188,13 @@ void CTSWorldGun::Touch( void ) {
return;
}
}//END OF touch method
}// touch method
void CTSWorldGun::PlayerUse( void ) {
void
CTSWorldGun::PlayerUse(void)
{
//laziness.
//entity other = eActivator;
@ -240,7 +236,9 @@ void CTSWorldGun::PlayerUse( void ) {
void CTSWorldGun::Think( void ) {
void
CTSWorldGun::Think(void)
{
//CTSWorldGun selfRef = (CTSWorldGun)self;
// oh.. this makes the weapon collidable with the original dropper
// again.

View File

@ -506,7 +506,7 @@ TSMultiplayerRules::TimerUpdate(void)
}
}
}
}//END OF gamemode check
}// gamemode check
if (g_ts_gamestate != GAME_OVER) {
@ -516,7 +516,7 @@ TSMultiplayerRules::TimerUpdate(void)
centerprintToAll("mp_timelimit expired, changing map...\n");
TimerBegin(5, GAME_OVER);
printfline("Did the gamemode become GAME_OVER? %i", (g_ts_gamestate==GAME_OVER));
printfline("Did the gamemode become GAME_OVER? %d", (float)(g_ts_gamestate==GAME_OVER));
}
}
}

View File

@ -1,6 +1,13 @@
#pragma target fte
#pragma progs_dat "../../progs.dat"
//---WARNINGS DISABLED---
// As of now, the only warnings left are for the server/gamerules.qc unused globals
// like sRule_TeamNames.
#pragma warning disable Q302 /*uninitialised locals*/
/////////////////////////////////////////////////////////////////
#define QWSSQC
#define SERVER
#define TS

View File

@ -284,7 +284,7 @@ EV_TS_resetViewModel(void){
player pl = (player)self;
pSeat->m_iLastWeapon = -1; // any weapon slot choice will refresh the view model.
pl.lasersightUnlockTime = FALSE;
resetViewModel();
TS_View_ResetViewModel();
}
#endif

View File

@ -88,30 +88,6 @@ Game_Input(void)
// HUD_DrawWeaponSelect_Trigger here, Nuclide calls the latter which works
// fine.
// CRITICAL.
// DISABLED.
// This is trying to close weaponselect on detecting a right-click, but it
// has issues.
// Idea is, this needs to *absorb* the right-click, and stop it from reaching
// the rest of the client and server to work with weapons, like a change-ironsight
// order.
// This might stop the client weapon logic from seeing the right click, but not
// the server.
// It appears there is no way to stop that without the FTE built-in event method
// CSQC_Input_Frame (defined by Nuclide) letting the gamemod block right-click
// inputs per some condition, like weapon-select being up.
/*
if(pSeat->m_iInputAttack2){ //input_buttons & INPUT_BUTTON3){
if(HUD_CloseWeaponSelect(TRUE)){
pSeat->m_flInputBlockTime = time + 0.2;
input_impulse = 0;
input_buttons = 0;
pSeat->m_iInputAttack2 = FALSE;
}else{
//pSeat->m_iInputAttack2 = TRUE;
}
}
*/
}// pi.iState checks
#endif
@ -196,23 +172,6 @@ Game_Input(void)
}
#endif
// !!!
// 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.
/*
#ifdef CSQC
if (pSeatLocal->m_iInputSpeed == TRUE) {
//input_buttons |= INPUT_BUTTON9;
input_buttons |= INPUT_BUTTON7;
//self.flags |= FL_SNEAK;
}else{
//self.flags &= ~FL_SNEAK;
}
#endif
//printfline("input_buttons: %d", (INPUT_BUTTON7 & input_buttons) );
*/
// TS way, weapon thinks happen alongside checking inputs
pl.callWeaponThink();
@ -234,8 +193,15 @@ Game_Input(void)
processInputs();
// !!!
// Should SEMI flags be handled here for anytime an input has been pressed
// (even if not involved due to the other being picked, like primary fire
// taking precedence when both are pressed so secondary is registered as
// held down the next frame, even when primary is let go but sec is not),
// or only on PRIMARY / SECONDARY being handled? Decisions decisions
if(input_buttons & INPUT_BUTTON0){
pl.gflags |= GF_SEMI_TOGGLED;
//pl.gflags |= GF_SEMI_TOGGLED;
}else{
// held down the previous frame, but not now? That's a release.
if(pl.gflags & GF_SEMI_TOGGLED){
@ -243,9 +209,8 @@ Game_Input(void)
pl.gflags &= ~GF_SEMI_TOGGLED;
}
}
if(input_buttons & INPUT_BUTTON3){
pl.gflags |= GF_SEMI_SECONDARY_TOGGLED;
//pl.gflags |= GF_SEMI_SECONDARY_TOGGLED;
}else{
if(pl.gflags & GF_SEMI_SECONDARY_TOGGLED){
TS_Weapon_SecondaryAttackRelease(pl);
@ -253,6 +218,7 @@ Game_Input(void)
}
}
#else
//////////////////////////////////////////////
//INPUT_TAP_DETECT_CHOICE == 2
@ -393,79 +359,22 @@ Game_Input(void)
void processInputs(void){
player pl = (player)self;
if (input_buttons & INPUT_BUTTON0){
//printfline("!!! PRIMA !!! (%d %d)", ((input_buttons & INPUT_BUTTON0)!=0), ((input_buttons & INPUT_BUTTON3)!=0));
Weapons_Primary();
//TAGGG - CRITICAL.
// Is setting the _net version of gflags ok?
// This is like SAVE_STATE but only for this bitflag.
// Doing this causes the issue of client being called many times for a short while as
// though SEMI_TOGGLED weren't touched to happen.
// In other words, checks for being out of clip and playing a click sound can play
// several clicks one frame after the other even though one was intended every 0.22 seconds.
// If this is the wrong way to go about fixing that, or this has some nasty side-effects
// in realistic pings, need to know to fix that some other way.
// Could even check for having recently seen the button not pressed and reject out-of-date
// server messages explicitly too?
// (This all applies to "GF_SEMI_SECONDARY_TOGGLED" further down)
/*
// BEST YET
pl.gflags |= GF_SEMI_TOGGLED;
pl.gflags_net |= GF_SEMI_TOGGLED;
// FIX: for holding both inputs to behave properly
if(input_buttons & INPUT_BUTTON3){
pl.gflags |= GF_SEMI_SECONDARY_TOGGLED;
pl.gflags_net |= GF_SEMI_SECONDARY_TOGGLED;
}
*/
// Primary was picked, so turn off the flag for secondary
//pl.gflags &= ~GF_SEMI_SECONDARY_TOGGLED;
return;
}
if (input_buttons & INPUT_BUTTON3){
//printfline("!!! SECO !!! (%d %d)", ((input_buttons & INPUT_BUTTON0)!=0), ((input_buttons & INPUT_BUTTON3)!=0));
// TAGGG - CRITICAL.
// Would be nice to be able to do secondary input ignored if weapon select is open
// like primary, see a similar place involving "HUD_DrawWeaponSelect_Trigger" in
// Nuclide's src/client/entry.qc. Can we get that CSQC_Input_Frame event to pipe
// a call over to gamemod script for custom behavior like this, perhaps?
/*
#if CLIENT
if ((pSeat->m_iHUDWeaponSelected) ) {
HUD_DrawWeaponSelect_Trigger();
input_buttons = 0;
pSeat->m_flInputBlockTime = time + 0.2;
}
// prevent accidental input packets
if (pSeat->m_flInputBlockTime > time) {
input_impulse = 0;
input_buttons = 0;
return;
}
#endif
*/
Weapons_Secondary();
// BEST YET
/*
pl.gflags |= GF_SEMI_SECONDARY_TOGGLED;
pl.gflags_net |= GF_SEMI_SECONDARY_TOGGLED;
*/
// Secondary was picked, so turn off the flag for primary
//pl.gflags &= ~GF_SEMI_TOGGLED;
return;
}
@ -499,3 +408,56 @@ void processInputs(void){
}//processInputs
#ifdef CLIENT
void HUD_DrawWeaponSelect_Trigger(void);
BOOL TS_HUD_CloseWeaponSelect(BOOL);
// Not yet called by Nuclide! A series of notes for now
// (move to clientside files then)
//TODO: if spawning from seemingly the same click as "use new config" is still a problem, this is
// definitely the place to try something
void ClientGame_Input_Frame(void){
// This is trying to close weaponselect on detecting a right-click, but it
// has issues.
// Idea is, this needs to *absorb* the right-click, and stop it from reaching
// the rest of the client and server to work with weapons, like a change-ironsight
// order.
// This might stop the client weapon logic from seeing the right click, but not
// the server.
// It appears there is no way to stop that without the FTE built-in event method
// CSQC_Input_Frame (defined by Nuclide) letting the gamemod block right-click
// inputs per some condition, like weapon-select being up.
if(pSeat->m_iHUDWeaponSelected && pSeat->m_iInputAttack2){ //input_buttons & INPUT_BUTTON3
if(TS_HUD_CloseWeaponSelect(TRUE)){
pSeat->m_flInputBlockTime = time + 0.2;
input_impulse = 0;
input_buttons = 0;
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.
if (pSeatLocal->m_iInputSpeed == TRUE) {
//input_buttons |= INPUT_BUTTON9;
input_buttons |= INPUT_BUTTON7;
//self.flags |= FL_SNEAK;
}else{
//self.flags &= ~FL_SNEAK;
}
//printfline("input_buttons: %d", (INPUT_BUTTON7 & input_buttons) );
}
#endif

View File

@ -161,8 +161,8 @@ BOOL CON_anyWeaponUsingAmmoType(int arg_ammoType, int arg_excludedWeaponID){
if(otherWeaponTypeID == WEAPONDATA_TYPEID_GUN || otherWeaponTypeID == WEAPONDATA_TYPEID_IRONSIGHT){
//in the clear. do the check.
weapondata_basic_t* otherWeaponPointer = ary_weaponData[CONFIG_PLAYER_INVENTORY_GENERIC[i].weaponID];
weapondata_gun_t otherGunRef = *((weapondata_gun_t*) otherWeaponPointer);
if(otherGunRef.iAmmoDataID == arg_ammoType){
weapondata_gun_t* otherGunP = ((weapondata_gun_t*) otherWeaponPointer);
if(otherGunP->iAmmoDataID == arg_ammoType){
//valid match - still using this ammo pool. confirm and stop.
//ammoStillUsed = TRUE;
//break;
@ -284,7 +284,8 @@ void swapInventoryElements(player pl, int arg_index1, int arg_index2){
int iFireMode = PLAYER_INVENTORY_GENERIC[arg_index2].iFireMode;
int iFireModeAkimbo = PLAYER_INVENTORY_GENERIC[arg_index2].iFireModeAkimbo;
int iIronSight = PLAYER_INVENTORY_GENERIC[arg_index2].iIronSight;
int forceBodygroup1Submodel = PLAYER_INVENTORY_GENERIC[arg_index2].forceBodygroup1Submodel;
int iForceBodygroup1Submodel = PLAYER_INVENTORY_GENERIC[arg_index2].iForceBodygroup1Submodel;
int bNeedsPump = PLAYER_INVENTORY_GENERIC[arg_index2].bNeedsPump;
PLAYER_INVENTORY_GENERIC[arg_index2].weaponID = PLAYER_INVENTORY_GENERIC[arg_index1].weaponID;
@ -301,7 +302,8 @@ void swapInventoryElements(player pl, int arg_index1, int arg_index2){
PLAYER_INVENTORY_GENERIC[arg_index2].iFireMode = PLAYER_INVENTORY_GENERIC[arg_index1].iFireMode;
PLAYER_INVENTORY_GENERIC[arg_index2].iFireModeAkimbo = PLAYER_INVENTORY_GENERIC[arg_index1].iFireModeAkimbo;
PLAYER_INVENTORY_GENERIC[arg_index2].iIronSight = PLAYER_INVENTORY_GENERIC[arg_index1].iIronSight;
PLAYER_INVENTORY_GENERIC[arg_index2].forceBodygroup1Submodel = PLAYER_INVENTORY_GENERIC[arg_index1].forceBodygroup1Submodel;
PLAYER_INVENTORY_GENERIC[arg_index2].iForceBodygroup1Submodel = PLAYER_INVENTORY_GENERIC[arg_index1].iForceBodygroup1Submodel;
PLAYER_INVENTORY_GENERIC[arg_index2].bNeedsPump = PLAYER_INVENTORY_GENERIC[arg_index1].bNeedsPump;
@ -319,7 +321,8 @@ void swapInventoryElements(player pl, int arg_index1, int arg_index2){
PLAYER_INVENTORY_GENERIC[arg_index1].iFireMode = iFireMode;
PLAYER_INVENTORY_GENERIC[arg_index1].iFireModeAkimbo = iFireModeAkimbo;
PLAYER_INVENTORY_GENERIC[arg_index1].iIronSight = iIronSight;
PLAYER_INVENTORY_GENERIC[arg_index1].forceBodygroup1Submodel = forceBodygroup1Submodel;
PLAYER_INVENTORY_GENERIC[arg_index1].iForceBodygroup1Submodel = iForceBodygroup1Submodel;
PLAYER_INVENTORY_GENERIC[arg_index1].bNeedsPump = bNeedsPump;
}//END OF swapConfigElements
@ -787,7 +790,8 @@ BOOL attemptAddWeaponToConfig(player pl, int arg_weaponID, int arg_iBitsUpgrade,
PLAYER_INVENTORY_GENERIC[matchStart].iIronSight = 0; //default: no use / magnification.
PLAYER_INVENTORY_GENERIC[matchStart].forceBodygroup1Submodel = FALSE;
PLAYER_INVENTORY_GENERIC[matchStart].iForceBodygroup1Submodel = 0;
PLAYER_INVENTORY_GENERIC[matchStart].bNeedsPump = FALSE;
//PLAYER_INVENTORY_GENERIC[matchStart].iPrice = newPrice;
//PLAYER_INVENTORY_GENERIC[matchStart].iSlots = newSlots;
@ -1113,7 +1117,7 @@ BOOL attemptBuyWeapon(player pl, int arg_weaponID, int arg_iBitsUpgrade, int iCo
// IGNORE WARNINGS ABOUT ME! Only used if the weapon type ID suggests this is a gun or ironsight - type.
weapondata_gun_t gunRef;
weapondata_gun_t* gunP = NULL;
weapondata_throwable_t throwableRef;
int existingMatchingIndex = -1; //not found until proven otherwise.
@ -1248,8 +1252,8 @@ BOOL attemptBuyWeapon(player pl, int arg_weaponID, int arg_iBitsUpgrade, int iCo
//And if this weapon's ammo type hasn't been filled by another weapon purchased before, do so (and add its cost).
//(gun & ironsight only)
gunRef = *((weapondata_gun_t*) weaponPointer);
ammoType = gunRef.iAmmoDataID;
gunP = ((weapondata_gun_t*) weaponPointer);
ammoType = gunP->iAmmoDataID;
ammoRef = *ary_ammoData[ammoType];
//do the ammo purchase. at least, a hypothetical:
@ -1332,12 +1336,12 @@ BOOL attemptBuyWeapon(player pl, int arg_weaponID, int arg_iBitsUpgrade, int iCo
PLAYER_INVENTORY_GENERIC[matchStart].weaponTypeID = basicRef.typeID;
if(myWeaponTypeID == WEAPONDATA_TYPEID_GUN || myWeaponTypeID == WEAPONDATA_TYPEID_IRONSIGHT){
PLAYER_INVENTORY_GENERIC[matchStart].iClipLeft = gunRef.iClipMax;
PLAYER_INVENTORY_GENERIC[matchStart].iClipLeft = gunP->iClipMax;
//If our weapon supports akimbo, and we actually have it this time...
if((basicRef.iBitsUpgrade & BITS_WEAPONOPT_AKIMBO) && (iBitsUpgradeSafe & BITS_WEAPONOPT_AKIMBO) ){
//you'll be needing this then.
PLAYER_INVENTORY_GENERIC[matchStart].iClipAkimboLeft = gunRef.iClipMax;
PLAYER_INVENTORY_GENERIC[matchStart].iClipAkimboLeft = gunP->iClipMax;
}
else{
//nothing
@ -1367,27 +1371,26 @@ BOOL attemptBuyWeapon(player pl, int arg_weaponID, int arg_iBitsUpgrade, int iCo
if(myWeaponTypeID == WEAPONDATA_TYPEID_GUN || myWeaponTypeID == WEAPONDATA_TYPEID_IRONSIGHT){
if(gunRef.iBitDefaultFireMode != 0){
if(gunP->iBitDefaultFireMode != 0){
//well that was easy.
if(!(iBitsUpgradeSafe & BITS_WEAPONOPT_AKIMBO)){
//well that was easy.
PLAYER_INVENTORY_GENERIC[matchStart].iFireMode = gunRef.iBitDefaultFireMode;
PLAYER_INVENTORY_GENERIC[matchStart].iFireMode = gunP->iBitDefaultFireMode;
}else{
if(gunRef.iAkimboID > 0 && gunRef.iAkimboID < WEAPON_AKIMBO_UPGRADE_ID::LAST_ID ){
if(gunP->iAkimboID > 0 && gunP->iAkimboID < WEAPON_AKIMBO_UPGRADE_ID::LAST_ID ){
//set this too. and iFireModeAkimbo.
PLAYER_INVENTORY_GENERIC[matchStart].iFireMode = gunRef.iBitDefaultFireMode;
PLAYER_INVENTORY_GENERIC[matchStart].iFireMode = gunP->iBitDefaultFireMode;
//Get the akimbo information then
weapondata_gun_t* basicAkimboGunPointer = (weapondata_gun_t*) ary_akimboUpgradeData[gunRef.iAkimboID];
weapondata_gun_t basicAkimboGunRef = *(basicAkimboGunPointer);
weapondata_gun_t* basicAkimboGunP = (weapondata_gun_t*) ary_akimboUpgradeData[gunP->iAkimboID];
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = basicAkimboGunRef.iBitDefaultFireMode;
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = basicAkimboGunP->iBitDefaultFireMode;
}else{
//No akimbo ref? Then I am the akimbo ref. But I'm using "iFireModeAkimbo".
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = gunRef.iBitDefaultFireMode;
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = gunP->iBitDefaultFireMode;
}
}
@ -1407,7 +1410,8 @@ BOOL attemptBuyWeapon(player pl, int arg_weaponID, int arg_iBitsUpgrade, int iCo
PLAYER_INVENTORY_GENERIC[matchStart].iIronSight = 0; //default: no use / magnification.
PLAYER_INVENTORY_GENERIC[matchStart].forceBodygroup1Submodel = FALSE;
PLAYER_INVENTORY_GENERIC[matchStart].iForceBodygroup1Submodel = 0;
PLAYER_INVENTORY_GENERIC[matchStart].bNeedsPump = FALSE;
//PLAYER_INVENTORY_GENERIC[matchStart].iPrice = newPrice;
//PLAYER_INVENTORY_GENERIC[matchStart].iSlots = newSlots;
@ -1490,7 +1494,7 @@ int addWeaponToInventory(player pl, CTSWorldGun arg_pickupRef){
int arg_weaponID = arg_pickupRef.myInfo.weaponID;
weapondata_gun_t gunRef;
weapondata_gun_t* gunP = NULL;
weapondata_throwable_t throwableRef;
int existingMatchingIndex = -1; //not found until proven otherwise.
ammodata_t ammoRef;
@ -1617,7 +1621,7 @@ Full Load: X times the buy price, where "X" is max capacity (throwing knives or
// primary ammo instead.
BOOLEAN harvestAmmo = FALSE;
gunRef = *((weapondata_gun_t*) weaponPointer);
gunP = ((weapondata_gun_t*) weaponPointer);
//gun? ironsight? We can go akimbo, maybe.
// Have it already?
if(existingMatchingIndex == -1){
@ -1628,7 +1632,7 @@ Full Load: X times the buy price, where "X" is max capacity (throwing knives or
}
}else{ //if(existingMatchingIndex != -1
ammoType = gunRef.iAmmoDataID;
ammoType = gunP->iAmmoDataID;
ammoRef = *ary_ammoData[ammoType];
//we are seeing if we have akimbo...
@ -1756,19 +1760,17 @@ Full Load: X times the buy price, where "X" is max capacity (throwing knives or
}else if(basicRef.iBitsUpgrade & BITS_WEAPONOPT_AKIMBO && iBitsUpgradeSafe & BITS_WEAPONOPT_AKIMBO){
//Send the weapon's clip to iClipAkimboLeft actually.
//printfline("addWeaponToInventory - iFireModeAkimbo:%i ammo in akimbo1:%i akimbo2:%i", arg_pickupRef.myInfo.iFireModeAkimbo, arg_pickupRef.myInfo.iClipLeft, arg_pickupRef.myInfo.iClipAkimboLeft);
//PLAYER_INVENTORY_GENERIC[matchStart].iClipAkimboLeft = arg_pickupRef.myInfo.iClipAkimboLeft; //gunRef.iClipMax;
PLAYER_INVENTORY_GENERIC[matchStart].iClipAkimboLeft = arg_pickupRef.myInfo.iClipLeft; //gunRef.iClipMax;
PLAYER_INVENTORY_GENERIC[matchStart].iClipAkimboLeft = arg_pickupRef.myInfo.iClipLeft;
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = arg_pickupRef.myInfo.iFireModeAkimbo;
if(PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo == 0){
//give me a default fire mode for akimbo! Happens if we were only in singular and dropped.
weapondata_gun_t* basicAkimboGunPointer = (weapondata_gun_t*) ary_akimboUpgradeData[gunRef.iAkimboID];
weapondata_gun_t basicAkimboGunRef = *(basicAkimboGunPointer);
weapondata_gun_t* basicAkimboGunP = (weapondata_gun_t*) ary_akimboUpgradeData[gunP->iAkimboID];
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = basicAkimboGunRef.iBitDefaultFireMode;
PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = basicAkimboGunP->iBitDefaultFireMode;
}
}else{
//this isn't akimbo or we don't support it? To the first clip only, blank the akimbo for safety.
PLAYER_INVENTORY_GENERIC[matchStart].iClipLeft = arg_pickupRef.myInfo.iClipLeft; //gunRef.iClipMax;
PLAYER_INVENTORY_GENERIC[matchStart].iClipLeft = arg_pickupRef.myInfo.iClipLeft;
PLAYER_INVENTORY_GENERIC[matchStart].iClipAkimboLeft = 0;
PLAYER_INVENTORY_GENERIC[matchStart].iFireMode = arg_pickupRef.myInfo.iFireMode;
//PLAYER_INVENTORY_GENERIC[matchStart].iFireModeAkimbo = 0;
@ -1789,7 +1791,7 @@ Full Load: X times the buy price, where "X" is max capacity (throwing knives or
PLAYER_INVENTORY_GENERIC[matchStart].iCount = newCount;
arg_pickupRef.myInfo.iCount -= pickupCountSubtract;
//printfline("pickup forceBodygroup1Submodel: %i", arg_pickupRef.myInfo.forceBodygroup1Submodel);
//printfline("pickup iForceBodygroup1Submodel: %i", arg_pickupRef.myInfo.iForceBodygroup1Submodel);
//PLAYER_INVENTORY_GENERIC[matchStart].iPrice = newPrice;
PLAYER_INVENTORY_GENERIC[matchStart].iSlots = newSlots;

View File

@ -41,7 +41,12 @@ enum PLAYER_STATE{
#define SAVE_STATE_ARRAY_MEMBER(ary, i, sub) x ##_net = x // did not do
*/
// NOTE - it seems this is the only place this var is declared? Unsure what the 'noref' means.
// Nuclide expects it, used as a random seed, whole number. Not sure the best way to get a decimal
// out of it yet but some ideas should be good enough.
noref int input_sequence;
class player:base_player
{
@ -144,11 +149,11 @@ class player:base_player
int recentLaserDistanceDisplay;
BOOL forceViewModelUpdate;
// NOTICE - individual dynamic weapons have "forceBodygroup1Submodel".
// "prev_forceBodygroup1Submodel" is player-wide (here) instead because we only need to
// keep track of changes in a weapon's forceBodygroup1Submodel while that weapon is
// NOTICE - individual dynamic weapons have "iForceBodygroup1Submodel".
// "prev_iForceBodygroup1Submodel" is player-wide (here) instead because we only need to
// keep track of changes in a weapon's iForceBodygroup1Submodel while that weapon is
// equipped. Not that it could ever change while not equipped anyway.
int prev_forceBodygroup1Submodel;
int prev_iForceBodygroup1Submodel;
// same as below for muzzleflash.
int iMuzzleFlashType;
@ -301,16 +306,8 @@ class player:base_player
// ALSO! Call Byte vars 'floats' because FTE makes 'readbyte' give a float.
PREDICTED_FLOAT(shotgunReloadIndex);
// In pump-action mode, set to TRUE after firing the shotgun. The next click pumps
// instead.
// Note that switching to semi-fire mode and firing turns this flag off.
// Changing to semi-fire mode alone however, doesn't (changing fire modes without firing
// leaves this flag unaffected).
// Reloading also disables this flag, as it always ends in a visual pump.
// (was BOOL)
PREDICTED_FLOAT(shotgunWaitingForPump);
// do these even need to be networked in the end? Works now as it is,
// anything involving networking in even the most remote sense do be a finicky beast at times
PREDICTED_FLOAT(shotgunAddAmmoTime);
PREDICTED_FLOAT(shotgunAddAmmoSoundTime);

View File

@ -225,7 +225,6 @@ player::ReceiveEntity(float new, float fl)
shotgunReloadIndex = readbyte();
shotgunWaitingForPump = readbyte();
shotgunAddAmmoTime = readfloat();
shotgunAddAmmoSoundTime = readfloat();
@ -311,7 +310,8 @@ void player::ReceiveEntity_ary_myWeapons(int i){
ary_myWeapons[i].iFireModeAkimbo = readbyte();
ary_myWeapons[i].iIronSight = readbyte();
ary_myWeapons[i].forceBodygroup1Submodel = readbyte();
ary_myWeapons[i].iForceBodygroup1Submodel = readbyte();
ary_myWeapons[i].bNeedsPump = readbyte();
}
@ -384,7 +384,6 @@ player::PredictPreFrame(void)
SAVE_STATE(grenadeToss);
SAVE_STATE(shotgunReloadIndex);
SAVE_STATE(shotgunWaitingForPump);
SAVE_STATE(shotgunAddAmmoTime);
SAVE_STATE(shotgunAddAmmoSoundTime);
@ -406,7 +405,8 @@ player::PredictPreFrame(void)
SAVE_STATE(ary_myWeapons[i].iFireMode);
SAVE_STATE(ary_myWeapons[i].iFireModeAkimbo);
SAVE_STATE(ary_myWeapons[i].iIronSight);
SAVE_STATE(ary_myWeapons[i].forceBodygroup1Submodel);
SAVE_STATE(ary_myWeapons[i].iForceBodygroup1Submodel);
SAVE_STATE(ary_myWeapons[i].bNeedsPump);
}
//UNNECESSARY. This array is of fixed length, so known at all times.
@ -483,7 +483,6 @@ player::PredictPostFrame(void)
ROLL_BACK(grenadeToss);
ROLL_BACK(shotgunReloadIndex);
ROLL_BACK(shotgunWaitingForPump);
ROLL_BACK(shotgunAddAmmoTime);
ROLL_BACK(shotgunAddAmmoSoundTime);
@ -504,7 +503,8 @@ player::PredictPostFrame(void)
ROLL_BACK(ary_myWeapons[i].iFireMode);
ROLL_BACK(ary_myWeapons[i].iFireModeAkimbo);
ROLL_BACK(ary_myWeapons[i].iIronSight);
ROLL_BACK(ary_myWeapons[i].forceBodygroup1Submodel);
ROLL_BACK(ary_myWeapons[i].iForceBodygroup1Submodel);
ROLL_BACK(ary_myWeapons[i].bNeedsPump);
}
//UNNECESSARY. This array is of fixed length, so known at all times.
@ -632,7 +632,9 @@ player::EvaluateEntity(void)
if(ATTR_CHANGED(ary_myWeapons[i].iFireMode)) SendFlags |= PLAYER_UNUSED1;
if(ATTR_CHANGED(ary_myWeapons[i].iFireModeAkimbo)) SendFlags |= PLAYER_UNUSED1;
if(ATTR_CHANGED(ary_myWeapons[i].iIronSight)) SendFlags |= PLAYER_UNUSED1;
if(ATTR_CHANGED(ary_myWeapons[i].forceBodygroup1Submodel)) SendFlags |= PLAYER_UNUSED1;
if(ATTR_CHANGED(ary_myWeapons[i].iForceBodygroup1Submodel)) SendFlags |= PLAYER_UNUSED1;
if(ATTR_CHANGED(ary_myWeapons[i].bNeedsPump)) SendFlags |= PLAYER_UNUSED1;
//}
myAmmoType = getAmmoTypeOfWeapon(this.activeweapon);
if(myAmmoType != -1){
@ -672,7 +674,6 @@ player::EvaluateEntity(void)
SAVE_STATE(shotgunReloadIndex);
SAVE_STATE(shotgunWaitingForPump);
SAVE_STATE(shotgunAddAmmoTime);
SAVE_STATE(shotgunAddAmmoSoundTime);
@ -698,7 +699,8 @@ player::EvaluateEntity(void)
SAVE_STATE(ary_myWeapons[i].iFireMode);
SAVE_STATE(ary_myWeapons[i].iFireModeAkimbo);
SAVE_STATE(ary_myWeapons[i].iIronSight);
SAVE_STATE(ary_myWeapons[i].forceBodygroup1Submodel);
SAVE_STATE(ary_myWeapons[i].iForceBodygroup1Submodel);
SAVE_STATE(ary_myWeapons[i].bNeedsPump);
//}
@ -845,7 +847,6 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, shotgunReloadIndex );
WriteByte(MSG_ENTITY, shotgunWaitingForPump );
WriteFloat(MSG_ENTITY, shotgunAddAmmoTime );
WriteFloat(MSG_ENTITY, shotgunAddAmmoSoundTime );
@ -913,7 +914,8 @@ void player::SendEntity_ary_myWeapons(int i){
WriteByte(MSG_ENTITY, ary_myWeapons[i].iFireMode );
WriteByte(MSG_ENTITY, ary_myWeapons[i].iFireModeAkimbo );
WriteByte(MSG_ENTITY, ary_myWeapons[i].iIronSight );
WriteByte(MSG_ENTITY, ary_myWeapons[i].forceBodygroup1Submodel);
WriteByte(MSG_ENTITY, ary_myWeapons[i].iForceBodygroup1Submodel);
WriteByte(MSG_ENTITY, ary_myWeapons[i].bNeedsPump);
}
#endif
@ -1072,7 +1074,7 @@ player::reset(BOOL resetInventory){
lasersightUnlockTime = FALSE;
forceViewModelUpdate = FALSE;
prev_forceBodygroup1Submodel = 0;
prev_iForceBodygroup1Submodel = 0;
#endif
@ -1142,8 +1144,6 @@ player::reset(BOOL resetInventory){
if(resetInventory){
// could this be done for resets outside of resetInventory? unsure
flags = 0;
gflags = 0;
@ -1154,8 +1154,6 @@ player::reset(BOOL resetInventory){
printfline("setInventoryEquippedIndex: FLAG A");
setInventoryEquippedIndex(-1);
shotgunWaitingForPump = FALSE;
#ifdef CLIENT
equippedWeaponWaitingForCallback = FALSE;
#endif
@ -1252,7 +1250,7 @@ player::handleAccuracyKickback(void){
void
player::setZoom(float arg_theZoom)
{
printfline("ORDER! %.2f", arg_theZoom);
//printfline("setZoom: %.2f", arg_theZoom);
flZoomTarget = arg_theZoom;
}
// forget any zoom-related settings instantly.
@ -1557,7 +1555,7 @@ player::preThink(void){
}
// Called before rendering, so this is an acceptable place.
View_HandleZoom();
TS_View_HandleZoom();
//callWeaponThink();
@ -1921,7 +1919,7 @@ player::dropWeapon(int arg_weaponID, BOOL completeDrop){
playerEquipIdealSafe(this);
}else{
// still have it? undirty any blood effects since we dropped that.
ary_myWeapons[arg_weaponID].forceBodygroup1Submodel = 0;
ary_myWeapons[arg_weaponID].iForceBodygroup1Submodel = 0;
}
}else{
@ -1942,7 +1940,7 @@ player::dropWeapon(int arg_weaponID, BOOL completeDrop){
}
printfline("playerDrop: end. Was there a drop? %d", (eDrop != NULL));
printfline("playerDrop: end. Was there a drop? %d", (float)(eDrop != NULL));
if(eDrop != NULL){

View File

@ -79,13 +79,6 @@
#define printlinef(s1, ...) print(sprintf("SV: "s1"\n", ##__VA_ARGS__))
#endif
////////////////////////////////////////////////////////
// situational, see CTSWorldGun and CTSThrownProjectile.
// (consider unpacking, this is kinda unnecessary)
// anywhere in inventory_logic.qc still do something like that?? I forget.
#define COPYVARFROM(varName) myInfo.##varName = tempRef.##varName;
#define COPYVARTO(varName) tempRef.##varName = myInfo.##varName;
// Safe way to declare an entity seen in FreeHL. Think of it as:

View File

@ -370,7 +370,16 @@ class weapondynamic_t{
// to the submodel on drawing this weapon. Submodels actually start at 1, even if the only one.
// If set to 0, the change will only be noticed on undrawing/drawing the weapon as the submodel will
// not be applied then. Set to 1 to change in real time (likely the intention).
PREDICTED_INT(forceBodygroup1Submodel);
PREDICTED_INT(iForceBodygroup1Submodel);
// In pump-action mode, set to TRUE after firing the shotgun. The next click pumps
// instead.
// Note that switching to semi-fire mode and firing turns this flag off.
// Changing to semi-fire mode alone however, doesn't (changing fire modes without firing
// leaves this flag unaffected).
// Reloading also disables this flag, as it always ends in a visual pump.
// (was BOOL)
PREDICTED_FLOAT(bNeedsPump);
void(void) weapondynamic_t;

View File

@ -497,7 +497,8 @@ weapon_shotgun_reload(
}
pl.isChangingIronsight = FALSE;
pl.resetZoom();
//pl.resetZoom();
pl.setZoom(1.0f);
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
@ -512,7 +513,7 @@ weapon_shotgun_reload(
// In original TS, something about ever starting a reload stops the need
// for a pump. Or some part of reloading, good enough I think
pl.shotgunWaitingForPump = FALSE;
arg_thisWeapon.bNeedsPump = FALSE;
}//weapon_shotgun_reload
@ -1303,7 +1304,7 @@ weapon_ironsight_ToggleIronsight(
if(pl.isReloading == FALSE && pl.isChangingIronsight == FALSE){
printfline("time: %.2f weapon_ironsight_ToggleIronsight PASS. CURRENT:%i", time, arg_thisWeapon.iIronSight);
//printfline("time: %.2f weapon_ironsight_ToggleIronsight PASS. CURRENT:%i", time, arg_thisWeapon.iIronSight);
pl.isChangingIronsight = TRUE;
@ -1330,7 +1331,7 @@ weapon_ironsight_ToggleIronsight(
return;
}else{
printfline("time: %.2f weapon_ironsight_ToggleIronsight FAILED (%d, %d). current:%i", time, pl.isReloading, pl.isChangingIronsight, arg_thisWeapon.iIronSight);
//printfline("time: %.2f weapon_ironsight_ToggleIronsight FAILED (%d, %d). current:%i", time, pl.isReloading, pl.isChangingIronsight, arg_thisWeapon.iIronSight);
}
}// weapon_ironsight_ToggleIronsight
@ -1363,7 +1364,8 @@ weapon_gun_Reload(
}
pl.isChangingIronsight = FALSE;
pl.resetZoom();
//pl.resetZoom();
pl.setZoom(1.0f);
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
pl.isReloading = TRUE;
@ -1406,7 +1408,8 @@ weapon_gun_Reload_CustomSequence(
}
pl.isChangingIronsight = FALSE;
pl.resetZoom();
//pl.resetZoom();
pl.setZoom(1.0f);
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
pl.isReloading = TRUE;
@ -1452,7 +1455,8 @@ weapon_ironsight_Reload(
}
pl.isChangingIronsight = FALSE;
pl.resetZoom();
//pl.resetZoom();
pl.setZoom(1.0f);
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
pl.isReloading = TRUE;
@ -1547,7 +1551,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_SetViewModelFromStats();
TS_View_SetViewModelFromStats();
//sound(pl, CHAN_ITEM, "weapons/draw.wav", 1, ATTN_NORM, 100, SOUNDFLAG_PLAYER_COMMON);
localsound("weapons/draw.wav", CHAN_AUTO, 1.0f);
//printfline("weapon_base_onEquip: playing deploy anim");

View File

@ -133,7 +133,6 @@ w_ak47_holster(void)
void
w_ak47_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -178,27 +177,20 @@ w_ak47_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.40f);
break;}
case 2:{
pl.setZoom(0.1625f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
case 2:pl.setZoom(0.1625f);break;
}
}else{
if(pl.w_attack_next > 0){
return;
}
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon);
}

View File

@ -132,7 +132,6 @@ w_akimbocolts_holster(void)
// Putting it here avoids duplicating a bunch of code.
// Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point.
void weapon_akimbocolts_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){
float randomChoice;
//weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
//special case

View File

@ -123,14 +123,13 @@ w_barrettm82_holster(void)
void
w_barrettm82_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if (pl.w_attack_next > 0.0) {
return;
}
//if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){
INPUT_PRIMARY_TAP_GATE
//}
@ -142,8 +141,8 @@ w_barrettm82_primary(void)
SoundPitched_Send(pl, SNDP_BARRETTM82_FIRE);
randomChoice = random();
if(randomChoice < 0.5){
int r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_barrettm82::shoot, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_barrettm82::shoot2, 31.0f/30.0f);
@ -171,25 +170,15 @@ w_barrettm82_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.40f);
break;}
case 2:{
pl.setZoom(0.10f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
case 2:pl.setZoom(0.10f);break;
}
}

View File

@ -161,9 +161,8 @@ w_benellim3_primary(void)
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
if(pl.shotgunWaitingForPump){
if(arg_thisWeapon.bNeedsPump){
// pump instead!
pl.shotgunWaitingForPump = FALSE;
//SoundPitched_Channel_Send(pl, SNDP_BENELLIM3_PUMP, CHAN_AUTO);
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO);
@ -171,7 +170,6 @@ w_benellim3_primary(void)
// these pumps eject shells
weapon_EjectShell(SHELLEJECT_ID::SHOTGUN_BLUE);
// float randomChoice = random();
// why the cast to float here? No idea
int r = (float)input_sequence % 2;
if(r == 0){
@ -180,11 +178,13 @@ w_benellim3_primary(void)
TS_Weapons_ViewAnimation(weaponseq_benellim3::pump2, 25.0f/35.0f);
}
arg_thisWeapon.bNeedsPump = FALSE;
weapon_base_setWholeAttackDelay(pl, 15.0f/35.0f);
return;
}
}else{
pl.shotgunWaitingForPump = FALSE;
// not in PUMP firemode? Any firing forgets the pump-need if it was set.
arg_thisWeapon.bNeedsPump = FALSE;
}
// we still want to be able to do a pump on firing the last in the clip
@ -199,7 +199,7 @@ w_benellim3_primary(void)
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
TS_Weapons_ViewAnimation(weaponseq_benellim3::shootpump, (31.0f/35.0f) );
// no shell! Pumping does that.
pl.shotgunWaitingForPump = TRUE;
arg_thisWeapon.bNeedsPump = TRUE;
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::WEIRD);
}else{
TS_Weapons_ViewAnimation(weaponseq_benellim3::shootsemi, (31.0f/35.0f) );
@ -231,10 +231,6 @@ w_benellim3_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
/*
@ -248,15 +244,9 @@ w_benellim3_secondary(void)
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.5f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
}else{
// no ironsight for this
}
}

View File

@ -129,7 +129,6 @@ w_beretta_holster(void)
void
w_beretta_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -156,8 +155,8 @@ w_beretta_primary(void)
if(arg_thisWeapon.iClipLeft > 0){
randomChoice = random();
if(randomChoice <= 0.5){
int r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_beretta::shoot, 31.0f/35.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_beretta::shoot2, 31.0f/35.0f);

View File

@ -154,7 +154,6 @@ w_beretta_akimbo_holster(void)
// Putting it here avoids duplicating a bunch of code.
// Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point.
void weapon_beretta_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){
float randomChoice;
//weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
//special case
@ -218,6 +217,7 @@ void weapon_beretta_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int
}
}
int r;
if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){
// Not both fire types chosen
@ -226,19 +226,20 @@ void weapon_beretta_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int
if(finalAkimboChoice == BITS_AKIMBOCHOICE_LEFT){
//printfline("VM: LEFT");
if(!arg_thisWeapon.iIronSight){
if(arg_thisWeapon.iClipLeft > 0 ){
randomChoice = random();
if(randomChoice <= 0.33){
r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::leftshoot_1, 31.0f/31.0f);
}else if(randomChoice <= 0.66){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::leftshoot2_1, 31.0f/31.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::leftshoots_1, 31.0f/31.0f);
}
}else{
randomChoice = random();
if(randomChoice <= 0.5){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::leftshootlast_1, 31.0f/31.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::leftshootlasts_1, 31.0f/31.0f);
@ -260,17 +261,17 @@ void weapon_beretta_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int
//printfline("VM: RIGHT");
if(!arg_thisWeapon.iIronSight){
if(arg_thisWeapon.iClipAkimboLeft > 0 ){
randomChoice = random();
if(randomChoice <= 0.33){
r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::rightshoot_1, 31.0f/31.0f);
}else if(randomChoice <= 0.66){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::rightshoot2_1, 31.0f/31.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::rightshoots_1, 31.0f/31.0f);
}
}else{
randomChoice = random();
if(randomChoice <= 0.5){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::rightshootlast_1, 31.0f/31.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_beretta_akimbo::rightshootlasts_1, 31.0f/31.0f);

View File

@ -119,7 +119,6 @@ w_combatknife_primary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
if (pl.w_attack_next > 0.0) {
return;
@ -140,7 +139,7 @@ w_combatknife_primary(void)
}else if(hitRep == MELEE_HIT_RESPONSE::METAL){
TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hit.wav");
}else if(hitRep == MELEE_HIT_RESPONSE::FLESH){
arg_thisWeapon.forceBodygroup1Submodel = 2;
arg_thisWeapon.iForceBodygroup1Submodel = 2;
TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hitbody.wav");
}
#endif
@ -149,12 +148,13 @@ w_combatknife_primary(void)
//self.fAttackFinished = time + wptKNIFE.fAttackFinished;
// actually do this animation the same regardless as far as we know.
randomChoice = randomInRange_i(0, 2);
if(randomChoice == 0){
// Do these go through some kind of cycle, I forget
int r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_combatknife::slash1, (31.0f/30.0f) );
}else if(randomChoice == 1){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_combatknife::left, (31.0f/30.0f) );
}else if(randomChoice == 2){
}else{
TS_Weapons_ViewAnimation(weaponseq_combatknife::right, (31.0f/30.0f) );
}
@ -167,7 +167,6 @@ w_combatknife_secondary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
if (pl.w_attack_next > 0.0) {
return;
@ -182,7 +181,7 @@ w_combatknife_secondary(void)
//throw it! play this sound too.
arg_thisWeapon.iCount -= 1;
pl.updateSlotCountsForEquippedWeapon();
arg_thisWeapon.forceBodygroup1Submodel = 1; //reset, new knife is not bloody.
arg_thisWeapon.iForceBodygroup1Submodel = 1; //reset, new knife is not bloody.
TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_miss.wav");
#ifdef SERVER
CTSThrownProjectile::generate2(pl, arg_thisWeapon);

View File

@ -125,7 +125,6 @@ w_contenderg2_holster(void)
void
w_contenderg2_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -144,7 +143,8 @@ w_contenderg2_primary(void)
SoundPitched_Send(pl, SNDP_CONTENDERG2_FIRE);
if ( random() <= 0.5 ) {
int r = (float)input_sequence % 2;
if (r == 0) {
TS_Weapons_ViewAnimation(weaponseq_contenderg2::shoot1, 31.0f/30.0f);
} else {
TS_Weapons_ViewAnimation(weaponseq_contenderg2::shoot2, 31.0f/30.0f);
@ -172,22 +172,14 @@ w_contenderg2_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.325f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.325f);break;
}
}

View File

@ -171,9 +171,11 @@ w_deserteagle_primary(void)
}
int r;
if(!arg_thisWeapon.iIronSight){
if(arg_thisWeapon.iClipLeft > 0){
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if (r == 0) {
TS_Weapons_ViewAnimation(weaponseq_deserteagle::shoot1, 31.0f/30.0f);
} else {
TS_Weapons_ViewAnimation(weaponseq_deserteagle::shoot2, 31.0f/30.0f);
@ -217,24 +219,19 @@ w_deserteagle_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.75f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.75f);break;
}
}else{
if(pl.w_attack_next > 0){
return;
}
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon);
}

View File

@ -163,7 +163,8 @@ w_glock18_primary(void)
if(arg_thisWeapon.iClipLeft > 1){
// more than 1 bullet left? Typical
if ( random() <= 0.5 ) {
int r = (float)input_sequence % 2;
if (r == 0) {
TS_Weapons_ViewAnimation(weaponseq_glock18::shoot1, (31.0f/30.0f));
} else {
TS_Weapons_ViewAnimation(weaponseq_glock18::shoot2, (31.0f/30.0f));

View File

@ -121,7 +121,6 @@ w_glock20_holster(void)
void
w_glock20_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -145,8 +144,8 @@ w_glock20_primary(void)
}
if(arg_thisWeapon.iClipLeft > 0){
randomChoice = random();
if(randomChoice < 0.5){
int r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_glock20::shoot1, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_glock20::shoot2, 31.0f/30.0f);

View File

@ -125,7 +125,6 @@ w_hkpdw_holster(void)
void
w_hkpdw_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -148,10 +147,10 @@ w_hkpdw_primary(void)
SoundPitched_Send(pl, SNDP_HKPDW_FIRE_SIL);
}
randomChoice = random();
if(randomChoice < 1/3){
int r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot, 21.0f/30.0f);
}else if(randomChoice < 2/3){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot2, 21.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot3, 21.0f/30.0f);
@ -181,22 +180,14 @@ w_hkpdw_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.50f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
}

View File

@ -120,7 +120,6 @@ w_karate_primary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
if (pl.w_attack_next > 0.0) {
return;
@ -156,14 +155,14 @@ w_karate_primary(void)
//Animation_ShootWeapon( self );
pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.085, 1);
randomChoice = randomInRange_i(0, 3);
if(randomChoice == 0){
int r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_karate::punch_left, (31.0f/40.0f) );
}else if(randomChoice == 1){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_karate::punch_right, (31.0f/30.0f) );
}else if(randomChoice == 2){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_karate::uppercut, (31.0f/30.0f) );
}else if(randomChoice == 3){
}else{
TS_Weapons_ViewAnimation(weaponseq_karate::punch_right2, (31.0f/30.0f) );
}
@ -265,7 +264,6 @@ w_karate_secondary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
// a warning if this isn't defaulted, really?
// The whole point of being sent as a reference in determineSecondaryAttack is
// to give it a value though, I think this FTE warning is wrong, but satisfying anyway
@ -300,13 +298,13 @@ w_karate_secondary(void)
}
#endif
int r;
if(meleeAnimToPlay == 0){
//ordinary
randomChoice = randomInRange_i(0,1);
if(randomChoice == 0){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_karate::kick, (31.0f/30.0f) );
}else if(randomChoice == 1){
}else{
TS_Weapons_ViewAnimation(weaponseq_karate::sidekick, (31.0f/30.0f) );
}
}else if(meleeAnimToPlay == 1){

View File

@ -107,13 +107,11 @@ w_katana_holster(void)
{
}
void
w_katana_primary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
MELEE_HIT_RESPONSE hitRep;
int meleeAnimToPlay = 0;
@ -169,9 +167,11 @@ w_katana_primary(void)
// Don't check 'hitRep' client side, ray-checks to see what was hit are
// ineffective there
#ifdef SERVER
int r;
if (hitRep == MELEE_HIT_RESPONSE::NONE ) {
randomChoice = randomInRange_i(0, 1);
if(randomChoice == 0){
r = (float)input_sequence % 2;
if(r == 0){
SoundPitched_Send(pl, SNDP_KATANA_MISS);
}else{
SoundPitched_Send(pl, SNDP_KATANA_MISS1);
@ -179,14 +179,14 @@ w_katana_primary(void)
}else if(hitRep == MELEE_HIT_RESPONSE::SOFT){
//nothin
}else if(hitRep == MELEE_HIT_RESPONSE::METAL){
randomChoice = randomInRange_i(0, 1);
if(randomChoice == 0){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_PlaySoundDirect(pl, "weapons/katana/hit.wav");
}else{
TS_Weapons_PlaySoundDirect(pl, "weapons/katana/hit1.wav");
}
}else if(hitRep == MELEE_HIT_RESPONSE::FLESH){
arg_thisWeapon.forceBodygroup1Submodel = 2;
arg_thisWeapon.iForceBodygroup1Submodel = 2;
TS_Weapons_PlaySoundDirect(pl, "weapons/katana/hit-body.wav");
}
#endif

View File

@ -137,7 +137,6 @@ w_m16a4_holster(void)
void
w_m16a4_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -165,25 +164,26 @@ w_m16a4_primary(void)
}
SoundPitched_Send(pl, SNDP_M16A4_FIRE);
int r;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 1/4){
r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_m16a4::shoot1, (31.0f/30.0f) );
}else if(randomChoice < 2/4){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_m16a4::shoot2, (31.0f/30.0f) );
}else if(randomChoice < 3/4){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_m16a4::sshoot1, (31.0f/30.0f) );
}else{
TS_Weapons_ViewAnimation(weaponseq_m16a4::sshoot2, (31.0f/30.0f) );
}
}else{
randomChoice = random();
if(randomChoice < 1/4){
r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_m16a4::shoot3, (31.0f/30.0f) );
}else if(randomChoice < 2/4){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_m16a4::shoot4, (31.0f/30.0f) );
}else if(randomChoice < 3/4){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_m16a4::sshoot3, (31.0f/30.0f) );
}else{
TS_Weapons_ViewAnimation(weaponseq_m16a4::sshoot4, (31.0f/30.0f) );
@ -227,27 +227,20 @@ w_m16a4_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.40f);
break;}
case 2:{
pl.setZoom(0.10f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
case 2:pl.setZoom(0.10f);break;
}
}else{
if(pl.w_attack_next > 0){
return;
}
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl , (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon);
}

View File

@ -167,7 +167,6 @@ w_m4a1_holster(void)
void
w_m4a1_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -190,24 +189,25 @@ w_m4a1_primary(void)
SoundPitched_Send(pl, SNDP_M4A1_FIRE_SIL);
}
int r;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 1/4){
r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_m4a1::shoot1, (31.0f/30.0f) );
}else if(randomChoice < 2/4){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_m4a1::shoot2, (31.0f/30.0f) );
}else if(randomChoice < 3/4){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_m4a1::sshoot1, (31.0f/30.0f) );
}else{
TS_Weapons_ViewAnimation(weaponseq_m4a1::sshoot2, (31.0f/30.0f) );
}
}else{
randomChoice = random();
if(randomChoice < 1/4){
r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_m4a1::shoot3, (31.0f/30.0f) );
}else if(randomChoice < 2/4){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_m4a1::shoot4, (31.0f/30.0f) );
}else if(randomChoice < 3/4){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_m4a1::sshoot3, (31.0f/30.0f) );
}else{
TS_Weapons_ViewAnimation(weaponseq_m4a1::sshoot4, (31.0f/30.0f) );
@ -238,24 +238,19 @@ w_m4a1_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.325f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.325f);break;
}
}else{
if(pl.w_attack_next > 0){
return;
}
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon);
}

View File

@ -117,7 +117,6 @@ w_m60_holster(void)
void
w_m60_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -132,8 +131,8 @@ w_m60_primary(void)
SoundPitched_Send(pl, SNDP_M60_FIRE);
randomChoice = random();
if(randomChoice < 0.5){
int r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_m60::shoot, 31.0f/33.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_m60::shoot2, 31.0f/33.0f);

View File

@ -148,7 +148,6 @@ w_mac10_holster(void)
void
w_mac10_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -171,32 +170,32 @@ w_mac10_primary(void)
SoundPitched_Send(pl, SNDP_MAC10_FIRE_SIL);
}
int r = (float)input_sequence % 6;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 1/6){
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_mac10::shoot, 31.0f/30.0f);
}else if(randomChoice < 2/6){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_mac10::shoot2, 31.0f/30.0f);
}else if(randomChoice < 3/6){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_mac10::shoot3, 31.0f/30.0f);
}else if(randomChoice < 4/6){
}else if(r == 3){
TS_Weapons_ViewAnimation(weaponseq_mac10::sshoot, 31.0f/30.0f);
}else if(randomChoice < 5/6){
}else if(r == 4){
TS_Weapons_ViewAnimation(weaponseq_mac10::sshoot2, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_mac10::sshoot3, 31.0f/30.0f);
}
}else{
randomChoice = random();
if(randomChoice < 1/6){
r = (float)input_sequence % 6;
if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_mac10::shootb, 31.0f/30.0f);
}else if(randomChoice < 2/6){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_mac10::shootb2, 31.0f/30.0f);
}else if(randomChoice < 3/6){
}else if(r == 3){
TS_Weapons_ViewAnimation(weaponseq_mac10::shootb3, 31.0f/30.0f);
}else if(randomChoice < 4/6){
}else if(r == 4){
TS_Weapons_ViewAnimation(weaponseq_mac10::sshootb, 31.0f/30.0f);
}else if(randomChoice < 5/6){
}else if(r == 5){
TS_Weapons_ViewAnimation(weaponseq_mac10::sshootb2, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_mac10::sshootb3, 31.0f/30.0f);

View File

@ -148,7 +148,6 @@ w_miniuzi_holster(void)
void
w_miniuzi_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -170,27 +169,27 @@ w_miniuzi_primary(void)
} else {
SoundPitched_Send(pl, SNDP_MINIUZI_FIRE_SIL);
}
int r;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 1/4){
r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_miniuzi::shoot, (31.0f/30.0f) );
}else if(randomChoice < 2/4){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_miniuzi::shoot2, (31.0f/30.0f) );
}else if(randomChoice < 3/4){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_miniuzi::sshoot, (31.0f/30.0f) );
}else{ //4/4
}else{
TS_Weapons_ViewAnimation(weaponseq_miniuzi::sshoot2, (31.0f/30.0f) );
}
}else{
randomChoice = random();
if(randomChoice < 1/4){
r = (float)input_sequence % 4;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_miniuzi::shootb, (31.0f/30.0f) );
}else if(randomChoice < 2/4){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_miniuzi::shootb2, (31.0f/30.0f) );
}else if(randomChoice < 3/4){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_miniuzi::sshootb, (31.0f/30.0f) );
}else{ //4/4
}else{
TS_Weapons_ViewAnimation(weaponseq_miniuzi::sshootb2, (31.0f/30.0f) );
}
}

View File

@ -145,7 +145,6 @@ w_miniuzi_akimbo_holster(void)
// Putting it here avoids duplicating a bunch of code.
// Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point.
void weapon_miniuzi_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){
float randomChoice;
int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; //default
// NOTE! weapon_akimbo_semiAttackChoice already handles telling to skip firing if
@ -213,7 +212,7 @@ void weapon_miniuzi_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int
}
}
int r;
if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){
if(finalAkimboChoice == BITS_AKIMBOCHOICE_LEFT){
@ -244,18 +243,18 @@ void weapon_miniuzi_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int
}else{
//printfline("VM: UZI: BOTH");
randomChoice = random();
if(randomChoice < 1/6){
r = (float)input_sequence % 6;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_miniuzi_akimbo::akimbo_shoot1, (31.0f/30.0f) );
}else if(randomChoice < 2/6){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_miniuzi_akimbo::akimbo_shoot2, (31.0f/30.0f) );
}else if(randomChoice < 3/6){
}else if(r == 2){
TS_Weapons_ViewAnimation(weaponseq_miniuzi_akimbo::akimbo_shoot3, (31.0f/30.0f) );
}else if(randomChoice < 4/6){
}else if(r == 3){
TS_Weapons_ViewAnimation(weaponseq_miniuzi_akimbo::akimbo_sshoot1, (31.0f/30.0f) );
}else if(randomChoice < 5/6){
}else if(r == 4){
TS_Weapons_ViewAnimation(weaponseq_miniuzi_akimbo::akimbo_sshoot2, (31.0f/30.0f) );
}else{ // 6/6
}else{
TS_Weapons_ViewAnimation(weaponseq_miniuzi_akimbo::akimbo_sshoot3, (31.0f/30.0f) );
}

View File

@ -185,9 +185,8 @@ w_mossberg500_primary(void)
//if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
if(pl.shotgunWaitingForPump){
if(arg_thisWeapon.bNeedsPump){
// pump instead!
pl.shotgunWaitingForPump = FALSE;
// Sounds like the mossberg just re-uses the benelli m3's sound,
// as the mossberg sound folder lacks a pump sound.
@ -208,6 +207,7 @@ w_mossberg500_primary(void)
}
}
arg_thisWeapon.bNeedsPump = FALSE;
weapon_base_setWholeAttackDelay(pl, 14.0f/35.0f);
return;
}
@ -231,7 +231,7 @@ w_mossberg500_primary(void)
}
// no shell! Pumping does that.
pl.shotgunWaitingForPump = TRUE;
arg_thisWeapon.bNeedsPump = TRUE;
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::WEIRD);
//}

View File

@ -139,7 +139,6 @@ w_mp5k_holster(void)
void
w_mp5k_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -171,16 +170,17 @@ w_mp5k_primary(void)
SoundPitched_Send(pl, SNDP_MP5K_FIRE_SIL);
}
int r;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 1/2){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_mp5k::shoot1, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_mp5k::shoot2, 31.0f/30.0f);
}
}else{
randomChoice = random();
if(randomChoice < 1/2){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_mp5k::shoot1b, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_mp5k::shoot2b, 31.0f/30.0f);
@ -223,24 +223,19 @@ w_mp5k_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.40f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
}
}else{
if(pl.w_attack_next > 0){
return;
}
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon);
}

View File

@ -123,7 +123,6 @@ w_mp5sd_holster(void)
void
w_mp5sd_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -153,10 +152,10 @@ w_mp5sd_primary(void)
SoundPitched_Send(pl, SNDP_MP5SD_FIRE);
randomChoice = random();
if(randomChoice < 1/3){
int r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_mp5sd::shoot1, 31.0f/30.0f);
}else if(randomChoice < 2/3){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_mp5sd::shoot2, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_mp5sd::shoot3, 31.0f/30.0f);
@ -194,22 +193,14 @@ w_mp5sd_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.40f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
}
}

View File

@ -121,7 +121,6 @@ w_ragingbull_holster(void)
void
w_ragingbull_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -140,7 +139,8 @@ w_ragingbull_primary(void)
SoundPitched_Send(pl, SNDP_RAGINGBULL_FIRE);
if ( random() <= 0.5 ) {
int r = (float)input_sequence % 2;
if (r == 0) {
TS_Weapons_ViewAnimation(weaponseq_ragingbull::shoot, 31.0f/30.0f);
} else {
TS_Weapons_ViewAnimation(weaponseq_ragingbull::shoot2, 31.0f/30.0f);
@ -167,22 +167,14 @@ w_ragingbull_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.50f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
}

View File

@ -123,7 +123,6 @@ w_rugermk1_holster(void)
void
w_rugermk1_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -143,8 +142,8 @@ w_rugermk1_primary(void)
// silencer only!
SoundPitched_Send(pl, SNDP_RUGERMK1_FIRE);
randomChoice = random();
if(randomChoice < 0.5){
int r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_rugermk1::shoot1, 31.0f/35.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_rugermk1::shoot2, 31.0f/35.0f);

View File

@ -166,7 +166,6 @@ w_sawedoff_holster(void)
void
w_sawedoff_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -184,17 +183,18 @@ w_sawedoff_primary(void)
}
SoundPitched_Send(pl, SNDP_SAWEDOFF_FIRE);
int r;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 0.5){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_sawedoff::shoot1, 31.0f/33.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_sawedoff::shoot2, 31.0f/33.0f);
}
}else{
randomChoice = random();
if(randomChoice < 0.5){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_sawedoff::shoot1b, 31.0f/33.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_sawedoff::shoot2b, 31.0f/33.0f);

View File

@ -111,7 +111,6 @@ w_sealknife_primary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
if (pl.w_attack_next > 0.0) {
return;
@ -132,7 +131,7 @@ w_sealknife_primary(void)
}else if(hitRep == MELEE_HIT_RESPONSE::METAL){
TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hit.wav");
}else if(hitRep == MELEE_HIT_RESPONSE::FLESH){
arg_thisWeapon.forceBodygroup1Submodel = 2;
arg_thisWeapon.iForceBodygroup1Submodel = 2;
TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hitbody.wav");
}
#endif
@ -141,12 +140,12 @@ w_sealknife_primary(void)
//self.fAttackFinished = time + wptKNIFE.fAttackFinished;
// actually do this animation the same regardless as far as we know.
randomChoice = randomInRange_i(0, 2);
if(randomChoice == 0){
int r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_sealknife::slash1, (31.0f/30.0f) );
}else if(randomChoice == 1){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_sealknife::slash2, (31.0f/30.0f) );
}else if(randomChoice == 2){
}else{
TS_Weapons_ViewAnimation(weaponseq_sealknife::slash3, (31.0f/30.0f) );
}
@ -159,7 +158,6 @@ w_sealknife_secondary(void)
{
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
float randomChoice;
if (pl.w_attack_next > 0.0) {
return;
@ -174,7 +172,7 @@ w_sealknife_secondary(void)
//throw it! play this sound too.
arg_thisWeapon.iCount -= 1;
pl.updateSlotCountsForEquippedWeapon();
arg_thisWeapon.forceBodygroup1Submodel = 1; //reset, new knife is not bloody.
arg_thisWeapon.iForceBodygroup1Submodel = 1; //reset, new knife is not bloody.
TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_miss.wav");
#ifdef SERVER
CTSThrownProjectile::generate2(pl, arg_thisWeapon);

View File

@ -118,7 +118,6 @@ w_skorpion_holster(void)
void
w_skorpion_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -137,10 +136,10 @@ w_skorpion_primary(void)
SoundPitched_Send(pl, SNDP_SKORPION_FIRE);
randomChoice = random();
if(randomChoice < 1/3){
int r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_skorpion::fire1, 31.0f/30.0f);
}else if(randomChoice < 2/3){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_skorpion::fire2, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_skorpion::fire3, 31.0f/30.0f);

View File

@ -120,7 +120,6 @@ w_skorpion_akimbo_holster(void)
// Putting it here avoids duplicating a bunch of code.
// Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point.
void weapon_skorpion_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){
float randomChoice;
int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; //default
// NOTE! weapon_akimbo_semiAttackChoice already handles telling to skip firing if
@ -180,7 +179,7 @@ void weapon_skorpion_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, in
SoundPitched_Send(pl, SNDP_SKORPION_FIRE);
}
int r;
if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){
if(finalAkimboChoice == BITS_AKIMBOCHOICE_LEFT){
@ -211,8 +210,8 @@ void weapon_skorpion_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, in
}else{
//printfline("VM: UZI: BOTH");
randomChoice = random();
if(randomChoice < 0.5){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_skorpion_akimbo::fire1ak, (31.0f/30.0f) );
}else{
TS_Weapons_ViewAnimation(weaponseq_skorpion_akimbo::fire2ak, (31.0f/30.0f) );

View File

@ -168,14 +168,17 @@ w_socommk23_primary(void)
SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE_SIL);
}
int r;
if(!arg_thisWeapon.iIronSight){
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_socommk23::shootb1, (31.0f/30.0f));
} else {
TS_Weapons_ViewAnimation(weaponseq_socommk23::shootb2, (31.0f/30.0f));
}
}else{
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_socommk23::shootc1, (31.0f/30.0f));
} else {
TS_Weapons_ViewAnimation(weaponseq_socommk23::shootc2, (31.0f/30.0f));

View File

@ -233,6 +233,7 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i
}
int r;
if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){
// Not both fire types chosen
// Firing the opposite way within this time will let the dual animation play.
@ -241,13 +242,15 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i
if(finalAkimboChoice == BITS_AKIMBOCHOICE_LEFT){
//printfline("VM: LEFT");
if(!arg_thisWeapon.iIronSight){
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_left1, (31.0f/40.0f), 2 );
} else {
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_left2, (31.0f/40.0f), 2 );
}
}else{
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_leftb1, (31.0f/40.0f), 2 );
} else {
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_leftb2, (31.0f/40.0f), 2 );
@ -265,13 +268,15 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i
}else if(finalAkimboChoice == BITS_AKIMBOCHOICE_RIGHT){
//printfline("VM: RIGHT");
if(!arg_thisWeapon.iIronSight){
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_right1, (31.0f/40.0f), 2 );
} else {
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_right2, (31.0f/40.0f), 2 );
}
}else{
if ( random() <= 0.5 ) {
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_rightb1, (31.0f/40.0f), 2 );
} else {
TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_rightb2, (31.0f/40.0f), 2 );
@ -310,6 +315,15 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i
weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1);
}
/*
// TODO: akimbo support
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC, finalAkimboChoice);
} else {
weapon_EjectShell(SHELLEJECT_ID::GENERIC, finalAkimboChoice);
}
*/
}// weapon_socommk23_akimbo_attack

View File

@ -139,7 +139,6 @@ w_spas12_holster(void)
void
w_spas12_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -161,9 +160,8 @@ w_spas12_primary(void)
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
if(pl.shotgunWaitingForPump){
if(arg_thisWeapon.bNeedsPump){
// pump instead!
pl.shotgunWaitingForPump = FALSE;
//SoundPitched_Channel_Send(pl, SNDP_SPAS12_PUMP, CHAN_AUTO);
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/spas12/spas12-pump.wav", CHAN_AUTO);
@ -178,11 +176,12 @@ w_spas12_primary(void)
TS_Weapons_ViewAnimation(weaponseq_spas12::pump2, 31.0f/35.0f);
}
arg_thisWeapon.bNeedsPump = FALSE;
weapon_base_setWholeAttackDelay(pl, 14.0f/35.0f);
return;
}
}else{
pl.shotgunWaitingForPump = FALSE;
arg_thisWeapon.bNeedsPump = FALSE;
}
// we still want to be able to do a pump on firing the last in the clip
@ -196,7 +195,7 @@ w_spas12_primary(void)
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
TS_Weapons_ViewAnimation(weaponseq_spas12::shootpump, (31.0f/35.0f) );
// no shell! Pumping does that.
pl.shotgunWaitingForPump = TRUE;
arg_thisWeapon.bNeedsPump = TRUE;
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::WEIRD);
}else{
TS_Weapons_ViewAnimation(weaponseq_spas12::shootsemi, (31.0f/35.0f) );

View File

@ -124,7 +124,6 @@ w_steyraug_holster(void)
void
w_steyraug_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -173,22 +172,14 @@ w_steyraug_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.50f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
}

View File

@ -140,7 +140,6 @@ w_steyrtmp_holster(void)
void
w_steyrtmp_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -164,16 +163,17 @@ w_steyrtmp_primary(void)
SoundPitched_Send(pl, SNDP_STEYRTMP_FIRE_SIL);
}
int r;
if(!arg_thisWeapon.iIronSight){
randomChoice = random();
if(randomChoice < 1/2){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shoot, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shoot2, 31.0f/30.0f);
}
}else{
randomChoice = random();
if(randomChoice < 1/2){
r = (float)input_sequence % 2;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shootb, 31.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shootb2, 31.0f/30.0f);

View File

@ -128,7 +128,6 @@ w_ump_holster(void)
void
w_ump_primary(void)
{
float randomChoice;
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
@ -151,10 +150,10 @@ w_ump_primary(void)
SoundPitched_Send(pl, SNDP_UMP_FIRE_SIL);
}
randomChoice = random();
if(randomChoice < 1/3){
int r = (float)input_sequence % 3;
if(r == 0){
TS_Weapons_ViewAnimation(weaponseq_ump::shoot1, 19.0f/30.0f);
}else if(randomChoice < 2/3){
}else if(r == 1){
TS_Weapons_ViewAnimation(weaponseq_ump::shoot2, 19.0f/30.0f);
}else{
TS_Weapons_ViewAnimation(weaponseq_ump::shoot3, 19.0f/30.0f);
@ -184,22 +183,14 @@ w_ump_secondary(void)
player pl = (player)self;
weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex];
if(pl.w_attack_next > 0){
return;
}
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:{
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.50f);
break;}
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
}