Coded the 45 pistol
2013-07-21, 12:03 AM (This post was last modified: 2013-07-21, 12:24 AM by dm.mossberg590a1.)
#3
RE: Coded the 45 pistol
Yeah I had to keep the recoil somewhat high in order to balance the game. At close range though the pistol is beastly because you can fire pretty quickly and most of the shots will hit their target. Basically if you love firing rounds as fast as you can click your mouse the p226 is better but if you value accuracy more than the 1911 is the way to go.

Realistically, I have never fired the 1911, but based on what other people say the 45 is not as bad as people say it is. The 1911 should generally have the same recoil as a Glock 19 because the 1911 is heavier and absorbs recoil while the small and light Glock does not. p = mv, as some people say.

Ruler501, I did the following:

weapon.h
enum {
WEAP_KNIFE = 0,
WEAP_PISTOL,
WEAP_PISTOL2, ....

struct pistol : gun
{
pistol(playerent *owner, int weap) : gun(owner,weap) {}
};

struct p226 : pistol
{
p226(playerent *owner) : pistol(owner, WEAP_PISTOL) {}
};

struct m1911 : pistol
{
m1911(playerent *owner) : pistol(owner, WEAP_PISTOL2) {}
};

weapon.cpp
(for akimbo)
if(w->selectable() || w==curweapon || ((w->type==WEAP_PISTOL || w->type==WEAP_PISTOL2) && player1->akimbo))

In weapon::equipplayer
pl->weapons[WEAP_PISTOL] = new p226(pl);
pl->weapons[WEAP_PISTOL2] = new m1911(pl);

Commented out the pistol constructor
// pistol
//pistol::pistol(playerent *owner) : gun(owner, WEAP_PISTOL) {}

Entity.h
default: secondary = WEAP_PISTOL; break;
case WEAP_PISTOL:
case WEAP_PISTOL2:
case WEAP_HEAL:
case WEAP_SWORD:
case WEAP_RPG:
secondary = nextsecondary;
break;

server.h
const int gungame[] = {
WEAP_ASSAULT2,
WEAP_SNIPER,
WEAP_SNIPER2,
WEAP_ASSAULT,
WEAP_SUBGUN,
WEAP_BOLT,
WEAP_SHOTGUN,
WEAP_PISTOL,
WEAP_PISTOL2,
WEAP_RPG,
WEAP_HEAL, // nuke after killing with this
};

{ "pistol2", S_PISTOL, S_RPISTOL, 1400, 90, 60, 24, 90, 17, 0, 0, 90, 90, 9, 7, 8, 6, 4, 50, 70, 70, 2, false},

I did this just by glancing at the code, so there are probably a ton of other dependencies I didn't see, also the akimbo thing is all messed up. I personally would like to just get rid of all that akimbo crap and focus on realism, but otherwise it would be a major pain in the butt.

Anyways, this code is really messed up... it needs to have a better structure so that weapons could be more easily added. Right now it seems like almost all of the pistol code was only coded with one pistol in mind and the RPG is still labeled the crossbow... Also a lot of the tricky parts don't have documentation so it is even harder to understand the code.

[Image: name_zps459dc421.gif]
[Image: cooltext1206791925_zps58ab60b5.gif]

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." - Bjarne Stroustrup
Post Reply Quote this message in a reply


Messages In This Thread
Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-20, 04:04 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-20, 11:09 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-21, 12:03 AM
RE: Coded the 45 pistol - by ruler501 - 2013-07-21, 12:36 AM
RE: Coded the 45 pistol - by -{ET}-xdEpicZombie - 2013-07-21, 06:00 AM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-21, 10:19 AM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-21, 11:06 AM
RE: Coded the 45 pistol - by ruler501 - 2013-07-21, 04:05 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-21, 08:18 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-21, 08:45 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-21, 09:22 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-21, 09:54 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-21, 11:31 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-22, 08:40 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-22, 09:08 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-22, 09:56 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-22, 11:47 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-23, 01:35 AM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-07-23, 10:21 AM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-07-24, 10:08 AM
RE: Coded the 45 pistol - by ruler501 - 2013-07-24, 11:22 AM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-03, 10:47 PM
RE: Coded the 45 pistol - by ruler501 - 2013-08-03, 11:40 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-04, 12:06 AM
RE: Coded the 45 pistol - by {KE}bluwarguy - 2013-08-04, 10:11 AM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-04, 12:39 PM
RE: Coded the 45 pistol - by -{ET}-xdEpicZombie - 2013-08-04, 02:24 PM
RE: Coded the 45 pistol - by {KE}bluwarguy - 2013-08-04, 03:02 PM
RE: Coded the 45 pistol - by ruler501 - 2013-08-04, 04:45 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-04, 08:07 PM
RE: Coded the 45 pistol - by ruler501 - 2013-08-04, 11:34 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-05, 01:22 AM
RE: Coded the 45 pistol - by ruler501 - 2013-08-05, 11:36 AM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-05, 12:02 PM
RE: Coded the 45 pistol - by ruler501 - 2013-08-05, 03:01 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-05, 09:31 PM
RE: Coded the 45 pistol - by ruler501 - 2013-08-06, 01:45 AM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-06, 01:32 PM
RE: Coded the 45 pistol - by ruler501 - 2013-08-06, 02:52 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-08-07, 08:57 AM
RE: Coded the 45 pistol - by ruler501 - 2013-08-07, 09:11 AM
RE: Coded the 45 pistol - by forumlurker007 - 2013-10-29, 12:47 AM
RE: Coded the 45 pistol - by ruler501 - 2013-10-29, 03:02 PM
RE: Coded the 45 pistol - by dm.mossberg590a1 - 2013-10-29, 03:28 PM
RE: Coded the 45 pistol - by DeltaStrikeOp - 2013-10-29, 06:55 PM
RE: Coded the 45 pistol - by forumlurker007 - 2013-10-29, 10:07 PM

Forum Jump:


This forum uses Lukasz Tkacz MyBB addons.