weapon firing state
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1061 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4d9407b887
commit
181a88c471
6 changed files with 60 additions and 47 deletions
|
@ -12,21 +12,23 @@ Suicide timer limit
|
||||||
Suicide backpack/quad/ring drop
|
Suicide backpack/quad/ring drop
|
||||||
Condense bprint, sprint, centerprints
|
Condense bprint, sprint, centerprints
|
||||||
te_explode sprite
|
te_explode sprite
|
||||||
|
NQ/QW cross compatibility
|
||||||
|
|
||||||
Todo -
|
Todo -
|
||||||
Track oldbutton presses
|
Track oldbutton presses/weaponstate
|
||||||
Samelevel 4 (exit acts as a spawnpoint teleporter)
|
Samelevel 4 (exit acts as a spawnpoint teleporter)
|
||||||
Don't use newmis/spawn projectiles in front
|
Generic projectile spawning
|
||||||
|
Effects/decal system
|
||||||
Fix weird deathmatch modes, cvar checking
|
Fix weird deathmatch modes, cvar checking
|
||||||
sv_gravity change?
|
Add monsters back
|
||||||
|
Rogue/hipnotic weapons/monsters/hud stuffs
|
||||||
|
Q2/Q3 ents
|
||||||
|
H2/HL ents
|
||||||
|
|
||||||
|
Stray Ideas -
|
||||||
Advanced heal decay (only decay health that the megahealth added?)
|
Advanced heal decay (only decay health that the megahealth added?)
|
||||||
Effects system, NQ/QW cross compatibility
|
|
||||||
Object-oriented?/Unionize?
|
|
||||||
Add monsters back?
|
|
||||||
H2 ents?
|
|
||||||
HL ents?
|
|
||||||
Q3 ents?
|
|
||||||
Decal system based on visibility from players?
|
|
||||||
Clean up backpack pickup prints?
|
Clean up backpack pickup prints?
|
||||||
|
Decal system based on visibility from players?
|
||||||
CSQC?
|
CSQC?
|
||||||
Rogue/hipnotic weapons/monsters?
|
Don't use newmis/spawn projectiles in front?
|
||||||
|
sv_gravity change?
|
|
@ -514,6 +514,7 @@ void() PutClientInServer =
|
||||||
self.effects = 0;
|
self.effects = 0;
|
||||||
self.invincible_time = 0;
|
self.invincible_time = 0;
|
||||||
self.suicide_time = time + 3;
|
self.suicide_time = time + 3;
|
||||||
|
self.weaponstate = WS_IDLE;
|
||||||
|
|
||||||
DecodeLevelParms ();
|
DecodeLevelParms ();
|
||||||
|
|
||||||
|
|
|
@ -214,19 +214,12 @@ void(entity targ, entity inflictor, entity attacker, float damage, INTEGER mod)
|
||||||
dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
|
dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
|
||||||
dir = normalize(dir);
|
dir = normalize(dir);
|
||||||
// Set kickback for smaller weapons
|
// Set kickback for smaller weapons
|
||||||
//Zoid -- use normal NQ kickback
|
targ.velocity = targ.velocity + dir * damage * 8;
|
||||||
// // Read: only if it's not yourself doing the damage
|
|
||||||
// if ( (damage < 60) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker.netname != targ.netname))
|
|
||||||
// targ.velocity = targ.velocity + dir * damage * 11;
|
|
||||||
// else
|
|
||||||
// Otherwise, these rules apply to rockets and grenades
|
|
||||||
// for blast velocity
|
|
||||||
targ.velocity = targ.velocity + dir * damage * 8;
|
|
||||||
|
|
||||||
// Rocket Jump modifiers
|
// Rocket Jump modifiers
|
||||||
if ( (rj > 1) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker == targ))
|
if (rj > 1 && attacker == targ)
|
||||||
targ.velocity = targ.velocity + dir * damage * rj;
|
if (targ.classname == "player")
|
||||||
|
targ.velocity = targ.velocity + dir * damage * rj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,10 +229,10 @@ void(entity targ, entity inflictor, entity attacker, float damage, INTEGER mod)
|
||||||
return;
|
return;
|
||||||
if (targ.invincible_finished >= time)
|
if (targ.invincible_finished >= time)
|
||||||
{
|
{
|
||||||
if (self.invincible_sound < time)
|
if (targ.invincible_sound < time)
|
||||||
{
|
{
|
||||||
sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
|
sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
|
||||||
self.invincible_sound = time + 2;
|
targ.invincible_sound = time + 2;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,6 +421,7 @@ float EF_FLAG2 = 32;
|
||||||
// GLQuakeWorld Stuff
|
// GLQuakeWorld Stuff
|
||||||
// float EF_BLUE = 64; // Blue Globe effect for Quad
|
// float EF_BLUE = 64; // Blue Globe effect for Quad
|
||||||
// float EF_RED = 128; // Red Globe effect for Pentagram
|
// float EF_RED = 128; // Red Globe effect for Pentagram
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
#define MSG_BROADCAST 0 // unreliable to all
|
#define MSG_BROADCAST 0 // unreliable to all
|
||||||
#define MSG_ONE 1 // reliable to one (msg_entity)
|
#define MSG_ONE 1 // reliable to one (msg_entity)
|
||||||
|
@ -435,12 +436,12 @@ float EF_FLAG2 = 32;
|
||||||
#define PRINT_CHAT 3
|
#define PRINT_CHAT 3
|
||||||
|
|
||||||
// multicast sets
|
// multicast sets
|
||||||
float MULTICAST_ALL = 0; // every client
|
#define MULTICAST_ALL 0 // every client
|
||||||
float MULTICAST_PHS = 1; // within hearing
|
#define MULTICAST_PHS 1 // within hearing
|
||||||
float MULTICAST_PVS = 2; // within sight
|
#define MULTICAST_PVS 2 // within sight
|
||||||
float MULTICAST_ALL_R = 3; // every client, reliable
|
#define MULTICAST_ALL_R 3 // every client, reliable
|
||||||
float MULTICAST_PHS_R = 4; // within hearing, reliable
|
#define MULTICAST_PHS_R 4 // within hearing, reliable
|
||||||
float MULTICAST_PVS_R = 5; // within sight, reliable
|
#define MULTICAST_PVS_R 5 // within sight, reliable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -565,8 +566,6 @@ float AS_MISSILE = 4;
|
||||||
// doors, etc
|
// doors, etc
|
||||||
//
|
//
|
||||||
.vector dest, dest1, dest2;
|
.vector dest, dest1, dest2;
|
||||||
// .float wait, see unions
|
|
||||||
// .float delay, see unions
|
|
||||||
.entity trigger_field; // door's trigger entity
|
.entity trigger_field; // door's trigger entity
|
||||||
.string noise4;
|
.string noise4;
|
||||||
|
|
||||||
|
@ -604,6 +603,11 @@ float intermission_exittime;
|
||||||
entity newmis;
|
entity newmis;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// weaponstate defines
|
||||||
|
#define WS_IDLE 0
|
||||||
|
#define WS_FIRING1 1
|
||||||
|
#define WS_FIRING2 2 // used with nailgun
|
||||||
|
|
||||||
// unions
|
// unions
|
||||||
// DO NOT MIX UNION TYPES LIKE I AM DOING
|
// DO NOT MIX UNION TYPES LIKE I AM DOING
|
||||||
.union {
|
.union {
|
||||||
|
@ -619,14 +623,15 @@ entity newmis;
|
||||||
};
|
};
|
||||||
struct { // fields used with players
|
struct { // fields used with players
|
||||||
float weaponframe_time; // weapon frame advance time
|
float weaponframe_time; // weapon frame advance time
|
||||||
|
INTEGER weaponstate; // firing state of current weapon
|
||||||
float suicide_time; // time to allow suicide after spawn
|
float suicide_time; // time to allow suicide after spawn
|
||||||
float healdecay; // time when health will decay
|
float healdecay; // time when health will decay
|
||||||
float show_hostile; // used to alert monsters
|
float show_hostile; // used to alert monsters
|
||||||
float lsound_time; // used for lightning sound playback
|
float lightning_sound; // used for lightning sound playback
|
||||||
float fly_sound; // used with trigger_push and maintaining wind sound
|
float fly_sound; // used with trigger_push and maintaining wind sound
|
||||||
};
|
};
|
||||||
struct { // fields used with bubbles spawned from drowning
|
struct { // fields used with bubbles spawned from drowning
|
||||||
float bubble_count; // keeps track of the number of bubbles
|
INTEGER bubble_count; // keeps track of the number of bubbles
|
||||||
};
|
};
|
||||||
struct { // fields used with items
|
struct { // fields used with items
|
||||||
float healamount; // amount healed with health item
|
float healamount; // amount healed with health item
|
||||||
|
|
|
@ -168,12 +168,12 @@ void() player_axed4 = [$axattd4, player_run ] {};
|
||||||
|
|
||||||
void() player_nail1 =[$nailatt1, player_nail2 ]
|
void() player_nail1 =[$nailatt1, player_nail2 ]
|
||||||
{
|
{
|
||||||
if (!self.button0 || intermission_running || self.impulse)
|
if (self.weaponstate == WS_IDLE || intermission_running || self.impulse)
|
||||||
{player_run ();return;}
|
{player_run ();return;}
|
||||||
};
|
};
|
||||||
void() player_nail2 =[$nailatt2, player_nail1 ]
|
void() player_nail2 =[$nailatt2, player_nail1 ]
|
||||||
{
|
{
|
||||||
if (!self.button0 || intermission_running || self.impulse)
|
if (self.weaponstate == WS_IDLE || intermission_running || self.impulse)
|
||||||
{player_run ();return;}
|
{player_run ();return;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,12 +181,12 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
|
||||||
|
|
||||||
void() player_light1 =[$light1, player_light2 ]
|
void() player_light1 =[$light1, player_light2 ]
|
||||||
{
|
{
|
||||||
if (!self.button0 || intermission_running)
|
if (self.weaponstate == WS_IDLE || intermission_running)
|
||||||
{player_run ();return;}
|
{player_run ();return;}
|
||||||
};
|
};
|
||||||
void() player_light2 =[$light2, player_light1 ]
|
void() player_light2 =[$light2, player_light1 ]
|
||||||
{
|
{
|
||||||
if (!self.button0 || intermission_running)
|
if (self.weaponstate == WS_IDLE || intermission_running)
|
||||||
{player_run ();return;}
|
{player_run ();return;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void() player_axpain6 = [ $axpain6, player_run ] {};
|
||||||
|
|
||||||
void() player_pain =
|
void() player_pain =
|
||||||
{
|
{
|
||||||
if (self.weaponframe)
|
if (self.weaponstate != WS_IDLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (self.invisible_finished > time)
|
if (self.invisible_finished > time)
|
||||||
|
|
|
@ -486,10 +486,10 @@ void() W_FireLightning =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.lsound_time < time)
|
if (self.lightning_sound < time)
|
||||||
{
|
{
|
||||||
sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
|
sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
|
||||||
self.lsound_time = time + 0.6;
|
self.lightning_sound = time + 0.6;
|
||||||
}
|
}
|
||||||
VK_smallkick(self);
|
VK_smallkick(self);
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ void() W_Attack =
|
||||||
makevectors (self.v_angle); // calculate forward angle for velocity
|
makevectors (self.v_angle); // calculate forward angle for velocity
|
||||||
self.show_hostile = time + 1; // wake monsters up
|
self.show_hostile = time + 1; // wake monsters up
|
||||||
|
|
||||||
if (self.weaponframe == 0) // start delay
|
if (self.weaponstate == WS_IDLE) // start delay
|
||||||
self.delay = time + 0.1;
|
self.delay = time + 0.1;
|
||||||
|
|
||||||
// animations are dealt with here
|
// animations are dealt with here
|
||||||
|
@ -1003,10 +1003,16 @@ void() W_Attack =
|
||||||
r = 0.7;
|
r = 0.7;
|
||||||
break;
|
break;
|
||||||
case IT_NAILGUN:
|
case IT_NAILGUN:
|
||||||
if (self.weaponframe & 1)
|
if (self.weaponstate == WS_FIRING1)
|
||||||
W_FireSpikes(4);
|
{
|
||||||
else
|
|
||||||
W_FireSpikes(-4);
|
W_FireSpikes(-4);
|
||||||
|
self.weaponstate = WS_FIRING2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
W_FireSpikes(4);
|
||||||
|
self.weaponstate = WS_FIRING1;
|
||||||
|
}
|
||||||
|
|
||||||
r = 0.1;
|
r = 0.1;
|
||||||
break;
|
break;
|
||||||
|
@ -1028,6 +1034,9 @@ void() W_Attack =
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.weaponstate == WS_IDLE)
|
||||||
|
self.weaponstate = WS_FIRING1;
|
||||||
|
|
||||||
// advance attack time
|
// advance attack time
|
||||||
if (self.attack_finished <= time)
|
if (self.attack_finished <= time)
|
||||||
self.attack_finished = self.attack_finished + r;
|
self.attack_finished = self.attack_finished + r;
|
||||||
|
@ -1300,7 +1309,7 @@ void() W_HandlePlayerFrame =
|
||||||
case IT_NAILGUN:
|
case IT_NAILGUN:
|
||||||
case IT_SUPER_NAILGUN:
|
case IT_SUPER_NAILGUN:
|
||||||
// cycle until fire button is released
|
// cycle until fire button is released
|
||||||
if (self.button0)
|
if (self.weaponstate != WS_IDLE)
|
||||||
{
|
{
|
||||||
self.weaponframe_time = time + 0.1;
|
self.weaponframe_time = time + 0.1;
|
||||||
self.weaponframe = self.weaponframe + 1;
|
self.weaponframe = self.weaponframe + 1;
|
||||||
|
@ -1313,7 +1322,7 @@ void() W_HandlePlayerFrame =
|
||||||
return;
|
return;
|
||||||
case IT_LIGHTNING:
|
case IT_LIGHTNING:
|
||||||
// cycle until fire button is released
|
// cycle until fire button is released
|
||||||
if (self.button0)
|
if (self.weaponstate != WS_IDLE)
|
||||||
{
|
{
|
||||||
self.weaponframe_time = time + 0.1;
|
self.weaponframe_time = time + 0.1;
|
||||||
self.weaponframe = self.weaponframe + 1;
|
self.weaponframe = self.weaponframe + 1;
|
||||||
|
@ -1368,7 +1377,10 @@ void() W_WeaponFrame =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
self.attack_finished = time;
|
self.attack_finished = time;
|
||||||
|
self.weaponstate = WS_IDLE;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue