cleanup cpistol

This commit is contained in:
ac-stef
2017-06-27 15:15:25 +02:00
parent 1fe478aae4
commit 3a320de948
17 changed files with 13 additions and 145 deletions
+1 -2
View File
@@ -251,9 +251,8 @@ menuitemtextinput "Shotgun: " [ fragmessage SHOTGUN ] [ fragmessage SHOTGUN $arg
menuitemtextinput "SMG: " [ fragmessage SUBGUN ] [ fragmessage SUBGUN $arg1 ] [] 15
menuitemtextinput "Sniper: " [ fragmessage SNIPER ] [ fragmessage SNIPER $arg1 ] [] 15
menuitemtextinput "AR: " [ fragmessage ASSAULT ] [ fragmessage ASSAULT $arg1 ] [] 15
//menuitemtextinput "CPistol: " [ fragmessage CPISTOL ] [ fragmessage CPISTOL $arg1 ] [] 15
menuitemtextinput "Akimbo: " [ fragmessage AKIMBO ] [ fragmessage AKIMBO $arg1 ] [] 15
menuitem [] -1
menuitem "" -1
menuitem "\f9Gib messages: " -1
menuitemtextinput "Knife: " [ gibmessage KNIFE ] [ gibmessage KNIFE $arg1 ] [] 15
menuitemtextinput "Shotgun: " [ gibmessage SHOTGUN ] [ gibmessage SHOTGUN $arg1 ] [] 15
-1
View File
@@ -187,7 +187,6 @@ loop i $NUM_WEAPONS [ (concatword altaction_ $i) = quicknadethrow ] // Quick nad
// Use format to define altaction_N aliases from now on, makes for less edits in the future if weapon IDs change. - Bukz
// (format altaction_%1 (getgunindex knife)) = [ if (checkmag (currentprimary)) primary [ if (|| (checkmag PISTOL) (checkmag AKIMBO)) secondary [ if (checkmag GRENADE) grenades ] ] ] // Knife // uncomment to switch to primary/secondary/grenades with MOUSE2 depending on ammo content for each.
(format altaction_%1 (getgunindex sniper)) = [ setscope 1; onrelease [ setscope 0 ] ] // Sniper
// (format altaction_%1 (getgunindex cpistol)) = [ setburst 1; onrelease [ setburst 0 ] ] // Combat pistol // TODO uncomment when this becomes a priority/testing, for now lets save an unused alias - Bukz
// (format altaction_%1 (getgunindex grenades)) = attack // Grenade // with this comment, you throw the nade and the nade is unselected : Brahma
oldsens = $sensitivity
+1 -1
View File
@@ -22,7 +22,7 @@ extern void spawnstate(playerent *d);
void CACBot::Spawn()
{
// Init all bot variabeles
m_pMyEnt->nextprimary = 2 + rnd(5); // 2011jan18:ft: 2 == GUN_CARBINE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT - if CPISTOL is activated this needs a FIXME to rnd(6)
m_pMyEnt->nextprimary = 2 + rnd(5); // 2 == GUN_CARBINE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT
m_pMyEnt->targetyaw = m_pMyEnt->targetpitch = 0.0f;
m_pMyEnt->pBot = this;
+1 -1
View File
@@ -14,7 +14,7 @@
#define AC_BOT_H
//#define BOTDEBUG
#define MAX_WEAPONS 10
#define MAX_WEAPONS 9 // NUM_GUNS
class CACBot: public CBot
{
-1
View File
@@ -24,7 +24,6 @@ weaponinfo_s WeaponInfoTable[MAX_WEAPONS] =
{ TYPE_AUTO, 0.0f, 25.0f, 3.0f, 60.0f, 10 }, // SUBGUN
{ TYPE_SNIPER, 10.0f, 125.0f, 3.0f, 200.0f, 3 }, // SNIPER
{ TYPE_AUTO, 20.0f, 80.0f, 3.0f, 150.0f, 6 }, // ASSAULT
{ TYPE_AUTO, 0.0f, 0.0f, 3.0f, 0.0f, 6 }, // CPISTOL
{ TYPE_GRENADE, 5.0f, 30.0f, 3.0f, 50.0f, 1 }, // GRENADE
{ TYPE_AUTO, 0.0f, 50.0f, 3.0f, 50.0f, 0 } // AKIMBO
};
-3
View File
@@ -442,7 +442,6 @@ void deathstate(playerent *pl)
{
if(showscoresondeath) showscores(true);
setscope(false);
setburst(false);
if(editmode) toggleedit(true);
if(pl->team == TEAM_SPECT) spectatemode(SM_FLY);
else if(team_isspect(pl->team)) spectatemode(SM_FOLLOW1ST);
@@ -458,7 +457,6 @@ void spawnstate(playerent *d) // reset player state not persistent
if(d==player1)
{
setscope(false);
setburst(false);
}
if(d->deaths==0) d->resetstats();
}
@@ -790,7 +788,6 @@ void respawnself()
}
showscores(false);
setscope(false);
setburst(false);
lasthit = 0;
spawnplayer(player1);
player1->lifesequence++;
-1
View File
@@ -616,7 +616,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false)
if(editmode) toggleedit(true);
showscores(false);
setscope(false);
setburst(false);
player1->respawn();
player1->lifesequence = getint(p);
player1->health = getint(p);
-1
View File
@@ -304,7 +304,6 @@ void saycommand(char *init) // turns input to the comman
{
SDL_EnableUNICODE(saycommandon = (init!=NULL));
setscope(false);
setburst(false);
if(!editmode) keyrepeat(saycommandon);
copystring(cmdline.buf, init ? escapestring(init, false, true) : "");
DELETEA(cmdaction);
+1 -1
View File
@@ -53,7 +53,7 @@ struct entity : persistent_entity
}
};
enum { GUN_KNIFE = 0, GUN_PISTOL, GUN_CARBINE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT, GUN_CPISTOL, GUN_GRENADE, GUN_AKIMBO, NUMGUNS };
enum { GUN_KNIFE = 0, GUN_PISTOL, GUN_CARBINE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT, GUN_GRENADE, GUN_AKIMBO, NUMGUNS };
#define valid_weapon(g) ((g) >= GUN_KNIFE && (g) < NUMGUNS)
#define reloadable_gun(g) ((g) != GUN_KNIFE && (g) != GUN_GRENADE)
-1
View File
@@ -115,7 +115,6 @@ void preload_hudguns()
{
loopi(NUMGUNS)
{
if(i == GUN_CPISTOL) continue;
defformatstring(path)("weapons/%s", guns[i].modelname);
loadmodel(path);
}
-1
View File
@@ -915,7 +915,6 @@ extern void addgib(playerent *d);
extern playerent *playerincrosshair();
extern int magsize(int gun);
extern void setscope(bool activate);
extern void setburst(bool activate);
extern void intersectgeometry(const vec &from, vec &to);
extern int intersect(playerent *d, const vec &from, const vec &to, vec *end = NULL);
extern bool intersect(entity *e, const vec &from, const vec &to, vec *end = NULL);
+2 -2
View File
@@ -187,7 +187,7 @@ void loadcrosshair(const char *type, const char *filename)
}
else if(strchr(type, '.'))
{ // old syntax "loadcrosshair filename type", remove this in 2020
const char *oldcrosshairnames[CROSSHAIR_NUM + 1] = { "default", "teammate", "scope", "knife", "pistol", "carbine", "shotgun", "smg", "sniper", "ar", "cpistol", "grenades", "akimbo", "" };
const char *oldcrosshairnames[CROSSHAIR_NUM + 1] = { "default", "teammate", "scope", "knife", "pistol", "carbine", "shotgun", "smg", "sniper", "ar", "grenades", "akimbo", "" };
index = getlistindex(filename, oldcrosshairnames, false, 0);
if(index > 2) index -= 3;
else index += NUMGUNS;
@@ -338,7 +338,7 @@ void drawequipicons(playerent *p)
// weapons
int c = p->weaponsel->type != GUN_GRENADE ? p->weaponsel->type : getprevweaponsel(p), r = 0;
if(c==GUN_AKIMBO || c==GUN_CPISTOL) c = GUN_PISTOL; // same icon for akimb & pistol
if(c==GUN_AKIMBO) c = GUN_PISTOL; // same icon for akimb & pistol
if(c>3) { c -= 4; r = 1; }
if(p->weaponsel && valid_weapon(p->weaponsel->type)) drawequipicon(HUDPOS_WEAPON*2, 1650, c, r);
-1
View File
@@ -916,7 +916,6 @@ void preload_playermodels()
if(dynshadow && playermdl) playermdl->genshadows(8.0f, 4.0f);
loopi(NUMGUNS)
{
if(i == GUN_CPISTOL) continue;
defformatstring(vwep)("weapons/%s/world", guns[i].modelname);
model *vwepmdl = loadmodel(vwep);
if(dynshadow && vwepmdl) vwepmdl->genshadows(8.0f, 4.0f);
+2 -2
View File
@@ -3367,7 +3367,7 @@ void process(ENetPacket *packet, int sender, int chan)
case SV_WEAPCHANGE:
{
int gunselect = getint(p);
if(!valid_weapon(gunselect) || gunselect == GUN_CPISTOL) break;
if(!valid_weapon(gunselect)) break;
cl->state.gunselect = gunselect;
QUEUE_MSG;
break;
@@ -3466,7 +3466,7 @@ void process(ENetPacket *packet, int sender, int chan)
{
int ls = getint(p), gunselect = getint(p);
if((cl->state.state!=CS_ALIVE && cl->state.state!=CS_DEAD && cl->state.state!=CS_SPECTATE) ||
ls!=cl->state.lifesequence || cl->state.lastspawn<0 || !valid_weapon(gunselect) || gunselect == GUN_CPISTOL) break;
ls!=cl->state.lifesequence || cl->state.lastspawn<0 || !valid_weapon(gunselect)) break;
cl->state.lastspawn = -1;
cl->state.spawn = sg->gamemillis;
cl->autospawn = false;
+2 -4
View File
@@ -504,7 +504,6 @@ itemstat ammostats[NUMGUNS] =
{ 60, 90, 90, S_ITEMAMMO }, // subgun
{ 10, 20, 15, S_ITEMAMMO }, // sniper
{ 40, 60, 60, S_ITEMAMMO }, // assault
{ 30, 45, 75, S_ITEMAMMO }, // cpistol
{ 1, 0, 3, S_ITEMAMMO }, // grenade
{100, 0, 100, S_ITEMAKIMBO} // akimbo
};
@@ -531,7 +530,6 @@ guninfo guns[NUMGUNS] =
{ "subgun", "A-ARD/10 SMG", S_SUBGUN, S_RSUBGUN, 1650, 80, 16, 0, 0, 0, 45, 15, 30, 1, 2, 5, 25, 50, 188, 1, true },
{ "sniper", "AD-81 SR", S_SNIPER, S_RSNIPER, 1950, 1500, 82, 25, 0, 0, 50, 50, 5, 4, 4, 10, 85, 85, 100, 1, false },
{ "assault", "MTP-57 AR", S_ASSAULT, S_RASSAULT, 2000, 120, 22, 0, 0, 0, 18, 30, 20, 0, 2, 3, 25, 50, 115, 1, true },
{ "cpistol", "nop", S_PISTOL, S_RPISTOL, 1400, 120, 19, 0, 0, 0, 35, 10, 15, 6, 5, 6, 35, 50, 125, 1, false }, // temporary
{ "grenade", "Grenades", S_NULL, S_NULL, 1000, 650, 200, 0, 20, 6, 1, 1, 1, 3, 1, 0, 0, 0, 0, 3, false },
{ "pistol", "Akimbo", S_PISTOL, S_RAKIMBO, 1400, 80, 18, 0, 0, 0, 50, 10, 20, 6, 5, 4, 15, 25, 115, 1, true },
};
@@ -545,8 +543,8 @@ const char *rolenames[CR_NUM + 1] = { "unarmed", "master", "admin", "owner", ""
const char *killmessages[2][NUMGUNS] =
{
{ "", "busted", "picked off", "peppered", "sprayed", "punctured", "shredded", "busted", "", "busted" },
{ "slashed", "", "", "splattered", "", "headshot", "", "", "gibbed", "" }
{ "", "busted", "picked off", "peppered", "sprayed", "punctured", "shredded", "", "busted" },
{ "slashed", "", "", "splattered", "", "headshot", "", "gibbed", "" }
};
#define C(x) (1<<(SC_##x))
+3 -110
View File
@@ -14,7 +14,7 @@ struct sgray {
sgray sgr[SGRAYS*3];
int burstshotssettings[NUMGUNS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
int burstshotssettings[NUMGUNS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, };
void updatelastaction(playerent *d, int millis = lastmillis)
{
@@ -868,7 +868,7 @@ VARP(accuracy,0,0,1);
void r_accuracy(int h)
{
int i = player1->weaponsel->type;
if(accuracy && valid_weapon(i) && i != GUN_CPISTOL)
if(accuracy && valid_weapon(i))
{
int x_offset = 2 * HUDPOS_X_BOTTOMLEFT, y_offset = 2 * (h - 1.75 * FONTH);
string line;
@@ -889,7 +889,7 @@ void r_accuracy(int h)
void accuracyinfo()
{
vector <char*>lines;
loopi(NUMGUNS) if(i != GUN_CPISTOL && accuracym[i].shots)
loopi(NUMGUNS) if(accuracym[i].shots)
{
float acc = 100.0 * accuracym[i].hits / (float)accuracym[i].shots;
string line;
@@ -1075,7 +1075,6 @@ void weapon::equipplayer(playerent *pl)
pl->weapons[GUN_GRENADE] = new grenades(pl);
pl->weapons[GUN_KNIFE] = new knife(pl);
pl->weapons[GUN_PISTOL] = new pistol(pl);
pl->weapons[GUN_CPISTOL] = new cpistol(pl);
pl->weapons[GUN_CARBINE] = new carbine(pl);
pl->weapons[GUN_SHOTGUN] = new shotgun(pl);
pl->weapons[GUN_SNIPER] = new sniperrifle(pl);
@@ -1538,111 +1537,6 @@ int assaultrifle::dynspread() { return shots > 2 ? 55 : ( info.spread + ( shots
float assaultrifle::dynrecoil() { return info.recoil + (rnd(8)*-0.01f); }
bool assaultrifle::selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; }
// combat pistol
cpistol::cpistol(playerent *owner) : gun(owner, GUN_CPISTOL), bursting(false) {}
bool cpistol::selectable() { return false; /*return weapon::selectable() && !m_noprimary && this == owner->primweap;*/ }
void cpistol::onselecting() { weapon::onselecting(); bursting = false; }
void cpistol::ondeselecting() { bursting = false; }
bool cpistol::reload(bool autoreloaded)
{
bool r = weapon::reload(autoreloaded);
if(owner==player1 && r) { bursting = false; }
return r;
}
bool burst = false;
int burstshots = 0;
bool cpistol::attack(vec &targ) // modded from gun::attack // FIXME
{
int attackmillis = lastmillis-owner->lastaction - gunwait;
if(attackmillis<0) return false;
gunwait = reloading = 0;
if (bursting) burst = true;
if(!owner->attacking)
{
shots = 0;
checkautoreload();
return false;
}
attackmillis = lastmillis - min(attackmillis, curtime);
updatelastaction(owner, attackmillis);
if(!mag)
{
audiomgr.playsoundc(S_NOAMMO);
gunwait += 250;
owner->lastattackweapon = NULL;
shots = 0;
checkautoreload();
return false;
}
owner->lastattackweapon = this;
shots++;
if (burst) burstshots++;
if(!burst) owner->attacking = false;
vec from = owner->o;
vec to = targ;
from.z -= weaponbeloweye;
attackphysics(from, to);
hits.setsize(0);
raydamage(from, to, owner);
attackfx(from, to, 0);
if ( burst && burstshots > 2 )
{
gunwait = 500;
burstshots = 0;
burst = owner->attacking = false;
}
else if ( burst )
{
gunwait = 80;
}
else
{
gunwait = info.attackdelay;
}
mag--;
sendshoot(from, to, attackmillis);
return true;
}
void cpistol::setburst(bool enable)
{
if(this == owner->weaponsel && !reloading && owner->state == CS_ALIVE)
{
bursting = enable;
}
}
void setburst(bool enable)
{
if(player1->weaponsel->type != GUN_CPISTOL) return;
if(intermission) return;
cpistol *cp = (cpistol *)player1->weaponsel;
cp->setburst(enable);
if (!burst)
{
if ( enable && burstshots == 0 ) attack(true);
}
else
{
if ( burstshots == 0 ) burst = player1->attacking = enable;
}
}
COMMAND(setburst, "d");
// pistol
pistol::pistol(playerent *owner) : gun(owner, GUN_PISTOL) {}
@@ -1751,7 +1645,6 @@ void setscope(bool enable)
COMMANDF(setscope, "i", (int *on) { setscope(*on != 0); });
void shoot(playerent *p, vec &targ)
{
if(p->state!=CS_ALIVE || p->weaponchanging) return;
-12
View File
@@ -143,18 +143,6 @@ struct assaultrifle : gun
bool selectable();
};
struct cpistol : gun
{
bool bursting;
cpistol(playerent *owner);
bool reload(bool autoreloaded);
bool selectable();
void onselecting();
void ondeselecting();
bool attack(vec &targ);
void setburst(bool enable);
};
struct pistol : gun
{
pistol(playerent *owner);