Duke4.net Forums: Auto Aim still functioning for pistol and expander? - Duke4.net Forums

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Auto Aim still functioning for pistol and expander?

User is offline   Hendricks266 

  • Weaponized Autism

  #31

View PostHelixhorned, on 18 April 2015 - 01:42 PM, said:

For some reason, such a projectile will kill troopers with one shot.

Perhaps this line should Xcalloc instead:

g_tile[j].proj = (projectile_t *) Xmalloc(sizeof(projectile_t));


Spoiler

Either way, you would need to define PROJ_EXTRA and PROJ_EXTRA_RAND.

This post has been edited by Hendricks266: 18 April 2015 - 02:17 PM

0

User is offline   Helixhorned 

  • EDuke32 Developer

#32

View PostHendricks266, on 18 April 2015 - 01:52 PM, said:

Perhaps this line should Xcalloc instead:

g_tile[j].proj = (projectile_t *) Xmalloc(sizeof(projectile_t));


I don't think that's the issue. We copy DefaultProjectile into it right afterwards:
    if (g_tile[j].proj == NULL)
    {
        g_tile[j].proj = (projectile_t *) Xmalloc(sizeof(projectile_t));
        *g_tile[j].proj = *(projectile_t *)&DefaultProjectile;
        g_numProjectiles += 2;
    }

It's more that the default projectile's extra is 100. That thing is an amalgamation of different projectiles!

Quote

Either way, you would need to define PROJ_EXTRA and PROJ_EXTRA_RAND.

Right. "Extra" = health, one forgets this quickly :-/. This would make the first attempt as follows:

defineprojectile SHOTSPARK1 PROJ_WORKSLIKE 1  // NOTE: w/o PROJECTILE_ACCURATE_AUTOAIM
// (omitted properties hopefully same as hard-coded or unused ...)
// See A_Spawn()/BULLETHOLE__STATIC:
defineprojectile SHOTSPARK1 PROJ_XREPEAT 3
defineprojectile SHOTSPARK1 PROJ_YREPEAT 3
// (omitted properties hopefully same as hard-coded or unused ...)
defineprojectile SHOTSPARK1 PROJ_EXTRA PISTOL_WEAPON_STRENGTH  // <- def from USER.CON
defineprojectile SHOTSPARK1 PROJ_EXTRA_RAND 6
// (omitted properties hopefully same as hard-coded or unused ...)


However, omitting PROJECTILE_ACCURATE_AUTOAIM from PROJ_WORKSLIKE does not prevent auto-aim, which might be considered a bug. This is because in P_PreFireHitscan(), we call G_GetAutoAimAngle() unconditionally of the former:

// Prepare hitscan weapon fired from player p.
static void P_PreFireHitscan(int32_t i, int32_t p, int32_t atwith,
                             vec3_t *srcvect, int32_t *zvel, int16_t *sa,
                             int32_t accurate_autoaim_p,
                             int32_t not_accurate_p)
{
    int32_t angRange=32;
    int32_t zRange=256;

    int32_t j = GetAutoAimAngle(i, p, atwith, 5<<8, 0+1, srcvect, 256, zvel, sa);

// (...)


    if (accurate_autoaim_p)
    {
        if (!ps->auto_aim)
        {
(...)
        }

        if (j == -1)
        {
            *zvel = (100-ps->horiz-ps->horizoff)<<5;
            Proj_MaybeAddSpread(not_accurate_p, zvel, sa, zRange, angRange);
        }


Anyhow, for the problem at hand, setting AUTOAIMANGLE in EVENT_GETAUTOAIMANGLE is much more intuitive.
0

User is online   Danukem 

  • Duke Plus Developer

#33

View PostHelixhorned, on 18 April 2015 - 02:18 PM, said:

Anyhow, for the problem at hand, setting AUTOAIMANGLE in EVENT_GETAUTOAIMANGLE is much more intuitive.


That's all you have to do? :D

And I forgot that using a custom projectile would work as well. The sad thing is, I'm pretty sure I have actually used that method before (probably because TerminX suggested it when I asked) but it's been so long I had forgotten about it and assumed it wouldn't work.
0

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options