From ef76f7f88d66259da9897d5a969b5253af5a413c Mon Sep 17 00:00:00 2001 From: Lucas GAUTHERON Date: Fri, 24 Aug 2012 16:01:10 +0000 Subject: [PATCH] hardcoded burst fire settings (menus still TODO) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6862 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- changelog.txt | 1 + source/src/clientgame.cpp | 12 ++++++++++++ source/src/command.cpp | 5 +++++ source/src/protos.h | 1 + source/src/weapon.cpp | 4 ++++ 5 files changed, 23 insertions(+) diff --git a/changelog.txt b/changelog.txt index 1e0915c7..1b66f4ea 100644 --- a/changelog.txt +++ b/changelog.txt @@ -20,6 +20,7 @@ Weapons [*] Grenades accuracy, real shotgun accuracy. [*] Sniper trail bug fixed. // TODO: Is this for the "stop the sniper trail upon hit thing"? If so I'm not 100% certain it's completely fixed. // Bukz [*] Hudgun can be displayed when spectating (and in demos - e.g. /specthudgun 1). +[*] Burst fire settings Gameplay --------------------- diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 8f2bb894..9fa8dcb2 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -881,6 +881,18 @@ void writekillmsgcfg() f->printf("\n"); } +void burstshots(int gun, int shots = -1) +{ + if(gun >= 0 && gun < NUMGUNS && guns[gun].isauto) + { + if(shots >= 0) burstshotssettings[gun] = shots; + else intret(burstshotssettings[gun]); + } + else conoutf(_("invalid gun specified")); +} + +COMMAND(burstshots, ARG_2INT); + // damage arriving from the network, monsters, yourself, all ends up here. void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bool local) diff --git a/source/src/command.cpp b/source/src/command.cpp index 047e023e..b941fcc0 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -1395,6 +1395,11 @@ void writecfg() } ); f->printf("\n"); + loopi(NUMGUNS) if(guns[i].isauto) + { + f->printf("burstshots %d %d\n", i, burstshotssettings[i]); + } + f->printf("\n"); writebinds(f); f->printf("\n"); enumerate(*idents, ident, id, diff --git a/source/src/protos.h b/source/src/protos.h index 829b92bc..f4490df9 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -702,6 +702,7 @@ extern void damageeffect(int damage, playerent *d); extern void tryreload(playerent *p); extern void checkweaponstate(); extern struct projectile *newprojectile(vec &from, vec &to, float speed, bool local, playerent *owner, int gun, int id = lastmillis); +extern int burstshotssettings[NUMGUNS]; // entities extern void spawnallitems(); diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index d5a6421d..f85edae4 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -13,6 +13,8 @@ struct sgray { }; sgray sgr[SGRAYS*3]; +int burstshotssettings[NUMGUNS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + void updatelastaction(playerent *d, int millis = lastmillis) { loopi(NUMGUNS) d->weapons[i]->updatetimers(millis); @@ -1184,6 +1186,8 @@ bool gun::attack(vec &targ) if(!info.isauto) owner->attacking = false; + if(burstshotssettings[this->type] > 0 && shots >= burstshotssettings[this->type]) owner->attacking = false; + vec from = owner->o; vec to = targ; from.z -= weaponbeloweye;