Add pistol (#268)

This commit is contained in:
Cong
2014-07-01 00:41:05 +10:00
parent 5c3b3fac7f
commit dc2ac13434
6 changed files with 46 additions and 37 deletions

View File

@@ -596,6 +596,16 @@
"HitGuns": [
"explosion_small"
]
},
{
"Name": "9mm",
"Pic": {
"Type": "Directional",
"Sprites": "9mm"
},
"Speed": 1100,
"Range": 27,
"Power": 12
}
]
}

BIN
graphics/9mm_3x3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

View File

@@ -230,12 +230,13 @@
"MuzzleFlashParticle": "muzzle_flash_shotgun"
},
{
"Name": "Infinite Grenades",
"Bullet": "infinite_grenade",
"Name": "Pistol",
"Bullet": "9mm",
"Cost": 0,
"Lock": 1000,
"Sound": "launch",
"Elevation": 24
"Lock": 18,
"Sound": "pistol",
"Recoil": 0.1,
"Brass": "brass"
}
],
"PseudoGuns" : [

4
sounds/pistol.txt Normal file
View File

@@ -0,0 +1,4 @@
Derived from Chaingun, pistol, rifle, shotgun shots by Michel Baradari
http://opengameart.org/content/chaingun-pistol-rifle-shotgun-shots
http://creativecommons.org/licenses/by/3.0/

BIN
sounds/pistol.wav Normal file

Binary file not shown.

View File

@@ -100,36 +100,6 @@ static CPicDrawContext GetBulletDrawContext(const int id)
}
static void SetBulletProps(
TMobileObject *obj, const int z, const int dz, const BulletClass *b,
const int flags)
{
obj->bulletClass = b;
obj->updateFunc = UpdateBullet;
obj->tileItem.getPicFunc = NULL;
obj->tileItem.getActorPicsFunc = NULL;
obj->tileItem.drawFunc = NULL;
obj->tileItem.CPic = b->CPic;
obj->tileItem.CPicFunc = GetBulletDrawContext;
obj->z = z;
obj->dz = dz;
obj->range = RAND_INT(b->RangeLow, b->RangeHigh);
obj->flags = flags;
if (b->HurtAlways)
{
obj->flags |= FLAGS_HURTALWAYS;
}
obj->vel = Vec2iFull2Real(Vec2iScale(
obj->vel, RAND_INT(b->SpeedLow, b->SpeedHigh)));
if (b->SpeedScale)
{
obj->vel.y = obj->vel.y * TILE_HEIGHT / TILE_WIDTH;
}
obj->tileItem.w = b->Size.x;
obj->tileItem.h = b->Size.y;
obj->tileItem.ShadowSize = b->ShadowSize;
}
static Vec2i SeekTowards(
const Vec2i pos, const Vec2i vel, const double speedMin,
const Vec2i targetPos, const int seekFactor)
@@ -612,6 +582,30 @@ void BulletAdd(const AddBullet add)
const Vec2i pos = add.MuzzlePos;
TMobileObject *obj = CArrayGet(&gMobObjs, MobObjAdd(pos, add.PlayerIndex));
obj->vel = GetFullVectorsForRadians(add.Angle);
SetBulletProps(
obj, add.MuzzleHeight, add.Elevation, add.BulletClass, add.Flags);
obj->bulletClass = add.BulletClass;
obj->updateFunc = UpdateBullet;
obj->tileItem.getPicFunc = NULL;
obj->tileItem.getActorPicsFunc = NULL;
obj->tileItem.drawFunc = NULL;
obj->tileItem.CPic = obj->bulletClass->CPic;
obj->tileItem.CPicFunc = GetBulletDrawContext;
obj->z = add.MuzzleHeight;
obj->dz = add.Elevation;
obj->range = RAND_INT(
obj->bulletClass->RangeLow, obj->bulletClass->RangeHigh);
obj->flags = add.Flags;
if (obj->bulletClass->HurtAlways)
{
obj->flags |= FLAGS_HURTALWAYS;
}
obj->vel = Vec2iFull2Real(Vec2iScale(
obj->vel,
RAND_INT(obj->bulletClass->SpeedLow, obj->bulletClass->SpeedHigh)));
if (obj->bulletClass->SpeedScale)
{
obj->vel.y = obj->vel.y * TILE_HEIGHT / TILE_WIDTH;
}
obj->tileItem.w = obj->bulletClass->Size.x;
obj->tileItem.h = obj->bulletClass->Size.y;
obj->tileItem.ShadowSize = obj->bulletClass->ShadowSize;
}