From: Dennis Schridde <[EMAIL PROTECTED]>
Reply-To: Development list <[email protected]>
To: Development list <[email protected]>
Subject: Re: [Warzone-dev] input.c changes and projectile.c fix
Date: Mon, 13 Nov 2006 20:39:40 +0100

Am Montag, 13. November 2006 19:38 schrieb zz zz:
> > > no,it's just 'reset' the hit bounding box's radius bonus to 1(no bonus)
> >
> >It just looked to me that wpRadius is set before entering the loop of
> >neighbours and is never after set back to the old value (dependend on the > >wpn), so for other neighbours it would still be 1. But maybe I am wrong,
> >was just a quick look.
>
> you are right,wpRadius is never set back to the old value,but it shouldnt
> be a big problem,since this function is called every game loop/frame.
I don't like the idea of letting a bug happen, because it's negative effects
might be minor... This leads to very ugly things as we should all know by
now.

--Dennis
ok fixed that,though there is a new problem:the structure 'height' in STRUCTURE struct is commented out by someone/unfinished,so some missile weapons might have problems hitting building with relatively low vector z.Not sure if I should re-add/finish the 'height' value though.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Index: projectile.c
===================================================================
--- projectile.c        (revision 487)
+++ projectile.c        (working copy)
@@ -853,44 +853,85 @@
                                }
                        }

-                       //Watermelon:dont apply the 'hitbox' bonus if the 
target is a building
                        if ( psTempObj->type == OBJ_STRUCTURE || 
psTempObj->type == OBJ_FEATURE)
                        {
-                               wpRadius = 1;
+                               //Watermelon:ignore oil resource and pickup
+                               if ( psTempObj->type == OBJ_FEATURE )
+                               {
+                                       if ( ((FEATURE 
*)psTempObj)->psStats->damageable == 0)
+                                       {
+                                               continue;
+                                       }
+                               }
                                //Watermelon:AA weapon shouldnt hit buildings
                                if ( psObj->psWStats->surfaceToAir == 
SHOOT_IN_AIR )
                                {
                                        continue;
                                }
-                       }

-                       xdiff = (SDWORD)psObj->x - (SDWORD)psTempObj->x;
-                       ydiff = (SDWORD)psObj->y - (SDWORD)psTempObj->y;
+                               xdiff = (SDWORD)psObj->x - (SDWORD)psTempObj->x;
+                               ydiff = (SDWORD)psObj->y - (SDWORD)psTempObj->y;
+                               zdiff = abs((SDWORD)psObj->z - 
(SDWORD)psTempObj->z);

- if ((xdiff*xdiff + ydiff*ydiff) < (wpRadius * (SDWORD)(establishTargetRadius(psTempObj)) * (SDWORD)(establishTargetRadius(psTempObj))) )
-                       {
-                               if ( psObj->psWStats->surfaceToAir == 
SHOOT_IN_AIR )
+ if ((xdiff*xdiff + ydiff*ydiff) < ((SDWORD)(establishTargetRadius(psTempObj)) * (SDWORD)(establishTargetRadius(psTempObj))) &&
+                                       zdiff < 20)
                                {
-                                       if (psTempObj->type == OBJ_DROID && 
!vtolDroid((DROID *)psTempObj))
+                                       if ( psObj->psWStats->surfaceToAir == 
SHOOT_IN_AIR )
                                        {
-                                               continue;
+                                               if (psTempObj->type == OBJ_DROID 
&& !vtolDroid((DROID *)psTempObj))
+                                               {
+                                                       continue;
+                                               }
                                        }
+
+                                       if (bPenetrate && psTempObj->type != 
OBJ_STRUCTURE)
+                                       {
+ if ( (abs(psObj->x - psObj->startX) + abs(psObj->y - psObj->startY)) > 100 && timeSoFar > 500)
+                                               {
+                                                       continue;
+                                               }
+                                               asWeap.nStat = psObj->psWStats 
- asWeaponStats;
+ proj_SendProjectile( &asWeap, (BASE_OBJECT*)psObj, psObj->player, (psObj->startX + (UDWORD)(extendRad * dx /rad)),(psObj->startY + (UDWORD)(extendRad * dy /rad)), psObj->z, NULL, TRUE, bPenetrate );
+                                       }
+
+                                       psNewTarget = psTempObj;
+                                       psObj->psDest = psNewTarget;
+                                       psObj->state = PROJ_IMPACT;
+                                       return;
                                }
+                       }
+                       else
+                       {
+                               xdiff = (SDWORD)psObj->x - (SDWORD)psTempObj->x;
+                               ydiff = (SDWORD)psObj->y - (SDWORD)psTempObj->y;
+                               zdiff = abs((SDWORD)psObj->z - 
(SDWORD)psTempObj->z);

-                               if (bPenetrate && psTempObj->type != 
OBJ_STRUCTURE)
+ if ((xdiff*xdiff + ydiff*ydiff) < (wpRadius * (SDWORD)(establishTargetRadius(psTempObj)) * (SDWORD)(establishTargetRadius(psTempObj))) &&
+                                       zdiff < 20)
                                {
- if ( (abs(psObj->x - psObj->startX) + abs(psObj->y - psObj->startY)) > 100 && timeSoFar > 500)
+                                       if ( psObj->psWStats->surfaceToAir == 
SHOOT_IN_AIR )
                                        {
-                                               continue;
+                                               if (psTempObj->type == OBJ_DROID 
&& !vtolDroid((DROID *)psTempObj))
+                                               {
+                                                       continue;
+                                               }
                                        }
-                                       asWeap.nStat = psObj->psWStats - 
asWeaponStats;
- proj_SendProjectile( &asWeap, (BASE_OBJECT*)psObj, psObj->player, (psObj->startX + (UDWORD)(extendRad * dx /rad)),(psObj->startY + (UDWORD)(extendRad * dy /rad)), psObj->z, NULL, TRUE, bPenetrate );
+
+                                       if (bPenetrate && psTempObj->type != 
OBJ_STRUCTURE)
+                                       {
+ if ( (abs(psObj->x - psObj->startX) + abs(psObj->y - psObj->startY)) > 100 && timeSoFar > 500)
+                                               {
+                                                       continue;
+                                               }
+                                               asWeap.nStat = psObj->psWStats 
- asWeaponStats;
+ proj_SendProjectile( &asWeap, (BASE_OBJECT*)psObj, psObj->player, (psObj->startX + (UDWORD)(extendRad * dx /rad)),(psObj->startY + (UDWORD)(extendRad * dy /rad)), psObj->z, NULL, TRUE, bPenetrate );
+                                       }
+
+                                       psNewTarget = psTempObj;
+                                       psObj->psDest = psNewTarget;
+                                       psObj->state = PROJ_IMPACT;
+                                       return;
                                }
-
-                               psNewTarget = psTempObj;
-                               psObj->psDest = psNewTarget;
-                               psObj->state = PROJ_IMPACT;
-                               return;
                        }
                }
        }
@@ -1098,23 +1139,45 @@
                        {
                                continue;
                        }
-                       xdiff = (SDWORD)psObj->x - (SDWORD)psTempObj->x;
-                       ydiff = (SDWORD)psObj->y - (SDWORD)psTempObj->y;
-                       zdiff = (SDWORD)psObj->z - (SDWORD)psTempObj->z;

-                       //Watermelon:dont apply the 'hitbox' bonus if the 
target is a building
-                       if ( psTempObj->type == OBJ_STRUCTURE )
+ if ( psTempObj->type == OBJ_STRUCTURE || psTempObj->type == OBJ_FEATURE )
                        {
-                               wpRadius = 1;
+                               //Watermelon:ignore oil resource and pickup
+                               if ( psTempObj->type == OBJ_FEATURE )
+                               {
+                                       if ( ((FEATURE 
*)psTempObj)->psStats->damageable == 0)
+                                       {
+                                               continue;
+                                       }
+                               }
+
+                               xdiff = (SDWORD)psObj->x - (SDWORD)psTempObj->x;
+                               ydiff = (SDWORD)psObj->y - (SDWORD)psTempObj->y;
+                               zdiff = (SDWORD)psObj->z - (SDWORD)psTempObj->z;
+
+ if ((xdiff*xdiff + ydiff*ydiff) < ((SDWORD)(establishTargetRadius(psTempObj)) * (SDWORD)(establishTargetRadius(psTempObj))) &&
+                                       zdiff < 20 )
+                               {
+                                       psNewTarget = psTempObj;
+                                       psObj->psDest = psNewTarget;
+                                       psObj->state = PROJ_IMPACT;
+                                       return;
+                               }
                        }
+                       else
+                       {
+                               xdiff = (SDWORD)psObj->x - (SDWORD)psTempObj->x;
+                               ydiff = (SDWORD)psObj->y - (SDWORD)psTempObj->y;
+                               zdiff = (SDWORD)psObj->z - (SDWORD)psTempObj->z;

- if ((xdiff*xdiff + ydiff*ydiff) < (wpRadius * (SDWORD)(establishTargetRadius(psTempObj)) * (SDWORD)(establishTargetRadius(psTempObj))) &&
-                               zdiff < 20 )
-                       {
-                               psNewTarget = psTempObj;
-                               psObj->psDest = psNewTarget;
-                               psObj->state = PROJ_IMPACT;
-                               return;
+ if ((xdiff*xdiff + ydiff*ydiff) < ((SDWORD)(establishTargetRadius(psTempObj)) * (SDWORD)(establishTargetRadius(psTempObj))) &&
+                                       zdiff < 20 )
+                               {
+                                       psNewTarget = psTempObj;
+                                       psObj->psDest = psNewTarget;
+                                       psObj->state = PROJ_IMPACT;
+                                       return;
+                               }
                        }
                }
        }
@@ -2370,3 +2433,4 @@
}


+

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to