View Issue Details

IDProjectCategoryView StatusLast Update
0005041The Dark ModCodingpublic12.08.2019 16:38
Reporterstgatilov Assigned Tostgatilov  
PrioritylowSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.07 
Target VersionTDM 2.08Fixed in VersionTDM 2.08 
Summary0005041: Resurrect projectile shooting "spread"
DescriptionThe issue is described at the beginning of this forum thread:
  http://forums.thedarkmod.com/index.php?/topic/20064-weapon-projectile-issue/

Original Doom 3 had shotguns. Shotguns had bullets randomly spread from main direction on every shot. In TDM, the spread deviation was commented out long time ago, so now it is impossible to create a shotgun as a custom-made weapon.
TagsNo tags attached.

Activities

stgatilov

stgatilov

12.08.2019 16:26

administrator   ~0011814

Duplicating from forums ():

The relevant code:
float spreadRad = DEG2RAD( spread );
for( i = 0; i < num_projectiles; i++ ) {
    ang = idMath::Sin( spreadRad * gameLocal.random.RandomFloat() );
    spin = (float)DEG2RAD( 360.0f ) * gameLocal.random.RandomFloat();
    //dir = playerViewAxis[ 0 ] + playerViewAxis[ 2 ] * ( ang * idMath::Sin( spin ) ) - playerViewAxis[ 1 ] * ( ang * idMath::Cos( spin ) );
    dir = muzzleAxis[ 0 ]; // Dram: Make the weapon shoot directly from the barrel bone. Found by Ishtvan
    if (projectileDef->dict.GetBool("fire_along_playerview", "0")) {
        // greebo: Fire the projectile along the playerview direction
        dir = playerViewAxis.ToAngles().ToForward();
    }

And the corresponding commit:
Revision: 1417
Author: dram
Date: 10 октября 2007 г. 13:08:24
Message:
-Changed weapon and player so that the arrow is launched from the muzzle angle rather then the player angle
-Changed the drifting to use 3 fracsins so that each axis is irrelevant of the other, thus giving a more random drifting
----
Modified : /trunk/game/player.cpp
Modified : /trunk/game/weapon.cpp
stgatilov

stgatilov

12.08.2019 16:37

administrator   ~0011815

Committed the fix in SVN rev 8259.

Depending on value of fire_along_playerview cvar, either muzzleAxis or playerViewAxis coordinate system is chosen.
Then spread perturbation is applied in this LCS in the same way ID originally did it.

I tested it on ordinary broadhead arrows with the following local changes in script/tdm_weapon_arrow.script:
   //Currently you can only fire one arrow at a time
  -#define ARROW_NUMPROJECTILES 1
  +#define ARROW_NUMPROJECTILES 10
@@ -179,7 +179,7 @@
  - spread = getFloatKey( "spread" );
  + spread = 20;//getFloatKey( "spread" );
Works perfectly well =)

Issue History

Date Modified Username Field Change
12.08.2019 16:25 stgatilov New Issue
12.08.2019 16:25 stgatilov Status new => assigned
12.08.2019 16:25 stgatilov Assigned To => stgatilov
12.08.2019 16:26 stgatilov Note Added: 0011814
12.08.2019 16:37 stgatilov Note Added: 0011815
12.08.2019 16:38 stgatilov Status assigned => resolved
12.08.2019 16:38 stgatilov Resolution open => fixed
12.08.2019 16:38 stgatilov Fixed in Version => TDM 2.08