A_Fire(int height, int offset, int angleoffset)

Moderator: GZDoom Developers

Post Reply
Мichаеlis
Posts: 95
Joined: Thu Mar 18, 2010 12:36 pm

A_Fire(int height, int offset, int angleoffset)

Post by Мichаеlis »

This is a more or less obvious extension to A_Fire.
A_Fire already has ZOffset customizable, so this only makes this codepointer more generic.

Possible use is simulating linked actors (which are not supported in direct way). One of the possible workarounds is calling A_Fire every tic.
Personally I need this for my ZBlood+ mod.

Unfortunately, I am a complete n00b when it comes to anything SVN-related. I tried hard not to make any mistakes but I am unsure if this is all that should be updated.
Edit: I am particularly very unsure whether angleoffset should be added as it is now or whether it should be added to "an = (dest->angle + angleoffset) >> ANGLETOFINESHIFT"

Code: Select all

DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Fire)
{
    ACTION_PARAM_START(3);
    ACTION_PARAM_FIXED(height,0);
    ACTION_PARAM_FIXED(offset,1);
    ACTION_PARAM_FIXED(angleoffset,2);
    
    A_Fire(self, height, offset, angleoffset);
}

void A_Fire(AActor *self, int height, int offset, int angleoffset)
{
    AActor *dest;
    angle_t an;
                
    dest = self->tracer;
    if (dest == NULL || self->target == NULL)
        return;
                
    // don't move it if the vile lost sight
    if (!P_CheckSight (self->target, dest, 0) )
        return;

    an = dest->angle >> ANGLETOFINESHIFT;

    self->SetOrigin (dest->x + FixedMul ((24+offset)*FRACUNIT, finecosine[an+angleoffset]),
                     dest->y + FixedMul ((24+offset)*FRACUNIT, finesine[an+angleoffset]) ,
                     dest->z + height);
}
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_Fire(int height, int offset, int angleoffset)

Post by NeuralStunner »

You'll probably have to make it into a diff patch. (You'd have to ask someone if you don't know what that is, as I don't know that much either. :laff: )
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_Fire(int height, int offset, int angleoffset)

Post by Graf Zahl »

I thought this could be added but closer inspection shows that everything in here that was changed is wrong. Both the offset and the angleoffset are used in a way that doesn't work. So off this goes.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”