From 1a458c00789c526732b0459f630e01543ea71e89 Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Fri, 14 May 2010 16:39:21 +0000 Subject: [PATCH] Testing the carbine (an old project from the devs), thanks to makkE for the advice (and the work, of course)! git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4852 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entities.cpp | 1 + source/src/entity.h | 2 +- source/src/server.h | 8 +++++--- source/src/weapon.cpp | 7 +++++++ source/src/weapon.h | 6 ++++++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 8ccec5e6..495f909c 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -305,6 +305,7 @@ bool selectnextprimary(int num) { switch(num) { + case GUN_RIFLE: case GUN_SHOTGUN: case GUN_SUBGUN: case GUN_SNIPER: diff --git a/source/src/entity.h b/source/src/entity.h index fef25521..4da7f1f6 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -41,7 +41,7 @@ struct entity : persistent_entity } }; -enum { GUN_KNIFE = 0, GUN_PISTOL, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT, GUN_GRENADE, GUN_AKIMBO, NUMGUNS }; +enum { GUN_KNIFE = 0, GUN_PISTOL, GUN_RIFLE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT, GUN_GRENADE, GUN_AKIMBO, NUMGUNS }; #define reloadable_gun(g) (g != GUN_KNIFE && g != GUN_GRENADE) #define SGRAYS 21 diff --git a/source/src/server.h b/source/src/server.h index 7468c0ed..42e01fe3 100644 --- a/source/src/server.h +++ b/source/src/server.h @@ -376,12 +376,13 @@ itemstat ammostats[NUMGUNS] = { {1, 1, 1, S_ITEMAMMO}, //knife dummy {16, 32, 72, S_ITEMAMMO}, //pistol + {15, 30, 20, S_ITEMAMMO}, //rifle (temporary values) {14, 28, 21, S_ITEMAMMO}, //shotgun {60, 90, 90, S_ITEMAMMO}, //subgun {10, 20, 15, S_ITEMAMMO}, //sniper {30, 60, 60, S_ITEMAMMO}, //assault {2, 0, 2, S_ITEMAMMO}, //grenade - {72, 0, 72, S_ITEMAKIMBO} //akimbo + {72, 0, 72, S_ITEMAKIMBO} //akimbo }; itemstat powerupstats[I_ARMOUR-I_HEALTH+1] = @@ -394,10 +395,11 @@ guninfo guns[NUMGUNS] = { { "knife", S_KNIFE, S_NULL, 0, 500, 50, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, false }, { "pistol", S_PISTOL, S_RPISTOL, 1400, 170, 19, 0, 0, 80, 10, 8, 6, 5, 1, 40, 75, 150, 1, false }, + { "rifle", S_ASSAULT, S_RASSAULT, 1950, 600, 45, 0, 0, 60, 50, 10, 4, 4, 2, 100, 60, 150, 1, false }, // temporary values { "shotgun", S_SHOTGUN, S_RSHOTGUN, 2400, 1000, 5, 0, 0, 1, 35, 7, 9, 9, 1, 130, 500, 150, 1, false }, - { "subgun", S_SUBGUN, S_RSUBGUN, 1650, 80, 16, 0, 0, 70, 15, 30, 1, 2, 7, 15, 30, 250, 1, true }, + { "subgun", S_SUBGUN, S_RSUBGUN, 1650, 80, 16, 0, 0, 70, 15, 30, 1, 2, 5, 15, 55, 250, 1, true }, { "sniper", S_SNIPER, S_RSNIPER, 1950, 1500, 85, 0, 0, 60, 50, 5, 4, 4, 1, 100, 500, 100, 1, false }, - { "assault", S_ASSAULT, S_RASSAULT, 2000, 130, 24, 0, 0, 20, 40, 15, 0, 2, 2, 25, 60, 150, 1, true }, + { "assault", S_ASSAULT, S_RASSAULT, 2000, 130, 24, 0, 0, 20, 40, 20, 0, 2, 2, 25, 60, 150, 1, true }, { "grenade", S_NULL, S_NULL, 1000, 650, 200, 20, 6, 1, 1, 1, 3, 1, 0, 0, 0, 0, 3, false }, { "pistol", S_PISTOL, S_RAKIMBO, 1400, 80, 19, 0, 0, 80, 10, 16, 6, 5, 4, 30, 75, 150, 1, true }, }; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 6e1e67ee..6a9464b2 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -695,6 +695,7 @@ 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_RIFLE] = new rifle(pl); pl->weapons[GUN_SHOTGUN] = new shotgun(pl); pl->weapons[GUN_SNIPER] = new sniperrifle(pl); pl->weapons[GUN_SUBGUN] = new subgun(pl); @@ -1106,6 +1107,12 @@ void sniperrifle::setscope(bool enable) } } +// rifle + +rifle::rifle(playerent *owner) : gun(owner, GUN_RIFLE) {} + +bool rifle::selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; } + // assaultrifle diff --git a/source/src/weapon.h b/source/src/weapon.h index 0197850b..31b54415 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -118,6 +118,12 @@ struct sniperrifle : gun }; +struct rifle : gun +{ + rifle(playerent *owner); + bool selectable(); +}; + struct shotgun : gun { shotgun(playerent *owner);