error in pfuSmoke utility

New Message Reply Date view Thread view Subject view Author view

Todd Metivier (metivier++at++sanders.com)
Tue, 02 Aug 1994 13:13:37 -0400


There seems to be a slight error in the pfuSmoke
utility program smoke.c .

When you try and make a pfuSmoke of type PFUSMOKE_MISSLE,
the application will crash. This is because on line 178 in
smoke.c in the initPuff routine, pfScaleVec3 tries to use
a NULL pointer to a pfVec3 called rv. The vector rv is only
initialized if smoke->type is not PFUSMOKE_MISSLE as shown
below :

    /* Add random velocity modifier */
    if(smoke->type != PFUSMOKE_MISSLE)
    {
        rv = RAND_VEC3;
            pfAddScaledVec3(puff->direction, smoke->direction, .15f, rv);
    }
    else
            PFCOPY_VEC3(puff->direction, smoke->direction);

    pfScaleVec3(offset, smoke->expansion * smoke->radius * .05f, rv);
    PFADD_VEC3(puff->origin, puff->origin, offset);

This can be fixed by placing the last two lines of code inside
the if statement. These lines of code simply offset the puff
origins by random amounts. This presumable does not need to
happen for missile smoke.

fix :

    /* Add random velocity modifier */
    if(smoke->type != PFUSMOKE_MISSLE)
    {
        rv = RAND_VEC3;
            pfAddScaledVec3(puff->direction, smoke->direction, .15f, rv);
        pfScaleVec3(offset, smoke->expansion * smoke->radius * .05f, rv);
        PFADD_VEC3(puff->origin, puff->origin, offset);
    }
    else
            PFCOPY_VEC3(puff->direction, smoke->direction);

Todd Metivier | ARPA: metivier++at++sanders.com
Lockheed Sanders | UUCP: ...!uunet!sanders.com!metivier
PTP2-A001 |
65 River Road | Voice: (603) 885-9026
Hudson, NH 03051 | Fax: (603) 885-0631


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:26 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.