the slot1-10 keys are now working as expected.

This commit is contained in:
Marco Cawthorne 2020-03-25 19:57:08 +01:00
parent 80d06e7dcd
commit aa6b541313
39 changed files with 195 additions and 54 deletions

View file

@ -636,34 +636,34 @@ CSQC_ConsoleCommand(string sCMD)
pSeat->iShowScores = FALSE;
break;
case "slot1":
localcmd("impulse 1\n");
HUD_SlotSelect(0);
break;
case "slot2":
localcmd("impulse 2\n");
HUD_SlotSelect(1);
break;
case "slot3":
localcmd("impulse 3\n");
HUD_SlotSelect(2);
break;
case "slot4":
localcmd("impulse 4\n");
HUD_SlotSelect(3);
break;
case "slot5":
localcmd("impulse 5\n");
HUD_SlotSelect(4);
break;
case "slot6":
localcmd("impulse 6\n");
HUD_SlotSelect(5);
break;
case "slot7":
localcmd("impulse 7\n");
HUD_SlotSelect(6);
break;
case "slot8":
localcmd("impulse 8\n");
HUD_SlotSelect(7);
break;
case "slot9":
localcmd("impulse 9\n");
HUD_SlotSelect(8);
break;
case "slot10":
localcmd("impulse 10\n");
HUD_SlotSelect(9);
break;
default:
return Game_ConsoleCommand();

View file

@ -116,6 +116,43 @@ int HUD_InSlotPos(int slot, int pos)
return -1;
}
int HUD_SlotSelect(int slot)
{
player pl = (player)pSeat->ePlayer;
int curslot = g_weapons[pSeat->fHUDWeaponSelected].slot;
int i;
if (pSeat->fHUDWeaponSelectTime < time) {
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
} else {
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
}
/* weren't in that slot? select the first one then */
if (curslot != slot) {
for (i = 1; i < g_weapons.length; i++) {
if (g_weapons[i].slot == slot) {
pSeat->fHUDWeaponSelected = i;
pSeat->fHUDWeaponSelectTime = time + 3;
break;
}
}
} else {
/* increment our current selected weapon by 1 */
pSeat->fHUDWeaponSelected++;
pSeat->fHUDWeaponSelectTime = time + 3;
/* reset when out of bounds or outside slot area */
if (pSeat->fHUDWeaponSelected >= g_weapons.length) {
pSeat->fHUDWeaponSelected = 0;
HUD_SlotSelect(slot);
} else if (g_weapons[pSeat->fHUDWeaponSelected].slot != slot) {
pSeat->fHUDWeaponSelected = 0;
HUD_SlotSelect(slot);
}
}
}
void HUD_DrawWeaponSelect(void)
{
player pl = (player)pSeat->ePlayer;

View file

@ -118,6 +118,43 @@ int HUD_InSlotPos(int slot, int pos)
return -1;
}
int HUD_SlotSelect(int slot)
{
player pl = (player)pSeat->ePlayer;
int curslot = g_weapons[pSeat->fHUDWeaponSelected].slot;
int i;
if (pSeat->fHUDWeaponSelectTime < time) {
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
} else {
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
}
/* weren't in that slot? select the first one then */
if (curslot != slot) {
for (i = 1; i < g_weapons.length; i++) {
if (g_weapons[i].slot == slot) {
pSeat->fHUDWeaponSelected = i;
pSeat->fHUDWeaponSelectTime = time + 3;
break;
}
}
} else {
/* increment our current selected weapon by 1 */
pSeat->fHUDWeaponSelected++;
pSeat->fHUDWeaponSelectTime = time + 3;
/* reset when out of bounds or outside slot area */
if (pSeat->fHUDWeaponSelected >= g_weapons.length) {
pSeat->fHUDWeaponSelected = 0;
HUD_SlotSelect(slot);
} else if (g_weapons[pSeat->fHUDWeaponSelected].slot != slot) {
pSeat->fHUDWeaponSelected = 0;
HUD_SlotSelect(slot);
}
}
}
void HUD_DrawWeaponSelect(void)
{
player pl = (player)pSeat->ePlayer;

View file

@ -110,6 +110,43 @@ int HUD_InSlotPos(int slot, int pos)
return -1;
}
int HUD_SlotSelect(int slot)
{
player pl = (player)pSeat->ePlayer;
int curslot = g_weapons[pSeat->fHUDWeaponSelected].slot;
int i;
if (pSeat->fHUDWeaponSelectTime < time) {
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
} else {
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
}
/* weren't in that slot? select the first one then */
if (curslot != slot) {
for (i = 1; i < g_weapons.length; i++) {
if (g_weapons[i].slot == slot) {
pSeat->fHUDWeaponSelected = i;
pSeat->fHUDWeaponSelectTime = time + 3;
break;
}
}
} else {
/* increment our current selected weapon by 1 */
pSeat->fHUDWeaponSelected++;
pSeat->fHUDWeaponSelectTime = time + 3;
/* reset when out of bounds or outside slot area */
if (pSeat->fHUDWeaponSelected >= g_weapons.length) {
pSeat->fHUDWeaponSelected = 0;
HUD_SlotSelect(slot);
} else if (g_weapons[pSeat->fHUDWeaponSelected].slot != slot) {
pSeat->fHUDWeaponSelected = 0;
HUD_SlotSelect(slot);
}
}
}
void HUD_DrawWeaponSelect(void)
{
player pl = (player)pSeat->ePlayer;

View file

@ -617,24 +617,22 @@ void monster_scientist::Respawn(void)
v_angle[2] = Math_FixDelta(m_oldAngle[2]);
flags |= FL_MONSTER;
setorigin(this, m_oldOrigin);
angles = v_angle;
solid = SOLID_SLIDEBOX;
movetype = MOVETYPE_WALK;
setmodel(this, m_oldModel);
setsize(this, VEC_HULL_MIN + [0,0,36], VEC_HULL_MAX + [0,0,36]);
m_eUser = world;
setorigin(this, m_oldOrigin);
takedamage = DAMAGE_YES;
iBleeds = TRUE;
style = SCI_IDLE;
customphysics = Physics;
frame = SCIA_IDLE1;
SendFlags |= NPC_FRAME | NPC_BODY;
health = 50;
velocity = [0,0,0];
m_iFlags = 0x0;
SendFlags = 0xff;
m_eUser = world;
customphysics = Physics;
if (autocvar_sh_scialert) {
m_iFlags |= SCIF_FEAR;
}
@ -678,7 +676,6 @@ void monster_scientist::monster_scientist(void)
model = "models/scientist.mdl";
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);
Respawn();
if (body == -1) {
/* This stuff needs to be persistent because we can't guarantee that
@ -704,5 +701,4 @@ void monster_scientist::monster_scientist(void)
m_flPitch = 100;
netname = "Slick";
}
SendFlags |= NPC_FRAME | NPC_BODY;
}

View file

@ -16,7 +16,8 @@
/*QUAKED monster_alien_controller (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Alien Controller
*/
class monster_alien_controller:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_alien_grunt (0 0.8 0.8) (-32 -32 0) (32 32 64)
Monster.
Alien Grunt
*/
class monster_alien_grunt:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_alien_slave (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Alien Slave
*/
class monster_alien_slave:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_apache (0 0.8 0.8) (-300 -300 -172) (300 300 8)
Monster.
Boeing AH-64 Apache
*/
class monster_apache:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_babycrab (0 0.8 0.8) (-16 -16 0) (16 16 36)
Monster.
Baby Headcrab
*/
class monster_babycrab:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_barnacle (0 0.8 0.8) (-16 -16 -36) (16 16 0)
Monster.
Barnacle
*/
class monster_barnacle:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_barney (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Barney Calhoun
*/
enum {

View file

@ -16,7 +16,8 @@
/*QUAKED monster_barney_dead (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Barney's corpse
*/
class monster_barney_dead:CBaseEntity

View file

@ -16,7 +16,8 @@
/*QUAKED monster_bigmomma (0 0.8 0.8) (-95 -95 0) (95 95 190)
Monster.
Gonarch
*/
class monster_bigmomma:CBaseMonster
@ -33,7 +34,7 @@ void monster_bigmomma::Respawn(void)
void monster_bigmomma::monster_bigmomma(void)
{
netname = "Big Momma";
netname = "Gonarch";
model = "models/big_mom.mdl";
CBaseMonster::CBaseMonster();
}

View file

@ -16,7 +16,8 @@
/*QUAKED monster_bloater (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Flocking Floater
*/
class monster_bloater:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_bullchicken (0 0.8 0.8) (-32 -32 0) (32 32 64)
Monster.
Bullsquid
*/
class monster_bullchicken:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_cockroach (0 0.8 0.8) (-4 -4 0) (4 4 4)
Monster.
Cockroach
*/
class monster_cockroach:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_flyer_flock (0 0.8 0.8) (-16 -16 0) (16 16 16)
Monster.
Boid
*/
class monster_flyer_flock:CBaseMonster
@ -33,7 +34,7 @@ void monster_flyer_flock::Respawn(void)
void monster_flyer_flock::monster_flyer_flock(void)
{
netname = "Flyer";
netname = "Boid";
model = "models/aflock.mdl";
CBaseMonster::CBaseMonster();
}

View file

@ -16,7 +16,8 @@
/*QUAKED monster_gargantua (0 0.8 0.8) (-32 -32 0) (32 32 128)
Monster.
Gargantua
*/
class monster_gargantua:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_gman (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
G-Man
*/
class monster_gman:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_headcrab (0 0.8 0.8) (-16 -16 0) (16 16 36)
Monster.
Headcrab
*/
class monster_headcrab:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_hevsuit_dead (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
HEV-Suit/Player's corpse
*/
class monster_hevsuit_dead:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_hgrunt_dead (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Human Grunt's corpse
*/
class monster_hgrunt_dead:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_houndeye (0 0.8 0.8) (-16 -16 0) (16 16 36)
Monster.
Houndeye
*/
class monster_houndeye:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_human_assassin (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Black Ops - Assassin
*/
class monster_human_assassin:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_human_grunt (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
HECU - Human Grunt
*/
class monster_human_grunt:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_ichthyosaur (0 0.8 0.8) (-32 -32 0) (32 32 64)
Monster.
Ichthyosaur
*/
class monster_ichthyosaur:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_leech (0 0.8 0.8) (-6 -6 0) (6 6 6)
Monster.
Leech
*/
class monster_leech:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_miniturret (0 0.8 0.8) (-16 -16 -32) (16 16 32)
Monster.
Automatic Turret (small)
*/
class monster_miniturret:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_nihilanth (0 0.8 0.8) (-192 -192 0) (192 192 384)
Monster.
Nihilanth
*/
class monster_nihilanth:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_osprey (0 0.8 0.8) (-480 -480 -112) (480 480 24)
Monster.
Bell Boeing VV-22 Osprey
*/
class monster_osprey:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_rat (0 0.8 0.8) (-6 -6 0) (6 6 6)
Monster.
Rat
*/
class monster_rat:CBaseEntity

View file

@ -16,7 +16,8 @@
/*QUAKED monster_scientist (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Scientist
*/
enum {

View file

@ -16,7 +16,8 @@
/*QUAKED monster_scientist_dead (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Scientists' corpse
*/
enum {

View file

@ -16,7 +16,8 @@
/*QUAKED monster_sentry (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Sentry Gun
*/
class monster_sentry:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_sitting_scientist (0 0.8 0.8) (-14 -14 0) (14 14 36)
Monster.
Sitting scientists
*/
enum {

View file

@ -16,7 +16,8 @@
/*QUAKED monster_tentacle (0 0.8 0.8) (-32 -32 0) (32 32 64)
Monster.
Tentacle
*/
class monster_tentacle:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_turret (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Automatic Turret (large)
*/
class monster_turret:CBaseMonster

View file

@ -16,7 +16,8 @@
/*QUAKED monster_zombie (0 0.8 0.8) (-16 -16 0) (16 16 72)
Monster.
Zombie
*/
enum {