WEAPON_TRIPMINE: Wiggle with SetBody and SetFrame on the pickup a bit.

This commit is contained in:
Marco Cawthorne 2022-04-26 21:03:32 -07:00
parent fef95603e7
commit 8fad0d7dc1
Signed by: eukara
GPG key ID: C196CD8BA993248A
4 changed files with 61 additions and 56 deletions

View file

@ -28,7 +28,7 @@ string g_pbones[] =
"Dummy16", "Dummy16",
"Bip01 R Leg", "Bip01 R Leg",
"Bip01 R Leg1", "Bip01 R Leg1",
"Bip01 R Foot", "Bip01 R Foot",
"Bip01 R Toe0", "Bip01 R Toe0",
"Bip01 R Toe01", "Bip01 R Toe01",
"Bip01 R Toe02", "Bip01 R Toe02",
@ -89,6 +89,7 @@ string g_pbones[] =
"Bone15" "Bone15"
}; };
.string oldmodel;
void void
Player_HandleWeaponModel(base_player pp, float thirdperson) Player_HandleWeaponModel(base_player pp, float thirdperson)
{ {
@ -100,26 +101,26 @@ Player_HandleWeaponModel(base_player pp, float thirdperson)
} }
/* what's the current weapon model supposed to be anyway? */ /* what's the current weapon model supposed to be anyway? */
string wmodel = Weapons_GetPlayermodel(pl, pl.activeweapon); pl.p_model.oldmodel = Weapons_GetPlayermodel(pl, pl.activeweapon);
/* we changed weapons, update skeletonindex */ /* we changed weapons, update skeletonindex */
if (pl.p_model.model != wmodel) { if (pl.p_model.model != pl.p_model.oldmodel) {
/* free memory */ /* free memory */
if (pl.p_model.skeletonindex) if (pl.p_model.skeletonindex)
skel_delete(pl.p_model.skeletonindex); skel_delete(pl.p_model.skeletonindex);
/* set the new model and mark us updated */ /* set the new model and mark us updated */
setmodel(pl.p_model, wmodel); setmodel(pl.p_model, pl.p_model.oldmodel);
pl.p_model.model = wmodel; pl.p_model.model = pl.p_model.oldmodel;
/* set the new skeletonindex */ /* set the new skeletonindex */
pl.p_model.skeletonindex = skel_create(pl.p_model.modelindex); 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 */ /* 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")) if (autocvar(cl_himodels, 1, "Use high-quality player models over lower-definition ones"))
setcustomskin(self, "", "geomset 0 2\n"); setcustomskin(pl, "", "geomset 0 2\n");
else else
setcustomskin(self, "", "geomset 0 1\n"); setcustomskin(pl, "", "geomset 0 1\n");
} }
/* follow player at all times */ /* follow player at all times */

View file

@ -180,49 +180,6 @@ void w_gauss_primary(player pl)
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
} }
void w_gauss_secondary(player pl)
{
#ifdef CLIENT
if (pl.mode_tempstate)
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 100 + (200 * (pl.ammo_gauss_volume/255)), 0, 0);
#endif
if (pl.w_attack_next) {
return;
}
pl.w_attack_next = 0.1f;
/* Ammo check */
if (pl.ammo_uranium <= 0) {
if (pl.mode_tempstate > 0) {
w_gauss_release(pl);
}
return;
}
if (pl.ammo_gauss_volume < 255)
pl.ammo_uranium--;
/* Set pitch sound shift */
pl.ammo_gauss_volume += 16;
if (pl.ammo_gauss_volume > 255) {
pl.ammo_gauss_volume = 255;
}
if (pl.mode_tempstate == 1) {
Weapons_ViewAnimation(pl, GAUSS_SPIN);
pl.mode_tempstate = 2;
pl.w_idle_next = 0.0f;
} else if (!pl.mode_tempstate) {
Weapons_ViewAnimation(pl, GAUSS_SPINUP);
#ifdef CLIENT
sound(pl, CHAN_WEAPON, "ambience/pulsemachine.wav", 2, ATTN_NORM);
#endif
pl.mode_tempstate = 1;
}
}
void w_gauss_release(player pl) void w_gauss_release(player pl)
{ {
if (pl.w_idle_next > 0.0) { if (pl.w_idle_next > 0.0) {
@ -247,9 +204,7 @@ void w_gauss_release(player pl)
Animation_PlayerTop(pl, ANIM_SHOOTGAUSS, 0.43f); Animation_PlayerTop(pl, ANIM_SHOOTGAUSS, 0.43f);
Weapons_ViewPunchAngle(pl, [-5,0,0]); Weapons_ViewPunchAngle(pl, [-5,0,0]);
#ifdef CLIENT #ifdef SERVER
soundupdate(pl, CHAN_WEAPON, "", -1, ATTN_NORM, 0, 0, 0);
#else
w_gauss_fire(pl, 0); w_gauss_fire(pl, 0);
FX_GaussBeam(Weapons_GetCameraPos(pl), input_angles, 6, pl); FX_GaussBeam(Weapons_GetCameraPos(pl), input_angles, 6, pl);
#endif #endif
@ -278,6 +233,47 @@ void w_gauss_release(player pl)
} }
} }
void w_gauss_secondary(player pl)
{
if (pl.w_attack_next) {
return;
}
pl.w_attack_next = 0.1f;
/* Ammo check */
if (pl.ammo_uranium <= 0) {
if (pl.mode_tempstate > 0) {
w_gauss_release(pl);
}
return;
}
if (pl.ammo_gauss_volume < 10)
pl.ammo_uranium--;
/* Set pitch sound shift */
pl.ammo_gauss_volume += 1;
if (pl.ammo_gauss_volume > 100) {
pl.ammo_gauss_volume = 100;
#ifdef SERVER
Damage_Apply(pl, pl, 10, DMG_ELECTRO, WEAPON_GAUSS);
#endif
pl.mode_tempstate = 0;
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
pl.ammo_gauss_volume = 0;
Weapons_ViewAnimation(pl, GAUSS_IDLE1);
}
if (pl.mode_tempstate == 1) {
Weapons_ViewAnimation(pl, GAUSS_SPIN);
pl.mode_tempstate = 2;
} else if (!pl.mode_tempstate) {
Weapons_ViewAnimation(pl, GAUSS_SPINUP);
pl.mode_tempstate = 1;
}
}
void w_gauss_crosshair(player pl) void w_gauss_crosshair(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT

View file

@ -416,6 +416,9 @@ weapon_t w_tripmine =
#ifdef SERVER #ifdef SERVER
void void
weapon_tripmine(void) { weapon_tripmine(void) {
item_pickup ip = (item_pickup)self;
Weapons_InitItem(WEAPON_TRIPMINE); Weapons_InitItem(WEAPON_TRIPMINE);
ip.SetBody(2);
ip.SetFrame(8);
} }
#endif #endif

View file

@ -43,10 +43,15 @@ seta "maxplayers" "8"
seta "con_color" "255 150 0" seta "con_color" "255 150 0"
seta "vgui_color" "255 170 0" seta "vgui_color" "255 170 0"
seta "cross_color" "0 255 0" seta "cross_color" "0 255 0"
// disable some nuclide niceties // disable some nuclide niceties
seta v_muzzledlight 0 seta v_muzzledlight 0
// config compat // config compat
alias mp_timelimit timelimit alias mp_timelimit timelimit
alias mp_fraglimit fraglimit alias mp_fraglimit fraglimit
// video settings
seta gl_overbright 0
seta gl_ldr 1
seta r_lightmap_format rgb8